diff --git a/app/api_topologies.go b/app/api_topologies.go index 6b286a57f..7298542b4 100644 --- a/app/api_topologies.go +++ b/app/api_topologies.go @@ -10,6 +10,7 @@ import ( "time" "context" + "github.com/gorilla/mux" log "github.com/sirupsen/logrus" @@ -55,6 +56,14 @@ var ( {Value: "hide", Label: "Hide storage", filter: render.IsPodComponent, filterPseudo: false}, }, } + snapshotFilter = APITopologyOptionGroup{ + ID: "snapshot", + Default: "hide", + Options: []APITopologyOption{ + {Value: "show", Label: "Show snapshots", filter: nil, filterPseudo: false}, + {Value: "hide", Label: "Hide snapshots", filter: render.IsNonSnapshotComponent, filterPseudo: false}, + }, + } ) // namespaceFilters generates a namespace selector option group based on the given namespaces @@ -237,7 +246,7 @@ func MakeRegistry() *Registry { renderer: render.PodRenderer, Name: "Pods", Rank: 3, - Options: []APITopologyOptionGroup{storageFilter, unmanagedFilter}, + Options: []APITopologyOptionGroup{snapshotFilter, storageFilter, unmanagedFilter}, HideIfEmpty: true, }, APITopologyDesc{ diff --git a/client/app/scripts/charts/edge.js b/client/app/scripts/charts/edge.js index c4f9d6b98..d6d35e7b7 100644 --- a/client/app/scripts/charts/edge.js +++ b/client/app/scripts/charts/edge.js @@ -6,10 +6,8 @@ import { enterEdge, leaveEdge } from '../actions/app-actions'; import { encodeIdAttribute, decodeIdAttribute } from '../utils/dom-utils'; function isStorageComponent(id) { - if (id === '' || id === '' || id === '') { - return true; - } - return false; + const storageComponents = ['', '', '', '', '']; + return storageComponents.includes(id); } // getAdjacencyClass takes id which contains information about edge as a topology diff --git a/client/app/scripts/charts/node-container.js b/client/app/scripts/charts/node-container.js index 2ef7d991a..fa0dce2f2 100644 --- a/client/app/scripts/charts/node-container.js +++ b/client/app/scripts/charts/node-container.js @@ -60,6 +60,7 @@ class NodeContainer extends React.Component { 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.volumesnapshotV1, err = volumesnapshotv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.volumesnapshotV1 = volumesnapshotv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.volumesnapshotV1 = volumesnapshotv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/doc.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/doc.go new file mode 100644 index 000000000..f823c268b --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/doc.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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 000000000..1d85c4d7a --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,81 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned" + volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1" + fakevolumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// VolumesnapshotV1 retrieves the VolumesnapshotV1Client +func (c *Clientset) VolumesnapshotV1() volumesnapshotv1.VolumesnapshotV1Interface { + return &fakevolumesnapshotv1.FakeVolumesnapshotV1{Fake: &c.Fake} +} + +// Volumesnapshot retrieves the VolumesnapshotV1Client +func (c *Clientset) Volumesnapshot() volumesnapshotv1.VolumesnapshotV1Interface { + return &fakevolumesnapshotv1.FakeVolumesnapshotV1{Fake: &c.Fake} +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/doc.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/doc.go new file mode 100644 index 000000000..ab8ee5649 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/doc.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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/register.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/register.go new file mode 100644 index 000000000..d4782ae66 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/fake/register.go @@ -0,0 +1,53 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + volumesnapshotv1.AddToScheme(scheme) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme/doc.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme/doc.go new file mode 100644 index 000000000..bbf42d167 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme/doc.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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme/register.go new file mode 100644 index 000000000..cc970a514 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme/register.go @@ -0,0 +1,53 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + volumesnapshotv1.AddToScheme(scheme) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/doc.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/doc.go new file mode 100644 index 000000000..4f6dd5b4a --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/doc.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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/doc.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/doc.go new file mode 100644 index 000000000..e4301c97e --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/doc.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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshot.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshot.go new file mode 100644 index 000000000..212463ed7 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshot.go @@ -0,0 +1,139 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + 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" +) + +// FakeVolumeSnapshots implements VolumeSnapshotInterface +type FakeVolumeSnapshots struct { + Fake *FakeVolumesnapshotV1 + ns string +} + +var volumesnapshotsResource = schema.GroupVersionResource{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Resource: "volumesnapshots"} + +var volumesnapshotsKind = schema.GroupVersionKind{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Kind: "VolumeSnapshot"} + +// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any. +func (c *FakeVolumeSnapshots) Get(name string, options v1.GetOptions) (result *volumesnapshot_v1.VolumeSnapshot, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &volumesnapshot_v1.VolumeSnapshot{}) + + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshot), err +} + +// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors. +func (c *FakeVolumeSnapshots) List(opts v1.ListOptions) (result *volumesnapshot_v1.VolumeSnapshotList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &volumesnapshot_v1.VolumeSnapshotList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &volumesnapshot_v1.VolumeSnapshotList{ListMeta: obj.(*volumesnapshot_v1.VolumeSnapshotList).ListMeta} + for _, item := range obj.(*volumesnapshot_v1.VolumeSnapshotList).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 volumeSnapshots. +func (c *FakeVolumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(volumesnapshotsResource, c.ns, opts)) + +} + +// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. +func (c *FakeVolumeSnapshots) Create(volumeSnapshot *volumesnapshot_v1.VolumeSnapshot) (result *volumesnapshot_v1.VolumeSnapshot, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &volumesnapshot_v1.VolumeSnapshot{}) + + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshot), err +} + +// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. +func (c *FakeVolumeSnapshots) Update(volumeSnapshot *volumesnapshot_v1.VolumeSnapshot) (result *volumesnapshot_v1.VolumeSnapshot, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &volumesnapshot_v1.VolumeSnapshot{}) + + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshot), 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 *FakeVolumeSnapshots) UpdateStatus(volumeSnapshot *volumesnapshot_v1.VolumeSnapshot) (*volumesnapshot_v1.VolumeSnapshot, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &volumesnapshot_v1.VolumeSnapshot{}) + + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshot), err +} + +// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs. +func (c *FakeVolumeSnapshots) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(volumesnapshotsResource, c.ns, name), &volumesnapshot_v1.VolumeSnapshot{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVolumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &volumesnapshot_v1.VolumeSnapshotList{}) + return err +} + +// Patch applies the patch and returns the patched volumeSnapshot. +func (c *FakeVolumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *volumesnapshot_v1.VolumeSnapshot, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, data, subresources...), &volumesnapshot_v1.VolumeSnapshot{}) + + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshot), err +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshot_client.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshot_client.go new file mode 100644 index 000000000..ec070357b --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshot_client.go @@ -0,0 +1,43 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeVolumesnapshotV1 struct { + *testing.Fake +} + +func (c *FakeVolumesnapshotV1) VolumeSnapshots(namespace string) v1.VolumeSnapshotInterface { + return &FakeVolumeSnapshots{c, namespace} +} + +func (c *FakeVolumesnapshotV1) VolumeSnapshotDatas() v1.VolumeSnapshotDataInterface { + return &FakeVolumeSnapshotDatas{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeVolumesnapshotV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshotdata.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshotdata.go new file mode 100644 index 000000000..896d0ff4c --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake/fake_volumesnapshotdata.go @@ -0,0 +1,130 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + 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" +) + +// FakeVolumeSnapshotDatas implements VolumeSnapshotDataInterface +type FakeVolumeSnapshotDatas struct { + Fake *FakeVolumesnapshotV1 +} + +var volumesnapshotdatasResource = schema.GroupVersionResource{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Resource: "volumesnapshotdatas"} + +var volumesnapshotdatasKind = schema.GroupVersionKind{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Kind: "VolumeSnapshotData"} + +// Get takes name of the volumeSnapshotData, and returns the corresponding volumeSnapshotData object, and an error if there is any. +func (c *FakeVolumeSnapshotDatas) Get(name string, options v1.GetOptions) (result *volumesnapshot_v1.VolumeSnapshotData, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(volumesnapshotdatasResource, name), &volumesnapshot_v1.VolumeSnapshotData{}) + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshotData), err +} + +// List takes label and field selectors, and returns the list of VolumeSnapshotDatas that match those selectors. +func (c *FakeVolumeSnapshotDatas) List(opts v1.ListOptions) (result *volumesnapshot_v1.VolumeSnapshotDataList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(volumesnapshotdatasResource, volumesnapshotdatasKind, opts), &volumesnapshot_v1.VolumeSnapshotDataList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &volumesnapshot_v1.VolumeSnapshotDataList{ListMeta: obj.(*volumesnapshot_v1.VolumeSnapshotDataList).ListMeta} + for _, item := range obj.(*volumesnapshot_v1.VolumeSnapshotDataList).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 volumeSnapshotDatas. +func (c *FakeVolumeSnapshotDatas) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(volumesnapshotdatasResource, opts)) +} + +// Create takes the representation of a volumeSnapshotData and creates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any. +func (c *FakeVolumeSnapshotDatas) Create(volumeSnapshotData *volumesnapshot_v1.VolumeSnapshotData) (result *volumesnapshot_v1.VolumeSnapshotData, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(volumesnapshotdatasResource, volumeSnapshotData), &volumesnapshot_v1.VolumeSnapshotData{}) + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshotData), err +} + +// Update takes the representation of a volumeSnapshotData and updates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any. +func (c *FakeVolumeSnapshotDatas) Update(volumeSnapshotData *volumesnapshot_v1.VolumeSnapshotData) (result *volumesnapshot_v1.VolumeSnapshotData, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(volumesnapshotdatasResource, volumeSnapshotData), &volumesnapshot_v1.VolumeSnapshotData{}) + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshotData), 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 *FakeVolumeSnapshotDatas) UpdateStatus(volumeSnapshotData *volumesnapshot_v1.VolumeSnapshotData) (*volumesnapshot_v1.VolumeSnapshotData, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(volumesnapshotdatasResource, "status", volumeSnapshotData), &volumesnapshot_v1.VolumeSnapshotData{}) + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshotData), err +} + +// Delete takes name of the volumeSnapshotData and deletes it. Returns an error if one occurs. +func (c *FakeVolumeSnapshotDatas) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(volumesnapshotdatasResource, name), &volumesnapshot_v1.VolumeSnapshotData{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVolumeSnapshotDatas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(volumesnapshotdatasResource, listOptions) + + _, err := c.Fake.Invokes(action, &volumesnapshot_v1.VolumeSnapshotDataList{}) + return err +} + +// Patch applies the patch and returns the patched volumeSnapshotData. +func (c *FakeVolumeSnapshotDatas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *volumesnapshot_v1.VolumeSnapshotData, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotdatasResource, name, data, subresources...), &volumesnapshot_v1.VolumeSnapshotData{}) + if obj == nil { + return nil, err + } + return obj.(*volumesnapshot_v1.VolumeSnapshotData), err +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/generated_expansion.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/generated_expansion.go new file mode 100644 index 000000000..bb5847dfd --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/generated_expansion.go @@ -0,0 +1,22 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type VolumeSnapshotExpansion interface{} + +type VolumeSnapshotDataExpansion interface{} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshot.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshot.go new file mode 100644 index 000000000..6b32bc34f --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshot.go @@ -0,0 +1,173 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + scheme "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme" + meta_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" +) + +// VolumeSnapshotsGetter has a method to return a VolumeSnapshotInterface. +// A group's client should implement this interface. +type VolumeSnapshotsGetter interface { + VolumeSnapshots(namespace string) VolumeSnapshotInterface +} + +// VolumeSnapshotInterface has methods to work with VolumeSnapshot resources. +type VolumeSnapshotInterface interface { + Create(*v1.VolumeSnapshot) (*v1.VolumeSnapshot, error) + Update(*v1.VolumeSnapshot) (*v1.VolumeSnapshot, error) + UpdateStatus(*v1.VolumeSnapshot) (*v1.VolumeSnapshot, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.VolumeSnapshot, error) + List(opts meta_v1.ListOptions) (*v1.VolumeSnapshotList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshot, err error) + VolumeSnapshotExpansion +} + +// volumeSnapshots implements VolumeSnapshotInterface +type volumeSnapshots struct { + client rest.Interface + ns string +} + +// newVolumeSnapshots returns a VolumeSnapshots +func newVolumeSnapshots(c *VolumesnapshotV1Client, namespace string) *volumeSnapshots { + return &volumeSnapshots{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any. +func (c *volumeSnapshots) Get(name string, options meta_v1.GetOptions) (result *v1.VolumeSnapshot, err error) { + result = &v1.VolumeSnapshot{} + err = c.client.Get(). + Namespace(c.ns). + Resource("volumesnapshots"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors. +func (c *volumeSnapshots) List(opts meta_v1.ListOptions) (result *v1.VolumeSnapshotList, err error) { + result = &v1.VolumeSnapshotList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("volumesnapshots"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested volumeSnapshots. +func (c *volumeSnapshots) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("volumesnapshots"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. +func (c *volumeSnapshots) Create(volumeSnapshot *v1.VolumeSnapshot) (result *v1.VolumeSnapshot, err error) { + result = &v1.VolumeSnapshot{} + err = c.client.Post(). + Namespace(c.ns). + Resource("volumesnapshots"). + Body(volumeSnapshot). + Do(). + Into(result) + return +} + +// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any. +func (c *volumeSnapshots) Update(volumeSnapshot *v1.VolumeSnapshot) (result *v1.VolumeSnapshot, err error) { + result = &v1.VolumeSnapshot{} + err = c.client.Put(). + Namespace(c.ns). + Resource("volumesnapshots"). + Name(volumeSnapshot.Name). + Body(volumeSnapshot). + Do(). + 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 *volumeSnapshots) UpdateStatus(volumeSnapshot *v1.VolumeSnapshot) (result *v1.VolumeSnapshot, err error) { + result = &v1.VolumeSnapshot{} + err = c.client.Put(). + Namespace(c.ns). + Resource("volumesnapshots"). + Name(volumeSnapshot.Name). + SubResource("status"). + Body(volumeSnapshot). + Do(). + Into(result) + return +} + +// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs. +func (c *volumeSnapshots) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("volumesnapshots"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *volumeSnapshots) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("volumesnapshots"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched volumeSnapshot. +func (c *volumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshot, err error) { + result = &v1.VolumeSnapshot{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("volumesnapshots"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshot_client.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshot_client.go new file mode 100644 index 000000000..4b4f13246 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshot_client.go @@ -0,0 +1,94 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type VolumesnapshotV1Interface interface { + RESTClient() rest.Interface + VolumeSnapshotsGetter + VolumeSnapshotDatasGetter +} + +// VolumesnapshotV1Client is used to interact with features provided by the volumesnapshot.external-storage.k8s.io group. +type VolumesnapshotV1Client struct { + restClient rest.Interface +} + +func (c *VolumesnapshotV1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface { + return newVolumeSnapshots(c, namespace) +} + +func (c *VolumesnapshotV1Client) VolumeSnapshotDatas() VolumeSnapshotDataInterface { + return newVolumeSnapshotDatas(c) +} + +// NewForConfig creates a new VolumesnapshotV1Client for the given config. +func NewForConfig(c *rest.Config) (*VolumesnapshotV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &VolumesnapshotV1Client{client}, nil +} + +// NewForConfigOrDie creates a new VolumesnapshotV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *VolumesnapshotV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new VolumesnapshotV1Client for the given RESTClient. +func New(c rest.Interface) *VolumesnapshotV1Client { + return &VolumesnapshotV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.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 *VolumesnapshotV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshotdata.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshotdata.go new file mode 100644 index 000000000..73a841a6c --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/volumesnapshotdata.go @@ -0,0 +1,162 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + scheme "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme" + meta_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" +) + +// VolumeSnapshotDatasGetter has a method to return a VolumeSnapshotDataInterface. +// A group's client should implement this interface. +type VolumeSnapshotDatasGetter interface { + VolumeSnapshotDatas() VolumeSnapshotDataInterface +} + +// VolumeSnapshotDataInterface has methods to work with VolumeSnapshotData resources. +type VolumeSnapshotDataInterface interface { + Create(*v1.VolumeSnapshotData) (*v1.VolumeSnapshotData, error) + Update(*v1.VolumeSnapshotData) (*v1.VolumeSnapshotData, error) + UpdateStatus(*v1.VolumeSnapshotData) (*v1.VolumeSnapshotData, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.VolumeSnapshotData, error) + List(opts meta_v1.ListOptions) (*v1.VolumeSnapshotDataList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshotData, err error) + VolumeSnapshotDataExpansion +} + +// volumeSnapshotDatas implements VolumeSnapshotDataInterface +type volumeSnapshotDatas struct { + client rest.Interface +} + +// newVolumeSnapshotDatas returns a VolumeSnapshotDatas +func newVolumeSnapshotDatas(c *VolumesnapshotV1Client) *volumeSnapshotDatas { + return &volumeSnapshotDatas{ + client: c.RESTClient(), + } +} + +// Get takes name of the volumeSnapshotData, and returns the corresponding volumeSnapshotData object, and an error if there is any. +func (c *volumeSnapshotDatas) Get(name string, options meta_v1.GetOptions) (result *v1.VolumeSnapshotData, err error) { + result = &v1.VolumeSnapshotData{} + err = c.client.Get(). + Resource("volumesnapshotdatas"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VolumeSnapshotDatas that match those selectors. +func (c *volumeSnapshotDatas) List(opts meta_v1.ListOptions) (result *v1.VolumeSnapshotDataList, err error) { + result = &v1.VolumeSnapshotDataList{} + err = c.client.Get(). + Resource("volumesnapshotdatas"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested volumeSnapshotDatas. +func (c *volumeSnapshotDatas) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("volumesnapshotdatas"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a volumeSnapshotData and creates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any. +func (c *volumeSnapshotDatas) Create(volumeSnapshotData *v1.VolumeSnapshotData) (result *v1.VolumeSnapshotData, err error) { + result = &v1.VolumeSnapshotData{} + err = c.client.Post(). + Resource("volumesnapshotdatas"). + Body(volumeSnapshotData). + Do(). + Into(result) + return +} + +// Update takes the representation of a volumeSnapshotData and updates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any. +func (c *volumeSnapshotDatas) Update(volumeSnapshotData *v1.VolumeSnapshotData) (result *v1.VolumeSnapshotData, err error) { + result = &v1.VolumeSnapshotData{} + err = c.client.Put(). + Resource("volumesnapshotdatas"). + Name(volumeSnapshotData.Name). + Body(volumeSnapshotData). + Do(). + 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 *volumeSnapshotDatas) UpdateStatus(volumeSnapshotData *v1.VolumeSnapshotData) (result *v1.VolumeSnapshotData, err error) { + result = &v1.VolumeSnapshotData{} + err = c.client.Put(). + Resource("volumesnapshotdatas"). + Name(volumeSnapshotData.Name). + SubResource("status"). + Body(volumeSnapshotData). + Do(). + Into(result) + return +} + +// Delete takes name of the volumeSnapshotData and deletes it. Returns an error if one occurs. +func (c *volumeSnapshotDatas) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("volumesnapshotdatas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *volumeSnapshotDatas) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("volumesnapshotdatas"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched volumeSnapshotData. +func (c *volumeSnapshotDatas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshotData, err error) { + result = &v1.VolumeSnapshotData{} + err = c.client.Patch(pt). + Resource("volumesnapshotdatas"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/factory.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/factory.go new file mode 100644 index 000000000..44f6a2df9 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,179 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces" + volumesnapshot "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Volumesnapshot() volumesnapshot.Interface +} + +func (f *sharedInformerFactory) Volumesnapshot() volumesnapshot.Interface { + return volumesnapshot.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/generic.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/generic.go new file mode 100644 index 000000000..ec54d45dc --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,63 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=volumesnapshot.external-storage.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("volumesnapshots"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Volumesnapshot().V1().VolumeSnapshots().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("volumesnapshotdatas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Volumesnapshot().V1().VolumeSnapshotDatas().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..b26877421 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,37 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/interface.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/interface.go new file mode 100644 index 000000000..190144e56 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/interface.go @@ -0,0 +1,45 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package volumesnapshot + +import ( + internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/interface.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/interface.go new file mode 100644 index 000000000..51fec6ff6 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/interface.go @@ -0,0 +1,51 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // VolumeSnapshots returns a VolumeSnapshotInformer. + VolumeSnapshots() VolumeSnapshotInformer + // VolumeSnapshotDatas returns a VolumeSnapshotDataInformer. + VolumeSnapshotDatas() VolumeSnapshotDataInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// VolumeSnapshots returns a VolumeSnapshotInformer. +func (v *version) VolumeSnapshots() VolumeSnapshotInformer { + return &volumeSnapshotInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VolumeSnapshotDatas returns a VolumeSnapshotDataInformer. +func (v *version) VolumeSnapshotDatas() VolumeSnapshotDataInformer { + return &volumeSnapshotDataInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/volumesnapshot.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/volumesnapshot.go new file mode 100644 index 000000000..c922e34ca --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/volumesnapshot.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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1" + meta_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" +) + +// VolumeSnapshotInformer provides access to a shared informer and lister for +// VolumeSnapshots. +type VolumeSnapshotInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VolumeSnapshotLister +} + +type volumeSnapshotInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVolumeSnapshotInformer constructs a new informer for VolumeSnapshot 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 NewVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeSnapshotInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeSnapshotInformer constructs a new informer for VolumeSnapshot 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 NewFilteredVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VolumesnapshotV1().VolumeSnapshots(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VolumesnapshotV1().VolumeSnapshots(namespace).Watch(options) + }, + }, + &volumesnapshot_v1.VolumeSnapshot{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeSnapshotInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeSnapshotInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeSnapshotInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&volumesnapshot_v1.VolumeSnapshot{}, f.defaultInformer) +} + +func (f *volumeSnapshotInformer) Lister() v1.VolumeSnapshotLister { + return v1.NewVolumeSnapshotLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/volumesnapshotdata.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/volumesnapshotdata.go new file mode 100644 index 000000000..abc8cbbdb --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1/volumesnapshotdata.go @@ -0,0 +1,87 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned" + internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1" + meta_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" +) + +// VolumeSnapshotDataInformer provides access to a shared informer and lister for +// VolumeSnapshotDatas. +type VolumeSnapshotDataInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VolumeSnapshotDataLister +} + +type volumeSnapshotDataInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeSnapshotDataInformer constructs a new informer for VolumeSnapshotData 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 NewVolumeSnapshotDataInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeSnapshotDataInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeSnapshotDataInformer constructs a new informer for VolumeSnapshotData 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 NewFilteredVolumeSnapshotDataInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VolumesnapshotV1().VolumeSnapshotDatas().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VolumesnapshotV1().VolumeSnapshotDatas().Watch(options) + }, + }, + &volumesnapshot_v1.VolumeSnapshotData{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeSnapshotDataInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeSnapshotDataInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeSnapshotDataInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&volumesnapshot_v1.VolumeSnapshotData{}, f.defaultInformer) +} + +func (f *volumeSnapshotDataInformer) Lister() v1.VolumeSnapshotDataLister { + return v1.NewVolumeSnapshotDataLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/expansion_generated.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/expansion_generated.go new file mode 100644 index 000000000..aad5ad5d5 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/expansion_generated.go @@ -0,0 +1,30 @@ +/* +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. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// VolumeSnapshotListerExpansion allows custom methods to be added to +// VolumeSnapshotLister. +type VolumeSnapshotListerExpansion interface{} + +// VolumeSnapshotNamespaceListerExpansion allows custom methods to be added to +// VolumeSnapshotNamespaceLister. +type VolumeSnapshotNamespaceListerExpansion interface{} + +// VolumeSnapshotDataListerExpansion allows custom methods to be added to +// VolumeSnapshotDataLister. +type VolumeSnapshotDataListerExpansion interface{} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/volumesnapshot.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/volumesnapshot.go new file mode 100644 index 000000000..e977248fc --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/volumesnapshot.go @@ -0,0 +1,93 @@ +/* +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. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeSnapshotLister helps list VolumeSnapshots. +type VolumeSnapshotLister interface { + // List lists all VolumeSnapshots in the indexer. + List(selector labels.Selector) (ret []*v1.VolumeSnapshot, err error) + // VolumeSnapshots returns an object that can list and get VolumeSnapshots. + VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister + VolumeSnapshotListerExpansion +} + +// volumeSnapshotLister implements the VolumeSnapshotLister interface. +type volumeSnapshotLister struct { + indexer cache.Indexer +} + +// NewVolumeSnapshotLister returns a new VolumeSnapshotLister. +func NewVolumeSnapshotLister(indexer cache.Indexer) VolumeSnapshotLister { + return &volumeSnapshotLister{indexer: indexer} +} + +// List lists all VolumeSnapshots in the indexer. +func (s *volumeSnapshotLister) List(selector labels.Selector) (ret []*v1.VolumeSnapshot, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VolumeSnapshot)) + }) + return ret, err +} + +// VolumeSnapshots returns an object that can list and get VolumeSnapshots. +func (s *volumeSnapshotLister) VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister { + return volumeSnapshotNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VolumeSnapshotNamespaceLister helps list and get VolumeSnapshots. +type VolumeSnapshotNamespaceLister interface { + // List lists all VolumeSnapshots in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.VolumeSnapshot, err error) + // Get retrieves the VolumeSnapshot from the indexer for a given namespace and name. + Get(name string) (*v1.VolumeSnapshot, error) + VolumeSnapshotNamespaceListerExpansion +} + +// volumeSnapshotNamespaceLister implements the VolumeSnapshotNamespaceLister +// interface. +type volumeSnapshotNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all VolumeSnapshots in the indexer for a given namespace. +func (s volumeSnapshotNamespaceLister) List(selector labels.Selector) (ret []*v1.VolumeSnapshot, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VolumeSnapshot)) + }) + return ret, err +} + +// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name. +func (s volumeSnapshotNamespaceLister) Get(name string) (*v1.VolumeSnapshot, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("volumesnapshot"), name) + } + return obj.(*v1.VolumeSnapshot), nil +} diff --git a/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/volumesnapshotdata.go b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/volumesnapshotdata.go new file mode 100644 index 000000000..a0d0092a0 --- /dev/null +++ b/vendor/github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1/volumesnapshotdata.go @@ -0,0 +1,64 @@ +/* +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. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeSnapshotDataLister helps list VolumeSnapshotDatas. +type VolumeSnapshotDataLister interface { + // List lists all VolumeSnapshotDatas in the indexer. + List(selector labels.Selector) (ret []*v1.VolumeSnapshotData, err error) + // Get retrieves the VolumeSnapshotData from the index for a given name. + Get(name string) (*v1.VolumeSnapshotData, error) + VolumeSnapshotDataListerExpansion +} + +// volumeSnapshotDataLister implements the VolumeSnapshotDataLister interface. +type volumeSnapshotDataLister struct { + indexer cache.Indexer +} + +// NewVolumeSnapshotDataLister returns a new VolumeSnapshotDataLister. +func NewVolumeSnapshotDataLister(indexer cache.Indexer) VolumeSnapshotDataLister { + return &volumeSnapshotDataLister{indexer: indexer} +} + +// List lists all VolumeSnapshotDatas in the indexer. +func (s *volumeSnapshotDataLister) List(selector labels.Selector) (ret []*v1.VolumeSnapshotData, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VolumeSnapshotData)) + }) + return ret, err +} + +// Get retrieves the VolumeSnapshotData from the index for a given name. +func (s *volumeSnapshotDataLister) Get(name string) (*v1.VolumeSnapshotData, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("volumesnapshotdata"), name) + } + return obj.(*v1.VolumeSnapshotData), nil +} diff --git a/vendor/manifest b/vendor/manifest index a100a25a8..31130f284 100644 --- a/vendor/manifest +++ b/vendor/manifest @@ -1650,6 +1650,14 @@ "path": "vendor/golang.org/x/sys/windows", "notests": true }, + { + "importpath": "github.com/openebs/k8s-snapshot-client", + "repository": "https://github.com/openebs/k8s-snapshot-client", + "vcs": "git", + "revision": "a6506305fb16b003487392c8199452b01161866e", + "branch": "master", + "notests": true + }, { "importpath": "github.com/opentracing-contrib/go-stdlib/nethttp", "repository": "https://github.com/opentracing-contrib/go-stdlib",