From 77e82247dbddd6207128ca9c9b9c06ed5ba323e8 Mon Sep 17 00:00:00 2001 From: Jonas Riedel <138458199+jriedel-ionos@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:37:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Bump=20sdk-go=20to=20v6.2.0=20an?= =?UTF-8?q?d=20update=20types=20(#198)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **What is the purpose of this pull request/Why do we need it?** [sdk-go](https://github.com/ionos-cloud/sdk-go/) made upstream changes in the new release [v6.2.0](https://github.com/ionos-cloud/sdk-go/releases/tag/v6.2.0). They changed some LAN related type names, so we need to adapt to that. **Issue #, if available:** **Description of changes:** Renamed types to new names from upstream **Special notes for your reviewer:** **Checklist:** - [x] Includes [emojis](https://github.com/kubernetes-sigs/kubebuilder-release-tools?tab=readme-ov-file#kubebuilder-project-versioning) --- go.mod | 2 +- go.sum | 4 ++-- internal/ionoscloud/client.go | 2 +- internal/ionoscloud/client/client.go | 4 ++-- internal/ionoscloud/clienttest/mock_client.go | 16 ++++++++-------- internal/service/cloud/network.go | 2 +- internal/service/cloud/network_test.go | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 5203d6f2..b18f6e2b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.4.2 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/ionos-cloud/sdk-go/v6 v6.1.11 + github.com/ionos-cloud/sdk-go/v6 v6.2.0 github.com/jarcoal/httpmock v1.3.1 github.com/onsi/ginkgo/v2 v2.19.1 github.com/onsi/gomega v1.34.0 diff --git a/go.sum b/go.sum index d74eafb3..87d915f3 100644 --- a/go.sum +++ b/go.sum @@ -151,8 +151,8 @@ github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/ionos-cloud/sdk-go/v6 v6.1.11 h1:J/uRN4UWO3wCyGOeDdMKv8LWRzKu6UIkLEaes38Kzh8= -github.com/ionos-cloud/sdk-go/v6 v6.1.11/go.mod h1:EzEgRIDxBELvfoa/uBN0kOQaqovLjUWEB7iW4/Q+t4k= +github.com/ionos-cloud/sdk-go/v6 v6.2.0 h1:qX7gachC0wJSmFfVRnd+DHmz9AStvVraKcwQ/JokIB4= +github.com/ionos-cloud/sdk-go/v6 v6.2.0/go.mod h1:EzEgRIDxBELvfoa/uBN0kOQaqovLjUWEB7iW4/Q+t4k= github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww= github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= diff --git a/internal/ionoscloud/client.go b/internal/ionoscloud/client.go index 72c1a2e6..0212815c 100644 --- a/internal/ionoscloud/client.go +++ b/internal/ionoscloud/client.go @@ -41,7 +41,7 @@ type Client interface { DeleteVolume(ctx context.Context, datacenterID, volumeID string) (string, error) // CreateLAN creates a new LAN with the provided properties in the specified data center, // returning the request path. - CreateLAN(ctx context.Context, datacenterID string, properties sdk.LanPropertiesPost) (string, error) + CreateLAN(ctx context.Context, datacenterID string, properties sdk.LanProperties) (string, error) // PatchLAN patches the LAN that matches lanID in the specified data center with the provided properties, // returning the request location. PatchLAN(ctx context.Context, datacenterID, lanID string, properties sdk.LanProperties) (string, error) diff --git a/internal/ionoscloud/client/client.go b/internal/ionoscloud/client/client.go index f5bf5eab..76e021f3 100644 --- a/internal/ionoscloud/client/client.go +++ b/internal/ionoscloud/client/client.go @@ -219,12 +219,12 @@ func (c *IonosCloudClient) DeleteVolume(ctx context.Context, datacenterID, volum // CreateLAN creates a new LAN with the provided properties in the specified data center, // returning the request location. -func (c *IonosCloudClient) CreateLAN(ctx context.Context, datacenterID string, properties sdk.LanPropertiesPost, +func (c *IonosCloudClient) CreateLAN(ctx context.Context, datacenterID string, properties sdk.LanProperties, ) (string, error) { if datacenterID == "" { return "", errDatacenterIDIsEmpty } - lanPost := sdk.LanPost{ + lanPost := sdk.Lan{ Properties: &properties, } _, req, err := c.API.LANsApi.DatacentersLansPost(ctx, datacenterID).Lan(lanPost).Execute() diff --git a/internal/ionoscloud/clienttest/mock_client.go b/internal/ionoscloud/clienttest/mock_client.go index 0a9b6d08..000077ce 100644 --- a/internal/ionoscloud/clienttest/mock_client.go +++ b/internal/ionoscloud/clienttest/mock_client.go @@ -98,7 +98,7 @@ func (_c *MockClient_CheckRequestStatus_Call) RunAndReturn(run func(context.Cont } // CreateLAN provides a mock function with given fields: ctx, datacenterID, properties -func (_m *MockClient) CreateLAN(ctx context.Context, datacenterID string, properties ionoscloud.LanPropertiesPost) (string, error) { +func (_m *MockClient) CreateLAN(ctx context.Context, datacenterID string, properties ionoscloud.LanProperties) (string, error) { ret := _m.Called(ctx, datacenterID, properties) if len(ret) == 0 { @@ -107,16 +107,16 @@ func (_m *MockClient) CreateLAN(ctx context.Context, datacenterID string, proper var r0 string var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, ionoscloud.LanPropertiesPost) (string, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, ionoscloud.LanProperties) (string, error)); ok { return rf(ctx, datacenterID, properties) } - if rf, ok := ret.Get(0).(func(context.Context, string, ionoscloud.LanPropertiesPost) string); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, ionoscloud.LanProperties) string); ok { r0 = rf(ctx, datacenterID, properties) } else { r0 = ret.Get(0).(string) } - if rf, ok := ret.Get(1).(func(context.Context, string, ionoscloud.LanPropertiesPost) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, string, ionoscloud.LanProperties) error); ok { r1 = rf(ctx, datacenterID, properties) } else { r1 = ret.Error(1) @@ -133,14 +133,14 @@ type MockClient_CreateLAN_Call struct { // CreateLAN is a helper method to define mock.On call // - ctx context.Context // - datacenterID string -// - properties ionoscloud.LanPropertiesPost +// - properties ionoscloud.LanProperties func (_e *MockClient_Expecter) CreateLAN(ctx interface{}, datacenterID interface{}, properties interface{}) *MockClient_CreateLAN_Call { return &MockClient_CreateLAN_Call{Call: _e.mock.On("CreateLAN", ctx, datacenterID, properties)} } -func (_c *MockClient_CreateLAN_Call) Run(run func(ctx context.Context, datacenterID string, properties ionoscloud.LanPropertiesPost)) *MockClient_CreateLAN_Call { +func (_c *MockClient_CreateLAN_Call) Run(run func(ctx context.Context, datacenterID string, properties ionoscloud.LanProperties)) *MockClient_CreateLAN_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(ionoscloud.LanPropertiesPost)) + run(args[0].(context.Context), args[1].(string), args[2].(ionoscloud.LanProperties)) }) return _c } @@ -150,7 +150,7 @@ func (_c *MockClient_CreateLAN_Call) Return(_a0 string, _a1 error) *MockClient_C return _c } -func (_c *MockClient_CreateLAN_Call) RunAndReturn(run func(context.Context, string, ionoscloud.LanPropertiesPost) (string, error)) *MockClient_CreateLAN_Call { +func (_c *MockClient_CreateLAN_Call) RunAndReturn(run func(context.Context, string, ionoscloud.LanProperties) (string, error)) *MockClient_CreateLAN_Call { _c.Call.Return(run) return _c } diff --git a/internal/service/cloud/network.go b/internal/service/cloud/network.go index 30653b44..0c39ab40 100644 --- a/internal/service/cloud/network.go +++ b/internal/service/cloud/network.go @@ -180,7 +180,7 @@ func (s *Service) getLAN(ctx context.Context, ms *scope.Machine) (*sdk.Lan, erro func (s *Service) createLAN(ctx context.Context, ms *scope.Machine) error { log := s.logger.WithName("createLAN") - lanProperties := sdk.LanPropertiesPost{ + lanProperties := sdk.LanProperties{ Name: ptr.To(s.lanName(ms.ClusterScope.Cluster)), Public: ptr.To(true), Ipv6CidrBlock: ptr.To("AUTO"), // IPv6 is enabled by default. diff --git a/internal/service/cloud/network_test.go b/internal/service/cloud/network_test.go index 2eab32cd..d0eb3e5a 100644 --- a/internal/service/cloud/network_test.go +++ b/internal/service/cloud/network_test.go @@ -629,7 +629,7 @@ func (s *lanSuite) examplePatchRequest(status string) sdk.Request { } func (s *lanSuite) mockCreateLANCall() *clienttest.MockClient_CreateLAN_Call { - return s.ionosClient.EXPECT().CreateLAN(s.ctx, s.machineScope.DatacenterID(), sdk.LanPropertiesPost{ + return s.ionosClient.EXPECT().CreateLAN(s.ctx, s.machineScope.DatacenterID(), sdk.LanProperties{ Name: ptr.To(s.service.lanName(s.clusterScope.Cluster)), Public: ptr.To(true), Ipv6CidrBlock: ptr.To("AUTO"),