Generate clients for BackupStorageLocation

Signed-off-by: Nolan Brubaker <nolan@heptio.com>
This commit is contained in:
Nolan Brubaker
2018-08-09 12:19:49 -04:00
committed by Steve Kriss
parent a25eb03290
commit 345c3c39b1
11 changed files with 526 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ package v1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BackupStorageLocation is a location where Ark stores backup objects.

View File

@@ -28,6 +28,7 @@ import (
type ArkV1Interface interface {
RESTClient() rest.Interface
BackupsGetter
BackupStorageLocationsGetter
ConfigsGetter
DeleteBackupRequestsGetter
DownloadRequestsGetter
@@ -47,6 +48,10 @@ func (c *ArkV1Client) Backups(namespace string) BackupInterface {
return newBackups(c, namespace)
}
func (c *ArkV1Client) BackupStorageLocations(namespace string) BackupStorageLocationInterface {
return newBackupStorageLocations(c, namespace)
}
func (c *ArkV1Client) Configs(namespace string) ConfigInterface {
return newConfigs(c, namespace)
}

View File

@@ -0,0 +1,174 @@
/*
Copyright 2018 the Heptio Ark contributors.
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/heptio/ark/pkg/apis/ark/v1"
scheme "github.com/heptio/ark/pkg/generated/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"
)
// BackupStorageLocationsGetter has a method to return a BackupStorageLocationInterface.
// A group's client should implement this interface.
type BackupStorageLocationsGetter interface {
BackupStorageLocations(namespace string) BackupStorageLocationInterface
}
// BackupStorageLocationInterface has methods to work with BackupStorageLocation resources.
type BackupStorageLocationInterface interface {
Create(*v1.BackupStorageLocation) (*v1.BackupStorageLocation, error)
Update(*v1.BackupStorageLocation) (*v1.BackupStorageLocation, error)
UpdateStatus(*v1.BackupStorageLocation) (*v1.BackupStorageLocation, 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.BackupStorageLocation, error)
List(opts meta_v1.ListOptions) (*v1.BackupStorageLocationList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BackupStorageLocation, err error)
BackupStorageLocationExpansion
}
// backupStorageLocations implements BackupStorageLocationInterface
type backupStorageLocations struct {
client rest.Interface
ns string
}
// newBackupStorageLocations returns a BackupStorageLocations
func newBackupStorageLocations(c *ArkV1Client, namespace string) *backupStorageLocations {
return &backupStorageLocations{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the backupStorageLocation, and returns the corresponding backupStorageLocation object, and an error if there is any.
func (c *backupStorageLocations) Get(name string, options meta_v1.GetOptions) (result *v1.BackupStorageLocation, err error) {
result = &v1.BackupStorageLocation{}
err = c.client.Get().
Namespace(c.ns).
Resource("backupstoragelocations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of BackupStorageLocations that match those selectors.
func (c *backupStorageLocations) List(opts meta_v1.ListOptions) (result *v1.BackupStorageLocationList, err error) {
result = &v1.BackupStorageLocationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("backupstoragelocations").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested backupStorageLocations.
func (c *backupStorageLocations) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("backupstoragelocations").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Create takes the representation of a backupStorageLocation and creates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any.
func (c *backupStorageLocations) Create(backupStorageLocation *v1.BackupStorageLocation) (result *v1.BackupStorageLocation, err error) {
result = &v1.BackupStorageLocation{}
err = c.client.Post().
Namespace(c.ns).
Resource("backupstoragelocations").
Body(backupStorageLocation).
Do().
Into(result)
return
}
// Update takes the representation of a backupStorageLocation and updates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any.
func (c *backupStorageLocations) Update(backupStorageLocation *v1.BackupStorageLocation) (result *v1.BackupStorageLocation, err error) {
result = &v1.BackupStorageLocation{}
err = c.client.Put().
Namespace(c.ns).
Resource("backupstoragelocations").
Name(backupStorageLocation.Name).
Body(backupStorageLocation).
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 *backupStorageLocations) UpdateStatus(backupStorageLocation *v1.BackupStorageLocation) (result *v1.BackupStorageLocation, err error) {
result = &v1.BackupStorageLocation{}
err = c.client.Put().
Namespace(c.ns).
Resource("backupstoragelocations").
Name(backupStorageLocation.Name).
SubResource("status").
Body(backupStorageLocation).
Do().
Into(result)
return
}
// Delete takes name of the backupStorageLocation and deletes it. Returns an error if one occurs.
func (c *backupStorageLocations) Delete(name string, options *meta_v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("backupstoragelocations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *backupStorageLocations) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("backupstoragelocations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched backupStorageLocation.
func (c *backupStorageLocations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BackupStorageLocation, err error) {
result = &v1.BackupStorageLocation{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("backupstoragelocations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@@ -32,6 +32,10 @@ func (c *FakeArkV1) Backups(namespace string) v1.BackupInterface {
return &FakeBackups{c, namespace}
}
func (c *FakeArkV1) BackupStorageLocations(namespace string) v1.BackupStorageLocationInterface {
return &FakeBackupStorageLocations{c, namespace}
}
func (c *FakeArkV1) Configs(namespace string) v1.ConfigInterface {
return &FakeConfigs{c, namespace}
}

View File

@@ -0,0 +1,140 @@
/*
Copyright 2018 the Heptio Ark contributors.
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 (
ark_v1 "github.com/heptio/ark/pkg/apis/ark/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"
)
// FakeBackupStorageLocations implements BackupStorageLocationInterface
type FakeBackupStorageLocations struct {
Fake *FakeArkV1
ns string
}
var backupstoragelocationsResource = schema.GroupVersionResource{Group: "ark.heptio.com", Version: "v1", Resource: "backupstoragelocations"}
var backupstoragelocationsKind = schema.GroupVersionKind{Group: "ark.heptio.com", Version: "v1", Kind: "BackupStorageLocation"}
// Get takes name of the backupStorageLocation, and returns the corresponding backupStorageLocation object, and an error if there is any.
func (c *FakeBackupStorageLocations) Get(name string, options v1.GetOptions) (result *ark_v1.BackupStorageLocation, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(backupstoragelocationsResource, c.ns, name), &ark_v1.BackupStorageLocation{})
if obj == nil {
return nil, err
}
return obj.(*ark_v1.BackupStorageLocation), err
}
// List takes label and field selectors, and returns the list of BackupStorageLocations that match those selectors.
func (c *FakeBackupStorageLocations) List(opts v1.ListOptions) (result *ark_v1.BackupStorageLocationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(backupstoragelocationsResource, backupstoragelocationsKind, c.ns, opts), &ark_v1.BackupStorageLocationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &ark_v1.BackupStorageLocationList{ListMeta: obj.(*ark_v1.BackupStorageLocationList).ListMeta}
for _, item := range obj.(*ark_v1.BackupStorageLocationList).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 backupStorageLocations.
func (c *FakeBackupStorageLocations) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(backupstoragelocationsResource, c.ns, opts))
}
// Create takes the representation of a backupStorageLocation and creates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any.
func (c *FakeBackupStorageLocations) Create(backupStorageLocation *ark_v1.BackupStorageLocation) (result *ark_v1.BackupStorageLocation, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(backupstoragelocationsResource, c.ns, backupStorageLocation), &ark_v1.BackupStorageLocation{})
if obj == nil {
return nil, err
}
return obj.(*ark_v1.BackupStorageLocation), err
}
// Update takes the representation of a backupStorageLocation and updates it. Returns the server's representation of the backupStorageLocation, and an error, if there is any.
func (c *FakeBackupStorageLocations) Update(backupStorageLocation *ark_v1.BackupStorageLocation) (result *ark_v1.BackupStorageLocation, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(backupstoragelocationsResource, c.ns, backupStorageLocation), &ark_v1.BackupStorageLocation{})
if obj == nil {
return nil, err
}
return obj.(*ark_v1.BackupStorageLocation), 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 *FakeBackupStorageLocations) UpdateStatus(backupStorageLocation *ark_v1.BackupStorageLocation) (*ark_v1.BackupStorageLocation, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(backupstoragelocationsResource, "status", c.ns, backupStorageLocation), &ark_v1.BackupStorageLocation{})
if obj == nil {
return nil, err
}
return obj.(*ark_v1.BackupStorageLocation), err
}
// Delete takes name of the backupStorageLocation and deletes it. Returns an error if one occurs.
func (c *FakeBackupStorageLocations) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(backupstoragelocationsResource, c.ns, name), &ark_v1.BackupStorageLocation{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeBackupStorageLocations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(backupstoragelocationsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &ark_v1.BackupStorageLocationList{})
return err
}
// Patch applies the patch and returns the patched backupStorageLocation.
func (c *FakeBackupStorageLocations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *ark_v1.BackupStorageLocation, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(backupstoragelocationsResource, c.ns, name, data, subresources...), &ark_v1.BackupStorageLocation{})
if obj == nil {
return nil, err
}
return obj.(*ark_v1.BackupStorageLocation), err
}

View File

@@ -20,6 +20,8 @@ package v1
type BackupExpansion interface{}
type BackupStorageLocationExpansion interface{}
type ConfigExpansion interface{}
type DeleteBackupRequestExpansion interface{}

View File

@@ -0,0 +1,89 @@
/*
Copyright 2018 the Heptio Ark contributors.
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"
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
versioned "github.com/heptio/ark/pkg/generated/clientset/versioned"
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/externalversions/internalinterfaces"
v1 "github.com/heptio/ark/pkg/generated/listers/ark/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"
)
// BackupStorageLocationInformer provides access to a shared informer and lister for
// BackupStorageLocations.
type BackupStorageLocationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.BackupStorageLocationLister
}
type backupStorageLocationInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewBackupStorageLocationInformer constructs a new informer for BackupStorageLocation 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 NewBackupStorageLocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredBackupStorageLocationInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredBackupStorageLocationInformer constructs a new informer for BackupStorageLocation 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 NewFilteredBackupStorageLocationInformer(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.ArkV1().BackupStorageLocations(namespace).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ArkV1().BackupStorageLocations(namespace).Watch(options)
},
},
&ark_v1.BackupStorageLocation{},
resyncPeriod,
indexers,
)
}
func (f *backupStorageLocationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredBackupStorageLocationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *backupStorageLocationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&ark_v1.BackupStorageLocation{}, f.defaultInformer)
}
func (f *backupStorageLocationInformer) Lister() v1.BackupStorageLocationLister {
return v1.NewBackupStorageLocationLister(f.Informer().GetIndexer())
}

View File

@@ -26,6 +26,8 @@ import (
type Interface interface {
// Backups returns a BackupInformer.
Backups() BackupInformer
// BackupStorageLocations returns a BackupStorageLocationInformer.
BackupStorageLocations() BackupStorageLocationInformer
// Configs returns a ConfigInformer.
Configs() ConfigInformer
// DeleteBackupRequests returns a DeleteBackupRequestInformer.
@@ -60,6 +62,11 @@ func (v *version) Backups() BackupInformer {
return &backupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// BackupStorageLocations returns a BackupStorageLocationInformer.
func (v *version) BackupStorageLocations() BackupStorageLocationInformer {
return &backupStorageLocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Configs returns a ConfigInformer.
func (v *version) Configs() ConfigInformer {
return &configInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@@ -55,6 +55,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=ark.heptio.com, Version=v1
case v1.SchemeGroupVersion.WithResource("backups"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Backups().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("backupstoragelocations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().BackupStorageLocations().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("configs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Configs().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("deletebackuprequests"):

View File

@@ -0,0 +1,94 @@
/*
Copyright 2018 the Heptio Ark contributors.
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/heptio/ark/pkg/apis/ark/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// BackupStorageLocationLister helps list BackupStorageLocations.
type BackupStorageLocationLister interface {
// List lists all BackupStorageLocations in the indexer.
List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error)
// BackupStorageLocations returns an object that can list and get BackupStorageLocations.
BackupStorageLocations(namespace string) BackupStorageLocationNamespaceLister
BackupStorageLocationListerExpansion
}
// backupStorageLocationLister implements the BackupStorageLocationLister interface.
type backupStorageLocationLister struct {
indexer cache.Indexer
}
// NewBackupStorageLocationLister returns a new BackupStorageLocationLister.
func NewBackupStorageLocationLister(indexer cache.Indexer) BackupStorageLocationLister {
return &backupStorageLocationLister{indexer: indexer}
}
// List lists all BackupStorageLocations in the indexer.
func (s *backupStorageLocationLister) List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1.BackupStorageLocation))
})
return ret, err
}
// BackupStorageLocations returns an object that can list and get BackupStorageLocations.
func (s *backupStorageLocationLister) BackupStorageLocations(namespace string) BackupStorageLocationNamespaceLister {
return backupStorageLocationNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// BackupStorageLocationNamespaceLister helps list and get BackupStorageLocations.
type BackupStorageLocationNamespaceLister interface {
// List lists all BackupStorageLocations in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error)
// Get retrieves the BackupStorageLocation from the indexer for a given namespace and name.
Get(name string) (*v1.BackupStorageLocation, error)
BackupStorageLocationNamespaceListerExpansion
}
// backupStorageLocationNamespaceLister implements the BackupStorageLocationNamespaceLister
// interface.
type backupStorageLocationNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all BackupStorageLocations in the indexer for a given namespace.
func (s backupStorageLocationNamespaceLister) List(selector labels.Selector) (ret []*v1.BackupStorageLocation, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1.BackupStorageLocation))
})
return ret, err
}
// Get retrieves the BackupStorageLocation from the indexer for a given namespace and name.
func (s backupStorageLocationNamespaceLister) Get(name string) (*v1.BackupStorageLocation, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1.Resource("backupstoragelocation"), name)
}
return obj.(*v1.BackupStorageLocation), nil
}

View File

@@ -26,6 +26,14 @@ type BackupListerExpansion interface{}
// BackupNamespaceLister.
type BackupNamespaceListerExpansion interface{}
// BackupStorageLocationListerExpansion allows custom methods to be added to
// BackupStorageLocationLister.
type BackupStorageLocationListerExpansion interface{}
// BackupStorageLocationNamespaceListerExpansion allows custom methods to be added to
// BackupStorageLocationNamespaceLister.
type BackupStorageLocationNamespaceListerExpansion interface{}
// ConfigListerExpansion allows custom methods to be added to
// ConfigLister.
type ConfigListerExpansion interface{}