From 3ff6193cc0dd0eea19844d726b41c75e62bc3eb1 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 14 Mar 2025 16:15:33 +0000 Subject: [PATCH 1/2] Generate serverbackup --- services/serverbackup/api_default.go | 591 +++++++++--------- services/serverbackup/api_default_test.go | 419 ++++++------- services/serverbackup/client.go | 4 +- services/serverbackup/configuration.go | 9 +- services/serverbackup/model_backup.go | 414 +++++++----- services/serverbackup/model_backup_job.go | 54 +- services/serverbackup/model_backup_policy.go | 377 ++++++----- .../model_backup_policy_backup_properties.go | 110 ++-- .../serverbackup/model_backup_properties.go | 157 +++-- .../serverbackup/model_backup_schedule.go | 256 +++++--- .../model_backup_volume_backups_inner.go | 325 ++++++---- .../model_create_backup_payload.go | 157 +++-- .../model_create_backup_schedule_payload.go | 206 +++--- .../model_enable_service_payload.go | 116 ---- .../model_enable_service_resource_payload.go | 56 +- services/serverbackup/model_error_response.go | 172 +++++ .../model_get_backup_policies_response.go | 55 +- .../model_get_backup_schedules_response.go | 55 +- .../model_get_backup_service_response.go | 55 +- .../model_get_backups_list_response.go | 55 +- .../model_restore_backup_payload.go | 106 ++-- .../model_restore_volume_backup_payload.go | 54 +- .../model_update_backup_schedule_payload.go | 206 +++--- services/serverbackup/utils.go | 28 +- 24 files changed, 2381 insertions(+), 1656 deletions(-) delete mode 100644 services/serverbackup/model_enable_service_payload.go create mode 100644 services/serverbackup/model_error_response.go diff --git a/services/serverbackup/api_default.go b/services/serverbackup/api_default.go index c554875c9..e06a4a0e4 100644 --- a/services/serverbackup/api_default.go +++ b/services/serverbackup/api_default.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -30,6 +30,7 @@ type ApiCreateBackupRequest struct { apiService *DefaultApiService projectId string serverId string + region string createBackupPayload *CreateBackupPayload } @@ -51,9 +52,10 @@ func (r ApiCreateBackupRequest) Execute() (*BackupJob, error) { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -110,6 +112,17 @@ func (r ApiCreateBackupRequest) Execute() (*BackupJob, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -132,23 +145,26 @@ CreateBackup: create backup @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiCreateBackupRequest */ -func (a *APIClient) CreateBackup(ctx context.Context, projectId string, serverId string) ApiCreateBackupRequest { +func (a *APIClient) CreateBackup(ctx context.Context, projectId string, serverId string, region string) ApiCreateBackupRequest { return ApiCreateBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) CreateBackupExecute(ctx context.Context, projectId string, serverId string) (*BackupJob, error) { +func (a *APIClient) CreateBackupExecute(ctx context.Context, projectId string, serverId string, region string) (*BackupJob, error) { r := ApiCreateBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } return r.Execute() } @@ -158,6 +174,7 @@ type ApiCreateBackupScheduleRequest struct { apiService *DefaultApiService projectId string serverId string + region string createBackupSchedulePayload *CreateBackupSchedulePayload } @@ -179,9 +196,10 @@ func (r ApiCreateBackupScheduleRequest) Execute() (*BackupSchedule, error) { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backup-schedules" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -238,6 +256,17 @@ func (r ApiCreateBackupScheduleRequest) Execute() (*BackupSchedule, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -260,23 +289,26 @@ CreateBackupSchedule: create backup schedule @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiCreateBackupScheduleRequest */ -func (a *APIClient) CreateBackupSchedule(ctx context.Context, projectId string, serverId string) ApiCreateBackupScheduleRequest { +func (a *APIClient) CreateBackupSchedule(ctx context.Context, projectId string, serverId string, region string) ApiCreateBackupScheduleRequest { return ApiCreateBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) CreateBackupScheduleExecute(ctx context.Context, projectId string, serverId string) (*BackupSchedule, error) { +func (a *APIClient) CreateBackupScheduleExecute(ctx context.Context, projectId string, serverId string, region string) (*BackupSchedule, error) { r := ApiCreateBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } return r.Execute() } @@ -286,6 +318,7 @@ type ApiDeleteBackupRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupId string } @@ -301,9 +334,10 @@ func (r ApiDeleteBackupRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarHeaderParams := make(map[string]string) @@ -320,7 +354,7 @@ func (r ApiDeleteBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -359,6 +393,17 @@ func (r ApiDeleteBackupRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -371,25 +416,28 @@ DeleteBackup: delete backup @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupId id of the backup @return ApiDeleteBackupRequest */ -func (a *APIClient) DeleteBackup(ctx context.Context, projectId string, serverId string, backupId string) ApiDeleteBackupRequest { +func (a *APIClient) DeleteBackup(ctx context.Context, projectId string, serverId string, region string, backupId string) ApiDeleteBackupRequest { return ApiDeleteBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, } } -func (a *APIClient) DeleteBackupExecute(ctx context.Context, projectId string, serverId string, backupId string) error { +func (a *APIClient) DeleteBackupExecute(ctx context.Context, projectId string, serverId string, region string, backupId string) error { r := ApiDeleteBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, } return r.Execute() @@ -400,6 +448,7 @@ type ApiDeleteBackupScheduleRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupScheduleId string } @@ -415,9 +464,10 @@ func (r ApiDeleteBackupScheduleRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backup-schedules/{backupScheduleId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(r.backupScheduleId, "backupScheduleId")), -1) localVarHeaderParams := make(map[string]string) @@ -434,7 +484,7 @@ func (r ApiDeleteBackupScheduleRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -473,6 +523,17 @@ func (r ApiDeleteBackupScheduleRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -485,25 +546,28 @@ DeleteBackupSchedule: delete backup schedule @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupScheduleId backup schedule id @return ApiDeleteBackupScheduleRequest */ -func (a *APIClient) DeleteBackupSchedule(ctx context.Context, projectId string, serverId string, backupScheduleId string) ApiDeleteBackupScheduleRequest { +func (a *APIClient) DeleteBackupSchedule(ctx context.Context, projectId string, serverId string, region string, backupScheduleId string) ApiDeleteBackupScheduleRequest { return ApiDeleteBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupScheduleId: backupScheduleId, } } -func (a *APIClient) DeleteBackupScheduleExecute(ctx context.Context, projectId string, serverId string, backupScheduleId string) error { +func (a *APIClient) DeleteBackupScheduleExecute(ctx context.Context, projectId string, serverId string, region string, backupScheduleId string) error { r := ApiDeleteBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupScheduleId: backupScheduleId, } return r.Execute() @@ -514,6 +578,7 @@ type ApiDeleteVolumeBackupRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupId string volumeBackupId string } @@ -530,9 +595,10 @@ func (r ApiDeleteVolumeBackupRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(r.volumeBackupId, "volumeBackupId")), -1) @@ -550,7 +616,7 @@ func (r ApiDeleteVolumeBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -589,6 +655,17 @@ func (r ApiDeleteVolumeBackupRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -601,150 +678,42 @@ DeleteVolumeBackup: delete volume backup @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupId id of the backup @param volumeBackupId id of the volume backup @return ApiDeleteVolumeBackupRequest */ -func (a *APIClient) DeleteVolumeBackup(ctx context.Context, projectId string, serverId string, backupId string, volumeBackupId string) ApiDeleteVolumeBackupRequest { +func (a *APIClient) DeleteVolumeBackup(ctx context.Context, projectId string, serverId string, region string, backupId string, volumeBackupId string) ApiDeleteVolumeBackupRequest { return ApiDeleteVolumeBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, volumeBackupId: volumeBackupId, } } -func (a *APIClient) DeleteVolumeBackupExecute(ctx context.Context, projectId string, serverId string, backupId string, volumeBackupId string) error { +func (a *APIClient) DeleteVolumeBackupExecute(ctx context.Context, projectId string, serverId string, region string, backupId string, volumeBackupId string) error { r := ApiDeleteVolumeBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, volumeBackupId: volumeBackupId, } return r.Execute() } -type ApiDisableServiceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string -} - -func (r ApiDisableServiceRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DisableService") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - return newErr - } - - return nil -} - -/* -DisableService: disable backup service - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId project id - @param serverId server id - @return ApiDisableServiceRequest -*/ -func (a *APIClient) DisableService(ctx context.Context, projectId string, serverId string) ApiDisableServiceRequest { - return ApiDisableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - } -} - -/* -Deprecated: -*/ -func (a *APIClient) DisableServiceExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiDisableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - } - return r.Execute() -} - type ApiDisableServiceResourceRequest struct { ctx context.Context apiService *DefaultApiService projectId string serverId string + region string } func (r ApiDisableServiceResourceRequest) Execute() error { @@ -759,9 +728,10 @@ func (r ApiDisableServiceResourceRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/service" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -777,7 +747,7 @@ func (r ApiDisableServiceResourceRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -816,6 +786,17 @@ func (r ApiDisableServiceResourceRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -828,143 +809,26 @@ DisableServiceResource: disable backup service @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiDisableServiceResourceRequest */ -func (a *APIClient) DisableServiceResource(ctx context.Context, projectId string, serverId string) ApiDisableServiceResourceRequest { +func (a *APIClient) DisableServiceResource(ctx context.Context, projectId string, serverId string, region string) ApiDisableServiceResourceRequest { return ApiDisableServiceResourceRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) DisableServiceResourceExecute(ctx context.Context, projectId string, serverId string) error { +func (a *APIClient) DisableServiceResourceExecute(ctx context.Context, projectId string, serverId string, region string) error { r := ApiDisableServiceResourceRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - } - return r.Execute() -} - -type ApiEnableServiceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - enableServicePayload *EnableServicePayload -} - -func (r ApiEnableServiceRequest) EnableServicePayload(enableServicePayload EnableServicePayload) ApiEnableServiceRequest { - r.enableServicePayload = &enableServicePayload - return r -} - -func (r ApiEnableServiceRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.EnableService") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.enableServicePayload - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - return newErr - } - - return nil -} - -/* -EnableService: enable backup service - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId project id - @param serverId server id - @return ApiEnableServiceRequest -*/ -func (a *APIClient) EnableService(ctx context.Context, projectId string, serverId string) ApiEnableServiceRequest { - return ApiEnableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - } -} - -/* -Deprecated: -*/ -func (a *APIClient) EnableServiceExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiEnableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, + region: region, } return r.Execute() } @@ -974,6 +838,7 @@ type ApiEnableServiceResourceRequest struct { apiService *DefaultApiService projectId string serverId string + region string enableServiceResourcePayload *EnableServiceResourcePayload } @@ -994,9 +859,10 @@ func (r ApiEnableServiceResourceRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/service" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1012,7 +878,7 @@ func (r ApiEnableServiceResourceRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -1053,6 +919,17 @@ func (r ApiEnableServiceResourceRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -1065,23 +942,26 @@ EnableServiceResource: enable backup service @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiEnableServiceResourceRequest */ -func (a *APIClient) EnableServiceResource(ctx context.Context, projectId string, serverId string) ApiEnableServiceResourceRequest { +func (a *APIClient) EnableServiceResource(ctx context.Context, projectId string, serverId string, region string) ApiEnableServiceResourceRequest { return ApiEnableServiceResourceRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) EnableServiceResourceExecute(ctx context.Context, projectId string, serverId string) error { +func (a *APIClient) EnableServiceResourceExecute(ctx context.Context, projectId string, serverId string, region string) error { r := ApiEnableServiceResourceRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } return r.Execute() } @@ -1091,6 +971,7 @@ type ApiGetBackupRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupId string } @@ -1107,9 +988,10 @@ func (r ApiGetBackupRequest) Execute() (*Backup, error) { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarHeaderParams := make(map[string]string) @@ -1165,6 +1047,17 @@ func (r ApiGetBackupRequest) Execute() (*Backup, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -1187,25 +1080,28 @@ GetBackup: get backup @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupId id of the backup @return ApiGetBackupRequest */ -func (a *APIClient) GetBackup(ctx context.Context, projectId string, serverId string, backupId string) ApiGetBackupRequest { +func (a *APIClient) GetBackup(ctx context.Context, projectId string, serverId string, region string, backupId string) ApiGetBackupRequest { return ApiGetBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, } } -func (a *APIClient) GetBackupExecute(ctx context.Context, projectId string, serverId string, backupId string) (*Backup, error) { +func (a *APIClient) GetBackupExecute(ctx context.Context, projectId string, serverId string, region string, backupId string) (*Backup, error) { r := ApiGetBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, } return r.Execute() @@ -1216,6 +1112,7 @@ type ApiGetBackupScheduleRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupScheduleId string } @@ -1232,9 +1129,10 @@ func (r ApiGetBackupScheduleRequest) Execute() (*BackupSchedule, error) { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backup-schedules/{backupScheduleId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(r.backupScheduleId, "backupScheduleId")), -1) localVarHeaderParams := make(map[string]string) @@ -1290,6 +1188,17 @@ func (r ApiGetBackupScheduleRequest) Execute() (*BackupSchedule, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -1312,25 +1221,28 @@ GetBackupSchedule: get single backup schedule details @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupScheduleId backup schedule id @return ApiGetBackupScheduleRequest */ -func (a *APIClient) GetBackupSchedule(ctx context.Context, projectId string, serverId string, backupScheduleId string) ApiGetBackupScheduleRequest { +func (a *APIClient) GetBackupSchedule(ctx context.Context, projectId string, serverId string, region string, backupScheduleId string) ApiGetBackupScheduleRequest { return ApiGetBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupScheduleId: backupScheduleId, } } -func (a *APIClient) GetBackupScheduleExecute(ctx context.Context, projectId string, serverId string, backupScheduleId string) (*BackupSchedule, error) { +func (a *APIClient) GetBackupScheduleExecute(ctx context.Context, projectId string, serverId string, region string, backupScheduleId string) (*BackupSchedule, error) { r := ApiGetBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupScheduleId: backupScheduleId, } return r.Execute() @@ -1341,6 +1253,7 @@ type ApiGetServiceResourceRequest struct { apiService *DefaultApiService projectId string serverId string + region string } func (r ApiGetServiceResourceRequest) Execute() (*GetBackupServiceResponse, error) { @@ -1356,9 +1269,10 @@ func (r ApiGetServiceResourceRequest) Execute() (*GetBackupServiceResponse, erro return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/service" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1413,6 +1327,17 @@ func (r ApiGetServiceResourceRequest) Execute() (*GetBackupServiceResponse, erro Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -1435,23 +1360,26 @@ GetServiceResource: get backup service details @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiGetServiceResourceRequest */ -func (a *APIClient) GetServiceResource(ctx context.Context, projectId string, serverId string) ApiGetServiceResourceRequest { +func (a *APIClient) GetServiceResource(ctx context.Context, projectId string, serverId string, region string) ApiGetServiceResourceRequest { return ApiGetServiceResourceRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) GetServiceResourceExecute(ctx context.Context, projectId string, serverId string) (*GetBackupServiceResponse, error) { +func (a *APIClient) GetServiceResourceExecute(ctx context.Context, projectId string, serverId string, region string) (*GetBackupServiceResponse, error) { r := ApiGetServiceResourceRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } return r.Execute() } @@ -1475,7 +1403,7 @@ func (r ApiListBackupPoliciesRequest) Execute() (*GetBackupPoliciesResponse, err return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/backup-policies" + localVarPath := localBasePath + "/v2/projects/{projectId}/backup-policies" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -1531,6 +1459,17 @@ func (r ApiListBackupPoliciesRequest) Execute() (*GetBackupPoliciesResponse, err Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -1576,6 +1515,7 @@ type ApiListBackupSchedulesRequest struct { apiService *DefaultApiService projectId string serverId string + region string } func (r ApiListBackupSchedulesRequest) Execute() (*GetBackupSchedulesResponse, error) { @@ -1591,9 +1531,10 @@ func (r ApiListBackupSchedulesRequest) Execute() (*GetBackupSchedulesResponse, e return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backup-schedules" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1648,6 +1589,17 @@ func (r ApiListBackupSchedulesRequest) Execute() (*GetBackupSchedulesResponse, e Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -1670,23 +1622,26 @@ ListBackupSchedules: get list of backup schedules @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiListBackupSchedulesRequest */ -func (a *APIClient) ListBackupSchedules(ctx context.Context, projectId string, serverId string) ApiListBackupSchedulesRequest { +func (a *APIClient) ListBackupSchedules(ctx context.Context, projectId string, serverId string, region string) ApiListBackupSchedulesRequest { return ApiListBackupSchedulesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) ListBackupSchedulesExecute(ctx context.Context, projectId string, serverId string) (*GetBackupSchedulesResponse, error) { +func (a *APIClient) ListBackupSchedulesExecute(ctx context.Context, projectId string, serverId string, region string) (*GetBackupSchedulesResponse, error) { r := ApiListBackupSchedulesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } return r.Execute() } @@ -1696,6 +1651,7 @@ type ApiListBackupsRequest struct { apiService *DefaultApiService projectId string serverId string + region string } func (r ApiListBackupsRequest) Execute() (*GetBackupsListResponse, error) { @@ -1711,9 +1667,10 @@ func (r ApiListBackupsRequest) Execute() (*GetBackupsListResponse, error) { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1768,6 +1725,17 @@ func (r ApiListBackupsRequest) Execute() (*GetBackupsListResponse, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -1790,23 +1758,26 @@ ListBackups: get list of backups @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @return ApiListBackupsRequest */ -func (a *APIClient) ListBackups(ctx context.Context, projectId string, serverId string) ApiListBackupsRequest { +func (a *APIClient) ListBackups(ctx context.Context, projectId string, serverId string, region string) ApiListBackupsRequest { return ApiListBackupsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } } -func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string, serverId string) (*GetBackupsListResponse, error) { +func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetBackupsListResponse, error) { r := ApiListBackupsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, } return r.Execute() } @@ -1816,6 +1787,7 @@ type ApiRestoreBackupRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupId string restoreBackupPayload *RestoreBackupPayload } @@ -1837,9 +1809,10 @@ func (r ApiRestoreBackupRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}/restore" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/restore" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarHeaderParams := make(map[string]string) @@ -1856,7 +1829,7 @@ func (r ApiRestoreBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -1897,6 +1870,17 @@ func (r ApiRestoreBackupRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -1909,25 +1893,28 @@ RestoreBackup: trigger restore of the requested backup @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupId id of the backup @return ApiRestoreBackupRequest */ -func (a *APIClient) RestoreBackup(ctx context.Context, projectId string, serverId string, backupId string) ApiRestoreBackupRequest { +func (a *APIClient) RestoreBackup(ctx context.Context, projectId string, serverId string, region string, backupId string) ApiRestoreBackupRequest { return ApiRestoreBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, } } -func (a *APIClient) RestoreBackupExecute(ctx context.Context, projectId string, serverId string, backupId string) error { +func (a *APIClient) RestoreBackupExecute(ctx context.Context, projectId string, serverId string, region string, backupId string) error { r := ApiRestoreBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, } return r.Execute() @@ -1938,6 +1925,7 @@ type ApiRestoreVolumeBackupRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupId string volumeBackupId string restoreVolumeBackupPayload *RestoreVolumeBackupPayload @@ -1960,9 +1948,10 @@ func (r ApiRestoreVolumeBackupRequest) Execute() error { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}/restore" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}/restore" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(r.volumeBackupId, "volumeBackupId")), -1) @@ -1980,7 +1969,7 @@ func (r ApiRestoreVolumeBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -2021,6 +2010,17 @@ func (r ApiRestoreVolumeBackupRequest) Execute() error { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } return newErr } @@ -2033,27 +2033,30 @@ RestoreVolumeBackup: trigger restore of the requested volume backup @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupId id of the backup @param volumeBackupId id of the volume backup @return ApiRestoreVolumeBackupRequest */ -func (a *APIClient) RestoreVolumeBackup(ctx context.Context, projectId string, serverId string, backupId string, volumeBackupId string) ApiRestoreVolumeBackupRequest { +func (a *APIClient) RestoreVolumeBackup(ctx context.Context, projectId string, serverId string, region string, backupId string, volumeBackupId string) ApiRestoreVolumeBackupRequest { return ApiRestoreVolumeBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, volumeBackupId: volumeBackupId, } } -func (a *APIClient) RestoreVolumeBackupExecute(ctx context.Context, projectId string, serverId string, backupId string, volumeBackupId string) error { +func (a *APIClient) RestoreVolumeBackupExecute(ctx context.Context, projectId string, serverId string, region string, backupId string, volumeBackupId string) error { r := ApiRestoreVolumeBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupId: backupId, volumeBackupId: volumeBackupId, } @@ -2065,6 +2068,7 @@ type ApiUpdateBackupScheduleRequest struct { apiService *DefaultApiService projectId string serverId string + region string backupScheduleId string updateBackupSchedulePayload *UpdateBackupSchedulePayload } @@ -2087,9 +2091,10 @@ func (r ApiUpdateBackupScheduleRequest) Execute() (*BackupSchedule, error) { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/backup-schedules/{backupScheduleId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(r.backupScheduleId, "backupScheduleId")), -1) localVarHeaderParams := make(map[string]string) @@ -2147,6 +2152,17 @@ func (r ApiUpdateBackupScheduleRequest) Execute() (*BackupSchedule, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } return localVarReturnValue, newErr } @@ -2169,25 +2185,28 @@ UpdateBackupSchedule: update backup schedule @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId project id @param serverId server id + @param region region @param backupScheduleId backup schedule id @return ApiUpdateBackupScheduleRequest */ -func (a *APIClient) UpdateBackupSchedule(ctx context.Context, projectId string, serverId string, backupScheduleId string) ApiUpdateBackupScheduleRequest { +func (a *APIClient) UpdateBackupSchedule(ctx context.Context, projectId string, serverId string, region string, backupScheduleId string) ApiUpdateBackupScheduleRequest { return ApiUpdateBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupScheduleId: backupScheduleId, } } -func (a *APIClient) UpdateBackupScheduleExecute(ctx context.Context, projectId string, serverId string, backupScheduleId string) (*BackupSchedule, error) { +func (a *APIClient) UpdateBackupScheduleExecute(ctx context.Context, projectId string, serverId string, region string, backupScheduleId string) (*BackupSchedule, error) { r := ApiUpdateBackupScheduleRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + region: region, backupScheduleId: backupScheduleId, } return r.Execute() diff --git a/services/serverbackup/api_default_test.go b/services/serverbackup/api_default_test.go index 6dbe998a6..5157f42a2 100644 --- a/services/serverbackup/api_default_test.go +++ b/services/serverbackup/api_default_test.go @@ -24,14 +24,16 @@ import ( func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := BackupJob{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -65,28 +67,31 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - resp, reqErr := apiClient.CreateBackup(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.CreateBackup(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService CreateBackupSchedule", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backup-schedules" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := BackupSchedule{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -120,30 +125,33 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - resp, reqErr := apiClient.CreateBackupSchedule(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.CreateBackupSchedule(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService DeleteBackup", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupIdValue := "backupId" - path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -174,11 +182,12 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupId := "backupId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupId := backupIdValue - reqErr := apiClient.DeleteBackup(context.Background(), projectId, serverId, backupId).Execute() + reqErr := apiClient.DeleteBackup(context.Background(), projectId, serverId, region, backupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -186,16 +195,18 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService DeleteBackupSchedule", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backup-schedules/{backupScheduleId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupScheduleIdValue := "backupScheduleId" - path = strings.Replace(path, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -226,11 +237,12 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupScheduleId := "backupScheduleId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupScheduleId := backupScheduleIdValue - reqErr := apiClient.DeleteBackupSchedule(context.Background(), projectId, serverId, backupScheduleId).Execute() + reqErr := apiClient.DeleteBackupSchedule(context.Background(), projectId, serverId, region, backupScheduleId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -238,18 +250,20 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService DeleteVolumeBackup", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupIdValue := "backupId" - path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) volumeBackupIdValue := "volumeBackupId" - path = strings.Replace(path, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(volumeBackupIdValue, "volumeBackupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(volumeBackupIdValue, "volumeBackupId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -280,61 +294,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupId := "backupId" - volumeBackupId := "volumeBackupId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupId := backupIdValue + volumeBackupId := volumeBackupIdValue - reqErr := apiClient.DeleteVolumeBackup(context.Background(), projectId, serverId, backupId, volumeBackupId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService DisableService", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for serverbackup_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := "projectId" - serverId := "serverId" - - reqErr := apiClient.DisableService(context.Background(), projectId, serverId).Execute() + reqErr := apiClient.DeleteVolumeBackup(context.Background(), projectId, serverId, region, backupId, volumeBackupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -342,63 +308,16 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService DisableServiceResource", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/service" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for serverbackup_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := "projectId" - serverId := "serverId" - - reqErr := apiClient.DisableServiceResource(context.Background(), projectId, serverId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService EnableService", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -429,10 +348,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - reqErr := apiClient.EnableService(context.Background(), projectId, serverId).Execute() + reqErr := apiClient.DisableServiceResource(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -440,14 +360,16 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService EnableServiceResource", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/service" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -478,10 +400,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - reqErr := apiClient.EnableServiceResource(context.Background(), projectId, serverId).Execute() + reqErr := apiClient.EnableServiceResource(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -489,16 +412,18 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupIdValue := "backupId" - path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := Backup{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -532,31 +457,34 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupId := "backupId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupId := backupIdValue - resp, reqErr := apiClient.GetBackup(context.Background(), projectId, serverId, backupId).Execute() + resp, reqErr := apiClient.GetBackup(context.Background(), projectId, serverId, region, backupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService GetBackupSchedule", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backup-schedules/{backupScheduleId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupScheduleIdValue := "backupScheduleId" - path = strings.Replace(path, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := BackupSchedule{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -590,29 +518,32 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupScheduleId := "backupScheduleId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupScheduleId := backupScheduleIdValue - resp, reqErr := apiClient.GetBackupSchedule(context.Background(), projectId, serverId, backupScheduleId).Execute() + resp, reqErr := apiClient.GetBackupSchedule(context.Background(), projectId, serverId, region, backupScheduleId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService GetServiceResource", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/service" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetBackupServiceResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -646,26 +577,27 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - resp, reqErr := apiClient.GetServiceResource(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.GetServiceResource(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService ListBackupPolicies", func(t *testing.T) { - path := "/v1/projects/{projectId}/backup-policies" + _apiUrlPath := "/v2/projects/{projectId}/backup-policies" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetBackupPoliciesResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -699,27 +631,29 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" + projectId := projectIdValue resp, reqErr := apiClient.ListBackupPolicies(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService ListBackupSchedules", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backup-schedules" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetBackupSchedulesResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -753,28 +687,31 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - resp, reqErr := apiClient.ListBackupSchedules(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListBackupSchedules(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetBackupsListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -808,30 +745,33 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue - resp, reqErr := apiClient.ListBackups(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListBackups(context.Background(), projectId, serverId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) t.Run("Test DefaultApiService RestoreBackup", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}/restore" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/restore" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupIdValue := "backupId" - path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -862,11 +802,12 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupId := "backupId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupId := backupIdValue - reqErr := apiClient.RestoreBackup(context.Background(), projectId, serverId, backupId).Execute() + reqErr := apiClient.RestoreBackup(context.Background(), projectId, serverId, region, backupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -874,18 +815,20 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService RestoreVolumeBackup", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}/restore" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}/restore" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupIdValue := "backupId" - path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) volumeBackupIdValue := "volumeBackupId" - path = strings.Replace(path, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(volumeBackupIdValue, "volumeBackupId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(volumeBackupIdValue, "volumeBackupId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -916,12 +859,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupId := "backupId" - volumeBackupId := "volumeBackupId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupId := backupIdValue + volumeBackupId := volumeBackupIdValue - reqErr := apiClient.RestoreVolumeBackup(context.Background(), projectId, serverId, backupId, volumeBackupId).Execute() + reqErr := apiClient.RestoreVolumeBackup(context.Background(), projectId, serverId, region, backupId, volumeBackupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -929,16 +873,18 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { }) t.Run("Test DefaultApiService UpdateBackupSchedule", func(t *testing.T) { - path := "/v1/projects/{projectId}/servers/{serverId}/backup-schedules/{backupScheduleId}" + _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) backupScheduleIdValue := "backupScheduleId" - path = strings.Replace(path, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := BackupSchedule{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) @@ -972,16 +918,17 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" - backupScheduleId := "backupScheduleId" + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + backupScheduleId := backupScheduleIdValue - resp, reqErr := apiClient.UpdateBackupSchedule(context.Background(), projectId, serverId, backupScheduleId).Execute() + resp, reqErr := apiClient.UpdateBackupSchedule(context.Background(), projectId, serverId, region, backupScheduleId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { + if IsNil(resp) { t.Fatalf("response not present") } }) diff --git a/services/serverbackup/client.go b/services/serverbackup/client.go index 3783f4666..ba2aea6ec 100644 --- a/services/serverbackup/client.go +++ b/services/serverbackup/client.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -42,7 +42,7 @@ var ( queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -// APIClient manages communication with the STACKIT Server Backup Management API API v1.0 +// APIClient manages communication with the STACKIT Server Backup Management API API v2.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *config.Configuration diff --git a/services/serverbackup/configuration.go b/services/serverbackup/configuration.go index 4be4ddbc9..4382dac50 100644 --- a/services/serverbackup/configuration.go +++ b/services/serverbackup/configuration.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,15 +22,12 @@ func NewConfiguration() *config.Configuration { Debug: false, Servers: config.ServerConfigurations{ { - URL: "https://server-backup.api.{region}stackit.cloud", + URL: "https://server-backup.api.stackit.cloud", Description: "No description provided", Variables: map[string]config.ServerVariable{ "region": { Description: "No description provided", - DefaultValue: "eu01.", - EnumValues: []string{ - "eu01.", - }, + DefaultValue: "global", }, }, }, diff --git a/services/serverbackup/model_backup.go b/services/serverbackup/model_backup.go index ab93f1ed7..db467b021 100644 --- a/services/serverbackup/model_backup.go +++ b/services/serverbackup/model_backup.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,21 +17,187 @@ import ( // checks if the Backup type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Backup{} +/* + types and functions for createdAt +*/ + +// isNotNullableString +type BackupGetCreatedAtAttributeType = *string + +func getBackupGetCreatedAtAttributeTypeOk(arg BackupGetCreatedAtAttributeType) (ret BackupGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetCreatedAtAttributeType(arg *BackupGetCreatedAtAttributeType, val BackupGetCreatedAtRetType) { + *arg = &val +} + +type BackupGetCreatedAtArgType = string +type BackupGetCreatedAtRetType = string + +/* + types and functions for expireAt +*/ + +// isNotNullableString +type BackupGetExpireAtAttributeType = *string + +func getBackupGetExpireAtAttributeTypeOk(arg BackupGetExpireAtAttributeType) (ret BackupGetExpireAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetExpireAtAttributeType(arg *BackupGetExpireAtAttributeType, val BackupGetExpireAtRetType) { + *arg = &val +} + +type BackupGetExpireAtArgType = string +type BackupGetExpireAtRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type BackupGetIdAttributeType = *string + +func getBackupGetIdAttributeTypeOk(arg BackupGetIdAttributeType) (ret BackupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetIdAttributeType(arg *BackupGetIdAttributeType, val BackupGetIdRetType) { + *arg = &val +} + +type BackupGetIdArgType = string +type BackupGetIdRetType = string + +/* + types and functions for lastRestoredAt +*/ + +// isNotNullableString +type BackupGetLastRestoredAtAttributeType = *string + +func getBackupGetLastRestoredAtAttributeTypeOk(arg BackupGetLastRestoredAtAttributeType) (ret BackupGetLastRestoredAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetLastRestoredAtAttributeType(arg *BackupGetLastRestoredAtAttributeType, val BackupGetLastRestoredAtRetType) { + *arg = &val +} + +type BackupGetLastRestoredAtArgType = string +type BackupGetLastRestoredAtRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type BackupGetNameAttributeType = *string + +func getBackupGetNameAttributeTypeOk(arg BackupGetNameAttributeType) (ret BackupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetNameAttributeType(arg *BackupGetNameAttributeType, val BackupGetNameRetType) { + *arg = &val +} + +type BackupGetNameArgType = string +type BackupGetNameRetType = string + +/* + types and functions for size +*/ + +// isInteger +type BackupGetSizeAttributeType = *int64 +type BackupGetSizeArgType = int64 +type BackupGetSizeRetType = int64 + +func getBackupGetSizeAttributeTypeOk(arg BackupGetSizeAttributeType) (ret BackupGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetSizeAttributeType(arg *BackupGetSizeAttributeType, val BackupGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isEnumRef +type BackupGetStatusAttributeType = *string +type BackupGetStatusArgType = string +type BackupGetStatusRetType = string + +func getBackupGetStatusAttributeTypeOk(arg BackupGetStatusAttributeType) (ret BackupGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetStatusAttributeType(arg *BackupGetStatusAttributeType, val BackupGetStatusRetType) { + *arg = &val +} + +/* + types and functions for volumeBackups +*/ + +// isArray +type BackupGetVolumeBackupsAttributeType = *[]BackupVolumeBackupsInner +type BackupGetVolumeBackupsArgType = []BackupVolumeBackupsInner +type BackupGetVolumeBackupsRetType = []BackupVolumeBackupsInner + +func getBackupGetVolumeBackupsAttributeTypeOk(arg BackupGetVolumeBackupsAttributeType) (ret BackupGetVolumeBackupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetVolumeBackupsAttributeType(arg *BackupGetVolumeBackupsAttributeType, val BackupGetVolumeBackupsRetType) { + *arg = &val +} + // Backup struct for Backup type Backup struct { // REQUIRED - CreatedAt *string `json:"createdAt"` + CreatedAt BackupGetCreatedAtAttributeType `json:"createdAt"` // REQUIRED - ExpireAt *string `json:"expireAt"` + ExpireAt BackupGetExpireAtAttributeType `json:"expireAt"` // REQUIRED - Id *string `json:"id"` - LastRestoredAt *string `json:"lastRestoredAt,omitempty"` + Id BackupGetIdAttributeType `json:"id"` + LastRestoredAt BackupGetLastRestoredAtAttributeType `json:"lastRestoredAt,omitempty"` // REQUIRED - Name *string `json:"name"` - Size *int64 `json:"size,omitempty"` + Name BackupGetNameAttributeType `json:"name"` + // Can be cast to int32 without loss of precision. + Size BackupGetSizeAttributeType `json:"size,omitempty"` // REQUIRED - Status *string `json:"status"` - VolumeBackups *[]BackupVolumeBackupsInner `json:"volumeBackups,omitempty"` + Status BackupGetStatusAttributeType `json:"status"` + VolumeBackups BackupGetVolumeBackupsAttributeType `json:"volumeBackups,omitempty"` } type _Backup Backup @@ -40,13 +206,13 @@ type _Backup Backup // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewBackup(createdAt *string, expireAt *string, id *string, name *string, status *string) *Backup { +func NewBackup(createdAt BackupGetCreatedAtArgType, expireAt BackupGetExpireAtArgType, id BackupGetIdArgType, name BackupGetNameArgType, status BackupGetStatusArgType) *Backup { this := Backup{} - this.CreatedAt = createdAt - this.ExpireAt = expireAt - this.Id = id - this.Name = name - this.Status = status + setBackupGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setBackupGetExpireAtAttributeType(&this.ExpireAt, expireAt) + setBackupGetIdAttributeType(&this.Id, id) + setBackupGetNameAttributeType(&this.Name, name) + setBackupGetStatusAttributeType(&this.Status, status) return &this } @@ -59,236 +225,184 @@ func NewBackupWithDefaults() *Backup { } // GetCreatedAt returns the CreatedAt field value -func (o *Backup) GetCreatedAt() *string { - if o == nil || IsNil(o.CreatedAt) { - var ret *string - return ret - } - - return o.CreatedAt +func (o *Backup) GetCreatedAt() (ret BackupGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret } // GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. -func (o *Backup) GetCreatedAtOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.CreatedAt, true +func (o *Backup) GetCreatedAtOk() (ret BackupGetCreatedAtRetType, ok bool) { + return getBackupGetCreatedAtAttributeTypeOk(o.CreatedAt) } // SetCreatedAt sets field value -func (o *Backup) SetCreatedAt(v *string) { - o.CreatedAt = v +func (o *Backup) SetCreatedAt(v BackupGetCreatedAtRetType) { + setBackupGetCreatedAtAttributeType(&o.CreatedAt, v) } // GetExpireAt returns the ExpireAt field value -func (o *Backup) GetExpireAt() *string { - if o == nil || IsNil(o.ExpireAt) { - var ret *string - return ret - } - - return o.ExpireAt +func (o *Backup) GetExpireAt() (ret BackupGetExpireAtRetType) { + ret, _ = o.GetExpireAtOk() + return ret } // GetExpireAtOk returns a tuple with the ExpireAt field value // and a boolean to check if the value has been set. -func (o *Backup) GetExpireAtOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.ExpireAt, true +func (o *Backup) GetExpireAtOk() (ret BackupGetExpireAtRetType, ok bool) { + return getBackupGetExpireAtAttributeTypeOk(o.ExpireAt) } // SetExpireAt sets field value -func (o *Backup) SetExpireAt(v *string) { - o.ExpireAt = v +func (o *Backup) SetExpireAt(v BackupGetExpireAtRetType) { + setBackupGetExpireAtAttributeType(&o.ExpireAt, v) } // GetId returns the Id field value -func (o *Backup) GetId() *string { - if o == nil || IsNil(o.Id) { - var ret *string - return ret - } - - return o.Id +func (o *Backup) GetId() (ret BackupGetIdRetType) { + ret, _ = o.GetIdOk() + return ret } // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. -func (o *Backup) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Id, true +func (o *Backup) GetIdOk() (ret BackupGetIdRetType, ok bool) { + return getBackupGetIdAttributeTypeOk(o.Id) } // SetId sets field value -func (o *Backup) SetId(v *string) { - o.Id = v +func (o *Backup) SetId(v BackupGetIdRetType) { + setBackupGetIdAttributeType(&o.Id, v) } // GetLastRestoredAt returns the LastRestoredAt field value if set, zero value otherwise. -func (o *Backup) GetLastRestoredAt() *string { - if o == nil || IsNil(o.LastRestoredAt) { - var ret *string - return ret - } - return o.LastRestoredAt +func (o *Backup) GetLastRestoredAt() (res BackupGetLastRestoredAtRetType) { + res, _ = o.GetLastRestoredAtOk() + return } // GetLastRestoredAtOk returns a tuple with the LastRestoredAt field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Backup) GetLastRestoredAtOk() (*string, bool) { - if o == nil || IsNil(o.LastRestoredAt) { - return nil, false - } - return o.LastRestoredAt, true +func (o *Backup) GetLastRestoredAtOk() (ret BackupGetLastRestoredAtRetType, ok bool) { + return getBackupGetLastRestoredAtAttributeTypeOk(o.LastRestoredAt) } // HasLastRestoredAt returns a boolean if a field has been set. func (o *Backup) HasLastRestoredAt() bool { - if o != nil && !IsNil(o.LastRestoredAt) { - return true - } - - return false + _, ok := o.GetLastRestoredAtOk() + return ok } // SetLastRestoredAt gets a reference to the given string and assigns it to the LastRestoredAt field. -func (o *Backup) SetLastRestoredAt(v *string) { - o.LastRestoredAt = v +func (o *Backup) SetLastRestoredAt(v BackupGetLastRestoredAtRetType) { + setBackupGetLastRestoredAtAttributeType(&o.LastRestoredAt, v) } // GetName returns the Name field value -func (o *Backup) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - - return o.Name +func (o *Backup) GetName() (ret BackupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. -func (o *Backup) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name, true +func (o *Backup) GetNameOk() (ret BackupGetNameRetType, ok bool) { + return getBackupGetNameAttributeTypeOk(o.Name) } // SetName sets field value -func (o *Backup) SetName(v *string) { - o.Name = v +func (o *Backup) SetName(v BackupGetNameRetType) { + setBackupGetNameAttributeType(&o.Name, v) } // GetSize returns the Size field value if set, zero value otherwise. -func (o *Backup) GetSize() *int64 { - if o == nil || IsNil(o.Size) { - var ret *int64 - return ret - } - return o.Size +func (o *Backup) GetSize() (res BackupGetSizeRetType) { + res, _ = o.GetSizeOk() + return } // GetSizeOk returns a tuple with the Size field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Backup) GetSizeOk() (*int64, bool) { - if o == nil || IsNil(o.Size) { - return nil, false - } - return o.Size, true +func (o *Backup) GetSizeOk() (ret BackupGetSizeRetType, ok bool) { + return getBackupGetSizeAttributeTypeOk(o.Size) } // HasSize returns a boolean if a field has been set. func (o *Backup) HasSize() bool { - if o != nil && !IsNil(o.Size) { - return true - } - - return false + _, ok := o.GetSizeOk() + return ok } // SetSize gets a reference to the given int64 and assigns it to the Size field. -func (o *Backup) SetSize(v *int64) { - o.Size = v +func (o *Backup) SetSize(v BackupGetSizeRetType) { + setBackupGetSizeAttributeType(&o.Size, v) } // GetStatus returns the Status field value -func (o *Backup) GetStatus() *string { - if o == nil || IsNil(o.Status) { - var ret *string - return ret - } - - return o.Status +func (o *Backup) GetStatus() (ret BackupGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret } // GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. -func (o *Backup) GetStatusOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Status, true +func (o *Backup) GetStatusOk() (ret BackupGetStatusRetType, ok bool) { + return getBackupGetStatusAttributeTypeOk(o.Status) } // SetStatus sets field value -func (o *Backup) SetStatus(v *string) { - o.Status = v +func (o *Backup) SetStatus(v BackupGetStatusRetType) { + setBackupGetStatusAttributeType(&o.Status, v) } // GetVolumeBackups returns the VolumeBackups field value if set, zero value otherwise. -func (o *Backup) GetVolumeBackups() *[]BackupVolumeBackupsInner { - if o == nil || IsNil(o.VolumeBackups) { - var ret *[]BackupVolumeBackupsInner - return ret - } - return o.VolumeBackups +func (o *Backup) GetVolumeBackups() (res BackupGetVolumeBackupsRetType) { + res, _ = o.GetVolumeBackupsOk() + return } // GetVolumeBackupsOk returns a tuple with the VolumeBackups field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Backup) GetVolumeBackupsOk() (*[]BackupVolumeBackupsInner, bool) { - if o == nil || IsNil(o.VolumeBackups) { - return nil, false - } - return o.VolumeBackups, true +func (o *Backup) GetVolumeBackupsOk() (ret BackupGetVolumeBackupsRetType, ok bool) { + return getBackupGetVolumeBackupsAttributeTypeOk(o.VolumeBackups) } // HasVolumeBackups returns a boolean if a field has been set. func (o *Backup) HasVolumeBackups() bool { - if o != nil && !IsNil(o.VolumeBackups) { - return true - } - - return false + _, ok := o.GetVolumeBackupsOk() + return ok } // SetVolumeBackups gets a reference to the given []BackupVolumeBackupsInner and assigns it to the VolumeBackups field. -func (o *Backup) SetVolumeBackups(v *[]BackupVolumeBackupsInner) { - o.VolumeBackups = v +func (o *Backup) SetVolumeBackups(v BackupGetVolumeBackupsRetType) { + setBackupGetVolumeBackupsAttributeType(&o.VolumeBackups, v) } func (o Backup) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["createdAt"] = o.CreatedAt - toSerialize["expireAt"] = o.ExpireAt - toSerialize["id"] = o.Id - if !IsNil(o.LastRestoredAt) { - toSerialize["lastRestoredAt"] = o.LastRestoredAt + if val, ok := getBackupGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getBackupGetExpireAtAttributeTypeOk(o.ExpireAt); ok { + toSerialize["ExpireAt"] = val + } + if val, ok := getBackupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBackupGetLastRestoredAtAttributeTypeOk(o.LastRestoredAt); ok { + toSerialize["LastRestoredAt"] = val + } + if val, ok := getBackupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getBackupGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val } - toSerialize["name"] = o.Name - if !IsNil(o.Size) { - toSerialize["size"] = o.Size + if val, ok := getBackupGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val } - toSerialize["status"] = o.Status - if !IsNil(o.VolumeBackups) { - toSerialize["volumeBackups"] = o.VolumeBackups + if val, ok := getBackupGetVolumeBackupsAttributeTypeOk(o.VolumeBackups); ok { + toSerialize["VolumeBackups"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_backup_job.go b/services/serverbackup/model_backup_job.go index 280d4e623..6af5e3af3 100644 --- a/services/serverbackup/model_backup_job.go +++ b/services/serverbackup/model_backup_job.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,10 +17,31 @@ import ( // checks if the BackupJob type satisfies the MappedNullable interface at compile time var _ MappedNullable = &BackupJob{} +/* + types and functions for id +*/ + +// isNotNullableString +type BackupJobGetIdAttributeType = *string + +func getBackupJobGetIdAttributeTypeOk(arg BackupJobGetIdAttributeType) (ret BackupJobGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupJobGetIdAttributeType(arg *BackupJobGetIdAttributeType, val BackupJobGetIdRetType) { + *arg = &val +} + +type BackupJobGetIdArgType = string +type BackupJobGetIdRetType = string + // BackupJob struct for BackupJob type BackupJob struct { // REQUIRED - Id *string `json:"id"` + Id BackupJobGetIdAttributeType `json:"id"` } type _BackupJob BackupJob @@ -29,9 +50,9 @@ type _BackupJob BackupJob // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewBackupJob(id *string) *BackupJob { +func NewBackupJob(id BackupJobGetIdArgType) *BackupJob { this := BackupJob{} - this.Id = id + setBackupJobGetIdAttributeType(&this.Id, id) return &this } @@ -44,32 +65,27 @@ func NewBackupJobWithDefaults() *BackupJob { } // GetId returns the Id field value -func (o *BackupJob) GetId() *string { - if o == nil || IsNil(o.Id) { - var ret *string - return ret - } - - return o.Id +func (o *BackupJob) GetId() (ret BackupJobGetIdRetType) { + ret, _ = o.GetIdOk() + return ret } // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. -func (o *BackupJob) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Id, true +func (o *BackupJob) GetIdOk() (ret BackupJobGetIdRetType, ok bool) { + return getBackupJobGetIdAttributeTypeOk(o.Id) } // SetId sets field value -func (o *BackupJob) SetId(v *string) { - o.Id = v +func (o *BackupJob) SetId(v BackupJobGetIdRetType) { + setBackupJobGetIdAttributeType(&o.Id, v) } func (o BackupJob) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["id"] = o.Id + if val, ok := getBackupJobGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } return toSerialize, nil } diff --git a/services/serverbackup/model_backup_policy.go b/services/serverbackup/model_backup_policy.go index 3b02ecc45..ff95d8c6e 100644 --- a/services/serverbackup/model_backup_policy.go +++ b/services/serverbackup/model_backup_policy.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,15 +17,159 @@ import ( // checks if the BackupPolicy type satisfies the MappedNullable interface at compile time var _ MappedNullable = &BackupPolicy{} +/* + types and functions for backupProperties +*/ + +// isModel +type BackupPolicyGetBackupPropertiesAttributeType = *BackupPolicyBackupProperties +type BackupPolicyGetBackupPropertiesArgType = BackupPolicyBackupProperties +type BackupPolicyGetBackupPropertiesRetType = BackupPolicyBackupProperties + +func getBackupPolicyGetBackupPropertiesAttributeTypeOk(arg BackupPolicyGetBackupPropertiesAttributeType) (ret BackupPolicyGetBackupPropertiesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyGetBackupPropertiesAttributeType(arg *BackupPolicyGetBackupPropertiesAttributeType, val BackupPolicyGetBackupPropertiesRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type BackupPolicygetDefaultAttributeType = *bool +type BackupPolicygetDefaultArgType = bool +type BackupPolicygetDefaultRetType = bool + +func getBackupPolicygetDefaultAttributeTypeOk(arg BackupPolicygetDefaultAttributeType) (ret BackupPolicygetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicygetDefaultAttributeType(arg *BackupPolicygetDefaultAttributeType, val BackupPolicygetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type BackupPolicyGetDescriptionAttributeType = *string + +func getBackupPolicyGetDescriptionAttributeTypeOk(arg BackupPolicyGetDescriptionAttributeType) (ret BackupPolicyGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyGetDescriptionAttributeType(arg *BackupPolicyGetDescriptionAttributeType, val BackupPolicyGetDescriptionRetType) { + *arg = &val +} + +type BackupPolicyGetDescriptionArgType = string +type BackupPolicyGetDescriptionRetType = string + +/* + types and functions for enabled +*/ + +// isBoolean +type BackupPolicygetEnabledAttributeType = *bool +type BackupPolicygetEnabledArgType = bool +type BackupPolicygetEnabledRetType = bool + +func getBackupPolicygetEnabledAttributeTypeOk(arg BackupPolicygetEnabledAttributeType) (ret BackupPolicygetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicygetEnabledAttributeType(arg *BackupPolicygetEnabledAttributeType, val BackupPolicygetEnabledRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BackupPolicyGetIdAttributeType = *string + +func getBackupPolicyGetIdAttributeTypeOk(arg BackupPolicyGetIdAttributeType) (ret BackupPolicyGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyGetIdAttributeType(arg *BackupPolicyGetIdAttributeType, val BackupPolicyGetIdRetType) { + *arg = &val +} + +type BackupPolicyGetIdArgType = string +type BackupPolicyGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type BackupPolicyGetNameAttributeType = *string + +func getBackupPolicyGetNameAttributeTypeOk(arg BackupPolicyGetNameAttributeType) (ret BackupPolicyGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyGetNameAttributeType(arg *BackupPolicyGetNameAttributeType, val BackupPolicyGetNameRetType) { + *arg = &val +} + +type BackupPolicyGetNameArgType = string +type BackupPolicyGetNameRetType = string + +/* + types and functions for rrule +*/ + +// isNotNullableString +type BackupPolicyGetRruleAttributeType = *string + +func getBackupPolicyGetRruleAttributeTypeOk(arg BackupPolicyGetRruleAttributeType) (ret BackupPolicyGetRruleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyGetRruleAttributeType(arg *BackupPolicyGetRruleAttributeType, val BackupPolicyGetRruleRetType) { + *arg = &val +} + +type BackupPolicyGetRruleArgType = string +type BackupPolicyGetRruleRetType = string + // BackupPolicy struct for BackupPolicy type BackupPolicy struct { - BackupProperties *BackupPolicyBackupProperties `json:"backupProperties,omitempty"` - Default *bool `json:"default,omitempty"` - Description *string `json:"description,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Rrule *string `json:"rrule,omitempty"` + BackupProperties BackupPolicyGetBackupPropertiesAttributeType `json:"backupProperties,omitempty"` + Default BackupPolicygetDefaultAttributeType `json:"default,omitempty"` + Description BackupPolicyGetDescriptionAttributeType `json:"description,omitempty"` + Enabled BackupPolicygetEnabledAttributeType `json:"enabled,omitempty"` + Id BackupPolicyGetIdAttributeType `json:"id,omitempty"` + Name BackupPolicyGetNameAttributeType `json:"name,omitempty"` + Rrule BackupPolicyGetRruleAttributeType `json:"rrule,omitempty"` } // NewBackupPolicy instantiates a new BackupPolicy object @@ -46,251 +190,188 @@ func NewBackupPolicyWithDefaults() *BackupPolicy { } // GetBackupProperties returns the BackupProperties field value if set, zero value otherwise. -func (o *BackupPolicy) GetBackupProperties() *BackupPolicyBackupProperties { - if o == nil || IsNil(o.BackupProperties) { - var ret *BackupPolicyBackupProperties - return ret - } - return o.BackupProperties +func (o *BackupPolicy) GetBackupProperties() (res BackupPolicyGetBackupPropertiesRetType) { + res, _ = o.GetBackupPropertiesOk() + return } // GetBackupPropertiesOk returns a tuple with the BackupProperties field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetBackupPropertiesOk() (*BackupPolicyBackupProperties, bool) { - if o == nil || IsNil(o.BackupProperties) { - return nil, false - } - return o.BackupProperties, true +func (o *BackupPolicy) GetBackupPropertiesOk() (ret BackupPolicyGetBackupPropertiesRetType, ok bool) { + return getBackupPolicyGetBackupPropertiesAttributeTypeOk(o.BackupProperties) } // HasBackupProperties returns a boolean if a field has been set. func (o *BackupPolicy) HasBackupProperties() bool { - if o != nil && !IsNil(o.BackupProperties) { - return true - } - - return false + _, ok := o.GetBackupPropertiesOk() + return ok } // SetBackupProperties gets a reference to the given BackupPolicyBackupProperties and assigns it to the BackupProperties field. -func (o *BackupPolicy) SetBackupProperties(v *BackupPolicyBackupProperties) { - o.BackupProperties = v +func (o *BackupPolicy) SetBackupProperties(v BackupPolicyGetBackupPropertiesRetType) { + setBackupPolicyGetBackupPropertiesAttributeType(&o.BackupProperties, v) } // GetDefault returns the Default field value if set, zero value otherwise. -func (o *BackupPolicy) GetDefault() *bool { - if o == nil || IsNil(o.Default) { - var ret *bool - return ret - } - return o.Default +func (o *BackupPolicy) GetDefault() (res BackupPolicygetDefaultRetType) { + res, _ = o.GetDefaultOk() + return } // GetDefaultOk returns a tuple with the Default field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetDefaultOk() (*bool, bool) { - if o == nil || IsNil(o.Default) { - return nil, false - } - return o.Default, true +func (o *BackupPolicy) GetDefaultOk() (ret BackupPolicygetDefaultRetType, ok bool) { + return getBackupPolicygetDefaultAttributeTypeOk(o.Default) } // HasDefault returns a boolean if a field has been set. func (o *BackupPolicy) HasDefault() bool { - if o != nil && !IsNil(o.Default) { - return true - } - - return false + _, ok := o.GetDefaultOk() + return ok } // SetDefault gets a reference to the given bool and assigns it to the Default field. -func (o *BackupPolicy) SetDefault(v *bool) { - o.Default = v +func (o *BackupPolicy) SetDefault(v BackupPolicygetDefaultRetType) { + setBackupPolicygetDefaultAttributeType(&o.Default, v) } // GetDescription returns the Description field value if set, zero value otherwise. -func (o *BackupPolicy) GetDescription() *string { - if o == nil || IsNil(o.Description) { - var ret *string - return ret - } - return o.Description +func (o *BackupPolicy) GetDescription() (res BackupPolicyGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return } // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true +func (o *BackupPolicy) GetDescriptionOk() (ret BackupPolicyGetDescriptionRetType, ok bool) { + return getBackupPolicyGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. func (o *BackupPolicy) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false + _, ok := o.GetDescriptionOk() + return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *BackupPolicy) SetDescription(v *string) { - o.Description = v +func (o *BackupPolicy) SetDescription(v BackupPolicyGetDescriptionRetType) { + setBackupPolicyGetDescriptionAttributeType(&o.Description, v) } // GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *BackupPolicy) GetEnabled() *bool { - if o == nil || IsNil(o.Enabled) { - var ret *bool - return ret - } - return o.Enabled +func (o *BackupPolicy) GetEnabled() (res BackupPolicygetEnabledRetType) { + res, _ = o.GetEnabledOk() + return } // GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetEnabledOk() (*bool, bool) { - if o == nil || IsNil(o.Enabled) { - return nil, false - } - return o.Enabled, true +func (o *BackupPolicy) GetEnabledOk() (ret BackupPolicygetEnabledRetType, ok bool) { + return getBackupPolicygetEnabledAttributeTypeOk(o.Enabled) } // HasEnabled returns a boolean if a field has been set. func (o *BackupPolicy) HasEnabled() bool { - if o != nil && !IsNil(o.Enabled) { - return true - } - - return false + _, ok := o.GetEnabledOk() + return ok } // SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *BackupPolicy) SetEnabled(v *bool) { - o.Enabled = v +func (o *BackupPolicy) SetEnabled(v BackupPolicygetEnabledRetType) { + setBackupPolicygetEnabledAttributeType(&o.Enabled, v) } // GetId returns the Id field value if set, zero value otherwise. -func (o *BackupPolicy) GetId() *string { - if o == nil || IsNil(o.Id) { - var ret *string - return ret - } - return o.Id +func (o *BackupPolicy) GetId() (res BackupPolicyGetIdRetType) { + res, _ = o.GetIdOk() + return } // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { - return nil, false - } - return o.Id, true +func (o *BackupPolicy) GetIdOk() (ret BackupPolicyGetIdRetType, ok bool) { + return getBackupPolicyGetIdAttributeTypeOk(o.Id) } // HasId returns a boolean if a field has been set. func (o *BackupPolicy) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false + _, ok := o.GetIdOk() + return ok } // SetId gets a reference to the given string and assigns it to the Id field. -func (o *BackupPolicy) SetId(v *string) { - o.Id = v +func (o *BackupPolicy) SetId(v BackupPolicyGetIdRetType) { + setBackupPolicyGetIdAttributeType(&o.Id, v) } // GetName returns the Name field value if set, zero value otherwise. -func (o *BackupPolicy) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - return o.Name +func (o *BackupPolicy) GetName() (res BackupPolicyGetNameRetType) { + res, _ = o.GetNameOk() + return } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { - return nil, false - } - return o.Name, true +func (o *BackupPolicy) GetNameOk() (ret BackupPolicyGetNameRetType, ok bool) { + return getBackupPolicyGetNameAttributeTypeOk(o.Name) } // HasName returns a boolean if a field has been set. func (o *BackupPolicy) HasName() bool { - if o != nil && !IsNil(o.Name) { - return true - } - - return false + _, ok := o.GetNameOk() + return ok } // SetName gets a reference to the given string and assigns it to the Name field. -func (o *BackupPolicy) SetName(v *string) { - o.Name = v +func (o *BackupPolicy) SetName(v BackupPolicyGetNameRetType) { + setBackupPolicyGetNameAttributeType(&o.Name, v) } // GetRrule returns the Rrule field value if set, zero value otherwise. -func (o *BackupPolicy) GetRrule() *string { - if o == nil || IsNil(o.Rrule) { - var ret *string - return ret - } - return o.Rrule +func (o *BackupPolicy) GetRrule() (res BackupPolicyGetRruleRetType) { + res, _ = o.GetRruleOk() + return } // GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicy) GetRruleOk() (*string, bool) { - if o == nil || IsNil(o.Rrule) { - return nil, false - } - return o.Rrule, true +func (o *BackupPolicy) GetRruleOk() (ret BackupPolicyGetRruleRetType, ok bool) { + return getBackupPolicyGetRruleAttributeTypeOk(o.Rrule) } // HasRrule returns a boolean if a field has been set. func (o *BackupPolicy) HasRrule() bool { - if o != nil && !IsNil(o.Rrule) { - return true - } - - return false + _, ok := o.GetRruleOk() + return ok } // SetRrule gets a reference to the given string and assigns it to the Rrule field. -func (o *BackupPolicy) SetRrule(v *string) { - o.Rrule = v +func (o *BackupPolicy) SetRrule(v BackupPolicyGetRruleRetType) { + setBackupPolicyGetRruleAttributeType(&o.Rrule, v) } func (o BackupPolicy) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.BackupProperties) { - toSerialize["backupProperties"] = o.BackupProperties + if val, ok := getBackupPolicyGetBackupPropertiesAttributeTypeOk(o.BackupProperties); ok { + toSerialize["BackupProperties"] = val } - if !IsNil(o.Default) { - toSerialize["default"] = o.Default + if val, ok := getBackupPolicygetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val } - if !IsNil(o.Description) { - toSerialize["description"] = o.Description + if val, ok := getBackupPolicyGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val } - if !IsNil(o.Enabled) { - toSerialize["enabled"] = o.Enabled + if val, ok := getBackupPolicygetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val } - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if val, ok := getBackupPolicyGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if val, ok := getBackupPolicyGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val } - if !IsNil(o.Rrule) { - toSerialize["rrule"] = o.Rrule + if val, ok := getBackupPolicyGetRruleAttributeTypeOk(o.Rrule); ok { + toSerialize["Rrule"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_backup_policy_backup_properties.go b/services/serverbackup/model_backup_policy_backup_properties.go index 74cdddddd..d134f5465 100644 --- a/services/serverbackup/model_backup_policy_backup_properties.go +++ b/services/serverbackup/model_backup_policy_backup_properties.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,10 +17,52 @@ import ( // checks if the BackupPolicyBackupProperties type satisfies the MappedNullable interface at compile time var _ MappedNullable = &BackupPolicyBackupProperties{} +/* + types and functions for name +*/ + +// isNotNullableString +type BackupPolicyBackupPropertiesGetNameAttributeType = *string + +func getBackupPolicyBackupPropertiesGetNameAttributeTypeOk(arg BackupPolicyBackupPropertiesGetNameAttributeType) (ret BackupPolicyBackupPropertiesGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyBackupPropertiesGetNameAttributeType(arg *BackupPolicyBackupPropertiesGetNameAttributeType, val BackupPolicyBackupPropertiesGetNameRetType) { + *arg = &val +} + +type BackupPolicyBackupPropertiesGetNameArgType = string +type BackupPolicyBackupPropertiesGetNameRetType = string + +/* + types and functions for retentionPeriod +*/ + +// isInteger +type BackupPolicyBackupPropertiesGetRetentionPeriodAttributeType = *int64 +type BackupPolicyBackupPropertiesGetRetentionPeriodArgType = int64 +type BackupPolicyBackupPropertiesGetRetentionPeriodRetType = int64 + +func getBackupPolicyBackupPropertiesGetRetentionPeriodAttributeTypeOk(arg BackupPolicyBackupPropertiesGetRetentionPeriodAttributeType) (ret BackupPolicyBackupPropertiesGetRetentionPeriodRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPolicyBackupPropertiesGetRetentionPeriodAttributeType(arg *BackupPolicyBackupPropertiesGetRetentionPeriodAttributeType, val BackupPolicyBackupPropertiesGetRetentionPeriodRetType) { + *arg = &val +} + // BackupPolicyBackupProperties struct for BackupPolicyBackupProperties type BackupPolicyBackupProperties struct { - Name *string `json:"name,omitempty"` - RetentionPeriod *int64 `json:"retentionPeriod,omitempty"` + Name BackupPolicyBackupPropertiesGetNameAttributeType `json:"name,omitempty"` + // Can be cast to int32 without loss of precision. + RetentionPeriod BackupPolicyBackupPropertiesGetRetentionPeriodAttributeType `json:"retentionPeriod,omitempty"` } // NewBackupPolicyBackupProperties instantiates a new BackupPolicyBackupProperties object @@ -41,76 +83,58 @@ func NewBackupPolicyBackupPropertiesWithDefaults() *BackupPolicyBackupProperties } // GetName returns the Name field value if set, zero value otherwise. -func (o *BackupPolicyBackupProperties) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - return o.Name +func (o *BackupPolicyBackupProperties) GetName() (res BackupPolicyBackupPropertiesGetNameRetType) { + res, _ = o.GetNameOk() + return } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicyBackupProperties) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { - return nil, false - } - return o.Name, true +func (o *BackupPolicyBackupProperties) GetNameOk() (ret BackupPolicyBackupPropertiesGetNameRetType, ok bool) { + return getBackupPolicyBackupPropertiesGetNameAttributeTypeOk(o.Name) } // HasName returns a boolean if a field has been set. func (o *BackupPolicyBackupProperties) HasName() bool { - if o != nil && !IsNil(o.Name) { - return true - } - - return false + _, ok := o.GetNameOk() + return ok } // SetName gets a reference to the given string and assigns it to the Name field. -func (o *BackupPolicyBackupProperties) SetName(v *string) { - o.Name = v +func (o *BackupPolicyBackupProperties) SetName(v BackupPolicyBackupPropertiesGetNameRetType) { + setBackupPolicyBackupPropertiesGetNameAttributeType(&o.Name, v) } // GetRetentionPeriod returns the RetentionPeriod field value if set, zero value otherwise. -func (o *BackupPolicyBackupProperties) GetRetentionPeriod() *int64 { - if o == nil || IsNil(o.RetentionPeriod) { - var ret *int64 - return ret - } - return o.RetentionPeriod +func (o *BackupPolicyBackupProperties) GetRetentionPeriod() (res BackupPolicyBackupPropertiesGetRetentionPeriodRetType) { + res, _ = o.GetRetentionPeriodOk() + return } // GetRetentionPeriodOk returns a tuple with the RetentionPeriod field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupPolicyBackupProperties) GetRetentionPeriodOk() (*int64, bool) { - if o == nil || IsNil(o.RetentionPeriod) { - return nil, false - } - return o.RetentionPeriod, true +func (o *BackupPolicyBackupProperties) GetRetentionPeriodOk() (ret BackupPolicyBackupPropertiesGetRetentionPeriodRetType, ok bool) { + return getBackupPolicyBackupPropertiesGetRetentionPeriodAttributeTypeOk(o.RetentionPeriod) } // HasRetentionPeriod returns a boolean if a field has been set. func (o *BackupPolicyBackupProperties) HasRetentionPeriod() bool { - if o != nil && !IsNil(o.RetentionPeriod) { - return true - } - - return false + _, ok := o.GetRetentionPeriodOk() + return ok } // SetRetentionPeriod gets a reference to the given int64 and assigns it to the RetentionPeriod field. -func (o *BackupPolicyBackupProperties) SetRetentionPeriod(v *int64) { - o.RetentionPeriod = v +func (o *BackupPolicyBackupProperties) SetRetentionPeriod(v BackupPolicyBackupPropertiesGetRetentionPeriodRetType) { + setBackupPolicyBackupPropertiesGetRetentionPeriodAttributeType(&o.RetentionPeriod, v) } func (o BackupPolicyBackupProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if val, ok := getBackupPolicyBackupPropertiesGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val } - if !IsNil(o.RetentionPeriod) { - toSerialize["retentionPeriod"] = o.RetentionPeriod + if val, ok := getBackupPolicyBackupPropertiesGetRetentionPeriodAttributeTypeOk(o.RetentionPeriod); ok { + toSerialize["RetentionPeriod"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_backup_properties.go b/services/serverbackup/model_backup_properties.go index 3c00ca06c..ec41bdfc3 100644 --- a/services/serverbackup/model_backup_properties.go +++ b/services/serverbackup/model_backup_properties.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,15 +17,77 @@ import ( // checks if the BackupProperties type satisfies the MappedNullable interface at compile time var _ MappedNullable = &BackupProperties{} +/* + types and functions for name +*/ + +// isNotNullableString +type BackupPropertiesGetNameAttributeType = *string + +func getBackupPropertiesGetNameAttributeTypeOk(arg BackupPropertiesGetNameAttributeType) (ret BackupPropertiesGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPropertiesGetNameAttributeType(arg *BackupPropertiesGetNameAttributeType, val BackupPropertiesGetNameRetType) { + *arg = &val +} + +type BackupPropertiesGetNameArgType = string +type BackupPropertiesGetNameRetType = string + +/* + types and functions for retentionPeriod +*/ + +// isInteger +type BackupPropertiesGetRetentionPeriodAttributeType = *int64 +type BackupPropertiesGetRetentionPeriodArgType = int64 +type BackupPropertiesGetRetentionPeriodRetType = int64 + +func getBackupPropertiesGetRetentionPeriodAttributeTypeOk(arg BackupPropertiesGetRetentionPeriodAttributeType) (ret BackupPropertiesGetRetentionPeriodRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPropertiesGetRetentionPeriodAttributeType(arg *BackupPropertiesGetRetentionPeriodAttributeType, val BackupPropertiesGetRetentionPeriodRetType) { + *arg = &val +} + +/* + types and functions for volumeIds +*/ + +// isArray +type BackupPropertiesGetVolumeIdsAttributeType = *[]string +type BackupPropertiesGetVolumeIdsArgType = []string +type BackupPropertiesGetVolumeIdsRetType = []string + +func getBackupPropertiesGetVolumeIdsAttributeTypeOk(arg BackupPropertiesGetVolumeIdsAttributeType) (ret BackupPropertiesGetVolumeIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupPropertiesGetVolumeIdsAttributeType(arg *BackupPropertiesGetVolumeIdsAttributeType, val BackupPropertiesGetVolumeIdsRetType) { + *arg = &val +} + // BackupProperties struct for BackupProperties type BackupProperties struct { // Max 255 characters // REQUIRED - Name *string `json:"name"` + Name BackupPropertiesGetNameAttributeType `json:"name"` // Values are set in days (1-36500) + // Can be cast to int32 without loss of precision. // REQUIRED - RetentionPeriod *int64 `json:"retentionPeriod"` - VolumeIds *[]string `json:"volumeIds,omitempty"` + RetentionPeriod BackupPropertiesGetRetentionPeriodAttributeType `json:"retentionPeriod"` + VolumeIds BackupPropertiesGetVolumeIdsAttributeType `json:"volumeIds,omitempty"` } type _BackupProperties BackupProperties @@ -34,10 +96,10 @@ type _BackupProperties BackupProperties // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewBackupProperties(name *string, retentionPeriod *int64) *BackupProperties { +func NewBackupProperties(name BackupPropertiesGetNameArgType, retentionPeriod BackupPropertiesGetRetentionPeriodArgType) *BackupProperties { this := BackupProperties{} - this.Name = name - this.RetentionPeriod = retentionPeriod + setBackupPropertiesGetNameAttributeType(&this.Name, name) + setBackupPropertiesGetRetentionPeriodAttributeType(&this.RetentionPeriod, retentionPeriod) return &this } @@ -50,91 +112,72 @@ func NewBackupPropertiesWithDefaults() *BackupProperties { } // GetName returns the Name field value -func (o *BackupProperties) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - - return o.Name +func (o *BackupProperties) GetName() (ret BackupPropertiesGetNameRetType) { + ret, _ = o.GetNameOk() + return ret } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. -func (o *BackupProperties) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name, true +func (o *BackupProperties) GetNameOk() (ret BackupPropertiesGetNameRetType, ok bool) { + return getBackupPropertiesGetNameAttributeTypeOk(o.Name) } // SetName sets field value -func (o *BackupProperties) SetName(v *string) { - o.Name = v +func (o *BackupProperties) SetName(v BackupPropertiesGetNameRetType) { + setBackupPropertiesGetNameAttributeType(&o.Name, v) } // GetRetentionPeriod returns the RetentionPeriod field value -func (o *BackupProperties) GetRetentionPeriod() *int64 { - if o == nil || IsNil(o.RetentionPeriod) { - var ret *int64 - return ret - } - - return o.RetentionPeriod +func (o *BackupProperties) GetRetentionPeriod() (ret BackupPropertiesGetRetentionPeriodRetType) { + ret, _ = o.GetRetentionPeriodOk() + return ret } // GetRetentionPeriodOk returns a tuple with the RetentionPeriod field value // and a boolean to check if the value has been set. -func (o *BackupProperties) GetRetentionPeriodOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RetentionPeriod, true +func (o *BackupProperties) GetRetentionPeriodOk() (ret BackupPropertiesGetRetentionPeriodRetType, ok bool) { + return getBackupPropertiesGetRetentionPeriodAttributeTypeOk(o.RetentionPeriod) } // SetRetentionPeriod sets field value -func (o *BackupProperties) SetRetentionPeriod(v *int64) { - o.RetentionPeriod = v +func (o *BackupProperties) SetRetentionPeriod(v BackupPropertiesGetRetentionPeriodRetType) { + setBackupPropertiesGetRetentionPeriodAttributeType(&o.RetentionPeriod, v) } // GetVolumeIds returns the VolumeIds field value if set, zero value otherwise. -func (o *BackupProperties) GetVolumeIds() *[]string { - if o == nil || IsNil(o.VolumeIds) { - var ret *[]string - return ret - } - return o.VolumeIds +func (o *BackupProperties) GetVolumeIds() (res BackupPropertiesGetVolumeIdsRetType) { + res, _ = o.GetVolumeIdsOk() + return } // GetVolumeIdsOk returns a tuple with the VolumeIds field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupProperties) GetVolumeIdsOk() (*[]string, bool) { - if o == nil || IsNil(o.VolumeIds) { - return nil, false - } - return o.VolumeIds, true +func (o *BackupProperties) GetVolumeIdsOk() (ret BackupPropertiesGetVolumeIdsRetType, ok bool) { + return getBackupPropertiesGetVolumeIdsAttributeTypeOk(o.VolumeIds) } // HasVolumeIds returns a boolean if a field has been set. func (o *BackupProperties) HasVolumeIds() bool { - if o != nil && !IsNil(o.VolumeIds) { - return true - } - - return false + _, ok := o.GetVolumeIdsOk() + return ok } // SetVolumeIds gets a reference to the given []string and assigns it to the VolumeIds field. -func (o *BackupProperties) SetVolumeIds(v *[]string) { - o.VolumeIds = v +func (o *BackupProperties) SetVolumeIds(v BackupPropertiesGetVolumeIdsRetType) { + setBackupPropertiesGetVolumeIdsAttributeType(&o.VolumeIds, v) } func (o BackupProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["name"] = o.Name - toSerialize["retentionPeriod"] = o.RetentionPeriod - if !IsNil(o.VolumeIds) { - toSerialize["volumeIds"] = o.VolumeIds + if val, ok := getBackupPropertiesGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getBackupPropertiesGetRetentionPeriodAttributeTypeOk(o.RetentionPeriod); ok { + toSerialize["RetentionPeriod"] = val + } + if val, ok := getBackupPropertiesGetVolumeIdsAttributeTypeOk(o.VolumeIds); ok { + toSerialize["VolumeIds"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_backup_schedule.go b/services/serverbackup/model_backup_schedule.go index 438d2acf1..553b02634 100644 --- a/services/serverbackup/model_backup_schedule.go +++ b/services/serverbackup/model_backup_schedule.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,17 +17,120 @@ import ( // checks if the BackupSchedule type satisfies the MappedNullable interface at compile time var _ MappedNullable = &BackupSchedule{} +/* + types and functions for backupProperties +*/ + +// isModel +type BackupScheduleGetBackupPropertiesAttributeType = *BackupProperties +type BackupScheduleGetBackupPropertiesArgType = BackupProperties +type BackupScheduleGetBackupPropertiesRetType = BackupProperties + +func getBackupScheduleGetBackupPropertiesAttributeTypeOk(arg BackupScheduleGetBackupPropertiesAttributeType) (ret BackupScheduleGetBackupPropertiesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupScheduleGetBackupPropertiesAttributeType(arg *BackupScheduleGetBackupPropertiesAttributeType, val BackupScheduleGetBackupPropertiesRetType) { + *arg = &val +} + +/* + types and functions for enabled +*/ + +// isBoolean +type BackupSchedulegetEnabledAttributeType = *bool +type BackupSchedulegetEnabledArgType = bool +type BackupSchedulegetEnabledRetType = bool + +func getBackupSchedulegetEnabledAttributeTypeOk(arg BackupSchedulegetEnabledAttributeType) (ret BackupSchedulegetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupSchedulegetEnabledAttributeType(arg *BackupSchedulegetEnabledAttributeType, val BackupSchedulegetEnabledRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isInteger +type BackupScheduleGetIdAttributeType = *int64 +type BackupScheduleGetIdArgType = int64 +type BackupScheduleGetIdRetType = int64 + +func getBackupScheduleGetIdAttributeTypeOk(arg BackupScheduleGetIdAttributeType) (ret BackupScheduleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupScheduleGetIdAttributeType(arg *BackupScheduleGetIdAttributeType, val BackupScheduleGetIdRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type BackupScheduleGetNameAttributeType = *string + +func getBackupScheduleGetNameAttributeTypeOk(arg BackupScheduleGetNameAttributeType) (ret BackupScheduleGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupScheduleGetNameAttributeType(arg *BackupScheduleGetNameAttributeType, val BackupScheduleGetNameRetType) { + *arg = &val +} + +type BackupScheduleGetNameArgType = string +type BackupScheduleGetNameRetType = string + +/* + types and functions for rrule +*/ + +// isNotNullableString +type BackupScheduleGetRruleAttributeType = *string + +func getBackupScheduleGetRruleAttributeTypeOk(arg BackupScheduleGetRruleAttributeType) (ret BackupScheduleGetRruleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupScheduleGetRruleAttributeType(arg *BackupScheduleGetRruleAttributeType, val BackupScheduleGetRruleRetType) { + *arg = &val +} + +type BackupScheduleGetRruleArgType = string +type BackupScheduleGetRruleRetType = string + // BackupSchedule struct for BackupSchedule type BackupSchedule struct { - BackupProperties *BackupProperties `json:"backupProperties,omitempty"` + BackupProperties BackupScheduleGetBackupPropertiesAttributeType `json:"backupProperties,omitempty"` // REQUIRED - Enabled *bool `json:"enabled"` + Enabled BackupSchedulegetEnabledAttributeType `json:"enabled"` + // Can be cast to int32 without loss of precision. // REQUIRED - Id *int64 `json:"id"` + Id BackupScheduleGetIdAttributeType `json:"id"` // REQUIRED - Name *string `json:"name"` + Name BackupScheduleGetNameAttributeType `json:"name"` // REQUIRED - Rrule *string `json:"rrule"` + Rrule BackupScheduleGetRruleAttributeType `json:"rrule"` } type _BackupSchedule BackupSchedule @@ -36,12 +139,12 @@ type _BackupSchedule BackupSchedule // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewBackupSchedule(enabled *bool, id *int64, name *string, rrule *string) *BackupSchedule { +func NewBackupSchedule(enabled BackupSchedulegetEnabledArgType, id BackupScheduleGetIdArgType, name BackupScheduleGetNameArgType, rrule BackupScheduleGetRruleArgType) *BackupSchedule { this := BackupSchedule{} - this.Enabled = enabled - this.Id = id - this.Name = name - this.Rrule = rrule + setBackupSchedulegetEnabledAttributeType(&this.Enabled, enabled) + setBackupScheduleGetIdAttributeType(&this.Id, id) + setBackupScheduleGetNameAttributeType(&this.Name, name) + setBackupScheduleGetRruleAttributeType(&this.Rrule, rrule) return &this } @@ -54,142 +157,113 @@ func NewBackupScheduleWithDefaults() *BackupSchedule { } // GetBackupProperties returns the BackupProperties field value if set, zero value otherwise. -func (o *BackupSchedule) GetBackupProperties() *BackupProperties { - if o == nil || IsNil(o.BackupProperties) { - var ret *BackupProperties - return ret - } - return o.BackupProperties +func (o *BackupSchedule) GetBackupProperties() (res BackupScheduleGetBackupPropertiesRetType) { + res, _ = o.GetBackupPropertiesOk() + return } // GetBackupPropertiesOk returns a tuple with the BackupProperties field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupSchedule) GetBackupPropertiesOk() (*BackupProperties, bool) { - if o == nil || IsNil(o.BackupProperties) { - return nil, false - } - return o.BackupProperties, true +func (o *BackupSchedule) GetBackupPropertiesOk() (ret BackupScheduleGetBackupPropertiesRetType, ok bool) { + return getBackupScheduleGetBackupPropertiesAttributeTypeOk(o.BackupProperties) } // HasBackupProperties returns a boolean if a field has been set. func (o *BackupSchedule) HasBackupProperties() bool { - if o != nil && !IsNil(o.BackupProperties) { - return true - } - - return false + _, ok := o.GetBackupPropertiesOk() + return ok } // SetBackupProperties gets a reference to the given BackupProperties and assigns it to the BackupProperties field. -func (o *BackupSchedule) SetBackupProperties(v *BackupProperties) { - o.BackupProperties = v +func (o *BackupSchedule) SetBackupProperties(v BackupScheduleGetBackupPropertiesRetType) { + setBackupScheduleGetBackupPropertiesAttributeType(&o.BackupProperties, v) } // GetEnabled returns the Enabled field value -func (o *BackupSchedule) GetEnabled() *bool { - if o == nil || IsNil(o.Enabled) { - var ret *bool - return ret - } - - return o.Enabled +func (o *BackupSchedule) GetEnabled() (ret BackupSchedulegetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret } // GetEnabledOk returns a tuple with the Enabled field value // and a boolean to check if the value has been set. -func (o *BackupSchedule) GetEnabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return o.Enabled, true +func (o *BackupSchedule) GetEnabledOk() (ret BackupSchedulegetEnabledRetType, ok bool) { + return getBackupSchedulegetEnabledAttributeTypeOk(o.Enabled) } // SetEnabled sets field value -func (o *BackupSchedule) SetEnabled(v *bool) { - o.Enabled = v +func (o *BackupSchedule) SetEnabled(v BackupSchedulegetEnabledRetType) { + setBackupSchedulegetEnabledAttributeType(&o.Enabled, v) } // GetId returns the Id field value -func (o *BackupSchedule) GetId() *int64 { - if o == nil || IsNil(o.Id) { - var ret *int64 - return ret - } - - return o.Id +func (o *BackupSchedule) GetId() (ret BackupScheduleGetIdRetType) { + ret, _ = o.GetIdOk() + return ret } // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. -func (o *BackupSchedule) GetIdOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.Id, true +func (o *BackupSchedule) GetIdOk() (ret BackupScheduleGetIdRetType, ok bool) { + return getBackupScheduleGetIdAttributeTypeOk(o.Id) } // SetId sets field value -func (o *BackupSchedule) SetId(v *int64) { - o.Id = v +func (o *BackupSchedule) SetId(v BackupScheduleGetIdRetType) { + setBackupScheduleGetIdAttributeType(&o.Id, v) } // GetName returns the Name field value -func (o *BackupSchedule) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - - return o.Name +func (o *BackupSchedule) GetName() (ret BackupScheduleGetNameRetType) { + ret, _ = o.GetNameOk() + return ret } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. -func (o *BackupSchedule) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name, true +func (o *BackupSchedule) GetNameOk() (ret BackupScheduleGetNameRetType, ok bool) { + return getBackupScheduleGetNameAttributeTypeOk(o.Name) } // SetName sets field value -func (o *BackupSchedule) SetName(v *string) { - o.Name = v +func (o *BackupSchedule) SetName(v BackupScheduleGetNameRetType) { + setBackupScheduleGetNameAttributeType(&o.Name, v) } // GetRrule returns the Rrule field value -func (o *BackupSchedule) GetRrule() *string { - if o == nil || IsNil(o.Rrule) { - var ret *string - return ret - } - - return o.Rrule +func (o *BackupSchedule) GetRrule() (ret BackupScheduleGetRruleRetType) { + ret, _ = o.GetRruleOk() + return ret } // GetRruleOk returns a tuple with the Rrule field value // and a boolean to check if the value has been set. -func (o *BackupSchedule) GetRruleOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Rrule, true +func (o *BackupSchedule) GetRruleOk() (ret BackupScheduleGetRruleRetType, ok bool) { + return getBackupScheduleGetRruleAttributeTypeOk(o.Rrule) } // SetRrule sets field value -func (o *BackupSchedule) SetRrule(v *string) { - o.Rrule = v +func (o *BackupSchedule) SetRrule(v BackupScheduleGetRruleRetType) { + setBackupScheduleGetRruleAttributeType(&o.Rrule, v) } func (o BackupSchedule) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.BackupProperties) { - toSerialize["backupProperties"] = o.BackupProperties + if val, ok := getBackupScheduleGetBackupPropertiesAttributeTypeOk(o.BackupProperties); ok { + toSerialize["BackupProperties"] = val + } + if val, ok := getBackupSchedulegetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getBackupScheduleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBackupScheduleGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getBackupScheduleGetRruleAttributeTypeOk(o.Rrule); ok { + toSerialize["Rrule"] = val } - toSerialize["enabled"] = o.Enabled - toSerialize["id"] = o.Id - toSerialize["name"] = o.Name - toSerialize["rrule"] = o.Rrule return toSerialize, nil } diff --git a/services/serverbackup/model_backup_volume_backups_inner.go b/services/serverbackup/model_backup_volume_backups_inner.go index 234dd6dab..ecbf1eeea 100644 --- a/services/serverbackup/model_backup_volume_backups_inner.go +++ b/services/serverbackup/model_backup_volume_backups_inner.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,14 +17,139 @@ import ( // checks if the BackupVolumeBackupsInner type satisfies the MappedNullable interface at compile time var _ MappedNullable = &BackupVolumeBackupsInner{} +/* + types and functions for id +*/ + +// isNotNullableString +type BackupVolumeBackupsInnerGetIdAttributeType = *string + +func getBackupVolumeBackupsInnerGetIdAttributeTypeOk(arg BackupVolumeBackupsInnerGetIdAttributeType) (ret BackupVolumeBackupsInnerGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupVolumeBackupsInnerGetIdAttributeType(arg *BackupVolumeBackupsInnerGetIdAttributeType, val BackupVolumeBackupsInnerGetIdRetType) { + *arg = &val +} + +type BackupVolumeBackupsInnerGetIdArgType = string +type BackupVolumeBackupsInnerGetIdRetType = string + +/* + types and functions for lastRestoredAt +*/ + +// isNotNullableString +type BackupVolumeBackupsInnerGetLastRestoredAtAttributeType = *string + +func getBackupVolumeBackupsInnerGetLastRestoredAtAttributeTypeOk(arg BackupVolumeBackupsInnerGetLastRestoredAtAttributeType) (ret BackupVolumeBackupsInnerGetLastRestoredAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupVolumeBackupsInnerGetLastRestoredAtAttributeType(arg *BackupVolumeBackupsInnerGetLastRestoredAtAttributeType, val BackupVolumeBackupsInnerGetLastRestoredAtRetType) { + *arg = &val +} + +type BackupVolumeBackupsInnerGetLastRestoredAtArgType = string +type BackupVolumeBackupsInnerGetLastRestoredAtRetType = string + +/* + types and functions for lastRestoredVolumeId +*/ + +// isNotNullableString +type BackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeType = *string + +func getBackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeTypeOk(arg BackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeType) (ret BackupVolumeBackupsInnerGetLastRestoredVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeType(arg *BackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeType, val BackupVolumeBackupsInnerGetLastRestoredVolumeIdRetType) { + *arg = &val +} + +type BackupVolumeBackupsInnerGetLastRestoredVolumeIdArgType = string +type BackupVolumeBackupsInnerGetLastRestoredVolumeIdRetType = string + +/* + types and functions for size +*/ + +// isInteger +type BackupVolumeBackupsInnerGetSizeAttributeType = *int64 +type BackupVolumeBackupsInnerGetSizeArgType = int64 +type BackupVolumeBackupsInnerGetSizeRetType = int64 + +func getBackupVolumeBackupsInnerGetSizeAttributeTypeOk(arg BackupVolumeBackupsInnerGetSizeAttributeType) (ret BackupVolumeBackupsInnerGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupVolumeBackupsInnerGetSizeAttributeType(arg *BackupVolumeBackupsInnerGetSizeAttributeType, val BackupVolumeBackupsInnerGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isEnumRef +type BackupVolumeBackupsInnerGetStatusAttributeType = *string +type BackupVolumeBackupsInnerGetStatusArgType = string +type BackupVolumeBackupsInnerGetStatusRetType = string + +func getBackupVolumeBackupsInnerGetStatusAttributeTypeOk(arg BackupVolumeBackupsInnerGetStatusAttributeType) (ret BackupVolumeBackupsInnerGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupVolumeBackupsInnerGetStatusAttributeType(arg *BackupVolumeBackupsInnerGetStatusAttributeType, val BackupVolumeBackupsInnerGetStatusRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type BackupVolumeBackupsInnerGetVolumeIdAttributeType = *string + +func getBackupVolumeBackupsInnerGetVolumeIdAttributeTypeOk(arg BackupVolumeBackupsInnerGetVolumeIdAttributeType) (ret BackupVolumeBackupsInnerGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupVolumeBackupsInnerGetVolumeIdAttributeType(arg *BackupVolumeBackupsInnerGetVolumeIdAttributeType, val BackupVolumeBackupsInnerGetVolumeIdRetType) { + *arg = &val +} + +type BackupVolumeBackupsInnerGetVolumeIdArgType = string +type BackupVolumeBackupsInnerGetVolumeIdRetType = string + // BackupVolumeBackupsInner struct for BackupVolumeBackupsInner type BackupVolumeBackupsInner struct { - Id *string `json:"id,omitempty"` - LastRestoredAt *string `json:"lastRestoredAt,omitempty"` - LastRestoredVolumeId *string `json:"lastRestoredVolumeId,omitempty"` - Size *int64 `json:"size,omitempty"` - Status *string `json:"status,omitempty"` - VolumeId *string `json:"volumeId,omitempty"` + Id BackupVolumeBackupsInnerGetIdAttributeType `json:"id,omitempty"` + LastRestoredAt BackupVolumeBackupsInnerGetLastRestoredAtAttributeType `json:"lastRestoredAt,omitempty"` + LastRestoredVolumeId BackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeType `json:"lastRestoredVolumeId,omitempty"` + // Can be cast to int32 without loss of precision. + Size BackupVolumeBackupsInnerGetSizeAttributeType `json:"size,omitempty"` + Status BackupVolumeBackupsInnerGetStatusAttributeType `json:"status,omitempty"` + VolumeId BackupVolumeBackupsInnerGetVolumeIdAttributeType `json:"volumeId,omitempty"` } // NewBackupVolumeBackupsInner instantiates a new BackupVolumeBackupsInner object @@ -45,216 +170,162 @@ func NewBackupVolumeBackupsInnerWithDefaults() *BackupVolumeBackupsInner { } // GetId returns the Id field value if set, zero value otherwise. -func (o *BackupVolumeBackupsInner) GetId() *string { - if o == nil || IsNil(o.Id) { - var ret *string - return ret - } - return o.Id +func (o *BackupVolumeBackupsInner) GetId() (res BackupVolumeBackupsInnerGetIdRetType) { + res, _ = o.GetIdOk() + return } // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupVolumeBackupsInner) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { - return nil, false - } - return o.Id, true +func (o *BackupVolumeBackupsInner) GetIdOk() (ret BackupVolumeBackupsInnerGetIdRetType, ok bool) { + return getBackupVolumeBackupsInnerGetIdAttributeTypeOk(o.Id) } // HasId returns a boolean if a field has been set. func (o *BackupVolumeBackupsInner) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false + _, ok := o.GetIdOk() + return ok } // SetId gets a reference to the given string and assigns it to the Id field. -func (o *BackupVolumeBackupsInner) SetId(v *string) { - o.Id = v +func (o *BackupVolumeBackupsInner) SetId(v BackupVolumeBackupsInnerGetIdRetType) { + setBackupVolumeBackupsInnerGetIdAttributeType(&o.Id, v) } // GetLastRestoredAt returns the LastRestoredAt field value if set, zero value otherwise. -func (o *BackupVolumeBackupsInner) GetLastRestoredAt() *string { - if o == nil || IsNil(o.LastRestoredAt) { - var ret *string - return ret - } - return o.LastRestoredAt +func (o *BackupVolumeBackupsInner) GetLastRestoredAt() (res BackupVolumeBackupsInnerGetLastRestoredAtRetType) { + res, _ = o.GetLastRestoredAtOk() + return } // GetLastRestoredAtOk returns a tuple with the LastRestoredAt field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupVolumeBackupsInner) GetLastRestoredAtOk() (*string, bool) { - if o == nil || IsNil(o.LastRestoredAt) { - return nil, false - } - return o.LastRestoredAt, true +func (o *BackupVolumeBackupsInner) GetLastRestoredAtOk() (ret BackupVolumeBackupsInnerGetLastRestoredAtRetType, ok bool) { + return getBackupVolumeBackupsInnerGetLastRestoredAtAttributeTypeOk(o.LastRestoredAt) } // HasLastRestoredAt returns a boolean if a field has been set. func (o *BackupVolumeBackupsInner) HasLastRestoredAt() bool { - if o != nil && !IsNil(o.LastRestoredAt) { - return true - } - - return false + _, ok := o.GetLastRestoredAtOk() + return ok } // SetLastRestoredAt gets a reference to the given string and assigns it to the LastRestoredAt field. -func (o *BackupVolumeBackupsInner) SetLastRestoredAt(v *string) { - o.LastRestoredAt = v +func (o *BackupVolumeBackupsInner) SetLastRestoredAt(v BackupVolumeBackupsInnerGetLastRestoredAtRetType) { + setBackupVolumeBackupsInnerGetLastRestoredAtAttributeType(&o.LastRestoredAt, v) } // GetLastRestoredVolumeId returns the LastRestoredVolumeId field value if set, zero value otherwise. -func (o *BackupVolumeBackupsInner) GetLastRestoredVolumeId() *string { - if o == nil || IsNil(o.LastRestoredVolumeId) { - var ret *string - return ret - } - return o.LastRestoredVolumeId +func (o *BackupVolumeBackupsInner) GetLastRestoredVolumeId() (res BackupVolumeBackupsInnerGetLastRestoredVolumeIdRetType) { + res, _ = o.GetLastRestoredVolumeIdOk() + return } // GetLastRestoredVolumeIdOk returns a tuple with the LastRestoredVolumeId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupVolumeBackupsInner) GetLastRestoredVolumeIdOk() (*string, bool) { - if o == nil || IsNil(o.LastRestoredVolumeId) { - return nil, false - } - return o.LastRestoredVolumeId, true +func (o *BackupVolumeBackupsInner) GetLastRestoredVolumeIdOk() (ret BackupVolumeBackupsInnerGetLastRestoredVolumeIdRetType, ok bool) { + return getBackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeTypeOk(o.LastRestoredVolumeId) } // HasLastRestoredVolumeId returns a boolean if a field has been set. func (o *BackupVolumeBackupsInner) HasLastRestoredVolumeId() bool { - if o != nil && !IsNil(o.LastRestoredVolumeId) { - return true - } - - return false + _, ok := o.GetLastRestoredVolumeIdOk() + return ok } // SetLastRestoredVolumeId gets a reference to the given string and assigns it to the LastRestoredVolumeId field. -func (o *BackupVolumeBackupsInner) SetLastRestoredVolumeId(v *string) { - o.LastRestoredVolumeId = v +func (o *BackupVolumeBackupsInner) SetLastRestoredVolumeId(v BackupVolumeBackupsInnerGetLastRestoredVolumeIdRetType) { + setBackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeType(&o.LastRestoredVolumeId, v) } // GetSize returns the Size field value if set, zero value otherwise. -func (o *BackupVolumeBackupsInner) GetSize() *int64 { - if o == nil || IsNil(o.Size) { - var ret *int64 - return ret - } - return o.Size +func (o *BackupVolumeBackupsInner) GetSize() (res BackupVolumeBackupsInnerGetSizeRetType) { + res, _ = o.GetSizeOk() + return } // GetSizeOk returns a tuple with the Size field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupVolumeBackupsInner) GetSizeOk() (*int64, bool) { - if o == nil || IsNil(o.Size) { - return nil, false - } - return o.Size, true +func (o *BackupVolumeBackupsInner) GetSizeOk() (ret BackupVolumeBackupsInnerGetSizeRetType, ok bool) { + return getBackupVolumeBackupsInnerGetSizeAttributeTypeOk(o.Size) } // HasSize returns a boolean if a field has been set. func (o *BackupVolumeBackupsInner) HasSize() bool { - if o != nil && !IsNil(o.Size) { - return true - } - - return false + _, ok := o.GetSizeOk() + return ok } // SetSize gets a reference to the given int64 and assigns it to the Size field. -func (o *BackupVolumeBackupsInner) SetSize(v *int64) { - o.Size = v +func (o *BackupVolumeBackupsInner) SetSize(v BackupVolumeBackupsInnerGetSizeRetType) { + setBackupVolumeBackupsInnerGetSizeAttributeType(&o.Size, v) } // GetStatus returns the Status field value if set, zero value otherwise. -func (o *BackupVolumeBackupsInner) GetStatus() *string { - if o == nil || IsNil(o.Status) { - var ret *string - return ret - } - return o.Status +func (o *BackupVolumeBackupsInner) GetStatus() (res BackupVolumeBackupsInnerGetStatusRetType) { + res, _ = o.GetStatusOk() + return } // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupVolumeBackupsInner) GetStatusOk() (*string, bool) { - if o == nil || IsNil(o.Status) { - return nil, false - } - return o.Status, true +func (o *BackupVolumeBackupsInner) GetStatusOk() (ret BackupVolumeBackupsInnerGetStatusRetType, ok bool) { + return getBackupVolumeBackupsInnerGetStatusAttributeTypeOk(o.Status) } // HasStatus returns a boolean if a field has been set. func (o *BackupVolumeBackupsInner) HasStatus() bool { - if o != nil && !IsNil(o.Status) { - return true - } - - return false + _, ok := o.GetStatusOk() + return ok } // SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *BackupVolumeBackupsInner) SetStatus(v *string) { - o.Status = v +func (o *BackupVolumeBackupsInner) SetStatus(v BackupVolumeBackupsInnerGetStatusRetType) { + setBackupVolumeBackupsInnerGetStatusAttributeType(&o.Status, v) } // GetVolumeId returns the VolumeId field value if set, zero value otherwise. -func (o *BackupVolumeBackupsInner) GetVolumeId() *string { - if o == nil || IsNil(o.VolumeId) { - var ret *string - return ret - } - return o.VolumeId +func (o *BackupVolumeBackupsInner) GetVolumeId() (res BackupVolumeBackupsInnerGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return } // GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *BackupVolumeBackupsInner) GetVolumeIdOk() (*string, bool) { - if o == nil || IsNil(o.VolumeId) { - return nil, false - } - return o.VolumeId, true +func (o *BackupVolumeBackupsInner) GetVolumeIdOk() (ret BackupVolumeBackupsInnerGetVolumeIdRetType, ok bool) { + return getBackupVolumeBackupsInnerGetVolumeIdAttributeTypeOk(o.VolumeId) } // HasVolumeId returns a boolean if a field has been set. func (o *BackupVolumeBackupsInner) HasVolumeId() bool { - if o != nil && !IsNil(o.VolumeId) { - return true - } - - return false + _, ok := o.GetVolumeIdOk() + return ok } // SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. -func (o *BackupVolumeBackupsInner) SetVolumeId(v *string) { - o.VolumeId = v +func (o *BackupVolumeBackupsInner) SetVolumeId(v BackupVolumeBackupsInnerGetVolumeIdRetType) { + setBackupVolumeBackupsInnerGetVolumeIdAttributeType(&o.VolumeId, v) } func (o BackupVolumeBackupsInner) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if val, ok := getBackupVolumeBackupsInnerGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val } - if !IsNil(o.LastRestoredAt) { - toSerialize["lastRestoredAt"] = o.LastRestoredAt + if val, ok := getBackupVolumeBackupsInnerGetLastRestoredAtAttributeTypeOk(o.LastRestoredAt); ok { + toSerialize["LastRestoredAt"] = val } - if !IsNil(o.LastRestoredVolumeId) { - toSerialize["lastRestoredVolumeId"] = o.LastRestoredVolumeId + if val, ok := getBackupVolumeBackupsInnerGetLastRestoredVolumeIdAttributeTypeOk(o.LastRestoredVolumeId); ok { + toSerialize["LastRestoredVolumeId"] = val } - if !IsNil(o.Size) { - toSerialize["size"] = o.Size + if val, ok := getBackupVolumeBackupsInnerGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val } - if !IsNil(o.Status) { - toSerialize["status"] = o.Status + if val, ok := getBackupVolumeBackupsInnerGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val } - if !IsNil(o.VolumeId) { - toSerialize["volumeId"] = o.VolumeId + if val, ok := getBackupVolumeBackupsInnerGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_create_backup_payload.go b/services/serverbackup/model_create_backup_payload.go index ee7651ae1..fc083bdbf 100644 --- a/services/serverbackup/model_create_backup_payload.go +++ b/services/serverbackup/model_create_backup_payload.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,15 +17,77 @@ import ( // checks if the CreateBackupPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateBackupPayload{} +/* + types and functions for name +*/ + +// isNotNullableString +type CreateBackupPayloadGetNameAttributeType = *string + +func getCreateBackupPayloadGetNameAttributeTypeOk(arg CreateBackupPayloadGetNameAttributeType) (ret CreateBackupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetNameAttributeType(arg *CreateBackupPayloadGetNameAttributeType, val CreateBackupPayloadGetNameRetType) { + *arg = &val +} + +type CreateBackupPayloadGetNameArgType = string +type CreateBackupPayloadGetNameRetType = string + +/* + types and functions for retentionPeriod +*/ + +// isInteger +type CreateBackupPayloadGetRetentionPeriodAttributeType = *int64 +type CreateBackupPayloadGetRetentionPeriodArgType = int64 +type CreateBackupPayloadGetRetentionPeriodRetType = int64 + +func getCreateBackupPayloadGetRetentionPeriodAttributeTypeOk(arg CreateBackupPayloadGetRetentionPeriodAttributeType) (ret CreateBackupPayloadGetRetentionPeriodRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetRetentionPeriodAttributeType(arg *CreateBackupPayloadGetRetentionPeriodAttributeType, val CreateBackupPayloadGetRetentionPeriodRetType) { + *arg = &val +} + +/* + types and functions for volumeIds +*/ + +// isArray +type CreateBackupPayloadGetVolumeIdsAttributeType = *[]string +type CreateBackupPayloadGetVolumeIdsArgType = []string +type CreateBackupPayloadGetVolumeIdsRetType = []string + +func getCreateBackupPayloadGetVolumeIdsAttributeTypeOk(arg CreateBackupPayloadGetVolumeIdsAttributeType) (ret CreateBackupPayloadGetVolumeIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetVolumeIdsAttributeType(arg *CreateBackupPayloadGetVolumeIdsAttributeType, val CreateBackupPayloadGetVolumeIdsRetType) { + *arg = &val +} + // CreateBackupPayload struct for CreateBackupPayload type CreateBackupPayload struct { // Max 255 characters // REQUIRED - Name *string `json:"name"` + Name CreateBackupPayloadGetNameAttributeType `json:"name"` // Values are set in days (1-36500) + // Can be cast to int32 without loss of precision. // REQUIRED - RetentionPeriod *int64 `json:"retentionPeriod"` - VolumeIds *[]string `json:"volumeIds,omitempty"` + RetentionPeriod CreateBackupPayloadGetRetentionPeriodAttributeType `json:"retentionPeriod"` + VolumeIds CreateBackupPayloadGetVolumeIdsAttributeType `json:"volumeIds,omitempty"` } type _CreateBackupPayload CreateBackupPayload @@ -34,10 +96,10 @@ type _CreateBackupPayload CreateBackupPayload // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewCreateBackupPayload(name *string, retentionPeriod *int64) *CreateBackupPayload { +func NewCreateBackupPayload(name CreateBackupPayloadGetNameArgType, retentionPeriod CreateBackupPayloadGetRetentionPeriodArgType) *CreateBackupPayload { this := CreateBackupPayload{} - this.Name = name - this.RetentionPeriod = retentionPeriod + setCreateBackupPayloadGetNameAttributeType(&this.Name, name) + setCreateBackupPayloadGetRetentionPeriodAttributeType(&this.RetentionPeriod, retentionPeriod) return &this } @@ -50,91 +112,72 @@ func NewCreateBackupPayloadWithDefaults() *CreateBackupPayload { } // GetName returns the Name field value -func (o *CreateBackupPayload) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - - return o.Name +func (o *CreateBackupPayload) GetName() (ret CreateBackupPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. -func (o *CreateBackupPayload) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name, true +func (o *CreateBackupPayload) GetNameOk() (ret CreateBackupPayloadGetNameRetType, ok bool) { + return getCreateBackupPayloadGetNameAttributeTypeOk(o.Name) } // SetName sets field value -func (o *CreateBackupPayload) SetName(v *string) { - o.Name = v +func (o *CreateBackupPayload) SetName(v CreateBackupPayloadGetNameRetType) { + setCreateBackupPayloadGetNameAttributeType(&o.Name, v) } // GetRetentionPeriod returns the RetentionPeriod field value -func (o *CreateBackupPayload) GetRetentionPeriod() *int64 { - if o == nil || IsNil(o.RetentionPeriod) { - var ret *int64 - return ret - } - - return o.RetentionPeriod +func (o *CreateBackupPayload) GetRetentionPeriod() (ret CreateBackupPayloadGetRetentionPeriodRetType) { + ret, _ = o.GetRetentionPeriodOk() + return ret } // GetRetentionPeriodOk returns a tuple with the RetentionPeriod field value // and a boolean to check if the value has been set. -func (o *CreateBackupPayload) GetRetentionPeriodOk() (*int64, bool) { - if o == nil { - return nil, false - } - return o.RetentionPeriod, true +func (o *CreateBackupPayload) GetRetentionPeriodOk() (ret CreateBackupPayloadGetRetentionPeriodRetType, ok bool) { + return getCreateBackupPayloadGetRetentionPeriodAttributeTypeOk(o.RetentionPeriod) } // SetRetentionPeriod sets field value -func (o *CreateBackupPayload) SetRetentionPeriod(v *int64) { - o.RetentionPeriod = v +func (o *CreateBackupPayload) SetRetentionPeriod(v CreateBackupPayloadGetRetentionPeriodRetType) { + setCreateBackupPayloadGetRetentionPeriodAttributeType(&o.RetentionPeriod, v) } // GetVolumeIds returns the VolumeIds field value if set, zero value otherwise. -func (o *CreateBackupPayload) GetVolumeIds() *[]string { - if o == nil || IsNil(o.VolumeIds) { - var ret *[]string - return ret - } - return o.VolumeIds +func (o *CreateBackupPayload) GetVolumeIds() (res CreateBackupPayloadGetVolumeIdsRetType) { + res, _ = o.GetVolumeIdsOk() + return } // GetVolumeIdsOk returns a tuple with the VolumeIds field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateBackupPayload) GetVolumeIdsOk() (*[]string, bool) { - if o == nil || IsNil(o.VolumeIds) { - return nil, false - } - return o.VolumeIds, true +func (o *CreateBackupPayload) GetVolumeIdsOk() (ret CreateBackupPayloadGetVolumeIdsRetType, ok bool) { + return getCreateBackupPayloadGetVolumeIdsAttributeTypeOk(o.VolumeIds) } // HasVolumeIds returns a boolean if a field has been set. func (o *CreateBackupPayload) HasVolumeIds() bool { - if o != nil && !IsNil(o.VolumeIds) { - return true - } - - return false + _, ok := o.GetVolumeIdsOk() + return ok } // SetVolumeIds gets a reference to the given []string and assigns it to the VolumeIds field. -func (o *CreateBackupPayload) SetVolumeIds(v *[]string) { - o.VolumeIds = v +func (o *CreateBackupPayload) SetVolumeIds(v CreateBackupPayloadGetVolumeIdsRetType) { + setCreateBackupPayloadGetVolumeIdsAttributeType(&o.VolumeIds, v) } func (o CreateBackupPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["name"] = o.Name - toSerialize["retentionPeriod"] = o.RetentionPeriod - if !IsNil(o.VolumeIds) { - toSerialize["volumeIds"] = o.VolumeIds + if val, ok := getCreateBackupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateBackupPayloadGetRetentionPeriodAttributeTypeOk(o.RetentionPeriod); ok { + toSerialize["RetentionPeriod"] = val + } + if val, ok := getCreateBackupPayloadGetVolumeIdsAttributeTypeOk(o.VolumeIds); ok { + toSerialize["VolumeIds"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_create_backup_schedule_payload.go b/services/serverbackup/model_create_backup_schedule_payload.go index 0dbc39429..623fc4a8e 100644 --- a/services/serverbackup/model_create_backup_schedule_payload.go +++ b/services/serverbackup/model_create_backup_schedule_payload.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,16 +17,98 @@ import ( // checks if the CreateBackupSchedulePayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateBackupSchedulePayload{} +/* + types and functions for backupProperties +*/ + +// isModel +type CreateBackupSchedulePayloadGetBackupPropertiesAttributeType = *BackupProperties +type CreateBackupSchedulePayloadGetBackupPropertiesArgType = BackupProperties +type CreateBackupSchedulePayloadGetBackupPropertiesRetType = BackupProperties + +func getCreateBackupSchedulePayloadGetBackupPropertiesAttributeTypeOk(arg CreateBackupSchedulePayloadGetBackupPropertiesAttributeType) (ret CreateBackupSchedulePayloadGetBackupPropertiesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupSchedulePayloadGetBackupPropertiesAttributeType(arg *CreateBackupSchedulePayloadGetBackupPropertiesAttributeType, val CreateBackupSchedulePayloadGetBackupPropertiesRetType) { + *arg = &val +} + +/* + types and functions for enabled +*/ + +// isBoolean +type CreateBackupSchedulePayloadgetEnabledAttributeType = *bool +type CreateBackupSchedulePayloadgetEnabledArgType = bool +type CreateBackupSchedulePayloadgetEnabledRetType = bool + +func getCreateBackupSchedulePayloadgetEnabledAttributeTypeOk(arg CreateBackupSchedulePayloadgetEnabledAttributeType) (ret CreateBackupSchedulePayloadgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupSchedulePayloadgetEnabledAttributeType(arg *CreateBackupSchedulePayloadgetEnabledAttributeType, val CreateBackupSchedulePayloadgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateBackupSchedulePayloadGetNameAttributeType = *string + +func getCreateBackupSchedulePayloadGetNameAttributeTypeOk(arg CreateBackupSchedulePayloadGetNameAttributeType) (ret CreateBackupSchedulePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupSchedulePayloadGetNameAttributeType(arg *CreateBackupSchedulePayloadGetNameAttributeType, val CreateBackupSchedulePayloadGetNameRetType) { + *arg = &val +} + +type CreateBackupSchedulePayloadGetNameArgType = string +type CreateBackupSchedulePayloadGetNameRetType = string + +/* + types and functions for rrule +*/ + +// isNotNullableString +type CreateBackupSchedulePayloadGetRruleAttributeType = *string + +func getCreateBackupSchedulePayloadGetRruleAttributeTypeOk(arg CreateBackupSchedulePayloadGetRruleAttributeType) (ret CreateBackupSchedulePayloadGetRruleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupSchedulePayloadGetRruleAttributeType(arg *CreateBackupSchedulePayloadGetRruleAttributeType, val CreateBackupSchedulePayloadGetRruleRetType) { + *arg = &val +} + +type CreateBackupSchedulePayloadGetRruleArgType = string +type CreateBackupSchedulePayloadGetRruleRetType = string + // CreateBackupSchedulePayload struct for CreateBackupSchedulePayload type CreateBackupSchedulePayload struct { - BackupProperties *BackupProperties `json:"backupProperties,omitempty"` + BackupProperties CreateBackupSchedulePayloadGetBackupPropertiesAttributeType `json:"backupProperties,omitempty"` // REQUIRED - Enabled *bool `json:"enabled"` + Enabled CreateBackupSchedulePayloadgetEnabledAttributeType `json:"enabled"` // Max 255 characters // REQUIRED - Name *string `json:"name"` + Name CreateBackupSchedulePayloadGetNameAttributeType `json:"name"` // REQUIRED - Rrule *string `json:"rrule"` + Rrule CreateBackupSchedulePayloadGetRruleAttributeType `json:"rrule"` } type _CreateBackupSchedulePayload CreateBackupSchedulePayload @@ -35,11 +117,11 @@ type _CreateBackupSchedulePayload CreateBackupSchedulePayload // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewCreateBackupSchedulePayload(enabled *bool, name *string, rrule *string) *CreateBackupSchedulePayload { +func NewCreateBackupSchedulePayload(enabled CreateBackupSchedulePayloadgetEnabledArgType, name CreateBackupSchedulePayloadGetNameArgType, rrule CreateBackupSchedulePayloadGetRruleArgType) *CreateBackupSchedulePayload { this := CreateBackupSchedulePayload{} - this.Enabled = enabled - this.Name = name - this.Rrule = rrule + setCreateBackupSchedulePayloadgetEnabledAttributeType(&this.Enabled, enabled) + setCreateBackupSchedulePayloadGetNameAttributeType(&this.Name, name) + setCreateBackupSchedulePayloadGetRruleAttributeType(&this.Rrule, rrule) return &this } @@ -52,117 +134,93 @@ func NewCreateBackupSchedulePayloadWithDefaults() *CreateBackupSchedulePayload { } // GetBackupProperties returns the BackupProperties field value if set, zero value otherwise. -func (o *CreateBackupSchedulePayload) GetBackupProperties() *BackupProperties { - if o == nil || IsNil(o.BackupProperties) { - var ret *BackupProperties - return ret - } - return o.BackupProperties +func (o *CreateBackupSchedulePayload) GetBackupProperties() (res CreateBackupSchedulePayloadGetBackupPropertiesRetType) { + res, _ = o.GetBackupPropertiesOk() + return } // GetBackupPropertiesOk returns a tuple with the BackupProperties field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateBackupSchedulePayload) GetBackupPropertiesOk() (*BackupProperties, bool) { - if o == nil || IsNil(o.BackupProperties) { - return nil, false - } - return o.BackupProperties, true +func (o *CreateBackupSchedulePayload) GetBackupPropertiesOk() (ret CreateBackupSchedulePayloadGetBackupPropertiesRetType, ok bool) { + return getCreateBackupSchedulePayloadGetBackupPropertiesAttributeTypeOk(o.BackupProperties) } // HasBackupProperties returns a boolean if a field has been set. func (o *CreateBackupSchedulePayload) HasBackupProperties() bool { - if o != nil && !IsNil(o.BackupProperties) { - return true - } - - return false + _, ok := o.GetBackupPropertiesOk() + return ok } // SetBackupProperties gets a reference to the given BackupProperties and assigns it to the BackupProperties field. -func (o *CreateBackupSchedulePayload) SetBackupProperties(v *BackupProperties) { - o.BackupProperties = v +func (o *CreateBackupSchedulePayload) SetBackupProperties(v CreateBackupSchedulePayloadGetBackupPropertiesRetType) { + setCreateBackupSchedulePayloadGetBackupPropertiesAttributeType(&o.BackupProperties, v) } // GetEnabled returns the Enabled field value -func (o *CreateBackupSchedulePayload) GetEnabled() *bool { - if o == nil || IsNil(o.Enabled) { - var ret *bool - return ret - } - - return o.Enabled +func (o *CreateBackupSchedulePayload) GetEnabled() (ret CreateBackupSchedulePayloadgetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret } // GetEnabledOk returns a tuple with the Enabled field value // and a boolean to check if the value has been set. -func (o *CreateBackupSchedulePayload) GetEnabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return o.Enabled, true +func (o *CreateBackupSchedulePayload) GetEnabledOk() (ret CreateBackupSchedulePayloadgetEnabledRetType, ok bool) { + return getCreateBackupSchedulePayloadgetEnabledAttributeTypeOk(o.Enabled) } // SetEnabled sets field value -func (o *CreateBackupSchedulePayload) SetEnabled(v *bool) { - o.Enabled = v +func (o *CreateBackupSchedulePayload) SetEnabled(v CreateBackupSchedulePayloadgetEnabledRetType) { + setCreateBackupSchedulePayloadgetEnabledAttributeType(&o.Enabled, v) } // GetName returns the Name field value -func (o *CreateBackupSchedulePayload) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - - return o.Name +func (o *CreateBackupSchedulePayload) GetName() (ret CreateBackupSchedulePayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. -func (o *CreateBackupSchedulePayload) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name, true +func (o *CreateBackupSchedulePayload) GetNameOk() (ret CreateBackupSchedulePayloadGetNameRetType, ok bool) { + return getCreateBackupSchedulePayloadGetNameAttributeTypeOk(o.Name) } // SetName sets field value -func (o *CreateBackupSchedulePayload) SetName(v *string) { - o.Name = v +func (o *CreateBackupSchedulePayload) SetName(v CreateBackupSchedulePayloadGetNameRetType) { + setCreateBackupSchedulePayloadGetNameAttributeType(&o.Name, v) } // GetRrule returns the Rrule field value -func (o *CreateBackupSchedulePayload) GetRrule() *string { - if o == nil || IsNil(o.Rrule) { - var ret *string - return ret - } - - return o.Rrule +func (o *CreateBackupSchedulePayload) GetRrule() (ret CreateBackupSchedulePayloadGetRruleRetType) { + ret, _ = o.GetRruleOk() + return ret } // GetRruleOk returns a tuple with the Rrule field value // and a boolean to check if the value has been set. -func (o *CreateBackupSchedulePayload) GetRruleOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Rrule, true +func (o *CreateBackupSchedulePayload) GetRruleOk() (ret CreateBackupSchedulePayloadGetRruleRetType, ok bool) { + return getCreateBackupSchedulePayloadGetRruleAttributeTypeOk(o.Rrule) } // SetRrule sets field value -func (o *CreateBackupSchedulePayload) SetRrule(v *string) { - o.Rrule = v +func (o *CreateBackupSchedulePayload) SetRrule(v CreateBackupSchedulePayloadGetRruleRetType) { + setCreateBackupSchedulePayloadGetRruleAttributeType(&o.Rrule, v) } func (o CreateBackupSchedulePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.BackupProperties) { - toSerialize["backupProperties"] = o.BackupProperties + if val, ok := getCreateBackupSchedulePayloadGetBackupPropertiesAttributeTypeOk(o.BackupProperties); ok { + toSerialize["BackupProperties"] = val + } + if val, ok := getCreateBackupSchedulePayloadgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getCreateBackupSchedulePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateBackupSchedulePayloadGetRruleAttributeTypeOk(o.Rrule); ok { + toSerialize["Rrule"] = val } - toSerialize["enabled"] = o.Enabled - toSerialize["name"] = o.Name - toSerialize["rrule"] = o.Rrule return toSerialize, nil } diff --git a/services/serverbackup/model_enable_service_payload.go b/services/serverbackup/model_enable_service_payload.go deleted file mode 100644 index 37440cf7f..000000000 --- a/services/serverbackup/model_enable_service_payload.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -STACKIT Server Backup Management API - -API endpoints for Server Backup Operations on STACKIT Servers. - -API version: 1.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package serverbackup - -import ( - "encoding/json" -) - -// checks if the EnableServicePayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &EnableServicePayload{} - -// EnableServicePayload struct for EnableServicePayload -type EnableServicePayload struct { - BackupPolicyId *string `json:"backupPolicyId,omitempty"` -} - -// NewEnableServicePayload instantiates a new EnableServicePayload object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewEnableServicePayload() *EnableServicePayload { - this := EnableServicePayload{} - return &this -} - -// NewEnableServicePayloadWithDefaults instantiates a new EnableServicePayload object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewEnableServicePayloadWithDefaults() *EnableServicePayload { - this := EnableServicePayload{} - return &this -} - -// GetBackupPolicyId returns the BackupPolicyId field value if set, zero value otherwise. -func (o *EnableServicePayload) GetBackupPolicyId() *string { - if o == nil || IsNil(o.BackupPolicyId) { - var ret *string - return ret - } - return o.BackupPolicyId -} - -// GetBackupPolicyIdOk returns a tuple with the BackupPolicyId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EnableServicePayload) GetBackupPolicyIdOk() (*string, bool) { - if o == nil || IsNil(o.BackupPolicyId) { - return nil, false - } - return o.BackupPolicyId, true -} - -// HasBackupPolicyId returns a boolean if a field has been set. -func (o *EnableServicePayload) HasBackupPolicyId() bool { - if o != nil && !IsNil(o.BackupPolicyId) { - return true - } - - return false -} - -// SetBackupPolicyId gets a reference to the given string and assigns it to the BackupPolicyId field. -func (o *EnableServicePayload) SetBackupPolicyId(v *string) { - o.BackupPolicyId = v -} - -func (o EnableServicePayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.BackupPolicyId) { - toSerialize["backupPolicyId"] = o.BackupPolicyId - } - return toSerialize, nil -} - -type NullableEnableServicePayload struct { - value *EnableServicePayload - isSet bool -} - -func (v NullableEnableServicePayload) Get() *EnableServicePayload { - return v.value -} - -func (v *NullableEnableServicePayload) Set(val *EnableServicePayload) { - v.value = val - v.isSet = true -} - -func (v NullableEnableServicePayload) IsSet() bool { - return v.isSet -} - -func (v *NullableEnableServicePayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableEnableServicePayload(val *EnableServicePayload) *NullableEnableServicePayload { - return &NullableEnableServicePayload{value: val, isSet: true} -} - -func (v NullableEnableServicePayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableEnableServicePayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/serverbackup/model_enable_service_resource_payload.go b/services/serverbackup/model_enable_service_resource_payload.go index c37a546fa..74b9d1b9a 100644 --- a/services/serverbackup/model_enable_service_resource_payload.go +++ b/services/serverbackup/model_enable_service_resource_payload.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,9 +17,30 @@ import ( // checks if the EnableServiceResourcePayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &EnableServiceResourcePayload{} +/* + types and functions for backupPolicyId +*/ + +// isNotNullableString +type EnableServiceResourcePayloadGetBackupPolicyIdAttributeType = *string + +func getEnableServiceResourcePayloadGetBackupPolicyIdAttributeTypeOk(arg EnableServiceResourcePayloadGetBackupPolicyIdAttributeType) (ret EnableServiceResourcePayloadGetBackupPolicyIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setEnableServiceResourcePayloadGetBackupPolicyIdAttributeType(arg *EnableServiceResourcePayloadGetBackupPolicyIdAttributeType, val EnableServiceResourcePayloadGetBackupPolicyIdRetType) { + *arg = &val +} + +type EnableServiceResourcePayloadGetBackupPolicyIdArgType = string +type EnableServiceResourcePayloadGetBackupPolicyIdRetType = string + // EnableServiceResourcePayload struct for EnableServiceResourcePayload type EnableServiceResourcePayload struct { - BackupPolicyId *string `json:"backupPolicyId,omitempty"` + BackupPolicyId EnableServiceResourcePayloadGetBackupPolicyIdAttributeType `json:"backupPolicyId,omitempty"` } // NewEnableServiceResourcePayload instantiates a new EnableServiceResourcePayload object @@ -40,41 +61,32 @@ func NewEnableServiceResourcePayloadWithDefaults() *EnableServiceResourcePayload } // GetBackupPolicyId returns the BackupPolicyId field value if set, zero value otherwise. -func (o *EnableServiceResourcePayload) GetBackupPolicyId() *string { - if o == nil || IsNil(o.BackupPolicyId) { - var ret *string - return ret - } - return o.BackupPolicyId +func (o *EnableServiceResourcePayload) GetBackupPolicyId() (res EnableServiceResourcePayloadGetBackupPolicyIdRetType) { + res, _ = o.GetBackupPolicyIdOk() + return } // GetBackupPolicyIdOk returns a tuple with the BackupPolicyId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *EnableServiceResourcePayload) GetBackupPolicyIdOk() (*string, bool) { - if o == nil || IsNil(o.BackupPolicyId) { - return nil, false - } - return o.BackupPolicyId, true +func (o *EnableServiceResourcePayload) GetBackupPolicyIdOk() (ret EnableServiceResourcePayloadGetBackupPolicyIdRetType, ok bool) { + return getEnableServiceResourcePayloadGetBackupPolicyIdAttributeTypeOk(o.BackupPolicyId) } // HasBackupPolicyId returns a boolean if a field has been set. func (o *EnableServiceResourcePayload) HasBackupPolicyId() bool { - if o != nil && !IsNil(o.BackupPolicyId) { - return true - } - - return false + _, ok := o.GetBackupPolicyIdOk() + return ok } // SetBackupPolicyId gets a reference to the given string and assigns it to the BackupPolicyId field. -func (o *EnableServiceResourcePayload) SetBackupPolicyId(v *string) { - o.BackupPolicyId = v +func (o *EnableServiceResourcePayload) SetBackupPolicyId(v EnableServiceResourcePayloadGetBackupPolicyIdRetType) { + setEnableServiceResourcePayloadGetBackupPolicyIdAttributeType(&o.BackupPolicyId, v) } func (o EnableServiceResourcePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.BackupPolicyId) { - toSerialize["backupPolicyId"] = o.BackupPolicyId + if val, ok := getEnableServiceResourcePayloadGetBackupPolicyIdAttributeTypeOk(o.BackupPolicyId); ok { + toSerialize["BackupPolicyId"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_error_response.go b/services/serverbackup/model_error_response.go new file mode 100644 index 000000000..29f8bf8a0 --- /dev/null +++ b/services/serverbackup/model_error_response.go @@ -0,0 +1,172 @@ +/* +STACKIT Server Backup Management API + +API endpoints for Server Backup Operations on STACKIT Servers. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package serverbackup + +import ( + "encoding/json" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +/* + types and functions for message +*/ + +// isNotNullableString +type ErrorResponseGetMessageAttributeType = *string + +func getErrorResponseGetMessageAttributeTypeOk(arg ErrorResponseGetMessageAttributeType) (ret ErrorResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetMessageAttributeType(arg *ErrorResponseGetMessageAttributeType, val ErrorResponseGetMessageRetType) { + *arg = &val +} + +type ErrorResponseGetMessageArgType = string +type ErrorResponseGetMessageRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type ErrorResponseGetStatusAttributeType = *string + +func getErrorResponseGetStatusAttributeTypeOk(arg ErrorResponseGetStatusAttributeType) (ret ErrorResponseGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetStatusAttributeType(arg *ErrorResponseGetStatusAttributeType, val ErrorResponseGetStatusRetType) { + *arg = &val +} + +type ErrorResponseGetStatusArgType = string +type ErrorResponseGetStatusRetType = string + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Details about the error + // REQUIRED + Message ErrorResponseGetMessageAttributeType `json:"message"` + // The string representation of the http status code (i.e. Not Found, Bad Request, etc) + // REQUIRED + Status ErrorResponseGetStatusAttributeType `json:"status"` +} + +type _ErrorResponse ErrorResponse + +// NewErrorResponse instantiates a new ErrorResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorResponse(message ErrorResponseGetMessageArgType, status ErrorResponseGetStatusArgType) *ErrorResponse { + this := ErrorResponse{} + setErrorResponseGetMessageAttributeType(&this.Message, message) + setErrorResponseGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewErrorResponseWithDefaults instantiates a new ErrorResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorResponseWithDefaults() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// GetMessage returns the Message field value +func (o *ErrorResponse) GetMessage() (ret ErrorResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (ret ErrorResponseGetMessageRetType, ok bool) { + return getErrorResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v ErrorResponseGetMessageRetType) { + setErrorResponseGetMessageAttributeType(&o.Message, v) +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() (ret ErrorResponseGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (ret ErrorResponseGetStatusRetType, ok bool) { + return getErrorResponseGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v ErrorResponseGetStatusRetType) { + setErrorResponseGetStatusAttributeType(&o.Status, v) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + if val, ok := getErrorResponseGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableErrorResponse struct { + value *ErrorResponse + isSet bool +} + +func (v NullableErrorResponse) Get() *ErrorResponse { + return v.value +} + +func (v *NullableErrorResponse) Set(val *ErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { + return &NullableErrorResponse{value: val, isSet: true} +} + +func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serverbackup/model_get_backup_policies_response.go b/services/serverbackup/model_get_backup_policies_response.go index d10d7bc8e..ce2cec697 100644 --- a/services/serverbackup/model_get_backup_policies_response.go +++ b/services/serverbackup/model_get_backup_policies_response.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,9 +17,29 @@ import ( // checks if the GetBackupPoliciesResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GetBackupPoliciesResponse{} +/* + types and functions for items +*/ + +// isArray +type GetBackupPoliciesResponseGetItemsAttributeType = *[]BackupPolicy +type GetBackupPoliciesResponseGetItemsArgType = []BackupPolicy +type GetBackupPoliciesResponseGetItemsRetType = []BackupPolicy + +func getGetBackupPoliciesResponseGetItemsAttributeTypeOk(arg GetBackupPoliciesResponseGetItemsAttributeType) (ret GetBackupPoliciesResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetBackupPoliciesResponseGetItemsAttributeType(arg *GetBackupPoliciesResponseGetItemsAttributeType, val GetBackupPoliciesResponseGetItemsRetType) { + *arg = &val +} + // GetBackupPoliciesResponse struct for GetBackupPoliciesResponse type GetBackupPoliciesResponse struct { - Items *[]BackupPolicy `json:"items,omitempty"` + Items GetBackupPoliciesResponseGetItemsAttributeType `json:"items,omitempty"` } // NewGetBackupPoliciesResponse instantiates a new GetBackupPoliciesResponse object @@ -40,41 +60,32 @@ func NewGetBackupPoliciesResponseWithDefaults() *GetBackupPoliciesResponse { } // GetItems returns the Items field value if set, zero value otherwise. -func (o *GetBackupPoliciesResponse) GetItems() *[]BackupPolicy { - if o == nil || IsNil(o.Items) { - var ret *[]BackupPolicy - return ret - } - return o.Items +func (o *GetBackupPoliciesResponse) GetItems() (res GetBackupPoliciesResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return } // GetItemsOk returns a tuple with the Items field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetBackupPoliciesResponse) GetItemsOk() (*[]BackupPolicy, bool) { - if o == nil || IsNil(o.Items) { - return nil, false - } - return o.Items, true +func (o *GetBackupPoliciesResponse) GetItemsOk() (ret GetBackupPoliciesResponseGetItemsRetType, ok bool) { + return getGetBackupPoliciesResponseGetItemsAttributeTypeOk(o.Items) } // HasItems returns a boolean if a field has been set. func (o *GetBackupPoliciesResponse) HasItems() bool { - if o != nil && !IsNil(o.Items) { - return true - } - - return false + _, ok := o.GetItemsOk() + return ok } // SetItems gets a reference to the given []BackupPolicy and assigns it to the Items field. -func (o *GetBackupPoliciesResponse) SetItems(v *[]BackupPolicy) { - o.Items = v +func (o *GetBackupPoliciesResponse) SetItems(v GetBackupPoliciesResponseGetItemsRetType) { + setGetBackupPoliciesResponseGetItemsAttributeType(&o.Items, v) } func (o GetBackupPoliciesResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Items) { - toSerialize["items"] = o.Items + if val, ok := getGetBackupPoliciesResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_get_backup_schedules_response.go b/services/serverbackup/model_get_backup_schedules_response.go index 54529d2be..e46ec2229 100644 --- a/services/serverbackup/model_get_backup_schedules_response.go +++ b/services/serverbackup/model_get_backup_schedules_response.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,9 +17,29 @@ import ( // checks if the GetBackupSchedulesResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GetBackupSchedulesResponse{} +/* + types and functions for items +*/ + +// isArray +type GetBackupSchedulesResponseGetItemsAttributeType = *[]BackupSchedule +type GetBackupSchedulesResponseGetItemsArgType = []BackupSchedule +type GetBackupSchedulesResponseGetItemsRetType = []BackupSchedule + +func getGetBackupSchedulesResponseGetItemsAttributeTypeOk(arg GetBackupSchedulesResponseGetItemsAttributeType) (ret GetBackupSchedulesResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetBackupSchedulesResponseGetItemsAttributeType(arg *GetBackupSchedulesResponseGetItemsAttributeType, val GetBackupSchedulesResponseGetItemsRetType) { + *arg = &val +} + // GetBackupSchedulesResponse struct for GetBackupSchedulesResponse type GetBackupSchedulesResponse struct { - Items *[]BackupSchedule `json:"items,omitempty"` + Items GetBackupSchedulesResponseGetItemsAttributeType `json:"items,omitempty"` } // NewGetBackupSchedulesResponse instantiates a new GetBackupSchedulesResponse object @@ -40,41 +60,32 @@ func NewGetBackupSchedulesResponseWithDefaults() *GetBackupSchedulesResponse { } // GetItems returns the Items field value if set, zero value otherwise. -func (o *GetBackupSchedulesResponse) GetItems() *[]BackupSchedule { - if o == nil || IsNil(o.Items) { - var ret *[]BackupSchedule - return ret - } - return o.Items +func (o *GetBackupSchedulesResponse) GetItems() (res GetBackupSchedulesResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return } // GetItemsOk returns a tuple with the Items field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetBackupSchedulesResponse) GetItemsOk() (*[]BackupSchedule, bool) { - if o == nil || IsNil(o.Items) { - return nil, false - } - return o.Items, true +func (o *GetBackupSchedulesResponse) GetItemsOk() (ret GetBackupSchedulesResponseGetItemsRetType, ok bool) { + return getGetBackupSchedulesResponseGetItemsAttributeTypeOk(o.Items) } // HasItems returns a boolean if a field has been set. func (o *GetBackupSchedulesResponse) HasItems() bool { - if o != nil && !IsNil(o.Items) { - return true - } - - return false + _, ok := o.GetItemsOk() + return ok } // SetItems gets a reference to the given []BackupSchedule and assigns it to the Items field. -func (o *GetBackupSchedulesResponse) SetItems(v *[]BackupSchedule) { - o.Items = v +func (o *GetBackupSchedulesResponse) SetItems(v GetBackupSchedulesResponseGetItemsRetType) { + setGetBackupSchedulesResponseGetItemsAttributeType(&o.Items, v) } func (o GetBackupSchedulesResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Items) { - toSerialize["items"] = o.Items + if val, ok := getGetBackupSchedulesResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_get_backup_service_response.go b/services/serverbackup/model_get_backup_service_response.go index 0981fbc25..5f5f9ae0a 100644 --- a/services/serverbackup/model_get_backup_service_response.go +++ b/services/serverbackup/model_get_backup_service_response.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,9 +17,29 @@ import ( // checks if the GetBackupServiceResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GetBackupServiceResponse{} +/* + types and functions for enabled +*/ + +// isBoolean +type GetBackupServiceResponsegetEnabledAttributeType = *bool +type GetBackupServiceResponsegetEnabledArgType = bool +type GetBackupServiceResponsegetEnabledRetType = bool + +func getGetBackupServiceResponsegetEnabledAttributeTypeOk(arg GetBackupServiceResponsegetEnabledAttributeType) (ret GetBackupServiceResponsegetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetBackupServiceResponsegetEnabledAttributeType(arg *GetBackupServiceResponsegetEnabledAttributeType, val GetBackupServiceResponsegetEnabledRetType) { + *arg = &val +} + // GetBackupServiceResponse struct for GetBackupServiceResponse type GetBackupServiceResponse struct { - Enabled *bool `json:"enabled,omitempty"` + Enabled GetBackupServiceResponsegetEnabledAttributeType `json:"enabled,omitempty"` } // NewGetBackupServiceResponse instantiates a new GetBackupServiceResponse object @@ -40,41 +60,32 @@ func NewGetBackupServiceResponseWithDefaults() *GetBackupServiceResponse { } // GetEnabled returns the Enabled field value if set, zero value otherwise. -func (o *GetBackupServiceResponse) GetEnabled() *bool { - if o == nil || IsNil(o.Enabled) { - var ret *bool - return ret - } - return o.Enabled +func (o *GetBackupServiceResponse) GetEnabled() (res GetBackupServiceResponsegetEnabledRetType) { + res, _ = o.GetEnabledOk() + return } // GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetBackupServiceResponse) GetEnabledOk() (*bool, bool) { - if o == nil || IsNil(o.Enabled) { - return nil, false - } - return o.Enabled, true +func (o *GetBackupServiceResponse) GetEnabledOk() (ret GetBackupServiceResponsegetEnabledRetType, ok bool) { + return getGetBackupServiceResponsegetEnabledAttributeTypeOk(o.Enabled) } // HasEnabled returns a boolean if a field has been set. func (o *GetBackupServiceResponse) HasEnabled() bool { - if o != nil && !IsNil(o.Enabled) { - return true - } - - return false + _, ok := o.GetEnabledOk() + return ok } // SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *GetBackupServiceResponse) SetEnabled(v *bool) { - o.Enabled = v +func (o *GetBackupServiceResponse) SetEnabled(v GetBackupServiceResponsegetEnabledRetType) { + setGetBackupServiceResponsegetEnabledAttributeType(&o.Enabled, v) } func (o GetBackupServiceResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Enabled) { - toSerialize["enabled"] = o.Enabled + if val, ok := getGetBackupServiceResponsegetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_get_backups_list_response.go b/services/serverbackup/model_get_backups_list_response.go index acfc31a89..08485aac3 100644 --- a/services/serverbackup/model_get_backups_list_response.go +++ b/services/serverbackup/model_get_backups_list_response.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,9 +17,29 @@ import ( // checks if the GetBackupsListResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GetBackupsListResponse{} +/* + types and functions for items +*/ + +// isArray +type GetBackupsListResponseGetItemsAttributeType = *[]Backup +type GetBackupsListResponseGetItemsArgType = []Backup +type GetBackupsListResponseGetItemsRetType = []Backup + +func getGetBackupsListResponseGetItemsAttributeTypeOk(arg GetBackupsListResponseGetItemsAttributeType) (ret GetBackupsListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetBackupsListResponseGetItemsAttributeType(arg *GetBackupsListResponseGetItemsAttributeType, val GetBackupsListResponseGetItemsRetType) { + *arg = &val +} + // GetBackupsListResponse struct for GetBackupsListResponse type GetBackupsListResponse struct { - Items *[]Backup `json:"items,omitempty"` + Items GetBackupsListResponseGetItemsAttributeType `json:"items,omitempty"` } // NewGetBackupsListResponse instantiates a new GetBackupsListResponse object @@ -40,41 +60,32 @@ func NewGetBackupsListResponseWithDefaults() *GetBackupsListResponse { } // GetItems returns the Items field value if set, zero value otherwise. -func (o *GetBackupsListResponse) GetItems() *[]Backup { - if o == nil || IsNil(o.Items) { - var ret *[]Backup - return ret - } - return o.Items +func (o *GetBackupsListResponse) GetItems() (res GetBackupsListResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return } // GetItemsOk returns a tuple with the Items field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetBackupsListResponse) GetItemsOk() (*[]Backup, bool) { - if o == nil || IsNil(o.Items) { - return nil, false - } - return o.Items, true +func (o *GetBackupsListResponse) GetItemsOk() (ret GetBackupsListResponseGetItemsRetType, ok bool) { + return getGetBackupsListResponseGetItemsAttributeTypeOk(o.Items) } // HasItems returns a boolean if a field has been set. func (o *GetBackupsListResponse) HasItems() bool { - if o != nil && !IsNil(o.Items) { - return true - } - - return false + _, ok := o.GetItemsOk() + return ok } // SetItems gets a reference to the given []Backup and assigns it to the Items field. -func (o *GetBackupsListResponse) SetItems(v *[]Backup) { - o.Items = v +func (o *GetBackupsListResponse) SetItems(v GetBackupsListResponseGetItemsRetType) { + setGetBackupsListResponseGetItemsAttributeType(&o.Items, v) } func (o GetBackupsListResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Items) { - toSerialize["items"] = o.Items + if val, ok := getGetBackupsListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_restore_backup_payload.go b/services/serverbackup/model_restore_backup_payload.go index f9514cfb5..4ae0addaa 100644 --- a/services/serverbackup/model_restore_backup_payload.go +++ b/services/serverbackup/model_restore_backup_payload.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,11 +17,51 @@ import ( // checks if the RestoreBackupPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &RestoreBackupPayload{} +/* + types and functions for startServerAfterRestore +*/ + +// isBoolean +type RestoreBackupPayloadgetStartServerAfterRestoreAttributeType = *bool +type RestoreBackupPayloadgetStartServerAfterRestoreArgType = bool +type RestoreBackupPayloadgetStartServerAfterRestoreRetType = bool + +func getRestoreBackupPayloadgetStartServerAfterRestoreAttributeTypeOk(arg RestoreBackupPayloadgetStartServerAfterRestoreAttributeType) (ret RestoreBackupPayloadgetStartServerAfterRestoreRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRestoreBackupPayloadgetStartServerAfterRestoreAttributeType(arg *RestoreBackupPayloadgetStartServerAfterRestoreAttributeType, val RestoreBackupPayloadgetStartServerAfterRestoreRetType) { + *arg = &val +} + +/* + types and functions for volumeIds +*/ + +// isArray +type RestoreBackupPayloadGetVolumeIdsAttributeType = *[]string +type RestoreBackupPayloadGetVolumeIdsArgType = []string +type RestoreBackupPayloadGetVolumeIdsRetType = []string + +func getRestoreBackupPayloadGetVolumeIdsAttributeTypeOk(arg RestoreBackupPayloadGetVolumeIdsAttributeType) (ret RestoreBackupPayloadGetVolumeIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRestoreBackupPayloadGetVolumeIdsAttributeType(arg *RestoreBackupPayloadGetVolumeIdsAttributeType, val RestoreBackupPayloadGetVolumeIdsRetType) { + *arg = &val +} + // RestoreBackupPayload struct for RestoreBackupPayload type RestoreBackupPayload struct { // REQUIRED - StartServerAfterRestore *bool `json:"startServerAfterRestore"` - VolumeIds *[]string `json:"volumeIds,omitempty"` + StartServerAfterRestore RestoreBackupPayloadgetStartServerAfterRestoreAttributeType `json:"startServerAfterRestore"` + VolumeIds RestoreBackupPayloadGetVolumeIdsAttributeType `json:"volumeIds,omitempty"` } type _RestoreBackupPayload RestoreBackupPayload @@ -30,9 +70,9 @@ type _RestoreBackupPayload RestoreBackupPayload // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRestoreBackupPayload(startServerAfterRestore *bool) *RestoreBackupPayload { +func NewRestoreBackupPayload(startServerAfterRestore RestoreBackupPayloadgetStartServerAfterRestoreArgType) *RestoreBackupPayload { this := RestoreBackupPayload{} - this.StartServerAfterRestore = startServerAfterRestore + setRestoreBackupPayloadgetStartServerAfterRestoreAttributeType(&this.StartServerAfterRestore, startServerAfterRestore) return &this } @@ -45,66 +85,52 @@ func NewRestoreBackupPayloadWithDefaults() *RestoreBackupPayload { } // GetStartServerAfterRestore returns the StartServerAfterRestore field value -func (o *RestoreBackupPayload) GetStartServerAfterRestore() *bool { - if o == nil || IsNil(o.StartServerAfterRestore) { - var ret *bool - return ret - } - - return o.StartServerAfterRestore +func (o *RestoreBackupPayload) GetStartServerAfterRestore() (ret RestoreBackupPayloadgetStartServerAfterRestoreRetType) { + ret, _ = o.GetStartServerAfterRestoreOk() + return ret } // GetStartServerAfterRestoreOk returns a tuple with the StartServerAfterRestore field value // and a boolean to check if the value has been set. -func (o *RestoreBackupPayload) GetStartServerAfterRestoreOk() (*bool, bool) { - if o == nil { - return nil, false - } - return o.StartServerAfterRestore, true +func (o *RestoreBackupPayload) GetStartServerAfterRestoreOk() (ret RestoreBackupPayloadgetStartServerAfterRestoreRetType, ok bool) { + return getRestoreBackupPayloadgetStartServerAfterRestoreAttributeTypeOk(o.StartServerAfterRestore) } // SetStartServerAfterRestore sets field value -func (o *RestoreBackupPayload) SetStartServerAfterRestore(v *bool) { - o.StartServerAfterRestore = v +func (o *RestoreBackupPayload) SetStartServerAfterRestore(v RestoreBackupPayloadgetStartServerAfterRestoreRetType) { + setRestoreBackupPayloadgetStartServerAfterRestoreAttributeType(&o.StartServerAfterRestore, v) } // GetVolumeIds returns the VolumeIds field value if set, zero value otherwise. -func (o *RestoreBackupPayload) GetVolumeIds() *[]string { - if o == nil || IsNil(o.VolumeIds) { - var ret *[]string - return ret - } - return o.VolumeIds +func (o *RestoreBackupPayload) GetVolumeIds() (res RestoreBackupPayloadGetVolumeIdsRetType) { + res, _ = o.GetVolumeIdsOk() + return } // GetVolumeIdsOk returns a tuple with the VolumeIds field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *RestoreBackupPayload) GetVolumeIdsOk() (*[]string, bool) { - if o == nil || IsNil(o.VolumeIds) { - return nil, false - } - return o.VolumeIds, true +func (o *RestoreBackupPayload) GetVolumeIdsOk() (ret RestoreBackupPayloadGetVolumeIdsRetType, ok bool) { + return getRestoreBackupPayloadGetVolumeIdsAttributeTypeOk(o.VolumeIds) } // HasVolumeIds returns a boolean if a field has been set. func (o *RestoreBackupPayload) HasVolumeIds() bool { - if o != nil && !IsNil(o.VolumeIds) { - return true - } - - return false + _, ok := o.GetVolumeIdsOk() + return ok } // SetVolumeIds gets a reference to the given []string and assigns it to the VolumeIds field. -func (o *RestoreBackupPayload) SetVolumeIds(v *[]string) { - o.VolumeIds = v +func (o *RestoreBackupPayload) SetVolumeIds(v RestoreBackupPayloadGetVolumeIdsRetType) { + setRestoreBackupPayloadGetVolumeIdsAttributeType(&o.VolumeIds, v) } func (o RestoreBackupPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["startServerAfterRestore"] = o.StartServerAfterRestore - if !IsNil(o.VolumeIds) { - toSerialize["volumeIds"] = o.VolumeIds + if val, ok := getRestoreBackupPayloadgetStartServerAfterRestoreAttributeTypeOk(o.StartServerAfterRestore); ok { + toSerialize["StartServerAfterRestore"] = val + } + if val, ok := getRestoreBackupPayloadGetVolumeIdsAttributeTypeOk(o.VolumeIds); ok { + toSerialize["VolumeIds"] = val } return toSerialize, nil } diff --git a/services/serverbackup/model_restore_volume_backup_payload.go b/services/serverbackup/model_restore_volume_backup_payload.go index fbeb055a9..e3775c465 100644 --- a/services/serverbackup/model_restore_volume_backup_payload.go +++ b/services/serverbackup/model_restore_volume_backup_payload.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,10 +17,31 @@ import ( // checks if the RestoreVolumeBackupPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &RestoreVolumeBackupPayload{} +/* + types and functions for restoreVolumeId +*/ + +// isNotNullableString +type RestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType = *string + +func getRestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeTypeOk(arg RestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType) (ret RestoreVolumeBackupPayloadGetRestoreVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType(arg *RestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType, val RestoreVolumeBackupPayloadGetRestoreVolumeIdRetType) { + *arg = &val +} + +type RestoreVolumeBackupPayloadGetRestoreVolumeIdArgType = string +type RestoreVolumeBackupPayloadGetRestoreVolumeIdRetType = string + // RestoreVolumeBackupPayload struct for RestoreVolumeBackupPayload type RestoreVolumeBackupPayload struct { // REQUIRED - RestoreVolumeId *string `json:"restoreVolumeId"` + RestoreVolumeId RestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType `json:"restoreVolumeId"` } type _RestoreVolumeBackupPayload RestoreVolumeBackupPayload @@ -29,9 +50,9 @@ type _RestoreVolumeBackupPayload RestoreVolumeBackupPayload // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRestoreVolumeBackupPayload(restoreVolumeId *string) *RestoreVolumeBackupPayload { +func NewRestoreVolumeBackupPayload(restoreVolumeId RestoreVolumeBackupPayloadGetRestoreVolumeIdArgType) *RestoreVolumeBackupPayload { this := RestoreVolumeBackupPayload{} - this.RestoreVolumeId = restoreVolumeId + setRestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType(&this.RestoreVolumeId, restoreVolumeId) return &this } @@ -44,32 +65,27 @@ func NewRestoreVolumeBackupPayloadWithDefaults() *RestoreVolumeBackupPayload { } // GetRestoreVolumeId returns the RestoreVolumeId field value -func (o *RestoreVolumeBackupPayload) GetRestoreVolumeId() *string { - if o == nil || IsNil(o.RestoreVolumeId) { - var ret *string - return ret - } - - return o.RestoreVolumeId +func (o *RestoreVolumeBackupPayload) GetRestoreVolumeId() (ret RestoreVolumeBackupPayloadGetRestoreVolumeIdRetType) { + ret, _ = o.GetRestoreVolumeIdOk() + return ret } // GetRestoreVolumeIdOk returns a tuple with the RestoreVolumeId field value // and a boolean to check if the value has been set. -func (o *RestoreVolumeBackupPayload) GetRestoreVolumeIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.RestoreVolumeId, true +func (o *RestoreVolumeBackupPayload) GetRestoreVolumeIdOk() (ret RestoreVolumeBackupPayloadGetRestoreVolumeIdRetType, ok bool) { + return getRestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeTypeOk(o.RestoreVolumeId) } // SetRestoreVolumeId sets field value -func (o *RestoreVolumeBackupPayload) SetRestoreVolumeId(v *string) { - o.RestoreVolumeId = v +func (o *RestoreVolumeBackupPayload) SetRestoreVolumeId(v RestoreVolumeBackupPayloadGetRestoreVolumeIdRetType) { + setRestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeType(&o.RestoreVolumeId, v) } func (o RestoreVolumeBackupPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["restoreVolumeId"] = o.RestoreVolumeId + if val, ok := getRestoreVolumeBackupPayloadGetRestoreVolumeIdAttributeTypeOk(o.RestoreVolumeId); ok { + toSerialize["RestoreVolumeId"] = val + } return toSerialize, nil } diff --git a/services/serverbackup/model_update_backup_schedule_payload.go b/services/serverbackup/model_update_backup_schedule_payload.go index de0e8c840..46dbd2efb 100644 --- a/services/serverbackup/model_update_backup_schedule_payload.go +++ b/services/serverbackup/model_update_backup_schedule_payload.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,16 +17,98 @@ import ( // checks if the UpdateBackupSchedulePayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &UpdateBackupSchedulePayload{} +/* + types and functions for backupProperties +*/ + +// isModel +type UpdateBackupSchedulePayloadGetBackupPropertiesAttributeType = *BackupProperties +type UpdateBackupSchedulePayloadGetBackupPropertiesArgType = BackupProperties +type UpdateBackupSchedulePayloadGetBackupPropertiesRetType = BackupProperties + +func getUpdateBackupSchedulePayloadGetBackupPropertiesAttributeTypeOk(arg UpdateBackupSchedulePayloadGetBackupPropertiesAttributeType) (ret UpdateBackupSchedulePayloadGetBackupPropertiesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupSchedulePayloadGetBackupPropertiesAttributeType(arg *UpdateBackupSchedulePayloadGetBackupPropertiesAttributeType, val UpdateBackupSchedulePayloadGetBackupPropertiesRetType) { + *arg = &val +} + +/* + types and functions for enabled +*/ + +// isBoolean +type UpdateBackupSchedulePayloadgetEnabledAttributeType = *bool +type UpdateBackupSchedulePayloadgetEnabledArgType = bool +type UpdateBackupSchedulePayloadgetEnabledRetType = bool + +func getUpdateBackupSchedulePayloadgetEnabledAttributeTypeOk(arg UpdateBackupSchedulePayloadgetEnabledAttributeType) (ret UpdateBackupSchedulePayloadgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupSchedulePayloadgetEnabledAttributeType(arg *UpdateBackupSchedulePayloadgetEnabledAttributeType, val UpdateBackupSchedulePayloadgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateBackupSchedulePayloadGetNameAttributeType = *string + +func getUpdateBackupSchedulePayloadGetNameAttributeTypeOk(arg UpdateBackupSchedulePayloadGetNameAttributeType) (ret UpdateBackupSchedulePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupSchedulePayloadGetNameAttributeType(arg *UpdateBackupSchedulePayloadGetNameAttributeType, val UpdateBackupSchedulePayloadGetNameRetType) { + *arg = &val +} + +type UpdateBackupSchedulePayloadGetNameArgType = string +type UpdateBackupSchedulePayloadGetNameRetType = string + +/* + types and functions for rrule +*/ + +// isNotNullableString +type UpdateBackupSchedulePayloadGetRruleAttributeType = *string + +func getUpdateBackupSchedulePayloadGetRruleAttributeTypeOk(arg UpdateBackupSchedulePayloadGetRruleAttributeType) (ret UpdateBackupSchedulePayloadGetRruleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupSchedulePayloadGetRruleAttributeType(arg *UpdateBackupSchedulePayloadGetRruleAttributeType, val UpdateBackupSchedulePayloadGetRruleRetType) { + *arg = &val +} + +type UpdateBackupSchedulePayloadGetRruleArgType = string +type UpdateBackupSchedulePayloadGetRruleRetType = string + // UpdateBackupSchedulePayload struct for UpdateBackupSchedulePayload type UpdateBackupSchedulePayload struct { - BackupProperties *BackupProperties `json:"backupProperties,omitempty"` + BackupProperties UpdateBackupSchedulePayloadGetBackupPropertiesAttributeType `json:"backupProperties,omitempty"` // REQUIRED - Enabled *bool `json:"enabled"` + Enabled UpdateBackupSchedulePayloadgetEnabledAttributeType `json:"enabled"` // Max 255 characters // REQUIRED - Name *string `json:"name"` + Name UpdateBackupSchedulePayloadGetNameAttributeType `json:"name"` // REQUIRED - Rrule *string `json:"rrule"` + Rrule UpdateBackupSchedulePayloadGetRruleAttributeType `json:"rrule"` } type _UpdateBackupSchedulePayload UpdateBackupSchedulePayload @@ -35,11 +117,11 @@ type _UpdateBackupSchedulePayload UpdateBackupSchedulePayload // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewUpdateBackupSchedulePayload(enabled *bool, name *string, rrule *string) *UpdateBackupSchedulePayload { +func NewUpdateBackupSchedulePayload(enabled UpdateBackupSchedulePayloadgetEnabledArgType, name UpdateBackupSchedulePayloadGetNameArgType, rrule UpdateBackupSchedulePayloadGetRruleArgType) *UpdateBackupSchedulePayload { this := UpdateBackupSchedulePayload{} - this.Enabled = enabled - this.Name = name - this.Rrule = rrule + setUpdateBackupSchedulePayloadgetEnabledAttributeType(&this.Enabled, enabled) + setUpdateBackupSchedulePayloadGetNameAttributeType(&this.Name, name) + setUpdateBackupSchedulePayloadGetRruleAttributeType(&this.Rrule, rrule) return &this } @@ -52,117 +134,93 @@ func NewUpdateBackupSchedulePayloadWithDefaults() *UpdateBackupSchedulePayload { } // GetBackupProperties returns the BackupProperties field value if set, zero value otherwise. -func (o *UpdateBackupSchedulePayload) GetBackupProperties() *BackupProperties { - if o == nil || IsNil(o.BackupProperties) { - var ret *BackupProperties - return ret - } - return o.BackupProperties +func (o *UpdateBackupSchedulePayload) GetBackupProperties() (res UpdateBackupSchedulePayloadGetBackupPropertiesRetType) { + res, _ = o.GetBackupPropertiesOk() + return } // GetBackupPropertiesOk returns a tuple with the BackupProperties field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateBackupSchedulePayload) GetBackupPropertiesOk() (*BackupProperties, bool) { - if o == nil || IsNil(o.BackupProperties) { - return nil, false - } - return o.BackupProperties, true +func (o *UpdateBackupSchedulePayload) GetBackupPropertiesOk() (ret UpdateBackupSchedulePayloadGetBackupPropertiesRetType, ok bool) { + return getUpdateBackupSchedulePayloadGetBackupPropertiesAttributeTypeOk(o.BackupProperties) } // HasBackupProperties returns a boolean if a field has been set. func (o *UpdateBackupSchedulePayload) HasBackupProperties() bool { - if o != nil && !IsNil(o.BackupProperties) { - return true - } - - return false + _, ok := o.GetBackupPropertiesOk() + return ok } // SetBackupProperties gets a reference to the given BackupProperties and assigns it to the BackupProperties field. -func (o *UpdateBackupSchedulePayload) SetBackupProperties(v *BackupProperties) { - o.BackupProperties = v +func (o *UpdateBackupSchedulePayload) SetBackupProperties(v UpdateBackupSchedulePayloadGetBackupPropertiesRetType) { + setUpdateBackupSchedulePayloadGetBackupPropertiesAttributeType(&o.BackupProperties, v) } // GetEnabled returns the Enabled field value -func (o *UpdateBackupSchedulePayload) GetEnabled() *bool { - if o == nil || IsNil(o.Enabled) { - var ret *bool - return ret - } - - return o.Enabled +func (o *UpdateBackupSchedulePayload) GetEnabled() (ret UpdateBackupSchedulePayloadgetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret } // GetEnabledOk returns a tuple with the Enabled field value // and a boolean to check if the value has been set. -func (o *UpdateBackupSchedulePayload) GetEnabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return o.Enabled, true +func (o *UpdateBackupSchedulePayload) GetEnabledOk() (ret UpdateBackupSchedulePayloadgetEnabledRetType, ok bool) { + return getUpdateBackupSchedulePayloadgetEnabledAttributeTypeOk(o.Enabled) } // SetEnabled sets field value -func (o *UpdateBackupSchedulePayload) SetEnabled(v *bool) { - o.Enabled = v +func (o *UpdateBackupSchedulePayload) SetEnabled(v UpdateBackupSchedulePayloadgetEnabledRetType) { + setUpdateBackupSchedulePayloadgetEnabledAttributeType(&o.Enabled, v) } // GetName returns the Name field value -func (o *UpdateBackupSchedulePayload) GetName() *string { - if o == nil || IsNil(o.Name) { - var ret *string - return ret - } - - return o.Name +func (o *UpdateBackupSchedulePayload) GetName() (ret UpdateBackupSchedulePayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. -func (o *UpdateBackupSchedulePayload) GetNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Name, true +func (o *UpdateBackupSchedulePayload) GetNameOk() (ret UpdateBackupSchedulePayloadGetNameRetType, ok bool) { + return getUpdateBackupSchedulePayloadGetNameAttributeTypeOk(o.Name) } // SetName sets field value -func (o *UpdateBackupSchedulePayload) SetName(v *string) { - o.Name = v +func (o *UpdateBackupSchedulePayload) SetName(v UpdateBackupSchedulePayloadGetNameRetType) { + setUpdateBackupSchedulePayloadGetNameAttributeType(&o.Name, v) } // GetRrule returns the Rrule field value -func (o *UpdateBackupSchedulePayload) GetRrule() *string { - if o == nil || IsNil(o.Rrule) { - var ret *string - return ret - } - - return o.Rrule +func (o *UpdateBackupSchedulePayload) GetRrule() (ret UpdateBackupSchedulePayloadGetRruleRetType) { + ret, _ = o.GetRruleOk() + return ret } // GetRruleOk returns a tuple with the Rrule field value // and a boolean to check if the value has been set. -func (o *UpdateBackupSchedulePayload) GetRruleOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Rrule, true +func (o *UpdateBackupSchedulePayload) GetRruleOk() (ret UpdateBackupSchedulePayloadGetRruleRetType, ok bool) { + return getUpdateBackupSchedulePayloadGetRruleAttributeTypeOk(o.Rrule) } // SetRrule sets field value -func (o *UpdateBackupSchedulePayload) SetRrule(v *string) { - o.Rrule = v +func (o *UpdateBackupSchedulePayload) SetRrule(v UpdateBackupSchedulePayloadGetRruleRetType) { + setUpdateBackupSchedulePayloadGetRruleAttributeType(&o.Rrule, v) } func (o UpdateBackupSchedulePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.BackupProperties) { - toSerialize["backupProperties"] = o.BackupProperties + if val, ok := getUpdateBackupSchedulePayloadGetBackupPropertiesAttributeTypeOk(o.BackupProperties); ok { + toSerialize["BackupProperties"] = val + } + if val, ok := getUpdateBackupSchedulePayloadgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getUpdateBackupSchedulePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateBackupSchedulePayloadGetRruleAttributeTypeOk(o.Rrule); ok { + toSerialize["Rrule"] = val } - toSerialize["enabled"] = o.Enabled - toSerialize["name"] = o.Name - toSerialize["rrule"] = o.Rrule return toSerialize, nil } diff --git a/services/serverbackup/utils.go b/services/serverbackup/utils.go index d504aa28e..0a0d91dbd 100644 --- a/services/serverbackup/utils.go +++ b/services/serverbackup/utils.go @@ -3,7 +3,7 @@ STACKIT Server Backup Management API API endpoints for Server Backup Operations on STACKIT Servers. -API version: 1.0 +API version: 2.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -40,6 +40,29 @@ func PtrString(v string) *string { return &v } // PtrTime is helper routine that returns a pointer to given Time value. func PtrTime(v time.Time) *time.Time { return &v } +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + type NullableBool struct { value *bool isSet bool @@ -333,6 +356,9 @@ func IsNil(i interface{}) bool { if i == nil { return true } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } switch reflect.TypeOf(i).Kind() { case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: return reflect.ValueOf(i).IsNil() From d3631d424770563681dff8701d70679706f41bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Mon, 17 Mar 2025 09:31:34 +0100 Subject: [PATCH 2/2] chore: updated changelog --- CHANGELOG.md | 2 ++ services/serverbackup/CHANGELOG.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 764e3c089..220f7793f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## Release (2025-03-14) +- `serverbackup`: [v1.0.0](services/serverbackup/CHANGELOG.md#v100-2025-03-19) + - **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request. - `certificates`: [v1.0.0](services/certificates/CHANGELOG.md#v100-2025-03-14) - **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request. - `postgresflex`: [v1.0.1](services/postgresflex/CHANGELOG.md#v101-2025-03-12) diff --git a/services/serverbackup/CHANGELOG.md b/services/serverbackup/CHANGELOG.md index f990fe20c..dce516176 100644 --- a/services/serverbackup/CHANGELOG.md +++ b/services/serverbackup/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.0 (2025-03-19) +- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request. + ## v0.6.0 (2025-02-21) - **New:** Minimal go version is now Go 1.21