Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e5c21548
Commit
e5c21548
authored
Aug 08, 2016
by
Kris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate redundant dynamic client type
This will allow people to override the default parameter codec and still pass the resulting client with something that accepts *dynamic.Client.
parent
d9ce524d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
25 deletions
+10
-25
client.go
pkg/client/typed/dynamic/client.go
+10
-25
No files found.
pkg/client/typed/dynamic/client.go
View file @
e5c21548
...
@@ -40,11 +40,7 @@ import (
...
@@ -40,11 +40,7 @@ import (
// Client is a Kubernetes client that allows you to access metadata
// Client is a Kubernetes client that allows you to access metadata
// and manipulate metadata of a Kubernetes API group.
// and manipulate metadata of a Kubernetes API group.
type
Client
struct
{
type
Client
struct
{
cl
*
restclient
.
RESTClient
cl
*
restclient
.
RESTClient
}
type
ClientWithParameterCodec
struct
{
client
*
Client
parameterCodec
runtime
.
ParameterCodec
parameterCodec
runtime
.
ParameterCodec
}
}
...
@@ -85,35 +81,24 @@ func (c *Client) GetRateLimiter() flowcontrol.RateLimiter {
...
@@ -85,35 +81,24 @@ func (c *Client) GetRateLimiter() flowcontrol.RateLimiter {
// Resource returns an API interface to the specified resource for this client's
// Resource returns an API interface to the specified resource for this client's
// group and version. If resource is not a namespaced resource, then namespace
// group and version. If resource is not a namespaced resource, then namespace
// is ignored.
// is ignored.
The ResourceClient inherits the parameter codec of c.
func
(
c
*
Client
)
Resource
(
resource
*
unversioned
.
APIResource
,
namespace
string
)
*
ResourceClient
{
func
(
c
*
Client
)
Resource
(
resource
*
unversioned
.
APIResource
,
namespace
string
)
*
ResourceClient
{
return
&
ResourceClient
{
return
&
ResourceClient
{
cl
:
c
.
cl
,
cl
:
c
.
cl
,
resource
:
resource
,
resource
:
resource
,
ns
:
namespace
,
ns
:
namespace
,
parameterCodec
:
c
.
parameterCodec
,
}
}
}
}
// ParameterCodec
wraps a parameterCodec around the Client
.
// ParameterCodec
returns a client with the provided parameter codec
.
func
(
c
*
Client
)
ParameterCodec
(
parameterCodec
runtime
.
ParameterCodec
)
*
Client
WithParameterCodec
{
func
(
c
*
Client
)
ParameterCodec
(
parameterCodec
runtime
.
ParameterCodec
)
*
Client
{
return
&
Client
WithParameterCodec
{
return
&
Client
{
cl
ient
:
c
,
cl
:
c
.
cl
,
parameterCodec
:
parameterCodec
,
parameterCodec
:
parameterCodec
,
}
}
}
}
// Resource returns an API interface to the specified resource for this client's
// group and version. If resource is not a namespaced resource, then namespace
// is ignored. The ResourceClient inherits the parameter codec of c.
func
(
c
*
ClientWithParameterCodec
)
Resource
(
resource
*
unversioned
.
APIResource
,
namespace
string
)
*
ResourceClient
{
return
&
ResourceClient
{
cl
:
c
.
client
.
cl
,
resource
:
resource
,
ns
:
namespace
,
parameterCodec
:
c
.
parameterCodec
,
}
}
// ResourceClient is an API interface to a specific resource under a
// ResourceClient is an API interface to a specific resource under a
// dynamic client.
// dynamic client.
type
ResourceClient
struct
{
type
ResourceClient
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment