diff --git a/.gitignore b/.gitignore index dda7f45d..e9292d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .build *.swp release-tools +.idea \ No newline at end of file diff --git a/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go b/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go index 67089a2e..d6f496db 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go +++ b/apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go @@ -51,6 +51,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketRequestStatus": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_BucketRequestStatus(ref), "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketSpec": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_BucketSpec(ref), "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.BucketStatus": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_BucketStatus(ref), + "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriver": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriver(ref), + "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverList": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriverList(ref), + "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverSpec": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriverSpec(ref), + "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverStatus": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriverStatus(ref), "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.GCSProtocol": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_GCSProtocol(ref), "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.Protocol": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_Protocol(ref), "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.S3Protocol": schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_S3Protocol(ref), @@ -1028,6 +1032,131 @@ func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alp } } +func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriver(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverSpec", "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriverStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriverList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriver"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1.COSIDriver", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriverSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "provisioner": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_COSIDriverStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "registered": { + SchemaProps: spec.SchemaProps{ + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_container_object_storage_interface_api_apis_objectstoragek8sio_v1alpha1_GCSProtocol(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/objectstorage.k8s.io/v1alpha1/types.go b/apis/objectstorage.k8s.io/v1alpha1/types.go index e9ae280f..ee196de0 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/types.go +++ b/apis/objectstorage.k8s.io/v1alpha1/types.go @@ -277,6 +277,40 @@ type BucketAccessRequestList struct { Items []BucketAccessRequest `json:"items"` } + +type COSIDriverSpec struct { + // +optional + Provisioner string `json:"provisioner,omitempty"` +} + +type COSIDriverStatus struct { + // +optional + Registered bool `json:"registered"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope=Namespaced +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +type COSIDriver struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec COSIDriverSpec `json:"spec,omitempty"` + // +optional + Status COSIDriverStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type COSIDriverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []COSIDriver `json:"items"` +} + func init() { SchemeBuilder.Register(&Bucket{}, &BucketList{}) SchemeBuilder.Register(&BucketRequest{}, &BucketRequestList{}) @@ -285,4 +319,6 @@ func init() { SchemeBuilder.Register(&BucketAccess{}, &BucketAccessList{}) SchemeBuilder.Register(&BucketAccessRequest{}, &BucketAccessRequestList{}) SchemeBuilder.Register(&BucketAccessClass{}, &BucketAccessClassList{}) + + SchemeBuilder.Register(&COSIDriver{}, &COSIDriverList{}) } diff --git a/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go b/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go index 8d9e27ed..43a8f9bb 100644 --- a/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go +++ b/apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go @@ -609,6 +609,99 @@ func (in *BucketStatus) DeepCopy() *BucketStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *COSIDriver) DeepCopyInto(out *COSIDriver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new COSIDriver. +func (in *COSIDriver) DeepCopy() *COSIDriver { + if in == nil { + return nil + } + out := new(COSIDriver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *COSIDriver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *COSIDriverList) DeepCopyInto(out *COSIDriverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]COSIDriver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new COSIDriverList. +func (in *COSIDriverList) DeepCopy() *COSIDriverList { + if in == nil { + return nil + } + out := new(COSIDriverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *COSIDriverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *COSIDriverSpec) DeepCopyInto(out *COSIDriverSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new COSIDriverSpec. +func (in *COSIDriverSpec) DeepCopy() *COSIDriverSpec { + if in == nil { + return nil + } + out := new(COSIDriverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *COSIDriverStatus) DeepCopyInto(out *COSIDriverStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new COSIDriverStatus. +func (in *COSIDriverStatus) DeepCopy() *COSIDriverStatus { + if in == nil { + return nil + } + out := new(COSIDriverStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GCSProtocol) DeepCopyInto(out *GCSProtocol) { *out = *in diff --git a/clientset/fake/register.go b/clientset/fake/register.go index d6a90589..65e5a3d8 100644 --- a/clientset/fake/register.go +++ b/clientset/fake/register.go @@ -29,7 +29,7 @@ import ( var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) - +var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ objectstoragev1alpha1.AddToScheme, } diff --git a/clientset/typed/objectstorage.k8s.io/v1alpha1/cosidriver.go b/clientset/typed/objectstorage.k8s.io/v1alpha1/cosidriver.go new file mode 100644 index 00000000..631649ee --- /dev/null +++ b/clientset/typed/objectstorage.k8s.io/v1alpha1/cosidriver.go @@ -0,0 +1,195 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1" + scheme "github.com/kubernetes-sigs/container-object-storage-interface-api/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// COSIDriversGetter has a method to return a COSIDriverInterface. +// A group's client should implement this interface. +type COSIDriversGetter interface { + COSIDrivers(namespace string) COSIDriverInterface +} + +// COSIDriverInterface has methods to work with COSIDriver resources. +type COSIDriverInterface interface { + Create(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.CreateOptions) (*v1alpha1.COSIDriver, error) + Update(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.UpdateOptions) (*v1alpha1.COSIDriver, error) + UpdateStatus(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.UpdateOptions) (*v1alpha1.COSIDriver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.COSIDriver, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.COSIDriverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.COSIDriver, err error) + COSIDriverExpansion +} + +// cOSIDrivers implements COSIDriverInterface +type cOSIDrivers struct { + client rest.Interface + ns string +} + +// newCOSIDrivers returns a COSIDrivers +func newCOSIDrivers(c *ObjectstorageV1alpha1Client, namespace string) *cOSIDrivers { + return &cOSIDrivers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cOSIDriver, and returns the corresponding cOSIDriver object, and an error if there is any. +func (c *cOSIDrivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.COSIDriver, err error) { + result = &v1alpha1.COSIDriver{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cosidrivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of COSIDrivers that match those selectors. +func (c *cOSIDrivers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.COSIDriverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.COSIDriverList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cosidrivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cOSIDrivers. +func (c *cOSIDrivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cosidrivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a cOSIDriver and creates it. Returns the server's representation of the cOSIDriver, and an error, if there is any. +func (c *cOSIDrivers) Create(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.CreateOptions) (result *v1alpha1.COSIDriver, err error) { + result = &v1alpha1.COSIDriver{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cosidrivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cOSIDriver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a cOSIDriver and updates it. Returns the server's representation of the cOSIDriver, and an error, if there is any. +func (c *cOSIDrivers) Update(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.UpdateOptions) (result *v1alpha1.COSIDriver, err error) { + result = &v1alpha1.COSIDriver{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cosidrivers"). + Name(cOSIDriver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cOSIDriver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *cOSIDrivers) UpdateStatus(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.UpdateOptions) (result *v1alpha1.COSIDriver, err error) { + result = &v1alpha1.COSIDriver{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cosidrivers"). + Name(cOSIDriver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cOSIDriver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the cOSIDriver and deletes it. Returns an error if one occurs. +func (c *cOSIDrivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cosidrivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cOSIDrivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("cosidrivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched cOSIDriver. +func (c *cOSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.COSIDriver, err error) { + result = &v1alpha1.COSIDriver{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cosidrivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_cosidriver.go b/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_cosidriver.go new file mode 100644 index 00000000..e2e6397f --- /dev/null +++ b/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_cosidriver.go @@ -0,0 +1,142 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCOSIDrivers implements COSIDriverInterface +type FakeCOSIDrivers struct { + Fake *FakeObjectstorageV1alpha1 + ns string +} + +var cosidriversResource = schema.GroupVersionResource{Group: "objectstorage.k8s.io", Version: "v1alpha1", Resource: "cosidrivers"} + +var cosidriversKind = schema.GroupVersionKind{Group: "objectstorage.k8s.io", Version: "v1alpha1", Kind: "COSIDriver"} + +// Get takes name of the cOSIDriver, and returns the corresponding cOSIDriver object, and an error if there is any. +func (c *FakeCOSIDrivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.COSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cosidriversResource, c.ns, name), &v1alpha1.COSIDriver{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.COSIDriver), err +} + +// List takes label and field selectors, and returns the list of COSIDrivers that match those selectors. +func (c *FakeCOSIDrivers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.COSIDriverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cosidriversResource, cosidriversKind, c.ns, opts), &v1alpha1.COSIDriverList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.COSIDriverList{ListMeta: obj.(*v1alpha1.COSIDriverList).ListMeta} + for _, item := range obj.(*v1alpha1.COSIDriverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cOSIDrivers. +func (c *FakeCOSIDrivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cosidriversResource, c.ns, opts)) + +} + +// Create takes the representation of a cOSIDriver and creates it. Returns the server's representation of the cOSIDriver, and an error, if there is any. +func (c *FakeCOSIDrivers) Create(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.CreateOptions) (result *v1alpha1.COSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cosidriversResource, c.ns, cOSIDriver), &v1alpha1.COSIDriver{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.COSIDriver), err +} + +// Update takes the representation of a cOSIDriver and updates it. Returns the server's representation of the cOSIDriver, and an error, if there is any. +func (c *FakeCOSIDrivers) Update(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.UpdateOptions) (result *v1alpha1.COSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cosidriversResource, c.ns, cOSIDriver), &v1alpha1.COSIDriver{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.COSIDriver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCOSIDrivers) UpdateStatus(ctx context.Context, cOSIDriver *v1alpha1.COSIDriver, opts v1.UpdateOptions) (*v1alpha1.COSIDriver, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(cosidriversResource, "status", c.ns, cOSIDriver), &v1alpha1.COSIDriver{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.COSIDriver), err +} + +// Delete takes name of the cOSIDriver and deletes it. Returns an error if one occurs. +func (c *FakeCOSIDrivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(cosidriversResource, c.ns, name), &v1alpha1.COSIDriver{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCOSIDrivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cosidriversResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.COSIDriverList{}) + return err +} + +// Patch applies the patch and returns the patched cOSIDriver. +func (c *FakeCOSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.COSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cosidriversResource, c.ns, name, pt, data, subresources...), &v1alpha1.COSIDriver{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.COSIDriver), err +} diff --git a/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_objectstorage.k8s.io_client.go b/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_objectstorage.k8s.io_client.go index 7f586e1e..092b838e 100644 --- a/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_objectstorage.k8s.io_client.go +++ b/clientset/typed/objectstorage.k8s.io/v1alpha1/fake/fake_objectstorage.k8s.io_client.go @@ -52,6 +52,10 @@ func (c *FakeObjectstorageV1alpha1) BucketRequests(namespace string) v1alpha1.Bu return &FakeBucketRequests{c, namespace} } +func (c *FakeObjectstorageV1alpha1) COSIDrivers(namespace string) v1alpha1.COSIDriverInterface { + return &FakeCOSIDrivers{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeObjectstorageV1alpha1) RESTClient() rest.Interface { diff --git a/clientset/typed/objectstorage.k8s.io/v1alpha1/generated_expansion.go b/clientset/typed/objectstorage.k8s.io/v1alpha1/generated_expansion.go index 7b9057e3..dc94aacc 100644 --- a/clientset/typed/objectstorage.k8s.io/v1alpha1/generated_expansion.go +++ b/clientset/typed/objectstorage.k8s.io/v1alpha1/generated_expansion.go @@ -29,3 +29,5 @@ type BucketAccessRequestExpansion interface{} type BucketClassExpansion interface{} type BucketRequestExpansion interface{} + +type COSIDriverExpansion interface{} diff --git a/clientset/typed/objectstorage.k8s.io/v1alpha1/objectstorage.k8s.io_client.go b/clientset/typed/objectstorage.k8s.io/v1alpha1/objectstorage.k8s.io_client.go index b46e7b49..e6d23dd2 100644 --- a/clientset/typed/objectstorage.k8s.io/v1alpha1/objectstorage.k8s.io_client.go +++ b/clientset/typed/objectstorage.k8s.io/v1alpha1/objectstorage.k8s.io_client.go @@ -32,6 +32,7 @@ type ObjectstorageV1alpha1Interface interface { BucketAccessRequestsGetter BucketClassesGetter BucketRequestsGetter + COSIDriversGetter } // ObjectstorageV1alpha1Client is used to interact with features provided by the objectstorage.k8s.io group. @@ -63,6 +64,10 @@ func (c *ObjectstorageV1alpha1Client) BucketRequests(namespace string) BucketReq return newBucketRequests(c, namespace) } +func (c *ObjectstorageV1alpha1Client) COSIDrivers(namespace string) COSIDriverInterface { + return newCOSIDrivers(c, namespace) +} + // NewForConfig creates a new ObjectstorageV1alpha1Client for the given config. func NewForConfig(c *rest.Config) (*ObjectstorageV1alpha1Client, error) { config := *c diff --git a/crds/objectstorage.k8s.io_bucketaccessclasses.yaml b/crds/objectstorage.k8s.io_bucketaccessclasses.yaml index 61fdf48f..9e4b7c44 100644 --- a/crds/objectstorage.k8s.io_bucketaccessclasses.yaml +++ b/crds/objectstorage.k8s.io_bucketaccessclasses.yaml @@ -101,5 +101,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: null - storedVersions: null + conditions: [] + storedVersions: [] diff --git a/crds/objectstorage.k8s.io_bucketaccesses.yaml b/crds/objectstorage.k8s.io_bucketaccesses.yaml index d4127f93..656b308d 100644 --- a/crds/objectstorage.k8s.io_bucketaccesses.yaml +++ b/crds/objectstorage.k8s.io_bucketaccesses.yaml @@ -183,5 +183,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: null - storedVersions: null + conditions: [] + storedVersions: [] diff --git a/crds/objectstorage.k8s.io_bucketaccessrequests.yaml b/crds/objectstorage.k8s.io_bucketaccessrequests.yaml index 02b22839..f65125c7 100644 --- a/crds/objectstorage.k8s.io_bucketaccessrequests.yaml +++ b/crds/objectstorage.k8s.io_bucketaccessrequests.yaml @@ -62,5 +62,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: null - storedVersions: null + conditions: [] + storedVersions: [] diff --git a/crds/objectstorage.k8s.io_bucketclasses.yaml b/crds/objectstorage.k8s.io_bucketclasses.yaml index 363d8d30..142af636 100644 --- a/crds/objectstorage.k8s.io_bucketclasses.yaml +++ b/crds/objectstorage.k8s.io_bucketclasses.yaml @@ -114,5 +114,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: null - storedVersions: null + conditions: [] + storedVersions: [] diff --git a/crds/objectstorage.k8s.io_bucketrequests.yaml b/crds/objectstorage.k8s.io_bucketrequests.yaml index 3cd5d037..115ad20a 100644 --- a/crds/objectstorage.k8s.io_bucketrequests.yaml +++ b/crds/objectstorage.k8s.io_bucketrequests.yaml @@ -57,5 +57,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: null - storedVersions: null + conditions: [] + storedVersions: [] diff --git a/crds/objectstorage.k8s.io_buckets.yaml b/crds/objectstorage.k8s.io_buckets.yaml index 2c558e83..45529b57 100644 --- a/crds/objectstorage.k8s.io_buckets.yaml +++ b/crds/objectstorage.k8s.io_buckets.yaml @@ -185,5 +185,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: null - storedVersions: null + conditions: [] + storedVersions: [] diff --git a/crds/objectstorage.k8s.io_cosidrivers.yaml b/crds/objectstorage.k8s.io_cosidrivers.yaml new file mode 100644 index 00000000..056ae03e --- /dev/null +++ b/crds/objectstorage.k8s.io_cosidrivers.yaml @@ -0,0 +1,55 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: cosidrivers.objectstorage.k8s.io +spec: + group: objectstorage.k8s.io + names: + kind: COSIDriver + listKind: COSIDriverList + plural: cosidrivers + singular: cosidriver + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + provisioner: + type: string + type: object + status: + properties: + registered: + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/informers/externalversions/generic.go b/informers/externalversions/generic.go index 77ff19a8..c6d855a2 100644 --- a/informers/externalversions/generic.go +++ b/informers/externalversions/generic.go @@ -65,6 +65,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Objectstorage().V1alpha1().BucketClasses().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("bucketrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Objectstorage().V1alpha1().BucketRequests().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("cosidrivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Objectstorage().V1alpha1().COSIDrivers().Informer()}, nil } diff --git a/informers/externalversions/objectstorage.k8s.io/v1alpha1/cosidriver.go b/informers/externalversions/objectstorage.k8s.io/v1alpha1/cosidriver.go new file mode 100644 index 00000000..f4fa7b15 --- /dev/null +++ b/informers/externalversions/objectstorage.k8s.io/v1alpha1/cosidriver.go @@ -0,0 +1,90 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + objectstoragek8siov1alpha1 "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1" + clientset "github.com/kubernetes-sigs/container-object-storage-interface-api/clientset" + internalinterfaces "github.com/kubernetes-sigs/container-object-storage-interface-api/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kubernetes-sigs/container-object-storage-interface-api/listers/objectstorage.k8s.io/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// COSIDriverInformer provides access to a shared informer and lister for +// COSIDrivers. +type COSIDriverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.COSIDriverLister +} + +type cOSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCOSIDriverInformer constructs a new informer for COSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCOSIDriverInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCOSIDriverInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCOSIDriverInformer constructs a new informer for COSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCOSIDriverInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ObjectstorageV1alpha1().COSIDrivers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ObjectstorageV1alpha1().COSIDrivers(namespace).Watch(context.TODO(), options) + }, + }, + &objectstoragek8siov1alpha1.COSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f *cOSIDriverInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCOSIDriverInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cOSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&objectstoragek8siov1alpha1.COSIDriver{}, f.defaultInformer) +} + +func (f *cOSIDriverInformer) Lister() v1alpha1.COSIDriverLister { + return v1alpha1.NewCOSIDriverLister(f.Informer().GetIndexer()) +} diff --git a/informers/externalversions/objectstorage.k8s.io/v1alpha1/interface.go b/informers/externalversions/objectstorage.k8s.io/v1alpha1/interface.go index e9871240..bb85b4df 100644 --- a/informers/externalversions/objectstorage.k8s.io/v1alpha1/interface.go +++ b/informers/externalversions/objectstorage.k8s.io/v1alpha1/interface.go @@ -36,6 +36,8 @@ type Interface interface { BucketClasses() BucketClassInformer // BucketRequests returns a BucketRequestInformer. BucketRequests() BucketRequestInformer + // COSIDrivers returns a COSIDriverInformer. + COSIDrivers() COSIDriverInformer } type version struct { @@ -78,3 +80,8 @@ func (v *version) BucketClasses() BucketClassInformer { func (v *version) BucketRequests() BucketRequestInformer { return &bucketRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } + +// COSIDrivers returns a COSIDriverInformer. +func (v *version) COSIDrivers() COSIDriverInformer { + return &cOSIDriverInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucket.go b/listers/objectstorage.k8s.io/v1alpha1/bucket.go index 4c37850d..9519ae4a 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucket.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucket.go @@ -26,13 +26,10 @@ import ( ) // BucketLister helps list Buckets. -// All objects returned here must be treated as read-only. type BucketLister interface { // List lists all Buckets in the indexer. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.Bucket, err error) // Get retrieves the Bucket from the index for a given name. - // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.Bucket, error) BucketListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go b/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go index f425d65b..2eda3733 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketaccess.go @@ -26,13 +26,10 @@ import ( ) // BucketAccessLister helps list BucketAccesses. -// All objects returned here must be treated as read-only. type BucketAccessLister interface { // List lists all BucketAccesses in the indexer. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccess, err error) // Get retrieves the BucketAccess from the index for a given name. - // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketAccess, error) BucketAccessListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go index e0ae5931..744e8a86 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessclass.go @@ -26,13 +26,10 @@ import ( ) // BucketAccessClassLister helps list BucketAccessClasses. -// All objects returned here must be treated as read-only. type BucketAccessClassLister interface { // List lists all BucketAccessClasses in the indexer. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccessClass, err error) // Get retrieves the BucketAccessClass from the index for a given name. - // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketAccessClass, error) BucketAccessClassListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go index 61fb7890..69b5a0e6 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketaccessrequest.go @@ -26,10 +26,8 @@ import ( ) // BucketAccessRequestLister helps list BucketAccessRequests. -// All objects returned here must be treated as read-only. type BucketAccessRequestLister interface { // List lists all BucketAccessRequests in the indexer. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccessRequest, err error) // BucketAccessRequests returns an object that can list and get BucketAccessRequests. BucketAccessRequests(namespace string) BucketAccessRequestNamespaceLister @@ -60,13 +58,10 @@ func (s *bucketAccessRequestLister) BucketAccessRequests(namespace string) Bucke } // BucketAccessRequestNamespaceLister helps list and get BucketAccessRequests. -// All objects returned here must be treated as read-only. type BucketAccessRequestNamespaceLister interface { // List lists all BucketAccessRequests in the indexer for a given namespace. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketAccessRequest, err error) // Get retrieves the BucketAccessRequest from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketAccessRequest, error) BucketAccessRequestNamespaceListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go b/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go index 29646bd4..f9583098 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketclass.go @@ -26,13 +26,10 @@ import ( ) // BucketClassLister helps list BucketClasses. -// All objects returned here must be treated as read-only. type BucketClassLister interface { // List lists all BucketClasses in the indexer. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketClass, err error) // Get retrieves the BucketClass from the index for a given name. - // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketClass, error) BucketClassListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go b/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go index eebfde45..37836725 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go +++ b/listers/objectstorage.k8s.io/v1alpha1/bucketrequest.go @@ -26,10 +26,8 @@ import ( ) // BucketRequestLister helps list BucketRequests. -// All objects returned here must be treated as read-only. type BucketRequestLister interface { // List lists all BucketRequests in the indexer. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketRequest, err error) // BucketRequests returns an object that can list and get BucketRequests. BucketRequests(namespace string) BucketRequestNamespaceLister @@ -60,13 +58,10 @@ func (s *bucketRequestLister) BucketRequests(namespace string) BucketRequestName } // BucketRequestNamespaceLister helps list and get BucketRequests. -// All objects returned here must be treated as read-only. type BucketRequestNamespaceLister interface { // List lists all BucketRequests in the indexer for a given namespace. - // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.BucketRequest, err error) // Get retrieves the BucketRequest from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. Get(name string) (*v1alpha1.BucketRequest, error) BucketRequestNamespaceListerExpansion } diff --git a/listers/objectstorage.k8s.io/v1alpha1/cosidriver.go b/listers/objectstorage.k8s.io/v1alpha1/cosidriver.go new file mode 100644 index 00000000..6ca152ce --- /dev/null +++ b/listers/objectstorage.k8s.io/v1alpha1/cosidriver.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kubernetes-sigs/container-object-storage-interface-api/apis/objectstorage.k8s.io/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// COSIDriverLister helps list COSIDrivers. +type COSIDriverLister interface { + // List lists all COSIDrivers in the indexer. + List(selector labels.Selector) (ret []*v1alpha1.COSIDriver, err error) + // COSIDrivers returns an object that can list and get COSIDrivers. + COSIDrivers(namespace string) COSIDriverNamespaceLister + COSIDriverListerExpansion +} + +// cOSIDriverLister implements the COSIDriverLister interface. +type cOSIDriverLister struct { + indexer cache.Indexer +} + +// NewCOSIDriverLister returns a new COSIDriverLister. +func NewCOSIDriverLister(indexer cache.Indexer) COSIDriverLister { + return &cOSIDriverLister{indexer: indexer} +} + +// List lists all COSIDrivers in the indexer. +func (s *cOSIDriverLister) List(selector labels.Selector) (ret []*v1alpha1.COSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.COSIDriver)) + }) + return ret, err +} + +// COSIDrivers returns an object that can list and get COSIDrivers. +func (s *cOSIDriverLister) COSIDrivers(namespace string) COSIDriverNamespaceLister { + return cOSIDriverNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// COSIDriverNamespaceLister helps list and get COSIDrivers. +type COSIDriverNamespaceLister interface { + // List lists all COSIDrivers in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha1.COSIDriver, err error) + // Get retrieves the COSIDriver from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.COSIDriver, error) + COSIDriverNamespaceListerExpansion +} + +// cOSIDriverNamespaceLister implements the COSIDriverNamespaceLister +// interface. +type cOSIDriverNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all COSIDrivers in the indexer for a given namespace. +func (s cOSIDriverNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.COSIDriver, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.COSIDriver)) + }) + return ret, err +} + +// Get retrieves the COSIDriver from the indexer for a given namespace and name. +func (s cOSIDriverNamespaceLister) Get(name string) (*v1alpha1.COSIDriver, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("cosidriver"), name) + } + return obj.(*v1alpha1.COSIDriver), nil +} diff --git a/listers/objectstorage.k8s.io/v1alpha1/expansion_generated.go b/listers/objectstorage.k8s.io/v1alpha1/expansion_generated.go index b90e4eee..0c9167b4 100644 --- a/listers/objectstorage.k8s.io/v1alpha1/expansion_generated.go +++ b/listers/objectstorage.k8s.io/v1alpha1/expansion_generated.go @@ -49,3 +49,11 @@ type BucketRequestListerExpansion interface{} // BucketRequestNamespaceListerExpansion allows custom methods to be added to // BucketRequestNamespaceLister. type BucketRequestNamespaceListerExpansion interface{} + +// COSIDriverListerExpansion allows custom methods to be added to +// COSIDriverLister. +type COSIDriverListerExpansion interface{} + +// COSIDriverNamespaceListerExpansion allows custom methods to be added to +// COSIDriverNamespaceLister. +type COSIDriverNamespaceListerExpansion interface{}