Move ThirdPartyResource to root scoped object

This commit is contained in:
Jordan Liggitt 2016-04-30 00:43:40 -04:00
parent ee2a0694b6
commit e41d504739
26 changed files with 513 additions and 1146 deletions

View File

@ -5619,14 +5619,14 @@
]
},
{
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/thirdpartyresources",
"path": "/apis/extensions/v1beta1/thirdpartyresources",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "v1beta1.ThirdPartyResourceList",
"method": "GET",
"summary": "list or watch objects of kind ThirdPartyResource",
"nickname": "listNamespacedThirdPartyResource",
"nickname": "listThirdPartyResource",
"parameters": [
{
"type": "string",
@ -5675,14 +5675,6 @@
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
@ -5705,7 +5697,7 @@
"type": "v1beta1.ThirdPartyResource",
"method": "POST",
"summary": "create a ThirdPartyResource",
"nickname": "createNamespacedThirdPartyResource",
"nickname": "createThirdPartyResource",
"parameters": [
{
"type": "string",
@ -5722,14 +5714,6 @@
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
@ -5752,7 +5736,7 @@
"type": "unversioned.Status",
"method": "DELETE",
"summary": "delete collection of ThirdPartyResource",
"nickname": "deletecollectionNamespacedThirdPartyResource",
"nickname": "deletecollectionThirdPartyResource",
"parameters": [
{
"type": "string",
@ -5801,14 +5785,6 @@
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
@ -5830,14 +5806,14 @@
]
},
{
"path": "/apis/extensions/v1beta1/watch/namespaces/{namespace}/thirdpartyresources",
"path": "/apis/extensions/v1beta1/watch/thirdpartyresources",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch individual changes to a list of ThirdPartyResource",
"nickname": "watchNamespacedThirdPartyResourceList",
"nickname": "watchThirdPartyResourceList",
"parameters": [
{
"type": "string",
@ -5886,14 +5862,6 @@
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
@ -5916,14 +5884,14 @@
]
},
{
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/thirdpartyresources/{name}",
"path": "/apis/extensions/v1beta1/thirdpartyresources/{name}",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "v1beta1.ThirdPartyResource",
"method": "GET",
"summary": "read the specified ThirdPartyResource",
"nickname": "readNamespacedThirdPartyResource",
"nickname": "readThirdPartyResource",
"parameters": [
{
"type": "string",
@ -5949,14 +5917,6 @@
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
@ -5986,7 +5946,7 @@
"type": "v1beta1.ThirdPartyResource",
"method": "PUT",
"summary": "replace the specified ThirdPartyResource",
"nickname": "replaceNamespacedThirdPartyResource",
"nickname": "replaceThirdPartyResource",
"parameters": [
{
"type": "string",
@ -6004,14 +5964,6 @@
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
@ -6041,7 +5993,7 @@
"type": "v1beta1.ThirdPartyResource",
"method": "PATCH",
"summary": "partially update the specified ThirdPartyResource",
"nickname": "patchNamespacedThirdPartyResource",
"nickname": "patchThirdPartyResource",
"parameters": [
{
"type": "string",
@ -6059,14 +6011,6 @@
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
@ -6098,7 +6042,7 @@
"type": "unversioned.Status",
"method": "DELETE",
"summary": "delete a ThirdPartyResource",
"nickname": "deleteNamespacedThirdPartyResource",
"nickname": "deleteThirdPartyResource",
"parameters": [
{
"type": "string",
@ -6116,14 +6060,6 @@
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
@ -6152,14 +6088,14 @@
]
},
{
"path": "/apis/extensions/v1beta1/watch/namespaces/{namespace}/thirdpartyresources/{name}",
"path": "/apis/extensions/v1beta1/watch/thirdpartyresources/{name}",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch changes to an object of kind ThirdPartyResource",
"nickname": "watchNamespacedThirdPartyResource",
"nickname": "watchThirdPartyResource",
"parameters": [
{
"type": "string",
@ -6209,14 +6145,6 @@
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "namespace",
"description": "object name and auth scope, such as for teams and projects",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
@ -6245,161 +6173,6 @@
}
]
},
{
"path": "/apis/extensions/v1beta1/thirdpartyresources",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "v1beta1.ThirdPartyResourceList",
"method": "GET",
"summary": "list or watch objects of kind ThirdPartyResource",
"nickname": "listNamespacedThirdPartyResource",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.ThirdPartyResourceList"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/extensions/v1beta1/watch/thirdpartyresources",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch individual changes to a list of ThirdPartyResource",
"nickname": "watchNamespacedThirdPartyResourceList",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "*versioned.Event"
}
],
"produces": [
"application/json",
"application/json;stream=watch",
"application/vnd.kubernetes.protobuf",
"application/vnd.kubernetes.protobuf;stream=watch"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/extensions/v1beta1",
"description": "API at /apis/extensions/v1beta1",

File diff suppressed because it is too large Load Diff

View File

@ -92,6 +92,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper
// if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString(
"PodSecurityPolicy",
"ThirdPartyResource",
)
ignoredKinds := sets.NewString()

View File

@ -169,7 +169,7 @@ type HorizontalPodAutoscalerList struct {
Items []HorizontalPodAutoscaler `json:"items"`
}
// +genclient=true
// +genclient=true,nonNamespaced=true
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api.

View File

@ -166,7 +166,7 @@ type HorizontalPodAutoscalerList struct {
Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient=true
// +genclient=true,nonNamespaced=true
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api.

View File

@ -145,7 +145,7 @@ func ValidateThirdPartyResourceName(name string, prefix bool) (bool, string) {
func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, true, ValidateThirdPartyResourceName, field.NewPath("metadata"))...)
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, false, ValidateThirdPartyResourceName, field.NewPath("metadata"))...)
versions := sets.String{}
for ix := range obj.Versions {

View File

@ -62,8 +62,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace)
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}
// NewForConfig creates a new ExtensionsClient for the given config.

View File

@ -50,8 +50,8 @@ func (c *FakeExtensions) Scales(namespace string) unversioned.ScaleInterface {
return &FakeScales{c, namespace}
}
func (c *FakeExtensions) ThirdPartyResources(namespace string) unversioned.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c, namespace}
func (c *FakeExtensions) ThirdPartyResources() unversioned.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c}
}
// GetRESTClient returns a RESTClient that is used to communicate

View File

@ -28,15 +28,13 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface
type FakeThirdPartyResources struct {
Fake *FakeExtensions
ns string
}
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &extensions.ThirdPartyResource{})
Invokes(core.NewRootCreateAction(thirdpartyresourcesResource, thirdPartyResource), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -45,8 +43,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *extensions.ThirdPar
func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &extensions.ThirdPartyResource{})
Invokes(core.NewRootUpdateAction(thirdpartyresourcesResource, thirdPartyResource), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -55,13 +52,12 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *extensions.ThirdPar
func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(thirdpartyresourcesResource, c.ns, name), &extensions.ThirdPartyResource{})
Invokes(core.NewRootDeleteAction(thirdpartyresourcesResource, name), &extensions.ThirdPartyResource{})
return err
}
func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(thirdpartyresourcesResource, c.ns, listOptions)
action := core.NewRootDeleteCollectionAction(thirdpartyresourcesResource, listOptions)
_, err := c.Fake.Invokes(action, &extensions.ThirdPartyResourceList{})
return err
@ -69,8 +65,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l
func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(thirdpartyresourcesResource, c.ns, name), &extensions.ThirdPartyResource{})
Invokes(core.NewRootGetAction(thirdpartyresourcesResource, name), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -79,8 +74,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *extensions.ThirdPart
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(thirdpartyresourcesResource, c.ns, opts), &extensions.ThirdPartyResourceList{})
Invokes(core.NewRootListAction(thirdpartyresourcesResource, opts), &extensions.ThirdPartyResourceList{})
if obj == nil {
return nil, err
}
@ -101,6 +95,5 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *extensions
// Watch returns a watch.Interface that watches the requested thirdPartyResources.
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(thirdpartyresourcesResource, c.ns, opts))
InvokesWatch(core.NewRootWatchAction(thirdpartyresourcesResource, opts))
}

View File

@ -25,7 +25,7 @@ import (
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
// A group's client should implement this interface.
type ThirdPartyResourcesGetter interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
ThirdPartyResources() ThirdPartyResourceInterface
}
// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources.
@ -43,14 +43,12 @@ type ThirdPartyResourceInterface interface {
// thirdPartyResources implements ThirdPartyResourceInterface
type thirdPartyResources struct {
client *ExtensionsClient
ns string
}
// newThirdPartyResources returns a ThirdPartyResources
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources {
func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{
client: c,
ns: namespace,
}
}
@ -58,7 +56,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe
func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.client.Post().
Namespace(c.ns).
Resource("thirdpartyresources").
Body(thirdPartyResource).
Do().
@ -70,7 +67,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *extensions.ThirdPartyRe
func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.client.Put().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(thirdPartyResource.Name).
Body(thirdPartyResource).
@ -82,7 +78,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *extensions.ThirdPartyRe
// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs.
func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(name).
Body(options).
@ -93,7 +88,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er
// DeleteCollection deletes a collection of objects.
func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
@ -105,7 +99,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO
func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(name).
Do().
@ -117,7 +110,6 @@ func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyRes
func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) {
result = &extensions.ThirdPartyResourceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Do().
@ -129,7 +121,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.Thi
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Watch()

View File

@ -66,8 +66,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace)
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}
// NewForConfig creates a new ExtensionsClient for the given config.

View File

@ -53,6 +53,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface {
return &FakeScales{c, namespace}
}
func (c *FakeExtensions) ThirdPartyResources(namespace string) v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c, namespace}
func (c *FakeExtensions) ThirdPartyResources() v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c}
}

View File

@ -28,14 +28,13 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface
type FakeThirdPartyResources struct {
Fake *FakeExtensions
ns string
}
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootCreateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil {
return nil, err
@ -45,7 +44,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootUpdateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil {
return nil, err
@ -55,13 +54,13 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootDeleteAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
return err
}
func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(thirdpartyresourcesResource, c.ns, listOptions)
action := core.NewRootDeleteCollectionAction(thirdpartyresourcesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.ThirdPartyResourceList{})
return err
@ -69,7 +68,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l
func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootGetAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
if obj == nil {
return nil, err
@ -79,7 +78,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyRe
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(thirdpartyresourcesResource, c.ns, opts), &v1beta1.ThirdPartyResourceList{})
Invokes(core.NewRootListAction(thirdpartyresourcesResource, opts), &v1beta1.ThirdPartyResourceList{})
if obj == nil {
return nil, err
@ -101,6 +100,6 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.Th
// Watch returns a watch.Interface that watches the requested thirdPartyResources.
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(thirdpartyresourcesResource, c.ns, opts))
InvokesWatch(core.NewRootWatchAction(thirdpartyresourcesResource, opts))
}

View File

@ -25,7 +25,7 @@ import (
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
// A group's client should implement this interface.
type ThirdPartyResourcesGetter interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
ThirdPartyResources() ThirdPartyResourceInterface
}
// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources.
@ -43,14 +43,12 @@ type ThirdPartyResourceInterface interface {
// thirdPartyResources implements ThirdPartyResourceInterface
type thirdPartyResources struct {
client *ExtensionsClient
ns string
}
// newThirdPartyResources returns a ThirdPartyResources
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources {
func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{
client: c,
ns: namespace,
}
}
@ -58,7 +56,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe
func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{}
err = c.client.Post().
Namespace(c.ns).
Resource("thirdpartyresources").
Body(thirdPartyResource).
Do().
@ -70,7 +67,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResou
func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{}
err = c.client.Put().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(thirdPartyResource.Name).
Body(thirdPartyResource).
@ -82,7 +78,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResou
// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs.
func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(name).
Body(options).
@ -93,7 +88,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er
// DeleteCollection deletes a collection of objects.
func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
@ -105,7 +99,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO
func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{}
err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(name).
Do().
@ -117,7 +110,6 @@ func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResour
func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
result = &v1beta1.ThirdPartyResourceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Do().
@ -129,7 +121,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdP
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Watch()

View File

@ -67,8 +67,8 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace)
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}
// NewForConfig creates a new ExtensionsClient for the given config.

View File

@ -53,6 +53,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface {
return &FakeScales{c, namespace}
}
func (c *FakeExtensions) ThirdPartyResources(namespace string) v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c, namespace}
func (c *FakeExtensions) ThirdPartyResources() v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c}
}

View File

@ -28,14 +28,13 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface
type FakeThirdPartyResources struct {
Fake *FakeExtensions
ns string
}
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootCreateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil {
return nil, err
@ -45,7 +44,7 @@ func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(thirdpartyresourcesResource, c.ns, thirdPartyResource), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootUpdateAction(thirdpartyresourcesResource, thirdPartyResource), &v1beta1.ThirdPartyResource{})
if obj == nil {
return nil, err
@ -55,13 +54,13 @@ func (c *FakeThirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyR
func (c *FakeThirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootDeleteAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
return err
}
func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(thirdpartyresourcesResource, c.ns, listOptions)
action := core.NewRootDeleteCollectionAction(thirdpartyresourcesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.ThirdPartyResourceList{})
return err
@ -69,7 +68,7 @@ func (c *FakeThirdPartyResources) DeleteCollection(options *api.DeleteOptions, l
func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(thirdpartyresourcesResource, c.ns, name), &v1beta1.ThirdPartyResource{})
Invokes(core.NewRootGetAction(thirdpartyresourcesResource, name), &v1beta1.ThirdPartyResource{})
if obj == nil {
return nil, err
@ -79,7 +78,7 @@ func (c *FakeThirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyRe
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(thirdpartyresourcesResource, c.ns, opts), &v1beta1.ThirdPartyResourceList{})
Invokes(core.NewRootListAction(thirdpartyresourcesResource, opts), &v1beta1.ThirdPartyResourceList{})
if obj == nil {
return nil, err
@ -101,6 +100,6 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (result *v1beta1.Th
// Watch returns a watch.Interface that watches the requested thirdPartyResources.
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(thirdpartyresourcesResource, c.ns, opts))
InvokesWatch(core.NewRootWatchAction(thirdpartyresourcesResource, opts))
}

View File

@ -25,7 +25,7 @@ import (
// ThirdPartyResourcesGetter has a method to return a ThirdPartyResourceInterface.
// A group's client should implement this interface.
type ThirdPartyResourcesGetter interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
ThirdPartyResources() ThirdPartyResourceInterface
}
// ThirdPartyResourceInterface has methods to work with ThirdPartyResource resources.
@ -47,10 +47,9 @@ type thirdPartyResources struct {
}
// newThirdPartyResources returns a ThirdPartyResources
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources {
func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{
client: c,
ns: namespace,
}
}
@ -58,7 +57,6 @@ func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyRe
func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{}
err = c.client.Post().
Namespace(c.ns).
Resource("thirdpartyresources").
Body(thirdPartyResource).
Do().
@ -70,7 +68,6 @@ func (c *thirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResou
func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{}
err = c.client.Put().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(thirdPartyResource.Name).
Body(thirdPartyResource).
@ -82,7 +79,6 @@ func (c *thirdPartyResources) Update(thirdPartyResource *v1beta1.ThirdPartyResou
// Delete takes name of the thirdPartyResource and deletes it. Returns an error if one occurs.
func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(name).
Body(options).
@ -93,7 +89,6 @@ func (c *thirdPartyResources) Delete(name string, options *api.DeleteOptions) er
// DeleteCollection deletes a collection of objects.
func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
@ -105,7 +100,6 @@ func (c *thirdPartyResources) DeleteCollection(options *api.DeleteOptions, listO
func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResource, err error) {
result = &v1beta1.ThirdPartyResource{}
err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources").
Name(name).
Do().
@ -117,7 +111,6 @@ func (c *thirdPartyResources) Get(name string) (result *v1beta1.ThirdPartyResour
func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdPartyResourceList, err error) {
result = &v1beta1.ThirdPartyResourceList{}
err = c.client.Get().
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Do().
@ -129,7 +122,6 @@ func (c *thirdPartyResources) List(opts api.ListOptions) (result *v1beta1.ThirdP
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Watch()

View File

@ -74,8 +74,8 @@ func (c *ExtensionsClient) Ingress(namespace string) IngressInterface {
return newIngress(c, namespace)
}
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface {
return newThirdPartyResources(c, namespace)
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {

View File

@ -26,15 +26,14 @@ import (
// FakeThirdPartyResources implements ThirdPartyResourceInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the method you want to test easier.
type FakeThirdPartyResources struct {
Fake *FakeExperimental
Namespace string
Fake *FakeExperimental
}
// Ensure statically that FakeThirdPartyResources implements DaemonInterface.
var _ kclientlib.ThirdPartyResourceInterface = &FakeThirdPartyResources{}
func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewGetAction("thirdpartyresources", c.Namespace, name), &extensions.ThirdPartyResource{})
obj, err := c.Fake.Invokes(NewGetAction("thirdpartyresources", "", name), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -42,7 +41,7 @@ func (c *FakeThirdPartyResources) Get(name string) (*extensions.ThirdPartyResour
}
func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) {
obj, err := c.Fake.Invokes(NewListAction("thirdpartyresources", c.Namespace, opts), &extensions.ThirdPartyResourceList{})
obj, err := c.Fake.Invokes(NewListAction("thirdpartyresources", "", opts), &extensions.ThirdPartyResourceList{})
if obj == nil {
return nil, err
}
@ -50,7 +49,7 @@ func (c *FakeThirdPartyResources) List(opts api.ListOptions) (*extensions.ThirdP
}
func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewCreateAction("thirdpartyresources", c.Namespace, daemon), &extensions.ThirdPartyResource{})
obj, err := c.Fake.Invokes(NewCreateAction("thirdpartyresources", "", daemon), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -58,7 +57,7 @@ func (c *FakeThirdPartyResources) Create(daemon *extensions.ThirdPartyResource)
}
func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("thirdpartyresources", c.Namespace, daemon), &extensions.ThirdPartyResource{})
obj, err := c.Fake.Invokes(NewUpdateAction("thirdpartyresources", "", daemon), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -66,7 +65,7 @@ func (c *FakeThirdPartyResources) Update(daemon *extensions.ThirdPartyResource)
}
func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("thirdpartyresources", "status", c.Namespace, daemon), &extensions.ThirdPartyResource{})
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("thirdpartyresources", "status", "", daemon), &extensions.ThirdPartyResource{})
if obj == nil {
return nil, err
}
@ -74,10 +73,10 @@ func (c *FakeThirdPartyResources) UpdateStatus(daemon *extensions.ThirdPartyReso
}
func (c *FakeThirdPartyResources) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("thirdpartyresources", c.Namespace, name), &extensions.ThirdPartyResource{})
_, err := c.Fake.Invokes(NewDeleteAction("thirdpartyresources", "", name), &extensions.ThirdPartyResource{})
return err
}
func (c *FakeThirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("thirdpartyresources", c.Namespace, opts))
return c.Fake.InvokesWatch(NewWatchAction("thirdpartyresources", "", opts))
}

View File

@ -374,8 +374,8 @@ func (c *FakeExperimental) Ingress(namespace string) client.IngressInterface {
return &FakeIngress{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) ThirdPartyResources(namespace string) client.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{Fake: c, Namespace: namespace}
func (c *FakeExperimental) ThirdPartyResources() client.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{Fake: c}
}
func (c *FakeExperimental) ReplicaSets(namespace string) client.ReplicaSetInterface {

View File

@ -24,7 +24,7 @@ import (
// ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace
type ThirdPartyResourceNamespacer interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
ThirdPartyResources() ThirdPartyResourceInterface
}
type ThirdPartyResourceInterface interface {
@ -39,12 +39,11 @@ type ThirdPartyResourceInterface interface {
// thirdPartyResources implements DaemonsSetsNamespacer interface
type thirdPartyResources struct {
r *ExtensionsClient
ns string
r *ExtensionsClient
}
func newThirdPartyResources(c *ExtensionsClient, namespace string) *thirdPartyResources {
return &thirdPartyResources{c, namespace}
func newThirdPartyResources(c *ExtensionsClient) *thirdPartyResources {
return &thirdPartyResources{c}
}
// Ensure statically that thirdPartyResources implements ThirdPartyResourcesInterface.
@ -52,48 +51,47 @@ var _ ThirdPartyResourceInterface = &thirdPartyResources{}
func (c *thirdPartyResources) List(opts api.ListOptions) (result *extensions.ThirdPartyResourceList, err error) {
result = &extensions.ThirdPartyResourceList{}
err = c.r.Get().Namespace(c.ns).Resource("thirdpartyresources").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
err = c.r.Get().Resource("thirdpartyresources").VersionedParams(&opts, api.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular third party resource.
func (c *thirdPartyResources) Get(name string) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.r.Get().Namespace(c.ns).Resource("thirdpartyresources").Name(name).Do().Into(result)
err = c.r.Get().Resource("thirdpartyresources").Name(name).Do().Into(result)
return
}
// Create creates a new third party resource.
func (c *thirdPartyResources) Create(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.r.Post().Namespace(c.ns).Resource("thirdpartyresources").Body(resource).Do().Into(result)
err = c.r.Post().Resource("thirdpartyresources").Body(resource).Do().Into(result)
return
}
// Update updates an existing third party resource.
func (c *thirdPartyResources) Update(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.r.Put().Namespace(c.ns).Resource("thirdpartyresources").Name(resource.Name).Body(resource).Do().Into(result)
err = c.r.Put().Resource("thirdpartyresources").Name(resource.Name).Body(resource).Do().Into(result)
return
}
// UpdateStatus updates an existing third party resource status
func (c *thirdPartyResources) UpdateStatus(resource *extensions.ThirdPartyResource) (result *extensions.ThirdPartyResource, err error) {
result = &extensions.ThirdPartyResource{}
err = c.r.Put().Namespace(c.ns).Resource("thirdpartyresources").Name(resource.Name).SubResource("status").Body(resource).Do().Into(result)
err = c.r.Put().Resource("thirdpartyresources").Name(resource.Name).SubResource("status").Body(resource).Do().Into(result)
return
}
// Delete deletes an existing third party resource.
func (c *thirdPartyResources) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("thirdpartyresources").Name(name).Do().Error()
return c.r.Delete().Resource("thirdpartyresources").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested third party resources.
func (c *thirdPartyResources) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("thirdpartyresources").
VersionedParams(&opts, api.ParameterCodec).
Watch()

View File

@ -30,11 +30,10 @@ func getThirdPartyResourceName() string {
}
func TestListThirdPartyResources(t *testing.T) {
ns := api.NamespaceAll
c := &simple.Client{
Request: simple.Request{
Method: "GET",
Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, ""),
Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", ""),
},
Response: simple.Response{StatusCode: 200,
Body: &extensions.ThirdPartyResourceList{
@ -53,16 +52,15 @@ func TestListThirdPartyResources(t *testing.T) {
},
},
}
receivedDSs, err := c.Setup(t).Extensions().ThirdPartyResources(ns).List(api.ListOptions{})
receivedDSs, err := c.Setup(t).Extensions().ThirdPartyResources().List(api.ListOptions{})
defer c.Close()
c.Validate(t, receivedDSs, err)
}
func TestGetThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
c := &simple.Client{
Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.ThirdPartyResource{
@ -77,15 +75,14 @@ func TestGetThirdPartyResource(t *testing.T) {
},
},
}
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Get("foo")
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().Get("foo")
defer c.Close()
c.Validate(t, receivedThirdPartyResource, err)
}
func TestGetThirdPartyResourceWithNoName(t *testing.T) {
ns := api.NamespaceDefault
c := &simple.Client{Error: true}
receivedPod, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Get("")
receivedPod, err := c.Setup(t).Extensions().ThirdPartyResources().Get("")
defer c.Close()
if (err != nil) && (err.Error() != simple.NameRequiredError) {
t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err)
@ -95,12 +92,11 @@ func TestGetThirdPartyResourceWithNoName(t *testing.T) {
}
func TestUpdateThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
requestThirdPartyResource := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
}
c := &simple.Client{
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.ThirdPartyResource{
@ -115,18 +111,17 @@ func TestUpdateThirdPartyResource(t *testing.T) {
},
},
}
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Update(requestThirdPartyResource)
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().Update(requestThirdPartyResource)
defer c.Close()
c.Validate(t, receivedThirdPartyResource, err)
}
func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) {
ns := api.NamespaceDefault
requestThirdPartyResource := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
}
c := &simple.Client{
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo") + "/status", Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo") + "/status", Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.ThirdPartyResource{
@ -141,29 +136,27 @@ func TestUpdateThirdPartyResourceUpdateStatus(t *testing.T) {
},
},
}
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).UpdateStatus(requestThirdPartyResource)
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().UpdateStatus(requestThirdPartyResource)
defer c.Close()
c.Validate(t, receivedThirdPartyResource, err)
}
func TestDeleteThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
c := &simple.Client{
Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, "foo"), Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{StatusCode: 200},
}
err := c.Setup(t).Extensions().ThirdPartyResources(ns).Delete("foo")
err := c.Setup(t).Extensions().ThirdPartyResources().Delete("foo")
defer c.Close()
c.Validate(t, nil, err)
}
func TestCreateThirdPartyResource(t *testing.T) {
ns := api.NamespaceDefault
requestThirdPartyResource := &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{Name: "foo"},
}
c := &simple.Client{
Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), ns, ""), Body: requestThirdPartyResource, Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getThirdPartyResourceName(), "", ""), Body: requestThirdPartyResource, Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.ThirdPartyResource{
@ -178,7 +171,7 @@ func TestCreateThirdPartyResource(t *testing.T) {
},
},
}
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources(ns).Create(requestThirdPartyResource)
receivedThirdPartyResource, err := c.Setup(t).Extensions().ThirdPartyResources().Create(requestThirdPartyResource)
defer c.Close()
c.Validate(t, receivedThirdPartyResource, err)
}

View File

@ -43,10 +43,10 @@ func NewREST(opts generic.RESTOptions) *REST {
NewFunc: func() runtime.Object { return &extensions.ThirdPartyResource{} },
NewListFunc: func() runtime.Object { return &extensions.ThirdPartyResourceList{} },
KeyRootFunc: func(ctx api.Context) string {
return registry.NamespaceKeyRootFunc(ctx, prefix)
return prefix
},
KeyFunc: func(ctx api.Context, id string) (string, error) {
return registry.NamespaceKeyFunc(ctx, prefix, id)
return registry.NoNamespaceKeyFunc(ctx, prefix, id)
},
ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*extensions.ThirdPartyResource).Name, nil

View File

@ -40,8 +40,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource {
return &extensions.ThirdPartyResource{
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
Name: name,
},
Versions: []extensions.APIVersion{
{
@ -54,9 +53,9 @@ func validNewThirdPartyResource(name string) *extensions.ThirdPartyResource {
func TestCreate(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
test := registrytest.New(t, storage.Store)
test := registrytest.New(t, storage.Store).ClusterScope()
rsrc := validNewThirdPartyResource("foo")
rsrc.ObjectMeta = api.ObjectMeta{}
rsrc.ObjectMeta = api.ObjectMeta{GenerateName: "foo-"}
test.TestCreate(
// valid
rsrc,
@ -68,7 +67,7 @@ func TestCreate(t *testing.T) {
func TestUpdate(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
test := registrytest.New(t, storage.Store)
test := registrytest.New(t, storage.Store).ClusterScope()
test.TestUpdate(
// valid
validNewThirdPartyResource("foo"),
@ -84,28 +83,28 @@ func TestUpdate(t *testing.T) {
func TestDelete(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
test := registrytest.New(t, storage.Store)
test := registrytest.New(t, storage.Store).ClusterScope()
test.TestDelete(validNewThirdPartyResource("foo"))
}
func TestGet(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
test := registrytest.New(t, storage.Store)
test := registrytest.New(t, storage.Store).ClusterScope()
test.TestGet(validNewThirdPartyResource("foo"))
}
func TestList(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
test := registrytest.New(t, storage.Store)
test := registrytest.New(t, storage.Store).ClusterScope()
test.TestList(validNewThirdPartyResource("foo"))
}
func TestWatch(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
test := registrytest.New(t, storage.Store)
test := registrytest.New(t, storage.Store).ClusterScope()
test.TestWatch(
validNewThirdPartyResource("foo"),
// matching labels

View File

@ -45,7 +45,7 @@ var _ = rest.RESTCreateStrategy(Strategy)
var _ = rest.RESTUpdateStrategy(Strategy)
func (strategy) NamespaceScoped() bool {
return true
return false
}
func (strategy) PrepareForCreate(obj runtime.Object) {