diff --git a/cmd/libs/go2idl/client-gen/generators/generator-for-group.go b/cmd/libs/go2idl/client-gen/generators/generator-for-group.go index 8b181752eed..5c864f8b153 100644 --- a/cmd/libs/go2idl/client-gen/generators/generator-for-group.go +++ b/cmd/libs/go2idl/client-gen/generators/generator-for-group.go @@ -89,7 +89,13 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer "type": t, "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(newClientForConfigOrDieTemplate, m) @@ -101,7 +107,7 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer var groupInterfaceTemplate = ` type $.Group$Interface interface { - $range .types$ $.Name.Name$Namespacer + $range .types$ $.|publicPlural$Getter $end$ } ` @@ -113,12 +119,18 @@ type $.Group$Client struct { } ` -var namespacerImplTemplate = ` -func (c *$.Group$Client) $.type|publicPlural$(namespace string) $.type.Name.Name$Interface { +var getterImplNamespaced = ` +func (c *$.Group$Client) $.type|publicPlural$(namespace string) $.type|public$Interface { return new$.type|publicPlural$(c, namespace) } ` +var getterImplNonNamespaced = ` +func (c *$.Group$Client) $.type|publicPlural$() $.type|public$Interface { + return new$.type|publicPlural$(c) +} +` + var newClientForConfigTemplate = ` // NewForConfig creates a new $.Group$Client for the given config. func NewForConfig(c *$.Config|raw$) (*$.Group$Client, error) { diff --git a/cmd/libs/go2idl/client-gen/generators/generator-for-type.go b/cmd/libs/go2idl/client-gen/generators/generator-for-type.go index 194d60930c5..843d5d42a0b 100644 --- a/cmd/libs/go2idl/client-gen/generators/generator-for-type.go +++ b/cmd/libs/go2idl/client-gen/generators/generator-for-type.go @@ -66,6 +66,7 @@ func hasStatus(t *types.Type) bool { func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { sw := generator.NewSnippetWriter(w, c, "$", "$") pkg := filepath.Base(t.Name.Package) + namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true") m := map[string]interface{}{ "type": t, "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"}), "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"}), + "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) // Include the UpdateStatus method if the type has a status if hasStatus(t) { sw.Do(interfaceUpdateStatusTemplate, m) } sw.Do(interfaceTemplate2, m) - sw.Do(structTemplate, m) - sw.Do(newStructTemplate, m) + if namespaced { + sw.Do(structNamespaced, m) + sw.Do(newStructNamespaced, m) + } else { + sw.Do(structNonNamespaced, m) + sw.Do(newStructNonNamespaced, m) + } sw.Do(createTemplate, m) sw.Do(updateTemplate, m) // 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() } -// template for namespacer -var namespacerTemplate = ` -// $.type|public$Namespacer has methods to work with $.type|public$ resources in a namespace -type $.type|public$Namespacer interface { +// group client will implement this interface. +var getterComment = ` +// $.type|publicPlural$Getter has a method to return a $.type|public$Interface. +// A group's client should implement this interface.` + +var getterNamesapced = ` +type $.type|publicPlural$Getter 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 = ` // $.type|public$Interface has methods to work with $.type|public$ resources. type $.type|public$Interface interface { @@ -128,15 +150,24 @@ var interfaceTemplate2 = ` } ` -// template for the struct that implements the interface -var structTemplate = ` +// template for the struct that implements the type's interface +var structNamespaced = ` // $.type|privatePlural$ implements $.type|public$Interface type $.type|privatePlural$ struct { client *$.Group$Client 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$ func new$.type|publicPlural$(c *$.Group$Client, namespace string) *$.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 = ` // 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) { result = &$.type|raw$List{} err = c.client.Get(). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). VersionedParams(&opts, api.Scheme). Do(). @@ -163,7 +204,7 @@ var getTemplate = ` func (c *$.type|privatePlural$) Get(name string) (result *$.type|raw$, err error) { result = &$.type|raw${} err = c.client.Get(). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). Name(name). Do(). @@ -176,7 +217,7 @@ var deleteTemplate = ` // 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 { return c.client.Delete(). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). Name(name). Body(options). @@ -189,7 +230,7 @@ var deleteCollectionTemplate = ` // DeleteCollection deletes a collection of objects. func (c *$.type|privatePlural$) DeleteCollection(options *$.apiDeleteOptions|raw$, listOptions $.apiListOptions|raw$) error { return c.client.Delete(). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). VersionedParams(&listOptions, api.Scheme). Body(options). @@ -203,7 +244,7 @@ var createTemplate = ` func (c *$.type|privatePlural$) Create($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) { result = &$.type|raw${} err = c.client.Post(). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). Body($.type|private$). Do(). @@ -217,7 +258,7 @@ var updateTemplate = ` func (c *$.type|privatePlural$) Update($.type|private$ *$.type|raw$) (result *$.type|raw$, err error) { result = &$.type|raw${} err = c.client.Put(). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). Name($.type|private$.Name). Body($.type|private$). @@ -240,7 +281,7 @@ var watchTemplate = ` func (c *$.type|privatePlural$) Watch(opts $.apiListOptions|raw$) ($.watchInterface|raw$, error) { return c.client.Get(). Prefix("watch"). - Namespace(c.ns). + $if .namespaced$Namespace(c.ns).$end$ Resource("$.type|privatePlural$"). VersionedParams(&opts, api.Scheme). Watch() diff --git a/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testgroup_client.go b/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testgroup_client.go index 9a2635f4cad..2f0f8099f04 100644 --- a/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testgroup_client.go +++ b/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testgroup_client.go @@ -23,7 +23,7 @@ import ( ) type TestgroupInterface interface { - TestTypeNamespacer + TestTypesGetter } // TestgroupClient is used to interact with features provided by the Testgroup group. diff --git a/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testtype.go b/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testtype.go index f5635c01610..3ca7fb49757 100644 --- a/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testtype.go +++ b/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testtype.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// TestTypeNamespacer has methods to work with TestType resources in a namespace -type TestTypeNamespacer interface { +// TestTypesGetter has a method to return a TestTypeInterface. +// A group's client should implement this interface. +type TestTypesGetter interface { TestTypes(namespace string) TestTypeInterface } diff --git a/pkg/api/types.go b/pkg/api/types.go index bb81f2f9510..e594ae35bcc 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -261,7 +261,7 @@ type PersistentVolumeClaimVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty"` } -// +genclient=true +// +genclient=true,nonNamespaced=true type PersistentVolume struct { unversioned.TypeMeta `json:",inline"` @@ -1629,7 +1629,7 @@ const ( // ResourceList is a set of (resource name, quantity) pairs. type ResourceList map[ResourceName]resource.Quantity -// +genclient=true +// +genclient=true,nonNamespaced=true // Node is a worker node in Kubernetes // The name of the node according to etcd is in ObjectMeta.Name. @@ -1681,7 +1681,7 @@ const ( NamespaceTerminating NamespacePhase = "Terminating" ) -// +genclient=true +// +genclient=true,nonNamespaced=true // A namespace provides a scope for Names. // Use of multiple namespaces is optional @@ -2174,7 +2174,7 @@ type ComponentCondition struct { Error string `json:"error,omitempty"` } -// +genclient=true +// +genclient=true,nonNamespaced=true // ComponentStatus (and ComponentStatusList) holds the cluster validation info. type ComponentStatus struct { diff --git a/pkg/client/typed/generated/extensions/unversioned/daemonset.go b/pkg/client/typed/generated/extensions/unversioned/daemonset.go index 0f091beeafc..350be3616ae 100644 --- a/pkg/client/typed/generated/extensions/unversioned/daemonset.go +++ b/pkg/client/typed/generated/extensions/unversioned/daemonset.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// DaemonSetNamespacer has methods to work with DaemonSet resources in a namespace -type DaemonSetNamespacer interface { +// DaemonSetsGetter has a method to return a DaemonSetInterface. +// A group's client should implement this interface. +type DaemonSetsGetter interface { DaemonSets(namespace string) DaemonSetInterface } diff --git a/pkg/client/typed/generated/extensions/unversioned/deployment.go b/pkg/client/typed/generated/extensions/unversioned/deployment.go index 3ad9e1fbad2..90e105d273f 100644 --- a/pkg/client/typed/generated/extensions/unversioned/deployment.go +++ b/pkg/client/typed/generated/extensions/unversioned/deployment.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// DeploymentNamespacer has methods to work with Deployment resources in a namespace -type DeploymentNamespacer interface { +// DeploymentsGetter has a method to return a DeploymentInterface. +// A group's client should implement this interface. +type DeploymentsGetter interface { Deployments(namespace string) DeploymentInterface } diff --git a/pkg/client/typed/generated/extensions/unversioned/extensions_client.go b/pkg/client/typed/generated/extensions/unversioned/extensions_client.go index edee23c6353..cd939b802af 100644 --- a/pkg/client/typed/generated/extensions/unversioned/extensions_client.go +++ b/pkg/client/typed/generated/extensions/unversioned/extensions_client.go @@ -23,12 +23,12 @@ import ( ) type ExtensionsInterface interface { - DaemonSetNamespacer - DeploymentNamespacer - HorizontalPodAutoscalerNamespacer - IngressNamespacer - JobNamespacer - ThirdPartyResourceNamespacer + DaemonSetsGetter + DeploymentsGetter + HorizontalPodAutoscalersGetter + IngressesGetter + JobsGetter + ThirdPartyResourcesGetter } // ExtensionsClient is used to interact with features provided by the Extensions group. diff --git a/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go b/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go index 26b6b4afe7e..e15861e2ddc 100644 --- a/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go +++ b/pkg/client/typed/generated/extensions/unversioned/horizontalpodautoscaler.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// HorizontalPodAutoscalerNamespacer has methods to work with HorizontalPodAutoscaler resources in a namespace -type HorizontalPodAutoscalerNamespacer interface { +// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface. +// A group's client should implement this interface. +type HorizontalPodAutoscalersGetter interface { HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface } diff --git a/pkg/client/typed/generated/extensions/unversioned/ingress.go b/pkg/client/typed/generated/extensions/unversioned/ingress.go index 85adc5c3722..594e90b36d8 100644 --- a/pkg/client/typed/generated/extensions/unversioned/ingress.go +++ b/pkg/client/typed/generated/extensions/unversioned/ingress.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// IngressNamespacer has methods to work with Ingress resources in a namespace -type IngressNamespacer interface { +// IngressesGetter has a method to return a IngressInterface. +// A group's client should implement this interface. +type IngressesGetter interface { Ingresses(namespace string) IngressInterface } diff --git a/pkg/client/typed/generated/extensions/unversioned/job.go b/pkg/client/typed/generated/extensions/unversioned/job.go index 1714fbb49a0..5114da420e6 100644 --- a/pkg/client/typed/generated/extensions/unversioned/job.go +++ b/pkg/client/typed/generated/extensions/unversioned/job.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// JobNamespacer has methods to work with Job resources in a namespace -type JobNamespacer interface { +// JobsGetter has a method to return a JobInterface. +// A group's client should implement this interface. +type JobsGetter interface { Jobs(namespace string) JobInterface } diff --git a/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go b/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go index 7858126d601..2e47339cadf 100644 --- a/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go +++ b/pkg/client/typed/generated/extensions/unversioned/thirdpartyresource.go @@ -22,8 +22,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace -type ThirdPartyResourceNamespacer interface { +// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface. +// A group's client should implement this interface. +type ThirdPartyResourcesGetter interface { ThirdPartyResources(namespace string) ThirdPartyResourceInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/componentstatus.go b/pkg/client/typed/generated/legacy/unversioned/componentstatus.go index aec8ac8b2f5..b40d59b463c 100644 --- a/pkg/client/typed/generated/legacy/unversioned/componentstatus.go +++ b/pkg/client/typed/generated/legacy/unversioned/componentstatus.go @@ -21,9 +21,10 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// ComponentStatusNamespacer has methods to work with ComponentStatus resources in a namespace -type ComponentStatusNamespacer interface { - ComponentStatus(namespace string) ComponentStatusInterface +// ComponentStatusGetter has a method to return a ComponentStatusInterface. +// A group's client should implement this interface. +type ComponentStatusGetter interface { + ComponentStatus() ComponentStatusInterface } // ComponentStatusInterface has methods to work with ComponentStatus resources. @@ -41,14 +42,12 @@ type ComponentStatusInterface interface { // componentStatus implements ComponentStatusInterface type componentStatus struct { client *LegacyClient - ns string } // newComponentStatus returns a ComponentStatus -func newComponentStatus(c *LegacyClient, namespace string) *componentStatus { +func newComponentStatus(c *LegacyClient) *componentStatus { return &componentStatus{ 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) { result = &api.ComponentStatus{} err = c.client.Post(). - Namespace(c.ns). Resource("componentStatus"). Body(componentStatus). 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) { result = &api.ComponentStatus{} err = c.client.Put(). - Namespace(c.ns). Resource("componentStatus"). Name(componentStatus.Name). 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. func (c *componentStatus) Delete(name string, options *api.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("componentStatus"). Name(name). Body(options). @@ -91,7 +87,6 @@ func (c *componentStatus) Delete(name string, options *api.DeleteOptions) error // DeleteCollection deletes a collection of objects. func (c *componentStatus) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("componentStatus"). VersionedParams(&listOptions, api.Scheme). 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) { result = &api.ComponentStatus{} err = c.client.Get(). - Namespace(c.ns). Resource("componentStatus"). Name(name). 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) { result = &api.ComponentStatusList{} err = c.client.Get(). - Namespace(c.ns). Resource("componentStatus"). VersionedParams(&opts, api.Scheme). 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) { return c.client.Get(). Prefix("watch"). - Namespace(c.ns). Resource("componentStatus"). VersionedParams(&opts, api.Scheme). Watch() diff --git a/pkg/client/typed/generated/legacy/unversioned/endpoints.go b/pkg/client/typed/generated/legacy/unversioned/endpoints.go index e7663c80216..0e150fb7fca 100644 --- a/pkg/client/typed/generated/legacy/unversioned/endpoints.go +++ b/pkg/client/typed/generated/legacy/unversioned/endpoints.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// EndpointsNamespacer has methods to work with Endpoints resources in a namespace -type EndpointsNamespacer interface { +// EndpointsGetter has a method to return a EndpointsInterface. +// A group's client should implement this interface. +type EndpointsGetter interface { Endpoints(namespace string) EndpointsInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/event.go b/pkg/client/typed/generated/legacy/unversioned/event.go index af24b72e0b7..1cd6bf078af 100644 --- a/pkg/client/typed/generated/legacy/unversioned/event.go +++ b/pkg/client/typed/generated/legacy/unversioned/event.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// EventNamespacer has methods to work with Event resources in a namespace -type EventNamespacer interface { +// EventsGetter has a method to return a EventInterface. +// A group's client should implement this interface. +type EventsGetter interface { Events(namespace string) EventInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/legacy_client.go b/pkg/client/typed/generated/legacy/unversioned/legacy_client.go index 427fc436dd4..93888a76188 100644 --- a/pkg/client/typed/generated/legacy/unversioned/legacy_client.go +++ b/pkg/client/typed/generated/legacy/unversioned/legacy_client.go @@ -23,21 +23,21 @@ import ( ) type LegacyInterface interface { - ComponentStatusNamespacer - EndpointsNamespacer - EventNamespacer - LimitRangeNamespacer - NamespaceNamespacer - NodeNamespacer - PersistentVolumeNamespacer - PersistentVolumeClaimNamespacer - PodNamespacer - PodTemplateNamespacer - ReplicationControllerNamespacer - ResourceQuotaNamespacer - SecretNamespacer - ServiceNamespacer - ServiceAccountNamespacer + ComponentStatusGetter + EndpointsGetter + EventsGetter + LimitRangesGetter + NamespacesGetter + NodesGetter + PersistentVolumesGetter + PersistentVolumeClaimsGetter + PodsGetter + PodTemplatesGetter + ReplicationControllersGetter + ResourceQuotasGetter + SecretsGetter + ServicesGetter + ServiceAccountsGetter } // LegacyClient is used to interact with features provided by the Legacy group. @@ -45,8 +45,8 @@ type LegacyClient struct { *unversioned.RESTClient } -func (c *LegacyClient) ComponentStatus(namespace string) ComponentStatusInterface { - return newComponentStatus(c, namespace) +func (c *LegacyClient) ComponentStatus() ComponentStatusInterface { + return newComponentStatus(c) } func (c *LegacyClient) Endpoints(namespace string) EndpointsInterface { @@ -61,16 +61,16 @@ func (c *LegacyClient) LimitRanges(namespace string) LimitRangeInterface { return newLimitRanges(c, namespace) } -func (c *LegacyClient) Namespaces(namespace string) NamespaceInterface { - return newNamespaces(c, namespace) +func (c *LegacyClient) Namespaces() NamespaceInterface { + return newNamespaces(c) } -func (c *LegacyClient) Nodes(namespace string) NodeInterface { - return newNodes(c, namespace) +func (c *LegacyClient) Nodes() NodeInterface { + return newNodes(c) } -func (c *LegacyClient) PersistentVolumes(namespace string) PersistentVolumeInterface { - return newPersistentVolumes(c, namespace) +func (c *LegacyClient) PersistentVolumes() PersistentVolumeInterface { + return newPersistentVolumes(c) } func (c *LegacyClient) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface { diff --git a/pkg/client/typed/generated/legacy/unversioned/limitrange.go b/pkg/client/typed/generated/legacy/unversioned/limitrange.go index 5634344d46c..dbe3c5b14b7 100644 --- a/pkg/client/typed/generated/legacy/unversioned/limitrange.go +++ b/pkg/client/typed/generated/legacy/unversioned/limitrange.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// LimitRangeNamespacer has methods to work with LimitRange resources in a namespace -type LimitRangeNamespacer interface { +// LimitRangesGetter has a method to return a LimitRangeInterface. +// A group's client should implement this interface. +type LimitRangesGetter interface { LimitRanges(namespace string) LimitRangeInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/namespace.go b/pkg/client/typed/generated/legacy/unversioned/namespace.go index b291adf0851..6b203ae2694 100644 --- a/pkg/client/typed/generated/legacy/unversioned/namespace.go +++ b/pkg/client/typed/generated/legacy/unversioned/namespace.go @@ -21,9 +21,10 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// NamespaceNamespacer has methods to work with Namespace resources in a namespace -type NamespaceNamespacer interface { - Namespaces(namespace string) NamespaceInterface +// NamespacesGetter has a method to return a NamespaceInterface. +// A group's client should implement this interface. +type NamespacesGetter interface { + Namespaces() NamespaceInterface } // NamespaceInterface has methods to work with Namespace resources. @@ -42,14 +43,12 @@ type NamespaceInterface interface { // namespaces implements NamespaceInterface type namespaces struct { client *LegacyClient - ns string } // newNamespaces returns a Namespaces -func newNamespaces(c *LegacyClient, namespace string) *namespaces { +func newNamespaces(c *LegacyClient) *namespaces { return &namespaces{ 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) { result = &api.Namespace{} err = c.client.Post(). - Namespace(c.ns). Resource("namespaces"). Body(namespace). 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) { result = &api.Namespace{} err = c.client.Put(). - Namespace(c.ns). Resource("namespaces"). Name(namespace.Name). 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. func (c *namespaces) Delete(name string, options *api.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("namespaces"). Name(name). Body(options). @@ -98,7 +94,6 @@ func (c *namespaces) Delete(name string, options *api.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *namespaces) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("namespaces"). VersionedParams(&listOptions, api.Scheme). 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) { result = &api.Namespace{} err = c.client.Get(). - Namespace(c.ns). Resource("namespaces"). Name(name). 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) { result = &api.NamespaceList{} err = c.client.Get(). - Namespace(c.ns). Resource("namespaces"). VersionedParams(&opts, api.Scheme). 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) { return c.client.Get(). Prefix("watch"). - Namespace(c.ns). Resource("namespaces"). VersionedParams(&opts, api.Scheme). Watch() diff --git a/pkg/client/typed/generated/legacy/unversioned/node.go b/pkg/client/typed/generated/legacy/unversioned/node.go index 5477a8bc0c3..ab5f454d6fc 100644 --- a/pkg/client/typed/generated/legacy/unversioned/node.go +++ b/pkg/client/typed/generated/legacy/unversioned/node.go @@ -21,9 +21,10 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// NodeNamespacer has methods to work with Node resources in a namespace -type NodeNamespacer interface { - Nodes(namespace string) NodeInterface +// NodesGetter has a method to return a NodeInterface. +// A group's client should implement this interface. +type NodesGetter interface { + Nodes() NodeInterface } // NodeInterface has methods to work with Node resources. @@ -42,14 +43,12 @@ type NodeInterface interface { // nodes implements NodeInterface type nodes struct { client *LegacyClient - ns string } // newNodes returns a Nodes -func newNodes(c *LegacyClient, namespace string) *nodes { +func newNodes(c *LegacyClient) *nodes { return &nodes{ 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) { result = &api.Node{} err = c.client.Post(). - Namespace(c.ns). Resource("nodes"). Body(node). 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) { result = &api.Node{} err = c.client.Put(). - Namespace(c.ns). Resource("nodes"). Name(node.Name). 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. func (c *nodes) Delete(name string, options *api.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("nodes"). Name(name). Body(options). @@ -98,7 +94,6 @@ func (c *nodes) Delete(name string, options *api.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *nodes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("nodes"). VersionedParams(&listOptions, api.Scheme). 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) { result = &api.Node{} err = c.client.Get(). - Namespace(c.ns). Resource("nodes"). Name(name). 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) { result = &api.NodeList{} err = c.client.Get(). - Namespace(c.ns). Resource("nodes"). VersionedParams(&opts, api.Scheme). 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) { return c.client.Get(). Prefix("watch"). - Namespace(c.ns). Resource("nodes"). VersionedParams(&opts, api.Scheme). Watch() diff --git a/pkg/client/typed/generated/legacy/unversioned/persistentvolume.go b/pkg/client/typed/generated/legacy/unversioned/persistentvolume.go index 1bf4a7d9968..4104947b34a 100644 --- a/pkg/client/typed/generated/legacy/unversioned/persistentvolume.go +++ b/pkg/client/typed/generated/legacy/unversioned/persistentvolume.go @@ -21,9 +21,10 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// PersistentVolumeNamespacer has methods to work with PersistentVolume resources in a namespace -type PersistentVolumeNamespacer interface { - PersistentVolumes(namespace string) PersistentVolumeInterface +// PersistentVolumesGetter has a method to return a PersistentVolumeInterface. +// A group's client should implement this interface. +type PersistentVolumesGetter interface { + PersistentVolumes() PersistentVolumeInterface } // PersistentVolumeInterface has methods to work with PersistentVolume resources. @@ -42,14 +43,12 @@ type PersistentVolumeInterface interface { // persistentVolumes implements PersistentVolumeInterface type persistentVolumes struct { client *LegacyClient - ns string } // newPersistentVolumes returns a PersistentVolumes -func newPersistentVolumes(c *LegacyClient, namespace string) *persistentVolumes { +func newPersistentVolumes(c *LegacyClient) *persistentVolumes { return &persistentVolumes{ 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) { result = &api.PersistentVolume{} err = c.client.Post(). - Namespace(c.ns). Resource("persistentVolumes"). Body(persistentVolume). 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) { result = &api.PersistentVolume{} err = c.client.Put(). - Namespace(c.ns). Resource("persistentVolumes"). Name(persistentVolume.Name). 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. func (c *persistentVolumes) Delete(name string, options *api.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("persistentVolumes"). Name(name). Body(options). @@ -98,7 +94,6 @@ func (c *persistentVolumes) Delete(name string, options *api.DeleteOptions) erro // DeleteCollection deletes a collection of objects. func (c *persistentVolumes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("persistentVolumes"). VersionedParams(&listOptions, api.Scheme). 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) { result = &api.PersistentVolume{} err = c.client.Get(). - Namespace(c.ns). Resource("persistentVolumes"). Name(name). 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) { result = &api.PersistentVolumeList{} err = c.client.Get(). - Namespace(c.ns). Resource("persistentVolumes"). VersionedParams(&opts, api.Scheme). 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) { return c.client.Get(). Prefix("watch"). - Namespace(c.ns). Resource("persistentVolumes"). VersionedParams(&opts, api.Scheme). Watch() diff --git a/pkg/client/typed/generated/legacy/unversioned/persistentvolumeclaim.go b/pkg/client/typed/generated/legacy/unversioned/persistentvolumeclaim.go index 71f379d476d..e05696ac6cd 100644 --- a/pkg/client/typed/generated/legacy/unversioned/persistentvolumeclaim.go +++ b/pkg/client/typed/generated/legacy/unversioned/persistentvolumeclaim.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// PersistentVolumeClaimNamespacer has methods to work with PersistentVolumeClaim resources in a namespace -type PersistentVolumeClaimNamespacer interface { +// PersistentVolumeClaimsGetter has a method to return a PersistentVolumeClaimInterface. +// A group's client should implement this interface. +type PersistentVolumeClaimsGetter interface { PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/pod.go b/pkg/client/typed/generated/legacy/unversioned/pod.go index 92aef41039b..6a9788d5017 100644 --- a/pkg/client/typed/generated/legacy/unversioned/pod.go +++ b/pkg/client/typed/generated/legacy/unversioned/pod.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// PodNamespacer has methods to work with Pod resources in a namespace -type PodNamespacer interface { +// PodsGetter has a method to return a PodInterface. +// A group's client should implement this interface. +type PodsGetter interface { Pods(namespace string) PodInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/podtemplate.go b/pkg/client/typed/generated/legacy/unversioned/podtemplate.go index 45b7f416d37..466ebcae3b1 100644 --- a/pkg/client/typed/generated/legacy/unversioned/podtemplate.go +++ b/pkg/client/typed/generated/legacy/unversioned/podtemplate.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// PodTemplateNamespacer has methods to work with PodTemplate resources in a namespace -type PodTemplateNamespacer interface { +// PodTemplatesGetter has a method to return a PodTemplateInterface. +// A group's client should implement this interface. +type PodTemplatesGetter interface { PodTemplates(namespace string) PodTemplateInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/replicationcontroller.go b/pkg/client/typed/generated/legacy/unversioned/replicationcontroller.go index eb43f1ff146..0381b22bb87 100644 --- a/pkg/client/typed/generated/legacy/unversioned/replicationcontroller.go +++ b/pkg/client/typed/generated/legacy/unversioned/replicationcontroller.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// ReplicationControllerNamespacer has methods to work with ReplicationController resources in a namespace -type ReplicationControllerNamespacer interface { +// ReplicationControllersGetter has a method to return a ReplicationControllerInterface. +// A group's client should implement this interface. +type ReplicationControllersGetter interface { ReplicationControllers(namespace string) ReplicationControllerInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/resourcequota.go b/pkg/client/typed/generated/legacy/unversioned/resourcequota.go index 3e27b043e65..6798c5a102c 100644 --- a/pkg/client/typed/generated/legacy/unversioned/resourcequota.go +++ b/pkg/client/typed/generated/legacy/unversioned/resourcequota.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// ResourceQuotaNamespacer has methods to work with ResourceQuota resources in a namespace -type ResourceQuotaNamespacer interface { +// ResourceQuotasGetter has a method to return a ResourceQuotaInterface. +// A group's client should implement this interface. +type ResourceQuotasGetter interface { ResourceQuotas(namespace string) ResourceQuotaInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/secret.go b/pkg/client/typed/generated/legacy/unversioned/secret.go index aca5e0da6cc..4a870981fe0 100644 --- a/pkg/client/typed/generated/legacy/unversioned/secret.go +++ b/pkg/client/typed/generated/legacy/unversioned/secret.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// SecretNamespacer has methods to work with Secret resources in a namespace -type SecretNamespacer interface { +// SecretsGetter has a method to return a SecretInterface. +// A group's client should implement this interface. +type SecretsGetter interface { Secrets(namespace string) SecretInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/service.go b/pkg/client/typed/generated/legacy/unversioned/service.go index 70e9a248684..13840cbc307 100644 --- a/pkg/client/typed/generated/legacy/unversioned/service.go +++ b/pkg/client/typed/generated/legacy/unversioned/service.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// ServiceNamespacer has methods to work with Service resources in a namespace -type ServiceNamespacer interface { +// ServicesGetter has a method to return a ServiceInterface. +// A group's client should implement this interface. +type ServicesGetter interface { Services(namespace string) ServiceInterface } diff --git a/pkg/client/typed/generated/legacy/unversioned/serviceaccount.go b/pkg/client/typed/generated/legacy/unversioned/serviceaccount.go index 71838e5a4b0..519977f85e7 100644 --- a/pkg/client/typed/generated/legacy/unversioned/serviceaccount.go +++ b/pkg/client/typed/generated/legacy/unversioned/serviceaccount.go @@ -21,8 +21,9 @@ import ( watch "k8s.io/kubernetes/pkg/watch" ) -// ServiceAccountNamespacer has methods to work with ServiceAccount resources in a namespace -type ServiceAccountNamespacer interface { +// ServiceAccountsGetter has a method to return a ServiceAccountInterface. +// A group's client should implement this interface. +type ServiceAccountsGetter interface { ServiceAccounts(namespace string) ServiceAccountInterface }