diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index c313ecb48..ee364a1bf 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -18,7 +18,9 @@ package versioned import ( glog "github.com/golang/glog" + cephv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph/v1alpha1" rookv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha1" + rookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha2" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -26,16 +28,33 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + CephV1alpha1() cephv1alpha1.CephV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Ceph() cephv1alpha1.CephV1alpha1Interface RookV1alpha1() rookv1alpha1.RookV1alpha1Interface // Deprecated: please explicitly pick a version if possible. Rook() rookv1alpha1.RookV1alpha1Interface + RookV1alpha2() rookv1alpha2.RookV1alpha2Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient + cephV1alpha1 *cephv1alpha1.CephV1alpha1Client rookV1alpha1 *rookv1alpha1.RookV1alpha1Client + rookV1alpha2 *rookv1alpha2.RookV1alpha2Client +} + +// CephV1alpha1 retrieves the CephV1alpha1Client +func (c *Clientset) CephV1alpha1() cephv1alpha1.CephV1alpha1Interface { + return c.cephV1alpha1 +} + +// Deprecated: Ceph retrieves the default version of CephClient. +// Please explicitly pick a version. +func (c *Clientset) Ceph() cephv1alpha1.CephV1alpha1Interface { + return c.cephV1alpha1 } // RookV1alpha1 retrieves the RookV1alpha1Client @@ -49,6 +68,11 @@ func (c *Clientset) Rook() rookv1alpha1.RookV1alpha1Interface { return c.rookV1alpha1 } +// RookV1alpha2 retrieves the RookV1alpha2Client +func (c *Clientset) RookV1alpha2() rookv1alpha2.RookV1alpha2Interface { + return c.rookV1alpha2 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -65,10 +89,18 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error + cs.cephV1alpha1, err = cephv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.rookV1alpha1, err = rookv1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } + cs.rookV1alpha2, err = rookv1alpha2.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -82,7 +114,9 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset + cs.cephV1alpha1 = cephv1alpha1.NewForConfigOrDie(c) cs.rookV1alpha1 = rookv1alpha1.NewForConfigOrDie(c) + cs.rookV1alpha2 = rookv1alpha2.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -91,7 +125,9 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.cephV1alpha1 = cephv1alpha1.New(c) cs.rookV1alpha1 = rookv1alpha1.New(c) + cs.rookV1alpha2 = rookv1alpha2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index f95172fac..585d26cc6 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -18,8 +18,12 @@ package fake import ( clientset "github.com/rook/rook/pkg/client/clientset/versioned" + cephv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph/v1alpha1" + fakecephv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake" rookv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha1" fakerookv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha1/fake" + rookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha2" + fakerookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -61,6 +65,16 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} +// CephV1alpha1 retrieves the CephV1alpha1Client +func (c *Clientset) CephV1alpha1() cephv1alpha1.CephV1alpha1Interface { + return &fakecephv1alpha1.FakeCephV1alpha1{Fake: &c.Fake} +} + +// Ceph retrieves the CephV1alpha1Client +func (c *Clientset) Ceph() cephv1alpha1.CephV1alpha1Interface { + return &fakecephv1alpha1.FakeCephV1alpha1{Fake: &c.Fake} +} + // RookV1alpha1 retrieves the RookV1alpha1Client func (c *Clientset) RookV1alpha1() rookv1alpha1.RookV1alpha1Interface { return &fakerookv1alpha1.FakeRookV1alpha1{Fake: &c.Fake} @@ -70,3 +84,8 @@ func (c *Clientset) RookV1alpha1() rookv1alpha1.RookV1alpha1Interface { func (c *Clientset) Rook() rookv1alpha1.RookV1alpha1Interface { return &fakerookv1alpha1.FakeRookV1alpha1{Fake: &c.Fake} } + +// RookV1alpha2 retrieves the RookV1alpha2Client +func (c *Clientset) RookV1alpha2() rookv1alpha2.RookV1alpha2Interface { + return &fakerookv1alpha2.FakeRookV1alpha2{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 1ef1985d0..94c0ccb84 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -17,7 +17,9 @@ limitations under the License. package fake import ( + cephv1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" rookv1alpha1 "github.com/rook/rook/pkg/apis/rook.io/v1alpha1" + rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -48,6 +50,8 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { + cephv1alpha1.AddToScheme(scheme) rookv1alpha1.AddToScheme(scheme) + rookv1alpha2.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 4bf088096..3fb134d52 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -17,7 +17,9 @@ limitations under the License. package scheme import ( + cephv1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" rookv1alpha1 "github.com/rook/rook/pkg/apis/rook.io/v1alpha1" + rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -48,6 +50,8 @@ func init() { // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. func AddToScheme(scheme *runtime.Scheme) { + cephv1alpha1.AddToScheme(scheme) rookv1alpha1.AddToScheme(scheme) + rookv1alpha2.AddToScheme(scheme) } diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/ceph_client.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/ceph_client.go new file mode 100644 index 000000000..be40a8973 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/ceph_client.go @@ -0,0 +1,103 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha1 + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" + "github.com/rook/rook/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type CephV1alpha1Interface interface { + RESTClient() rest.Interface + ClustersGetter + FilesystemsGetter + ObjectStoresGetter + PoolsGetter +} + +// CephV1alpha1Client is used to interact with features provided by the ceph.rook.io group. +type CephV1alpha1Client struct { + restClient rest.Interface +} + +func (c *CephV1alpha1Client) Clusters(namespace string) ClusterInterface { + return newClusters(c, namespace) +} + +func (c *CephV1alpha1Client) Filesystems(namespace string) FilesystemInterface { + return newFilesystems(c, namespace) +} + +func (c *CephV1alpha1Client) ObjectStores(namespace string) ObjectStoreInterface { + return newObjectStores(c, namespace) +} + +func (c *CephV1alpha1Client) Pools(namespace string) PoolInterface { + return newPools(c, namespace) +} + +// NewForConfig creates a new CephV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*CephV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &CephV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new CephV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CephV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CephV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *CephV1alpha1Client { + return &CephV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *CephV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/cluster.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/cluster.go new file mode 100644 index 000000000..63e24b04f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/cluster.go @@ -0,0 +1,155 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha1 + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/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" +) + +// ClustersGetter has a method to return a ClusterInterface. +// A group's client should implement this interface. +type ClustersGetter interface { + Clusters(namespace string) ClusterInterface +} + +// ClusterInterface has methods to work with Cluster resources. +type ClusterInterface interface { + Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Cluster, error) + List(opts v1.ListOptions) (*v1alpha1.ClusterList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) + ClusterExpansion +} + +// clusters implements ClusterInterface +type clusters struct { + client rest.Interface + ns string +} + +// newClusters returns a Clusters +func newClusters(c *CephV1alpha1Client, namespace string) *clusters { + return &clusters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *clusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { + result = &v1alpha1.ClusterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusters"). + Body(cluster). + Do(). + Into(result) + return +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + Body(cluster). + Do(). + Into(result) + return +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *clusters) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cluster. +func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusters"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/doc.go new file mode 100644 index 000000000..f51751d64 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/doc.go new file mode 100644 index 000000000..d4003d501 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_ceph_client.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_ceph_client.go new file mode 100644 index 000000000..b0a1316aa --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_ceph_client.go @@ -0,0 +1,50 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/ceph/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCephV1alpha1 struct { + *testing.Fake +} + +func (c *FakeCephV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface { + return &FakeClusters{c, namespace} +} + +func (c *FakeCephV1alpha1) Filesystems(namespace string) v1alpha1.FilesystemInterface { + return &FakeFilesystems{c, namespace} +} + +func (c *FakeCephV1alpha1) ObjectStores(namespace string) v1alpha1.ObjectStoreInterface { + return &FakeObjectStores{c, namespace} +} + +func (c *FakeCephV1alpha1) Pools(namespace string) v1alpha1.PoolInterface { + return &FakePools{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCephV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_cluster.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_cluster.go new file mode 100644 index 000000000..7f9bc9f06 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_cluster.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.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" +) + +// FakeClusters implements ClusterInterface +type FakeClusters struct { + Fake *FakeCephV1alpha1 + ns string +} + +var clustersResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1alpha1", Resource: "clusters"} + +var clustersKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1alpha1", Kind: "Cluster"} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *FakeClusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1alpha1.ClusterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterList{} + for _, item := range obj.(*v1alpha1.ClusterList).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 clusters. +func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts)) + +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{}) + return err +} + +// Patch applies the patch and returns the patched cluster. +func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, data, subresources...), &v1alpha1.Cluster{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Cluster), err +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_filesystem.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_filesystem.go new file mode 100644 index 000000000..81125e1df --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_filesystem.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.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" +) + +// FakeFilesystems implements FilesystemInterface +type FakeFilesystems struct { + Fake *FakeCephV1alpha1 + ns string +} + +var filesystemsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1alpha1", Resource: "filesystems"} + +var filesystemsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1alpha1", Kind: "Filesystem"} + +// Get takes name of the filesystem, and returns the corresponding filesystem object, and an error if there is any. +func (c *FakeFilesystems) Get(name string, options v1.GetOptions) (result *v1alpha1.Filesystem, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(filesystemsResource, c.ns, name), &v1alpha1.Filesystem{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Filesystem), err +} + +// List takes label and field selectors, and returns the list of Filesystems that match those selectors. +func (c *FakeFilesystems) List(opts v1.ListOptions) (result *v1alpha1.FilesystemList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(filesystemsResource, filesystemsKind, c.ns, opts), &v1alpha1.FilesystemList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.FilesystemList{} + for _, item := range obj.(*v1alpha1.FilesystemList).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 filesystems. +func (c *FakeFilesystems) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(filesystemsResource, c.ns, opts)) + +} + +// Create takes the representation of a filesystem and creates it. Returns the server's representation of the filesystem, and an error, if there is any. +func (c *FakeFilesystems) Create(filesystem *v1alpha1.Filesystem) (result *v1alpha1.Filesystem, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(filesystemsResource, c.ns, filesystem), &v1alpha1.Filesystem{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Filesystem), err +} + +// Update takes the representation of a filesystem and updates it. Returns the server's representation of the filesystem, and an error, if there is any. +func (c *FakeFilesystems) Update(filesystem *v1alpha1.Filesystem) (result *v1alpha1.Filesystem, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(filesystemsResource, c.ns, filesystem), &v1alpha1.Filesystem{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Filesystem), err +} + +// Delete takes name of the filesystem and deletes it. Returns an error if one occurs. +func (c *FakeFilesystems) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(filesystemsResource, c.ns, name), &v1alpha1.Filesystem{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeFilesystems) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(filesystemsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.FilesystemList{}) + return err +} + +// Patch applies the patch and returns the patched filesystem. +func (c *FakeFilesystems) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Filesystem, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(filesystemsResource, c.ns, name, data, subresources...), &v1alpha1.Filesystem{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Filesystem), err +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_objectstore.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_objectstore.go new file mode 100644 index 000000000..d455cfde1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_objectstore.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.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" +) + +// FakeObjectStores implements ObjectStoreInterface +type FakeObjectStores struct { + Fake *FakeCephV1alpha1 + ns string +} + +var objectstoresResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1alpha1", Resource: "objectstores"} + +var objectstoresKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1alpha1", Kind: "ObjectStore"} + +// Get takes name of the objectStore, and returns the corresponding objectStore object, and an error if there is any. +func (c *FakeObjectStores) Get(name string, options v1.GetOptions) (result *v1alpha1.ObjectStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(objectstoresResource, c.ns, name), &v1alpha1.ObjectStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ObjectStore), err +} + +// List takes label and field selectors, and returns the list of ObjectStores that match those selectors. +func (c *FakeObjectStores) List(opts v1.ListOptions) (result *v1alpha1.ObjectStoreList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(objectstoresResource, objectstoresKind, c.ns, opts), &v1alpha1.ObjectStoreList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ObjectStoreList{} + for _, item := range obj.(*v1alpha1.ObjectStoreList).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 objectStores. +func (c *FakeObjectStores) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(objectstoresResource, c.ns, opts)) + +} + +// Create takes the representation of a objectStore and creates it. Returns the server's representation of the objectStore, and an error, if there is any. +func (c *FakeObjectStores) Create(objectStore *v1alpha1.ObjectStore) (result *v1alpha1.ObjectStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(objectstoresResource, c.ns, objectStore), &v1alpha1.ObjectStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ObjectStore), err +} + +// Update takes the representation of a objectStore and updates it. Returns the server's representation of the objectStore, and an error, if there is any. +func (c *FakeObjectStores) Update(objectStore *v1alpha1.ObjectStore) (result *v1alpha1.ObjectStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(objectstoresResource, c.ns, objectStore), &v1alpha1.ObjectStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ObjectStore), err +} + +// Delete takes name of the objectStore and deletes it. Returns an error if one occurs. +func (c *FakeObjectStores) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(objectstoresResource, c.ns, name), &v1alpha1.ObjectStore{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeObjectStores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(objectstoresResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.ObjectStoreList{}) + return err +} + +// Patch applies the patch and returns the patched objectStore. +func (c *FakeObjectStores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ObjectStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(objectstoresResource, c.ns, name, data, subresources...), &v1alpha1.ObjectStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ObjectStore), err +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_pool.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_pool.go new file mode 100644 index 000000000..ffc63ee77 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/fake/fake_pool.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.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" +) + +// FakePools implements PoolInterface +type FakePools struct { + Fake *FakeCephV1alpha1 + ns string +} + +var poolsResource = schema.GroupVersionResource{Group: "ceph.rook.io", Version: "v1alpha1", Resource: "pools"} + +var poolsKind = schema.GroupVersionKind{Group: "ceph.rook.io", Version: "v1alpha1", Kind: "Pool"} + +// Get takes name of the pool, and returns the corresponding pool object, and an error if there is any. +func (c *FakePools) Get(name string, options v1.GetOptions) (result *v1alpha1.Pool, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(poolsResource, c.ns, name), &v1alpha1.Pool{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Pool), err +} + +// List takes label and field selectors, and returns the list of Pools that match those selectors. +func (c *FakePools) List(opts v1.ListOptions) (result *v1alpha1.PoolList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(poolsResource, poolsKind, c.ns, opts), &v1alpha1.PoolList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.PoolList{} + for _, item := range obj.(*v1alpha1.PoolList).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 pools. +func (c *FakePools) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(poolsResource, c.ns, opts)) + +} + +// Create takes the representation of a pool and creates it. Returns the server's representation of the pool, and an error, if there is any. +func (c *FakePools) Create(pool *v1alpha1.Pool) (result *v1alpha1.Pool, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(poolsResource, c.ns, pool), &v1alpha1.Pool{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Pool), err +} + +// Update takes the representation of a pool and updates it. Returns the server's representation of the pool, and an error, if there is any. +func (c *FakePools) Update(pool *v1alpha1.Pool) (result *v1alpha1.Pool, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(poolsResource, c.ns, pool), &v1alpha1.Pool{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Pool), err +} + +// Delete takes name of the pool and deletes it. Returns an error if one occurs. +func (c *FakePools) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(poolsResource, c.ns, name), &v1alpha1.Pool{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(poolsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha1.PoolList{}) + return err +} + +// Patch applies the patch and returns the patched pool. +func (c *FakePools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Pool, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(poolsResource, c.ns, name, data, subresources...), &v1alpha1.Pool{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Pool), err +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/filesystem.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/filesystem.go new file mode 100644 index 000000000..f0cfadb81 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/filesystem.go @@ -0,0 +1,155 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha1 + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/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" +) + +// FilesystemsGetter has a method to return a FilesystemInterface. +// A group's client should implement this interface. +type FilesystemsGetter interface { + Filesystems(namespace string) FilesystemInterface +} + +// FilesystemInterface has methods to work with Filesystem resources. +type FilesystemInterface interface { + Create(*v1alpha1.Filesystem) (*v1alpha1.Filesystem, error) + Update(*v1alpha1.Filesystem) (*v1alpha1.Filesystem, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Filesystem, error) + List(opts v1.ListOptions) (*v1alpha1.FilesystemList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Filesystem, err error) + FilesystemExpansion +} + +// filesystems implements FilesystemInterface +type filesystems struct { + client rest.Interface + ns string +} + +// newFilesystems returns a Filesystems +func newFilesystems(c *CephV1alpha1Client, namespace string) *filesystems { + return &filesystems{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the filesystem, and returns the corresponding filesystem object, and an error if there is any. +func (c *filesystems) Get(name string, options v1.GetOptions) (result *v1alpha1.Filesystem, err error) { + result = &v1alpha1.Filesystem{} + err = c.client.Get(). + Namespace(c.ns). + Resource("filesystems"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Filesystems that match those selectors. +func (c *filesystems) List(opts v1.ListOptions) (result *v1alpha1.FilesystemList, err error) { + result = &v1alpha1.FilesystemList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("filesystems"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested filesystems. +func (c *filesystems) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("filesystems"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a filesystem and creates it. Returns the server's representation of the filesystem, and an error, if there is any. +func (c *filesystems) Create(filesystem *v1alpha1.Filesystem) (result *v1alpha1.Filesystem, err error) { + result = &v1alpha1.Filesystem{} + err = c.client.Post(). + Namespace(c.ns). + Resource("filesystems"). + Body(filesystem). + Do(). + Into(result) + return +} + +// Update takes the representation of a filesystem and updates it. Returns the server's representation of the filesystem, and an error, if there is any. +func (c *filesystems) Update(filesystem *v1alpha1.Filesystem) (result *v1alpha1.Filesystem, err error) { + result = &v1alpha1.Filesystem{} + err = c.client.Put(). + Namespace(c.ns). + Resource("filesystems"). + Name(filesystem.Name). + Body(filesystem). + Do(). + Into(result) + return +} + +// Delete takes name of the filesystem and deletes it. Returns an error if one occurs. +func (c *filesystems) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("filesystems"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *filesystems) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("filesystems"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched filesystem. +func (c *filesystems) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Filesystem, err error) { + result = &v1alpha1.Filesystem{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("filesystems"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..251cdfcb0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/generated_expansion.go @@ -0,0 +1,25 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha1 + +type ClusterExpansion interface{} + +type FilesystemExpansion interface{} + +type ObjectStoreExpansion interface{} + +type PoolExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/objectstore.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/objectstore.go new file mode 100644 index 000000000..b6960078e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/objectstore.go @@ -0,0 +1,155 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha1 + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/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" +) + +// ObjectStoresGetter has a method to return a ObjectStoreInterface. +// A group's client should implement this interface. +type ObjectStoresGetter interface { + ObjectStores(namespace string) ObjectStoreInterface +} + +// ObjectStoreInterface has methods to work with ObjectStore resources. +type ObjectStoreInterface interface { + Create(*v1alpha1.ObjectStore) (*v1alpha1.ObjectStore, error) + Update(*v1alpha1.ObjectStore) (*v1alpha1.ObjectStore, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.ObjectStore, error) + List(opts v1.ListOptions) (*v1alpha1.ObjectStoreList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ObjectStore, err error) + ObjectStoreExpansion +} + +// objectStores implements ObjectStoreInterface +type objectStores struct { + client rest.Interface + ns string +} + +// newObjectStores returns a ObjectStores +func newObjectStores(c *CephV1alpha1Client, namespace string) *objectStores { + return &objectStores{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the objectStore, and returns the corresponding objectStore object, and an error if there is any. +func (c *objectStores) Get(name string, options v1.GetOptions) (result *v1alpha1.ObjectStore, err error) { + result = &v1alpha1.ObjectStore{} + err = c.client.Get(). + Namespace(c.ns). + Resource("objectstores"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ObjectStores that match those selectors. +func (c *objectStores) List(opts v1.ListOptions) (result *v1alpha1.ObjectStoreList, err error) { + result = &v1alpha1.ObjectStoreList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("objectstores"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested objectStores. +func (c *objectStores) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("objectstores"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a objectStore and creates it. Returns the server's representation of the objectStore, and an error, if there is any. +func (c *objectStores) Create(objectStore *v1alpha1.ObjectStore) (result *v1alpha1.ObjectStore, err error) { + result = &v1alpha1.ObjectStore{} + err = c.client.Post(). + Namespace(c.ns). + Resource("objectstores"). + Body(objectStore). + Do(). + Into(result) + return +} + +// Update takes the representation of a objectStore and updates it. Returns the server's representation of the objectStore, and an error, if there is any. +func (c *objectStores) Update(objectStore *v1alpha1.ObjectStore) (result *v1alpha1.ObjectStore, err error) { + result = &v1alpha1.ObjectStore{} + err = c.client.Put(). + Namespace(c.ns). + Resource("objectstores"). + Name(objectStore.Name). + Body(objectStore). + Do(). + Into(result) + return +} + +// Delete takes name of the objectStore and deletes it. Returns an error if one occurs. +func (c *objectStores) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("objectstores"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *objectStores) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("objectstores"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched objectStore. +func (c *objectStores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ObjectStore, err error) { + result = &v1alpha1.ObjectStore{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("objectstores"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/ceph/v1alpha1/pool.go b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/pool.go new file mode 100644 index 000000000..2e30ee20d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/ceph/v1alpha1/pool.go @@ -0,0 +1,155 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha1 + +import ( + v1alpha1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1alpha1" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/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" +) + +// PoolsGetter has a method to return a PoolInterface. +// A group's client should implement this interface. +type PoolsGetter interface { + Pools(namespace string) PoolInterface +} + +// PoolInterface has methods to work with Pool resources. +type PoolInterface interface { + Create(*v1alpha1.Pool) (*v1alpha1.Pool, error) + Update(*v1alpha1.Pool) (*v1alpha1.Pool, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Pool, error) + List(opts v1.ListOptions) (*v1alpha1.PoolList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Pool, err error) + PoolExpansion +} + +// pools implements PoolInterface +type pools struct { + client rest.Interface + ns string +} + +// newPools returns a Pools +func newPools(c *CephV1alpha1Client, namespace string) *pools { + return &pools{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the pool, and returns the corresponding pool object, and an error if there is any. +func (c *pools) Get(name string, options v1.GetOptions) (result *v1alpha1.Pool, err error) { + result = &v1alpha1.Pool{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pools"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Pools that match those selectors. +func (c *pools) List(opts v1.ListOptions) (result *v1alpha1.PoolList, err error) { + result = &v1alpha1.PoolList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pools"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pools. +func (c *pools) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("pools"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a pool and creates it. Returns the server's representation of the pool, and an error, if there is any. +func (c *pools) Create(pool *v1alpha1.Pool) (result *v1alpha1.Pool, err error) { + result = &v1alpha1.Pool{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pools"). + Body(pool). + Do(). + Into(result) + return +} + +// Update takes the representation of a pool and updates it. Returns the server's representation of the pool, and an error, if there is any. +func (c *pools) Update(pool *v1alpha1.Pool) (result *v1alpha1.Pool, err error) { + result = &v1alpha1.Pool{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pools"). + Name(pool.Name). + Body(pool). + Do(). + Into(result) + return +} + +// Delete takes name of the pool and deletes it. Returns an error if one occurs. +func (c *pools) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pools"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pools) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pools"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched pool. +func (c *pools) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Pool, err error) { + result = &v1alpha1.Pool{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("pools"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/doc.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/doc.go new file mode 100644 index 000000000..ef161aeae --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1alpha2 diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/doc.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/doc.go new file mode 100644 index 000000000..d4003d501 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/fake_rook_client.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/fake_rook_client.go new file mode 100644 index 000000000..4e4bb5cb6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/fake_rook_client.go @@ -0,0 +1,38 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook/v1alpha2" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeRookV1alpha2 struct { + *testing.Fake +} + +func (c *FakeRookV1alpha2) Volumes(namespace string) v1alpha2.VolumeInterface { + return &FakeVolumes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRookV1alpha2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/fake_volume.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/fake_volume.go new file mode 100644 index 000000000..f2a7e8899 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/fake/fake_volume.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 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. +*/ + +package fake + +import ( + v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + 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" +) + +// FakeVolumes implements VolumeInterface +type FakeVolumes struct { + Fake *FakeRookV1alpha2 + ns string +} + +var volumesResource = schema.GroupVersionResource{Group: "rook.io", Version: "v1alpha2", Resource: "volumes"} + +var volumesKind = schema.GroupVersionKind{Group: "rook.io", Version: "v1alpha2", Kind: "Volume"} + +// Get takes name of the volume, and returns the corresponding volume object, and an error if there is any. +func (c *FakeVolumes) Get(name string, options v1.GetOptions) (result *v1alpha2.Volume, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(volumesResource, c.ns, name), &v1alpha2.Volume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Volume), err +} + +// List takes label and field selectors, and returns the list of Volumes that match those selectors. +func (c *FakeVolumes) List(opts v1.ListOptions) (result *v1alpha2.VolumeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(volumesResource, volumesKind, c.ns, opts), &v1alpha2.VolumeList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.VolumeList{} + for _, item := range obj.(*v1alpha2.VolumeList).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 volumes. +func (c *FakeVolumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(volumesResource, c.ns, opts)) + +} + +// Create takes the representation of a volume and creates it. Returns the server's representation of the volume, and an error, if there is any. +func (c *FakeVolumes) Create(volume *v1alpha2.Volume) (result *v1alpha2.Volume, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(volumesResource, c.ns, volume), &v1alpha2.Volume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Volume), err +} + +// Update takes the representation of a volume and updates it. Returns the server's representation of the volume, and an error, if there is any. +func (c *FakeVolumes) Update(volume *v1alpha2.Volume) (result *v1alpha2.Volume, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(volumesResource, c.ns, volume), &v1alpha2.Volume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Volume), err +} + +// Delete takes name of the volume and deletes it. Returns an error if one occurs. +func (c *FakeVolumes) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(volumesResource, c.ns, name), &v1alpha2.Volume{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVolumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(volumesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.VolumeList{}) + return err +} + +// Patch applies the patch and returns the patched volume. +func (c *FakeVolumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Volume, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(volumesResource, c.ns, name, data, subresources...), &v1alpha2.Volume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Volume), err +} diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/generated_expansion.go new file mode 100644 index 000000000..ab233a95f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/generated_expansion.go @@ -0,0 +1,19 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha2 + +type VolumeExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/rook_client.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/rook_client.go new file mode 100644 index 000000000..6b69c9eac --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/rook_client.go @@ -0,0 +1,88 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha2 + +import ( + v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + "github.com/rook/rook/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type RookV1alpha2Interface interface { + RESTClient() rest.Interface + VolumesGetter +} + +// RookV1alpha2Client is used to interact with features provided by the rook.io group. +type RookV1alpha2Client struct { + restClient rest.Interface +} + +func (c *RookV1alpha2Client) Volumes(namespace string) VolumeInterface { + return newVolumes(c, namespace) +} + +// NewForConfig creates a new RookV1alpha2Client for the given config. +func NewForConfig(c *rest.Config) (*RookV1alpha2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &RookV1alpha2Client{client}, nil +} + +// NewForConfigOrDie creates a new RookV1alpha2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RookV1alpha2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RookV1alpha2Client for the given RESTClient. +func New(c rest.Interface) *RookV1alpha2Client { + return &RookV1alpha2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RookV1alpha2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/rook/v1alpha2/volume.go b/pkg/client/clientset/versioned/typed/rook/v1alpha2/volume.go new file mode 100644 index 000000000..3e56f55b0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook/v1alpha2/volume.go @@ -0,0 +1,155 @@ +/* +Copyright 2018 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. +*/ + +package v1alpha2 + +import ( + v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + scheme "github.com/rook/rook/pkg/client/clientset/versioned/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" +) + +// VolumesGetter has a method to return a VolumeInterface. +// A group's client should implement this interface. +type VolumesGetter interface { + Volumes(namespace string) VolumeInterface +} + +// VolumeInterface has methods to work with Volume resources. +type VolumeInterface interface { + Create(*v1alpha2.Volume) (*v1alpha2.Volume, error) + Update(*v1alpha2.Volume) (*v1alpha2.Volume, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.Volume, error) + List(opts v1.ListOptions) (*v1alpha2.VolumeList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Volume, err error) + VolumeExpansion +} + +// volumes implements VolumeInterface +type volumes struct { + client rest.Interface + ns string +} + +// newVolumes returns a Volumes +func newVolumes(c *RookV1alpha2Client, namespace string) *volumes { + return &volumes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the volume, and returns the corresponding volume object, and an error if there is any. +func (c *volumes) Get(name string, options v1.GetOptions) (result *v1alpha2.Volume, err error) { + result = &v1alpha2.Volume{} + err = c.client.Get(). + Namespace(c.ns). + Resource("volumes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Volumes that match those selectors. +func (c *volumes) List(opts v1.ListOptions) (result *v1alpha2.VolumeList, err error) { + result = &v1alpha2.VolumeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("volumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested volumes. +func (c *volumes) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("volumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a volume and creates it. Returns the server's representation of the volume, and an error, if there is any. +func (c *volumes) Create(volume *v1alpha2.Volume) (result *v1alpha2.Volume, err error) { + result = &v1alpha2.Volume{} + err = c.client.Post(). + Namespace(c.ns). + Resource("volumes"). + Body(volume). + Do(). + Into(result) + return +} + +// Update takes the representation of a volume and updates it. Returns the server's representation of the volume, and an error, if there is any. +func (c *volumes) Update(volume *v1alpha2.Volume) (result *v1alpha2.Volume, err error) { + result = &v1alpha2.Volume{} + err = c.client.Put(). + Namespace(c.ns). + Resource("volumes"). + Name(volume.Name). + Body(volume). + Do(). + Into(result) + return +} + +// Delete takes name of the volume and deletes it. Returns an error if one occurs. +func (c *volumes) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("volumes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *volumes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("volumes"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched volume. +func (c *volumes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.Volume, err error) { + result = &v1alpha2.Volume{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("volumes"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +}