Move snapshot APIs and client to v1 (no controller changes)
This commit is contained in:
@@ -21,6 +21,7 @@ package versioned
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1"
|
||||
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1beta1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
@@ -30,6 +31,7 @@ import (
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface
|
||||
SnapshotV1() snapshotv1.SnapshotV1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
@@ -37,6 +39,7 @@ type Interface interface {
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
snapshotV1beta1 *snapshotv1beta1.SnapshotV1beta1Client
|
||||
snapshotV1 *snapshotv1.SnapshotV1Client
|
||||
}
|
||||
|
||||
// SnapshotV1beta1 retrieves the SnapshotV1beta1Client
|
||||
@@ -44,6 +47,11 @@ func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface {
|
||||
return c.snapshotV1beta1
|
||||
}
|
||||
|
||||
// SnapshotV1 retrieves the SnapshotV1Client
|
||||
func (c *Clientset) SnapshotV1() snapshotv1.SnapshotV1Interface {
|
||||
return c.snapshotV1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
@@ -69,6 +77,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.snapshotV1, err = snapshotv1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
@@ -82,6 +94,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.snapshotV1beta1 = snapshotv1beta1.NewForConfigOrDie(c)
|
||||
cs.snapshotV1 = snapshotv1.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
@@ -91,6 +104,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.snapshotV1beta1 = snapshotv1beta1.New(c)
|
||||
cs.snapshotV1 = snapshotv1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
|
@@ -20,6 +20,8 @@ package fake
|
||||
|
||||
import (
|
||||
clientset "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned"
|
||||
snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1"
|
||||
fakesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1/fake"
|
||||
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1beta1"
|
||||
fakesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1beta1/fake"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -80,3 +82,8 @@ var _ clientset.Interface = &Clientset{}
|
||||
func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface {
|
||||
return &fakesnapshotv1beta1.FakeSnapshotV1beta1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// SnapshotV1 retrieves the SnapshotV1Client
|
||||
func (c *Clientset) SnapshotV1() snapshotv1.SnapshotV1Interface {
|
||||
return &fakesnapshotv1.FakeSnapshotV1{Fake: &c.Fake}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1"
|
||||
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -32,6 +33,7 @@ var codecs = serializer.NewCodecFactory(scheme)
|
||||
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
snapshotv1beta1.AddToScheme,
|
||||
snapshotv1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
@@ -19,6 +19,7 @@ limitations under the License.
|
||||
package scheme
|
||||
|
||||
import (
|
||||
snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1"
|
||||
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -32,6 +33,7 @@ var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
snapshotv1beta1.AddToScheme,
|
||||
snapshotv1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
20
client/clientset/versioned/typed/volumesnapshot/v1/doc.go
Normal file
20
client/clientset/versioned/typed/volumesnapshot/v1/doc.go
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/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 *FakeSnapshotV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var volumesnapshotsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1", Resource: "volumesnapshots"}
|
||||
|
||||
var volumesnapshotsKind = schema.GroupVersionKind{Group: "snapshot.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(ctx context.Context, name string, options v1.GetOptions) (result *volumesnapshotv1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &volumesnapshotv1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *FakeVolumeSnapshots) List(ctx context.Context, opts v1.ListOptions) (result *volumesnapshotv1.VolumeSnapshotList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &volumesnapshotv1.VolumeSnapshotList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &volumesnapshotv1.VolumeSnapshotList{ListMeta: obj.(*volumesnapshotv1.VolumeSnapshotList).ListMeta}
|
||||
for _, item := range obj.(*volumesnapshotv1.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(ctx context.Context, 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(ctx context.Context, volumeSnapshot *volumesnapshotv1.VolumeSnapshot, opts v1.CreateOptions) (result *volumesnapshotv1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &volumesnapshotv1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.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(ctx context.Context, volumeSnapshot *volumesnapshotv1.VolumeSnapshot, opts v1.UpdateOptions) (result *volumesnapshotv1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &volumesnapshotv1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.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(ctx context.Context, volumeSnapshot *volumesnapshotv1.VolumeSnapshot, opts v1.UpdateOptions) (*volumesnapshotv1.VolumeSnapshot, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &volumesnapshotv1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(volumesnapshotsResource, c.ns, name), &volumesnapshotv1.VolumeSnapshot{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &volumesnapshotv1.VolumeSnapshotList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *FakeVolumeSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *volumesnapshotv1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, pt, data, subresources...), &volumesnapshotv1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshot), err
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1 "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/typed/volumesnapshot/v1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeSnapshotV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1) VolumeSnapshots(namespace string) v1.VolumeSnapshotInterface {
|
||||
return &FakeVolumeSnapshots{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1) VolumeSnapshotClasses() v1.VolumeSnapshotClassInterface {
|
||||
return &FakeVolumeSnapshotClasses{c}
|
||||
}
|
||||
|
||||
func (c *FakeSnapshotV1) VolumeSnapshotContents() v1.VolumeSnapshotContentInterface {
|
||||
return &FakeVolumeSnapshotContents{c}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeSnapshotV1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/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"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotClasses implements VolumeSnapshotClassInterface
|
||||
type FakeVolumeSnapshotClasses struct {
|
||||
Fake *FakeSnapshotV1
|
||||
}
|
||||
|
||||
var volumesnapshotclassesResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1", Resource: "volumesnapshotclasses"}
|
||||
|
||||
var volumesnapshotclassesKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1", Kind: "VolumeSnapshotClass"}
|
||||
|
||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *volumesnapshotv1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotclassesResource, name), &volumesnapshotv1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
||||
func (c *FakeVolumeSnapshotClasses) List(ctx context.Context, opts v1.ListOptions) (result *volumesnapshotv1.VolumeSnapshotClassList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotclassesResource, volumesnapshotclassesKind, opts), &volumesnapshotv1.VolumeSnapshotClassList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &volumesnapshotv1.VolumeSnapshotClassList{ListMeta: obj.(*volumesnapshotv1.VolumeSnapshotClassList).ListMeta}
|
||||
for _, item := range obj.(*volumesnapshotv1.VolumeSnapshotClassList).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 volumeSnapshotClasses.
|
||||
func (c *FakeVolumeSnapshotClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotclassesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Create(ctx context.Context, volumeSnapshotClass *volumesnapshotv1.VolumeSnapshotClass, opts v1.CreateOptions) (result *volumesnapshotv1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotclassesResource, volumeSnapshotClass), &volumesnapshotv1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotClasses) Update(ctx context.Context, volumeSnapshotClass *volumesnapshotv1.VolumeSnapshotClass, opts v1.UpdateOptions) (result *volumesnapshotv1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotclassesResource, volumeSnapshotClass), &volumesnapshotv1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotClass), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotclassesResource, name), &volumesnapshotv1.VolumeSnapshotClass{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotclassesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &volumesnapshotv1.VolumeSnapshotClassList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
||||
func (c *FakeVolumeSnapshotClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *volumesnapshotv1.VolumeSnapshotClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotclassesResource, name, pt, data, subresources...), &volumesnapshotv1.VolumeSnapshotClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotClass), err
|
||||
}
|
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v3/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"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotContents implements VolumeSnapshotContentInterface
|
||||
type FakeVolumeSnapshotContents struct {
|
||||
Fake *FakeSnapshotV1
|
||||
}
|
||||
|
||||
var volumesnapshotcontentsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1", Resource: "volumesnapshotcontents"}
|
||||
|
||||
var volumesnapshotcontentsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1", Kind: "VolumeSnapshotContent"}
|
||||
|
||||
// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *volumesnapshotv1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotcontentsResource, name), &volumesnapshotv1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors.
|
||||
func (c *FakeVolumeSnapshotContents) List(ctx context.Context, opts v1.ListOptions) (result *volumesnapshotv1.VolumeSnapshotContentList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotcontentsResource, volumesnapshotcontentsKind, opts), &volumesnapshotv1.VolumeSnapshotContentList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &volumesnapshotv1.VolumeSnapshotContentList{ListMeta: obj.(*volumesnapshotv1.VolumeSnapshotContentList).ListMeta}
|
||||
for _, item := range obj.(*volumesnapshotv1.VolumeSnapshotContentList).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 volumeSnapshotContents.
|
||||
func (c *FakeVolumeSnapshotContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotcontentsResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Create(ctx context.Context, volumeSnapshotContent *volumesnapshotv1.VolumeSnapshotContent, opts v1.CreateOptions) (result *volumesnapshotv1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &volumesnapshotv1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotContents) Update(ctx context.Context, volumeSnapshotContent *volumesnapshotv1.VolumeSnapshotContent, opts v1.UpdateOptions) (result *volumesnapshotv1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotcontentsResource, volumeSnapshotContent), &volumesnapshotv1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotContent), 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 *FakeVolumeSnapshotContents) UpdateStatus(ctx context.Context, volumeSnapshotContent *volumesnapshotv1.VolumeSnapshotContent, opts v1.UpdateOptions) (*volumesnapshotv1.VolumeSnapshotContent, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(volumesnapshotcontentsResource, "status", volumeSnapshotContent), &volumesnapshotv1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotContent), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotcontentsResource, name), &volumesnapshotv1.VolumeSnapshotContent{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotcontentsResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &volumesnapshotv1.VolumeSnapshotContentList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotContent.
|
||||
func (c *FakeVolumeSnapshotContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *volumesnapshotv1.VolumeSnapshotContent, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotcontentsResource, name, pt, data, subresources...), &volumesnapshotv1.VolumeSnapshotContent{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshotv1.VolumeSnapshotContent), err
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
type VolumeSnapshotExpansion interface{}
|
||||
|
||||
type VolumeSnapshotClassExpansion interface{}
|
||||
|
||||
type VolumeSnapshotContentExpansion interface{}
|
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1"
|
||||
scheme "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/scheme"
|
||||
metav1 "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(ctx context.Context, volumeSnapshot *v1.VolumeSnapshot, opts metav1.CreateOptions) (*v1.VolumeSnapshot, error)
|
||||
Update(ctx context.Context, volumeSnapshot *v1.VolumeSnapshot, opts metav1.UpdateOptions) (*v1.VolumeSnapshot, error)
|
||||
UpdateStatus(ctx context.Context, volumeSnapshot *v1.VolumeSnapshot, opts metav1.UpdateOptions) (*v1.VolumeSnapshot, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshot, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, 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 *SnapshotV1Client, 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(ctx context.Context, name string, options metav1.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(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *volumeSnapshots) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VolumeSnapshotList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.VolumeSnapshotList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *volumeSnapshots) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// 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(ctx context.Context, volumeSnapshot *v1.VolumeSnapshot, opts metav1.CreateOptions) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.VolumeSnapshot{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshot).
|
||||
Do(ctx).
|
||||
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(ctx context.Context, volumeSnapshot *v1.VolumeSnapshot, opts metav1.UpdateOptions) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.VolumeSnapshot{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(volumeSnapshot.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshot).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *volumeSnapshots) UpdateStatus(ctx context.Context, volumeSnapshot *v1.VolumeSnapshot, opts metav1.UpdateOptions) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.VolumeSnapshot{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(volumeSnapshot.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshot).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshots) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshots) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *volumeSnapshots) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.VolumeSnapshot{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1"
|
||||
"github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type SnapshotV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
VolumeSnapshotsGetter
|
||||
VolumeSnapshotClassesGetter
|
||||
VolumeSnapshotContentsGetter
|
||||
}
|
||||
|
||||
// SnapshotV1Client is used to interact with features provided by the snapshot.storage.k8s.io group.
|
||||
type SnapshotV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *SnapshotV1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface {
|
||||
return newVolumeSnapshots(c, namespace)
|
||||
}
|
||||
|
||||
func (c *SnapshotV1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface {
|
||||
return newVolumeSnapshotClasses(c)
|
||||
}
|
||||
|
||||
func (c *SnapshotV1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface {
|
||||
return newVolumeSnapshotContents(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new SnapshotV1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*SnapshotV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SnapshotV1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new SnapshotV1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *SnapshotV1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new SnapshotV1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *SnapshotV1Client {
|
||||
return &SnapshotV1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
||||
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 *SnapshotV1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1"
|
||||
scheme "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/scheme"
|
||||
metav1 "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"
|
||||
)
|
||||
|
||||
// VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotClassesGetter interface {
|
||||
VolumeSnapshotClasses() VolumeSnapshotClassInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources.
|
||||
type VolumeSnapshotClassInterface interface {
|
||||
Create(ctx context.Context, volumeSnapshotClass *v1.VolumeSnapshotClass, opts metav1.CreateOptions) (*v1.VolumeSnapshotClass, error)
|
||||
Update(ctx context.Context, volumeSnapshotClass *v1.VolumeSnapshotClass, opts metav1.UpdateOptions) (*v1.VolumeSnapshotClass, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshotClass, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotClassList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotClass, err error)
|
||||
VolumeSnapshotClassExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotClasses implements VolumeSnapshotClassInterface
|
||||
type volumeSnapshotClasses struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newVolumeSnapshotClasses returns a VolumeSnapshotClasses
|
||||
func newVolumeSnapshotClasses(c *SnapshotV1Client) *volumeSnapshotClasses {
|
||||
return &volumeSnapshotClasses{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
||||
func (c *volumeSnapshotClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VolumeSnapshotClass, err error) {
|
||||
result = &v1.VolumeSnapshotClass{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
||||
func (c *volumeSnapshotClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VolumeSnapshotClassList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.VolumeSnapshotClassList{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses.
|
||||
func (c *volumeSnapshotClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *volumeSnapshotClasses) Create(ctx context.Context, volumeSnapshotClass *v1.VolumeSnapshotClass, opts metav1.CreateOptions) (result *v1.VolumeSnapshotClass, err error) {
|
||||
result = &v1.VolumeSnapshotClass{}
|
||||
err = c.client.Post().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshotClass).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
||||
func (c *volumeSnapshotClasses) Update(ctx context.Context, volumeSnapshotClass *v1.VolumeSnapshotClass, opts metav1.UpdateOptions) (result *v1.VolumeSnapshotClass, err error) {
|
||||
result = &v1.VolumeSnapshotClass{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(volumeSnapshotClass.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshotClass).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshotClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshotClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotclasses").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
||||
func (c *volumeSnapshotClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotClass, err error) {
|
||||
result = &v1.VolumeSnapshotClass{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("volumesnapshotclasses").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1"
|
||||
scheme "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned/scheme"
|
||||
metav1 "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"
|
||||
)
|
||||
|
||||
// VolumeSnapshotContentsGetter has a method to return a VolumeSnapshotContentInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotContentsGetter interface {
|
||||
VolumeSnapshotContents() VolumeSnapshotContentInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotContentInterface has methods to work with VolumeSnapshotContent resources.
|
||||
type VolumeSnapshotContentInterface interface {
|
||||
Create(ctx context.Context, volumeSnapshotContent *v1.VolumeSnapshotContent, opts metav1.CreateOptions) (*v1.VolumeSnapshotContent, error)
|
||||
Update(ctx context.Context, volumeSnapshotContent *v1.VolumeSnapshotContent, opts metav1.UpdateOptions) (*v1.VolumeSnapshotContent, error)
|
||||
UpdateStatus(ctx context.Context, volumeSnapshotContent *v1.VolumeSnapshotContent, opts metav1.UpdateOptions) (*v1.VolumeSnapshotContent, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeSnapshotContent, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeSnapshotContentList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotContent, err error)
|
||||
VolumeSnapshotContentExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotContents implements VolumeSnapshotContentInterface
|
||||
type volumeSnapshotContents struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newVolumeSnapshotContents returns a VolumeSnapshotContents
|
||||
func newVolumeSnapshotContents(c *SnapshotV1Client) *volumeSnapshotContents {
|
||||
return &volumeSnapshotContents{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any.
|
||||
func (c *volumeSnapshotContents) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VolumeSnapshotContent, err error) {
|
||||
result = &v1.VolumeSnapshotContent{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors.
|
||||
func (c *volumeSnapshotContents) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VolumeSnapshotContentList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.VolumeSnapshotContentList{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotContents.
|
||||
func (c *volumeSnapshotContents) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *volumeSnapshotContents) Create(ctx context.Context, volumeSnapshotContent *v1.VolumeSnapshotContent, opts metav1.CreateOptions) (result *v1.VolumeSnapshotContent, err error) {
|
||||
result = &v1.VolumeSnapshotContent{}
|
||||
err = c.client.Post().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshotContent).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
||||
func (c *volumeSnapshotContents) Update(ctx context.Context, volumeSnapshotContent *v1.VolumeSnapshotContent, opts metav1.UpdateOptions) (result *v1.VolumeSnapshotContent, err error) {
|
||||
result = &v1.VolumeSnapshotContent{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(volumeSnapshotContent.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshotContent).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *volumeSnapshotContents) UpdateStatus(ctx context.Context, volumeSnapshotContent *v1.VolumeSnapshotContent, opts metav1.UpdateOptions) (result *v1.VolumeSnapshotContent, err error) {
|
||||
result = &v1.VolumeSnapshotContent{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(volumeSnapshotContent.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(volumeSnapshotContent).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshotContents) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshotContents) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotcontents").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotContent.
|
||||
func (c *volumeSnapshotContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeSnapshotContent, err error) {
|
||||
result = &v1.VolumeSnapshotContent{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("volumesnapshotcontents").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user