diff --git a/go.mod b/go.mod index 5a8089643..9b33df26d 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/spf13/viper v1.19.0 github.com/stackitcloud/stackit-sdk-go/core v0.14.0 github.com/stackitcloud/stackit-sdk-go/services/authorization v0.4.0 - github.com/stackitcloud/stackit-sdk-go/services/dns v0.11.0 + github.com/stackitcloud/stackit-sdk-go/services/dns v0.12.0 github.com/stackitcloud/stackit-sdk-go/services/iaas v0.16.0 github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.16.0 github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.19.0 @@ -25,7 +25,7 @@ require ( github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.11.0 github.com/stackitcloud/stackit-sdk-go/services/runcommand v0.2.0 github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.10.0 - github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.2.0 + github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.3.0 github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.5.0 github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v0.3.0 github.com/stackitcloud/stackit-sdk-go/services/ske v0.20.0 diff --git a/go.sum b/go.sum index 5fcce1242..8fb3b82ff 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/stackitcloud/stackit-sdk-go/core v0.14.0 h1:oBwwzrEHDTlZpRoQwmMQpNA8b github.com/stackitcloud/stackit-sdk-go/core v0.14.0/go.mod h1:mDX1mSTsB3mP+tNBGcFNx6gH1mGBN4T+dVt+lcw7nlw= github.com/stackitcloud/stackit-sdk-go/services/authorization v0.4.0 h1:WXSIE4KfdHzaiiD0MF8CsoIv8I+Two/Bf/r28tYhRCU= github.com/stackitcloud/stackit-sdk-go/services/authorization v0.4.0/go.mod h1:8spVqlPqZrvQQ63Qodbydk3qsZx7lr963ECft+sqFhY= -github.com/stackitcloud/stackit-sdk-go/services/dns v0.11.0 h1:+OZ82DwFy4JIJThadVjvll5kUWjHPSLbUIF65njsNBk= -github.com/stackitcloud/stackit-sdk-go/services/dns v0.11.0/go.mod h1:mv8U7kuclXo+0VpDHtBCkve/3i9h1yT+RAId/MUi+C8= +github.com/stackitcloud/stackit-sdk-go/services/dns v0.12.0 h1:NypnmRbvjCX7ANJej1epwmopBEjkMzklJT3SY5iVwWg= +github.com/stackitcloud/stackit-sdk-go/services/dns v0.12.0/go.mod h1:mv8U7kuclXo+0VpDHtBCkve/3i9h1yT+RAId/MUi+C8= github.com/stackitcloud/stackit-sdk-go/services/iaas v0.16.0 h1:geyW780gqNxzSsPvmlxy3kUUJaRA4eiF9V3b2Ibcdjs= github.com/stackitcloud/stackit-sdk-go/services/iaas v0.16.0/go.mod h1:YfuN+eXuqr846xeRyW2Vf1JM2jU0ikeQa76dDI66RsM= github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.17.0 h1:06CGP64CEk3Zg6i9kZCMRdmCzLLiyMWQqGK1teBr9Oc= @@ -159,8 +159,8 @@ github.com/stackitcloud/stackit-sdk-go/services/runcommand v0.2.0 h1:tb0w+0imdJh github.com/stackitcloud/stackit-sdk-go/services/runcommand v0.2.0/go.mod h1:LgCIIj7jA2lWX4DI3bxUYD+m0TbWCr1VgAyBYNJeghc= github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.10.0 h1:HrnEgRPt3eD/tEHyzDWyCRxNFzb9g/FLYfwIEEQZ+Rg= github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.10.0/go.mod h1:268uoY2gKCa5xcDL169TGVjLUNTcZ2En77YdfYOcR1w= -github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.2.0 h1:6IUrNIBEIpmrlfEK3QENQZB35KHEmeyc7w1owFOfGpc= -github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.2.0/go.mod h1:+807U5ZLXns+CEbyIg483wNEwV10vaN6GjMnSZhw/64= +github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.3.0 h1:Tlps8vBQmQ1mx2YFbzOzMIyWtXGJy7X3N9Qk3qk88Cc= +github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.3.0/go.mod h1:+807U5ZLXns+CEbyIg483wNEwV10vaN6GjMnSZhw/64= github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.5.0 h1:yf9BxAZEG2hdaekWxaNt2BOX/4qmGkl0d268ggR+tCU= github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.5.0/go.mod h1:Wpqj80yGruCNYGr2yxqhRaLLj4gPSkhJqZyWRXUh/QU= github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v0.3.0 h1:6IZBX9fyza9Eln3FHGHquvLNXQslk+dtkQp41G9+7+Y= diff --git a/internal/pkg/services/serverbackup/utils/utils.go b/internal/pkg/services/serverbackup/utils/utils.go index 1dc32dfec..ecc02493e 100644 --- a/internal/pkg/services/serverbackup/utils/utils.go +++ b/internal/pkg/services/serverbackup/utils/utils.go @@ -8,8 +8,8 @@ import ( ) type ServerBackupClient interface { - ListBackupSchedulesExecute(ctx context.Context, projectId, serverId string) (*serverbackup.ListBackupSchedules200Response, error) - ListBackupsExecute(ctx context.Context, projectId, serverId string) (*serverbackup.ListBackups200Response, error) + ListBackupSchedulesExecute(ctx context.Context, projectId, serverId string) (*serverbackup.GetBackupSchedulesResponse, error) + ListBackupsExecute(ctx context.Context, projectId, serverId string) (*serverbackup.GetBackupsListResponse, error) } func CanDisableBackupService(ctx context.Context, client ServerBackupClient, projectId, serverId string) (bool, error) { diff --git a/internal/pkg/services/serverbackup/utils/utils_test.go b/internal/pkg/services/serverbackup/utils/utils_test.go index a25ce9ba5..ab8425f54 100644 --- a/internal/pkg/services/serverbackup/utils/utils_test.go +++ b/internal/pkg/services/serverbackup/utils/utils_test.go @@ -18,19 +18,19 @@ var ( type serverbackupClientMocked struct { listBackupSchedulesFails bool - listBackupSchedulesResp *serverbackup.ListBackupSchedules200Response + listBackupSchedulesResp *serverbackup.GetBackupSchedulesResponse listBackupsFails bool - listBackupsResp *serverbackup.ListBackups200Response + listBackupsResp *serverbackup.GetBackupsListResponse } -func (m *serverbackupClientMocked) ListBackupSchedulesExecute(_ context.Context, _, _ string) (*serverbackup.ListBackupSchedules200Response, error) { +func (m *serverbackupClientMocked) ListBackupSchedulesExecute(_ context.Context, _, _ string) (*serverbackup.GetBackupSchedulesResponse, error) { if m.listBackupSchedulesFails { return nil, fmt.Errorf("could not list backup schedules") } return m.listBackupSchedulesResp, nil } -func (m *serverbackupClientMocked) ListBackupsExecute(_ context.Context, _, _ string) (*serverbackup.ListBackups200Response, error) { +func (m *serverbackupClientMocked) ListBackupsExecute(_ context.Context, _, _ string) (*serverbackup.GetBackupsListResponse, error) { if m.listBackupsFails { return nil, fmt.Errorf("could not list backups") } @@ -42,8 +42,8 @@ func TestCanDisableBackupService(t *testing.T) { description string listBackupsFails bool listBackupSchedulesFails bool - listBackups *serverbackup.ListBackups200Response - listBackupSchedules *serverbackup.ListBackupSchedules200Response + listBackups *serverbackup.GetBackupsListResponse + listBackupSchedules *serverbackup.GetBackupSchedulesResponse isValid bool // isValid ==> err == nil expectedOutput bool // expectedCanDisable }{ @@ -51,8 +51,8 @@ func TestCanDisableBackupService(t *testing.T) { description: "base-ok-can-disable-backups-service-no-backups-no-backup-schedules", listBackupsFails: false, listBackupSchedulesFails: false, - listBackups: &serverbackup.ListBackups200Response{Items: &[]serverbackup.Backup{}}, - listBackupSchedules: &serverbackup.ListBackupSchedules200Response{Items: &[]serverbackup.BackupSchedule{}}, + listBackups: &serverbackup.GetBackupsListResponse{Items: &[]serverbackup.Backup{}}, + listBackupSchedules: &serverbackup.GetBackupSchedulesResponse{Items: &[]serverbackup.BackupSchedule{}}, isValid: true, expectedOutput: true, }, @@ -60,8 +60,8 @@ func TestCanDisableBackupService(t *testing.T) { description: "not-ok-api-error-list-backups", listBackupsFails: true, listBackupSchedulesFails: false, - listBackups: &serverbackup.ListBackups200Response{Items: &[]serverbackup.Backup{}}, - listBackupSchedules: &serverbackup.ListBackupSchedules200Response{Items: &[]serverbackup.BackupSchedule{}}, + listBackups: &serverbackup.GetBackupsListResponse{Items: &[]serverbackup.Backup{}}, + listBackupSchedules: &serverbackup.GetBackupSchedulesResponse{Items: &[]serverbackup.BackupSchedule{}}, isValid: false, expectedOutput: false, }, @@ -69,8 +69,8 @@ func TestCanDisableBackupService(t *testing.T) { description: "not-ok-api-error-list-backup-schedules", listBackupsFails: true, listBackupSchedulesFails: false, - listBackups: &serverbackup.ListBackups200Response{Items: &[]serverbackup.Backup{}}, - listBackupSchedules: &serverbackup.ListBackupSchedules200Response{Items: &[]serverbackup.BackupSchedule{}}, + listBackups: &serverbackup.GetBackupsListResponse{Items: &[]serverbackup.Backup{}}, + listBackupSchedules: &serverbackup.GetBackupSchedulesResponse{Items: &[]serverbackup.BackupSchedule{}}, isValid: false, expectedOutput: false, }, @@ -78,7 +78,7 @@ func TestCanDisableBackupService(t *testing.T) { description: "not-ok-has-backups-cannot-disable", listBackupsFails: false, listBackupSchedulesFails: false, - listBackups: &serverbackup.ListBackups200Response{ + listBackups: &serverbackup.GetBackupsListResponse{ Items: &[]serverbackup.Backup{ { CreatedAt: utils.Ptr("test timestamp"), @@ -92,7 +92,7 @@ func TestCanDisableBackupService(t *testing.T) { }, }, }, - listBackupSchedules: &serverbackup.ListBackupSchedules200Response{Items: &[]serverbackup.BackupSchedule{}}, + listBackupSchedules: &serverbackup.GetBackupSchedulesResponse{Items: &[]serverbackup.BackupSchedule{}}, isValid: true, expectedOutput: false, }, @@ -100,8 +100,8 @@ func TestCanDisableBackupService(t *testing.T) { description: "not-ok-has-backups-schedules-cannot-disable", listBackupsFails: false, listBackupSchedulesFails: false, - listBackups: &serverbackup.ListBackups200Response{Items: &[]serverbackup.Backup{}}, - listBackupSchedules: &serverbackup.ListBackupSchedules200Response{ + listBackups: &serverbackup.GetBackupsListResponse{Items: &[]serverbackup.Backup{}}, + listBackupSchedules: &serverbackup.GetBackupSchedulesResponse{ Items: &[]serverbackup.BackupSchedule{ { BackupProperties: nil,