From a0afba4d18291b412621ae54ad80b1a8aea898c8 Mon Sep 17 00:00:00 2001 From: gitlawr Date: Mon, 17 Jun 2019 17:40:23 +0800 Subject: [PATCH] go generate --- .../zz_generated_destination_rule_mock.go | 1741 +++++++++++++++++ .../zz_generated_virtual_service_mock.go | 1741 +++++++++++++++++ .../v1alpha3/zz_generated_deepcopy.go | 72 + ...z_generated_destination_rule_controller.go | 506 +++++ ...ated_destination_rule_lifecycle_adapter.go | 63 + .../v1alpha3/zz_generated_k8s_client.go | 139 ++ .../v1alpha3/zz_generated_scheme.go | 42 + ...zz_generated_virtual_service_controller.go | 506 +++++ ...rated_virtual_service_lifecycle_adapter.go | 63 + client/project/v3/zz_generated_client.go | 4 + .../zz_generated_connection_pool_settings.go | 12 + .../v3/zz_generated_consistent_hash_lb.go | 16 + client/project/v3/zz_generated_cors_policy.go | 20 + client/project/v3/zz_generated_destination.go | 14 + .../v3/zz_generated_destination_rule.go | 117 ++ .../v3/zz_generated_destination_rule_spec.go | 14 + .../v3/zz_generated_header_operations.go | 14 + client/project/v3/zz_generated_headers.go | 12 + client/project/v3/zz_generated_http_cookie.go | 14 + .../v3/zz_generated_http_fault_injection.go | 12 + .../v3/zz_generated_http_match_request.go | 24 + .../project/v3/zz_generated_http_redirect.go | 12 + client/project/v3/zz_generated_http_retry.go | 12 + .../project/v3/zz_generated_http_rewrite.go | 12 + client/project/v3/zz_generated_http_route.go | 34 + .../v3/zz_generated_http_route_destination.go | 14 + .../project/v3/zz_generated_http_settings.go | 16 + .../project/v3/zz_generated_inject_abort.go | 12 + .../project/v3/zz_generated_inject_delay.go | 14 + .../v3/zz_generated_l4match_attributes.go | 16 + .../v3/zz_generated_load_balancer_settings.go | 12 + .../v3/zz_generated_outlier_detection.go | 16 + .../project/v3/zz_generated_port_selector.go | 12 + .../v3/zz_generated_port_traffic_policy.go | 18 + .../project/v3/zz_generated_string_match.go | 16 + client/project/v3/zz_generated_subset.go | 14 + client/project/v3/zz_generated_tcp_route.go | 12 + .../project/v3/zz_generated_tcp_settings.go | 12 + .../v3/zz_generated_tls_match_attributes.go | 18 + client/project/v3/zz_generated_tls_route.go | 12 + .../project/v3/zz_generated_tls_settings.go | 20 + .../project/v3/zz_generated_traffic_policy.go | 18 + .../v3/zz_generated_virtual_service.go | 121 ++ .../v3/zz_generated_virtual_service_spec.go | 18 + compose/zz_generated_compose.go | 2 + 45 files changed, 5609 insertions(+) create mode 100644 apis/networking.istio.io/v1alpha3/fakes/zz_generated_destination_rule_mock.go create mode 100644 apis/networking.istio.io/v1alpha3/fakes/zz_generated_virtual_service_mock.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_deepcopy.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_controller.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_lifecycle_adapter.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_k8s_client.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_scheme.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_controller.go create mode 100644 apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_lifecycle_adapter.go create mode 100644 client/project/v3/zz_generated_connection_pool_settings.go create mode 100644 client/project/v3/zz_generated_consistent_hash_lb.go create mode 100644 client/project/v3/zz_generated_cors_policy.go create mode 100644 client/project/v3/zz_generated_destination.go create mode 100644 client/project/v3/zz_generated_destination_rule.go create mode 100644 client/project/v3/zz_generated_destination_rule_spec.go create mode 100644 client/project/v3/zz_generated_header_operations.go create mode 100644 client/project/v3/zz_generated_headers.go create mode 100644 client/project/v3/zz_generated_http_cookie.go create mode 100644 client/project/v3/zz_generated_http_fault_injection.go create mode 100644 client/project/v3/zz_generated_http_match_request.go create mode 100644 client/project/v3/zz_generated_http_redirect.go create mode 100644 client/project/v3/zz_generated_http_retry.go create mode 100644 client/project/v3/zz_generated_http_rewrite.go create mode 100644 client/project/v3/zz_generated_http_route.go create mode 100644 client/project/v3/zz_generated_http_route_destination.go create mode 100644 client/project/v3/zz_generated_http_settings.go create mode 100644 client/project/v3/zz_generated_inject_abort.go create mode 100644 client/project/v3/zz_generated_inject_delay.go create mode 100644 client/project/v3/zz_generated_l4match_attributes.go create mode 100644 client/project/v3/zz_generated_load_balancer_settings.go create mode 100644 client/project/v3/zz_generated_outlier_detection.go create mode 100644 client/project/v3/zz_generated_port_selector.go create mode 100644 client/project/v3/zz_generated_port_traffic_policy.go create mode 100644 client/project/v3/zz_generated_string_match.go create mode 100644 client/project/v3/zz_generated_subset.go create mode 100644 client/project/v3/zz_generated_tcp_route.go create mode 100644 client/project/v3/zz_generated_tcp_settings.go create mode 100644 client/project/v3/zz_generated_tls_match_attributes.go create mode 100644 client/project/v3/zz_generated_tls_route.go create mode 100644 client/project/v3/zz_generated_tls_settings.go create mode 100644 client/project/v3/zz_generated_traffic_policy.go create mode 100644 client/project/v3/zz_generated_virtual_service.go create mode 100644 client/project/v3/zz_generated_virtual_service_spec.go diff --git a/apis/networking.istio.io/v1alpha3/fakes/zz_generated_destination_rule_mock.go b/apis/networking.istio.io/v1alpha3/fakes/zz_generated_destination_rule_mock.go new file mode 100644 index 00000000..5b801c79 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/fakes/zz_generated_destination_rule_mock.go @@ -0,0 +1,1741 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package fakes + +import ( + context "context" + sync "sync" + + v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" + controller "github.com/rancher/norman/controller" + objectclient "github.com/rancher/norman/objectclient" + v1alpha3a "github.com/rancher/types/apis/networking.istio.io/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +var ( + lockDestinationRuleListerMockGet sync.RWMutex + lockDestinationRuleListerMockList sync.RWMutex +) + +// Ensure, that DestinationRuleListerMock does implement DestinationRuleLister. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.DestinationRuleLister = &DestinationRuleListerMock{} + +// DestinationRuleListerMock is a mock implementation of DestinationRuleLister. +// +// func TestSomethingThatUsesDestinationRuleLister(t *testing.T) { +// +// // make and configure a mocked DestinationRuleLister +// mockedDestinationRuleLister := &DestinationRuleListerMock{ +// GetFunc: func(namespace string, name string) (*v1alpha3.DestinationRule, error) { +// panic("mock out the Get method") +// }, +// ListFunc: func(namespace string, selector labels.Selector) ([]*v1alpha3.DestinationRule, error) { +// panic("mock out the List method") +// }, +// } +// +// // use mockedDestinationRuleLister in code that requires DestinationRuleLister +// // and then make assertions. +// +// } +type DestinationRuleListerMock struct { + // GetFunc mocks the Get method. + GetFunc func(namespace string, name string) (*v1alpha3.DestinationRule, error) + + // ListFunc mocks the List method. + ListFunc func(namespace string, selector labels.Selector) ([]*v1alpha3.DestinationRule, error) + + // calls tracks calls to the methods. + calls struct { + // Get holds details about calls to the Get method. + Get []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + } + // List holds details about calls to the List method. + List []struct { + // Namespace is the namespace argument value. + Namespace string + // Selector is the selector argument value. + Selector labels.Selector + } + } +} + +// Get calls GetFunc. +func (mock *DestinationRuleListerMock) Get(namespace string, name string) (*v1alpha3.DestinationRule, error) { + if mock.GetFunc == nil { + panic("DestinationRuleListerMock.GetFunc: method is nil but DestinationRuleLister.Get was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockDestinationRuleListerMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockDestinationRuleListerMockGet.Unlock() + return mock.GetFunc(namespace, name) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedDestinationRuleLister.GetCalls()) +func (mock *DestinationRuleListerMock) GetCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockDestinationRuleListerMockGet.RLock() + calls = mock.calls.Get + lockDestinationRuleListerMockGet.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *DestinationRuleListerMock) List(namespace string, selector labels.Selector) ([]*v1alpha3.DestinationRule, error) { + if mock.ListFunc == nil { + panic("DestinationRuleListerMock.ListFunc: method is nil but DestinationRuleLister.List was just called") + } + callInfo := struct { + Namespace string + Selector labels.Selector + }{ + Namespace: namespace, + Selector: selector, + } + lockDestinationRuleListerMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockDestinationRuleListerMockList.Unlock() + return mock.ListFunc(namespace, selector) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedDestinationRuleLister.ListCalls()) +func (mock *DestinationRuleListerMock) ListCalls() []struct { + Namespace string + Selector labels.Selector +} { + var calls []struct { + Namespace string + Selector labels.Selector + } + lockDestinationRuleListerMockList.RLock() + calls = mock.calls.List + lockDestinationRuleListerMockList.RUnlock() + return calls +} + +var ( + lockDestinationRuleControllerMockAddClusterScopedFeatureHandler sync.RWMutex + lockDestinationRuleControllerMockAddClusterScopedHandler sync.RWMutex + lockDestinationRuleControllerMockAddFeatureHandler sync.RWMutex + lockDestinationRuleControllerMockAddHandler sync.RWMutex + lockDestinationRuleControllerMockEnqueue sync.RWMutex + lockDestinationRuleControllerMockGeneric sync.RWMutex + lockDestinationRuleControllerMockInformer sync.RWMutex + lockDestinationRuleControllerMockLister sync.RWMutex + lockDestinationRuleControllerMockStart sync.RWMutex + lockDestinationRuleControllerMockSync sync.RWMutex +) + +// Ensure, that DestinationRuleControllerMock does implement DestinationRuleController. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.DestinationRuleController = &DestinationRuleControllerMock{} + +// DestinationRuleControllerMock is a mock implementation of DestinationRuleController. +// +// func TestSomethingThatUsesDestinationRuleController(t *testing.T) { +// +// // make and configure a mocked DestinationRuleController +// mockedDestinationRuleController := &DestinationRuleControllerMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, handler v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// EnqueueFunc: func(namespace string, name string) { +// panic("mock out the Enqueue method") +// }, +// GenericFunc: func() controller.GenericController { +// panic("mock out the Generic method") +// }, +// InformerFunc: func() cache.SharedIndexInformer { +// panic("mock out the Informer method") +// }, +// ListerFunc: func() v1alpha3a.DestinationRuleLister { +// panic("mock out the Lister method") +// }, +// StartFunc: func(ctx context.Context, threadiness int) error { +// panic("mock out the Start method") +// }, +// SyncFunc: func(ctx context.Context) error { +// panic("mock out the Sync method") +// }, +// } +// +// // use mockedDestinationRuleController in code that requires DestinationRuleController +// // and then make assertions. +// +// } +type DestinationRuleControllerMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1alpha3a.DestinationRuleHandlerFunc) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v1alpha3a.DestinationRuleHandlerFunc) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.DestinationRuleHandlerFunc) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, handler v1alpha3a.DestinationRuleHandlerFunc) + + // EnqueueFunc mocks the Enqueue method. + EnqueueFunc func(namespace string, name string) + + // GenericFunc mocks the Generic method. + GenericFunc func() controller.GenericController + + // InformerFunc mocks the Informer method. + InformerFunc func() cache.SharedIndexInformer + + // ListerFunc mocks the Lister method. + ListerFunc func() v1alpha3a.DestinationRuleLister + + // StartFunc mocks the Start method. + StartFunc func(ctx context.Context, threadiness int) error + + // SyncFunc mocks the Sync method. + SyncFunc func(ctx context.Context) error + + // calls tracks calls to the methods. + calls struct { + // AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Handler is the handler argument value. + Handler v1alpha3a.DestinationRuleHandlerFunc + } + // AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method. + AddClusterScopedHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Handler is the handler argument value. + Handler v1alpha3a.DestinationRuleHandlerFunc + } + // AddFeatureHandler holds details about calls to the AddFeatureHandler method. + AddFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1alpha3a.DestinationRuleHandlerFunc + } + // AddHandler holds details about calls to the AddHandler method. + AddHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Handler is the handler argument value. + Handler v1alpha3a.DestinationRuleHandlerFunc + } + // Enqueue holds details about calls to the Enqueue method. + Enqueue []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + } + // Generic holds details about calls to the Generic method. + Generic []struct { + } + // Informer holds details about calls to the Informer method. + Informer []struct { + } + // Lister holds details about calls to the Lister method. + Lister []struct { + } + // Start holds details about calls to the Start method. + Start []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Threadiness is the threadiness argument value. + Threadiness int + } + // Sync holds details about calls to the Sync method. + Sync []struct { + // Ctx is the ctx argument value. + Ctx context.Context + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *DestinationRuleControllerMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("DestinationRuleControllerMock.AddClusterScopedFeatureHandlerFunc: method is nil but DestinationRuleController.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockDestinationRuleControllerMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockDestinationRuleControllerMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, handler) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedDestinationRuleController.AddClusterScopedFeatureHandlerCalls()) +func (mock *DestinationRuleControllerMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleControllerMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockDestinationRuleControllerMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *DestinationRuleControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("DestinationRuleControllerMock.AddClusterScopedHandlerFunc: method is nil but DestinationRuleController.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Handler v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockDestinationRuleControllerMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockDestinationRuleControllerMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, handler) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedDestinationRuleController.AddClusterScopedHandlerCalls()) +func (mock *DestinationRuleControllerMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Handler v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Handler v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleControllerMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockDestinationRuleControllerMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *DestinationRuleControllerMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("DestinationRuleControllerMock.AddFeatureHandlerFunc: method is nil but DestinationRuleController.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockDestinationRuleControllerMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockDestinationRuleControllerMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedDestinationRuleController.AddFeatureHandlerCalls()) +func (mock *DestinationRuleControllerMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleControllerMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockDestinationRuleControllerMockAddFeatureHandler.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *DestinationRuleControllerMock) AddHandler(ctx context.Context, name string, handler v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("DestinationRuleControllerMock.AddHandlerFunc: method is nil but DestinationRuleController.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Handler v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Name: name, + Handler: handler, + } + lockDestinationRuleControllerMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockDestinationRuleControllerMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, handler) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedDestinationRuleController.AddHandlerCalls()) +func (mock *DestinationRuleControllerMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Handler v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Handler v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleControllerMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockDestinationRuleControllerMockAddHandler.RUnlock() + return calls +} + +// Enqueue calls EnqueueFunc. +func (mock *DestinationRuleControllerMock) Enqueue(namespace string, name string) { + if mock.EnqueueFunc == nil { + panic("DestinationRuleControllerMock.EnqueueFunc: method is nil but DestinationRuleController.Enqueue was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockDestinationRuleControllerMockEnqueue.Lock() + mock.calls.Enqueue = append(mock.calls.Enqueue, callInfo) + lockDestinationRuleControllerMockEnqueue.Unlock() + mock.EnqueueFunc(namespace, name) +} + +// EnqueueCalls gets all the calls that were made to Enqueue. +// Check the length with: +// len(mockedDestinationRuleController.EnqueueCalls()) +func (mock *DestinationRuleControllerMock) EnqueueCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockDestinationRuleControllerMockEnqueue.RLock() + calls = mock.calls.Enqueue + lockDestinationRuleControllerMockEnqueue.RUnlock() + return calls +} + +// Generic calls GenericFunc. +func (mock *DestinationRuleControllerMock) Generic() controller.GenericController { + if mock.GenericFunc == nil { + panic("DestinationRuleControllerMock.GenericFunc: method is nil but DestinationRuleController.Generic was just called") + } + callInfo := struct { + }{} + lockDestinationRuleControllerMockGeneric.Lock() + mock.calls.Generic = append(mock.calls.Generic, callInfo) + lockDestinationRuleControllerMockGeneric.Unlock() + return mock.GenericFunc() +} + +// GenericCalls gets all the calls that were made to Generic. +// Check the length with: +// len(mockedDestinationRuleController.GenericCalls()) +func (mock *DestinationRuleControllerMock) GenericCalls() []struct { +} { + var calls []struct { + } + lockDestinationRuleControllerMockGeneric.RLock() + calls = mock.calls.Generic + lockDestinationRuleControllerMockGeneric.RUnlock() + return calls +} + +// Informer calls InformerFunc. +func (mock *DestinationRuleControllerMock) Informer() cache.SharedIndexInformer { + if mock.InformerFunc == nil { + panic("DestinationRuleControllerMock.InformerFunc: method is nil but DestinationRuleController.Informer was just called") + } + callInfo := struct { + }{} + lockDestinationRuleControllerMockInformer.Lock() + mock.calls.Informer = append(mock.calls.Informer, callInfo) + lockDestinationRuleControllerMockInformer.Unlock() + return mock.InformerFunc() +} + +// InformerCalls gets all the calls that were made to Informer. +// Check the length with: +// len(mockedDestinationRuleController.InformerCalls()) +func (mock *DestinationRuleControllerMock) InformerCalls() []struct { +} { + var calls []struct { + } + lockDestinationRuleControllerMockInformer.RLock() + calls = mock.calls.Informer + lockDestinationRuleControllerMockInformer.RUnlock() + return calls +} + +// Lister calls ListerFunc. +func (mock *DestinationRuleControllerMock) Lister() v1alpha3a.DestinationRuleLister { + if mock.ListerFunc == nil { + panic("DestinationRuleControllerMock.ListerFunc: method is nil but DestinationRuleController.Lister was just called") + } + callInfo := struct { + }{} + lockDestinationRuleControllerMockLister.Lock() + mock.calls.Lister = append(mock.calls.Lister, callInfo) + lockDestinationRuleControllerMockLister.Unlock() + return mock.ListerFunc() +} + +// ListerCalls gets all the calls that were made to Lister. +// Check the length with: +// len(mockedDestinationRuleController.ListerCalls()) +func (mock *DestinationRuleControllerMock) ListerCalls() []struct { +} { + var calls []struct { + } + lockDestinationRuleControllerMockLister.RLock() + calls = mock.calls.Lister + lockDestinationRuleControllerMockLister.RUnlock() + return calls +} + +// Start calls StartFunc. +func (mock *DestinationRuleControllerMock) Start(ctx context.Context, threadiness int) error { + if mock.StartFunc == nil { + panic("DestinationRuleControllerMock.StartFunc: method is nil but DestinationRuleController.Start was just called") + } + callInfo := struct { + Ctx context.Context + Threadiness int + }{ + Ctx: ctx, + Threadiness: threadiness, + } + lockDestinationRuleControllerMockStart.Lock() + mock.calls.Start = append(mock.calls.Start, callInfo) + lockDestinationRuleControllerMockStart.Unlock() + return mock.StartFunc(ctx, threadiness) +} + +// StartCalls gets all the calls that were made to Start. +// Check the length with: +// len(mockedDestinationRuleController.StartCalls()) +func (mock *DestinationRuleControllerMock) StartCalls() []struct { + Ctx context.Context + Threadiness int +} { + var calls []struct { + Ctx context.Context + Threadiness int + } + lockDestinationRuleControllerMockStart.RLock() + calls = mock.calls.Start + lockDestinationRuleControllerMockStart.RUnlock() + return calls +} + +// Sync calls SyncFunc. +func (mock *DestinationRuleControllerMock) Sync(ctx context.Context) error { + if mock.SyncFunc == nil { + panic("DestinationRuleControllerMock.SyncFunc: method is nil but DestinationRuleController.Sync was just called") + } + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + lockDestinationRuleControllerMockSync.Lock() + mock.calls.Sync = append(mock.calls.Sync, callInfo) + lockDestinationRuleControllerMockSync.Unlock() + return mock.SyncFunc(ctx) +} + +// SyncCalls gets all the calls that were made to Sync. +// Check the length with: +// len(mockedDestinationRuleController.SyncCalls()) +func (mock *DestinationRuleControllerMock) SyncCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + lockDestinationRuleControllerMockSync.RLock() + calls = mock.calls.Sync + lockDestinationRuleControllerMockSync.RUnlock() + return calls +} + +var ( + lockDestinationRuleInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex + lockDestinationRuleInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex + lockDestinationRuleInterfaceMockAddClusterScopedHandler sync.RWMutex + lockDestinationRuleInterfaceMockAddClusterScopedLifecycle sync.RWMutex + lockDestinationRuleInterfaceMockAddFeatureHandler sync.RWMutex + lockDestinationRuleInterfaceMockAddFeatureLifecycle sync.RWMutex + lockDestinationRuleInterfaceMockAddHandler sync.RWMutex + lockDestinationRuleInterfaceMockAddLifecycle sync.RWMutex + lockDestinationRuleInterfaceMockController sync.RWMutex + lockDestinationRuleInterfaceMockCreate sync.RWMutex + lockDestinationRuleInterfaceMockDelete sync.RWMutex + lockDestinationRuleInterfaceMockDeleteCollection sync.RWMutex + lockDestinationRuleInterfaceMockDeleteNamespaced sync.RWMutex + lockDestinationRuleInterfaceMockGet sync.RWMutex + lockDestinationRuleInterfaceMockGetNamespaced sync.RWMutex + lockDestinationRuleInterfaceMockList sync.RWMutex + lockDestinationRuleInterfaceMockObjectClient sync.RWMutex + lockDestinationRuleInterfaceMockUpdate sync.RWMutex + lockDestinationRuleInterfaceMockWatch sync.RWMutex +) + +// Ensure, that DestinationRuleInterfaceMock does implement DestinationRuleInterface. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.DestinationRuleInterface = &DestinationRuleInterfaceMock{} + +// DestinationRuleInterfaceMock is a mock implementation of DestinationRuleInterface. +// +// func TestSomethingThatUsesDestinationRuleInterface(t *testing.T) { +// +// // make and configure a mocked DestinationRuleInterface +// mockedDestinationRuleInterface := &DestinationRuleInterfaceMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1alpha3a.DestinationRuleLifecycle) { +// panic("mock out the AddClusterScopedFeatureLifecycle method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v1alpha3a.DestinationRuleLifecycle) { +// panic("mock out the AddClusterScopedLifecycle method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, lifecycle v1alpha3a.DestinationRuleLifecycle) { +// panic("mock out the AddFeatureLifecycle method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, sync v1alpha3a.DestinationRuleHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// AddLifecycleFunc: func(ctx context.Context, name string, lifecycle v1alpha3a.DestinationRuleLifecycle) { +// panic("mock out the AddLifecycle method") +// }, +// ControllerFunc: func() v1alpha3a.DestinationRuleController { +// panic("mock out the Controller method") +// }, +// CreateFunc: func(in1 *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { +// panic("mock out the Create method") +// }, +// DeleteFunc: func(name string, options *v1.DeleteOptions) error { +// panic("mock out the Delete method") +// }, +// DeleteCollectionFunc: func(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { +// panic("mock out the DeleteCollection method") +// }, +// DeleteNamespacedFunc: func(namespace string, name string, options *v1.DeleteOptions) error { +// panic("mock out the DeleteNamespaced method") +// }, +// GetFunc: func(name string, opts v1.GetOptions) (*v1alpha3.DestinationRule, error) { +// panic("mock out the Get method") +// }, +// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v1alpha3.DestinationRule, error) { +// panic("mock out the GetNamespaced method") +// }, +// ListFunc: func(opts v1.ListOptions) (*v1alpha3a.DestinationRuleList, error) { +// panic("mock out the List method") +// }, +// ObjectClientFunc: func() *objectclient.ObjectClient { +// panic("mock out the ObjectClient method") +// }, +// UpdateFunc: func(in1 *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { +// panic("mock out the Update method") +// }, +// WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { +// panic("mock out the Watch method") +// }, +// } +// +// // use mockedDestinationRuleInterface in code that requires DestinationRuleInterface +// // and then make assertions. +// +// } +type DestinationRuleInterfaceMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1alpha3a.DestinationRuleHandlerFunc) + + // AddClusterScopedFeatureLifecycleFunc mocks the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1alpha3a.DestinationRuleLifecycle) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v1alpha3a.DestinationRuleHandlerFunc) + + // AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method. + AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v1alpha3a.DestinationRuleLifecycle) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.DestinationRuleHandlerFunc) + + // AddFeatureLifecycleFunc mocks the AddFeatureLifecycle method. + AddFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, lifecycle v1alpha3a.DestinationRuleLifecycle) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, sync v1alpha3a.DestinationRuleHandlerFunc) + + // AddLifecycleFunc mocks the AddLifecycle method. + AddLifecycleFunc func(ctx context.Context, name string, lifecycle v1alpha3a.DestinationRuleLifecycle) + + // ControllerFunc mocks the Controller method. + ControllerFunc func() v1alpha3a.DestinationRuleController + + // CreateFunc mocks the Create method. + CreateFunc func(in1 *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) + + // DeleteFunc mocks the Delete method. + DeleteFunc func(name string, options *v1.DeleteOptions) error + + // DeleteCollectionFunc mocks the DeleteCollection method. + DeleteCollectionFunc func(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error + + // DeleteNamespacedFunc mocks the DeleteNamespaced method. + DeleteNamespacedFunc func(namespace string, name string, options *v1.DeleteOptions) error + + // GetFunc mocks the Get method. + GetFunc func(name string, opts v1.GetOptions) (*v1alpha3.DestinationRule, error) + + // GetNamespacedFunc mocks the GetNamespaced method. + GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v1alpha3.DestinationRule, error) + + // ListFunc mocks the List method. + ListFunc func(opts v1.ListOptions) (*v1alpha3a.DestinationRuleList, error) + + // ObjectClientFunc mocks the ObjectClient method. + ObjectClientFunc func() *objectclient.ObjectClient + + // UpdateFunc mocks the Update method. + UpdateFunc func(in1 *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) + + // WatchFunc mocks the Watch method. + WatchFunc func(opts v1.ListOptions) (watch.Interface, error) + + // calls tracks calls to the methods. + calls struct { + // AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Sync is the sync argument value. + Sync v1alpha3a.DestinationRuleHandlerFunc + } + // AddClusterScopedFeatureLifecycle holds details about calls to the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + // AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method. + AddClusterScopedHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Sync is the sync argument value. + Sync v1alpha3a.DestinationRuleHandlerFunc + } + // AddClusterScopedLifecycle holds details about calls to the AddClusterScopedLifecycle method. + AddClusterScopedLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + // AddFeatureHandler holds details about calls to the AddFeatureHandler method. + AddFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1alpha3a.DestinationRuleHandlerFunc + } + // AddFeatureLifecycle holds details about calls to the AddFeatureLifecycle method. + AddFeatureLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + // AddHandler holds details about calls to the AddHandler method. + AddHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1alpha3a.DestinationRuleHandlerFunc + } + // AddLifecycle holds details about calls to the AddLifecycle method. + AddLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + // Controller holds details about calls to the Controller method. + Controller []struct { + } + // Create holds details about calls to the Create method. + Create []struct { + // In1 is the in1 argument value. + In1 *v1alpha3.DestinationRule + } + // Delete holds details about calls to the Delete method. + Delete []struct { + // Name is the name argument value. + Name string + // Options is the options argument value. + Options *v1.DeleteOptions + } + // DeleteCollection holds details about calls to the DeleteCollection method. + DeleteCollection []struct { + // DeleteOpts is the deleteOpts argument value. + DeleteOpts *v1.DeleteOptions + // ListOpts is the listOpts argument value. + ListOpts v1.ListOptions + } + // DeleteNamespaced holds details about calls to the DeleteNamespaced method. + DeleteNamespaced []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + // Options is the options argument value. + Options *v1.DeleteOptions + } + // Get holds details about calls to the Get method. + Get []struct { + // Name is the name argument value. + Name string + // Opts is the opts argument value. + Opts v1.GetOptions + } + // GetNamespaced holds details about calls to the GetNamespaced method. + GetNamespaced []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + // Opts is the opts argument value. + Opts v1.GetOptions + } + // List holds details about calls to the List method. + List []struct { + // Opts is the opts argument value. + Opts v1.ListOptions + } + // ObjectClient holds details about calls to the ObjectClient method. + ObjectClient []struct { + } + // Update holds details about calls to the Update method. + Update []struct { + // In1 is the in1 argument value. + In1 *v1alpha3.DestinationRule + } + // Watch holds details about calls to the Watch method. + Watch []struct { + // Opts is the opts argument value. + Opts v1.ListOptions + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *DestinationRuleInterfaceMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("DestinationRuleInterfaceMock.AddClusterScopedFeatureHandlerFunc: method is nil but DestinationRuleInterface.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockDestinationRuleInterfaceMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockDestinationRuleInterfaceMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, sync) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedDestinationRuleInterface.AddClusterScopedFeatureHandlerCalls()) +func (mock *DestinationRuleInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleInterfaceMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockDestinationRuleInterfaceMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedFeatureLifecycle calls AddClusterScopedFeatureLifecycleFunc. +func (mock *DestinationRuleInterfaceMock) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1alpha3a.DestinationRuleLifecycle) { + if mock.AddClusterScopedFeatureLifecycleFunc == nil { + panic("DestinationRuleInterfaceMock.AddClusterScopedFeatureLifecycleFunc: method is nil but DestinationRuleInterface.AddClusterScopedFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1alpha3a.DestinationRuleLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockDestinationRuleInterfaceMockAddClusterScopedFeatureLifecycle.Lock() + mock.calls.AddClusterScopedFeatureLifecycle = append(mock.calls.AddClusterScopedFeatureLifecycle, callInfo) + lockDestinationRuleInterfaceMockAddClusterScopedFeatureLifecycle.Unlock() + mock.AddClusterScopedFeatureLifecycleFunc(ctx, enabled, name, clusterName, lifecycle) +} + +// AddClusterScopedFeatureLifecycleCalls gets all the calls that were made to AddClusterScopedFeatureLifecycle. +// Check the length with: +// len(mockedDestinationRuleInterface.AddClusterScopedFeatureLifecycleCalls()) +func (mock *DestinationRuleInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1alpha3a.DestinationRuleLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + lockDestinationRuleInterfaceMockAddClusterScopedFeatureLifecycle.RLock() + calls = mock.calls.AddClusterScopedFeatureLifecycle + lockDestinationRuleInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *DestinationRuleInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("DestinationRuleInterfaceMock.AddClusterScopedHandlerFunc: method is nil but DestinationRuleInterface.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Sync v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockDestinationRuleInterfaceMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockDestinationRuleInterfaceMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, sync) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedDestinationRuleInterface.AddClusterScopedHandlerCalls()) +func (mock *DestinationRuleInterfaceMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Sync v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Sync v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleInterfaceMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockDestinationRuleInterfaceMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddClusterScopedLifecycle calls AddClusterScopedLifecycleFunc. +func (mock *DestinationRuleInterfaceMock) AddClusterScopedLifecycle(ctx context.Context, name string, clusterName string, lifecycle v1alpha3a.DestinationRuleLifecycle) { + if mock.AddClusterScopedLifecycleFunc == nil { + panic("DestinationRuleInterfaceMock.AddClusterScopedLifecycleFunc: method is nil but DestinationRuleInterface.AddClusterScopedLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1alpha3a.DestinationRuleLifecycle + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockDestinationRuleInterfaceMockAddClusterScopedLifecycle.Lock() + mock.calls.AddClusterScopedLifecycle = append(mock.calls.AddClusterScopedLifecycle, callInfo) + lockDestinationRuleInterfaceMockAddClusterScopedLifecycle.Unlock() + mock.AddClusterScopedLifecycleFunc(ctx, name, clusterName, lifecycle) +} + +// AddClusterScopedLifecycleCalls gets all the calls that were made to AddClusterScopedLifecycle. +// Check the length with: +// len(mockedDestinationRuleInterface.AddClusterScopedLifecycleCalls()) +func (mock *DestinationRuleInterfaceMock) AddClusterScopedLifecycleCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1alpha3a.DestinationRuleLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + lockDestinationRuleInterfaceMockAddClusterScopedLifecycle.RLock() + calls = mock.calls.AddClusterScopedLifecycle + lockDestinationRuleInterfaceMockAddClusterScopedLifecycle.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *DestinationRuleInterfaceMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("DestinationRuleInterfaceMock.AddFeatureHandlerFunc: method is nil but DestinationRuleInterface.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockDestinationRuleInterfaceMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockDestinationRuleInterfaceMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedDestinationRuleInterface.AddFeatureHandlerCalls()) +func (mock *DestinationRuleInterfaceMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleInterfaceMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockDestinationRuleInterfaceMockAddFeatureHandler.RUnlock() + return calls +} + +// AddFeatureLifecycle calls AddFeatureLifecycleFunc. +func (mock *DestinationRuleInterfaceMock) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle v1alpha3a.DestinationRuleLifecycle) { + if mock.AddFeatureLifecycleFunc == nil { + panic("DestinationRuleInterfaceMock.AddFeatureLifecycleFunc: method is nil but DestinationRuleInterface.AddFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1alpha3a.DestinationRuleLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Lifecycle: lifecycle, + } + lockDestinationRuleInterfaceMockAddFeatureLifecycle.Lock() + mock.calls.AddFeatureLifecycle = append(mock.calls.AddFeatureLifecycle, callInfo) + lockDestinationRuleInterfaceMockAddFeatureLifecycle.Unlock() + mock.AddFeatureLifecycleFunc(ctx, enabled, name, lifecycle) +} + +// AddFeatureLifecycleCalls gets all the calls that were made to AddFeatureLifecycle. +// Check the length with: +// len(mockedDestinationRuleInterface.AddFeatureLifecycleCalls()) +func (mock *DestinationRuleInterfaceMock) AddFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1alpha3a.DestinationRuleLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + lockDestinationRuleInterfaceMockAddFeatureLifecycle.RLock() + calls = mock.calls.AddFeatureLifecycle + lockDestinationRuleInterfaceMockAddFeatureLifecycle.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *DestinationRuleInterfaceMock) AddHandler(ctx context.Context, name string, sync v1alpha3a.DestinationRuleHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("DestinationRuleInterfaceMock.AddHandlerFunc: method is nil but DestinationRuleInterface.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc + }{ + Ctx: ctx, + Name: name, + Sync: sync, + } + lockDestinationRuleInterfaceMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockDestinationRuleInterfaceMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, sync) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedDestinationRuleInterface.AddHandlerCalls()) +func (mock *DestinationRuleInterfaceMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Sync v1alpha3a.DestinationRuleHandlerFunc + } + lockDestinationRuleInterfaceMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockDestinationRuleInterfaceMockAddHandler.RUnlock() + return calls +} + +// AddLifecycle calls AddLifecycleFunc. +func (mock *DestinationRuleInterfaceMock) AddLifecycle(ctx context.Context, name string, lifecycle v1alpha3a.DestinationRuleLifecycle) { + if mock.AddLifecycleFunc == nil { + panic("DestinationRuleInterfaceMock.AddLifecycleFunc: method is nil but DestinationRuleInterface.AddLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Lifecycle v1alpha3a.DestinationRuleLifecycle + }{ + Ctx: ctx, + Name: name, + Lifecycle: lifecycle, + } + lockDestinationRuleInterfaceMockAddLifecycle.Lock() + mock.calls.AddLifecycle = append(mock.calls.AddLifecycle, callInfo) + lockDestinationRuleInterfaceMockAddLifecycle.Unlock() + mock.AddLifecycleFunc(ctx, name, lifecycle) +} + +// AddLifecycleCalls gets all the calls that were made to AddLifecycle. +// Check the length with: +// len(mockedDestinationRuleInterface.AddLifecycleCalls()) +func (mock *DestinationRuleInterfaceMock) AddLifecycleCalls() []struct { + Ctx context.Context + Name string + Lifecycle v1alpha3a.DestinationRuleLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + Lifecycle v1alpha3a.DestinationRuleLifecycle + } + lockDestinationRuleInterfaceMockAddLifecycle.RLock() + calls = mock.calls.AddLifecycle + lockDestinationRuleInterfaceMockAddLifecycle.RUnlock() + return calls +} + +// Controller calls ControllerFunc. +func (mock *DestinationRuleInterfaceMock) Controller() v1alpha3a.DestinationRuleController { + if mock.ControllerFunc == nil { + panic("DestinationRuleInterfaceMock.ControllerFunc: method is nil but DestinationRuleInterface.Controller was just called") + } + callInfo := struct { + }{} + lockDestinationRuleInterfaceMockController.Lock() + mock.calls.Controller = append(mock.calls.Controller, callInfo) + lockDestinationRuleInterfaceMockController.Unlock() + return mock.ControllerFunc() +} + +// ControllerCalls gets all the calls that were made to Controller. +// Check the length with: +// len(mockedDestinationRuleInterface.ControllerCalls()) +func (mock *DestinationRuleInterfaceMock) ControllerCalls() []struct { +} { + var calls []struct { + } + lockDestinationRuleInterfaceMockController.RLock() + calls = mock.calls.Controller + lockDestinationRuleInterfaceMockController.RUnlock() + return calls +} + +// Create calls CreateFunc. +func (mock *DestinationRuleInterfaceMock) Create(in1 *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { + if mock.CreateFunc == nil { + panic("DestinationRuleInterfaceMock.CreateFunc: method is nil but DestinationRuleInterface.Create was just called") + } + callInfo := struct { + In1 *v1alpha3.DestinationRule + }{ + In1: in1, + } + lockDestinationRuleInterfaceMockCreate.Lock() + mock.calls.Create = append(mock.calls.Create, callInfo) + lockDestinationRuleInterfaceMockCreate.Unlock() + return mock.CreateFunc(in1) +} + +// CreateCalls gets all the calls that were made to Create. +// Check the length with: +// len(mockedDestinationRuleInterface.CreateCalls()) +func (mock *DestinationRuleInterfaceMock) CreateCalls() []struct { + In1 *v1alpha3.DestinationRule +} { + var calls []struct { + In1 *v1alpha3.DestinationRule + } + lockDestinationRuleInterfaceMockCreate.RLock() + calls = mock.calls.Create + lockDestinationRuleInterfaceMockCreate.RUnlock() + return calls +} + +// Delete calls DeleteFunc. +func (mock *DestinationRuleInterfaceMock) Delete(name string, options *v1.DeleteOptions) error { + if mock.DeleteFunc == nil { + panic("DestinationRuleInterfaceMock.DeleteFunc: method is nil but DestinationRuleInterface.Delete was just called") + } + callInfo := struct { + Name string + Options *v1.DeleteOptions + }{ + Name: name, + Options: options, + } + lockDestinationRuleInterfaceMockDelete.Lock() + mock.calls.Delete = append(mock.calls.Delete, callInfo) + lockDestinationRuleInterfaceMockDelete.Unlock() + return mock.DeleteFunc(name, options) +} + +// DeleteCalls gets all the calls that were made to Delete. +// Check the length with: +// len(mockedDestinationRuleInterface.DeleteCalls()) +func (mock *DestinationRuleInterfaceMock) DeleteCalls() []struct { + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Name string + Options *v1.DeleteOptions + } + lockDestinationRuleInterfaceMockDelete.RLock() + calls = mock.calls.Delete + lockDestinationRuleInterfaceMockDelete.RUnlock() + return calls +} + +// DeleteCollection calls DeleteCollectionFunc. +func (mock *DestinationRuleInterfaceMock) DeleteCollection(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { + if mock.DeleteCollectionFunc == nil { + panic("DestinationRuleInterfaceMock.DeleteCollectionFunc: method is nil but DestinationRuleInterface.DeleteCollection was just called") + } + callInfo := struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + }{ + DeleteOpts: deleteOpts, + ListOpts: listOpts, + } + lockDestinationRuleInterfaceMockDeleteCollection.Lock() + mock.calls.DeleteCollection = append(mock.calls.DeleteCollection, callInfo) + lockDestinationRuleInterfaceMockDeleteCollection.Unlock() + return mock.DeleteCollectionFunc(deleteOpts, listOpts) +} + +// DeleteCollectionCalls gets all the calls that were made to DeleteCollection. +// Check the length with: +// len(mockedDestinationRuleInterface.DeleteCollectionCalls()) +func (mock *DestinationRuleInterfaceMock) DeleteCollectionCalls() []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions +} { + var calls []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + } + lockDestinationRuleInterfaceMockDeleteCollection.RLock() + calls = mock.calls.DeleteCollection + lockDestinationRuleInterfaceMockDeleteCollection.RUnlock() + return calls +} + +// DeleteNamespaced calls DeleteNamespacedFunc. +func (mock *DestinationRuleInterfaceMock) DeleteNamespaced(namespace string, name string, options *v1.DeleteOptions) error { + if mock.DeleteNamespacedFunc == nil { + panic("DestinationRuleInterfaceMock.DeleteNamespacedFunc: method is nil but DestinationRuleInterface.DeleteNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Options *v1.DeleteOptions + }{ + Namespace: namespace, + Name: name, + Options: options, + } + lockDestinationRuleInterfaceMockDeleteNamespaced.Lock() + mock.calls.DeleteNamespaced = append(mock.calls.DeleteNamespaced, callInfo) + lockDestinationRuleInterfaceMockDeleteNamespaced.Unlock() + return mock.DeleteNamespacedFunc(namespace, name, options) +} + +// DeleteNamespacedCalls gets all the calls that were made to DeleteNamespaced. +// Check the length with: +// len(mockedDestinationRuleInterface.DeleteNamespacedCalls()) +func (mock *DestinationRuleInterfaceMock) DeleteNamespacedCalls() []struct { + Namespace string + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Namespace string + Name string + Options *v1.DeleteOptions + } + lockDestinationRuleInterfaceMockDeleteNamespaced.RLock() + calls = mock.calls.DeleteNamespaced + lockDestinationRuleInterfaceMockDeleteNamespaced.RUnlock() + return calls +} + +// Get calls GetFunc. +func (mock *DestinationRuleInterfaceMock) Get(name string, opts v1.GetOptions) (*v1alpha3.DestinationRule, error) { + if mock.GetFunc == nil { + panic("DestinationRuleInterfaceMock.GetFunc: method is nil but DestinationRuleInterface.Get was just called") + } + callInfo := struct { + Name string + Opts v1.GetOptions + }{ + Name: name, + Opts: opts, + } + lockDestinationRuleInterfaceMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockDestinationRuleInterfaceMockGet.Unlock() + return mock.GetFunc(name, opts) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedDestinationRuleInterface.GetCalls()) +func (mock *DestinationRuleInterfaceMock) GetCalls() []struct { + Name string + Opts v1.GetOptions +} { + var calls []struct { + Name string + Opts v1.GetOptions + } + lockDestinationRuleInterfaceMockGet.RLock() + calls = mock.calls.Get + lockDestinationRuleInterfaceMockGet.RUnlock() + return calls +} + +// GetNamespaced calls GetNamespacedFunc. +func (mock *DestinationRuleInterfaceMock) GetNamespaced(namespace string, name string, opts v1.GetOptions) (*v1alpha3.DestinationRule, error) { + if mock.GetNamespacedFunc == nil { + panic("DestinationRuleInterfaceMock.GetNamespacedFunc: method is nil but DestinationRuleInterface.GetNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Opts v1.GetOptions + }{ + Namespace: namespace, + Name: name, + Opts: opts, + } + lockDestinationRuleInterfaceMockGetNamespaced.Lock() + mock.calls.GetNamespaced = append(mock.calls.GetNamespaced, callInfo) + lockDestinationRuleInterfaceMockGetNamespaced.Unlock() + return mock.GetNamespacedFunc(namespace, name, opts) +} + +// GetNamespacedCalls gets all the calls that were made to GetNamespaced. +// Check the length with: +// len(mockedDestinationRuleInterface.GetNamespacedCalls()) +func (mock *DestinationRuleInterfaceMock) GetNamespacedCalls() []struct { + Namespace string + Name string + Opts v1.GetOptions +} { + var calls []struct { + Namespace string + Name string + Opts v1.GetOptions + } + lockDestinationRuleInterfaceMockGetNamespaced.RLock() + calls = mock.calls.GetNamespaced + lockDestinationRuleInterfaceMockGetNamespaced.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *DestinationRuleInterfaceMock) List(opts v1.ListOptions) (*v1alpha3a.DestinationRuleList, error) { + if mock.ListFunc == nil { + panic("DestinationRuleInterfaceMock.ListFunc: method is nil but DestinationRuleInterface.List was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockDestinationRuleInterfaceMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockDestinationRuleInterfaceMockList.Unlock() + return mock.ListFunc(opts) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedDestinationRuleInterface.ListCalls()) +func (mock *DestinationRuleInterfaceMock) ListCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockDestinationRuleInterfaceMockList.RLock() + calls = mock.calls.List + lockDestinationRuleInterfaceMockList.RUnlock() + return calls +} + +// ObjectClient calls ObjectClientFunc. +func (mock *DestinationRuleInterfaceMock) ObjectClient() *objectclient.ObjectClient { + if mock.ObjectClientFunc == nil { + panic("DestinationRuleInterfaceMock.ObjectClientFunc: method is nil but DestinationRuleInterface.ObjectClient was just called") + } + callInfo := struct { + }{} + lockDestinationRuleInterfaceMockObjectClient.Lock() + mock.calls.ObjectClient = append(mock.calls.ObjectClient, callInfo) + lockDestinationRuleInterfaceMockObjectClient.Unlock() + return mock.ObjectClientFunc() +} + +// ObjectClientCalls gets all the calls that were made to ObjectClient. +// Check the length with: +// len(mockedDestinationRuleInterface.ObjectClientCalls()) +func (mock *DestinationRuleInterfaceMock) ObjectClientCalls() []struct { +} { + var calls []struct { + } + lockDestinationRuleInterfaceMockObjectClient.RLock() + calls = mock.calls.ObjectClient + lockDestinationRuleInterfaceMockObjectClient.RUnlock() + return calls +} + +// Update calls UpdateFunc. +func (mock *DestinationRuleInterfaceMock) Update(in1 *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { + if mock.UpdateFunc == nil { + panic("DestinationRuleInterfaceMock.UpdateFunc: method is nil but DestinationRuleInterface.Update was just called") + } + callInfo := struct { + In1 *v1alpha3.DestinationRule + }{ + In1: in1, + } + lockDestinationRuleInterfaceMockUpdate.Lock() + mock.calls.Update = append(mock.calls.Update, callInfo) + lockDestinationRuleInterfaceMockUpdate.Unlock() + return mock.UpdateFunc(in1) +} + +// UpdateCalls gets all the calls that were made to Update. +// Check the length with: +// len(mockedDestinationRuleInterface.UpdateCalls()) +func (mock *DestinationRuleInterfaceMock) UpdateCalls() []struct { + In1 *v1alpha3.DestinationRule +} { + var calls []struct { + In1 *v1alpha3.DestinationRule + } + lockDestinationRuleInterfaceMockUpdate.RLock() + calls = mock.calls.Update + lockDestinationRuleInterfaceMockUpdate.RUnlock() + return calls +} + +// Watch calls WatchFunc. +func (mock *DestinationRuleInterfaceMock) Watch(opts v1.ListOptions) (watch.Interface, error) { + if mock.WatchFunc == nil { + panic("DestinationRuleInterfaceMock.WatchFunc: method is nil but DestinationRuleInterface.Watch was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockDestinationRuleInterfaceMockWatch.Lock() + mock.calls.Watch = append(mock.calls.Watch, callInfo) + lockDestinationRuleInterfaceMockWatch.Unlock() + return mock.WatchFunc(opts) +} + +// WatchCalls gets all the calls that were made to Watch. +// Check the length with: +// len(mockedDestinationRuleInterface.WatchCalls()) +func (mock *DestinationRuleInterfaceMock) WatchCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockDestinationRuleInterfaceMockWatch.RLock() + calls = mock.calls.Watch + lockDestinationRuleInterfaceMockWatch.RUnlock() + return calls +} + +var ( + lockDestinationRulesGetterMockDestinationRules sync.RWMutex +) + +// Ensure, that DestinationRulesGetterMock does implement DestinationRulesGetter. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.DestinationRulesGetter = &DestinationRulesGetterMock{} + +// DestinationRulesGetterMock is a mock implementation of DestinationRulesGetter. +// +// func TestSomethingThatUsesDestinationRulesGetter(t *testing.T) { +// +// // make and configure a mocked DestinationRulesGetter +// mockedDestinationRulesGetter := &DestinationRulesGetterMock{ +// DestinationRulesFunc: func(namespace string) v1alpha3a.DestinationRuleInterface { +// panic("mock out the DestinationRules method") +// }, +// } +// +// // use mockedDestinationRulesGetter in code that requires DestinationRulesGetter +// // and then make assertions. +// +// } +type DestinationRulesGetterMock struct { + // DestinationRulesFunc mocks the DestinationRules method. + DestinationRulesFunc func(namespace string) v1alpha3a.DestinationRuleInterface + + // calls tracks calls to the methods. + calls struct { + // DestinationRules holds details about calls to the DestinationRules method. + DestinationRules []struct { + // Namespace is the namespace argument value. + Namespace string + } + } +} + +// DestinationRules calls DestinationRulesFunc. +func (mock *DestinationRulesGetterMock) DestinationRules(namespace string) v1alpha3a.DestinationRuleInterface { + if mock.DestinationRulesFunc == nil { + panic("DestinationRulesGetterMock.DestinationRulesFunc: method is nil but DestinationRulesGetter.DestinationRules was just called") + } + callInfo := struct { + Namespace string + }{ + Namespace: namespace, + } + lockDestinationRulesGetterMockDestinationRules.Lock() + mock.calls.DestinationRules = append(mock.calls.DestinationRules, callInfo) + lockDestinationRulesGetterMockDestinationRules.Unlock() + return mock.DestinationRulesFunc(namespace) +} + +// DestinationRulesCalls gets all the calls that were made to DestinationRules. +// Check the length with: +// len(mockedDestinationRulesGetter.DestinationRulesCalls()) +func (mock *DestinationRulesGetterMock) DestinationRulesCalls() []struct { + Namespace string +} { + var calls []struct { + Namespace string + } + lockDestinationRulesGetterMockDestinationRules.RLock() + calls = mock.calls.DestinationRules + lockDestinationRulesGetterMockDestinationRules.RUnlock() + return calls +} diff --git a/apis/networking.istio.io/v1alpha3/fakes/zz_generated_virtual_service_mock.go b/apis/networking.istio.io/v1alpha3/fakes/zz_generated_virtual_service_mock.go new file mode 100644 index 00000000..43fcf888 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/fakes/zz_generated_virtual_service_mock.go @@ -0,0 +1,1741 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package fakes + +import ( + context "context" + sync "sync" + + v1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" + controller "github.com/rancher/norman/controller" + objectclient "github.com/rancher/norman/objectclient" + v1alpha3a "github.com/rancher/types/apis/networking.istio.io/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +var ( + lockVirtualServiceListerMockGet sync.RWMutex + lockVirtualServiceListerMockList sync.RWMutex +) + +// Ensure, that VirtualServiceListerMock does implement VirtualServiceLister. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.VirtualServiceLister = &VirtualServiceListerMock{} + +// VirtualServiceListerMock is a mock implementation of VirtualServiceLister. +// +// func TestSomethingThatUsesVirtualServiceLister(t *testing.T) { +// +// // make and configure a mocked VirtualServiceLister +// mockedVirtualServiceLister := &VirtualServiceListerMock{ +// GetFunc: func(namespace string, name string) (*v1alpha3.VirtualService, error) { +// panic("mock out the Get method") +// }, +// ListFunc: func(namespace string, selector labels.Selector) ([]*v1alpha3.VirtualService, error) { +// panic("mock out the List method") +// }, +// } +// +// // use mockedVirtualServiceLister in code that requires VirtualServiceLister +// // and then make assertions. +// +// } +type VirtualServiceListerMock struct { + // GetFunc mocks the Get method. + GetFunc func(namespace string, name string) (*v1alpha3.VirtualService, error) + + // ListFunc mocks the List method. + ListFunc func(namespace string, selector labels.Selector) ([]*v1alpha3.VirtualService, error) + + // calls tracks calls to the methods. + calls struct { + // Get holds details about calls to the Get method. + Get []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + } + // List holds details about calls to the List method. + List []struct { + // Namespace is the namespace argument value. + Namespace string + // Selector is the selector argument value. + Selector labels.Selector + } + } +} + +// Get calls GetFunc. +func (mock *VirtualServiceListerMock) Get(namespace string, name string) (*v1alpha3.VirtualService, error) { + if mock.GetFunc == nil { + panic("VirtualServiceListerMock.GetFunc: method is nil but VirtualServiceLister.Get was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockVirtualServiceListerMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockVirtualServiceListerMockGet.Unlock() + return mock.GetFunc(namespace, name) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedVirtualServiceLister.GetCalls()) +func (mock *VirtualServiceListerMock) GetCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockVirtualServiceListerMockGet.RLock() + calls = mock.calls.Get + lockVirtualServiceListerMockGet.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *VirtualServiceListerMock) List(namespace string, selector labels.Selector) ([]*v1alpha3.VirtualService, error) { + if mock.ListFunc == nil { + panic("VirtualServiceListerMock.ListFunc: method is nil but VirtualServiceLister.List was just called") + } + callInfo := struct { + Namespace string + Selector labels.Selector + }{ + Namespace: namespace, + Selector: selector, + } + lockVirtualServiceListerMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockVirtualServiceListerMockList.Unlock() + return mock.ListFunc(namespace, selector) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedVirtualServiceLister.ListCalls()) +func (mock *VirtualServiceListerMock) ListCalls() []struct { + Namespace string + Selector labels.Selector +} { + var calls []struct { + Namespace string + Selector labels.Selector + } + lockVirtualServiceListerMockList.RLock() + calls = mock.calls.List + lockVirtualServiceListerMockList.RUnlock() + return calls +} + +var ( + lockVirtualServiceControllerMockAddClusterScopedFeatureHandler sync.RWMutex + lockVirtualServiceControllerMockAddClusterScopedHandler sync.RWMutex + lockVirtualServiceControllerMockAddFeatureHandler sync.RWMutex + lockVirtualServiceControllerMockAddHandler sync.RWMutex + lockVirtualServiceControllerMockEnqueue sync.RWMutex + lockVirtualServiceControllerMockGeneric sync.RWMutex + lockVirtualServiceControllerMockInformer sync.RWMutex + lockVirtualServiceControllerMockLister sync.RWMutex + lockVirtualServiceControllerMockStart sync.RWMutex + lockVirtualServiceControllerMockSync sync.RWMutex +) + +// Ensure, that VirtualServiceControllerMock does implement VirtualServiceController. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.VirtualServiceController = &VirtualServiceControllerMock{} + +// VirtualServiceControllerMock is a mock implementation of VirtualServiceController. +// +// func TestSomethingThatUsesVirtualServiceController(t *testing.T) { +// +// // make and configure a mocked VirtualServiceController +// mockedVirtualServiceController := &VirtualServiceControllerMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, handler v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// EnqueueFunc: func(namespace string, name string) { +// panic("mock out the Enqueue method") +// }, +// GenericFunc: func() controller.GenericController { +// panic("mock out the Generic method") +// }, +// InformerFunc: func() cache.SharedIndexInformer { +// panic("mock out the Informer method") +// }, +// ListerFunc: func() v1alpha3a.VirtualServiceLister { +// panic("mock out the Lister method") +// }, +// StartFunc: func(ctx context.Context, threadiness int) error { +// panic("mock out the Start method") +// }, +// SyncFunc: func(ctx context.Context) error { +// panic("mock out the Sync method") +// }, +// } +// +// // use mockedVirtualServiceController in code that requires VirtualServiceController +// // and then make assertions. +// +// } +type VirtualServiceControllerMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1alpha3a.VirtualServiceHandlerFunc) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v1alpha3a.VirtualServiceHandlerFunc) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.VirtualServiceHandlerFunc) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, handler v1alpha3a.VirtualServiceHandlerFunc) + + // EnqueueFunc mocks the Enqueue method. + EnqueueFunc func(namespace string, name string) + + // GenericFunc mocks the Generic method. + GenericFunc func() controller.GenericController + + // InformerFunc mocks the Informer method. + InformerFunc func() cache.SharedIndexInformer + + // ListerFunc mocks the Lister method. + ListerFunc func() v1alpha3a.VirtualServiceLister + + // StartFunc mocks the Start method. + StartFunc func(ctx context.Context, threadiness int) error + + // SyncFunc mocks the Sync method. + SyncFunc func(ctx context.Context) error + + // calls tracks calls to the methods. + calls struct { + // AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Handler is the handler argument value. + Handler v1alpha3a.VirtualServiceHandlerFunc + } + // AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method. + AddClusterScopedHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Handler is the handler argument value. + Handler v1alpha3a.VirtualServiceHandlerFunc + } + // AddFeatureHandler holds details about calls to the AddFeatureHandler method. + AddFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1alpha3a.VirtualServiceHandlerFunc + } + // AddHandler holds details about calls to the AddHandler method. + AddHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Handler is the handler argument value. + Handler v1alpha3a.VirtualServiceHandlerFunc + } + // Enqueue holds details about calls to the Enqueue method. + Enqueue []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + } + // Generic holds details about calls to the Generic method. + Generic []struct { + } + // Informer holds details about calls to the Informer method. + Informer []struct { + } + // Lister holds details about calls to the Lister method. + Lister []struct { + } + // Start holds details about calls to the Start method. + Start []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Threadiness is the threadiness argument value. + Threadiness int + } + // Sync holds details about calls to the Sync method. + Sync []struct { + // Ctx is the ctx argument value. + Ctx context.Context + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *VirtualServiceControllerMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("VirtualServiceControllerMock.AddClusterScopedFeatureHandlerFunc: method is nil but VirtualServiceController.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockVirtualServiceControllerMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockVirtualServiceControllerMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, handler) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedVirtualServiceController.AddClusterScopedFeatureHandlerCalls()) +func (mock *VirtualServiceControllerMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceControllerMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockVirtualServiceControllerMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *VirtualServiceControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("VirtualServiceControllerMock.AddClusterScopedHandlerFunc: method is nil but VirtualServiceController.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Handler v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockVirtualServiceControllerMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockVirtualServiceControllerMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, handler) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedVirtualServiceController.AddClusterScopedHandlerCalls()) +func (mock *VirtualServiceControllerMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Handler v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Handler v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceControllerMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockVirtualServiceControllerMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *VirtualServiceControllerMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("VirtualServiceControllerMock.AddFeatureHandlerFunc: method is nil but VirtualServiceController.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockVirtualServiceControllerMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockVirtualServiceControllerMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedVirtualServiceController.AddFeatureHandlerCalls()) +func (mock *VirtualServiceControllerMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceControllerMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockVirtualServiceControllerMockAddFeatureHandler.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *VirtualServiceControllerMock) AddHandler(ctx context.Context, name string, handler v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("VirtualServiceControllerMock.AddHandlerFunc: method is nil but VirtualServiceController.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Handler v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Name: name, + Handler: handler, + } + lockVirtualServiceControllerMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockVirtualServiceControllerMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, handler) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedVirtualServiceController.AddHandlerCalls()) +func (mock *VirtualServiceControllerMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Handler v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Handler v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceControllerMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockVirtualServiceControllerMockAddHandler.RUnlock() + return calls +} + +// Enqueue calls EnqueueFunc. +func (mock *VirtualServiceControllerMock) Enqueue(namespace string, name string) { + if mock.EnqueueFunc == nil { + panic("VirtualServiceControllerMock.EnqueueFunc: method is nil but VirtualServiceController.Enqueue was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockVirtualServiceControllerMockEnqueue.Lock() + mock.calls.Enqueue = append(mock.calls.Enqueue, callInfo) + lockVirtualServiceControllerMockEnqueue.Unlock() + mock.EnqueueFunc(namespace, name) +} + +// EnqueueCalls gets all the calls that were made to Enqueue. +// Check the length with: +// len(mockedVirtualServiceController.EnqueueCalls()) +func (mock *VirtualServiceControllerMock) EnqueueCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockVirtualServiceControllerMockEnqueue.RLock() + calls = mock.calls.Enqueue + lockVirtualServiceControllerMockEnqueue.RUnlock() + return calls +} + +// Generic calls GenericFunc. +func (mock *VirtualServiceControllerMock) Generic() controller.GenericController { + if mock.GenericFunc == nil { + panic("VirtualServiceControllerMock.GenericFunc: method is nil but VirtualServiceController.Generic was just called") + } + callInfo := struct { + }{} + lockVirtualServiceControllerMockGeneric.Lock() + mock.calls.Generic = append(mock.calls.Generic, callInfo) + lockVirtualServiceControllerMockGeneric.Unlock() + return mock.GenericFunc() +} + +// GenericCalls gets all the calls that were made to Generic. +// Check the length with: +// len(mockedVirtualServiceController.GenericCalls()) +func (mock *VirtualServiceControllerMock) GenericCalls() []struct { +} { + var calls []struct { + } + lockVirtualServiceControllerMockGeneric.RLock() + calls = mock.calls.Generic + lockVirtualServiceControllerMockGeneric.RUnlock() + return calls +} + +// Informer calls InformerFunc. +func (mock *VirtualServiceControllerMock) Informer() cache.SharedIndexInformer { + if mock.InformerFunc == nil { + panic("VirtualServiceControllerMock.InformerFunc: method is nil but VirtualServiceController.Informer was just called") + } + callInfo := struct { + }{} + lockVirtualServiceControllerMockInformer.Lock() + mock.calls.Informer = append(mock.calls.Informer, callInfo) + lockVirtualServiceControllerMockInformer.Unlock() + return mock.InformerFunc() +} + +// InformerCalls gets all the calls that were made to Informer. +// Check the length with: +// len(mockedVirtualServiceController.InformerCalls()) +func (mock *VirtualServiceControllerMock) InformerCalls() []struct { +} { + var calls []struct { + } + lockVirtualServiceControllerMockInformer.RLock() + calls = mock.calls.Informer + lockVirtualServiceControllerMockInformer.RUnlock() + return calls +} + +// Lister calls ListerFunc. +func (mock *VirtualServiceControllerMock) Lister() v1alpha3a.VirtualServiceLister { + if mock.ListerFunc == nil { + panic("VirtualServiceControllerMock.ListerFunc: method is nil but VirtualServiceController.Lister was just called") + } + callInfo := struct { + }{} + lockVirtualServiceControllerMockLister.Lock() + mock.calls.Lister = append(mock.calls.Lister, callInfo) + lockVirtualServiceControllerMockLister.Unlock() + return mock.ListerFunc() +} + +// ListerCalls gets all the calls that were made to Lister. +// Check the length with: +// len(mockedVirtualServiceController.ListerCalls()) +func (mock *VirtualServiceControllerMock) ListerCalls() []struct { +} { + var calls []struct { + } + lockVirtualServiceControllerMockLister.RLock() + calls = mock.calls.Lister + lockVirtualServiceControllerMockLister.RUnlock() + return calls +} + +// Start calls StartFunc. +func (mock *VirtualServiceControllerMock) Start(ctx context.Context, threadiness int) error { + if mock.StartFunc == nil { + panic("VirtualServiceControllerMock.StartFunc: method is nil but VirtualServiceController.Start was just called") + } + callInfo := struct { + Ctx context.Context + Threadiness int + }{ + Ctx: ctx, + Threadiness: threadiness, + } + lockVirtualServiceControllerMockStart.Lock() + mock.calls.Start = append(mock.calls.Start, callInfo) + lockVirtualServiceControllerMockStart.Unlock() + return mock.StartFunc(ctx, threadiness) +} + +// StartCalls gets all the calls that were made to Start. +// Check the length with: +// len(mockedVirtualServiceController.StartCalls()) +func (mock *VirtualServiceControllerMock) StartCalls() []struct { + Ctx context.Context + Threadiness int +} { + var calls []struct { + Ctx context.Context + Threadiness int + } + lockVirtualServiceControllerMockStart.RLock() + calls = mock.calls.Start + lockVirtualServiceControllerMockStart.RUnlock() + return calls +} + +// Sync calls SyncFunc. +func (mock *VirtualServiceControllerMock) Sync(ctx context.Context) error { + if mock.SyncFunc == nil { + panic("VirtualServiceControllerMock.SyncFunc: method is nil but VirtualServiceController.Sync was just called") + } + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + lockVirtualServiceControllerMockSync.Lock() + mock.calls.Sync = append(mock.calls.Sync, callInfo) + lockVirtualServiceControllerMockSync.Unlock() + return mock.SyncFunc(ctx) +} + +// SyncCalls gets all the calls that were made to Sync. +// Check the length with: +// len(mockedVirtualServiceController.SyncCalls()) +func (mock *VirtualServiceControllerMock) SyncCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + lockVirtualServiceControllerMockSync.RLock() + calls = mock.calls.Sync + lockVirtualServiceControllerMockSync.RUnlock() + return calls +} + +var ( + lockVirtualServiceInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex + lockVirtualServiceInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex + lockVirtualServiceInterfaceMockAddClusterScopedHandler sync.RWMutex + lockVirtualServiceInterfaceMockAddClusterScopedLifecycle sync.RWMutex + lockVirtualServiceInterfaceMockAddFeatureHandler sync.RWMutex + lockVirtualServiceInterfaceMockAddFeatureLifecycle sync.RWMutex + lockVirtualServiceInterfaceMockAddHandler sync.RWMutex + lockVirtualServiceInterfaceMockAddLifecycle sync.RWMutex + lockVirtualServiceInterfaceMockController sync.RWMutex + lockVirtualServiceInterfaceMockCreate sync.RWMutex + lockVirtualServiceInterfaceMockDelete sync.RWMutex + lockVirtualServiceInterfaceMockDeleteCollection sync.RWMutex + lockVirtualServiceInterfaceMockDeleteNamespaced sync.RWMutex + lockVirtualServiceInterfaceMockGet sync.RWMutex + lockVirtualServiceInterfaceMockGetNamespaced sync.RWMutex + lockVirtualServiceInterfaceMockList sync.RWMutex + lockVirtualServiceInterfaceMockObjectClient sync.RWMutex + lockVirtualServiceInterfaceMockUpdate sync.RWMutex + lockVirtualServiceInterfaceMockWatch sync.RWMutex +) + +// Ensure, that VirtualServiceInterfaceMock does implement VirtualServiceInterface. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.VirtualServiceInterface = &VirtualServiceInterfaceMock{} + +// VirtualServiceInterfaceMock is a mock implementation of VirtualServiceInterface. +// +// func TestSomethingThatUsesVirtualServiceInterface(t *testing.T) { +// +// // make and configure a mocked VirtualServiceInterface +// mockedVirtualServiceInterface := &VirtualServiceInterfaceMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1alpha3a.VirtualServiceLifecycle) { +// panic("mock out the AddClusterScopedFeatureLifecycle method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v1alpha3a.VirtualServiceLifecycle) { +// panic("mock out the AddClusterScopedLifecycle method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, lifecycle v1alpha3a.VirtualServiceLifecycle) { +// panic("mock out the AddFeatureLifecycle method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, sync v1alpha3a.VirtualServiceHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// AddLifecycleFunc: func(ctx context.Context, name string, lifecycle v1alpha3a.VirtualServiceLifecycle) { +// panic("mock out the AddLifecycle method") +// }, +// ControllerFunc: func() v1alpha3a.VirtualServiceController { +// panic("mock out the Controller method") +// }, +// CreateFunc: func(in1 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { +// panic("mock out the Create method") +// }, +// DeleteFunc: func(name string, options *v1.DeleteOptions) error { +// panic("mock out the Delete method") +// }, +// DeleteCollectionFunc: func(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { +// panic("mock out the DeleteCollection method") +// }, +// DeleteNamespacedFunc: func(namespace string, name string, options *v1.DeleteOptions) error { +// panic("mock out the DeleteNamespaced method") +// }, +// GetFunc: func(name string, opts v1.GetOptions) (*v1alpha3.VirtualService, error) { +// panic("mock out the Get method") +// }, +// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v1alpha3.VirtualService, error) { +// panic("mock out the GetNamespaced method") +// }, +// ListFunc: func(opts v1.ListOptions) (*v1alpha3a.VirtualServiceList, error) { +// panic("mock out the List method") +// }, +// ObjectClientFunc: func() *objectclient.ObjectClient { +// panic("mock out the ObjectClient method") +// }, +// UpdateFunc: func(in1 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { +// panic("mock out the Update method") +// }, +// WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { +// panic("mock out the Watch method") +// }, +// } +// +// // use mockedVirtualServiceInterface in code that requires VirtualServiceInterface +// // and then make assertions. +// +// } +type VirtualServiceInterfaceMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1alpha3a.VirtualServiceHandlerFunc) + + // AddClusterScopedFeatureLifecycleFunc mocks the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1alpha3a.VirtualServiceLifecycle) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v1alpha3a.VirtualServiceHandlerFunc) + + // AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method. + AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v1alpha3a.VirtualServiceLifecycle) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.VirtualServiceHandlerFunc) + + // AddFeatureLifecycleFunc mocks the AddFeatureLifecycle method. + AddFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, lifecycle v1alpha3a.VirtualServiceLifecycle) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, sync v1alpha3a.VirtualServiceHandlerFunc) + + // AddLifecycleFunc mocks the AddLifecycle method. + AddLifecycleFunc func(ctx context.Context, name string, lifecycle v1alpha3a.VirtualServiceLifecycle) + + // ControllerFunc mocks the Controller method. + ControllerFunc func() v1alpha3a.VirtualServiceController + + // CreateFunc mocks the Create method. + CreateFunc func(in1 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) + + // DeleteFunc mocks the Delete method. + DeleteFunc func(name string, options *v1.DeleteOptions) error + + // DeleteCollectionFunc mocks the DeleteCollection method. + DeleteCollectionFunc func(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error + + // DeleteNamespacedFunc mocks the DeleteNamespaced method. + DeleteNamespacedFunc func(namespace string, name string, options *v1.DeleteOptions) error + + // GetFunc mocks the Get method. + GetFunc func(name string, opts v1.GetOptions) (*v1alpha3.VirtualService, error) + + // GetNamespacedFunc mocks the GetNamespaced method. + GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v1alpha3.VirtualService, error) + + // ListFunc mocks the List method. + ListFunc func(opts v1.ListOptions) (*v1alpha3a.VirtualServiceList, error) + + // ObjectClientFunc mocks the ObjectClient method. + ObjectClientFunc func() *objectclient.ObjectClient + + // UpdateFunc mocks the Update method. + UpdateFunc func(in1 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) + + // WatchFunc mocks the Watch method. + WatchFunc func(opts v1.ListOptions) (watch.Interface, error) + + // calls tracks calls to the methods. + calls struct { + // AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Sync is the sync argument value. + Sync v1alpha3a.VirtualServiceHandlerFunc + } + // AddClusterScopedFeatureLifecycle holds details about calls to the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + // AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method. + AddClusterScopedHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Sync is the sync argument value. + Sync v1alpha3a.VirtualServiceHandlerFunc + } + // AddClusterScopedLifecycle holds details about calls to the AddClusterScopedLifecycle method. + AddClusterScopedLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + // AddFeatureHandler holds details about calls to the AddFeatureHandler method. + AddFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1alpha3a.VirtualServiceHandlerFunc + } + // AddFeatureLifecycle holds details about calls to the AddFeatureLifecycle method. + AddFeatureLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + // AddHandler holds details about calls to the AddHandler method. + AddHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1alpha3a.VirtualServiceHandlerFunc + } + // AddLifecycle holds details about calls to the AddLifecycle method. + AddLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Lifecycle is the lifecycle argument value. + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + // Controller holds details about calls to the Controller method. + Controller []struct { + } + // Create holds details about calls to the Create method. + Create []struct { + // In1 is the in1 argument value. + In1 *v1alpha3.VirtualService + } + // Delete holds details about calls to the Delete method. + Delete []struct { + // Name is the name argument value. + Name string + // Options is the options argument value. + Options *v1.DeleteOptions + } + // DeleteCollection holds details about calls to the DeleteCollection method. + DeleteCollection []struct { + // DeleteOpts is the deleteOpts argument value. + DeleteOpts *v1.DeleteOptions + // ListOpts is the listOpts argument value. + ListOpts v1.ListOptions + } + // DeleteNamespaced holds details about calls to the DeleteNamespaced method. + DeleteNamespaced []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + // Options is the options argument value. + Options *v1.DeleteOptions + } + // Get holds details about calls to the Get method. + Get []struct { + // Name is the name argument value. + Name string + // Opts is the opts argument value. + Opts v1.GetOptions + } + // GetNamespaced holds details about calls to the GetNamespaced method. + GetNamespaced []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + // Opts is the opts argument value. + Opts v1.GetOptions + } + // List holds details about calls to the List method. + List []struct { + // Opts is the opts argument value. + Opts v1.ListOptions + } + // ObjectClient holds details about calls to the ObjectClient method. + ObjectClient []struct { + } + // Update holds details about calls to the Update method. + Update []struct { + // In1 is the in1 argument value. + In1 *v1alpha3.VirtualService + } + // Watch holds details about calls to the Watch method. + Watch []struct { + // Opts is the opts argument value. + Opts v1.ListOptions + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *VirtualServiceInterfaceMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("VirtualServiceInterfaceMock.AddClusterScopedFeatureHandlerFunc: method is nil but VirtualServiceInterface.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockVirtualServiceInterfaceMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockVirtualServiceInterfaceMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, sync) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedVirtualServiceInterface.AddClusterScopedFeatureHandlerCalls()) +func (mock *VirtualServiceInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceInterfaceMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockVirtualServiceInterfaceMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedFeatureLifecycle calls AddClusterScopedFeatureLifecycleFunc. +func (mock *VirtualServiceInterfaceMock) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1alpha3a.VirtualServiceLifecycle) { + if mock.AddClusterScopedFeatureLifecycleFunc == nil { + panic("VirtualServiceInterfaceMock.AddClusterScopedFeatureLifecycleFunc: method is nil but VirtualServiceInterface.AddClusterScopedFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1alpha3a.VirtualServiceLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockVirtualServiceInterfaceMockAddClusterScopedFeatureLifecycle.Lock() + mock.calls.AddClusterScopedFeatureLifecycle = append(mock.calls.AddClusterScopedFeatureLifecycle, callInfo) + lockVirtualServiceInterfaceMockAddClusterScopedFeatureLifecycle.Unlock() + mock.AddClusterScopedFeatureLifecycleFunc(ctx, enabled, name, clusterName, lifecycle) +} + +// AddClusterScopedFeatureLifecycleCalls gets all the calls that were made to AddClusterScopedFeatureLifecycle. +// Check the length with: +// len(mockedVirtualServiceInterface.AddClusterScopedFeatureLifecycleCalls()) +func (mock *VirtualServiceInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1alpha3a.VirtualServiceLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + lockVirtualServiceInterfaceMockAddClusterScopedFeatureLifecycle.RLock() + calls = mock.calls.AddClusterScopedFeatureLifecycle + lockVirtualServiceInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *VirtualServiceInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("VirtualServiceInterfaceMock.AddClusterScopedHandlerFunc: method is nil but VirtualServiceInterface.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Sync v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockVirtualServiceInterfaceMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockVirtualServiceInterfaceMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, sync) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedVirtualServiceInterface.AddClusterScopedHandlerCalls()) +func (mock *VirtualServiceInterfaceMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Sync v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Sync v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceInterfaceMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockVirtualServiceInterfaceMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddClusterScopedLifecycle calls AddClusterScopedLifecycleFunc. +func (mock *VirtualServiceInterfaceMock) AddClusterScopedLifecycle(ctx context.Context, name string, clusterName string, lifecycle v1alpha3a.VirtualServiceLifecycle) { + if mock.AddClusterScopedLifecycleFunc == nil { + panic("VirtualServiceInterfaceMock.AddClusterScopedLifecycleFunc: method is nil but VirtualServiceInterface.AddClusterScopedLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1alpha3a.VirtualServiceLifecycle + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockVirtualServiceInterfaceMockAddClusterScopedLifecycle.Lock() + mock.calls.AddClusterScopedLifecycle = append(mock.calls.AddClusterScopedLifecycle, callInfo) + lockVirtualServiceInterfaceMockAddClusterScopedLifecycle.Unlock() + mock.AddClusterScopedLifecycleFunc(ctx, name, clusterName, lifecycle) +} + +// AddClusterScopedLifecycleCalls gets all the calls that were made to AddClusterScopedLifecycle. +// Check the length with: +// len(mockedVirtualServiceInterface.AddClusterScopedLifecycleCalls()) +func (mock *VirtualServiceInterfaceMock) AddClusterScopedLifecycleCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1alpha3a.VirtualServiceLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + lockVirtualServiceInterfaceMockAddClusterScopedLifecycle.RLock() + calls = mock.calls.AddClusterScopedLifecycle + lockVirtualServiceInterfaceMockAddClusterScopedLifecycle.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *VirtualServiceInterfaceMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("VirtualServiceInterfaceMock.AddFeatureHandlerFunc: method is nil but VirtualServiceInterface.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockVirtualServiceInterfaceMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockVirtualServiceInterfaceMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedVirtualServiceInterface.AddFeatureHandlerCalls()) +func (mock *VirtualServiceInterfaceMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceInterfaceMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockVirtualServiceInterfaceMockAddFeatureHandler.RUnlock() + return calls +} + +// AddFeatureLifecycle calls AddFeatureLifecycleFunc. +func (mock *VirtualServiceInterfaceMock) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle v1alpha3a.VirtualServiceLifecycle) { + if mock.AddFeatureLifecycleFunc == nil { + panic("VirtualServiceInterfaceMock.AddFeatureLifecycleFunc: method is nil but VirtualServiceInterface.AddFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1alpha3a.VirtualServiceLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Lifecycle: lifecycle, + } + lockVirtualServiceInterfaceMockAddFeatureLifecycle.Lock() + mock.calls.AddFeatureLifecycle = append(mock.calls.AddFeatureLifecycle, callInfo) + lockVirtualServiceInterfaceMockAddFeatureLifecycle.Unlock() + mock.AddFeatureLifecycleFunc(ctx, enabled, name, lifecycle) +} + +// AddFeatureLifecycleCalls gets all the calls that were made to AddFeatureLifecycle. +// Check the length with: +// len(mockedVirtualServiceInterface.AddFeatureLifecycleCalls()) +func (mock *VirtualServiceInterfaceMock) AddFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1alpha3a.VirtualServiceLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + lockVirtualServiceInterfaceMockAddFeatureLifecycle.RLock() + calls = mock.calls.AddFeatureLifecycle + lockVirtualServiceInterfaceMockAddFeatureLifecycle.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *VirtualServiceInterfaceMock) AddHandler(ctx context.Context, name string, sync v1alpha3a.VirtualServiceHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("VirtualServiceInterfaceMock.AddHandlerFunc: method is nil but VirtualServiceInterface.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc + }{ + Ctx: ctx, + Name: name, + Sync: sync, + } + lockVirtualServiceInterfaceMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockVirtualServiceInterfaceMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, sync) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedVirtualServiceInterface.AddHandlerCalls()) +func (mock *VirtualServiceInterfaceMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Sync v1alpha3a.VirtualServiceHandlerFunc + } + lockVirtualServiceInterfaceMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockVirtualServiceInterfaceMockAddHandler.RUnlock() + return calls +} + +// AddLifecycle calls AddLifecycleFunc. +func (mock *VirtualServiceInterfaceMock) AddLifecycle(ctx context.Context, name string, lifecycle v1alpha3a.VirtualServiceLifecycle) { + if mock.AddLifecycleFunc == nil { + panic("VirtualServiceInterfaceMock.AddLifecycleFunc: method is nil but VirtualServiceInterface.AddLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Lifecycle v1alpha3a.VirtualServiceLifecycle + }{ + Ctx: ctx, + Name: name, + Lifecycle: lifecycle, + } + lockVirtualServiceInterfaceMockAddLifecycle.Lock() + mock.calls.AddLifecycle = append(mock.calls.AddLifecycle, callInfo) + lockVirtualServiceInterfaceMockAddLifecycle.Unlock() + mock.AddLifecycleFunc(ctx, name, lifecycle) +} + +// AddLifecycleCalls gets all the calls that were made to AddLifecycle. +// Check the length with: +// len(mockedVirtualServiceInterface.AddLifecycleCalls()) +func (mock *VirtualServiceInterfaceMock) AddLifecycleCalls() []struct { + Ctx context.Context + Name string + Lifecycle v1alpha3a.VirtualServiceLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + Lifecycle v1alpha3a.VirtualServiceLifecycle + } + lockVirtualServiceInterfaceMockAddLifecycle.RLock() + calls = mock.calls.AddLifecycle + lockVirtualServiceInterfaceMockAddLifecycle.RUnlock() + return calls +} + +// Controller calls ControllerFunc. +func (mock *VirtualServiceInterfaceMock) Controller() v1alpha3a.VirtualServiceController { + if mock.ControllerFunc == nil { + panic("VirtualServiceInterfaceMock.ControllerFunc: method is nil but VirtualServiceInterface.Controller was just called") + } + callInfo := struct { + }{} + lockVirtualServiceInterfaceMockController.Lock() + mock.calls.Controller = append(mock.calls.Controller, callInfo) + lockVirtualServiceInterfaceMockController.Unlock() + return mock.ControllerFunc() +} + +// ControllerCalls gets all the calls that were made to Controller. +// Check the length with: +// len(mockedVirtualServiceInterface.ControllerCalls()) +func (mock *VirtualServiceInterfaceMock) ControllerCalls() []struct { +} { + var calls []struct { + } + lockVirtualServiceInterfaceMockController.RLock() + calls = mock.calls.Controller + lockVirtualServiceInterfaceMockController.RUnlock() + return calls +} + +// Create calls CreateFunc. +func (mock *VirtualServiceInterfaceMock) Create(in1 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { + if mock.CreateFunc == nil { + panic("VirtualServiceInterfaceMock.CreateFunc: method is nil but VirtualServiceInterface.Create was just called") + } + callInfo := struct { + In1 *v1alpha3.VirtualService + }{ + In1: in1, + } + lockVirtualServiceInterfaceMockCreate.Lock() + mock.calls.Create = append(mock.calls.Create, callInfo) + lockVirtualServiceInterfaceMockCreate.Unlock() + return mock.CreateFunc(in1) +} + +// CreateCalls gets all the calls that were made to Create. +// Check the length with: +// len(mockedVirtualServiceInterface.CreateCalls()) +func (mock *VirtualServiceInterfaceMock) CreateCalls() []struct { + In1 *v1alpha3.VirtualService +} { + var calls []struct { + In1 *v1alpha3.VirtualService + } + lockVirtualServiceInterfaceMockCreate.RLock() + calls = mock.calls.Create + lockVirtualServiceInterfaceMockCreate.RUnlock() + return calls +} + +// Delete calls DeleteFunc. +func (mock *VirtualServiceInterfaceMock) Delete(name string, options *v1.DeleteOptions) error { + if mock.DeleteFunc == nil { + panic("VirtualServiceInterfaceMock.DeleteFunc: method is nil but VirtualServiceInterface.Delete was just called") + } + callInfo := struct { + Name string + Options *v1.DeleteOptions + }{ + Name: name, + Options: options, + } + lockVirtualServiceInterfaceMockDelete.Lock() + mock.calls.Delete = append(mock.calls.Delete, callInfo) + lockVirtualServiceInterfaceMockDelete.Unlock() + return mock.DeleteFunc(name, options) +} + +// DeleteCalls gets all the calls that were made to Delete. +// Check the length with: +// len(mockedVirtualServiceInterface.DeleteCalls()) +func (mock *VirtualServiceInterfaceMock) DeleteCalls() []struct { + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Name string + Options *v1.DeleteOptions + } + lockVirtualServiceInterfaceMockDelete.RLock() + calls = mock.calls.Delete + lockVirtualServiceInterfaceMockDelete.RUnlock() + return calls +} + +// DeleteCollection calls DeleteCollectionFunc. +func (mock *VirtualServiceInterfaceMock) DeleteCollection(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { + if mock.DeleteCollectionFunc == nil { + panic("VirtualServiceInterfaceMock.DeleteCollectionFunc: method is nil but VirtualServiceInterface.DeleteCollection was just called") + } + callInfo := struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + }{ + DeleteOpts: deleteOpts, + ListOpts: listOpts, + } + lockVirtualServiceInterfaceMockDeleteCollection.Lock() + mock.calls.DeleteCollection = append(mock.calls.DeleteCollection, callInfo) + lockVirtualServiceInterfaceMockDeleteCollection.Unlock() + return mock.DeleteCollectionFunc(deleteOpts, listOpts) +} + +// DeleteCollectionCalls gets all the calls that were made to DeleteCollection. +// Check the length with: +// len(mockedVirtualServiceInterface.DeleteCollectionCalls()) +func (mock *VirtualServiceInterfaceMock) DeleteCollectionCalls() []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions +} { + var calls []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + } + lockVirtualServiceInterfaceMockDeleteCollection.RLock() + calls = mock.calls.DeleteCollection + lockVirtualServiceInterfaceMockDeleteCollection.RUnlock() + return calls +} + +// DeleteNamespaced calls DeleteNamespacedFunc. +func (mock *VirtualServiceInterfaceMock) DeleteNamespaced(namespace string, name string, options *v1.DeleteOptions) error { + if mock.DeleteNamespacedFunc == nil { + panic("VirtualServiceInterfaceMock.DeleteNamespacedFunc: method is nil but VirtualServiceInterface.DeleteNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Options *v1.DeleteOptions + }{ + Namespace: namespace, + Name: name, + Options: options, + } + lockVirtualServiceInterfaceMockDeleteNamespaced.Lock() + mock.calls.DeleteNamespaced = append(mock.calls.DeleteNamespaced, callInfo) + lockVirtualServiceInterfaceMockDeleteNamespaced.Unlock() + return mock.DeleteNamespacedFunc(namespace, name, options) +} + +// DeleteNamespacedCalls gets all the calls that were made to DeleteNamespaced. +// Check the length with: +// len(mockedVirtualServiceInterface.DeleteNamespacedCalls()) +func (mock *VirtualServiceInterfaceMock) DeleteNamespacedCalls() []struct { + Namespace string + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Namespace string + Name string + Options *v1.DeleteOptions + } + lockVirtualServiceInterfaceMockDeleteNamespaced.RLock() + calls = mock.calls.DeleteNamespaced + lockVirtualServiceInterfaceMockDeleteNamespaced.RUnlock() + return calls +} + +// Get calls GetFunc. +func (mock *VirtualServiceInterfaceMock) Get(name string, opts v1.GetOptions) (*v1alpha3.VirtualService, error) { + if mock.GetFunc == nil { + panic("VirtualServiceInterfaceMock.GetFunc: method is nil but VirtualServiceInterface.Get was just called") + } + callInfo := struct { + Name string + Opts v1.GetOptions + }{ + Name: name, + Opts: opts, + } + lockVirtualServiceInterfaceMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockVirtualServiceInterfaceMockGet.Unlock() + return mock.GetFunc(name, opts) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedVirtualServiceInterface.GetCalls()) +func (mock *VirtualServiceInterfaceMock) GetCalls() []struct { + Name string + Opts v1.GetOptions +} { + var calls []struct { + Name string + Opts v1.GetOptions + } + lockVirtualServiceInterfaceMockGet.RLock() + calls = mock.calls.Get + lockVirtualServiceInterfaceMockGet.RUnlock() + return calls +} + +// GetNamespaced calls GetNamespacedFunc. +func (mock *VirtualServiceInterfaceMock) GetNamespaced(namespace string, name string, opts v1.GetOptions) (*v1alpha3.VirtualService, error) { + if mock.GetNamespacedFunc == nil { + panic("VirtualServiceInterfaceMock.GetNamespacedFunc: method is nil but VirtualServiceInterface.GetNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Opts v1.GetOptions + }{ + Namespace: namespace, + Name: name, + Opts: opts, + } + lockVirtualServiceInterfaceMockGetNamespaced.Lock() + mock.calls.GetNamespaced = append(mock.calls.GetNamespaced, callInfo) + lockVirtualServiceInterfaceMockGetNamespaced.Unlock() + return mock.GetNamespacedFunc(namespace, name, opts) +} + +// GetNamespacedCalls gets all the calls that were made to GetNamespaced. +// Check the length with: +// len(mockedVirtualServiceInterface.GetNamespacedCalls()) +func (mock *VirtualServiceInterfaceMock) GetNamespacedCalls() []struct { + Namespace string + Name string + Opts v1.GetOptions +} { + var calls []struct { + Namespace string + Name string + Opts v1.GetOptions + } + lockVirtualServiceInterfaceMockGetNamespaced.RLock() + calls = mock.calls.GetNamespaced + lockVirtualServiceInterfaceMockGetNamespaced.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *VirtualServiceInterfaceMock) List(opts v1.ListOptions) (*v1alpha3a.VirtualServiceList, error) { + if mock.ListFunc == nil { + panic("VirtualServiceInterfaceMock.ListFunc: method is nil but VirtualServiceInterface.List was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockVirtualServiceInterfaceMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockVirtualServiceInterfaceMockList.Unlock() + return mock.ListFunc(opts) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedVirtualServiceInterface.ListCalls()) +func (mock *VirtualServiceInterfaceMock) ListCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockVirtualServiceInterfaceMockList.RLock() + calls = mock.calls.List + lockVirtualServiceInterfaceMockList.RUnlock() + return calls +} + +// ObjectClient calls ObjectClientFunc. +func (mock *VirtualServiceInterfaceMock) ObjectClient() *objectclient.ObjectClient { + if mock.ObjectClientFunc == nil { + panic("VirtualServiceInterfaceMock.ObjectClientFunc: method is nil but VirtualServiceInterface.ObjectClient was just called") + } + callInfo := struct { + }{} + lockVirtualServiceInterfaceMockObjectClient.Lock() + mock.calls.ObjectClient = append(mock.calls.ObjectClient, callInfo) + lockVirtualServiceInterfaceMockObjectClient.Unlock() + return mock.ObjectClientFunc() +} + +// ObjectClientCalls gets all the calls that were made to ObjectClient. +// Check the length with: +// len(mockedVirtualServiceInterface.ObjectClientCalls()) +func (mock *VirtualServiceInterfaceMock) ObjectClientCalls() []struct { +} { + var calls []struct { + } + lockVirtualServiceInterfaceMockObjectClient.RLock() + calls = mock.calls.ObjectClient + lockVirtualServiceInterfaceMockObjectClient.RUnlock() + return calls +} + +// Update calls UpdateFunc. +func (mock *VirtualServiceInterfaceMock) Update(in1 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { + if mock.UpdateFunc == nil { + panic("VirtualServiceInterfaceMock.UpdateFunc: method is nil but VirtualServiceInterface.Update was just called") + } + callInfo := struct { + In1 *v1alpha3.VirtualService + }{ + In1: in1, + } + lockVirtualServiceInterfaceMockUpdate.Lock() + mock.calls.Update = append(mock.calls.Update, callInfo) + lockVirtualServiceInterfaceMockUpdate.Unlock() + return mock.UpdateFunc(in1) +} + +// UpdateCalls gets all the calls that were made to Update. +// Check the length with: +// len(mockedVirtualServiceInterface.UpdateCalls()) +func (mock *VirtualServiceInterfaceMock) UpdateCalls() []struct { + In1 *v1alpha3.VirtualService +} { + var calls []struct { + In1 *v1alpha3.VirtualService + } + lockVirtualServiceInterfaceMockUpdate.RLock() + calls = mock.calls.Update + lockVirtualServiceInterfaceMockUpdate.RUnlock() + return calls +} + +// Watch calls WatchFunc. +func (mock *VirtualServiceInterfaceMock) Watch(opts v1.ListOptions) (watch.Interface, error) { + if mock.WatchFunc == nil { + panic("VirtualServiceInterfaceMock.WatchFunc: method is nil but VirtualServiceInterface.Watch was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockVirtualServiceInterfaceMockWatch.Lock() + mock.calls.Watch = append(mock.calls.Watch, callInfo) + lockVirtualServiceInterfaceMockWatch.Unlock() + return mock.WatchFunc(opts) +} + +// WatchCalls gets all the calls that were made to Watch. +// Check the length with: +// len(mockedVirtualServiceInterface.WatchCalls()) +func (mock *VirtualServiceInterfaceMock) WatchCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockVirtualServiceInterfaceMockWatch.RLock() + calls = mock.calls.Watch + lockVirtualServiceInterfaceMockWatch.RUnlock() + return calls +} + +var ( + lockVirtualServicesGetterMockVirtualServices sync.RWMutex +) + +// Ensure, that VirtualServicesGetterMock does implement VirtualServicesGetter. +// If this is not the case, regenerate this file with moq. +var _ v1alpha3a.VirtualServicesGetter = &VirtualServicesGetterMock{} + +// VirtualServicesGetterMock is a mock implementation of VirtualServicesGetter. +// +// func TestSomethingThatUsesVirtualServicesGetter(t *testing.T) { +// +// // make and configure a mocked VirtualServicesGetter +// mockedVirtualServicesGetter := &VirtualServicesGetterMock{ +// VirtualServicesFunc: func(namespace string) v1alpha3a.VirtualServiceInterface { +// panic("mock out the VirtualServices method") +// }, +// } +// +// // use mockedVirtualServicesGetter in code that requires VirtualServicesGetter +// // and then make assertions. +// +// } +type VirtualServicesGetterMock struct { + // VirtualServicesFunc mocks the VirtualServices method. + VirtualServicesFunc func(namespace string) v1alpha3a.VirtualServiceInterface + + // calls tracks calls to the methods. + calls struct { + // VirtualServices holds details about calls to the VirtualServices method. + VirtualServices []struct { + // Namespace is the namespace argument value. + Namespace string + } + } +} + +// VirtualServices calls VirtualServicesFunc. +func (mock *VirtualServicesGetterMock) VirtualServices(namespace string) v1alpha3a.VirtualServiceInterface { + if mock.VirtualServicesFunc == nil { + panic("VirtualServicesGetterMock.VirtualServicesFunc: method is nil but VirtualServicesGetter.VirtualServices was just called") + } + callInfo := struct { + Namespace string + }{ + Namespace: namespace, + } + lockVirtualServicesGetterMockVirtualServices.Lock() + mock.calls.VirtualServices = append(mock.calls.VirtualServices, callInfo) + lockVirtualServicesGetterMockVirtualServices.Unlock() + return mock.VirtualServicesFunc(namespace) +} + +// VirtualServicesCalls gets all the calls that were made to VirtualServices. +// Check the length with: +// len(mockedVirtualServicesGetter.VirtualServicesCalls()) +func (mock *VirtualServicesGetterMock) VirtualServicesCalls() []struct { + Namespace string +} { + var calls []struct { + Namespace string + } + lockVirtualServicesGetterMockVirtualServices.RLock() + calls = mock.calls.VirtualServices + lockVirtualServicesGetterMockVirtualServices.RUnlock() + return calls +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_deepcopy.go b/apis/networking.istio.io/v1alpha3/zz_generated_deepcopy.go new file mode 100644 index 00000000..61e90826 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_deepcopy.go @@ -0,0 +1,72 @@ +package v1alpha3 + +import ( + istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DestinationRuleList) DeepCopyInto(out *DestinationRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]istiov1alpha3.DestinationRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationRuleList. +func (in *DestinationRuleList) DeepCopy() *DestinationRuleList { + if in == nil { + return nil + } + out := new(DestinationRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DestinationRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualServiceList) DeepCopyInto(out *VirtualServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]istiov1alpha3.VirtualService, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceList. +func (in *VirtualServiceList) DeepCopy() *VirtualServiceList { + if in == nil { + return nil + } + out := new(VirtualServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualServiceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_controller.go b/apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_controller.go new file mode 100644 index 00000000..9ac50508 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_controller.go @@ -0,0 +1,506 @@ +package v1alpha3 + +import ( + "context" + + "github.com/knative/pkg/apis/istio/v1alpha3" + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/resource" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + DestinationRuleGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "DestinationRule", + } + DestinationRuleResource = metav1.APIResource{ + Name: "destinationrules", + SingularName: "destinationrule", + Namespaced: true, + + Kind: DestinationRuleGroupVersionKind.Kind, + } + + DestinationRuleGroupVersionResource = schema.GroupVersionResource{ + Group: GroupName, + Version: Version, + Resource: "destinationrules", + } +) + +func init() { + resource.Put(DestinationRuleGroupVersionResource) +} + +func NewDestinationRule(namespace, name string, obj v1alpha3.DestinationRule) *v1alpha3.DestinationRule { + obj.APIVersion, obj.Kind = DestinationRuleGroupVersionKind.ToAPIVersionAndKind() + obj.Name = name + obj.Namespace = namespace + return &obj +} + +type DestinationRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1alpha3.DestinationRule `json:"items"` +} + +type DestinationRuleHandlerFunc func(key string, obj *v1alpha3.DestinationRule) (runtime.Object, error) + +type DestinationRuleChangeHandlerFunc func(obj *v1alpha3.DestinationRule) (runtime.Object, error) + +type DestinationRuleLister interface { + List(namespace string, selector labels.Selector) (ret []*v1alpha3.DestinationRule, err error) + Get(namespace, name string) (*v1alpha3.DestinationRule, error) +} + +type DestinationRuleController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() DestinationRuleLister + AddHandler(ctx context.Context, name string, handler DestinationRuleHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync DestinationRuleHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler DestinationRuleHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler DestinationRuleHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type DestinationRuleInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1alpha3.DestinationRule, error) + Get(name string, opts metav1.GetOptions) (*v1alpha3.DestinationRule, error) + Update(*v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*DestinationRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() DestinationRuleController + AddHandler(ctx context.Context, name string, sync DestinationRuleHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync DestinationRuleHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle DestinationRuleLifecycle) + AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle DestinationRuleLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync DestinationRuleHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync DestinationRuleHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle DestinationRuleLifecycle) + AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle DestinationRuleLifecycle) +} + +type destinationRuleLister struct { + controller *destinationRuleController +} + +func (l *destinationRuleLister) List(namespace string, selector labels.Selector) (ret []*v1alpha3.DestinationRule, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1alpha3.DestinationRule)) + }) + return +} + +func (l *destinationRuleLister) Get(namespace, name string) (*v1alpha3.DestinationRule, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: DestinationRuleGroupVersionKind.Group, + Resource: "destinationRule", + }, key) + } + return obj.(*v1alpha3.DestinationRule), nil +} + +type destinationRuleController struct { + controller.GenericController +} + +func (c *destinationRuleController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *destinationRuleController) Lister() DestinationRuleLister { + return &destinationRuleLister{ + controller: c, + } +} + +func (c *destinationRuleController) AddHandler(ctx context.Context, name string, handler DestinationRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.DestinationRule); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *destinationRuleController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler DestinationRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if !enabled() { + return nil, nil + } else if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.DestinationRule); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *destinationRuleController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler DestinationRuleHandlerFunc) { + resource.PutClusterScoped(DestinationRuleGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.DestinationRule); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *destinationRuleController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler DestinationRuleHandlerFunc) { + resource.PutClusterScoped(DestinationRuleGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if !enabled() { + return nil, nil + } else if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.DestinationRule); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type destinationRuleFactory struct { +} + +func (c destinationRuleFactory) Object() runtime.Object { + return &v1alpha3.DestinationRule{} +} + +func (c destinationRuleFactory) List() runtime.Object { + return &DestinationRuleList{} +} + +func (s *destinationRuleClient) Controller() DestinationRuleController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.destinationRuleControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(DestinationRuleGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &destinationRuleController{ + GenericController: genericController, + } + + s.client.destinationRuleControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type destinationRuleClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller DestinationRuleController +} + +func (s *destinationRuleClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *destinationRuleClient) Create(o *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1alpha3.DestinationRule), err +} + +func (s *destinationRuleClient) Get(name string, opts metav1.GetOptions) (*v1alpha3.DestinationRule, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1alpha3.DestinationRule), err +} + +func (s *destinationRuleClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1alpha3.DestinationRule, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1alpha3.DestinationRule), err +} + +func (s *destinationRuleClient) Update(o *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1alpha3.DestinationRule), err +} + +func (s *destinationRuleClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *destinationRuleClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *destinationRuleClient) List(opts metav1.ListOptions) (*DestinationRuleList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*DestinationRuleList), err +} + +func (s *destinationRuleClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *destinationRuleClient) Patch(o *v1alpha3.DestinationRule, patchType types.PatchType, data []byte, subresources ...string) (*v1alpha3.DestinationRule, error) { + obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...) + return obj.(*v1alpha3.DestinationRule), err +} + +func (s *destinationRuleClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *destinationRuleClient) AddHandler(ctx context.Context, name string, sync DestinationRuleHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *destinationRuleClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync DestinationRuleHandlerFunc) { + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *destinationRuleClient) AddLifecycle(ctx context.Context, name string, lifecycle DestinationRuleLifecycle) { + sync := NewDestinationRuleLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *destinationRuleClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle DestinationRuleLifecycle) { + sync := NewDestinationRuleLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *destinationRuleClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync DestinationRuleHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *destinationRuleClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync DestinationRuleHandlerFunc) { + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +func (s *destinationRuleClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle DestinationRuleLifecycle) { + sync := NewDestinationRuleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *destinationRuleClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle DestinationRuleLifecycle) { + sync := NewDestinationRuleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +type DestinationRuleIndexer func(obj *v1alpha3.DestinationRule) ([]string, error) + +type DestinationRuleClientCache interface { + Get(namespace, name string) (*v1alpha3.DestinationRule, error) + List(namespace string, selector labels.Selector) ([]*v1alpha3.DestinationRule, error) + + Index(name string, indexer DestinationRuleIndexer) + GetIndexed(name, key string) ([]*v1alpha3.DestinationRule, error) +} + +type DestinationRuleClient interface { + Create(*v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1alpha3.DestinationRule, error) + Update(*v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*DestinationRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() DestinationRuleClientCache + + OnCreate(ctx context.Context, name string, sync DestinationRuleChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync DestinationRuleChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync DestinationRuleChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + ObjectClient() *objectclient.ObjectClient + Interface() DestinationRuleInterface +} + +type destinationRuleClientCache struct { + client *destinationRuleClient2 +} + +type destinationRuleClient2 struct { + iface DestinationRuleInterface + controller DestinationRuleController +} + +func (n *destinationRuleClient2) Interface() DestinationRuleInterface { + return n.iface +} + +func (n *destinationRuleClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *destinationRuleClient2) ObjectClient() *objectclient.ObjectClient { + return n.Interface().ObjectClient() +} + +func (n *destinationRuleClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *destinationRuleClient2) Create(obj *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { + return n.iface.Create(obj) +} + +func (n *destinationRuleClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1alpha3.DestinationRule, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *destinationRuleClient2) Update(obj *v1alpha3.DestinationRule) (*v1alpha3.DestinationRule, error) { + return n.iface.Update(obj) +} + +func (n *destinationRuleClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *destinationRuleClient2) List(namespace string, opts metav1.ListOptions) (*DestinationRuleList, error) { + return n.iface.List(opts) +} + +func (n *destinationRuleClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *destinationRuleClientCache) Get(namespace, name string) (*v1alpha3.DestinationRule, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *destinationRuleClientCache) List(namespace string, selector labels.Selector) ([]*v1alpha3.DestinationRule, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *destinationRuleClient2) Cache() DestinationRuleClientCache { + n.loadController() + return &destinationRuleClientCache{ + client: n, + } +} + +func (n *destinationRuleClient2) OnCreate(ctx context.Context, name string, sync DestinationRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &destinationRuleLifecycleDelegate{create: sync}) +} + +func (n *destinationRuleClient2) OnChange(ctx context.Context, name string, sync DestinationRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &destinationRuleLifecycleDelegate{update: sync}) +} + +func (n *destinationRuleClient2) OnRemove(ctx context.Context, name string, sync DestinationRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &destinationRuleLifecycleDelegate{remove: sync}) +} + +func (n *destinationRuleClientCache) Index(name string, indexer DestinationRuleIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1alpha3.DestinationRule); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *destinationRuleClientCache) GetIndexed(name, key string) ([]*v1alpha3.DestinationRule, error) { + var result []*v1alpha3.DestinationRule + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1alpha3.DestinationRule); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *destinationRuleClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type destinationRuleLifecycleDelegate struct { + create DestinationRuleChangeHandlerFunc + update DestinationRuleChangeHandlerFunc + remove DestinationRuleChangeHandlerFunc +} + +func (n *destinationRuleLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *destinationRuleLifecycleDelegate) Create(obj *v1alpha3.DestinationRule) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *destinationRuleLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *destinationRuleLifecycleDelegate) Remove(obj *v1alpha3.DestinationRule) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *destinationRuleLifecycleDelegate) Updated(obj *v1alpha3.DestinationRule) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_lifecycle_adapter.go b/apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_lifecycle_adapter.go new file mode 100644 index 00000000..64519a9e --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_destination_rule_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1alpha3 + +import ( + "github.com/knative/pkg/apis/istio/v1alpha3" + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type DestinationRuleLifecycle interface { + Create(obj *v1alpha3.DestinationRule) (runtime.Object, error) + Remove(obj *v1alpha3.DestinationRule) (runtime.Object, error) + Updated(obj *v1alpha3.DestinationRule) (runtime.Object, error) +} + +type destinationRuleLifecycleAdapter struct { + lifecycle DestinationRuleLifecycle +} + +func (w *destinationRuleLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *destinationRuleLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *destinationRuleLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1alpha3.DestinationRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *destinationRuleLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1alpha3.DestinationRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *destinationRuleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1alpha3.DestinationRule)) + if o == nil { + return nil, err + } + return o, err +} + +func NewDestinationRuleLifecycleAdapter(name string, clusterScoped bool, client DestinationRuleInterface, l DestinationRuleLifecycle) DestinationRuleHandlerFunc { + adapter := &destinationRuleLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1alpha3.DestinationRule) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_k8s_client.go b/apis/networking.istio.io/v1alpha3/zz_generated_k8s_client.go new file mode 100644 index 00000000..6d16484e --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_k8s_client.go @@ -0,0 +1,139 @@ +package v1alpha3 + +import ( + "context" + "sync" + + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/objectclient/dynamic" + "github.com/rancher/norman/restwatch" + "k8s.io/client-go/rest" +) + +type ( + contextKeyType struct{} + contextClientsKeyType struct{} +) + +type Interface interface { + RESTClient() rest.Interface + controller.Starter + + VirtualServicesGetter + DestinationRulesGetter +} + +type Clients struct { + Interface Interface + + VirtualService VirtualServiceClient + DestinationRule DestinationRuleClient +} + +type Client struct { + sync.Mutex + restClient rest.Interface + starters []controller.Starter + + virtualServiceControllers map[string]VirtualServiceController + destinationRuleControllers map[string]DestinationRuleController +} + +func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) { + c, err := NewForConfig(config) + if err != nil { + return ctx, nil, err + } + + cs := NewClientsFromInterface(c) + + ctx = context.WithValue(ctx, contextKeyType{}, c) + ctx = context.WithValue(ctx, contextClientsKeyType{}, cs) + return ctx, c, nil +} + +func ClientsFrom(ctx context.Context) *Clients { + return ctx.Value(contextClientsKeyType{}).(*Clients) +} + +func From(ctx context.Context) Interface { + return ctx.Value(contextKeyType{}).(Interface) +} + +func NewClients(config rest.Config) (*Clients, error) { + iface, err := NewForConfig(config) + if err != nil { + return nil, err + } + return NewClientsFromInterface(iface), nil +} + +func NewClientsFromInterface(iface Interface) *Clients { + return &Clients{ + Interface: iface, + + VirtualService: &virtualServiceClient2{ + iface: iface.VirtualServices(""), + }, + DestinationRule: &destinationRuleClient2{ + iface: iface.DestinationRules(""), + }, + } +} + +func NewForConfig(config rest.Config) (Interface, error) { + if config.NegotiatedSerializer == nil { + config.NegotiatedSerializer = dynamic.NegotiatedSerializer + } + + restClient, err := restwatch.UnversionedRESTClientFor(&config) + if err != nil { + return nil, err + } + + return &Client{ + restClient: restClient, + + virtualServiceControllers: map[string]VirtualServiceController{}, + destinationRuleControllers: map[string]DestinationRuleController{}, + }, nil +} + +func (c *Client) RESTClient() rest.Interface { + return c.restClient +} + +func (c *Client) Sync(ctx context.Context) error { + return controller.Sync(ctx, c.starters...) +} + +func (c *Client) Start(ctx context.Context, threadiness int) error { + return controller.Start(ctx, threadiness, c.starters...) +} + +type VirtualServicesGetter interface { + VirtualServices(namespace string) VirtualServiceInterface +} + +func (c *Client) VirtualServices(namespace string) VirtualServiceInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &VirtualServiceResource, VirtualServiceGroupVersionKind, virtualServiceFactory{}) + return &virtualServiceClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type DestinationRulesGetter interface { + DestinationRules(namespace string) DestinationRuleInterface +} + +func (c *Client) DestinationRules(namespace string) DestinationRuleInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &DestinationRuleResource, DestinationRuleGroupVersionKind, destinationRuleFactory{}) + return &destinationRuleClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_scheme.go b/apis/networking.istio.io/v1alpha3/zz_generated_scheme.go new file mode 100644 index 00000000..acf8eb74 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_scheme.go @@ -0,0 +1,42 @@ +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "networking.istio.io" + Version = "v1alpha3" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // TODO this gets cleaned up when the types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + + &VirtualServiceList{}, + &DestinationRuleList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_controller.go b/apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_controller.go new file mode 100644 index 00000000..de677292 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_controller.go @@ -0,0 +1,506 @@ +package v1alpha3 + +import ( + "context" + + "github.com/knative/pkg/apis/istio/v1alpha3" + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/resource" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + VirtualServiceGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "VirtualService", + } + VirtualServiceResource = metav1.APIResource{ + Name: "virtualservices", + SingularName: "virtualservice", + Namespaced: true, + + Kind: VirtualServiceGroupVersionKind.Kind, + } + + VirtualServiceGroupVersionResource = schema.GroupVersionResource{ + Group: GroupName, + Version: Version, + Resource: "virtualservices", + } +) + +func init() { + resource.Put(VirtualServiceGroupVersionResource) +} + +func NewVirtualService(namespace, name string, obj v1alpha3.VirtualService) *v1alpha3.VirtualService { + obj.APIVersion, obj.Kind = VirtualServiceGroupVersionKind.ToAPIVersionAndKind() + obj.Name = name + obj.Namespace = namespace + return &obj +} + +type VirtualServiceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1alpha3.VirtualService `json:"items"` +} + +type VirtualServiceHandlerFunc func(key string, obj *v1alpha3.VirtualService) (runtime.Object, error) + +type VirtualServiceChangeHandlerFunc func(obj *v1alpha3.VirtualService) (runtime.Object, error) + +type VirtualServiceLister interface { + List(namespace string, selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) + Get(namespace, name string) (*v1alpha3.VirtualService, error) +} + +type VirtualServiceController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() VirtualServiceLister + AddHandler(ctx context.Context, name string, handler VirtualServiceHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync VirtualServiceHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler VirtualServiceHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler VirtualServiceHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type VirtualServiceInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1alpha3.VirtualService, error) + Get(name string, opts metav1.GetOptions) (*v1alpha3.VirtualService, error) + Update(*v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*VirtualServiceList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() VirtualServiceController + AddHandler(ctx context.Context, name string, sync VirtualServiceHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync VirtualServiceHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle VirtualServiceLifecycle) + AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle VirtualServiceLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync VirtualServiceHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync VirtualServiceHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle VirtualServiceLifecycle) + AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle VirtualServiceLifecycle) +} + +type virtualServiceLister struct { + controller *virtualServiceController +} + +func (l *virtualServiceLister) List(namespace string, selector labels.Selector) (ret []*v1alpha3.VirtualService, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1alpha3.VirtualService)) + }) + return +} + +func (l *virtualServiceLister) Get(namespace, name string) (*v1alpha3.VirtualService, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: VirtualServiceGroupVersionKind.Group, + Resource: "virtualService", + }, key) + } + return obj.(*v1alpha3.VirtualService), nil +} + +type virtualServiceController struct { + controller.GenericController +} + +func (c *virtualServiceController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *virtualServiceController) Lister() VirtualServiceLister { + return &virtualServiceLister{ + controller: c, + } +} + +func (c *virtualServiceController) AddHandler(ctx context.Context, name string, handler VirtualServiceHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.VirtualService); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *virtualServiceController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler VirtualServiceHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if !enabled() { + return nil, nil + } else if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.VirtualService); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *virtualServiceController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler VirtualServiceHandlerFunc) { + resource.PutClusterScoped(VirtualServiceGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.VirtualService); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *virtualServiceController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler VirtualServiceHandlerFunc) { + resource.PutClusterScoped(VirtualServiceGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if !enabled() { + return nil, nil + } else if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1alpha3.VirtualService); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type virtualServiceFactory struct { +} + +func (c virtualServiceFactory) Object() runtime.Object { + return &v1alpha3.VirtualService{} +} + +func (c virtualServiceFactory) List() runtime.Object { + return &VirtualServiceList{} +} + +func (s *virtualServiceClient) Controller() VirtualServiceController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.virtualServiceControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(VirtualServiceGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &virtualServiceController{ + GenericController: genericController, + } + + s.client.virtualServiceControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type virtualServiceClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller VirtualServiceController +} + +func (s *virtualServiceClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *virtualServiceClient) Create(o *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1alpha3.VirtualService), err +} + +func (s *virtualServiceClient) Get(name string, opts metav1.GetOptions) (*v1alpha3.VirtualService, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1alpha3.VirtualService), err +} + +func (s *virtualServiceClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1alpha3.VirtualService, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1alpha3.VirtualService), err +} + +func (s *virtualServiceClient) Update(o *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1alpha3.VirtualService), err +} + +func (s *virtualServiceClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *virtualServiceClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *virtualServiceClient) List(opts metav1.ListOptions) (*VirtualServiceList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*VirtualServiceList), err +} + +func (s *virtualServiceClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *virtualServiceClient) Patch(o *v1alpha3.VirtualService, patchType types.PatchType, data []byte, subresources ...string) (*v1alpha3.VirtualService, error) { + obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...) + return obj.(*v1alpha3.VirtualService), err +} + +func (s *virtualServiceClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *virtualServiceClient) AddHandler(ctx context.Context, name string, sync VirtualServiceHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *virtualServiceClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync VirtualServiceHandlerFunc) { + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *virtualServiceClient) AddLifecycle(ctx context.Context, name string, lifecycle VirtualServiceLifecycle) { + sync := NewVirtualServiceLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *virtualServiceClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle VirtualServiceLifecycle) { + sync := NewVirtualServiceLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *virtualServiceClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync VirtualServiceHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *virtualServiceClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync VirtualServiceHandlerFunc) { + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +func (s *virtualServiceClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle VirtualServiceLifecycle) { + sync := NewVirtualServiceLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *virtualServiceClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle VirtualServiceLifecycle) { + sync := NewVirtualServiceLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +type VirtualServiceIndexer func(obj *v1alpha3.VirtualService) ([]string, error) + +type VirtualServiceClientCache interface { + Get(namespace, name string) (*v1alpha3.VirtualService, error) + List(namespace string, selector labels.Selector) ([]*v1alpha3.VirtualService, error) + + Index(name string, indexer VirtualServiceIndexer) + GetIndexed(name, key string) ([]*v1alpha3.VirtualService, error) +} + +type VirtualServiceClient interface { + Create(*v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1alpha3.VirtualService, error) + Update(*v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*VirtualServiceList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() VirtualServiceClientCache + + OnCreate(ctx context.Context, name string, sync VirtualServiceChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync VirtualServiceChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync VirtualServiceChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + ObjectClient() *objectclient.ObjectClient + Interface() VirtualServiceInterface +} + +type virtualServiceClientCache struct { + client *virtualServiceClient2 +} + +type virtualServiceClient2 struct { + iface VirtualServiceInterface + controller VirtualServiceController +} + +func (n *virtualServiceClient2) Interface() VirtualServiceInterface { + return n.iface +} + +func (n *virtualServiceClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *virtualServiceClient2) ObjectClient() *objectclient.ObjectClient { + return n.Interface().ObjectClient() +} + +func (n *virtualServiceClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *virtualServiceClient2) Create(obj *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { + return n.iface.Create(obj) +} + +func (n *virtualServiceClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1alpha3.VirtualService, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *virtualServiceClient2) Update(obj *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) { + return n.iface.Update(obj) +} + +func (n *virtualServiceClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *virtualServiceClient2) List(namespace string, opts metav1.ListOptions) (*VirtualServiceList, error) { + return n.iface.List(opts) +} + +func (n *virtualServiceClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *virtualServiceClientCache) Get(namespace, name string) (*v1alpha3.VirtualService, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *virtualServiceClientCache) List(namespace string, selector labels.Selector) ([]*v1alpha3.VirtualService, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *virtualServiceClient2) Cache() VirtualServiceClientCache { + n.loadController() + return &virtualServiceClientCache{ + client: n, + } +} + +func (n *virtualServiceClient2) OnCreate(ctx context.Context, name string, sync VirtualServiceChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &virtualServiceLifecycleDelegate{create: sync}) +} + +func (n *virtualServiceClient2) OnChange(ctx context.Context, name string, sync VirtualServiceChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &virtualServiceLifecycleDelegate{update: sync}) +} + +func (n *virtualServiceClient2) OnRemove(ctx context.Context, name string, sync VirtualServiceChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &virtualServiceLifecycleDelegate{remove: sync}) +} + +func (n *virtualServiceClientCache) Index(name string, indexer VirtualServiceIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1alpha3.VirtualService); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *virtualServiceClientCache) GetIndexed(name, key string) ([]*v1alpha3.VirtualService, error) { + var result []*v1alpha3.VirtualService + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1alpha3.VirtualService); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *virtualServiceClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type virtualServiceLifecycleDelegate struct { + create VirtualServiceChangeHandlerFunc + update VirtualServiceChangeHandlerFunc + remove VirtualServiceChangeHandlerFunc +} + +func (n *virtualServiceLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *virtualServiceLifecycleDelegate) Create(obj *v1alpha3.VirtualService) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *virtualServiceLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *virtualServiceLifecycleDelegate) Remove(obj *v1alpha3.VirtualService) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *virtualServiceLifecycleDelegate) Updated(obj *v1alpha3.VirtualService) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_lifecycle_adapter.go b/apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_lifecycle_adapter.go new file mode 100644 index 00000000..bbd06a30 --- /dev/null +++ b/apis/networking.istio.io/v1alpha3/zz_generated_virtual_service_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1alpha3 + +import ( + "github.com/knative/pkg/apis/istio/v1alpha3" + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type VirtualServiceLifecycle interface { + Create(obj *v1alpha3.VirtualService) (runtime.Object, error) + Remove(obj *v1alpha3.VirtualService) (runtime.Object, error) + Updated(obj *v1alpha3.VirtualService) (runtime.Object, error) +} + +type virtualServiceLifecycleAdapter struct { + lifecycle VirtualServiceLifecycle +} + +func (w *virtualServiceLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *virtualServiceLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *virtualServiceLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1alpha3.VirtualService)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *virtualServiceLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1alpha3.VirtualService)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *virtualServiceLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1alpha3.VirtualService)) + if o == nil { + return nil, err + } + return o, err +} + +func NewVirtualServiceLifecycleAdapter(name string, clusterScoped bool, client VirtualServiceInterface, l VirtualServiceLifecycle) VirtualServiceHandlerFunc { + adapter := &virtualServiceLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1alpha3.VirtualService) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/client/project/v3/zz_generated_client.go b/client/project/v3/zz_generated_client.go index 0fbd8fd0..f6a2a78c 100644 --- a/client/project/v3/zz_generated_client.go +++ b/client/project/v3/zz_generated_client.go @@ -47,6 +47,8 @@ type Client struct { PrometheusRule PrometheusRuleOperations Alertmanager AlertmanagerOperations HorizontalPodAutoscaler HorizontalPodAutoscalerOperations + VirtualService VirtualServiceOperations + DestinationRule DestinationRuleOperations } func NewClient(opts *clientbase.ClientOpts) (*Client, error) { @@ -99,6 +101,8 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.PrometheusRule = newPrometheusRuleClient(client) client.Alertmanager = newAlertmanagerClient(client) client.HorizontalPodAutoscaler = newHorizontalPodAutoscalerClient(client) + client.VirtualService = newVirtualServiceClient(client) + client.DestinationRule = newDestinationRuleClient(client) return client, nil } diff --git a/client/project/v3/zz_generated_connection_pool_settings.go b/client/project/v3/zz_generated_connection_pool_settings.go new file mode 100644 index 00000000..2218a7a3 --- /dev/null +++ b/client/project/v3/zz_generated_connection_pool_settings.go @@ -0,0 +1,12 @@ +package client + +const ( + ConnectionPoolSettingsType = "connectionPoolSettings" + ConnectionPoolSettingsFieldHTTP = "http" + ConnectionPoolSettingsFieldTCP = "tcp" +) + +type ConnectionPoolSettings struct { + HTTP *HTTPSettings `json:"http,omitempty" yaml:"http,omitempty"` + TCP *TCPSettings `json:"tcp,omitempty" yaml:"tcp,omitempty"` +} diff --git a/client/project/v3/zz_generated_consistent_hash_lb.go b/client/project/v3/zz_generated_consistent_hash_lb.go new file mode 100644 index 00000000..f248a849 --- /dev/null +++ b/client/project/v3/zz_generated_consistent_hash_lb.go @@ -0,0 +1,16 @@ +package client + +const ( + ConsistentHashLBType = "consistentHashLB" + ConsistentHashLBFieldHTTPCookie = "httpCookie" + ConsistentHashLBFieldHTTPHeaderName = "httpHeaderName" + ConsistentHashLBFieldMinimumRingSize = "minimumRingSize" + ConsistentHashLBFieldUseSourceIP = "useSourceIp" +) + +type ConsistentHashLB struct { + HTTPCookie *HTTPCookie `json:"httpCookie,omitempty" yaml:"httpCookie,omitempty"` + HTTPHeaderName string `json:"httpHeaderName,omitempty" yaml:"httpHeaderName,omitempty"` + MinimumRingSize int64 `json:"minimumRingSize,omitempty" yaml:"minimumRingSize,omitempty"` + UseSourceIP bool `json:"useSourceIp,omitempty" yaml:"useSourceIp,omitempty"` +} diff --git a/client/project/v3/zz_generated_cors_policy.go b/client/project/v3/zz_generated_cors_policy.go new file mode 100644 index 00000000..6c1b44e9 --- /dev/null +++ b/client/project/v3/zz_generated_cors_policy.go @@ -0,0 +1,20 @@ +package client + +const ( + CorsPolicyType = "corsPolicy" + CorsPolicyFieldAllowCredentials = "allowCredentials" + CorsPolicyFieldAllowHeaders = "allowHeaders" + CorsPolicyFieldAllowMethods = "allowMethods" + CorsPolicyFieldAllowOrigin = "allowOrigin" + CorsPolicyFieldExposeHeaders = "exposeHeaders" + CorsPolicyFieldMaxAge = "maxAge" +) + +type CorsPolicy struct { + AllowCredentials bool `json:"allowCredentials,omitempty" yaml:"allowCredentials,omitempty"` + AllowHeaders []string `json:"allowHeaders,omitempty" yaml:"allowHeaders,omitempty"` + AllowMethods []string `json:"allowMethods,omitempty" yaml:"allowMethods,omitempty"` + AllowOrigin []string `json:"allowOrigin,omitempty" yaml:"allowOrigin,omitempty"` + ExposeHeaders []string `json:"exposeHeaders,omitempty" yaml:"exposeHeaders,omitempty"` + MaxAge string `json:"maxAge,omitempty" yaml:"maxAge,omitempty"` +} diff --git a/client/project/v3/zz_generated_destination.go b/client/project/v3/zz_generated_destination.go new file mode 100644 index 00000000..51d1b083 --- /dev/null +++ b/client/project/v3/zz_generated_destination.go @@ -0,0 +1,14 @@ +package client + +const ( + DestinationType = "destination" + DestinationFieldHost = "host" + DestinationFieldPort = "port" + DestinationFieldSubset = "subset" +) + +type Destination struct { + Host string `json:"host,omitempty" yaml:"host,omitempty"` + Port *PortSelector `json:"port,omitempty" yaml:"port,omitempty"` + Subset string `json:"subset,omitempty" yaml:"subset,omitempty"` +} diff --git a/client/project/v3/zz_generated_destination_rule.go b/client/project/v3/zz_generated_destination_rule.go new file mode 100644 index 00000000..ed478d53 --- /dev/null +++ b/client/project/v3/zz_generated_destination_rule.go @@ -0,0 +1,117 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + DestinationRuleType = "destinationRule" + DestinationRuleFieldAnnotations = "annotations" + DestinationRuleFieldCreated = "created" + DestinationRuleFieldCreatorID = "creatorId" + DestinationRuleFieldHost = "host" + DestinationRuleFieldLabels = "labels" + DestinationRuleFieldName = "name" + DestinationRuleFieldNamespaceId = "namespaceId" + DestinationRuleFieldOwnerReferences = "ownerReferences" + DestinationRuleFieldProjectID = "projectId" + DestinationRuleFieldRemoved = "removed" + DestinationRuleFieldState = "state" + DestinationRuleFieldStatus = "status" + DestinationRuleFieldSubsets = "subsets" + DestinationRuleFieldTrafficPolicy = "trafficPolicy" + DestinationRuleFieldTransitioning = "transitioning" + DestinationRuleFieldTransitioningMessage = "transitioningMessage" + DestinationRuleFieldUUID = "uuid" +) + +type DestinationRule struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Host string `json:"host,omitempty" yaml:"host,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + Status interface{} `json:"status,omitempty" yaml:"status,omitempty"` + Subsets []Subset `json:"subsets,omitempty" yaml:"subsets,omitempty"` + TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty" yaml:"trafficPolicy,omitempty"` + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type DestinationRuleCollection struct { + types.Collection + Data []DestinationRule `json:"data,omitempty"` + client *DestinationRuleClient +} + +type DestinationRuleClient struct { + apiClient *Client +} + +type DestinationRuleOperations interface { + List(opts *types.ListOpts) (*DestinationRuleCollection, error) + Create(opts *DestinationRule) (*DestinationRule, error) + Update(existing *DestinationRule, updates interface{}) (*DestinationRule, error) + Replace(existing *DestinationRule) (*DestinationRule, error) + ByID(id string) (*DestinationRule, error) + Delete(container *DestinationRule) error +} + +func newDestinationRuleClient(apiClient *Client) *DestinationRuleClient { + return &DestinationRuleClient{ + apiClient: apiClient, + } +} + +func (c *DestinationRuleClient) Create(container *DestinationRule) (*DestinationRule, error) { + resp := &DestinationRule{} + err := c.apiClient.Ops.DoCreate(DestinationRuleType, container, resp) + return resp, err +} + +func (c *DestinationRuleClient) Update(existing *DestinationRule, updates interface{}) (*DestinationRule, error) { + resp := &DestinationRule{} + err := c.apiClient.Ops.DoUpdate(DestinationRuleType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *DestinationRuleClient) Replace(obj *DestinationRule) (*DestinationRule, error) { + resp := &DestinationRule{} + err := c.apiClient.Ops.DoReplace(DestinationRuleType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *DestinationRuleClient) List(opts *types.ListOpts) (*DestinationRuleCollection, error) { + resp := &DestinationRuleCollection{} + err := c.apiClient.Ops.DoList(DestinationRuleType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *DestinationRuleCollection) Next() (*DestinationRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &DestinationRuleCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *DestinationRuleClient) ByID(id string) (*DestinationRule, error) { + resp := &DestinationRule{} + err := c.apiClient.Ops.DoByID(DestinationRuleType, id, resp) + return resp, err +} + +func (c *DestinationRuleClient) Delete(container *DestinationRule) error { + return c.apiClient.Ops.DoResourceDelete(DestinationRuleType, &container.Resource) +} diff --git a/client/project/v3/zz_generated_destination_rule_spec.go b/client/project/v3/zz_generated_destination_rule_spec.go new file mode 100644 index 00000000..5127c64d --- /dev/null +++ b/client/project/v3/zz_generated_destination_rule_spec.go @@ -0,0 +1,14 @@ +package client + +const ( + DestinationRuleSpecType = "destinationRuleSpec" + DestinationRuleSpecFieldHost = "host" + DestinationRuleSpecFieldSubsets = "subsets" + DestinationRuleSpecFieldTrafficPolicy = "trafficPolicy" +) + +type DestinationRuleSpec struct { + Host string `json:"host,omitempty" yaml:"host,omitempty"` + Subsets []Subset `json:"subsets,omitempty" yaml:"subsets,omitempty"` + TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty" yaml:"trafficPolicy,omitempty"` +} diff --git a/client/project/v3/zz_generated_header_operations.go b/client/project/v3/zz_generated_header_operations.go new file mode 100644 index 00000000..a6d7e9b1 --- /dev/null +++ b/client/project/v3/zz_generated_header_operations.go @@ -0,0 +1,14 @@ +package client + +const ( + HeaderOperationsType = "headerOperations" + HeaderOperationsFieldAdd = "add" + HeaderOperationsFieldRemove = "remove" + HeaderOperationsFieldSet = "set" +) + +type HeaderOperations struct { + Add map[string]string `json:"add,omitempty" yaml:"add,omitempty"` + Remove []string `json:"remove,omitempty" yaml:"remove,omitempty"` + Set map[string]string `json:"set,omitempty" yaml:"set,omitempty"` +} diff --git a/client/project/v3/zz_generated_headers.go b/client/project/v3/zz_generated_headers.go new file mode 100644 index 00000000..ab92e1ce --- /dev/null +++ b/client/project/v3/zz_generated_headers.go @@ -0,0 +1,12 @@ +package client + +const ( + HeadersType = "headers" + HeadersFieldRequest = "request" + HeadersFieldResponse = "response" +) + +type Headers struct { + Request *HeaderOperations `json:"request,omitempty" yaml:"request,omitempty"` + Response *HeaderOperations `json:"response,omitempty" yaml:"response,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_cookie.go b/client/project/v3/zz_generated_http_cookie.go new file mode 100644 index 00000000..4c5d1b99 --- /dev/null +++ b/client/project/v3/zz_generated_http_cookie.go @@ -0,0 +1,14 @@ +package client + +const ( + HTTPCookieType = "httpCookie" + HTTPCookieFieldName = "name" + HTTPCookieFieldPath = "path" + HTTPCookieFieldTTL = "ttl" +) + +type HTTPCookie struct { + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Path string `json:"path,omitempty" yaml:"path,omitempty"` + TTL string `json:"ttl,omitempty" yaml:"ttl,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_fault_injection.go b/client/project/v3/zz_generated_http_fault_injection.go new file mode 100644 index 00000000..fe98c075 --- /dev/null +++ b/client/project/v3/zz_generated_http_fault_injection.go @@ -0,0 +1,12 @@ +package client + +const ( + HTTPFaultInjectionType = "httpFaultInjection" + HTTPFaultInjectionFieldAbort = "abort" + HTTPFaultInjectionFieldDelay = "delay" +) + +type HTTPFaultInjection struct { + Abort *InjectAbort `json:"abort,omitempty" yaml:"abort,omitempty"` + Delay *InjectDelay `json:"delay,omitempty" yaml:"delay,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_match_request.go b/client/project/v3/zz_generated_http_match_request.go new file mode 100644 index 00000000..f7eac8f4 --- /dev/null +++ b/client/project/v3/zz_generated_http_match_request.go @@ -0,0 +1,24 @@ +package client + +const ( + HTTPMatchRequestType = "httpMatchRequest" + HTTPMatchRequestFieldAuthority = "authority" + HTTPMatchRequestFieldGateways = "gateways" + HTTPMatchRequestFieldHeaders = "headers" + HTTPMatchRequestFieldMethod = "method" + HTTPMatchRequestFieldPort = "port" + HTTPMatchRequestFieldScheme = "scheme" + HTTPMatchRequestFieldSourceLabels = "sourceLabels" + HTTPMatchRequestFieldURI = "uri" +) + +type HTTPMatchRequest struct { + Authority *StringMatch `json:"authority,omitempty" yaml:"authority,omitempty"` + Gateways []string `json:"gateways,omitempty" yaml:"gateways,omitempty"` + Headers map[string]StringMatch `json:"headers,omitempty" yaml:"headers,omitempty"` + Method *StringMatch `json:"method,omitempty" yaml:"method,omitempty"` + Port *int64 `json:"port,omitempty" yaml:"port,omitempty"` + Scheme *StringMatch `json:"scheme,omitempty" yaml:"scheme,omitempty"` + SourceLabels map[string]string `json:"sourceLabels,omitempty" yaml:"sourceLabels,omitempty"` + URI *StringMatch `json:"uri,omitempty" yaml:"uri,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_redirect.go b/client/project/v3/zz_generated_http_redirect.go new file mode 100644 index 00000000..29efd0cd --- /dev/null +++ b/client/project/v3/zz_generated_http_redirect.go @@ -0,0 +1,12 @@ +package client + +const ( + HTTPRedirectType = "httpRedirect" + HTTPRedirectFieldAuthority = "authority" + HTTPRedirectFieldURI = "uri" +) + +type HTTPRedirect struct { + Authority string `json:"authority,omitempty" yaml:"authority,omitempty"` + URI string `json:"uri,omitempty" yaml:"uri,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_retry.go b/client/project/v3/zz_generated_http_retry.go new file mode 100644 index 00000000..654c94a4 --- /dev/null +++ b/client/project/v3/zz_generated_http_retry.go @@ -0,0 +1,12 @@ +package client + +const ( + HTTPRetryType = "httpRetry" + HTTPRetryFieldAttempts = "attempts" + HTTPRetryFieldPerTryTimeout = "perTryTimeout" +) + +type HTTPRetry struct { + Attempts int64 `json:"attempts,omitempty" yaml:"attempts,omitempty"` + PerTryTimeout string `json:"perTryTimeout,omitempty" yaml:"perTryTimeout,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_rewrite.go b/client/project/v3/zz_generated_http_rewrite.go new file mode 100644 index 00000000..8724c049 --- /dev/null +++ b/client/project/v3/zz_generated_http_rewrite.go @@ -0,0 +1,12 @@ +package client + +const ( + HTTPRewriteType = "httpRewrite" + HTTPRewriteFieldAuthority = "authority" + HTTPRewriteFieldURI = "uri" +) + +type HTTPRewrite struct { + Authority string `json:"authority,omitempty" yaml:"authority,omitempty"` + URI string `json:"uri,omitempty" yaml:"uri,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_route.go b/client/project/v3/zz_generated_http_route.go new file mode 100644 index 00000000..1fa40bff --- /dev/null +++ b/client/project/v3/zz_generated_http_route.go @@ -0,0 +1,34 @@ +package client + +const ( + HTTPRouteType = "httpRoute" + HTTPRouteFieldCorsPolicy = "corsPolicy" + HTTPRouteFieldDeprecatedAppendHeaders = "appendHeaders" + HTTPRouteFieldFault = "fault" + HTTPRouteFieldHeaders = "headers" + HTTPRouteFieldMatch = "match" + HTTPRouteFieldMirror = "mirror" + HTTPRouteFieldRedirect = "redirect" + HTTPRouteFieldRemoveResponseHeaders = "removeResponseHeaders" + HTTPRouteFieldRetries = "retries" + HTTPRouteFieldRewrite = "rewrite" + HTTPRouteFieldRoute = "route" + HTTPRouteFieldTimeout = "timeout" + HTTPRouteFieldWebsocketUpgrade = "websocketUpgrade" +) + +type HTTPRoute struct { + CorsPolicy *CorsPolicy `json:"corsPolicy,omitempty" yaml:"corsPolicy,omitempty"` + DeprecatedAppendHeaders map[string]string `json:"appendHeaders,omitempty" yaml:"appendHeaders,omitempty"` + Fault *HTTPFaultInjection `json:"fault,omitempty" yaml:"fault,omitempty"` + Headers *Headers `json:"headers,omitempty" yaml:"headers,omitempty"` + Match []HTTPMatchRequest `json:"match,omitempty" yaml:"match,omitempty"` + Mirror *Destination `json:"mirror,omitempty" yaml:"mirror,omitempty"` + Redirect *HTTPRedirect `json:"redirect,omitempty" yaml:"redirect,omitempty"` + RemoveResponseHeaders map[string]string `json:"removeResponseHeaders,omitempty" yaml:"removeResponseHeaders,omitempty"` + Retries *HTTPRetry `json:"retries,omitempty" yaml:"retries,omitempty"` + Rewrite *HTTPRewrite `json:"rewrite,omitempty" yaml:"rewrite,omitempty"` + Route []HTTPRouteDestination `json:"route,omitempty" yaml:"route,omitempty"` + Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"` + WebsocketUpgrade *bool `json:"websocketUpgrade,omitempty" yaml:"websocketUpgrade,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_route_destination.go b/client/project/v3/zz_generated_http_route_destination.go new file mode 100644 index 00000000..05692a30 --- /dev/null +++ b/client/project/v3/zz_generated_http_route_destination.go @@ -0,0 +1,14 @@ +package client + +const ( + HTTPRouteDestinationType = "httpRouteDestination" + HTTPRouteDestinationFieldDestination = "destination" + HTTPRouteDestinationFieldHeaders = "headers" + HTTPRouteDestinationFieldWeight = "weight" +) + +type HTTPRouteDestination struct { + Destination *Destination `json:"destination,omitempty" yaml:"destination,omitempty"` + Headers *Headers `json:"headers,omitempty" yaml:"headers,omitempty"` + Weight int64 `json:"weight,omitempty" yaml:"weight,omitempty"` +} diff --git a/client/project/v3/zz_generated_http_settings.go b/client/project/v3/zz_generated_http_settings.go new file mode 100644 index 00000000..dc04c2b6 --- /dev/null +++ b/client/project/v3/zz_generated_http_settings.go @@ -0,0 +1,16 @@ +package client + +const ( + HTTPSettingsType = "httpSettings" + HTTPSettingsFieldHTTP1MaxPendingRequests = "http1MaxPendingRequests" + HTTPSettingsFieldHTTP2MaxRequests = "http2MaxRequests" + HTTPSettingsFieldMaxRequestsPerConnection = "maxRequestsPerConnection" + HTTPSettingsFieldMaxRetries = "maxRetries" +) + +type HTTPSettings struct { + HTTP1MaxPendingRequests int64 `json:"http1MaxPendingRequests,omitempty" yaml:"http1MaxPendingRequests,omitempty"` + HTTP2MaxRequests int64 `json:"http2MaxRequests,omitempty" yaml:"http2MaxRequests,omitempty"` + MaxRequestsPerConnection int64 `json:"maxRequestsPerConnection,omitempty" yaml:"maxRequestsPerConnection,omitempty"` + MaxRetries int64 `json:"maxRetries,omitempty" yaml:"maxRetries,omitempty"` +} diff --git a/client/project/v3/zz_generated_inject_abort.go b/client/project/v3/zz_generated_inject_abort.go new file mode 100644 index 00000000..1642770b --- /dev/null +++ b/client/project/v3/zz_generated_inject_abort.go @@ -0,0 +1,12 @@ +package client + +const ( + InjectAbortType = "injectAbort" + InjectAbortFieldHTTPStatus = "httpStatus" + InjectAbortFieldPercent = "percent" +) + +type InjectAbort struct { + HTTPStatus int64 `json:"httpStatus,omitempty" yaml:"httpStatus,omitempty"` + Percent int64 `json:"percent,omitempty" yaml:"percent,omitempty"` +} diff --git a/client/project/v3/zz_generated_inject_delay.go b/client/project/v3/zz_generated_inject_delay.go new file mode 100644 index 00000000..fab6cb64 --- /dev/null +++ b/client/project/v3/zz_generated_inject_delay.go @@ -0,0 +1,14 @@ +package client + +const ( + InjectDelayType = "injectDelay" + InjectDelayFieldExponentialDelay = "exponentialDelay" + InjectDelayFieldFixedDelay = "fixedDelay" + InjectDelayFieldPercent = "percent" +) + +type InjectDelay struct { + ExponentialDelay string `json:"exponentialDelay,omitempty" yaml:"exponentialDelay,omitempty"` + FixedDelay string `json:"fixedDelay,omitempty" yaml:"fixedDelay,omitempty"` + Percent int64 `json:"percent,omitempty" yaml:"percent,omitempty"` +} diff --git a/client/project/v3/zz_generated_l4match_attributes.go b/client/project/v3/zz_generated_l4match_attributes.go new file mode 100644 index 00000000..5d6c2952 --- /dev/null +++ b/client/project/v3/zz_generated_l4match_attributes.go @@ -0,0 +1,16 @@ +package client + +const ( + L4MatchAttributesType = "l4MatchAttributes" + L4MatchAttributesFieldDestinationSubnets = "destinationSubnets" + L4MatchAttributesFieldGateways = "gateways" + L4MatchAttributesFieldPort = "port" + L4MatchAttributesFieldSourceLabels = "sourceLabels" +) + +type L4MatchAttributes struct { + DestinationSubnets []string `json:"destinationSubnets,omitempty" yaml:"destinationSubnets,omitempty"` + Gateways []string `json:"gateways,omitempty" yaml:"gateways,omitempty"` + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + SourceLabels map[string]string `json:"sourceLabels,omitempty" yaml:"sourceLabels,omitempty"` +} diff --git a/client/project/v3/zz_generated_load_balancer_settings.go b/client/project/v3/zz_generated_load_balancer_settings.go new file mode 100644 index 00000000..8bbb896f --- /dev/null +++ b/client/project/v3/zz_generated_load_balancer_settings.go @@ -0,0 +1,12 @@ +package client + +const ( + LoadBalancerSettingsType = "loadBalancerSettings" + LoadBalancerSettingsFieldConsistentHash = "consistentHash" + LoadBalancerSettingsFieldSimple = "simple" +) + +type LoadBalancerSettings struct { + ConsistentHash *ConsistentHashLB `json:"consistentHash,omitempty" yaml:"consistentHash,omitempty"` + Simple string `json:"simple,omitempty" yaml:"simple,omitempty"` +} diff --git a/client/project/v3/zz_generated_outlier_detection.go b/client/project/v3/zz_generated_outlier_detection.go new file mode 100644 index 00000000..856a22f5 --- /dev/null +++ b/client/project/v3/zz_generated_outlier_detection.go @@ -0,0 +1,16 @@ +package client + +const ( + OutlierDetectionType = "outlierDetection" + OutlierDetectionFieldBaseEjectionTime = "baseEjectionTime" + OutlierDetectionFieldConsecutiveErrors = "consecutiveErrors" + OutlierDetectionFieldInterval = "interval" + OutlierDetectionFieldMaxEjectionPercent = "maxEjectionPercent" +) + +type OutlierDetection struct { + BaseEjectionTime string `json:"baseEjectionTime,omitempty" yaml:"baseEjectionTime,omitempty"` + ConsecutiveErrors int64 `json:"consecutiveErrors,omitempty" yaml:"consecutiveErrors,omitempty"` + Interval string `json:"interval,omitempty" yaml:"interval,omitempty"` + MaxEjectionPercent int64 `json:"maxEjectionPercent,omitempty" yaml:"maxEjectionPercent,omitempty"` +} diff --git a/client/project/v3/zz_generated_port_selector.go b/client/project/v3/zz_generated_port_selector.go new file mode 100644 index 00000000..9b9614c7 --- /dev/null +++ b/client/project/v3/zz_generated_port_selector.go @@ -0,0 +1,12 @@ +package client + +const ( + PortSelectorType = "portSelector" + PortSelectorFieldName = "name" + PortSelectorFieldNumber = "number" +) + +type PortSelector struct { + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Number int64 `json:"number,omitempty" yaml:"number,omitempty"` +} diff --git a/client/project/v3/zz_generated_port_traffic_policy.go b/client/project/v3/zz_generated_port_traffic_policy.go new file mode 100644 index 00000000..84ebc46c --- /dev/null +++ b/client/project/v3/zz_generated_port_traffic_policy.go @@ -0,0 +1,18 @@ +package client + +const ( + PortTrafficPolicyType = "portTrafficPolicy" + PortTrafficPolicyFieldConnectionPool = "connectionPool" + PortTrafficPolicyFieldLoadBalancer = "loadBalancer" + PortTrafficPolicyFieldOutlierDetection = "outlierDetection" + PortTrafficPolicyFieldPort = "port" + PortTrafficPolicyFieldTLS = "tls" +) + +type PortTrafficPolicy struct { + ConnectionPool *ConnectionPoolSettings `json:"connectionPool,omitempty" yaml:"connectionPool,omitempty"` + LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"` + OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty" yaml:"outlierDetection,omitempty"` + Port *PortSelector `json:"port,omitempty" yaml:"port,omitempty"` + TLS *TLSSettings `json:"tls,omitempty" yaml:"tls,omitempty"` +} diff --git a/client/project/v3/zz_generated_string_match.go b/client/project/v3/zz_generated_string_match.go new file mode 100644 index 00000000..3195aaf0 --- /dev/null +++ b/client/project/v3/zz_generated_string_match.go @@ -0,0 +1,16 @@ +package client + +const ( + StringMatchType = "stringMatch" + StringMatchFieldExact = "exact" + StringMatchFieldPrefix = "prefix" + StringMatchFieldRegex = "regex" + StringMatchFieldSuffix = "suffix" +) + +type StringMatch struct { + Exact string `json:"exact,omitempty" yaml:"exact,omitempty"` + Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"` + Regex string `json:"regex,omitempty" yaml:"regex,omitempty"` + Suffix string `json:"suffix,omitempty" yaml:"suffix,omitempty"` +} diff --git a/client/project/v3/zz_generated_subset.go b/client/project/v3/zz_generated_subset.go new file mode 100644 index 00000000..e4c98327 --- /dev/null +++ b/client/project/v3/zz_generated_subset.go @@ -0,0 +1,14 @@ +package client + +const ( + SubsetType = "subset" + SubsetFieldLabels = "labels" + SubsetFieldName = "name" + SubsetFieldTrafficPolicy = "trafficPolicy" +) + +type Subset struct { + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty" yaml:"trafficPolicy,omitempty"` +} diff --git a/client/project/v3/zz_generated_tcp_route.go b/client/project/v3/zz_generated_tcp_route.go new file mode 100644 index 00000000..756c9360 --- /dev/null +++ b/client/project/v3/zz_generated_tcp_route.go @@ -0,0 +1,12 @@ +package client + +const ( + TCPRouteType = "tcpRoute" + TCPRouteFieldMatch = "match" + TCPRouteFieldRoute = "route" +) + +type TCPRoute struct { + Match []L4MatchAttributes `json:"match,omitempty" yaml:"match,omitempty"` + Route []HTTPRouteDestination `json:"route,omitempty" yaml:"route,omitempty"` +} diff --git a/client/project/v3/zz_generated_tcp_settings.go b/client/project/v3/zz_generated_tcp_settings.go new file mode 100644 index 00000000..6eebee8e --- /dev/null +++ b/client/project/v3/zz_generated_tcp_settings.go @@ -0,0 +1,12 @@ +package client + +const ( + TCPSettingsType = "tcpSettings" + TCPSettingsFieldConnectTimeout = "connectTimeout" + TCPSettingsFieldMaxConnections = "maxConnections" +) + +type TCPSettings struct { + ConnectTimeout string `json:"connectTimeout,omitempty" yaml:"connectTimeout,omitempty"` + MaxConnections int64 `json:"maxConnections,omitempty" yaml:"maxConnections,omitempty"` +} diff --git a/client/project/v3/zz_generated_tls_match_attributes.go b/client/project/v3/zz_generated_tls_match_attributes.go new file mode 100644 index 00000000..d858551a --- /dev/null +++ b/client/project/v3/zz_generated_tls_match_attributes.go @@ -0,0 +1,18 @@ +package client + +const ( + TLSMatchAttributesType = "tlsMatchAttributes" + TLSMatchAttributesFieldDestinationSubnets = "destinationSubnets" + TLSMatchAttributesFieldGateways = "gateways" + TLSMatchAttributesFieldPort = "port" + TLSMatchAttributesFieldSniHosts = "sniHosts" + TLSMatchAttributesFieldSourceLabels = "sourceLabels" +) + +type TLSMatchAttributes struct { + DestinationSubnets []string `json:"destinationSubnets,omitempty" yaml:"destinationSubnets,omitempty"` + Gateways []string `json:"gateways,omitempty" yaml:"gateways,omitempty"` + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + SniHosts []string `json:"sniHosts,omitempty" yaml:"sniHosts,omitempty"` + SourceLabels map[string]string `json:"sourceLabels,omitempty" yaml:"sourceLabels,omitempty"` +} diff --git a/client/project/v3/zz_generated_tls_route.go b/client/project/v3/zz_generated_tls_route.go new file mode 100644 index 00000000..9bf11e5f --- /dev/null +++ b/client/project/v3/zz_generated_tls_route.go @@ -0,0 +1,12 @@ +package client + +const ( + TLSRouteType = "tlsRoute" + TLSRouteFieldMatch = "match" + TLSRouteFieldRoute = "route" +) + +type TLSRoute struct { + Match []TLSMatchAttributes `json:"match,omitempty" yaml:"match,omitempty"` + Route []HTTPRouteDestination `json:"route,omitempty" yaml:"route,omitempty"` +} diff --git a/client/project/v3/zz_generated_tls_settings.go b/client/project/v3/zz_generated_tls_settings.go new file mode 100644 index 00000000..b887ec24 --- /dev/null +++ b/client/project/v3/zz_generated_tls_settings.go @@ -0,0 +1,20 @@ +package client + +const ( + TLSSettingsType = "tlsSettings" + TLSSettingsFieldCaCertificates = "caCertificates" + TLSSettingsFieldClientCertificate = "clientCertificate" + TLSSettingsFieldMode = "mode" + TLSSettingsFieldPrivateKey = "privateKey" + TLSSettingsFieldSni = "sni" + TLSSettingsFieldSubjectAltNames = "subjectAltNames" +) + +type TLSSettings struct { + CaCertificates string `json:"caCertificates,omitempty" yaml:"caCertificates,omitempty"` + ClientCertificate string `json:"clientCertificate,omitempty" yaml:"clientCertificate,omitempty"` + Mode string `json:"mode,omitempty" yaml:"mode,omitempty"` + PrivateKey string `json:"privateKey,omitempty" yaml:"privateKey,omitempty"` + Sni string `json:"sni,omitempty" yaml:"sni,omitempty"` + SubjectAltNames []string `json:"subjectAltNames,omitempty" yaml:"subjectAltNames,omitempty"` +} diff --git a/client/project/v3/zz_generated_traffic_policy.go b/client/project/v3/zz_generated_traffic_policy.go new file mode 100644 index 00000000..c9261ef5 --- /dev/null +++ b/client/project/v3/zz_generated_traffic_policy.go @@ -0,0 +1,18 @@ +package client + +const ( + TrafficPolicyType = "trafficPolicy" + TrafficPolicyFieldConnectionPool = "connectionPool" + TrafficPolicyFieldLoadBalancer = "loadBalancer" + TrafficPolicyFieldOutlierDetection = "outlierDetection" + TrafficPolicyFieldPortLevelSettings = "portLevelSettings" + TrafficPolicyFieldTLS = "tls" +) + +type TrafficPolicy struct { + ConnectionPool *ConnectionPoolSettings `json:"connectionPool,omitempty" yaml:"connectionPool,omitempty"` + LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"` + OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty" yaml:"outlierDetection,omitempty"` + PortLevelSettings []PortTrafficPolicy `json:"portLevelSettings,omitempty" yaml:"portLevelSettings,omitempty"` + TLS *TLSSettings `json:"tls,omitempty" yaml:"tls,omitempty"` +} diff --git a/client/project/v3/zz_generated_virtual_service.go b/client/project/v3/zz_generated_virtual_service.go new file mode 100644 index 00000000..6a535bc9 --- /dev/null +++ b/client/project/v3/zz_generated_virtual_service.go @@ -0,0 +1,121 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + VirtualServiceType = "virtualService" + VirtualServiceFieldAnnotations = "annotations" + VirtualServiceFieldCreated = "created" + VirtualServiceFieldCreatorID = "creatorId" + VirtualServiceFieldGateways = "gateways" + VirtualServiceFieldHTTP = "http" + VirtualServiceFieldHosts = "hosts" + VirtualServiceFieldLabels = "labels" + VirtualServiceFieldName = "name" + VirtualServiceFieldNamespaceId = "namespaceId" + VirtualServiceFieldOwnerReferences = "ownerReferences" + VirtualServiceFieldProjectID = "projectId" + VirtualServiceFieldRemoved = "removed" + VirtualServiceFieldState = "state" + VirtualServiceFieldStatus = "status" + VirtualServiceFieldTCP = "tcp" + VirtualServiceFieldTLS = "tls" + VirtualServiceFieldTransitioning = "transitioning" + VirtualServiceFieldTransitioningMessage = "transitioningMessage" + VirtualServiceFieldUUID = "uuid" +) + +type VirtualService struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Gateways []string `json:"gateways,omitempty" yaml:"gateways,omitempty"` + HTTP []HTTPRoute `json:"http,omitempty" yaml:"http,omitempty"` + Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + Status interface{} `json:"status,omitempty" yaml:"status,omitempty"` + TCP []TCPRoute `json:"tcp,omitempty" yaml:"tcp,omitempty"` + TLS []TLSRoute `json:"tls,omitempty" yaml:"tls,omitempty"` + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type VirtualServiceCollection struct { + types.Collection + Data []VirtualService `json:"data,omitempty"` + client *VirtualServiceClient +} + +type VirtualServiceClient struct { + apiClient *Client +} + +type VirtualServiceOperations interface { + List(opts *types.ListOpts) (*VirtualServiceCollection, error) + Create(opts *VirtualService) (*VirtualService, error) + Update(existing *VirtualService, updates interface{}) (*VirtualService, error) + Replace(existing *VirtualService) (*VirtualService, error) + ByID(id string) (*VirtualService, error) + Delete(container *VirtualService) error +} + +func newVirtualServiceClient(apiClient *Client) *VirtualServiceClient { + return &VirtualServiceClient{ + apiClient: apiClient, + } +} + +func (c *VirtualServiceClient) Create(container *VirtualService) (*VirtualService, error) { + resp := &VirtualService{} + err := c.apiClient.Ops.DoCreate(VirtualServiceType, container, resp) + return resp, err +} + +func (c *VirtualServiceClient) Update(existing *VirtualService, updates interface{}) (*VirtualService, error) { + resp := &VirtualService{} + err := c.apiClient.Ops.DoUpdate(VirtualServiceType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *VirtualServiceClient) Replace(obj *VirtualService) (*VirtualService, error) { + resp := &VirtualService{} + err := c.apiClient.Ops.DoReplace(VirtualServiceType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *VirtualServiceClient) List(opts *types.ListOpts) (*VirtualServiceCollection, error) { + resp := &VirtualServiceCollection{} + err := c.apiClient.Ops.DoList(VirtualServiceType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *VirtualServiceCollection) Next() (*VirtualServiceCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &VirtualServiceCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *VirtualServiceClient) ByID(id string) (*VirtualService, error) { + resp := &VirtualService{} + err := c.apiClient.Ops.DoByID(VirtualServiceType, id, resp) + return resp, err +} + +func (c *VirtualServiceClient) Delete(container *VirtualService) error { + return c.apiClient.Ops.DoResourceDelete(VirtualServiceType, &container.Resource) +} diff --git a/client/project/v3/zz_generated_virtual_service_spec.go b/client/project/v3/zz_generated_virtual_service_spec.go new file mode 100644 index 00000000..24631b96 --- /dev/null +++ b/client/project/v3/zz_generated_virtual_service_spec.go @@ -0,0 +1,18 @@ +package client + +const ( + VirtualServiceSpecType = "virtualServiceSpec" + VirtualServiceSpecFieldGateways = "gateways" + VirtualServiceSpecFieldHTTP = "http" + VirtualServiceSpecFieldHosts = "hosts" + VirtualServiceSpecFieldTCP = "tcp" + VirtualServiceSpecFieldTLS = "tls" +) + +type VirtualServiceSpec struct { + Gateways []string `json:"gateways,omitempty" yaml:"gateways,omitempty"` + HTTP []HTTPRoute `json:"http,omitempty" yaml:"http,omitempty"` + Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"` + TCP []TCPRoute `json:"tcp,omitempty" yaml:"tcp,omitempty"` + TLS []TLSRoute `json:"tls,omitempty" yaml:"tls,omitempty"` +} diff --git a/compose/zz_generated_compose.go b/compose/zz_generated_compose.go index fe8273fe..cfe1e3f9 100644 --- a/compose/zz_generated_compose.go +++ b/compose/zz_generated_compose.go @@ -115,4 +115,6 @@ type Config struct { PrometheusRules map[string]projectClient.PrometheusRule `json:"prometheusRules,omitempty" yaml:"prometheusRules,omitempty"` Alertmanagers map[string]projectClient.Alertmanager `json:"alertmanagers,omitempty" yaml:"alertmanagers,omitempty"` HorizontalPodAutoscalers map[string]projectClient.HorizontalPodAutoscaler `json:"horizontalPodAutoscalers,omitempty" yaml:"horizontalPodAutoscalers,omitempty"` + VirtualServices map[string]projectClient.VirtualService `json:"virtualServices,omitempty" yaml:"virtualServices,omitempty"` + DestinationRules map[string]projectClient.DestinationRule `json:"destinationRules,omitempty" yaml:"destinationRules,omitempty"` }