mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
add nonNamespaced comment tag; change the interface name
This commit is contained in:
parent
b7438274dc
commit
ec9771ccb6
@ -89,7 +89,13 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
|
|||||||
"type": t,
|
"type": t,
|
||||||
"Group": namer.IC(g.group),
|
"Group": namer.IC(g.group),
|
||||||
}
|
}
|
||||||
sw.Do(namespacerImplTemplate, wrapper)
|
namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true")
|
||||||
|
if namespaced {
|
||||||
|
sw.Do(getterImplNamespaced, wrapper)
|
||||||
|
} else {
|
||||||
|
sw.Do(getterImplNonNamespaced, wrapper)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sw.Do(newClientForConfigTemplate, m)
|
sw.Do(newClientForConfigTemplate, m)
|
||||||
sw.Do(newClientForConfigOrDieTemplate, m)
|
sw.Do(newClientForConfigOrDieTemplate, m)
|
||||||
@ -101,7 +107,7 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
|
|||||||
|
|
||||||
var groupInterfaceTemplate = `
|
var groupInterfaceTemplate = `
|
||||||
type $.Group$Interface interface {
|
type $.Group$Interface interface {
|
||||||
$range .types$ $.Name.Name$Namespacer
|
$range .types$ $.|publicPlural$Getter
|
||||||
$end$
|
$end$
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@ -113,12 +119,18 @@ type $.Group$Client struct {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
var namespacerImplTemplate = `
|
var getterImplNamespaced = `
|
||||||
func (c *$.Group$Client) $.type|publicPlural$(namespace string) $.type.Name.Name$Interface {
|
func (c *$.Group$Client) $.type|publicPlural$(namespace string) $.type|public$Interface {
|
||||||
return new$.type|publicPlural$(c, namespace)
|
return new$.type|publicPlural$(c, namespace)
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var getterImplNonNamespaced = `
|
||||||
|
func (c *$.Group$Client) $.type|publicPlural$() $.type|public$Interface {
|
||||||
|
return new$.type|publicPlural$(c)
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
var newClientForConfigTemplate = `
|
var newClientForConfigTemplate = `
|
||||||
// NewForConfig creates a new $.Group$Client for the given config.
|
// NewForConfig creates a new $.Group$Client for the given config.
|
||||||
func NewForConfig(c *$.Config|raw$) (*$.Group$Client, error) {
|
func NewForConfig(c *$.Config|raw$) (*$.Group$Client, error) {
|
||||||
|
@ -66,6 +66,7 @@ func hasStatus(t *types.Type) bool {
|
|||||||
func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
||||||
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
sw := generator.NewSnippetWriter(w, c, "$", "$")
|
||||||
pkg := filepath.Base(t.Name.Package)
|
pkg := filepath.Base(t.Name.Package)
|
||||||
|
namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true")
|
||||||
m := map[string]interface{}{
|
m := map[string]interface{}{
|
||||||
"type": t,
|
"type": t,
|
||||||
"package": pkg,
|
"package": pkg,
|
||||||
@ -74,16 +75,28 @@ func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w i
|
|||||||
"watchInterface": c.Universe.Type(types.Name{Package: "k8s.io/kubernetes/pkg/watch", Name: "Interface"}),
|
"watchInterface": c.Universe.Type(types.Name{Package: "k8s.io/kubernetes/pkg/watch", Name: "Interface"}),
|
||||||
"apiDeleteOptions": c.Universe.Type(types.Name{Package: "k8s.io/kubernetes/pkg/api", Name: "DeleteOptions"}),
|
"apiDeleteOptions": c.Universe.Type(types.Name{Package: "k8s.io/kubernetes/pkg/api", Name: "DeleteOptions"}),
|
||||||
"apiListOptions": c.Universe.Type(types.Name{Package: "k8s.io/kubernetes/pkg/api", Name: "ListOptions"}),
|
"apiListOptions": c.Universe.Type(types.Name{Package: "k8s.io/kubernetes/pkg/api", Name: "ListOptions"}),
|
||||||
|
"namespaced": namespaced,
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.Do(getterComment, m)
|
||||||
|
if namespaced {
|
||||||
|
sw.Do(getterNamesapced, m)
|
||||||
|
} else {
|
||||||
|
sw.Do(getterNonNamesapced, m)
|
||||||
}
|
}
|
||||||
sw.Do(namespacerTemplate, m)
|
|
||||||
sw.Do(interfaceTemplate1, m)
|
sw.Do(interfaceTemplate1, m)
|
||||||
// Include the UpdateStatus method if the type has a status
|
// Include the UpdateStatus method if the type has a status
|
||||||
if hasStatus(t) {
|
if hasStatus(t) {
|
||||||
sw.Do(interfaceUpdateStatusTemplate, m)
|
sw.Do(interfaceUpdateStatusTemplate, m)
|
||||||
}
|
}
|
||||||
sw.Do(interfaceTemplate2, m)
|
sw.Do(interfaceTemplate2, m)
|
||||||
sw.Do(structTemplate, m)
|
if namespaced {
|
||||||
sw.Do(newStructTemplate, m)
|
sw.Do(structNamespaced, m)
|
||||||
|
sw.Do(newStructNamespaced, m)
|
||||||
|
} else {
|
||||||
|
sw.Do(structNonNamespaced, m)
|
||||||
|
sw.Do(newStructNonNamespaced, m)
|
||||||
|
}
|
||||||
sw.Do(createTemplate, m)
|
sw.Do(createTemplate, m)
|
||||||
sw.Do(updateTemplate, m)
|
sw.Do(updateTemplate, m)
|
||||||
// Generate the UpdateStatus method if the type has a status
|
// Generate the UpdateStatus method if the type has a status
|
||||||
@ -99,15 +112,24 @@ func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w i
|
|||||||
return sw.Error()
|
return sw.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
// template for namespacer
|
// group client will implement this interface.
|
||||||
var namespacerTemplate = `
|
var getterComment = `
|
||||||
// $.type|public$Namespacer has methods to work with $.type|public$ resources in a namespace
|
// $.type|publicPlural$Getter has a method to return a $.type|public$Interface.
|
||||||
type $.type|public$Namespacer interface {
|
// A group's client should implement this interface.`
|
||||||
|
|
||||||
|
var getterNamesapced = `
|
||||||
|
type $.type|publicPlural$Getter interface {
|
||||||
$.type|publicPlural$(namespace string) $.type|public$Interface
|
$.type|publicPlural$(namespace string) $.type|public$Interface
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
// template for the Interface
|
var getterNonNamesapced = `
|
||||||
|
type $.type|publicPlural$Getter interface {
|
||||||
|
$.type|publicPlural$() $.type|public$Interface
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
// this type's interface, typed client will implement this interface.
|
||||||
var interfaceTemplate1 = `
|
var interfaceTemplate1 = `
|
||||||
// $.type|public$Interface has methods to work with $.type|public$ resources.
|
// $.type|public$Interface has methods to work with $.type|public$ resources.
|
||||||
type $.type|public$Interface interface {
|
type $.type|public$Interface interface {
|
||||||
@ -128,15 +150,24 @@ var interfaceTemplate2 = `
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
// template for the struct that implements the interface
|
// template for the struct that implements the type's interface
|
||||||
var structTemplate = `
|
var structNamespaced = `
|
||||||
// $.type|privatePlural$ implements $.type|public$Interface
|
// $.type|privatePlural$ implements $.type|public$Interface
|
||||||
type $.type|privatePlural$ struct {
|
type $.type|privatePlural$ struct {
|
||||||
client *$.Group$Client
|
client *$.Group$Client
|
||||||
ns string
|
ns string
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
var newStructTemplate = `
|
|
||||||
|
// template for the struct that implements the type's interface
|
||||||
|
var structNonNamespaced = `
|
||||||
|
// $.type|privatePlural$ implements $.type|public$Interface
|
||||||
|
type $.type|privatePlural$ struct {
|
||||||
|
client *$.Group$Client
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
var newStructNamespaced = `
|
||||||
// new$.type|publicPlural$ returns a $.type|publicPlural$
|
// new$.type|publicPlural$ returns a $.type|publicPlural$
|
||||||
func new$.type|publicPlural$(c *$.Group$Client, namespace string) *$.type|privatePlural$ {
|
func new$.type|publicPlural$(c *$.Group$Client, namespace string) *$.type|privatePlural$ {
|
||||||
return &$.type|privatePlural${
|
return &$.type|privatePlural${
|
||||||
@ -145,12 +176,22 @@ func new$.type|publicPlural$(c *$.Group$Client, namespace string) *$.type|privat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var newStructNonNamespaced = `
|
||||||
|
// new$.type|publicPlural$ returns a $.type|publicPlural$
|
||||||
|
func new$.type|publicPlural$(c *$.Group$Client) *$.type|privatePlural$ {
|
||||||
|
return &$.type|privatePlural${
|
||||||
|
client: c,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
var listTemplate = `
|
var listTemplate = `
|
||||||
// List takes label and field selectors, and returns the list of $.type|publicPlural$ that match those selectors.
|
// List takes label and field selectors, and returns the list of $.type|publicPlural$ that match those selectors.
|
||||||
func (c *$.type|privatePlural$) List(opts $.apiListOptions|raw$) (result *$.type|raw$List, err error) {
|
func (c *$.type|privatePlural$) List(opts $.apiListOptions|raw$) (result *$.type|raw$List, err error) {
|
||||||
result = &$.type|raw$List{}
|
result = &$.type|raw$List{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Do().
|
Do().
|
||||||
@ -163,7 +204,7 @@ var getTemplate = `
|
|||||||
func (c *$.type|privatePlural$) Get(name string) (result *$.type|raw$, err error) {
|
func (c *$.type|privatePlural$) Get(name string) (result *$.type|raw$, err error) {
|
||||||
result = &$.type|raw${}
|
result = &$.type|raw${}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
Name(name).
|
Name(name).
|
||||||
Do().
|
Do().
|
||||||
@ -176,7 +217,7 @@ var deleteTemplate = `
|
|||||||
// Delete takes name of the $.type|private$ and deletes it. Returns an error if one occurs.
|
// Delete takes name of the $.type|private$ and deletes it. Returns an error if one occurs.
|
||||||
func (c *$.type|privatePlural$) Delete(name string, options *$.apiDeleteOptions|raw$) error {
|
func (c *$.type|privatePlural$) Delete(name string, options *$.apiDeleteOptions|raw$) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -189,7 +230,7 @@ var deleteCollectionTemplate = `
|
|||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *$.type|privatePlural$) DeleteCollection(options *$.apiDeleteOptions|raw$, listOptions $.apiListOptions|raw$) error {
|
func (c *$.type|privatePlural$) DeleteCollection(options *$.apiDeleteOptions|raw$, listOptions $.apiListOptions|raw$) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
VersionedParams(&listOptions, api.Scheme).
|
VersionedParams(&listOptions, api.Scheme).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -203,7 +244,7 @@ var createTemplate = `
|
|||||||
func (c *$.type|privatePlural$) Create($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) {
|
func (c *$.type|privatePlural$) Create($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) {
|
||||||
result = &$.type|raw${}
|
result = &$.type|raw${}
|
||||||
err = c.client.Post().
|
err = c.client.Post().
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
Body($.type|private$).
|
Body($.type|private$).
|
||||||
Do().
|
Do().
|
||||||
@ -217,7 +258,7 @@ var updateTemplate = `
|
|||||||
func (c *$.type|privatePlural$) Update($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) {
|
func (c *$.type|privatePlural$) Update($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) {
|
||||||
result = &$.type|raw${}
|
result = &$.type|raw${}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
Name($.type|private$.Name).
|
Name($.type|private$.Name).
|
||||||
Body($.type|private$).
|
Body($.type|private$).
|
||||||
@ -240,7 +281,7 @@ var watchTemplate = `
|
|||||||
func (c *$.type|privatePlural$) Watch(opts $.apiListOptions|raw$) ($.watchInterface|raw$, error) {
|
func (c *$.type|privatePlural$) Watch(opts $.apiListOptions|raw$) ($.watchInterface|raw$, error) {
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Prefix("watch").
|
Prefix("watch").
|
||||||
Namespace(c.ns).
|
$if .namespaced$Namespace(c.ns).$end$
|
||||||
Resource("$.type|privatePlural$").
|
Resource("$.type|privatePlural$").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Watch()
|
Watch()
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type TestgroupInterface interface {
|
type TestgroupInterface interface {
|
||||||
TestTypeNamespacer
|
TestTypesGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestgroupClient is used to interact with features provided by the Testgroup group.
|
// TestgroupClient is used to interact with features provided by the Testgroup group.
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTypeNamespacer has methods to work with TestType resources in a namespace
|
// TestTypesGetter has a method to return a TestTypeInterface.
|
||||||
type TestTypeNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type TestTypesGetter interface {
|
||||||
TestTypes(namespace string) TestTypeInterface
|
TestTypes(namespace string) TestTypeInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ type PersistentVolumeClaimVolumeSource struct {
|
|||||||
ReadOnly bool `json:"readOnly,omitempty"`
|
ReadOnly bool `json:"readOnly,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient=true
|
// +genclient=true,nonNamespaced=true
|
||||||
|
|
||||||
type PersistentVolume struct {
|
type PersistentVolume struct {
|
||||||
unversioned.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
@ -1629,7 +1629,7 @@ const (
|
|||||||
// ResourceList is a set of (resource name, quantity) pairs.
|
// ResourceList is a set of (resource name, quantity) pairs.
|
||||||
type ResourceList map[ResourceName]resource.Quantity
|
type ResourceList map[ResourceName]resource.Quantity
|
||||||
|
|
||||||
// +genclient=true
|
// +genclient=true,nonNamespaced=true
|
||||||
|
|
||||||
// Node is a worker node in Kubernetes
|
// Node is a worker node in Kubernetes
|
||||||
// The name of the node according to etcd is in ObjectMeta.Name.
|
// The name of the node according to etcd is in ObjectMeta.Name.
|
||||||
@ -1681,7 +1681,7 @@ const (
|
|||||||
NamespaceTerminating NamespacePhase = "Terminating"
|
NamespaceTerminating NamespacePhase = "Terminating"
|
||||||
)
|
)
|
||||||
|
|
||||||
// +genclient=true
|
// +genclient=true,nonNamespaced=true
|
||||||
|
|
||||||
// A namespace provides a scope for Names.
|
// A namespace provides a scope for Names.
|
||||||
// Use of multiple namespaces is optional
|
// Use of multiple namespaces is optional
|
||||||
@ -2174,7 +2174,7 @@ type ComponentCondition struct {
|
|||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient=true
|
// +genclient=true,nonNamespaced=true
|
||||||
|
|
||||||
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
||||||
type ComponentStatus struct {
|
type ComponentStatus struct {
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DaemonSetNamespacer has methods to work with DaemonSet resources in a namespace
|
// DaemonSetsGetter has a method to return a DaemonSetInterface.
|
||||||
type DaemonSetNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type DaemonSetsGetter interface {
|
||||||
DaemonSets(namespace string) DaemonSetInterface
|
DaemonSets(namespace string) DaemonSetInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeploymentNamespacer has methods to work with Deployment resources in a namespace
|
// DeploymentsGetter has a method to return a DeploymentInterface.
|
||||||
type DeploymentNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type DeploymentsGetter interface {
|
||||||
Deployments(namespace string) DeploymentInterface
|
Deployments(namespace string) DeploymentInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ExtensionsInterface interface {
|
type ExtensionsInterface interface {
|
||||||
DaemonSetNamespacer
|
DaemonSetsGetter
|
||||||
DeploymentNamespacer
|
DeploymentsGetter
|
||||||
HorizontalPodAutoscalerNamespacer
|
HorizontalPodAutoscalersGetter
|
||||||
IngressNamespacer
|
IngressesGetter
|
||||||
JobNamespacer
|
JobsGetter
|
||||||
ThirdPartyResourceNamespacer
|
ThirdPartyResourcesGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtensionsClient is used to interact with features provided by the Extensions group.
|
// ExtensionsClient is used to interact with features provided by the Extensions group.
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HorizontalPodAutoscalerNamespacer has methods to work with HorizontalPodAutoscaler resources in a namespace
|
// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface.
|
||||||
type HorizontalPodAutoscalerNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type HorizontalPodAutoscalersGetter interface {
|
||||||
HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
|
HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IngressNamespacer has methods to work with Ingress resources in a namespace
|
// IngressesGetter has a method to return a IngressInterface.
|
||||||
type IngressNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type IngressesGetter interface {
|
||||||
Ingresses(namespace string) IngressInterface
|
Ingresses(namespace string) IngressInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// JobNamespacer has methods to work with Job resources in a namespace
|
// JobsGetter has a method to return a JobInterface.
|
||||||
type JobNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type JobsGetter interface {
|
||||||
Jobs(namespace string) JobInterface
|
Jobs(namespace string) JobInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace
|
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
|
||||||
type ThirdPartyResourceNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type ThirdPartyResourcesGetter interface {
|
||||||
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
|
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ComponentStatusNamespacer has methods to work with ComponentStatus resources in a namespace
|
// ComponentStatusGetter has a method to return a ComponentStatusInterface.
|
||||||
type ComponentStatusNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
ComponentStatus(namespace string) ComponentStatusInterface
|
type ComponentStatusGetter interface {
|
||||||
|
ComponentStatus() ComponentStatusInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComponentStatusInterface has methods to work with ComponentStatus resources.
|
// ComponentStatusInterface has methods to work with ComponentStatus resources.
|
||||||
@ -41,14 +42,12 @@ type ComponentStatusInterface interface {
|
|||||||
// componentStatus implements ComponentStatusInterface
|
// componentStatus implements ComponentStatusInterface
|
||||||
type componentStatus struct {
|
type componentStatus struct {
|
||||||
client *LegacyClient
|
client *LegacyClient
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newComponentStatus returns a ComponentStatus
|
// newComponentStatus returns a ComponentStatus
|
||||||
func newComponentStatus(c *LegacyClient, namespace string) *componentStatus {
|
func newComponentStatus(c *LegacyClient) *componentStatus {
|
||||||
return &componentStatus{
|
return &componentStatus{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +55,6 @@ func newComponentStatus(c *LegacyClient, namespace string) *componentStatus {
|
|||||||
func (c *componentStatus) Create(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) {
|
func (c *componentStatus) Create(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) {
|
||||||
result = &api.ComponentStatus{}
|
result = &api.ComponentStatus{}
|
||||||
err = c.client.Post().
|
err = c.client.Post().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
Body(componentStatus).
|
Body(componentStatus).
|
||||||
Do().
|
Do().
|
||||||
@ -68,7 +66,6 @@ func (c *componentStatus) Create(componentStatus *api.ComponentStatus) (result *
|
|||||||
func (c *componentStatus) Update(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) {
|
func (c *componentStatus) Update(componentStatus *api.ComponentStatus) (result *api.ComponentStatus, err error) {
|
||||||
result = &api.ComponentStatus{}
|
result = &api.ComponentStatus{}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
Name(componentStatus.Name).
|
Name(componentStatus.Name).
|
||||||
Body(componentStatus).
|
Body(componentStatus).
|
||||||
@ -80,7 +77,6 @@ func (c *componentStatus) Update(componentStatus *api.ComponentStatus) (result *
|
|||||||
// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs.
|
// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs.
|
||||||
func (c *componentStatus) Delete(name string, options *api.DeleteOptions) error {
|
func (c *componentStatus) Delete(name string, options *api.DeleteOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -91,7 +87,6 @@ func (c *componentStatus) Delete(name string, options *api.DeleteOptions) error
|
|||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *componentStatus) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
func (c *componentStatus) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
VersionedParams(&listOptions, api.Scheme).
|
VersionedParams(&listOptions, api.Scheme).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -103,7 +98,6 @@ func (c *componentStatus) DeleteCollection(options *api.DeleteOptions, listOptio
|
|||||||
func (c *componentStatus) Get(name string) (result *api.ComponentStatus, err error) {
|
func (c *componentStatus) Get(name string) (result *api.ComponentStatus, err error) {
|
||||||
result = &api.ComponentStatus{}
|
result = &api.ComponentStatus{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
Name(name).
|
Name(name).
|
||||||
Do().
|
Do().
|
||||||
@ -115,7 +109,6 @@ func (c *componentStatus) Get(name string) (result *api.ComponentStatus, err err
|
|||||||
func (c *componentStatus) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) {
|
func (c *componentStatus) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) {
|
||||||
result = &api.ComponentStatusList{}
|
result = &api.ComponentStatusList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Do().
|
Do().
|
||||||
@ -127,7 +120,6 @@ func (c *componentStatus) List(opts api.ListOptions) (result *api.ComponentStatu
|
|||||||
func (c *componentStatus) Watch(opts api.ListOptions) (watch.Interface, error) {
|
func (c *componentStatus) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Prefix("watch").
|
Prefix("watch").
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("componentStatus").
|
Resource("componentStatus").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Watch()
|
Watch()
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EndpointsNamespacer has methods to work with Endpoints resources in a namespace
|
// EndpointsGetter has a method to return a EndpointsInterface.
|
||||||
type EndpointsNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type EndpointsGetter interface {
|
||||||
Endpoints(namespace string) EndpointsInterface
|
Endpoints(namespace string) EndpointsInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EventNamespacer has methods to work with Event resources in a namespace
|
// EventsGetter has a method to return a EventInterface.
|
||||||
type EventNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type EventsGetter interface {
|
||||||
Events(namespace string) EventInterface
|
Events(namespace string) EventInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,21 +23,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type LegacyInterface interface {
|
type LegacyInterface interface {
|
||||||
ComponentStatusNamespacer
|
ComponentStatusGetter
|
||||||
EndpointsNamespacer
|
EndpointsGetter
|
||||||
EventNamespacer
|
EventsGetter
|
||||||
LimitRangeNamespacer
|
LimitRangesGetter
|
||||||
NamespaceNamespacer
|
NamespacesGetter
|
||||||
NodeNamespacer
|
NodesGetter
|
||||||
PersistentVolumeNamespacer
|
PersistentVolumesGetter
|
||||||
PersistentVolumeClaimNamespacer
|
PersistentVolumeClaimsGetter
|
||||||
PodNamespacer
|
PodsGetter
|
||||||
PodTemplateNamespacer
|
PodTemplatesGetter
|
||||||
ReplicationControllerNamespacer
|
ReplicationControllersGetter
|
||||||
ResourceQuotaNamespacer
|
ResourceQuotasGetter
|
||||||
SecretNamespacer
|
SecretsGetter
|
||||||
ServiceNamespacer
|
ServicesGetter
|
||||||
ServiceAccountNamespacer
|
ServiceAccountsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
// LegacyClient is used to interact with features provided by the Legacy group.
|
// LegacyClient is used to interact with features provided by the Legacy group.
|
||||||
@ -45,8 +45,8 @@ type LegacyClient struct {
|
|||||||
*unversioned.RESTClient
|
*unversioned.RESTClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LegacyClient) ComponentStatus(namespace string) ComponentStatusInterface {
|
func (c *LegacyClient) ComponentStatus() ComponentStatusInterface {
|
||||||
return newComponentStatus(c, namespace)
|
return newComponentStatus(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LegacyClient) Endpoints(namespace string) EndpointsInterface {
|
func (c *LegacyClient) Endpoints(namespace string) EndpointsInterface {
|
||||||
@ -61,16 +61,16 @@ func (c *LegacyClient) LimitRanges(namespace string) LimitRangeInterface {
|
|||||||
return newLimitRanges(c, namespace)
|
return newLimitRanges(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LegacyClient) Namespaces(namespace string) NamespaceInterface {
|
func (c *LegacyClient) Namespaces() NamespaceInterface {
|
||||||
return newNamespaces(c, namespace)
|
return newNamespaces(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LegacyClient) Nodes(namespace string) NodeInterface {
|
func (c *LegacyClient) Nodes() NodeInterface {
|
||||||
return newNodes(c, namespace)
|
return newNodes(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LegacyClient) PersistentVolumes(namespace string) PersistentVolumeInterface {
|
func (c *LegacyClient) PersistentVolumes() PersistentVolumeInterface {
|
||||||
return newPersistentVolumes(c, namespace)
|
return newPersistentVolumes(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LegacyClient) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface {
|
func (c *LegacyClient) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface {
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LimitRangeNamespacer has methods to work with LimitRange resources in a namespace
|
// LimitRangesGetter has a method to return a LimitRangeInterface.
|
||||||
type LimitRangeNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type LimitRangesGetter interface {
|
||||||
LimitRanges(namespace string) LimitRangeInterface
|
LimitRanges(namespace string) LimitRangeInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NamespaceNamespacer has methods to work with Namespace resources in a namespace
|
// NamespacesGetter has a method to return a NamespaceInterface.
|
||||||
type NamespaceNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
Namespaces(namespace string) NamespaceInterface
|
type NamespacesGetter interface {
|
||||||
|
Namespaces() NamespaceInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// NamespaceInterface has methods to work with Namespace resources.
|
// NamespaceInterface has methods to work with Namespace resources.
|
||||||
@ -42,14 +43,12 @@ type NamespaceInterface interface {
|
|||||||
// namespaces implements NamespaceInterface
|
// namespaces implements NamespaceInterface
|
||||||
type namespaces struct {
|
type namespaces struct {
|
||||||
client *LegacyClient
|
client *LegacyClient
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newNamespaces returns a Namespaces
|
// newNamespaces returns a Namespaces
|
||||||
func newNamespaces(c *LegacyClient, namespace string) *namespaces {
|
func newNamespaces(c *LegacyClient) *namespaces {
|
||||||
return &namespaces{
|
return &namespaces{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ func newNamespaces(c *LegacyClient, namespace string) *namespaces {
|
|||||||
func (c *namespaces) Create(namespace *api.Namespace) (result *api.Namespace, err error) {
|
func (c *namespaces) Create(namespace *api.Namespace) (result *api.Namespace, err error) {
|
||||||
result = &api.Namespace{}
|
result = &api.Namespace{}
|
||||||
err = c.client.Post().
|
err = c.client.Post().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
Body(namespace).
|
Body(namespace).
|
||||||
Do().
|
Do().
|
||||||
@ -69,7 +67,6 @@ func (c *namespaces) Create(namespace *api.Namespace) (result *api.Namespace, er
|
|||||||
func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) {
|
func (c *namespaces) Update(namespace *api.Namespace) (result *api.Namespace, err error) {
|
||||||
result = &api.Namespace{}
|
result = &api.Namespace{}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
Name(namespace.Name).
|
Name(namespace.Name).
|
||||||
Body(namespace).
|
Body(namespace).
|
||||||
@ -87,7 +84,6 @@ func (c *namespaces) UpdateStatus(namespace *api.Namespace) (*api.Namespace, err
|
|||||||
// Delete takes name of the namespace and deletes it. Returns an error if one occurs.
|
// Delete takes name of the namespace and deletes it. Returns an error if one occurs.
|
||||||
func (c *namespaces) Delete(name string, options *api.DeleteOptions) error {
|
func (c *namespaces) Delete(name string, options *api.DeleteOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -98,7 +94,6 @@ func (c *namespaces) Delete(name string, options *api.DeleteOptions) error {
|
|||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *namespaces) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
func (c *namespaces) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
VersionedParams(&listOptions, api.Scheme).
|
VersionedParams(&listOptions, api.Scheme).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -110,7 +105,6 @@ func (c *namespaces) DeleteCollection(options *api.DeleteOptions, listOptions ap
|
|||||||
func (c *namespaces) Get(name string) (result *api.Namespace, err error) {
|
func (c *namespaces) Get(name string) (result *api.Namespace, err error) {
|
||||||
result = &api.Namespace{}
|
result = &api.Namespace{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
Name(name).
|
Name(name).
|
||||||
Do().
|
Do().
|
||||||
@ -122,7 +116,6 @@ func (c *namespaces) Get(name string) (result *api.Namespace, err error) {
|
|||||||
func (c *namespaces) List(opts api.ListOptions) (result *api.NamespaceList, err error) {
|
func (c *namespaces) List(opts api.ListOptions) (result *api.NamespaceList, err error) {
|
||||||
result = &api.NamespaceList{}
|
result = &api.NamespaceList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Do().
|
Do().
|
||||||
@ -134,7 +127,6 @@ func (c *namespaces) List(opts api.ListOptions) (result *api.NamespaceList, err
|
|||||||
func (c *namespaces) Watch(opts api.ListOptions) (watch.Interface, error) {
|
func (c *namespaces) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Prefix("watch").
|
Prefix("watch").
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("namespaces").
|
Resource("namespaces").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Watch()
|
Watch()
|
||||||
|
@ -21,9 +21,10 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeNamespacer has methods to work with Node resources in a namespace
|
// NodesGetter has a method to return a NodeInterface.
|
||||||
type NodeNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
Nodes(namespace string) NodeInterface
|
type NodesGetter interface {
|
||||||
|
Nodes() NodeInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeInterface has methods to work with Node resources.
|
// NodeInterface has methods to work with Node resources.
|
||||||
@ -42,14 +43,12 @@ type NodeInterface interface {
|
|||||||
// nodes implements NodeInterface
|
// nodes implements NodeInterface
|
||||||
type nodes struct {
|
type nodes struct {
|
||||||
client *LegacyClient
|
client *LegacyClient
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newNodes returns a Nodes
|
// newNodes returns a Nodes
|
||||||
func newNodes(c *LegacyClient, namespace string) *nodes {
|
func newNodes(c *LegacyClient) *nodes {
|
||||||
return &nodes{
|
return &nodes{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ func newNodes(c *LegacyClient, namespace string) *nodes {
|
|||||||
func (c *nodes) Create(node *api.Node) (result *api.Node, err error) {
|
func (c *nodes) Create(node *api.Node) (result *api.Node, err error) {
|
||||||
result = &api.Node{}
|
result = &api.Node{}
|
||||||
err = c.client.Post().
|
err = c.client.Post().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
Body(node).
|
Body(node).
|
||||||
Do().
|
Do().
|
||||||
@ -69,7 +67,6 @@ func (c *nodes) Create(node *api.Node) (result *api.Node, err error) {
|
|||||||
func (c *nodes) Update(node *api.Node) (result *api.Node, err error) {
|
func (c *nodes) Update(node *api.Node) (result *api.Node, err error) {
|
||||||
result = &api.Node{}
|
result = &api.Node{}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
Name(node.Name).
|
Name(node.Name).
|
||||||
Body(node).
|
Body(node).
|
||||||
@ -87,7 +84,6 @@ func (c *nodes) UpdateStatus(node *api.Node) (*api.Node, error) {
|
|||||||
// Delete takes name of the node and deletes it. Returns an error if one occurs.
|
// Delete takes name of the node and deletes it. Returns an error if one occurs.
|
||||||
func (c *nodes) Delete(name string, options *api.DeleteOptions) error {
|
func (c *nodes) Delete(name string, options *api.DeleteOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -98,7 +94,6 @@ func (c *nodes) Delete(name string, options *api.DeleteOptions) error {
|
|||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *nodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
func (c *nodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
VersionedParams(&listOptions, api.Scheme).
|
VersionedParams(&listOptions, api.Scheme).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -110,7 +105,6 @@ func (c *nodes) DeleteCollection(options *api.DeleteOptions, listOptions api.Lis
|
|||||||
func (c *nodes) Get(name string) (result *api.Node, err error) {
|
func (c *nodes) Get(name string) (result *api.Node, err error) {
|
||||||
result = &api.Node{}
|
result = &api.Node{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
Name(name).
|
Name(name).
|
||||||
Do().
|
Do().
|
||||||
@ -122,7 +116,6 @@ func (c *nodes) Get(name string) (result *api.Node, err error) {
|
|||||||
func (c *nodes) List(opts api.ListOptions) (result *api.NodeList, err error) {
|
func (c *nodes) List(opts api.ListOptions) (result *api.NodeList, err error) {
|
||||||
result = &api.NodeList{}
|
result = &api.NodeList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Do().
|
Do().
|
||||||
@ -134,7 +127,6 @@ func (c *nodes) List(opts api.ListOptions) (result *api.NodeList, err error) {
|
|||||||
func (c *nodes) Watch(opts api.ListOptions) (watch.Interface, error) {
|
func (c *nodes) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Prefix("watch").
|
Prefix("watch").
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("nodes").
|
Resource("nodes").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Watch()
|
Watch()
|
||||||
|
@ -21,9 +21,10 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PersistentVolumeNamespacer has methods to work with PersistentVolume resources in a namespace
|
// PersistentVolumesGetter has a method to return a PersistentVolumeInterface.
|
||||||
type PersistentVolumeNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
PersistentVolumes(namespace string) PersistentVolumeInterface
|
type PersistentVolumesGetter interface {
|
||||||
|
PersistentVolumes() PersistentVolumeInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersistentVolumeInterface has methods to work with PersistentVolume resources.
|
// PersistentVolumeInterface has methods to work with PersistentVolume resources.
|
||||||
@ -42,14 +43,12 @@ type PersistentVolumeInterface interface {
|
|||||||
// persistentVolumes implements PersistentVolumeInterface
|
// persistentVolumes implements PersistentVolumeInterface
|
||||||
type persistentVolumes struct {
|
type persistentVolumes struct {
|
||||||
client *LegacyClient
|
client *LegacyClient
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newPersistentVolumes returns a PersistentVolumes
|
// newPersistentVolumes returns a PersistentVolumes
|
||||||
func newPersistentVolumes(c *LegacyClient, namespace string) *persistentVolumes {
|
func newPersistentVolumes(c *LegacyClient) *persistentVolumes {
|
||||||
return &persistentVolumes{
|
return &persistentVolumes{
|
||||||
client: c,
|
client: c,
|
||||||
ns: namespace,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ func newPersistentVolumes(c *LegacyClient, namespace string) *persistentVolumes
|
|||||||
func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
|
func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
|
||||||
result = &api.PersistentVolume{}
|
result = &api.PersistentVolume{}
|
||||||
err = c.client.Post().
|
err = c.client.Post().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
Body(persistentVolume).
|
Body(persistentVolume).
|
||||||
Do().
|
Do().
|
||||||
@ -69,7 +67,6 @@ func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (resu
|
|||||||
func (c *persistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
|
func (c *persistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
|
||||||
result = &api.PersistentVolume{}
|
result = &api.PersistentVolume{}
|
||||||
err = c.client.Put().
|
err = c.client.Put().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
Name(persistentVolume.Name).
|
Name(persistentVolume.Name).
|
||||||
Body(persistentVolume).
|
Body(persistentVolume).
|
||||||
@ -87,7 +84,6 @@ func (c *persistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume)
|
|||||||
// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs.
|
// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs.
|
||||||
func (c *persistentVolumes) Delete(name string, options *api.DeleteOptions) error {
|
func (c *persistentVolumes) Delete(name string, options *api.DeleteOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
Name(name).
|
Name(name).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -98,7 +94,6 @@ func (c *persistentVolumes) Delete(name string, options *api.DeleteOptions) erro
|
|||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *persistentVolumes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
func (c *persistentVolumes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
VersionedParams(&listOptions, api.Scheme).
|
VersionedParams(&listOptions, api.Scheme).
|
||||||
Body(options).
|
Body(options).
|
||||||
@ -110,7 +105,6 @@ func (c *persistentVolumes) DeleteCollection(options *api.DeleteOptions, listOpt
|
|||||||
func (c *persistentVolumes) Get(name string) (result *api.PersistentVolume, err error) {
|
func (c *persistentVolumes) Get(name string) (result *api.PersistentVolume, err error) {
|
||||||
result = &api.PersistentVolume{}
|
result = &api.PersistentVolume{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
Name(name).
|
Name(name).
|
||||||
Do().
|
Do().
|
||||||
@ -122,7 +116,6 @@ func (c *persistentVolumes) Get(name string) (result *api.PersistentVolume, err
|
|||||||
func (c *persistentVolumes) List(opts api.ListOptions) (result *api.PersistentVolumeList, err error) {
|
func (c *persistentVolumes) List(opts api.ListOptions) (result *api.PersistentVolumeList, err error) {
|
||||||
result = &api.PersistentVolumeList{}
|
result = &api.PersistentVolumeList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Do().
|
Do().
|
||||||
@ -134,7 +127,6 @@ func (c *persistentVolumes) List(opts api.ListOptions) (result *api.PersistentVo
|
|||||||
func (c *persistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) {
|
func (c *persistentVolumes) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Prefix("watch").
|
Prefix("watch").
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("persistentVolumes").
|
Resource("persistentVolumes").
|
||||||
VersionedParams(&opts, api.Scheme).
|
VersionedParams(&opts, api.Scheme).
|
||||||
Watch()
|
Watch()
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PersistentVolumeClaimNamespacer has methods to work with PersistentVolumeClaim resources in a namespace
|
// PersistentVolumeClaimsGetter has a method to return a PersistentVolumeClaimInterface.
|
||||||
type PersistentVolumeClaimNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type PersistentVolumeClaimsGetter interface {
|
||||||
PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
|
PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PodNamespacer has methods to work with Pod resources in a namespace
|
// PodsGetter has a method to return a PodInterface.
|
||||||
type PodNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type PodsGetter interface {
|
||||||
Pods(namespace string) PodInterface
|
Pods(namespace string) PodInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PodTemplateNamespacer has methods to work with PodTemplate resources in a namespace
|
// PodTemplatesGetter has a method to return a PodTemplateInterface.
|
||||||
type PodTemplateNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type PodTemplatesGetter interface {
|
||||||
PodTemplates(namespace string) PodTemplateInterface
|
PodTemplates(namespace string) PodTemplateInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReplicationControllerNamespacer has methods to work with ReplicationController resources in a namespace
|
// ReplicationControllersGetter has a method to return a ReplicationControllerInterface.
|
||||||
type ReplicationControllerNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type ReplicationControllersGetter interface {
|
||||||
ReplicationControllers(namespace string) ReplicationControllerInterface
|
ReplicationControllers(namespace string) ReplicationControllerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ResourceQuotaNamespacer has methods to work with ResourceQuota resources in a namespace
|
// ResourceQuotasGetter has a method to return a ResourceQuotaInterface.
|
||||||
type ResourceQuotaNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type ResourceQuotasGetter interface {
|
||||||
ResourceQuotas(namespace string) ResourceQuotaInterface
|
ResourceQuotas(namespace string) ResourceQuotaInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SecretNamespacer has methods to work with Secret resources in a namespace
|
// SecretsGetter has a method to return a SecretInterface.
|
||||||
type SecretNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type SecretsGetter interface {
|
||||||
Secrets(namespace string) SecretInterface
|
Secrets(namespace string) SecretInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceNamespacer has methods to work with Service resources in a namespace
|
// ServicesGetter has a method to return a ServiceInterface.
|
||||||
type ServiceNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type ServicesGetter interface {
|
||||||
Services(namespace string) ServiceInterface
|
Services(namespace string) ServiceInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
watch "k8s.io/kubernetes/pkg/watch"
|
watch "k8s.io/kubernetes/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceAccountNamespacer has methods to work with ServiceAccount resources in a namespace
|
// ServiceAccountsGetter has a method to return a ServiceAccountInterface.
|
||||||
type ServiceAccountNamespacer interface {
|
// A group's client should implement this interface.
|
||||||
|
type ServiceAccountsGetter interface {
|
||||||
ServiceAccounts(namespace string) ServiceAccountInterface
|
ServiceAccounts(namespace string) ServiceAccountInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user