Initial commit

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
Andy Goldstein
2017-08-02 13:27:17 -04:00
commit 2fe501f527
2024 changed files with 948288 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
package clientset
import (
glog "github.com/golang/glog"
arkv1 "github.com/heptio/ark/pkg/generated/clientset/typed/ark/v1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
ArkV1() arkv1.ArkV1Interface
// Deprecated: please explicitly pick a version if possible.
Ark() arkv1.ArkV1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*arkv1.ArkV1Client
}
// ArkV1 retrieves the ArkV1Client
func (c *Clientset) ArkV1() arkv1.ArkV1Interface {
if c == nil {
return nil
}
return c.ArkV1Client
}
// Deprecated: Ark retrieves the default version of ArkClient.
// Please explicitly pick a version.
func (c *Clientset) Ark() arkv1.ArkV1Interface {
if c == nil {
return nil
}
return c.ArkV1Client
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
return nil
}
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.ArkV1Client, err = arkv1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err)
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.ArkV1Client = arkv1.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.ArkV1Client = arkv1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}
+4
View File
@@ -0,0 +1,4 @@
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated clientset.
package clientset
@@ -0,0 +1,55 @@
package fake
import (
clientset "github.com/heptio/ark/pkg/generated/clientset"
arkv1 "github.com/heptio/ark/pkg/generated/clientset/typed/ark/v1"
fakearkv1 "github.com/heptio/ark/pkg/generated/clientset/typed/ark/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)
}
}
fakePtr := testing.Fake{}
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o))
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
return &Clientset{fakePtr}
}
// 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
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return &fakediscovery.FakeDiscovery{Fake: &c.Fake}
}
var _ clientset.Interface = &Clientset{}
// ArkV1 retrieves the ArkV1Client
func (c *Clientset) ArkV1() arkv1.ArkV1Interface {
return &fakearkv1.FakeArkV1{Fake: &c.Fake}
}
// Ark retrieves the ArkV1Client
func (c *Clientset) Ark() arkv1.ArkV1Interface {
return &fakearkv1.FakeArkV1{Fake: &c.Fake}
}
+4
View File
@@ -0,0 +1,4 @@
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated fake clientset.
package fake
+37
View File
@@ -0,0 +1,37 @@
package fake
import (
arkv1 "github.com/heptio/ark/pkg/apis/ark/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/kuberentes/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) {
arkv1.AddToScheme(scheme)
}
+4
View File
@@ -0,0 +1,4 @@
// This package is generated by client-gen with custom arguments.
// This package contains the scheme of the automatically generated clientset.
package scheme
@@ -0,0 +1,37 @@
package scheme
import (
arkv1 "github.com/heptio/ark/pkg/apis/ark/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/kuberentes/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) {
arkv1.AddToScheme(scheme)
}
@@ -0,0 +1,87 @@
package v1
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/generated/clientset/scheme"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
)
type ArkV1Interface interface {
RESTClient() rest.Interface
BackupsGetter
ConfigsGetter
RestoresGetter
SchedulesGetter
}
// ArkV1Client is used to interact with features provided by the ark.heptio.com group.
type ArkV1Client struct {
restClient rest.Interface
}
func (c *ArkV1Client) Backups(namespace string) BackupInterface {
return newBackups(c, namespace)
}
func (c *ArkV1Client) Configs(namespace string) ConfigInterface {
return newConfigs(c, namespace)
}
func (c *ArkV1Client) Restores(namespace string) RestoreInterface {
return newRestores(c, namespace)
}
func (c *ArkV1Client) Schedules(namespace string) ScheduleInterface {
return newSchedules(c, namespace)
}
// NewForConfig creates a new ArkV1Client for the given config.
func NewForConfig(c *rest.Config) (*ArkV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &ArkV1Client{client}, nil
}
// NewForConfigOrDie creates a new ArkV1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *ArkV1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new ArkV1Client for the given RESTClient.
func New(c rest.Interface) *ArkV1Client {
return &ArkV1Client{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 *ArkV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
@@ -0,0 +1,156 @@
package v1
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
scheme "github.com/heptio/ark/pkg/generated/clientset/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"
)
// BackupsGetter has a method to return a BackupInterface.
// A group's client should implement this interface.
type BackupsGetter interface {
Backups(namespace string) BackupInterface
}
// BackupInterface has methods to work with Backup resources.
type BackupInterface interface {
Create(*v1.Backup) (*v1.Backup, error)
Update(*v1.Backup) (*v1.Backup, error)
UpdateStatus(*v1.Backup) (*v1.Backup, 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.Backup, error)
List(opts meta_v1.ListOptions) (*v1.BackupList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Backup, err error)
BackupExpansion
}
// backups implements BackupInterface
type backups struct {
client rest.Interface
ns string
}
// newBackups returns a Backups
func newBackups(c *ArkV1Client, namespace string) *backups {
return &backups{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a backup and creates it. Returns the server's representation of the backup, and an error, if there is any.
func (c *backups) Create(backup *v1.Backup) (result *v1.Backup, err error) {
result = &v1.Backup{}
err = c.client.Post().
Namespace(c.ns).
Resource("backups").
Body(backup).
Do().
Into(result)
return
}
// Update takes the representation of a backup and updates it. Returns the server's representation of the backup, and an error, if there is any.
func (c *backups) Update(backup *v1.Backup) (result *v1.Backup, err error) {
result = &v1.Backup{}
err = c.client.Put().
Namespace(c.ns).
Resource("backups").
Name(backup.Name).
Body(backup).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *backups) UpdateStatus(backup *v1.Backup) (result *v1.Backup, err error) {
result = &v1.Backup{}
err = c.client.Put().
Namespace(c.ns).
Resource("backups").
Name(backup.Name).
SubResource("status").
Body(backup).
Do().
Into(result)
return
}
// Delete takes name of the backup and deletes it. Returns an error if one occurs.
func (c *backups) Delete(name string, options *meta_v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("backups").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *backups) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("backups").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the backup, and returns the corresponding backup object, and an error if there is any.
func (c *backups) Get(name string, options meta_v1.GetOptions) (result *v1.Backup, err error) {
result = &v1.Backup{}
err = c.client.Get().
Namespace(c.ns).
Resource("backups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Backups that match those selectors.
func (c *backups) List(opts meta_v1.ListOptions) (result *v1.BackupList, err error) {
result = &v1.BackupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("backups").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested backups.
func (c *backups) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("backups").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched backup.
func (c *backups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Backup, err error) {
result = &v1.Backup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("backups").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
@@ -0,0 +1,139 @@
package v1
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
scheme "github.com/heptio/ark/pkg/generated/clientset/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"
)
// ConfigsGetter has a method to return a ConfigInterface.
// A group's client should implement this interface.
type ConfigsGetter interface {
Configs(namespace string) ConfigInterface
}
// ConfigInterface has methods to work with Config resources.
type ConfigInterface interface {
Create(*v1.Config) (*v1.Config, error)
Update(*v1.Config) (*v1.Config, 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.Config, error)
List(opts meta_v1.ListOptions) (*v1.ConfigList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Config, err error)
ConfigExpansion
}
// configs implements ConfigInterface
type configs struct {
client rest.Interface
ns string
}
// newConfigs returns a Configs
func newConfigs(c *ArkV1Client, namespace string) *configs {
return &configs{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a config and creates it. Returns the server's representation of the config, and an error, if there is any.
func (c *configs) Create(config *v1.Config) (result *v1.Config, err error) {
result = &v1.Config{}
err = c.client.Post().
Namespace(c.ns).
Resource("configs").
Body(config).
Do().
Into(result)
return
}
// Update takes the representation of a config and updates it. Returns the server's representation of the config, and an error, if there is any.
func (c *configs) Update(config *v1.Config) (result *v1.Config, err error) {
result = &v1.Config{}
err = c.client.Put().
Namespace(c.ns).
Resource("configs").
Name(config.Name).
Body(config).
Do().
Into(result)
return
}
// Delete takes name of the config and deletes it. Returns an error if one occurs.
func (c *configs) Delete(name string, options *meta_v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("configs").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *configs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("configs").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the config, and returns the corresponding config object, and an error if there is any.
func (c *configs) Get(name string, options meta_v1.GetOptions) (result *v1.Config, err error) {
result = &v1.Config{}
err = c.client.Get().
Namespace(c.ns).
Resource("configs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Configs that match those selectors.
func (c *configs) List(opts meta_v1.ListOptions) (result *v1.ConfigList, err error) {
result = &v1.ConfigList{}
err = c.client.Get().
Namespace(c.ns).
Resource("configs").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested configs.
func (c *configs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("configs").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched config.
func (c *configs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Config, err error) {
result = &v1.Config{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("configs").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
@@ -0,0 +1,4 @@
// This package is generated by client-gen with custom arguments.
// This package has the automatically generated typed clients.
package v1
@@ -0,0 +1,4 @@
// This package is generated by client-gen with custom arguments.
// Package fake has the automatically generated clients.
package fake
@@ -0,0 +1,34 @@
package fake
import (
v1 "github.com/heptio/ark/pkg/generated/clientset/typed/ark/v1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeArkV1 struct {
*testing.Fake
}
func (c *FakeArkV1) Backups(namespace string) v1.BackupInterface {
return &FakeBackups{c, namespace}
}
func (c *FakeArkV1) Configs(namespace string) v1.ConfigInterface {
return &FakeConfigs{c, namespace}
}
func (c *FakeArkV1) Restores(namespace string) v1.RestoreInterface {
return &FakeRestores{c, namespace}
}
func (c *FakeArkV1) Schedules(namespace string) v1.ScheduleInterface {
return &FakeSchedules{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeArkV1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}
@@ -0,0 +1,114 @@
package fake
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
meta_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"
)
// FakeBackups implements BackupInterface
type FakeBackups struct {
Fake *FakeArkV1
ns string
}
var backupsResource = schema.GroupVersionResource{Group: "ark.heptio.com", Version: "v1", Resource: "backups"}
var backupsKind = schema.GroupVersionKind{Group: "ark.heptio.com", Version: "v1", Kind: "Backup"}
func (c *FakeBackups) Create(backup *v1.Backup) (result *v1.Backup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(backupsResource, c.ns, backup), &v1.Backup{})
if obj == nil {
return nil, err
}
return obj.(*v1.Backup), err
}
func (c *FakeBackups) Update(backup *v1.Backup) (result *v1.Backup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(backupsResource, c.ns, backup), &v1.Backup{})
if obj == nil {
return nil, err
}
return obj.(*v1.Backup), err
}
func (c *FakeBackups) UpdateStatus(backup *v1.Backup) (*v1.Backup, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(backupsResource, "status", c.ns, backup), &v1.Backup{})
if obj == nil {
return nil, err
}
return obj.(*v1.Backup), err
}
func (c *FakeBackups) Delete(name string, options *meta_v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(backupsResource, c.ns, name), &v1.Backup{})
return err
}
func (c *FakeBackups) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(backupsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1.BackupList{})
return err
}
func (c *FakeBackups) Get(name string, options meta_v1.GetOptions) (result *v1.Backup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(backupsResource, c.ns, name), &v1.Backup{})
if obj == nil {
return nil, err
}
return obj.(*v1.Backup), err
}
func (c *FakeBackups) List(opts meta_v1.ListOptions) (result *v1.BackupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(backupsResource, backupsKind, c.ns, opts), &v1.BackupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.BackupList{}
for _, item := range obj.(*v1.BackupList).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 backups.
func (c *FakeBackups) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(backupsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched backup.
func (c *FakeBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Backup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(backupsResource, c.ns, name, data, subresources...), &v1.Backup{})
if obj == nil {
return nil, err
}
return obj.(*v1.Backup), err
}
@@ -0,0 +1,104 @@
package fake
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
meta_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"
)
// FakeConfigs implements ConfigInterface
type FakeConfigs struct {
Fake *FakeArkV1
ns string
}
var configsResource = schema.GroupVersionResource{Group: "ark.heptio.com", Version: "v1", Resource: "configs"}
var configsKind = schema.GroupVersionKind{Group: "ark.heptio.com", Version: "v1", Kind: "Config"}
func (c *FakeConfigs) Create(config *v1.Config) (result *v1.Config, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(configsResource, c.ns, config), &v1.Config{})
if obj == nil {
return nil, err
}
return obj.(*v1.Config), err
}
func (c *FakeConfigs) Update(config *v1.Config) (result *v1.Config, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(configsResource, c.ns, config), &v1.Config{})
if obj == nil {
return nil, err
}
return obj.(*v1.Config), err
}
func (c *FakeConfigs) Delete(name string, options *meta_v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(configsResource, c.ns, name), &v1.Config{})
return err
}
func (c *FakeConfigs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(configsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1.ConfigList{})
return err
}
func (c *FakeConfigs) Get(name string, options meta_v1.GetOptions) (result *v1.Config, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(configsResource, c.ns, name), &v1.Config{})
if obj == nil {
return nil, err
}
return obj.(*v1.Config), err
}
func (c *FakeConfigs) List(opts meta_v1.ListOptions) (result *v1.ConfigList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(configsResource, configsKind, c.ns, opts), &v1.ConfigList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ConfigList{}
for _, item := range obj.(*v1.ConfigList).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 configs.
func (c *FakeConfigs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(configsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched config.
func (c *FakeConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Config, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(configsResource, c.ns, name, data, subresources...), &v1.Config{})
if obj == nil {
return nil, err
}
return obj.(*v1.Config), err
}
@@ -0,0 +1,114 @@
package fake
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
meta_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"
)
// FakeRestores implements RestoreInterface
type FakeRestores struct {
Fake *FakeArkV1
ns string
}
var restoresResource = schema.GroupVersionResource{Group: "ark.heptio.com", Version: "v1", Resource: "restores"}
var restoresKind = schema.GroupVersionKind{Group: "ark.heptio.com", Version: "v1", Kind: "Restore"}
func (c *FakeRestores) Create(restore *v1.Restore) (result *v1.Restore, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(restoresResource, c.ns, restore), &v1.Restore{})
if obj == nil {
return nil, err
}
return obj.(*v1.Restore), err
}
func (c *FakeRestores) Update(restore *v1.Restore) (result *v1.Restore, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(restoresResource, c.ns, restore), &v1.Restore{})
if obj == nil {
return nil, err
}
return obj.(*v1.Restore), err
}
func (c *FakeRestores) UpdateStatus(restore *v1.Restore) (*v1.Restore, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(restoresResource, "status", c.ns, restore), &v1.Restore{})
if obj == nil {
return nil, err
}
return obj.(*v1.Restore), err
}
func (c *FakeRestores) Delete(name string, options *meta_v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(restoresResource, c.ns, name), &v1.Restore{})
return err
}
func (c *FakeRestores) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(restoresResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1.RestoreList{})
return err
}
func (c *FakeRestores) Get(name string, options meta_v1.GetOptions) (result *v1.Restore, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(restoresResource, c.ns, name), &v1.Restore{})
if obj == nil {
return nil, err
}
return obj.(*v1.Restore), err
}
func (c *FakeRestores) List(opts meta_v1.ListOptions) (result *v1.RestoreList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(restoresResource, restoresKind, c.ns, opts), &v1.RestoreList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.RestoreList{}
for _, item := range obj.(*v1.RestoreList).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 restores.
func (c *FakeRestores) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(restoresResource, c.ns, opts))
}
// Patch applies the patch and returns the patched restore.
func (c *FakeRestores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Restore, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(restoresResource, c.ns, name, data, subresources...), &v1.Restore{})
if obj == nil {
return nil, err
}
return obj.(*v1.Restore), err
}
@@ -0,0 +1,114 @@
package fake
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
meta_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"
)
// FakeSchedules implements ScheduleInterface
type FakeSchedules struct {
Fake *FakeArkV1
ns string
}
var schedulesResource = schema.GroupVersionResource{Group: "ark.heptio.com", Version: "v1", Resource: "schedules"}
var schedulesKind = schema.GroupVersionKind{Group: "ark.heptio.com", Version: "v1", Kind: "Schedule"}
func (c *FakeSchedules) Create(schedule *v1.Schedule) (result *v1.Schedule, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(schedulesResource, c.ns, schedule), &v1.Schedule{})
if obj == nil {
return nil, err
}
return obj.(*v1.Schedule), err
}
func (c *FakeSchedules) Update(schedule *v1.Schedule) (result *v1.Schedule, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(schedulesResource, c.ns, schedule), &v1.Schedule{})
if obj == nil {
return nil, err
}
return obj.(*v1.Schedule), err
}
func (c *FakeSchedules) UpdateStatus(schedule *v1.Schedule) (*v1.Schedule, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(schedulesResource, "status", c.ns, schedule), &v1.Schedule{})
if obj == nil {
return nil, err
}
return obj.(*v1.Schedule), err
}
func (c *FakeSchedules) Delete(name string, options *meta_v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(schedulesResource, c.ns, name), &v1.Schedule{})
return err
}
func (c *FakeSchedules) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(schedulesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1.ScheduleList{})
return err
}
func (c *FakeSchedules) Get(name string, options meta_v1.GetOptions) (result *v1.Schedule, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(schedulesResource, c.ns, name), &v1.Schedule{})
if obj == nil {
return nil, err
}
return obj.(*v1.Schedule), err
}
func (c *FakeSchedules) List(opts meta_v1.ListOptions) (result *v1.ScheduleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(schedulesResource, schedulesKind, c.ns, opts), &v1.ScheduleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.ScheduleList{}
for _, item := range obj.(*v1.ScheduleList).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 schedules.
func (c *FakeSchedules) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(schedulesResource, c.ns, opts))
}
// Patch applies the patch and returns the patched schedule.
func (c *FakeSchedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Schedule, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(schedulesResource, c.ns, name, data, subresources...), &v1.Schedule{})
if obj == nil {
return nil, err
}
return obj.(*v1.Schedule), err
}
@@ -0,0 +1,9 @@
package v1
type BackupExpansion interface{}
type ConfigExpansion interface{}
type RestoreExpansion interface{}
type ScheduleExpansion interface{}
@@ -0,0 +1,156 @@
package v1
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
scheme "github.com/heptio/ark/pkg/generated/clientset/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"
)
// RestoresGetter has a method to return a RestoreInterface.
// A group's client should implement this interface.
type RestoresGetter interface {
Restores(namespace string) RestoreInterface
}
// RestoreInterface has methods to work with Restore resources.
type RestoreInterface interface {
Create(*v1.Restore) (*v1.Restore, error)
Update(*v1.Restore) (*v1.Restore, error)
UpdateStatus(*v1.Restore) (*v1.Restore, 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.Restore, error)
List(opts meta_v1.ListOptions) (*v1.RestoreList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Restore, err error)
RestoreExpansion
}
// restores implements RestoreInterface
type restores struct {
client rest.Interface
ns string
}
// newRestores returns a Restores
func newRestores(c *ArkV1Client, namespace string) *restores {
return &restores{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a restore and creates it. Returns the server's representation of the restore, and an error, if there is any.
func (c *restores) Create(restore *v1.Restore) (result *v1.Restore, err error) {
result = &v1.Restore{}
err = c.client.Post().
Namespace(c.ns).
Resource("restores").
Body(restore).
Do().
Into(result)
return
}
// Update takes the representation of a restore and updates it. Returns the server's representation of the restore, and an error, if there is any.
func (c *restores) Update(restore *v1.Restore) (result *v1.Restore, err error) {
result = &v1.Restore{}
err = c.client.Put().
Namespace(c.ns).
Resource("restores").
Name(restore.Name).
Body(restore).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *restores) UpdateStatus(restore *v1.Restore) (result *v1.Restore, err error) {
result = &v1.Restore{}
err = c.client.Put().
Namespace(c.ns).
Resource("restores").
Name(restore.Name).
SubResource("status").
Body(restore).
Do().
Into(result)
return
}
// Delete takes name of the restore and deletes it. Returns an error if one occurs.
func (c *restores) Delete(name string, options *meta_v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("restores").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *restores) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("restores").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the restore, and returns the corresponding restore object, and an error if there is any.
func (c *restores) Get(name string, options meta_v1.GetOptions) (result *v1.Restore, err error) {
result = &v1.Restore{}
err = c.client.Get().
Namespace(c.ns).
Resource("restores").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Restores that match those selectors.
func (c *restores) List(opts meta_v1.ListOptions) (result *v1.RestoreList, err error) {
result = &v1.RestoreList{}
err = c.client.Get().
Namespace(c.ns).
Resource("restores").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested restores.
func (c *restores) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("restores").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched restore.
func (c *restores) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Restore, err error) {
result = &v1.Restore{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("restores").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
@@ -0,0 +1,156 @@
package v1
import (
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
scheme "github.com/heptio/ark/pkg/generated/clientset/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"
)
// SchedulesGetter has a method to return a ScheduleInterface.
// A group's client should implement this interface.
type SchedulesGetter interface {
Schedules(namespace string) ScheduleInterface
}
// ScheduleInterface has methods to work with Schedule resources.
type ScheduleInterface interface {
Create(*v1.Schedule) (*v1.Schedule, error)
Update(*v1.Schedule) (*v1.Schedule, error)
UpdateStatus(*v1.Schedule) (*v1.Schedule, 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.Schedule, error)
List(opts meta_v1.ListOptions) (*v1.ScheduleList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Schedule, err error)
ScheduleExpansion
}
// schedules implements ScheduleInterface
type schedules struct {
client rest.Interface
ns string
}
// newSchedules returns a Schedules
func newSchedules(c *ArkV1Client, namespace string) *schedules {
return &schedules{
client: c.RESTClient(),
ns: namespace,
}
}
// Create takes the representation of a schedule and creates it. Returns the server's representation of the schedule, and an error, if there is any.
func (c *schedules) Create(schedule *v1.Schedule) (result *v1.Schedule, err error) {
result = &v1.Schedule{}
err = c.client.Post().
Namespace(c.ns).
Resource("schedules").
Body(schedule).
Do().
Into(result)
return
}
// Update takes the representation of a schedule and updates it. Returns the server's representation of the schedule, and an error, if there is any.
func (c *schedules) Update(schedule *v1.Schedule) (result *v1.Schedule, err error) {
result = &v1.Schedule{}
err = c.client.Put().
Namespace(c.ns).
Resource("schedules").
Name(schedule.Name).
Body(schedule).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
func (c *schedules) UpdateStatus(schedule *v1.Schedule) (result *v1.Schedule, err error) {
result = &v1.Schedule{}
err = c.client.Put().
Namespace(c.ns).
Resource("schedules").
Name(schedule.Name).
SubResource("status").
Body(schedule).
Do().
Into(result)
return
}
// Delete takes name of the schedule and deletes it. Returns an error if one occurs.
func (c *schedules) Delete(name string, options *meta_v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("schedules").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *schedules) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("schedules").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the schedule, and returns the corresponding schedule object, and an error if there is any.
func (c *schedules) Get(name string, options meta_v1.GetOptions) (result *v1.Schedule, err error) {
result = &v1.Schedule{}
err = c.client.Get().
Namespace(c.ns).
Resource("schedules").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Schedules that match those selectors.
func (c *schedules) List(opts meta_v1.ListOptions) (result *v1.ScheduleList, err error) {
result = &v1.ScheduleList{}
err = c.client.Get().
Namespace(c.ns).
Resource("schedules").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested schedules.
func (c *schedules) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("schedules").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched schedule.
func (c *schedules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Schedule, err error) {
result = &v1.Schedule{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("schedules").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
@@ -0,0 +1,28 @@
// This file was automatically generated by informer-gen
package ark
import (
v1 "github.com/heptio/ark/pkg/generated/informers/externalversions/ark/v1"
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/externalversions/internalinterfaces"
)
// 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 {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &group{f}
}
// V1 returns a new v1.Interface.
func (g *group) V1() v1.Interface {
return v1.New(g.SharedInformerFactory)
}
@@ -0,0 +1,52 @@
// This file was automatically generated by informer-gen
package v1
import (
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
clientset "github.com/heptio/ark/pkg/generated/clientset"
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"
time "time"
)
// BackupInformer provides access to a shared informer and lister for
// Backups.
type BackupInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.BackupLister
}
type backupInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newBackupInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
return client.ArkV1().Backups(meta_v1.NamespaceAll).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
return client.ArkV1().Backups(meta_v1.NamespaceAll).Watch(options)
},
},
&ark_v1.Backup{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *backupInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&ark_v1.Backup{}, newBackupInformer)
}
func (f *backupInformer) Lister() v1.BackupLister {
return v1.NewBackupLister(f.Informer().GetIndexer())
}
@@ -0,0 +1,52 @@
// This file was automatically generated by informer-gen
package v1
import (
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
clientset "github.com/heptio/ark/pkg/generated/clientset"
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"
time "time"
)
// ConfigInformer provides access to a shared informer and lister for
// Configs.
type ConfigInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.ConfigLister
}
type configInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newConfigInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
return client.ArkV1().Configs(meta_v1.NamespaceAll).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
return client.ArkV1().Configs(meta_v1.NamespaceAll).Watch(options)
},
},
&ark_v1.Config{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *configInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&ark_v1.Config{}, newConfigInformer)
}
func (f *configInformer) Lister() v1.ConfigLister {
return v1.NewConfigLister(f.Informer().GetIndexer())
}
@@ -0,0 +1,48 @@
// This file was automatically generated by informer-gen
package v1
import (
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// Backups returns a BackupInformer.
Backups() BackupInformer
// Configs returns a ConfigInformer.
Configs() ConfigInformer
// Restores returns a RestoreInformer.
Restores() RestoreInformer
// Schedules returns a ScheduleInformer.
Schedules() ScheduleInformer
}
type version struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// Backups returns a BackupInformer.
func (v *version) Backups() BackupInformer {
return &backupInformer{factory: v.SharedInformerFactory}
}
// Configs returns a ConfigInformer.
func (v *version) Configs() ConfigInformer {
return &configInformer{factory: v.SharedInformerFactory}
}
// Restores returns a RestoreInformer.
func (v *version) Restores() RestoreInformer {
return &restoreInformer{factory: v.SharedInformerFactory}
}
// Schedules returns a ScheduleInformer.
func (v *version) Schedules() ScheduleInformer {
return &scheduleInformer{factory: v.SharedInformerFactory}
}
@@ -0,0 +1,52 @@
// This file was automatically generated by informer-gen
package v1
import (
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
clientset "github.com/heptio/ark/pkg/generated/clientset"
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"
time "time"
)
// RestoreInformer provides access to a shared informer and lister for
// Restores.
type RestoreInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.RestoreLister
}
type restoreInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newRestoreInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
return client.ArkV1().Restores(meta_v1.NamespaceAll).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
return client.ArkV1().Restores(meta_v1.NamespaceAll).Watch(options)
},
},
&ark_v1.Restore{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *restoreInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&ark_v1.Restore{}, newRestoreInformer)
}
func (f *restoreInformer) Lister() v1.RestoreLister {
return v1.NewRestoreLister(f.Informer().GetIndexer())
}
@@ -0,0 +1,52 @@
// This file was automatically generated by informer-gen
package v1
import (
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
clientset "github.com/heptio/ark/pkg/generated/clientset"
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"
time "time"
)
// ScheduleInformer provides access to a shared informer and lister for
// Schedules.
type ScheduleInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.ScheduleLister
}
type scheduleInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newScheduleInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
return client.ArkV1().Schedules(meta_v1.NamespaceAll).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
return client.ArkV1().Schedules(meta_v1.NamespaceAll).Watch(options)
},
},
&ark_v1.Schedule{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *scheduleInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&ark_v1.Schedule{}, newScheduleInformer)
}
func (f *scheduleInformer) Lister() v1.ScheduleLister {
return v1.NewScheduleLister(f.Informer().GetIndexer())
}
@@ -0,0 +1,102 @@
// This file was automatically generated by informer-gen
package externalversions
import (
clientset "github.com/heptio/ark/pkg/generated/clientset"
ark "github.com/heptio/ark/pkg/generated/informers/externalversions/ark"
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/externalversions/internalinterfaces"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
reflect "reflect"
sync "sync"
time "time"
)
type sharedInformerFactory struct {
client clientset.Interface
lock sync.Mutex
defaultResync 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
}
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory
func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory {
return &sharedInformerFactory{
client: client,
defaultResync: defaultResync,
informers: make(map[reflect.Type]cache.SharedIndexInformer),
startedInformers: make(map[reflect.Type]bool),
}
}
// 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
}
informer = newFunc(f.client, f.defaultResync)
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
Ark() ark.Interface
}
func (f *sharedInformerFactory) Ark() ark.Interface {
return ark.New(f)
}
@@ -0,0 +1,51 @@
// This file was automatically generated by informer-gen
package externalversions
import (
"fmt"
v1 "github.com/heptio/ark/pkg/apis/ark/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=Ark, Version=V1
case v1.SchemeGroupVersion.WithResource("backups"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Backups().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("configs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Configs().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("restores"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Restores().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("schedules"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Schedules().Informer()}, nil
}
return nil, fmt.Errorf("no informer found for %v", resource)
}
@@ -0,0 +1,18 @@
// This file was automatically generated by informer-gen
package internalinterfaces
import (
clientset "github.com/heptio/ark/pkg/generated/clientset"
runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache"
time "time"
)
type NewInformerFunc func(clientset.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
}
@@ -0,0 +1,95 @@
// This file was automatically generated by informer-gen
package internalversion
import (
clientset "github.com/heptio/ark/pkg/generated/clientset"
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/internalversion/internalinterfaces"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
reflect "reflect"
sync "sync"
time "time"
)
type sharedInformerFactory struct {
client clientset.Interface
lock sync.Mutex
defaultResync 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
}
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory
func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory {
return &sharedInformerFactory{
client: client,
defaultResync: defaultResync,
informers: make(map[reflect.Type]cache.SharedIndexInformer),
startedInformers: make(map[reflect.Type]bool),
}
}
// 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
}
informer = newFunc(f.client, f.defaultResync)
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
}
@@ -0,0 +1,40 @@
// This file was automatically generated by informer-gen
package internalversion
import (
"fmt"
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 {
}
return nil, fmt.Errorf("no informer found for %v", resource)
}
@@ -0,0 +1,18 @@
// This file was automatically generated by informer-gen
package internalinterfaces
import (
clientset "github.com/heptio/ark/pkg/generated/clientset"
runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache"
time "time"
)
type NewInformerFunc func(clientset.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
}
+78
View File
@@ -0,0 +1,78 @@
// This file was automatically generated by lister-gen
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"
)
// BackupLister helps list Backups.
type BackupLister interface {
// List lists all Backups in the indexer.
List(selector labels.Selector) (ret []*v1.Backup, err error)
// Backups returns an object that can list and get Backups.
Backups(namespace string) BackupNamespaceLister
BackupListerExpansion
}
// backupLister implements the BackupLister interface.
type backupLister struct {
indexer cache.Indexer
}
// NewBackupLister returns a new BackupLister.
func NewBackupLister(indexer cache.Indexer) BackupLister {
return &backupLister{indexer: indexer}
}
// List lists all Backups in the indexer.
func (s *backupLister) List(selector labels.Selector) (ret []*v1.Backup, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Backup))
})
return ret, err
}
// Backups returns an object that can list and get Backups.
func (s *backupLister) Backups(namespace string) BackupNamespaceLister {
return backupNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// BackupNamespaceLister helps list and get Backups.
type BackupNamespaceLister interface {
// List lists all Backups in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1.Backup, err error)
// Get retrieves the Backup from the indexer for a given namespace and name.
Get(name string) (*v1.Backup, error)
BackupNamespaceListerExpansion
}
// backupNamespaceLister implements the BackupNamespaceLister
// interface.
type backupNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Backups in the indexer for a given namespace.
func (s backupNamespaceLister) List(selector labels.Selector) (ret []*v1.Backup, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Backup))
})
return ret, err
}
// Get retrieves the Backup from the indexer for a given namespace and name.
func (s backupNamespaceLister) Get(name string) (*v1.Backup, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1.Resource("backup"), name)
}
return obj.(*v1.Backup), nil
}
+78
View File
@@ -0,0 +1,78 @@
// This file was automatically generated by lister-gen
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"
)
// ConfigLister helps list Configs.
type ConfigLister interface {
// List lists all Configs in the indexer.
List(selector labels.Selector) (ret []*v1.Config, err error)
// Configs returns an object that can list and get Configs.
Configs(namespace string) ConfigNamespaceLister
ConfigListerExpansion
}
// configLister implements the ConfigLister interface.
type configLister struct {
indexer cache.Indexer
}
// NewConfigLister returns a new ConfigLister.
func NewConfigLister(indexer cache.Indexer) ConfigLister {
return &configLister{indexer: indexer}
}
// List lists all Configs in the indexer.
func (s *configLister) List(selector labels.Selector) (ret []*v1.Config, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Config))
})
return ret, err
}
// Configs returns an object that can list and get Configs.
func (s *configLister) Configs(namespace string) ConfigNamespaceLister {
return configNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ConfigNamespaceLister helps list and get Configs.
type ConfigNamespaceLister interface {
// List lists all Configs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1.Config, err error)
// Get retrieves the Config from the indexer for a given namespace and name.
Get(name string) (*v1.Config, error)
ConfigNamespaceListerExpansion
}
// configNamespaceLister implements the ConfigNamespaceLister
// interface.
type configNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Configs in the indexer for a given namespace.
func (s configNamespaceLister) List(selector labels.Selector) (ret []*v1.Config, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Config))
})
return ret, err
}
// Get retrieves the Config from the indexer for a given namespace and name.
func (s configNamespaceLister) Get(name string) (*v1.Config, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1.Resource("config"), name)
}
return obj.(*v1.Config), nil
}
@@ -0,0 +1,35 @@
// This file was automatically generated by lister-gen
package v1
// BackupListerExpansion allows custom methods to be added to
// BackupLister.
type BackupListerExpansion interface{}
// BackupNamespaceListerExpansion allows custom methods to be added to
// BackupNamespaceLister.
type BackupNamespaceListerExpansion interface{}
// ConfigListerExpansion allows custom methods to be added to
// ConfigLister.
type ConfigListerExpansion interface{}
// ConfigNamespaceListerExpansion allows custom methods to be added to
// ConfigNamespaceLister.
type ConfigNamespaceListerExpansion interface{}
// RestoreListerExpansion allows custom methods to be added to
// RestoreLister.
type RestoreListerExpansion interface{}
// RestoreNamespaceListerExpansion allows custom methods to be added to
// RestoreNamespaceLister.
type RestoreNamespaceListerExpansion interface{}
// ScheduleListerExpansion allows custom methods to be added to
// ScheduleLister.
type ScheduleListerExpansion interface{}
// ScheduleNamespaceListerExpansion allows custom methods to be added to
// ScheduleNamespaceLister.
type ScheduleNamespaceListerExpansion interface{}
+78
View File
@@ -0,0 +1,78 @@
// This file was automatically generated by lister-gen
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"
)
// RestoreLister helps list Restores.
type RestoreLister interface {
// List lists all Restores in the indexer.
List(selector labels.Selector) (ret []*v1.Restore, err error)
// Restores returns an object that can list and get Restores.
Restores(namespace string) RestoreNamespaceLister
RestoreListerExpansion
}
// restoreLister implements the RestoreLister interface.
type restoreLister struct {
indexer cache.Indexer
}
// NewRestoreLister returns a new RestoreLister.
func NewRestoreLister(indexer cache.Indexer) RestoreLister {
return &restoreLister{indexer: indexer}
}
// List lists all Restores in the indexer.
func (s *restoreLister) List(selector labels.Selector) (ret []*v1.Restore, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Restore))
})
return ret, err
}
// Restores returns an object that can list and get Restores.
func (s *restoreLister) Restores(namespace string) RestoreNamespaceLister {
return restoreNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// RestoreNamespaceLister helps list and get Restores.
type RestoreNamespaceLister interface {
// List lists all Restores in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1.Restore, err error)
// Get retrieves the Restore from the indexer for a given namespace and name.
Get(name string) (*v1.Restore, error)
RestoreNamespaceListerExpansion
}
// restoreNamespaceLister implements the RestoreNamespaceLister
// interface.
type restoreNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Restores in the indexer for a given namespace.
func (s restoreNamespaceLister) List(selector labels.Selector) (ret []*v1.Restore, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Restore))
})
return ret, err
}
// Get retrieves the Restore from the indexer for a given namespace and name.
func (s restoreNamespaceLister) Get(name string) (*v1.Restore, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1.Resource("restore"), name)
}
return obj.(*v1.Restore), nil
}
+78
View File
@@ -0,0 +1,78 @@
// This file was automatically generated by lister-gen
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"
)
// ScheduleLister helps list Schedules.
type ScheduleLister interface {
// List lists all Schedules in the indexer.
List(selector labels.Selector) (ret []*v1.Schedule, err error)
// Schedules returns an object that can list and get Schedules.
Schedules(namespace string) ScheduleNamespaceLister
ScheduleListerExpansion
}
// scheduleLister implements the ScheduleLister interface.
type scheduleLister struct {
indexer cache.Indexer
}
// NewScheduleLister returns a new ScheduleLister.
func NewScheduleLister(indexer cache.Indexer) ScheduleLister {
return &scheduleLister{indexer: indexer}
}
// List lists all Schedules in the indexer.
func (s *scheduleLister) List(selector labels.Selector) (ret []*v1.Schedule, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Schedule))
})
return ret, err
}
// Schedules returns an object that can list and get Schedules.
func (s *scheduleLister) Schedules(namespace string) ScheduleNamespaceLister {
return scheduleNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ScheduleNamespaceLister helps list and get Schedules.
type ScheduleNamespaceLister interface {
// List lists all Schedules in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1.Schedule, err error)
// Get retrieves the Schedule from the indexer for a given namespace and name.
Get(name string) (*v1.Schedule, error)
ScheduleNamespaceListerExpansion
}
// scheduleNamespaceLister implements the ScheduleNamespaceLister
// interface.
type scheduleNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all Schedules in the indexer for a given namespace.
func (s scheduleNamespaceLister) List(selector labels.Selector) (ret []*v1.Schedule, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1.Schedule))
})
return ret, err
}
// Get retrieves the Schedule from the indexer for a given namespace and name.
func (s scheduleNamespaceLister) Get(name string) (*v1.Schedule, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1.Resource("schedule"), name)
}
return obj.(*v1.Schedule), nil
}