From 0bcfba8320b38170e576084837f1278dd62e80b4 Mon Sep 17 00:00:00 2001 From: Karthik Bhat Date: Thu, 8 Aug 2024 19:59:04 +0530 Subject: [PATCH] Generate mocks for all the IBM Cloud services (#1913) --- pkg/cloud/services/cos/cos.go | 3 + pkg/cloud/services/cos/mock/cos_generated.go | 182 +++++++++++++++++ .../services/globaltagging/globaltagging.go | 3 + .../mock/globaltagging_generated.go | 103 ++++++++++ .../mock/resourcecontroller_generated.go | 193 ++++++++++++++++++ .../resourcecontroller/resourcecontroller.go | 3 + .../mock/resourcemanager_generated.go | 87 ++++++++ .../resourcemanager/resourcemanager.go | 3 + .../mock/transitgateway_generated.go | 181 ++++++++++++++++ .../services/transitgateway/transitgateway.go | 3 + pkg/cloud/services/vpc/vpc.go | 6 +- 11 files changed, 764 insertions(+), 3 deletions(-) create mode 100644 pkg/cloud/services/cos/mock/cos_generated.go create mode 100644 pkg/cloud/services/globaltagging/mock/globaltagging_generated.go create mode 100644 pkg/cloud/services/resourcecontroller/mock/resourcecontroller_generated.go create mode 100644 pkg/cloud/services/resourcemanager/mock/resourcemanager_generated.go create mode 100644 pkg/cloud/services/transitgateway/mock/transitgateway_generated.go diff --git a/pkg/cloud/services/cos/cos.go b/pkg/cloud/services/cos/cos.go index 39fe76f2d..c7a5a8801 100644 --- a/pkg/cloud/services/cos/cos.go +++ b/pkg/cloud/services/cos/cos.go @@ -22,6 +22,9 @@ import ( "github.com/IBM/ibm-cos-sdk-go/service/s3" ) +//go:generate ../../../../hack/tools/bin/mockgen -source=./cos.go -destination=./mock/cos_generated.go -package=mock +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/cos_generated.go > ./mock/_cos_generated.go && mv ./mock/_cos_generated.go ./mock/cos_generated.go" + // Cos interface defines a method that a IBMCLOUD service object should implement in order to // use the cos package for listing resource instances. type Cos interface { diff --git a/pkg/cloud/services/cos/mock/cos_generated.go b/pkg/cloud/services/cos/mock/cos_generated.go new file mode 100644 index 000000000..d8776016a --- /dev/null +++ b/pkg/cloud/services/cos/mock/cos_generated.go @@ -0,0 +1,182 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./cos.go +// +// Generated by this command: +// +// mockgen -source=./cos.go -destination=./mock/cos_generated.go -package=mock +// + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + aws "github.com/IBM/ibm-cos-sdk-go/aws" + request "github.com/IBM/ibm-cos-sdk-go/aws/request" + s3 "github.com/IBM/ibm-cos-sdk-go/service/s3" + gomock "go.uber.org/mock/gomock" +) + +// MockCos is a mock of Cos interface. +type MockCos struct { + ctrl *gomock.Controller + recorder *MockCosMockRecorder +} + +// MockCosMockRecorder is the mock recorder for MockCos. +type MockCosMockRecorder struct { + mock *MockCos +} + +// NewMockCos creates a new mock instance. +func NewMockCos(ctrl *gomock.Controller) *MockCos { + mock := &MockCos{ctrl: ctrl} + mock.recorder = &MockCosMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockCos) EXPECT() *MockCosMockRecorder { + return m.recorder +} + +// CreateBucket mocks base method. +func (m *MockCos) CreateBucket(input *s3.CreateBucketInput) (*s3.CreateBucketOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateBucket", input) + ret0, _ := ret[0].(*s3.CreateBucketOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateBucket indicates an expected call of CreateBucket. +func (mr *MockCosMockRecorder) CreateBucket(input any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBucket", reflect.TypeOf((*MockCos)(nil).CreateBucket), input) +} + +// CreateBucketWithContext mocks base method. +func (m *MockCos) CreateBucketWithContext(ctx aws.Context, input *s3.CreateBucketInput, opts ...request.Option) (*s3.CreateBucketOutput, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, input} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateBucketWithContext", varargs...) + ret0, _ := ret[0].(*s3.CreateBucketOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateBucketWithContext indicates an expected call of CreateBucketWithContext. +func (mr *MockCosMockRecorder) CreateBucketWithContext(ctx, input any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, input}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBucketWithContext", reflect.TypeOf((*MockCos)(nil).CreateBucketWithContext), varargs...) +} + +// DeleteObject mocks base method. +func (m *MockCos) DeleteObject(input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteObject", input) + ret0, _ := ret[0].(*s3.DeleteObjectOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteObject indicates an expected call of DeleteObject. +func (mr *MockCosMockRecorder) DeleteObject(input any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObject", reflect.TypeOf((*MockCos)(nil).DeleteObject), input) +} + +// GetBucketByName mocks base method. +func (m *MockCos) GetBucketByName(name string) (*s3.HeadBucketOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBucketByName", name) + ret0, _ := ret[0].(*s3.HeadBucketOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBucketByName indicates an expected call of GetBucketByName. +func (mr *MockCosMockRecorder) GetBucketByName(name any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBucketByName", reflect.TypeOf((*MockCos)(nil).GetBucketByName), name) +} + +// GetObjectRequest mocks base method. +func (m *MockCos) GetObjectRequest(arg0 *s3.GetObjectInput) (*request.Request, *s3.GetObjectOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetObjectRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*s3.GetObjectOutput) + return ret0, ret1 +} + +// GetObjectRequest indicates an expected call of GetObjectRequest. +func (mr *MockCosMockRecorder) GetObjectRequest(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectRequest", reflect.TypeOf((*MockCos)(nil).GetObjectRequest), arg0) +} + +// ListObjects mocks base method. +func (m *MockCos) ListObjects(input *s3.ListObjectsInput) (*s3.ListObjectsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListObjects", input) + ret0, _ := ret[0].(*s3.ListObjectsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListObjects indicates an expected call of ListObjects. +func (mr *MockCosMockRecorder) ListObjects(input any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListObjects", reflect.TypeOf((*MockCos)(nil).ListObjects), input) +} + +// PutObject mocks base method. +func (m *MockCos) PutObject(arg0 *s3.PutObjectInput) (*s3.PutObjectOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutObject", arg0) + ret0, _ := ret[0].(*s3.PutObjectOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutObject indicates an expected call of PutObject. +func (mr *MockCosMockRecorder) PutObject(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObject", reflect.TypeOf((*MockCos)(nil).PutObject), arg0) +} + +// PutPublicAccessBlock mocks base method. +func (m *MockCos) PutPublicAccessBlock(input *s3.PutPublicAccessBlockInput) (*s3.PutPublicAccessBlockOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutPublicAccessBlock", input) + ret0, _ := ret[0].(*s3.PutPublicAccessBlockOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutPublicAccessBlock indicates an expected call of PutPublicAccessBlock. +func (mr *MockCosMockRecorder) PutPublicAccessBlock(input any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutPublicAccessBlock", reflect.TypeOf((*MockCos)(nil).PutPublicAccessBlock), input) +} diff --git a/pkg/cloud/services/globaltagging/globaltagging.go b/pkg/cloud/services/globaltagging/globaltagging.go index 8ed76fcbd..61ca4e546 100644 --- a/pkg/cloud/services/globaltagging/globaltagging.go +++ b/pkg/cloud/services/globaltagging/globaltagging.go @@ -21,6 +21,9 @@ import ( "github.com/IBM/platform-services-go-sdk/globaltaggingv1" ) +//go:generate ../../../../hack/tools/bin/mockgen -source=./globaltagging.go -destination=./mock/globaltagging_generated.go -package=mock +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/globaltagging_generated.go > ./mock/_globaltagging_generated.go && mv ./mock/_globaltagging_generated.go ./mock/globaltagging_generated.go" + // GlobalTagging interface defines a method that a IBMCLOUD service object should implement in order to // use the manage tags with the Global Tagging APIs. type GlobalTagging interface { diff --git a/pkg/cloud/services/globaltagging/mock/globaltagging_generated.go b/pkg/cloud/services/globaltagging/mock/globaltagging_generated.go new file mode 100644 index 000000000..6ea378d81 --- /dev/null +++ b/pkg/cloud/services/globaltagging/mock/globaltagging_generated.go @@ -0,0 +1,103 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./globaltagging.go +// +// Generated by this command: +// +// mockgen -source=./globaltagging.go -destination=./mock/globaltagging_generated.go -package=mock +// + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + core "github.com/IBM/go-sdk-core/v5/core" + globaltaggingv1 "github.com/IBM/platform-services-go-sdk/globaltaggingv1" + gomock "go.uber.org/mock/gomock" +) + +// MockGlobalTagging is a mock of GlobalTagging interface. +type MockGlobalTagging struct { + ctrl *gomock.Controller + recorder *MockGlobalTaggingMockRecorder +} + +// MockGlobalTaggingMockRecorder is the mock recorder for MockGlobalTagging. +type MockGlobalTaggingMockRecorder struct { + mock *MockGlobalTagging +} + +// NewMockGlobalTagging creates a new mock instance. +func NewMockGlobalTagging(ctrl *gomock.Controller) *MockGlobalTagging { + mock := &MockGlobalTagging{ctrl: ctrl} + mock.recorder = &MockGlobalTaggingMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGlobalTagging) EXPECT() *MockGlobalTaggingMockRecorder { + return m.recorder +} + +// AttachTag mocks base method. +func (m *MockGlobalTagging) AttachTag(arg0 *globaltaggingv1.AttachTagOptions) (*globaltaggingv1.TagResults, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachTag", arg0) + ret0, _ := ret[0].(*globaltaggingv1.TagResults) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// AttachTag indicates an expected call of AttachTag. +func (mr *MockGlobalTaggingMockRecorder) AttachTag(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachTag", reflect.TypeOf((*MockGlobalTagging)(nil).AttachTag), arg0) +} + +// CreateTag mocks base method. +func (m *MockGlobalTagging) CreateTag(arg0 *globaltaggingv1.CreateTagOptions) (*globaltaggingv1.CreateTagResults, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTag", arg0) + ret0, _ := ret[0].(*globaltaggingv1.CreateTagResults) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateTag indicates an expected call of CreateTag. +func (mr *MockGlobalTaggingMockRecorder) CreateTag(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTag", reflect.TypeOf((*MockGlobalTagging)(nil).CreateTag), arg0) +} + +// GetTagByName mocks base method. +func (m *MockGlobalTagging) GetTagByName(arg0 string) (*globaltaggingv1.Tag, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTagByName", arg0) + ret0, _ := ret[0].(*globaltaggingv1.Tag) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTagByName indicates an expected call of GetTagByName. +func (mr *MockGlobalTaggingMockRecorder) GetTagByName(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTagByName", reflect.TypeOf((*MockGlobalTagging)(nil).GetTagByName), arg0) +} diff --git a/pkg/cloud/services/resourcecontroller/mock/resourcecontroller_generated.go b/pkg/cloud/services/resourcecontroller/mock/resourcecontroller_generated.go new file mode 100644 index 000000000..f1be01fcc --- /dev/null +++ b/pkg/cloud/services/resourcecontroller/mock/resourcecontroller_generated.go @@ -0,0 +1,193 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./resourcecontroller.go +// +// Generated by this command: +// +// mockgen -source=./resourcecontroller.go -destination=./mock/resourcecontroller_generated.go -package=mock +// + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + core "github.com/IBM/go-sdk-core/v5/core" + resourcecontrollerv2 "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" + gomock "go.uber.org/mock/gomock" +) + +// MockResourceController is a mock of ResourceController interface. +type MockResourceController struct { + ctrl *gomock.Controller + recorder *MockResourceControllerMockRecorder +} + +// MockResourceControllerMockRecorder is the mock recorder for MockResourceController. +type MockResourceControllerMockRecorder struct { + mock *MockResourceController +} + +// NewMockResourceController creates a new mock instance. +func NewMockResourceController(ctrl *gomock.Controller) *MockResourceController { + mock := &MockResourceController{ctrl: ctrl} + mock.recorder = &MockResourceControllerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockResourceController) EXPECT() *MockResourceControllerMockRecorder { + return m.recorder +} + +// CreateResourceInstance mocks base method. +func (m *MockResourceController) CreateResourceInstance(arg0 *resourcecontrollerv2.CreateResourceInstanceOptions) (*resourcecontrollerv2.ResourceInstance, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateResourceInstance", arg0) + ret0, _ := ret[0].(*resourcecontrollerv2.ResourceInstance) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateResourceInstance indicates an expected call of CreateResourceInstance. +func (mr *MockResourceControllerMockRecorder) CreateResourceInstance(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateResourceInstance", reflect.TypeOf((*MockResourceController)(nil).CreateResourceInstance), arg0) +} + +// CreateResourceKey mocks base method. +func (m *MockResourceController) CreateResourceKey(arg0 *resourcecontrollerv2.CreateResourceKeyOptions) (*resourcecontrollerv2.ResourceKey, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateResourceKey", arg0) + ret0, _ := ret[0].(*resourcecontrollerv2.ResourceKey) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateResourceKey indicates an expected call of CreateResourceKey. +func (mr *MockResourceControllerMockRecorder) CreateResourceKey(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateResourceKey", reflect.TypeOf((*MockResourceController)(nil).CreateResourceKey), arg0) +} + +// DeleteResourceInstance mocks base method. +func (m *MockResourceController) DeleteResourceInstance(arg0 *resourcecontrollerv2.DeleteResourceInstanceOptions) (*core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteResourceInstance", arg0) + ret0, _ := ret[0].(*core.DetailedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteResourceInstance indicates an expected call of DeleteResourceInstance. +func (mr *MockResourceControllerMockRecorder) DeleteResourceInstance(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteResourceInstance", reflect.TypeOf((*MockResourceController)(nil).DeleteResourceInstance), arg0) +} + +// GetInstanceByName mocks base method. +func (m *MockResourceController) GetInstanceByName(arg0, arg1, arg2 string) (*resourcecontrollerv2.ResourceInstance, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetInstanceByName", arg0, arg1, arg2) + ret0, _ := ret[0].(*resourcecontrollerv2.ResourceInstance) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetInstanceByName indicates an expected call of GetInstanceByName. +func (mr *MockResourceControllerMockRecorder) GetInstanceByName(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceByName", reflect.TypeOf((*MockResourceController)(nil).GetInstanceByName), arg0, arg1, arg2) +} + +// GetResourceInstance mocks base method. +func (m *MockResourceController) GetResourceInstance(arg0 *resourcecontrollerv2.GetResourceInstanceOptions) (*resourcecontrollerv2.ResourceInstance, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetResourceInstance", arg0) + ret0, _ := ret[0].(*resourcecontrollerv2.ResourceInstance) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetResourceInstance indicates an expected call of GetResourceInstance. +func (mr *MockResourceControllerMockRecorder) GetResourceInstance(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceInstance", reflect.TypeOf((*MockResourceController)(nil).GetResourceInstance), arg0) +} + +// GetServiceInstance mocks base method. +func (m *MockResourceController) GetServiceInstance(arg0, arg1 string, arg2 *string) (*resourcecontrollerv2.ResourceInstance, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceInstance", arg0, arg1, arg2) + ret0, _ := ret[0].(*resourcecontrollerv2.ResourceInstance) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceInstance indicates an expected call of GetServiceInstance. +func (mr *MockResourceControllerMockRecorder) GetServiceInstance(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceInstance", reflect.TypeOf((*MockResourceController)(nil).GetServiceInstance), arg0, arg1, arg2) +} + +// GetServiceURL mocks base method. +func (m *MockResourceController) GetServiceURL() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceURL") + ret0, _ := ret[0].(string) + return ret0 +} + +// GetServiceURL indicates an expected call of GetServiceURL. +func (mr *MockResourceControllerMockRecorder) GetServiceURL() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceURL", reflect.TypeOf((*MockResourceController)(nil).GetServiceURL)) +} + +// ListResourceInstances mocks base method. +func (m *MockResourceController) ListResourceInstances(listResourceInstancesOptions *resourcecontrollerv2.ListResourceInstancesOptions) (*resourcecontrollerv2.ResourceInstancesList, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListResourceInstances", listResourceInstancesOptions) + ret0, _ := ret[0].(*resourcecontrollerv2.ResourceInstancesList) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListResourceInstances indicates an expected call of ListResourceInstances. +func (mr *MockResourceControllerMockRecorder) ListResourceInstances(listResourceInstancesOptions any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListResourceInstances", reflect.TypeOf((*MockResourceController)(nil).ListResourceInstances), listResourceInstancesOptions) +} + +// SetServiceURL mocks base method. +func (m *MockResourceController) SetServiceURL(arg0 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetServiceURL", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetServiceURL indicates an expected call of SetServiceURL. +func (mr *MockResourceControllerMockRecorder) SetServiceURL(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetServiceURL", reflect.TypeOf((*MockResourceController)(nil).SetServiceURL), arg0) +} diff --git a/pkg/cloud/services/resourcecontroller/resourcecontroller.go b/pkg/cloud/services/resourcecontroller/resourcecontroller.go index fe8f8966d..524fadd2d 100644 --- a/pkg/cloud/services/resourcecontroller/resourcecontroller.go +++ b/pkg/cloud/services/resourcecontroller/resourcecontroller.go @@ -21,6 +21,9 @@ import ( "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" ) +//go:generate ../../../../hack/tools/bin/mockgen -source=./resourcecontroller.go -destination=./mock/resourcecontroller_generated.go -package=mock +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/resourcecontroller_generated.go > ./mock/_resourcecontroller_generated.go && mv ./mock/_resourcecontroller_generated.go ./mock/resourcecontroller_generated.go" + // ResourceController interface defines a method that a IBMCLOUD service object should implement in order to // use the resourcecontrollerv2 package for listing resource instances. type ResourceController interface { diff --git a/pkg/cloud/services/resourcemanager/mock/resourcemanager_generated.go b/pkg/cloud/services/resourcemanager/mock/resourcemanager_generated.go new file mode 100644 index 000000000..4b126d198 --- /dev/null +++ b/pkg/cloud/services/resourcemanager/mock/resourcemanager_generated.go @@ -0,0 +1,87 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./resourcemanager.go +// +// Generated by this command: +// +// mockgen -source=./resourcemanager.go -destination=./mock/resourcemanager_generated.go -package=mock +// + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + core "github.com/IBM/go-sdk-core/v5/core" + resourcemanagerv2 "github.com/IBM/platform-services-go-sdk/resourcemanagerv2" + gomock "go.uber.org/mock/gomock" +) + +// MockResourceManager is a mock of ResourceManager interface. +type MockResourceManager struct { + ctrl *gomock.Controller + recorder *MockResourceManagerMockRecorder +} + +// MockResourceManagerMockRecorder is the mock recorder for MockResourceManager. +type MockResourceManagerMockRecorder struct { + mock *MockResourceManager +} + +// NewMockResourceManager creates a new mock instance. +func NewMockResourceManager(ctrl *gomock.Controller) *MockResourceManager { + mock := &MockResourceManager{ctrl: ctrl} + mock.recorder = &MockResourceManagerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockResourceManager) EXPECT() *MockResourceManagerMockRecorder { + return m.recorder +} + +// GetResourceGroupByName mocks base method. +func (m *MockResourceManager) GetResourceGroupByName(arg0 string) (*resourcemanagerv2.ResourceGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetResourceGroupByName", arg0) + ret0, _ := ret[0].(*resourcemanagerv2.ResourceGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetResourceGroupByName indicates an expected call of GetResourceGroupByName. +func (mr *MockResourceManagerMockRecorder) GetResourceGroupByName(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceGroupByName", reflect.TypeOf((*MockResourceManager)(nil).GetResourceGroupByName), arg0) +} + +// ListResourceGroups mocks base method. +func (m *MockResourceManager) ListResourceGroups(arg0 *resourcemanagerv2.ListResourceGroupsOptions) (*resourcemanagerv2.ResourceGroupList, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListResourceGroups", arg0) + ret0, _ := ret[0].(*resourcemanagerv2.ResourceGroupList) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListResourceGroups indicates an expected call of ListResourceGroups. +func (mr *MockResourceManagerMockRecorder) ListResourceGroups(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListResourceGroups", reflect.TypeOf((*MockResourceManager)(nil).ListResourceGroups), arg0) +} diff --git a/pkg/cloud/services/resourcemanager/resourcemanager.go b/pkg/cloud/services/resourcemanager/resourcemanager.go index 4b260805c..c3bc2fa0a 100644 --- a/pkg/cloud/services/resourcemanager/resourcemanager.go +++ b/pkg/cloud/services/resourcemanager/resourcemanager.go @@ -21,6 +21,9 @@ import ( "github.com/IBM/platform-services-go-sdk/resourcemanagerv2" ) +//go:generate ../../../../hack/tools/bin/mockgen -source=./resourcemanager.go -destination=./mock/resourcemanager_generated.go -package=mock +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/resourcemanager_generated.go > ./mock/_resourcemanager_generated.go && mv ./mock/_resourcemanager_generated.go ./mock/resourcemanager_generated.go" + // ResourceManager interface defines a method that a IBMCLOUD service object should implement in order to // use the manage lifecycle of cloud resource groups using Resource Manager APIs. type ResourceManager interface { diff --git a/pkg/cloud/services/transitgateway/mock/transitgateway_generated.go b/pkg/cloud/services/transitgateway/mock/transitgateway_generated.go new file mode 100644 index 000000000..d1df9fff1 --- /dev/null +++ b/pkg/cloud/services/transitgateway/mock/transitgateway_generated.go @@ -0,0 +1,181 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./transitgateway.go +// +// Generated by this command: +// +// mockgen -source=./transitgateway.go -destination=./mock/transitgateway_generated.go -package=mock +// + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + core "github.com/IBM/go-sdk-core/v5/core" + transitgatewayapisv1 "github.com/IBM/networking-go-sdk/transitgatewayapisv1" + gomock "go.uber.org/mock/gomock" +) + +// MockTransitGateway is a mock of TransitGateway interface. +type MockTransitGateway struct { + ctrl *gomock.Controller + recorder *MockTransitGatewayMockRecorder +} + +// MockTransitGatewayMockRecorder is the mock recorder for MockTransitGateway. +type MockTransitGatewayMockRecorder struct { + mock *MockTransitGateway +} + +// NewMockTransitGateway creates a new mock instance. +func NewMockTransitGateway(ctrl *gomock.Controller) *MockTransitGateway { + mock := &MockTransitGateway{ctrl: ctrl} + mock.recorder = &MockTransitGatewayMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockTransitGateway) EXPECT() *MockTransitGatewayMockRecorder { + return m.recorder +} + +// CreateTransitGateway mocks base method. +func (m *MockTransitGateway) CreateTransitGateway(arg0 *transitgatewayapisv1.CreateTransitGatewayOptions) (*transitgatewayapisv1.TransitGateway, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTransitGateway", arg0) + ret0, _ := ret[0].(*transitgatewayapisv1.TransitGateway) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateTransitGateway indicates an expected call of CreateTransitGateway. +func (mr *MockTransitGatewayMockRecorder) CreateTransitGateway(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTransitGateway", reflect.TypeOf((*MockTransitGateway)(nil).CreateTransitGateway), arg0) +} + +// CreateTransitGatewayConnection mocks base method. +func (m *MockTransitGateway) CreateTransitGatewayConnection(arg0 *transitgatewayapisv1.CreateTransitGatewayConnectionOptions) (*transitgatewayapisv1.TransitGatewayConnectionCust, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTransitGatewayConnection", arg0) + ret0, _ := ret[0].(*transitgatewayapisv1.TransitGatewayConnectionCust) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateTransitGatewayConnection indicates an expected call of CreateTransitGatewayConnection. +func (mr *MockTransitGatewayMockRecorder) CreateTransitGatewayConnection(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTransitGatewayConnection", reflect.TypeOf((*MockTransitGateway)(nil).CreateTransitGatewayConnection), arg0) +} + +// DeleteTransitGateway mocks base method. +func (m *MockTransitGateway) DeleteTransitGateway(deleteTransitGatewayOptions *transitgatewayapisv1.DeleteTransitGatewayOptions) (*core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteTransitGateway", deleteTransitGatewayOptions) + ret0, _ := ret[0].(*core.DetailedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteTransitGateway indicates an expected call of DeleteTransitGateway. +func (mr *MockTransitGatewayMockRecorder) DeleteTransitGateway(deleteTransitGatewayOptions any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTransitGateway", reflect.TypeOf((*MockTransitGateway)(nil).DeleteTransitGateway), deleteTransitGatewayOptions) +} + +// DeleteTransitGatewayConnection mocks base method. +func (m *MockTransitGateway) DeleteTransitGatewayConnection(deleteTransitGatewayConnectionOptions *transitgatewayapisv1.DeleteTransitGatewayConnectionOptions) (*core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteTransitGatewayConnection", deleteTransitGatewayConnectionOptions) + ret0, _ := ret[0].(*core.DetailedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteTransitGatewayConnection indicates an expected call of DeleteTransitGatewayConnection. +func (mr *MockTransitGatewayMockRecorder) DeleteTransitGatewayConnection(deleteTransitGatewayConnectionOptions any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTransitGatewayConnection", reflect.TypeOf((*MockTransitGateway)(nil).DeleteTransitGatewayConnection), deleteTransitGatewayConnectionOptions) +} + +// GetTransitGateway mocks base method. +func (m *MockTransitGateway) GetTransitGateway(arg0 *transitgatewayapisv1.GetTransitGatewayOptions) (*transitgatewayapisv1.TransitGateway, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTransitGateway", arg0) + ret0, _ := ret[0].(*transitgatewayapisv1.TransitGateway) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTransitGateway indicates an expected call of GetTransitGateway. +func (mr *MockTransitGatewayMockRecorder) GetTransitGateway(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransitGateway", reflect.TypeOf((*MockTransitGateway)(nil).GetTransitGateway), arg0) +} + +// GetTransitGatewayByName mocks base method. +func (m *MockTransitGateway) GetTransitGatewayByName(name string) (*transitgatewayapisv1.TransitGateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTransitGatewayByName", name) + ret0, _ := ret[0].(*transitgatewayapisv1.TransitGateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTransitGatewayByName indicates an expected call of GetTransitGatewayByName. +func (mr *MockTransitGatewayMockRecorder) GetTransitGatewayByName(name any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransitGatewayByName", reflect.TypeOf((*MockTransitGateway)(nil).GetTransitGatewayByName), name) +} + +// GetTransitGatewayConnection mocks base method. +func (m *MockTransitGateway) GetTransitGatewayConnection(arg0 *transitgatewayapisv1.GetTransitGatewayConnectionOptions) (*transitgatewayapisv1.TransitGatewayConnectionCust, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTransitGatewayConnection", arg0) + ret0, _ := ret[0].(*transitgatewayapisv1.TransitGatewayConnectionCust) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTransitGatewayConnection indicates an expected call of GetTransitGatewayConnection. +func (mr *MockTransitGatewayMockRecorder) GetTransitGatewayConnection(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransitGatewayConnection", reflect.TypeOf((*MockTransitGateway)(nil).GetTransitGatewayConnection), arg0) +} + +// ListTransitGatewayConnections mocks base method. +func (m *MockTransitGateway) ListTransitGatewayConnections(arg0 *transitgatewayapisv1.ListTransitGatewayConnectionsOptions) (*transitgatewayapisv1.TransitGatewayConnectionCollection, *core.DetailedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTransitGatewayConnections", arg0) + ret0, _ := ret[0].(*transitgatewayapisv1.TransitGatewayConnectionCollection) + ret1, _ := ret[1].(*core.DetailedResponse) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTransitGatewayConnections indicates an expected call of ListTransitGatewayConnections. +func (mr *MockTransitGatewayMockRecorder) ListTransitGatewayConnections(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTransitGatewayConnections", reflect.TypeOf((*MockTransitGateway)(nil).ListTransitGatewayConnections), arg0) +} diff --git a/pkg/cloud/services/transitgateway/transitgateway.go b/pkg/cloud/services/transitgateway/transitgateway.go index 62beaf208..cba613a95 100644 --- a/pkg/cloud/services/transitgateway/transitgateway.go +++ b/pkg/cloud/services/transitgateway/transitgateway.go @@ -21,6 +21,9 @@ import ( tgapiv1 "github.com/IBM/networking-go-sdk/transitgatewayapisv1" ) +//go:generate ../../../../hack/tools/bin/mockgen -source=./transitgateway.go -destination=./mock/transitgateway_generated.go -package=mock +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/transitgateway_generated.go > ./mock/_transitgateway_generated.go && mv ./mock/_transitgateway_generated.go ./mock/transitgateway_generated.go" + // TransitGateway interface defines a method that a IBMCLOUD service object should implement in order to // use the transitgateway package for listing resource instances. type TransitGateway interface { diff --git a/pkg/cloud/services/vpc/vpc.go b/pkg/cloud/services/vpc/vpc.go index c58036dc6..511815fbc 100644 --- a/pkg/cloud/services/vpc/vpc.go +++ b/pkg/cloud/services/vpc/vpc.go @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -//go:generate ../../../../hack/tools/bin/mockgen -source=./vpc.go -destination=./mock/vpc_generated.go -package=mock -//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/vpc_generated.go > ./mock/_vpc_generated.go && mv ./mock/_vpc_generated.go ./mock/vpc_generated.go" - package vpc import ( @@ -24,6 +21,9 @@ import ( "github.com/IBM/vpc-go-sdk/vpcv1" ) +//go:generate ../../../../hack/tools/bin/mockgen -source=./vpc.go -destination=./mock/vpc_generated.go -package=mock +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt ./mock/vpc_generated.go > ./mock/_vpc_generated.go && mv ./mock/_vpc_generated.go ./mock/vpc_generated.go" + // Vpc interface defines methods that a Cluster API IBMCLOUD object should implement. type Vpc interface { CreateInstance(options *vpcv1.CreateInstanceOptions) (*vpcv1.Instance, *core.DetailedResponse, error)