From 43df69bb4c2ba5c66de08680340500a330bd2889 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 13 Nov 2024 11:04:09 +0000 Subject: [PATCH] Generate serverbackup --- services/serverbackup/api_default.go | 412 +++++++++++------- services/serverbackup/api_default_test.go | 102 ++++- services/serverbackup/model_backup.go | 3 +- .../serverbackup/model_backup_properties.go | 1 - .../serverbackup/model_backup_schedule.go | 1 - .../model_backup_volume_backups_inner.go | 7 +- .../model_create_backup_payload.go | 1 - .../model_enable_service_resource_payload.go | 116 +++++ services/serverbackup/model_error_response.go | 169 ------- .../model_get_backup_schedules_response.go | 116 +++++ ....go => model_get_backups_list_response.go} | 50 +-- ...odel_list_backup_schedules_200_response.go | 116 ----- 12 files changed, 606 insertions(+), 488 deletions(-) create mode 100644 services/serverbackup/model_enable_service_resource_payload.go delete mode 100644 services/serverbackup/model_error_response.go create mode 100644 services/serverbackup/model_get_backup_schedules_response.go rename services/serverbackup/{model_list_backups_200_response.go => model_get_backups_list_response.go} (54%) delete mode 100644 services/serverbackup/model_list_backup_schedules_200_response.go diff --git a/services/serverbackup/api_default.go b/services/serverbackup/api_default.go index 7324093e6..fc764d68e 100644 --- a/services/serverbackup/api_default.go +++ b/services/serverbackup/api_default.go @@ -110,17 +110,6 @@ 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 } @@ -249,17 +238,6 @@ 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 } @@ -342,7 +320,7 @@ func (r ApiDeleteBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -381,17 +359,6 @@ 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 } @@ -467,7 +434,7 @@ func (r ApiDeleteBackupScheduleRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -506,17 +473,6 @@ 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 } @@ -594,7 +550,7 @@ func (r ApiDeleteVolumeBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -633,17 +589,6 @@ 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 } @@ -720,7 +665,7 @@ func (r ApiDisableServiceRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -759,17 +704,6 @@ func (r ApiDisableServiceRequest) 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 } @@ -793,6 +727,9 @@ func (a *APIClient) DisableService(ctx context.Context, projectId string, server } } +/* +Deprecated: +*/ func (a *APIClient) DisableServiceExecute(ctx context.Context, projectId string, serverId string) error { r := ApiDisableServiceRequest{ apiService: a.defaultApi, @@ -803,6 +740,115 @@ func (a *APIClient) DisableServiceExecute(ctx context.Context, projectId string, return r.Execute() } +type ApiDisableServiceResourceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiDisableServiceResourceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DisableServiceResource") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/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) + + 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 +} + +/* +DisableServiceResource: disable backup service + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param serverId openstack server id + @return ApiDisableServiceResourceRequest +*/ +func (a *APIClient) DisableServiceResource(ctx context.Context, projectId string, serverId string) ApiDisableServiceResourceRequest { + return ApiDisableServiceResourceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) DisableServiceResourceExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDisableServiceResourceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + type ApiEnableServiceRequest struct { ctx context.Context apiService *DefaultApiService @@ -846,7 +892,7 @@ func (r ApiEnableServiceRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -887,17 +933,6 @@ func (r ApiEnableServiceRequest) 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 } @@ -921,6 +956,9 @@ func (a *APIClient) EnableService(ctx context.Context, projectId string, serverI } } +/* +Deprecated: +*/ func (a *APIClient) EnableServiceExecute(ctx context.Context, projectId string, serverId string) error { r := ApiEnableServiceRequest{ apiService: a.defaultApi, @@ -931,6 +969,123 @@ func (a *APIClient) EnableServiceExecute(ctx context.Context, projectId string, return r.Execute() } +type ApiEnableServiceResourceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + enableServiceResourcePayload *EnableServiceResourcePayload +} + +func (r ApiEnableServiceResourceRequest) EnableServiceResourcePayload(enableServiceResourcePayload EnableServiceResourcePayload) ApiEnableServiceResourceRequest { + r.enableServiceResourcePayload = &enableServiceResourcePayload + return r +} + +func (r ApiEnableServiceResourceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.EnableServiceResource") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/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) + + 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.enableServiceResourcePayload + 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 +} + +/* +EnableServiceResource: enable backup service + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param serverId openstack server id + @return ApiEnableServiceResourceRequest +*/ +func (a *APIClient) EnableServiceResource(ctx context.Context, projectId string, serverId string) ApiEnableServiceResourceRequest { + return ApiEnableServiceResourceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) EnableServiceResourceExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiEnableServiceResourceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + type ApiGetBackupRequest struct { ctx context.Context apiService *DefaultApiService @@ -1010,17 +1165,6 @@ 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 } @@ -1146,17 +1290,6 @@ 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 } @@ -1210,12 +1343,12 @@ type ApiListBackupSchedulesRequest struct { serverId string } -func (r ApiListBackupSchedulesRequest) Execute() (*ListBackupSchedules200Response, error) { +func (r ApiListBackupSchedulesRequest) Execute() (*GetBackupSchedulesResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListBackupSchedules200Response + localVarReturnValue *GetBackupSchedulesResponse ) a := r.apiService localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListBackupSchedules") @@ -1280,17 +1413,6 @@ func (r ApiListBackupSchedulesRequest) Execute() (*ListBackupSchedules200Respons 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 } @@ -1324,7 +1446,7 @@ func (a *APIClient) ListBackupSchedules(ctx context.Context, projectId string, s } } -func (a *APIClient) ListBackupSchedulesExecute(ctx context.Context, projectId string, serverId string) (*ListBackupSchedules200Response, error) { +func (a *APIClient) ListBackupSchedulesExecute(ctx context.Context, projectId string, serverId string) (*GetBackupSchedulesResponse, error) { r := ApiListBackupSchedulesRequest{ apiService: a.defaultApi, ctx: ctx, @@ -1341,12 +1463,12 @@ type ApiListBackupsRequest struct { serverId string } -func (r ApiListBackupsRequest) Execute() (*ListBackups200Response, error) { +func (r ApiListBackupsRequest) Execute() (*GetBackupsListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListBackups200Response + localVarReturnValue *GetBackupsListResponse ) a := r.apiService localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListBackups") @@ -1411,17 +1533,6 @@ func (r ApiListBackupsRequest) Execute() (*ListBackups200Response, 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 } @@ -1455,7 +1566,7 @@ func (a *APIClient) ListBackups(ctx context.Context, projectId string, serverId } } -func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string, serverId string) (*ListBackups200Response, error) { +func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string, serverId string) (*GetBackupsListResponse, error) { r := ApiListBackupsRequest{ apiService: a.defaultApi, ctx: ctx, @@ -1510,7 +1621,7 @@ func (r ApiRestoreBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -1551,17 +1662,6 @@ 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 } @@ -1645,7 +1745,7 @@ func (r ApiRestoreVolumeBackupRequest) Execute() error { } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -1686,17 +1786,6 @@ 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 } @@ -1823,17 +1912,6 @@ 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 } diff --git a/services/serverbackup/api_default_test.go b/services/serverbackup/api_default_test.go index 188dd1829..639e571e8 100644 --- a/services/serverbackup/api_default_test.go +++ b/services/serverbackup/api_default_test.go @@ -341,6 +341,55 @@ 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}" projectIdValue := "projectId" @@ -390,6 +439,55 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService EnableServiceResource", 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.EnableServiceResource(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { path := "/v1/projects/{projectId}/servers/{serverId}/backups/{backupId}" projectIdValue := "projectId" @@ -515,7 +613,7 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ListBackupSchedules200Response{} + data := GetBackupSchedulesResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -570,7 +668,7 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ListBackups200Response{} + data := GetBackupsListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) diff --git a/services/serverbackup/model_backup.go b/services/serverbackup/model_backup.go index 9aac42749..ee125d41a 100644 --- a/services/serverbackup/model_backup.go +++ b/services/serverbackup/model_backup.go @@ -28,8 +28,7 @@ type Backup struct { LastRestoredAt *string `json:"lastRestoredAt,omitempty"` // REQUIRED Name *string `json:"name"` - // Can be cast to int32 without loss of precision. - Size *int64 `json:"size,omitempty"` + Size *int64 `json:"size,omitempty"` // REQUIRED Status *string `json:"status"` VolumeBackups *[]BackupVolumeBackupsInner `json:"volumeBackups,omitempty"` diff --git a/services/serverbackup/model_backup_properties.go b/services/serverbackup/model_backup_properties.go index fd8378924..4a50b90f1 100644 --- a/services/serverbackup/model_backup_properties.go +++ b/services/serverbackup/model_backup_properties.go @@ -23,7 +23,6 @@ type BackupProperties struct { // REQUIRED Name *string `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"` diff --git a/services/serverbackup/model_backup_schedule.go b/services/serverbackup/model_backup_schedule.go index 21f67c8fc..f4e9c11a8 100644 --- a/services/serverbackup/model_backup_schedule.go +++ b/services/serverbackup/model_backup_schedule.go @@ -22,7 +22,6 @@ type BackupSchedule struct { BackupProperties *BackupProperties `json:"backupProperties,omitempty"` // REQUIRED Enabled *bool `json:"enabled"` - // Can be cast to int32 without loss of precision. // REQUIRED Id *int64 `json:"id"` // REQUIRED diff --git a/services/serverbackup/model_backup_volume_backups_inner.go b/services/serverbackup/model_backup_volume_backups_inner.go index 8d58b63f3..234dd6dab 100644 --- a/services/serverbackup/model_backup_volume_backups_inner.go +++ b/services/serverbackup/model_backup_volume_backups_inner.go @@ -22,10 +22,9 @@ type BackupVolumeBackupsInner struct { Id *string `json:"id,omitempty"` LastRestoredAt *string `json:"lastRestoredAt,omitempty"` LastRestoredVolumeId *string `json:"lastRestoredVolumeId,omitempty"` - // Can be cast to int32 without loss of precision. - Size *int64 `json:"size,omitempty"` - Status *string `json:"status,omitempty"` - VolumeId *string `json:"volumeId,omitempty"` + Size *int64 `json:"size,omitempty"` + Status *string `json:"status,omitempty"` + VolumeId *string `json:"volumeId,omitempty"` } // NewBackupVolumeBackupsInner instantiates a new BackupVolumeBackupsInner object diff --git a/services/serverbackup/model_create_backup_payload.go b/services/serverbackup/model_create_backup_payload.go index af19cbae5..52fa38617 100644 --- a/services/serverbackup/model_create_backup_payload.go +++ b/services/serverbackup/model_create_backup_payload.go @@ -23,7 +23,6 @@ type CreateBackupPayload struct { // REQUIRED Name *string `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"` diff --git a/services/serverbackup/model_enable_service_resource_payload.go b/services/serverbackup/model_enable_service_resource_payload.go new file mode 100644 index 000000000..c37a546fa --- /dev/null +++ b/services/serverbackup/model_enable_service_resource_payload.go @@ -0,0 +1,116 @@ +/* +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 EnableServiceResourcePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EnableServiceResourcePayload{} + +// EnableServiceResourcePayload struct for EnableServiceResourcePayload +type EnableServiceResourcePayload struct { + BackupPolicyId *string `json:"backupPolicyId,omitempty"` +} + +// NewEnableServiceResourcePayload instantiates a new EnableServiceResourcePayload 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 NewEnableServiceResourcePayload() *EnableServiceResourcePayload { + this := EnableServiceResourcePayload{} + return &this +} + +// NewEnableServiceResourcePayloadWithDefaults instantiates a new EnableServiceResourcePayload 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 NewEnableServiceResourcePayloadWithDefaults() *EnableServiceResourcePayload { + this := EnableServiceResourcePayload{} + return &this +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BackupPolicyId) { + toSerialize["backupPolicyId"] = o.BackupPolicyId + } + return toSerialize, nil +} + +type NullableEnableServiceResourcePayload struct { + value *EnableServiceResourcePayload + isSet bool +} + +func (v NullableEnableServiceResourcePayload) Get() *EnableServiceResourcePayload { + return v.value +} + +func (v *NullableEnableServiceResourcePayload) Set(val *EnableServiceResourcePayload) { + v.value = val + v.isSet = true +} + +func (v NullableEnableServiceResourcePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableEnableServiceResourcePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnableServiceResourcePayload(val *EnableServiceResourcePayload) *NullableEnableServiceResourcePayload { + return &NullableEnableServiceResourcePayload{value: val, isSet: true} +} + +func (v NullableEnableServiceResourcePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnableServiceResourcePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serverbackup/model_error_response.go b/services/serverbackup/model_error_response.go deleted file mode 100644 index 46308fe38..000000000 --- a/services/serverbackup/model_error_response.go +++ /dev/null @@ -1,169 +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 ErrorResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ErrorResponse{} - -// ErrorResponse struct for ErrorResponse -type ErrorResponse struct { - // Details about the error - // REQUIRED - Message *string `json:"message"` - // The string representation of the http status code (i.e. Not Found, Bad Request, etc) - // REQUIRED - Status *string `json:"status"` - // The time the error occured - // REQUIRED - Timestamp *string `json:"timestamp"` -} - -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 *string, status *string, timestamp *string) *ErrorResponse { - this := ErrorResponse{} - this.Message = message - this.Status = status - this.Timestamp = timestamp - 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() *string { - if o == nil { - var ret *string - return ret - } - - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *ErrorResponse) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Message, true -} - -// SetMessage sets field value -func (o *ErrorResponse) SetMessage(v *string) { - o.Message = v -} - -// GetStatus returns the Status field value -func (o *ErrorResponse) GetStatus() *string { - if o == nil { - var ret *string - return ret - } - - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *ErrorResponse) GetStatusOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Status, true -} - -// SetStatus sets field value -func (o *ErrorResponse) SetStatus(v *string) { - o.Status = v -} - -// GetTimestamp returns the Timestamp field value -func (o *ErrorResponse) GetTimestamp() *string { - if o == nil { - var ret *string - return ret - } - - return o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value -// and a boolean to check if the value has been set. -func (o *ErrorResponse) GetTimestampOk() (*string, bool) { - if o == nil { - return nil, false - } - return o.Timestamp, true -} - -// SetTimestamp sets field value -func (o *ErrorResponse) SetTimestamp(v *string) { - o.Timestamp = v -} - -func (o ErrorResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["message"] = o.Message - toSerialize["status"] = o.Status - toSerialize["timestamp"] = o.Timestamp - 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_schedules_response.go b/services/serverbackup/model_get_backup_schedules_response.go new file mode 100644 index 000000000..54529d2be --- /dev/null +++ b/services/serverbackup/model_get_backup_schedules_response.go @@ -0,0 +1,116 @@ +/* +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 GetBackupSchedulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetBackupSchedulesResponse{} + +// GetBackupSchedulesResponse struct for GetBackupSchedulesResponse +type GetBackupSchedulesResponse struct { + Items *[]BackupSchedule `json:"items,omitempty"` +} + +// NewGetBackupSchedulesResponse instantiates a new GetBackupSchedulesResponse 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 NewGetBackupSchedulesResponse() *GetBackupSchedulesResponse { + this := GetBackupSchedulesResponse{} + return &this +} + +// NewGetBackupSchedulesResponseWithDefaults instantiates a new GetBackupSchedulesResponse 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 NewGetBackupSchedulesResponseWithDefaults() *GetBackupSchedulesResponse { + this := GetBackupSchedulesResponse{} + return &this +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableGetBackupSchedulesResponse struct { + value *GetBackupSchedulesResponse + isSet bool +} + +func (v NullableGetBackupSchedulesResponse) Get() *GetBackupSchedulesResponse { + return v.value +} + +func (v *NullableGetBackupSchedulesResponse) Set(val *GetBackupSchedulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetBackupSchedulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetBackupSchedulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetBackupSchedulesResponse(val *GetBackupSchedulesResponse) *NullableGetBackupSchedulesResponse { + return &NullableGetBackupSchedulesResponse{value: val, isSet: true} +} + +func (v NullableGetBackupSchedulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetBackupSchedulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serverbackup/model_list_backups_200_response.go b/services/serverbackup/model_get_backups_list_response.go similarity index 54% rename from services/serverbackup/model_list_backups_200_response.go rename to services/serverbackup/model_get_backups_list_response.go index 5b9feb7b8..acfc31a89 100644 --- a/services/serverbackup/model_list_backups_200_response.go +++ b/services/serverbackup/model_get_backups_list_response.go @@ -14,33 +14,33 @@ import ( "encoding/json" ) -// checks if the ListBackups200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListBackups200Response{} +// checks if the GetBackupsListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetBackupsListResponse{} -// ListBackups200Response struct for ListBackups200Response -type ListBackups200Response struct { +// GetBackupsListResponse struct for GetBackupsListResponse +type GetBackupsListResponse struct { Items *[]Backup `json:"items,omitempty"` } -// NewListBackups200Response instantiates a new ListBackups200Response object +// NewGetBackupsListResponse instantiates a new GetBackupsListResponse 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 NewListBackups200Response() *ListBackups200Response { - this := ListBackups200Response{} +func NewGetBackupsListResponse() *GetBackupsListResponse { + this := GetBackupsListResponse{} return &this } -// NewListBackups200ResponseWithDefaults instantiates a new ListBackups200Response object +// NewGetBackupsListResponseWithDefaults instantiates a new GetBackupsListResponse 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 NewListBackups200ResponseWithDefaults() *ListBackups200Response { - this := ListBackups200Response{} +func NewGetBackupsListResponseWithDefaults() *GetBackupsListResponse { + this := GetBackupsListResponse{} return &this } // GetItems returns the Items field value if set, zero value otherwise. -func (o *ListBackups200Response) GetItems() *[]Backup { +func (o *GetBackupsListResponse) GetItems() *[]Backup { if o == nil || IsNil(o.Items) { var ret *[]Backup return ret @@ -50,7 +50,7 @@ func (o *ListBackups200Response) GetItems() *[]Backup { // 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 *ListBackups200Response) GetItemsOk() (*[]Backup, bool) { +func (o *GetBackupsListResponse) GetItemsOk() (*[]Backup, bool) { if o == nil || IsNil(o.Items) { return nil, false } @@ -58,7 +58,7 @@ func (o *ListBackups200Response) GetItemsOk() (*[]Backup, bool) { } // HasItems returns a boolean if a field has been set. -func (o *ListBackups200Response) HasItems() bool { +func (o *GetBackupsListResponse) HasItems() bool { if o != nil && !IsNil(o.Items) { return true } @@ -67,11 +67,11 @@ func (o *ListBackups200Response) HasItems() bool { } // SetItems gets a reference to the given []Backup and assigns it to the Items field. -func (o *ListBackups200Response) SetItems(v *[]Backup) { +func (o *GetBackupsListResponse) SetItems(v *[]Backup) { o.Items = v } -func (o ListBackups200Response) ToMap() (map[string]interface{}, error) { +func (o GetBackupsListResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !IsNil(o.Items) { toSerialize["items"] = o.Items @@ -79,38 +79,38 @@ func (o ListBackups200Response) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -type NullableListBackups200Response struct { - value *ListBackups200Response +type NullableGetBackupsListResponse struct { + value *GetBackupsListResponse isSet bool } -func (v NullableListBackups200Response) Get() *ListBackups200Response { +func (v NullableGetBackupsListResponse) Get() *GetBackupsListResponse { return v.value } -func (v *NullableListBackups200Response) Set(val *ListBackups200Response) { +func (v *NullableGetBackupsListResponse) Set(val *GetBackupsListResponse) { v.value = val v.isSet = true } -func (v NullableListBackups200Response) IsSet() bool { +func (v NullableGetBackupsListResponse) IsSet() bool { return v.isSet } -func (v *NullableListBackups200Response) Unset() { +func (v *NullableGetBackupsListResponse) Unset() { v.value = nil v.isSet = false } -func NewNullableListBackups200Response(val *ListBackups200Response) *NullableListBackups200Response { - return &NullableListBackups200Response{value: val, isSet: true} +func NewNullableGetBackupsListResponse(val *GetBackupsListResponse) *NullableGetBackupsListResponse { + return &NullableGetBackupsListResponse{value: val, isSet: true} } -func (v NullableListBackups200Response) MarshalJSON() ([]byte, error) { +func (v NullableGetBackupsListResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableListBackups200Response) UnmarshalJSON(src []byte) error { +func (v *NullableGetBackupsListResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/services/serverbackup/model_list_backup_schedules_200_response.go b/services/serverbackup/model_list_backup_schedules_200_response.go deleted file mode 100644 index c0a9e07fc..000000000 --- a/services/serverbackup/model_list_backup_schedules_200_response.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 ListBackupSchedules200Response type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListBackupSchedules200Response{} - -// ListBackupSchedules200Response struct for ListBackupSchedules200Response -type ListBackupSchedules200Response struct { - Items *[]BackupSchedule `json:"items,omitempty"` -} - -// NewListBackupSchedules200Response instantiates a new ListBackupSchedules200Response 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 NewListBackupSchedules200Response() *ListBackupSchedules200Response { - this := ListBackupSchedules200Response{} - return &this -} - -// NewListBackupSchedules200ResponseWithDefaults instantiates a new ListBackupSchedules200Response 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 NewListBackupSchedules200ResponseWithDefaults() *ListBackupSchedules200Response { - this := ListBackupSchedules200Response{} - return &this -} - -// GetItems returns the Items field value if set, zero value otherwise. -func (o *ListBackupSchedules200Response) GetItems() *[]BackupSchedule { - if o == nil || IsNil(o.Items) { - var ret *[]BackupSchedule - return ret - } - return o.Items -} - -// 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 *ListBackupSchedules200Response) GetItemsOk() (*[]BackupSchedule, bool) { - if o == nil || IsNil(o.Items) { - return nil, false - } - return o.Items, true -} - -// HasItems returns a boolean if a field has been set. -func (o *ListBackupSchedules200Response) HasItems() bool { - if o != nil && !IsNil(o.Items) { - return true - } - - return false -} - -// SetItems gets a reference to the given []BackupSchedule and assigns it to the Items field. -func (o *ListBackupSchedules200Response) SetItems(v *[]BackupSchedule) { - o.Items = v -} - -func (o ListBackupSchedules200Response) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Items) { - toSerialize["items"] = o.Items - } - return toSerialize, nil -} - -type NullableListBackupSchedules200Response struct { - value *ListBackupSchedules200Response - isSet bool -} - -func (v NullableListBackupSchedules200Response) Get() *ListBackupSchedules200Response { - return v.value -} - -func (v *NullableListBackupSchedules200Response) Set(val *ListBackupSchedules200Response) { - v.value = val - v.isSet = true -} - -func (v NullableListBackupSchedules200Response) IsSet() bool { - return v.isSet -} - -func (v *NullableListBackupSchedules200Response) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListBackupSchedules200Response(val *ListBackupSchedules200Response) *NullableListBackupSchedules200Response { - return &NullableListBackupSchedules200Response{value: val, isSet: true} -} - -func (v NullableListBackupSchedules200Response) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListBackupSchedules200Response) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -}