From e482b0d01e27b7818d2ed987afaa09fed835aff7 Mon Sep 17 00:00:00 2001 From: stackit-pipeline <142982727+stackit-pipeline@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:20:29 +0100 Subject: [PATCH] Generator: Update SDK /services/iaas (#1225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Generate iaas * feature: updated changelog * Update services/iaas/CHANGELOG.md --------- Co-authored-by: Rüdiger Schmitz Co-authored-by: João Palet --- services/iaas/CHANGELOG.md | 11 + services/iaas/api_default.go | 11367 ++++++++++++---- services/iaas/api_default_test.go | 2576 +++- services/iaas/model_affinity_group.go | 214 + .../model_affinity_group_list_response.go | 111 + services/iaas/model_area_config.go | 4 +- .../model_availability_zone_list_response.go | 111 + services/iaas/model_backup.go | 451 + services/iaas/model_backup_list_response.go | 111 + services/iaas/model_backup_source.go | 140 + .../iaas/model_base_security_group_rule.go | 2 +- services/iaas/model_boot_volume_source.go | 4 +- .../model_create_affinity_group_payload.go | 214 + services/iaas/model_create_area_ipv4.go | 4 +- services/iaas/model_create_backup_payload.go | 184 + services/iaas/model_create_image_payload.go | 582 + .../iaas/model_create_key_pair_payload.go | 2 +- .../iaas/model_create_network_area_payload.go | 4 +- .../iaas/model_create_network_ipv4_body.go | 15 +- .../iaas/model_create_network_ipv6_body.go | 15 +- services/iaas/model_create_network_payload.go | 2 +- .../iaas/model_create_public_ip_payload.go | 15 +- .../model_create_security_group_payload.go | 2 +- ...odel_create_security_group_rule_payload.go | 2 +- services/iaas/model_create_server_payload.go | 4 +- .../iaas/model_create_snapshot_payload.go | 371 + services/iaas/model_create_volume_payload.go | 40 +- services/iaas/model_error.go | 4 +- services/iaas/model_get_server_log_request.go | 121 - services/iaas/model_icmp_parameters.go | 4 +- services/iaas/model_image.go | 582 + services/iaas/model_image_checksum.go | 140 + services/iaas/model_image_config.go | 737 + services/iaas/model_image_create_response.go | 139 + services/iaas/model_image_list_response.go | 111 + services/iaas/model_image_share.go | 154 + services/iaas/model_image_share_consumer.go | 229 + services/iaas/model_key_pair_list_response.go | 2 +- services/iaas/model_keypair.go | 2 +- services/iaas/model_machine_type.go | 8 +- .../iaas/model_machine_type_list_response.go | 2 +- services/iaas/model_network.go | 36 +- services/iaas/model_network_area.go | 8 +- .../iaas/model_network_area_list_response.go | 2 +- services/iaas/model_network_list_response.go | 2 +- services/iaas/model_network_range.go | 2 +- .../iaas/model_network_range_list_response.go | 2 +- services/iaas/model_nic_list_response.go | 2 +- services/iaas/model_port_range.go | 4 +- services/iaas/model_project_list_response.go | 2 +- services/iaas/model_public_ip.go | 15 +- .../iaas/model_public_ip_list_response.go | 2 +- services/iaas/model_request.go | 10 +- services/iaas/model_request_resource.go | 6 +- services/iaas/model_rescue_server_payload.go | 2 +- services/iaas/model_resize_server_payload.go | 2 +- services/iaas/model_resize_volume_payload.go | 2 +- services/iaas/model_route.go | 4 +- services/iaas/model_route_list_response.go | 2 +- services/iaas/model_security_group.go | 2 +- .../model_security_group_list_response.go | 2 +- services/iaas/model_security_group_rule.go | 2 +- ...model_security_group_rule_list_response.go | 2 +- services/iaas/model_server.go | 4 +- services/iaas/model_server_console_url.go | 2 +- services/iaas/model_server_list_response.go | 2 +- services/iaas/model_server_maintenance.go | 6 +- services/iaas/model_server_network.go | 10 +- ...odel_service_account_mail_list_response.go | 2 +- .../iaas/model_set_image_share_payload.go | 154 + services/iaas/model_snapshot.go | 371 + services/iaas/model_snapshot_list_response.go | 111 + services/iaas/model_update_backup_payload.go | 451 + services/iaas/model_update_image_payload.go | 337 + .../iaas/model_update_image_share_payload.go | 154 + .../iaas/model_update_network_ipv4_body.go | 15 +- .../iaas/model_update_network_ipv6_body.go | 15 +- .../iaas/model_update_public_ip_payload.go | 15 +- .../iaas/model_update_snapshot_payload.go | 154 + services/iaas/model_update_volume_payload.go | 38 +- services/iaas/model_volume.go | 40 +- .../model_volume_attachment_list_response.go | 2 +- services/iaas/model_volume_list_response.go | 2 +- .../iaas/model_volume_performance_class.go | 2 +- ..._volume_performance_class_list_response.go | 2 +- services/iaas/model_volume_source.go | 4 +- 86 files changed, 17098 insertions(+), 3701 deletions(-) create mode 100644 services/iaas/model_affinity_group.go create mode 100644 services/iaas/model_affinity_group_list_response.go create mode 100644 services/iaas/model_availability_zone_list_response.go create mode 100644 services/iaas/model_backup.go create mode 100644 services/iaas/model_backup_list_response.go create mode 100644 services/iaas/model_backup_source.go create mode 100644 services/iaas/model_create_affinity_group_payload.go create mode 100644 services/iaas/model_create_backup_payload.go create mode 100644 services/iaas/model_create_image_payload.go create mode 100644 services/iaas/model_create_snapshot_payload.go delete mode 100644 services/iaas/model_get_server_log_request.go create mode 100644 services/iaas/model_image.go create mode 100644 services/iaas/model_image_checksum.go create mode 100644 services/iaas/model_image_config.go create mode 100644 services/iaas/model_image_create_response.go create mode 100644 services/iaas/model_image_list_response.go create mode 100644 services/iaas/model_image_share.go create mode 100644 services/iaas/model_image_share_consumer.go create mode 100644 services/iaas/model_set_image_share_payload.go create mode 100644 services/iaas/model_snapshot.go create mode 100644 services/iaas/model_snapshot_list_response.go create mode 100644 services/iaas/model_update_backup_payload.go create mode 100644 services/iaas/model_update_image_payload.go create mode 100644 services/iaas/model_update_image_share_payload.go create mode 100644 services/iaas/model_update_snapshot_payload.go diff --git a/services/iaas/CHANGELOG.md b/services/iaas/CHANGELOG.md index 8b1b5b39..aaf152a6 100644 --- a/services/iaas/CHANGELOG.md +++ b/services/iaas/CHANGELOG.md @@ -1,3 +1,14 @@ +## v0.17.0 (2024-12-13) + +- **Feature:** Add new methods to manage affinity groups: `CreateAffinityGroup`, `DeleteAffinityGroup`, `GetAffinityGroup`, and `ListAffinityGroup` +- **Feature:** Add new methods to manage backups: `CreateBackup`, `DeleteBackup`, `GetBackup`, `ListBackup`, `RestoreBackup`, `ExecuteBackup`,`UpdateBackup` +- **Feature:** Add new methods to manage images: `CreateImage`, `DeleteImage`, `GetImage`, `ListImage`,`UpdateImage` +- **Feature:** Add new methods to manage imageshares: `DeleteImageShare`, `GetImageShare`, `SetImageShare`,`UpdateImageShare` +- **Feature:** Add new methods to manage imageshare consumers: `DeleteImageShareConsumer`, `GetImageShareConsumer`, `SetImageShare`,`UpdateImageShare` +- **Feature:** Add new methods to manage project NICs: `GetProjectNIC`, `ListProjectNICs` +- **Feature:** Add new methods to manage snapshots: `CreateSnapshot`, `DeleteSnapshot`, `GetSnapshot`, `ListSnapshot`, `UpdateSnapshot` +- **Bugfix:** Correctly handle nullable attributes in model types + ## v0.16.0 (2024-11-08) - **Feature:** Add new methods to manage key pairs: `CreateKeyPair`, `UpdateKeyPair`, `DeleteKeyPair`, `GetKeyPair`, and `ListKeyPairs` diff --git a/services/iaas/api_default.go b/services/iaas/api_default.go index 5873df9f..1ed6aad5 100644 --- a/services/iaas/api_default.go +++ b/services/iaas/api_default.go @@ -1238,39 +1238,47 @@ func (a *APIClient) AddVolumeToServerExecute(ctx context.Context, projectId stri return r.Execute() } -type ApiCreateKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - createKeyPairPayload *CreateKeyPairPayload +type ApiCreateAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createAffinityGroupPayload *CreateAffinityGroupPayload } -// Request a public key import. +// Request a affinity group creation. -func (r ApiCreateKeyPairRequest) CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest { - r.createKeyPairPayload = &createKeyPairPayload +func (r ApiCreateAffinityGroupRequest) CreateAffinityGroupPayload(createAffinityGroupPayload CreateAffinityGroupPayload) ApiCreateAffinityGroupRequest { + r.createAffinityGroupPayload = &createAffinityGroupPayload return r } -func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { +func (r ApiCreateAffinityGroupRequest) Execute() (*AffinityGroup, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Keypair + localVarReturnValue *AffinityGroup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAffinityGroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/keypairs" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/affinity-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.createKeyPairPayload == nil { - return localVarReturnValue, fmt.Errorf("createKeyPairPayload is required and must be specified") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createAffinityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createAffinityGroupPayload is required and must be specified") } // to determine the Content-Type header @@ -1291,7 +1299,7 @@ func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createKeyPairPayload + localVarPostBody = r.createAffinityGroupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1368,17 +1376,6 @@ func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - 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 - } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1406,56 +1403,59 @@ func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { } /* -CreateKeyPair: Import a public key. +CreateAffinityGroup: Create a new affinity group in a project. -Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. +Create a new server affinity group in the given project ID. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateKeyPairRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateAffinityGroupRequest */ -func (a *APIClient) CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest { - return ApiCreateKeyPairRequest{ +func (a *APIClient) CreateAffinityGroup(ctx context.Context, projectId string) ApiCreateAffinityGroupRequest { + return ApiCreateAffinityGroupRequest{ apiService: a.defaultApi, ctx: ctx, + projectId: projectId, } } -func (a *APIClient) CreateKeyPairExecute(ctx context.Context) (*Keypair, error) { - r := ApiCreateKeyPairRequest{ +func (a *APIClient) CreateAffinityGroupExecute(ctx context.Context, projectId string) (*AffinityGroup, error) { + r := ApiCreateAffinityGroupRequest{ apiService: a.defaultApi, ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiCreateNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createNetworkPayload *CreateNetworkPayload +type ApiCreateBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createBackupPayload *CreateBackupPayload } -// Request a network creation. +// Request a backup creation. -func (r ApiCreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { - r.createNetworkPayload = &createNetworkPayload +func (r ApiCreateBackupRequest) CreateBackupPayload(createBackupPayload CreateBackupPayload) ApiCreateBackupRequest { + r.createBackupPayload = &createBackupPayload return r } -func (r ApiCreateNetworkRequest) Execute() (*Network, error) { +func (r ApiCreateBackupRequest) Execute() (*Backup, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Network + localVarReturnValue *Backup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateBackup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/backups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -1467,8 +1467,8 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createNetworkPayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkPayload is required and must be specified") + if r.createBackupPayload == nil { + return localVarReturnValue, fmt.Errorf("createBackupPayload is required and must be specified") } // to determine the Content-Type header @@ -1489,7 +1489,7 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createNetworkPayload + localVarPostBody = r.createBackupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1566,17 +1566,6 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - 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 - } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1604,24 +1593,24 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { } /* -CreateNetwork: Create new network. +CreateBackup: Create new Backup. -Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. +Create a new Backup in a project. If a snapshot ID is provided create the backup from the snapshot. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateNetworkRequest + @return ApiCreateBackupRequest */ -func (a *APIClient) CreateNetwork(ctx context.Context, projectId string) ApiCreateNetworkRequest { - return ApiCreateNetworkRequest{ +func (a *APIClient) CreateBackup(ctx context.Context, projectId string) ApiCreateBackupRequest { + return ApiCreateBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string) (*Network, error) { - r := ApiCreateNetworkRequest{ +func (a *APIClient) CreateBackupExecute(ctx context.Context, projectId string) (*Backup, error) { + r := ApiCreateBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -1629,47 +1618,47 @@ func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string) return r.Execute() } -type ApiCreateNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - createNetworkAreaPayload *CreateNetworkAreaPayload +type ApiCreateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createImagePayload *CreateImagePayload } -// Request an Area creation. +// Request an image creation. -func (r ApiCreateNetworkAreaRequest) CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest { - r.createNetworkAreaPayload = &createNetworkAreaPayload +func (r ApiCreateImageRequest) CreateImagePayload(createImagePayload CreateImagePayload) ApiCreateImageRequest { + r.createImagePayload = &createImagePayload return r } -func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { +func (r ApiCreateImageRequest) Execute() (*ImageCreateResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkArea + localVarReturnValue *ImageCreateResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateImage") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createNetworkAreaPayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkAreaPayload is required and must be specified") + if r.createImagePayload == nil { + return localVarReturnValue, fmt.Errorf("createImagePayload is required and must be specified") } // to determine the Content-Type header @@ -1690,7 +1679,7 @@ func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createNetworkAreaPayload + localVarPostBody = r.createImagePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1767,6 +1756,17 @@ func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1794,80 +1794,64 @@ func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { } /* -CreateNetworkArea: Create new network area in an organization. +CreateImage: Create new Image. -Create a new network area in an organization. +Create a new Image in a project. This call, if successful, returns a pre-signed URL for the customer to upload the image. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @return ApiCreateNetworkAreaRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateImageRequest */ -func (a *APIClient) CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest { - return ApiCreateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) CreateImage(ctx context.Context, projectId string) ApiCreateImageRequest { + return ApiCreateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) { - r := ApiCreateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) CreateImageExecute(ctx context.Context, projectId string) (*ImageCreateResponse, error) { + r := ApiCreateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiCreateNetworkAreaRangeRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - createNetworkAreaRangePayload *CreateNetworkAreaRangePayload +type ApiCreateKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + createKeyPairPayload *CreateKeyPairPayload } -// Request an addition of network ranges to an area. +// Request a public key import. -func (r ApiCreateNetworkAreaRangeRequest) CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest { - r.createNetworkAreaRangePayload = &createNetworkAreaRangePayload +func (r ApiCreateKeyPairRequest) CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest { + r.createKeyPairPayload = &createKeyPairPayload return r } -func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, error) { +func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkRangeListResponse + localVarReturnValue *Keypair ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRange") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyPair") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/keypairs" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") - } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") - } - if r.createNetworkAreaRangePayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkAreaRangePayload is required and must be specified") + if r.createKeyPairPayload == nil { + return localVarReturnValue, fmt.Errorf("createKeyPairPayload is required and must be specified") } // to determine the Content-Type header @@ -1888,7 +1872,7 @@ func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createNetworkAreaRangePayload + localVarPostBody = r.createKeyPairPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2003,83 +1987,69 @@ func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, } /* -CreateNetworkAreaRange: Create new network range in a network area. +CreateKeyPair: Import a public key. -Create a new network range in an existing network area. +Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiCreateNetworkAreaRangeRequest + @return ApiCreateKeyPairRequest */ -func (a *APIClient) CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRangeRequest { - return ApiCreateNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest { + return ApiCreateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, } } -func (a *APIClient) CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { - r := ApiCreateNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) CreateKeyPairExecute(ctx context.Context) (*Keypair, error) { + r := ApiCreateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, } return r.Execute() } -type ApiCreateNetworkAreaRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - createNetworkAreaRoutePayload *CreateNetworkAreaRoutePayload +type ApiCreateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createNetworkPayload *CreateNetworkPayload } -// Request an addition of routes to an area. +// Request a network creation. -func (r ApiCreateNetworkAreaRouteRequest) CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest { - r.createNetworkAreaRoutePayload = &createNetworkAreaRoutePayload +func (r ApiCreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { + r.createNetworkPayload = &createNetworkPayload return r } -func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) { +func (r ApiCreateNetworkRequest) Execute() (*Network, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RouteListResponse + localVarReturnValue *Network ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") - } - if r.createNetworkAreaRoutePayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkAreaRoutePayload is required and must be specified") + if r.createNetworkPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkPayload is required and must be specified") } // to determine the Content-Type header @@ -2100,7 +2070,7 @@ func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createNetworkAreaRoutePayload + localVarPostBody = r.createNetworkPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2215,83 +2185,72 @@ func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) } /* -CreateNetworkAreaRoute: Create new network routes. +CreateNetwork: Create new network. -Create one or several new network routes in a network area. +Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiCreateNetworkAreaRouteRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateNetworkRequest */ -func (a *APIClient) CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRouteRequest { - return ApiCreateNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) CreateNetwork(ctx context.Context, projectId string) ApiCreateNetworkRequest { + return ApiCreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { - r := ApiCreateNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string) (*Network, error) { + r := ApiCreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiCreateNicRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - createNicPayload *CreateNicPayload +type ApiCreateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + createNetworkAreaPayload *CreateNetworkAreaPayload } -// Request a network interface creation. +// Request an Area creation. -func (r ApiCreateNicRequest) CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest { - r.createNicPayload = &createNicPayload +func (r ApiCreateNetworkAreaRequest) CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest { + r.createNetworkAreaPayload = &createNetworkAreaPayload return r } -func (r ApiCreateNicRequest) Execute() (*NIC, error) { +func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NIC + localVarReturnValue *NetworkArea ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNic") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkArea") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") - } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if r.createNicPayload == nil { - return localVarReturnValue, fmt.Errorf("createNicPayload is required and must be specified") + if r.createNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaPayload is required and must be specified") } // to determine the Content-Type header @@ -2312,7 +2271,7 @@ func (r ApiCreateNicRequest) Execute() (*NIC, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createNicPayload + localVarPostBody = r.createNetworkAreaPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2389,28 +2348,6 @@ func (r ApiCreateNicRequest) Execute() (*NIC, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - 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 - } - if localVarHTTPResponse.StatusCode == 429 { - var v Error - 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 - } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2438,75 +2375,80 @@ func (r ApiCreateNicRequest) Execute() (*NIC, error) { } /* -CreateNic: Create new network interface. +CreateNetworkArea: Create new network area in an organization. -Create a new network interface in a project. +Create a new network area in an organization. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiCreateNicRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiCreateNetworkAreaRequest */ -func (a *APIClient) CreateNic(ctx context.Context, projectId string, networkId string) ApiCreateNicRequest { - return ApiCreateNicRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, +func (a *APIClient) CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest { + return ApiCreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, } } -func (a *APIClient) CreateNicExecute(ctx context.Context, projectId string, networkId string) (*NIC, error) { - r := ApiCreateNicRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, +func (a *APIClient) CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) { + r := ApiCreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, } return r.Execute() } -type ApiCreatePublicIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createPublicIPPayload *CreatePublicIPPayload +type ApiCreateNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + createNetworkAreaRangePayload *CreateNetworkAreaRangePayload } -// Request a public IP creation. +// Request an addition of network ranges to an area. -func (r ApiCreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { - r.createPublicIPPayload = &createPublicIPPayload +func (r ApiCreateNetworkAreaRangeRequest) CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest { + r.createNetworkAreaRangePayload = &createNetworkAreaRangePayload return r } -func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { +func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PublicIp + localVarReturnValue *NetworkRangeListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRange") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if r.createPublicIPPayload == nil { - return localVarReturnValue, fmt.Errorf("createPublicIPPayload is required and must be specified") + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRangePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRangePayload is required and must be specified") } // to determine the Content-Type header @@ -2527,7 +2469,7 @@ func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createPublicIPPayload + localVarPostBody = r.createNetworkAreaRangePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2604,7 +2546,7 @@ func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2642,72 +2584,83 @@ func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { } /* -CreatePublicIP: Create new public IP. +CreateNetworkAreaRange: Create new network range in a network area. -Create a new public IP in a project. +Create a new network range in an existing network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreatePublicIPRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiCreateNetworkAreaRangeRequest */ -func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string) ApiCreatePublicIPRequest { - return ApiCreatePublicIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRangeRequest { + return ApiCreateNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string) (*PublicIp, error) { - r := ApiCreatePublicIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { + r := ApiCreateNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiCreateSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createSecurityGroupPayload *CreateSecurityGroupPayload +type ApiCreateNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + createNetworkAreaRoutePayload *CreateNetworkAreaRoutePayload } -// Request a security group creation. +// Request an addition of routes to an area. -func (r ApiCreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { - r.createSecurityGroupPayload = &createSecurityGroupPayload +func (r ApiCreateNetworkAreaRouteRequest) CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest { + r.createNetworkAreaRoutePayload = &createNetworkAreaRoutePayload return r } -func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { +func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroup + localVarReturnValue *RouteListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRoute") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if r.createSecurityGroupPayload == nil { - return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload is required and must be specified") + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRoutePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRoutePayload is required and must be specified") } // to determine the Content-Type header @@ -2728,7 +2681,7 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createSecurityGroupPayload + localVarPostBody = r.createNetworkAreaRoutePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2805,6 +2758,17 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2832,62 +2796,65 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { } /* -CreateSecurityGroup: Create new security group. +CreateNetworkAreaRoute: Create new network routes. -Create a new security group in a project. +Create one or several new network routes in a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateSecurityGroupRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiCreateNetworkAreaRouteRequest */ -func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string) ApiCreateSecurityGroupRequest { - return ApiCreateSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRouteRequest { + return ApiCreateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string) (*SecurityGroup, error) { - r := ApiCreateSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { + r := ApiCreateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiCreateSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - createSecurityGroupRulePayload *CreateSecurityGroupRulePayload +type ApiCreateNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + createNicPayload *CreateNicPayload } -// Request for a security group rule creation. +// Request a network interface creation. -func (r ApiCreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { - r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload +func (r ApiCreateNicRequest) CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest { + r.createNicPayload = &createNicPayload return r } -func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { +func (r ApiCreateNicRequest) Execute() (*NIC, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroupRule + localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNic") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2898,14 +2865,14 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") } - if r.createSecurityGroupRulePayload == nil { - return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload is required and must be specified") + if r.createNicPayload == nil { + return localVarReturnValue, fmt.Errorf("createNicPayload is required and must be specified") } // to determine the Content-Type header @@ -2926,7 +2893,7 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createSecurityGroupRulePayload + localVarPostBody = r.createNicPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3003,6 +2970,28 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -3030,62 +3019,62 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) } /* -CreateSecurityGroupRule: Create new security group rule. +CreateNic: Create new network interface. -Create a new security group rule in a project. +Create a new network interface in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiCreateSecurityGroupRuleRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNicRequest */ -func (a *APIClient) CreateSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string) ApiCreateSecurityGroupRuleRequest { - return ApiCreateSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) CreateNic(ctx context.Context, projectId string, networkId string) ApiCreateNicRequest { + return ApiCreateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, } } -func (a *APIClient) CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRule, error) { - r := ApiCreateSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) CreateNicExecute(ctx context.Context, projectId string, networkId string) (*NIC, error) { + r := ApiCreateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, } return r.Execute() } -type ApiCreateServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createServerPayload *CreateServerPayload +type ApiCreatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createPublicIPPayload *CreatePublicIPPayload } -// Request a server creation. +// Request a public IP creation. -func (r ApiCreateServerRequest) CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest { - r.createServerPayload = &createServerPayload +func (r ApiCreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { + r.createPublicIPPayload = &createPublicIPPayload return r } -func (r ApiCreateServerRequest) Execute() (*Server, error) { +func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Server + localVarReturnValue *PublicIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -3097,8 +3086,8 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createServerPayload == nil { - return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") + if r.createPublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("createPublicIPPayload is required and must be specified") } // to determine the Content-Type header @@ -3119,7 +3108,7 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createServerPayload + localVarPostBody = r.createPublicIPPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3196,6 +3185,17 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -3223,24 +3223,24 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { } /* -CreateServer: Create new server. +CreatePublicIP: Create new public IP. -Create a new server in a project. +Create a new public IP in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateServerRequest + @return ApiCreatePublicIPRequest */ -func (a *APIClient) CreateServer(ctx context.Context, projectId string) ApiCreateServerRequest { - return ApiCreateServerRequest{ +func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string) ApiCreatePublicIPRequest { + return ApiCreatePublicIPRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) (*Server, error) { - r := ApiCreateServerRequest{ +func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string) (*PublicIp, error) { + r := ApiCreatePublicIPRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -3248,34 +3248,34 @@ func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) ( return r.Execute() } -type ApiCreateVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createVolumePayload *CreateVolumePayload +type ApiCreateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createSecurityGroupPayload *CreateSecurityGroupPayload } -// Request a volume creation. +// Request a security group creation. -func (r ApiCreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { - r.createVolumePayload = &createVolumePayload +func (r ApiCreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { + r.createSecurityGroupPayload = &createSecurityGroupPayload return r } -func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { +func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Volume + localVarReturnValue *SecurityGroup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -3287,8 +3287,8 @@ func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createVolumePayload == nil { - return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") + if r.createSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload is required and must be specified") } // to determine the Content-Type header @@ -3309,7 +3309,7 @@ func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createVolumePayload + localVarPostBody = r.createSecurityGroupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3413,24 +3413,24 @@ func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { } /* -CreateVolume: Create new volume. +CreateSecurityGroup: Create new security group. -Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. +Create a new security group in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateVolumeRequest + @return ApiCreateSecurityGroupRequest */ -func (a *APIClient) CreateVolume(ctx context.Context, projectId string) ApiCreateVolumeRequest { - return ApiCreateVolumeRequest{ +func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string) ApiCreateSecurityGroupRequest { + return ApiCreateSecurityGroupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string) (*Volume, error) { - r := ApiCreateVolumeRequest{ +func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string) (*SecurityGroup, error) { + r := ApiCreateSecurityGroupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -3438,47 +3438,59 @@ func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string) ( return r.Execute() } -type ApiDeallocateServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string -} - -func (r ApiDeallocateServerRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile +type ApiCreateSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + createSecurityGroupRulePayload *CreateSecurityGroupRulePayload +} + +// Request for a security group rule creation. + +func (r ApiCreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { + r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload + return r +} + +func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/deallocate" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" 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, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.createSecurityGroupRulePayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -3494,9 +3506,11 @@ func (r ApiDeallocateServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createSecurityGroupRulePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -3510,14 +3524,14 @@ func (r ApiDeallocateServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3531,131 +3545,145 @@ func (r ApiDeallocateServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeallocateServer: Deallocate an existing server. +CreateSecurityGroupRule: Create new security group rule. -Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. +Create a new security group rule in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiDeallocateServerRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest */ -func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, serverId string) ApiDeallocateServerRequest { - return ApiDeallocateServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) CreateSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string) ApiCreateSecurityGroupRuleRequest { + return ApiCreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiDeallocateServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRule, error) { + r := ApiCreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiDeleteKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - keypairName string +type ApiCreateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createServerPayload *CreateServerPayload } -func (r ApiDeleteKeyPairRequest) Execute() error { +// Request a server creation. + +func (r ApiCreateServerRequest) CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest { + r.createServerPayload = &createServerPayload + return r +} + +func (r ApiCreateServerRequest) Execute() (*Server, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/keypairs/{keypairName}" - localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.keypairName) > 127 { - return fmt.Errorf("keypairName must have less than 127 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createServerPayload == nil { + return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -3671,9 +3699,11 @@ func (r ApiDeleteKeyPairRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -3687,14 +3717,14 @@ func (r ApiDeleteKeyPairRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3708,104 +3738,5308 @@ func (r ApiDeleteKeyPairRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateServer: Create new server. + +Create a new server in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateServerRequest +*/ +func (a *APIClient) CreateServer(ctx context.Context, projectId string) ApiCreateServerRequest { + return ApiCreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) (*Server, error) { + r := ApiCreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiCreateSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createSnapshotPayload *CreateSnapshotPayload +} + +// Request a snapshot creation. + +func (r ApiCreateSnapshotRequest) CreateSnapshotPayload(createSnapshotPayload CreateSnapshotPayload) ApiCreateSnapshotRequest { + r.createSnapshotPayload = &createSnapshotPayload + return r +} + +func (r ApiCreateSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("createSnapshotPayload is required and must be specified") + } + + // 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSnapshotPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateSnapshot: Create new Snapshot. + +Create a new Snapshot from a Volume in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateSnapshotRequest +*/ +func (a *APIClient) CreateSnapshot(ctx context.Context, projectId string) ApiCreateSnapshotRequest { + return ApiCreateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateSnapshotExecute(ctx context.Context, projectId string) (*Snapshot, error) { + r := ApiCreateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiCreateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createVolumePayload *CreateVolumePayload +} + +// Request a volume creation. + +func (r ApiCreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { + r.createVolumePayload = &createVolumePayload + return r +} + +func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") + } + + // 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createVolumePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateVolume: Create new volume. + +Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateVolumeRequest +*/ +func (a *APIClient) CreateVolume(ctx context.Context, projectId string) ApiCreateVolumeRequest { + return ApiCreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string) (*Volume, error) { + r := ApiCreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiDeallocateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiDeallocateServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/deallocate" + 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{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeallocateServer: Deallocate an existing server. + +Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest +*/ +func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, serverId string) ApiDeallocateServerRequest { + return ApiDeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiDeleteAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + affinityGroupId string +} + +func (r ApiDeleteAffinityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAffinityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/affinity-groups/{affinityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(r.affinityGroupId, "affinityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.affinityGroupId) < 36 { + return fmt.Errorf("affinityGroupId must have at least 36 elements") + } + if strlen(r.affinityGroupId) > 36 { + return fmt.Errorf("affinityGroupId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteAffinityGroup: Delete a affinity group in a project. + +Delete a affinity group in the given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiDeleteAffinityGroupRequest +*/ +func (a *APIClient) DeleteAffinityGroup(ctx context.Context, projectId string, affinityGroupId string) ApiDeleteAffinityGroupRequest { + return ApiDeleteAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + affinityGroupId: affinityGroupId, + } +} + +func (a *APIClient) DeleteAffinityGroupExecute(ctx context.Context, projectId string, affinityGroupId string) error { + r := ApiDeleteAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + affinityGroupId: affinityGroupId, + } + return r.Execute() +} + +type ApiDeleteBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + backupId string + force *bool +} + +// Force action. + +func (r ApiDeleteBackupRequest) Force(force bool) ApiDeleteBackupRequest { + r.force = &force + return r +} + +func (r ApiDeleteBackupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteBackup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return fmt.Errorf("backupId must have less than 36 elements") + } + + if r.force != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force", r.force, "") + } + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteBackup: Delete a backup. + +Delete a backup that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiDeleteBackupRequest +*/ +func (a *APIClient) DeleteBackup(ctx context.Context, projectId string, backupId string) ApiDeleteBackupRequest { + return ApiDeleteBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + backupId: backupId, + } +} + +func (a *APIClient) DeleteBackupExecute(ctx context.Context, projectId string, backupId string) error { + r := ApiDeleteBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + backupId: backupId, + } + return r.Execute() +} + +type ApiDeleteImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string +} + +func (r ApiDeleteImageRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImage") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteImage: Delete an Image. + +Delete an image that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageRequest +*/ +func (a *APIClient) DeleteImage(ctx context.Context, projectId string, imageId string) ApiDeleteImageRequest { + return ApiDeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } +} + +func (a *APIClient) DeleteImageExecute(ctx context.Context, projectId string, imageId string) error { + r := ApiDeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } + return r.Execute() +} + +type ApiDeleteImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string +} + +func (r ApiDeleteImageShareRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShare") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteImageShare: Remove image share. + +Remove the image share. New scope will be local. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageShareRequest +*/ +func (a *APIClient) DeleteImageShare(ctx context.Context, projectId string, imageId string) ApiDeleteImageShareRequest { + return ApiDeleteImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } +} + +func (a *APIClient) DeleteImageShareExecute(ctx context.Context, projectId string, imageId string) error { + r := ApiDeleteImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } + return r.Execute() +} + +type ApiDeleteImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + consumerProjectId string +} + +func (r ApiDeleteImageShareConsumerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShareConsumer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(r.consumerProjectId, "consumerProjectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + if strlen(r.consumerProjectId) < 36 { + return fmt.Errorf("consumerProjectId must have at least 36 elements") + } + if strlen(r.consumerProjectId) > 36 { + return fmt.Errorf("consumerProjectId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteImageShareConsumer: Remove an image share consumer. + +Remove consumer from a shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiDeleteImageShareConsumerRequest +*/ +func (a *APIClient) DeleteImageShareConsumer(ctx context.Context, projectId string, imageId string, consumerProjectId string) ApiDeleteImageShareConsumerRequest { + return ApiDeleteImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + consumerProjectId: consumerProjectId, + } +} + +func (a *APIClient) DeleteImageShareConsumerExecute(ctx context.Context, projectId string, imageId string, consumerProjectId string) error { + r := ApiDeleteImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + consumerProjectId: consumerProjectId, + } + return r.Execute() +} + +type ApiDeleteKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r ApiDeleteKeyPairRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return fmt.Errorf("keypairName must have less than 127 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteKeyPair: Delete an SSH keypair. + +Delete an SSH keypair from a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest +*/ +func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { + return ApiDeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { + r := ApiDeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type ApiDeleteNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string +} + +func (r ApiDeleteNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteNetwork: Delete network. + +Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest +*/ +func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, networkId string) ApiDeleteNetworkRequest { + return ApiDeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } +} + +func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, networkId string) error { + r := ApiDeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } + return r.Execute() +} + +type ApiDeleteNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ApiDeleteNetworkAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteNetworkArea: Delete a network area. + +Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiDeleteNetworkAreaRequest +*/ +func (a *APIClient) DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest { + return ApiDeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error { + r := ApiDeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ApiDeleteNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + networkRangeId string +} + +func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRange") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteNetworkAreaRange: Delete a network range. + +Delete a network range of a network area. The deletion will fail if the network range is still used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiDeleteNetworkAreaRangeRequest +*/ +func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest { + return ApiDeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) error { + r := ApiDeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type ApiDeleteNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + routeId string +} + +func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRoute") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteNetworkAreaRoute: Delete a network route. + +Delete a network route of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteNetworkAreaRouteRequest +*/ +func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiDeleteNetworkAreaRouteRequest { + return ApiDeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + routeId: routeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) error { + r := ApiDeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + routeId: routeId, + } + return r.Execute() +} + +type ApiDeleteNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + nicId string +} + +func (r ApiDeleteNicRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNic") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteNic: Delete a network interface. + +Delete a network interface that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest +*/ +func (a *APIClient) DeleteNic(ctx context.Context, projectId string, networkId string, nicId string) ApiDeleteNicRequest { + return ApiDeleteNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) DeleteNicExecute(ctx context.Context, projectId string, networkId string, nicId string) error { + r := ApiDeleteNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type ApiDeletePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + publicIpId string +} + +func (r ApiDeletePublicIPRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeletePublicIP: Delete a public IP. + +Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest +*/ +func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, publicIpId string) ApiDeletePublicIPRequest { + return ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, publicIpId string) error { + r := ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type ApiDeleteSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string +} + +func (r ApiDeleteSecurityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteSecurityGroup: Delete security group. + +Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest +*/ +func (a *APIClient) DeleteSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiDeleteSecurityGroupRequest { + return ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) DeleteSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) error { + r := ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ApiDeleteSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string +} + +func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteSecurityGroupRule: Delete security group rule. + +Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest +*/ +func (a *APIClient) DeleteSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest { + return ApiDeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) error { + r := ApiDeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type ApiDeleteServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiDeleteServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteServer: Delete a server. + +Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest +*/ +func (a *APIClient) DeleteServer(ctx context.Context, projectId string, serverId string) ApiDeleteServerRequest { + return ApiDeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiDeleteSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + snapshotId string +} + +func (r ApiDeleteSnapshotRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSnapshot") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return fmt.Errorf("snapshotId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteSnapshot: Delete a snapshot. + +Delete a snapshot that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiDeleteSnapshotRequest +*/ +func (a *APIClient) DeleteSnapshot(ctx context.Context, projectId string, snapshotId string) ApiDeleteSnapshotRequest { + return ApiDeleteSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + snapshotId: snapshotId, + } +} + +func (a *APIClient) DeleteSnapshotExecute(ctx context.Context, projectId string, snapshotId string) error { + r := ApiDeleteSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + snapshotId: snapshotId, + } + return r.Execute() +} + +type ApiDeleteVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string +} + +func (r ApiDeleteVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 nil +} + +/* +DeleteVolume: Delete a volume. + +Delete a volume inside a project. The deletion will fail if the volume is still in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiDeleteVolumeRequest +*/ +func (a *APIClient) DeleteVolume(ctx context.Context, projectId string, volumeId string) ApiDeleteVolumeRequest { + return ApiDeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, + } +} + +func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, volumeId string) error { + r := ApiDeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiGetAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + affinityGroupId string +} + +func (r ApiGetAffinityGroupRequest) Execute() (*AffinityGroup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroup + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAffinityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/affinity-groups/{affinityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(r.affinityGroupId, "affinityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.affinityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("affinityGroupId must have at least 36 elements") + } + if strlen(r.affinityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("affinityGroupId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAffinityGroup: Get the affinity group. + +Get the affinity group created in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiGetAffinityGroupRequest +*/ +func (a *APIClient) GetAffinityGroup(ctx context.Context, projectId string, affinityGroupId string) ApiGetAffinityGroupRequest { + return ApiGetAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + affinityGroupId: affinityGroupId, + } +} + +func (a *APIClient) GetAffinityGroupExecute(ctx context.Context, projectId string, affinityGroupId string) (*AffinityGroup, error) { + r := ApiGetAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + affinityGroupId: affinityGroupId, + } + return r.Execute() +} + +type ApiGetAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string +} + +func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + 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, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAttachedVolume: Get Volume Attachment details. + +Get the details of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetAttachedVolumeRequest +*/ +func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { + return ApiGetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := ApiGetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiGetBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + backupId string +} + +func (r ApiGetBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return localVarReturnValue, fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return localVarReturnValue, fmt.Errorf("backupId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetBackup: Get details about a backup. + +Get details about a block device backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiGetBackupRequest +*/ +func (a *APIClient) GetBackup(ctx context.Context, projectId string, backupId string) ApiGetBackupRequest { + return ApiGetBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + backupId: backupId, + } +} + +func (a *APIClient) GetBackupExecute(ctx context.Context, projectId string, backupId string) (*Backup, error) { + r := ApiGetBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + backupId: backupId, + } + return r.Execute() +} + +type ApiGetImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string +} + +func (r ApiGetImageRequest) Execute() (*Image, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Image + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImage: Get details about an image. + +Get details about a specific Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageRequest +*/ +func (a *APIClient) GetImage(ctx context.Context, projectId string, imageId string) ApiGetImageRequest { + return ApiGetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } +} + +func (a *APIClient) GetImageExecute(ctx context.Context, projectId string, imageId string) (*Image, error) { + r := ApiGetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } + return r.Execute() +} + +type ApiGetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string +} + +func (r ApiGetImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImageShare: Get share details of an image. + +Get share details about an shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageShareRequest +*/ +func (a *APIClient) GetImageShare(ctx context.Context, projectId string, imageId string) ApiGetImageShareRequest { + return ApiGetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } +} + +func (a *APIClient) GetImageShareExecute(ctx context.Context, projectId string, imageId string) (*ImageShare, error) { + r := ApiGetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } + return r.Execute() +} + +type ApiGetImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + consumerProjectId string +} + +func (r ApiGetImageShareConsumerRequest) Execute() (*ImageShareConsumer, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShareConsumer + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShareConsumer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(r.consumerProjectId, "consumerProjectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if strlen(r.consumerProjectId) < 36 { + return localVarReturnValue, fmt.Errorf("consumerProjectId must have at least 36 elements") + } + if strlen(r.consumerProjectId) > 36 { + return localVarReturnValue, fmt.Errorf("consumerProjectId must have less than 36 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImageShareConsumer: Get image share consumer. + +Get details about an image share consumer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiGetImageShareConsumerRequest +*/ +func (a *APIClient) GetImageShareConsumer(ctx context.Context, projectId string, imageId string, consumerProjectId string) ApiGetImageShareConsumerRequest { + return ApiGetImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + consumerProjectId: consumerProjectId, + } +} + +func (a *APIClient) GetImageShareConsumerExecute(ctx context.Context, projectId string, imageId string, consumerProjectId string) (*ImageShareConsumer, error) { + r := ApiGetImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + consumerProjectId: consumerProjectId, + } + return r.Execute() +} + +type ApiGetKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r ApiGetKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKeyPair: Get SSH keypair details. + +Get details about an SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiGetKeyPairRequest +*/ +func (a *APIClient) GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest { + return ApiGetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { + r := ApiGetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type ApiGetMachineTypeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + machineType string +} + +func (r ApiGetMachineTypeRequest) Execute() (*MachineType, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MachineType + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMachineType") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/machine-types/{machineType}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(r.machineType, "machineType")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.machineType) > 63 { + return localVarReturnValue, fmt.Errorf("machineType must have less than 63 elements") + } + + // 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{"application/json"} + + // 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 localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr } - return nil + return localVarReturnValue, nil } /* -DeleteKeyPair: Delete an SSH keypair. +GetMachineType: Get details about a machine type. -Delete an SSH keypair from a user. +Get details about a specific machine type. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param keypairName The name of an SSH keypair. - @return ApiDeleteKeyPairRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param machineType STACKIT machine type Name. + @return ApiGetMachineTypeRequest */ -func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { - return ApiDeleteKeyPairRequest{ +func (a *APIClient) GetMachineType(ctx context.Context, projectId string, machineType string) ApiGetMachineTypeRequest { + return ApiGetMachineTypeRequest{ apiService: a.defaultApi, ctx: ctx, - keypairName: keypairName, + projectId: projectId, + machineType: machineType, } } -func (a *APIClient) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { - r := ApiDeleteKeyPairRequest{ +func (a *APIClient) GetMachineTypeExecute(ctx context.Context, projectId string, machineType string) (*MachineType, error) { + r := ApiGetMachineTypeRequest{ apiService: a.defaultApi, ctx: ctx, - keypairName: keypairName, + projectId: projectId, + machineType: machineType, } return r.Execute() } -type ApiDeleteNetworkRequest struct { +type ApiGetNetworkRequest struct { ctx context.Context apiService *DefaultApiService projectId string networkId string } -func (r ApiDeleteNetworkRequest) Execute() error { +func (r ApiGetNetworkRequest) Execute() (*Network, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" @@ -3816,16 +9050,16 @@ func (r ApiDeleteNetworkRequest) Execute() error { localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") } if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") } // to determine the Content-Type header @@ -3847,7 +9081,7 @@ func (r ApiDeleteNetworkRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -3861,14 +9095,14 @@ func (r ApiDeleteNetworkRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3882,84 +9116,83 @@ func (r ApiDeleteNetworkRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetwork: Delete network. +GetNetwork: Get network details. -Delete a network. If the network is still in use, the deletion will fail. +Get details about a network of a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param networkId The identifier (ID) of a STACKIT Network. - @return ApiDeleteNetworkRequest + @return ApiGetNetworkRequest */ -func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, networkId string) ApiDeleteNetworkRequest { - return ApiDeleteNetworkRequest{ +func (a *APIClient) GetNetwork(ctx context.Context, projectId string, networkId string) ApiGetNetworkRequest { + return ApiGetNetworkRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -3967,8 +9200,8 @@ func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, network } } -func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, networkId string) error { - r := ApiDeleteNetworkRequest{ +func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, networkId string) (*Network, error) { + r := ApiGetNetworkRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -3977,23 +9210,24 @@ func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, return r.Execute() } -type ApiDeleteNetworkAreaRequest struct { +type ApiGetNetworkAreaRequest struct { ctx context.Context apiService *DefaultApiService organizationId string areaId string } -func (r ApiDeleteNetworkAreaRequest) Execute() error { +func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" @@ -4004,16 +9238,16 @@ func (r ApiDeleteNetworkAreaRequest) Execute() error { localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.organizationId) < 36 { - return fmt.Errorf("organizationId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } if strlen(r.organizationId) > 36 { - return fmt.Errorf("organizationId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } if strlen(r.areaId) < 36 { - return fmt.Errorf("areaId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } if strlen(r.areaId) > 36 { - return fmt.Errorf("areaId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } // to determine the Content-Type header @@ -4035,7 +9269,7 @@ func (r ApiDeleteNetworkAreaRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -4049,14 +9283,14 @@ func (r ApiDeleteNetworkAreaRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -4070,84 +9304,83 @@ func (r ApiDeleteNetworkAreaRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetworkArea: Delete a network area. +GetNetworkArea: Get details about a network area. -Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. +Get details about a network area in an organization. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param organizationId The identifier (ID) of a STACKIT Organization. @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiDeleteNetworkAreaRequest + @return ApiGetNetworkAreaRequest */ -func (a *APIClient) DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest { - return ApiDeleteNetworkAreaRequest{ +func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { + return ApiGetNetworkAreaRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -4155,8 +9388,8 @@ func (a *APIClient) DeleteNetworkArea(ctx context.Context, organizationId string } } -func (a *APIClient) DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error { - r := ApiDeleteNetworkAreaRequest{ +func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := ApiGetNetworkAreaRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -4165,7 +9398,7 @@ func (a *APIClient) DeleteNetworkAreaExecute(ctx context.Context, organizationId return r.Execute() } -type ApiDeleteNetworkAreaRangeRequest struct { +type ApiGetNetworkAreaRangeRequest struct { ctx context.Context apiService *DefaultApiService organizationId string @@ -4173,16 +9406,17 @@ type ApiDeleteNetworkAreaRangeRequest struct { networkRangeId string } -func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { +func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRange ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRange") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRange") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" @@ -4194,22 +9428,22 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.organizationId) < 36 { - return fmt.Errorf("organizationId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } if strlen(r.organizationId) > 36 { - return fmt.Errorf("organizationId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } if strlen(r.areaId) < 36 { - return fmt.Errorf("areaId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } if strlen(r.areaId) > 36 { - return fmt.Errorf("areaId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } if strlen(r.networkRangeId) < 36 { - return fmt.Errorf("networkRangeId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("networkRangeId must have at least 36 elements") } if strlen(r.networkRangeId) > 36 { - return fmt.Errorf("networkRangeId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("networkRangeId must have less than 36 elements") } // to determine the Content-Type header @@ -4231,7 +9465,7 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -4245,14 +9479,14 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -4266,85 +9500,84 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetworkAreaRange: Delete a network range. +GetNetworkAreaRange: Get details about a network range. -Delete a network range of a network area. The deletion will fail if the network range is still used. +Get details about a network range in a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param organizationId The identifier (ID) of a STACKIT Organization. @param areaId The identifier (ID) of a STACKIT Network Area. @param networkRangeId The identifier (ID) of a STACKIT Network Range. - @return ApiDeleteNetworkAreaRangeRequest + @return ApiGetNetworkAreaRangeRequest */ -func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest { - return ApiDeleteNetworkAreaRangeRequest{ +func (a *APIClient) GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiGetNetworkAreaRangeRequest { + return ApiGetNetworkAreaRangeRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -4353,8 +9586,8 @@ func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId s } } -func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) error { - r := ApiDeleteNetworkAreaRangeRequest{ +func (a *APIClient) GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) (*NetworkRange, error) { + r := ApiGetNetworkAreaRangeRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -4364,7 +9597,7 @@ func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizat return r.Execute() } -type ApiDeleteNetworkAreaRouteRequest struct { +type ApiGetNetworkAreaRouteRequest struct { ctx context.Context apiService *DefaultApiService organizationId string @@ -4372,16 +9605,17 @@ type ApiDeleteNetworkAreaRouteRequest struct { routeId string } -func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { +func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRoute") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" @@ -4393,22 +9627,22 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.organizationId) < 36 { - return fmt.Errorf("organizationId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } if strlen(r.organizationId) > 36 { - return fmt.Errorf("organizationId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } if strlen(r.areaId) < 36 { - return fmt.Errorf("areaId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } if strlen(r.areaId) > 36 { - return fmt.Errorf("areaId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } if strlen(r.routeId) < 36 { - return fmt.Errorf("routeId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") } if strlen(r.routeId) > 36 { - return fmt.Errorf("routeId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") } // to determine the Content-Type header @@ -4430,7 +9664,7 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -4444,14 +9678,14 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -4465,74 +9699,84 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetworkAreaRoute: Delete a network route. +GetNetworkAreaRoute: Get details about a network route. -Delete a network route of a network area. +Get details about a network route defined in a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param organizationId The identifier (ID) of a STACKIT Organization. @param areaId The identifier (ID) of a STACKIT Network Area. @param routeId The identifier (ID) of a STACKIT Route. - @return ApiDeleteNetworkAreaRouteRequest + @return ApiGetNetworkAreaRouteRequest */ -func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiDeleteNetworkAreaRouteRequest { - return ApiDeleteNetworkAreaRouteRequest{ +func (a *APIClient) GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiGetNetworkAreaRouteRequest { + return ApiGetNetworkAreaRouteRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -4541,8 +9785,8 @@ func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId s } } -func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) error { - r := ApiDeleteNetworkAreaRouteRequest{ +func (a *APIClient) GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) (*Route, error) { + r := ApiGetNetworkAreaRouteRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -4552,7 +9796,7 @@ func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizat return r.Execute() } -type ApiDeleteNicRequest struct { +type ApiGetNicRequest struct { ctx context.Context apiService *DefaultApiService projectId string @@ -4560,16 +9804,17 @@ type ApiDeleteNicRequest struct { nicId string } -func (r ApiDeleteNicRequest) Execute() error { +func (r ApiGetNicRequest) Execute() (*NIC, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNic") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNic") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" @@ -4581,22 +9826,22 @@ func (r ApiDeleteNicRequest) Execute() error { localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") } if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") } if strlen(r.nicId) < 36 { - return fmt.Errorf("nicId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") } if strlen(r.nicId) > 36 { - return fmt.Errorf("nicId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") } // to determine the Content-Type header @@ -4618,7 +9863,7 @@ func (r ApiDeleteNicRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -4632,14 +9877,14 @@ func (r ApiDeleteNicRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -4653,74 +9898,84 @@ func (r ApiDeleteNicRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNic: Delete a network interface. +GetNic: Get details about a network interface. -Delete a network interface that is part of the project. +Get details about a network interface inside a network. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param networkId The identifier (ID) of a STACKIT Network. @param nicId The identifier (ID) of a network interface. - @return ApiDeleteNicRequest + @return ApiGetNicRequest */ -func (a *APIClient) DeleteNic(ctx context.Context, projectId string, networkId string, nicId string) ApiDeleteNicRequest { - return ApiDeleteNicRequest{ +func (a *APIClient) GetNic(ctx context.Context, projectId string, networkId string, nicId string) ApiGetNicRequest { + return ApiGetNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -4729,8 +9984,8 @@ func (a *APIClient) DeleteNic(ctx context.Context, projectId string, networkId s } } -func (a *APIClient) DeleteNicExecute(ctx context.Context, projectId string, networkId string, nicId string) error { - r := ApiDeleteNicRequest{ +func (a *APIClient) GetNicExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { + r := ApiGetNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -4740,43 +9995,44 @@ func (a *APIClient) DeleteNicExecute(ctx context.Context, projectId string, netw return r.Execute() } -type ApiDeletePublicIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - publicIpId string +type ApiGetOrganizationRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + requestId string } -func (r ApiDeletePublicIPRequest) Execute() error { +func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if strlen(r.publicIpId) < 36 { - return fmt.Errorf("publicIpId must have at least 36 elements") + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") } - if strlen(r.publicIpId) > 36 { - return fmt.Errorf("publicIpId must have less than 36 elements") + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") } // to determine the Content-Type header @@ -4798,7 +10054,7 @@ func (r ApiDeletePublicIPRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -4812,14 +10068,14 @@ func (r ApiDeletePublicIPRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -4833,127 +10089,138 @@ func (r ApiDeletePublicIPRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeletePublicIP: Delete a public IP. +GetOrganizationRequest: Lookup an organization request ID. -Delete a public IP that is part of the project. +Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiDeletePublicIPRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest */ -func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, publicIpId string) ApiDeletePublicIPRequest { - return ApiDeletePublicIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - publicIpId: publicIpId, +func (a *APIClient) GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest { + return ApiGetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, } } -func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, publicIpId string) error { - r := ApiDeletePublicIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - publicIpId: publicIpId, +func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { + r := ApiGetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, } return r.Execute() } -type ApiDeleteSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string +type ApiGetProjectNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + nicId string } -func (r ApiDeleteSecurityGroupRequest) Execute() error { +func (r ApiGetProjectNICRequest) Execute() (*NIC, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectNIC") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/nics/{nicId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return fmt.Errorf("securityGroupId must have at least 36 elements") + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId must have less than 36 elements") + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") } // to determine the Content-Type header @@ -4975,7 +10242,7 @@ func (r ApiDeleteSecurityGroupRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -4989,14 +10256,14 @@ func (r ApiDeleteSecurityGroupRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -5010,146 +10277,138 @@ func (r ApiDeleteSecurityGroupRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteSecurityGroup: Delete security group. +GetProjectNIC: Get details about a network interface of a project. -Delete a security group. +Get details about a network interface inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiDeleteSecurityGroupRequest + @param nicId The identifier (ID) of a network interface. + @return ApiGetProjectNICRequest */ -func (a *APIClient) DeleteSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiDeleteSecurityGroupRequest { - return ApiDeleteSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) GetProjectNIC(ctx context.Context, projectId string, nicId string) ApiGetProjectNICRequest { + return ApiGetProjectNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + nicId: nicId, } } -func (a *APIClient) DeleteSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) error { - r := ApiDeleteSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) GetProjectNICExecute(ctx context.Context, projectId string, nicId string) (*NIC, error) { + r := ApiGetProjectNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + nicId: nicId, } return r.Execute() } -type ApiDeleteSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - securityGroupRuleId string +type ApiGetProjectRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + requestId string } -func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { +func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/requests/{requestId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.securityGroupId) < 36 { - return fmt.Errorf("securityGroupId must have at least 36 elements") - } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupRuleId) < 36 { - return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") } - if strlen(r.securityGroupRuleId) > 36 { - return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") } // to determine the Content-Type header @@ -5171,7 +10430,7 @@ func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -5185,14 +10444,14 @@ func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -5206,130 +10465,138 @@ func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteSecurityGroupRule: Delete security group rule. +GetProjectRequest: Lookup a project request ID. -Delete a security group rule. +Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. - @return ApiDeleteSecurityGroupRuleRequest + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetProjectRequestRequest */ -func (a *APIClient) DeleteSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest { - return ApiDeleteSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, - securityGroupRuleId: securityGroupRuleId, +func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, requestId string) ApiGetProjectRequestRequest { + return ApiGetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + requestId: requestId, } } -func (a *APIClient) DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) error { - r := ApiDeleteSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, - securityGroupRuleId: securityGroupRuleId, +func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, requestId string) (*Request, error) { + r := ApiGetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + requestId: requestId, } return r.Execute() } -type ApiDeleteServerRequest struct { +type ApiGetPublicIPRequest struct { ctx context.Context apiService *DefaultApiService projectId string - serverId string + publicIpId string } -func (r ApiDeleteServerRequest) Execute() error { +func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" 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, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") } // to determine the Content-Type header @@ -5351,7 +10618,7 @@ func (r ApiDeleteServerRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -5365,14 +10632,14 @@ func (r ApiDeleteServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -5386,127 +10653,138 @@ func (r ApiDeleteServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteServer: Delete a server. +GetPublicIP: Get details about a public IP. -Delete a server. Volumes won't be deleted. +Get details about a public IP inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiDeleteServerRequest + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest */ -func (a *APIClient) DeleteServer(ctx context.Context, projectId string, serverId string) ApiDeleteServerRequest { - return ApiDeleteServerRequest{ +func (a *APIClient) GetPublicIP(ctx context.Context, projectId string, publicIpId string) ApiGetPublicIPRequest { + return ApiGetPublicIPRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + publicIpId: publicIpId, } } -func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiDeleteServerRequest{ +func (a *APIClient) GetPublicIPExecute(ctx context.Context, projectId string, publicIpId string) (*PublicIp, error) { + r := ApiGetPublicIPRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + publicIpId: publicIpId, } return r.Execute() } -type ApiDeleteVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumeId string +type ApiGetSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string } -func (r ApiDeleteVolumeRequest) Execute() error { +func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.volumeId) < 36 { - return fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header @@ -5528,7 +10806,7 @@ func (r ApiDeleteVolumeRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -5542,14 +10820,14 @@ func (r ApiDeleteVolumeRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -5563,126 +10841,125 @@ func (r ApiDeleteVolumeRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteVolume: Delete a volume. +GetSecurityGroup: Get security group details. -Delete a volume inside a project. The deletion will fail if the volume is still in use. +Get details about a security group of a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiDeleteVolumeRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest */ -func (a *APIClient) DeleteVolume(ctx context.Context, projectId string, volumeId string) ApiDeleteVolumeRequest { - return ApiDeleteVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) GetSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiGetSecurityGroupRequest { + return ApiGetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, volumeId string) error { - r := ApiDeleteVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) GetSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroup, error) { + r := ApiGetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiGetAttachedVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - volumeId string +type ApiGetSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string } -func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { +func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachment + localVarReturnValue *SecurityGroupRule ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" 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, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -5693,17 +10970,17 @@ func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") } - if strlen(r.volumeId) < 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.securityGroupRuleId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.securityGroupRuleId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") } // to determine the Content-Type header @@ -5826,66 +11103,88 @@ func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { } /* -GetAttachedVolume: Get Volume Attachment details. +GetSecurityGroupRule: Get security group rule details. -Get the details of an existing Volume Attachment. +Get details about a security group rule of a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiGetAttachedVolumeRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiGetSecurityGroupRuleRequest */ -func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { - return ApiGetAttachedVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - volumeId: volumeId, +func (a *APIClient) GetSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest { + return ApiGetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, } } -func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { - r := ApiGetAttachedVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - volumeId: volumeId, +func (a *APIClient) GetSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) { + r := ApiGetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, } return r.Execute() } -type ApiGetKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - keypairName string +type ApiGetServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + details *bool } -func (r ApiGetKeyPairRequest) Execute() (*Keypair, error) { +// Show detailed information about server. + +func (r ApiGetServerRequest) Details(details bool) ApiGetServerRequest { + r.details = &details + return r +} + +func (r ApiGetServerRequest) Execute() (*Server, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Keypair + localVarReturnValue *Server ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/keypairs/{keypairName}" - localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + localVarPath := localBasePath + "/v1beta1/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{} - if strlen(r.keypairName) > 127 { - return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -6006,54 +11305,57 @@ func (r ApiGetKeyPairRequest) Execute() (*Keypair, error) { } /* -GetKeyPair: Get SSH keypair details. +GetServer: Get server details. -Get details about an SSH keypair. +Get details about a server by its ID. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param keypairName The name of an SSH keypair. - @return ApiGetKeyPairRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest */ -func (a *APIClient) GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest { - return ApiGetKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +func (a *APIClient) GetServer(ctx context.Context, projectId string, serverId string) ApiGetServerRequest { + return ApiGetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { - r := ApiGetKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, serverId string) (*Server, error) { + r := ApiGetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiGetMachineTypeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - machineType string +type ApiGetServerConsoleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiGetMachineTypeRequest) Execute() (*MachineType, error) { +func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *MachineType + localVarReturnValue *ServerConsoleUrl ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMachineType") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/machine-types/{machineType}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/console" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(r.machineType, "machineType")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -6064,8 +11366,11 @@ func (r ApiGetMachineTypeRequest) Execute() (*MachineType, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.machineType) > 63 { - return localVarReturnValue, fmt.Errorf("machineType must have less than 63 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -6188,57 +11493,65 @@ func (r ApiGetMachineTypeRequest) Execute() (*MachineType, error) { } /* -GetMachineType: Get details about a machine type. +GetServerConsole: Get server console. -Get details about a specific machine type. +Get a URL for server remote console. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param machineType STACKIT machine type Name. - @return ApiGetMachineTypeRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest */ -func (a *APIClient) GetMachineType(ctx context.Context, projectId string, machineType string) ApiGetMachineTypeRequest { - return ApiGetMachineTypeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - machineType: machineType, +func (a *APIClient) GetServerConsole(ctx context.Context, projectId string, serverId string) ApiGetServerConsoleRequest { + return ApiGetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) GetMachineTypeExecute(ctx context.Context, projectId string, machineType string) (*MachineType, error) { - r := ApiGetMachineTypeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - machineType: machineType, +func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId string, serverId string) (*ServerConsoleUrl, error) { + r := ApiGetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiGetNetworkRequest struct { +type ApiGetServerLogRequest struct { ctx context.Context apiService *DefaultApiService projectId string - networkId string + serverId string + length *int64 } -func (r ApiGetNetworkRequest) Execute() (*Network, error) { +// Request the server log. By default the length is limited to 2000 lines. Set to 0 to retrieve the complete log. + +func (r ApiGetServerLogRequest) Length(length int64) ApiGetServerLogRequest { + r.length = &length + return r +} + +func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Network + localVarReturnValue *GetServerLog200Response ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/log" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -6249,13 +11562,16 @@ func (r ApiGetNetworkRequest) Execute() (*Network, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } + if r.length != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "length", r.length, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -6376,72 +11692,72 @@ func (r ApiGetNetworkRequest) Execute() (*Network, error) { } /* -GetNetwork: Get network details. +GetServerLog: Get server log. -Get details about a network of a project. +Get server console log. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiGetNetworkRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerLogRequest */ -func (a *APIClient) GetNetwork(ctx context.Context, projectId string, networkId string) ApiGetNetworkRequest { - return ApiGetNetworkRequest{ +func (a *APIClient) GetServerLog(ctx context.Context, projectId string, serverId string) ApiGetServerLogRequest { + return ApiGetServerLogRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, + serverId: serverId, } } -func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, networkId string) (*Network, error) { - r := ApiGetNetworkRequest{ +func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, serverId string) (*GetServerLog200Response, error) { + r := ApiGetServerLogRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, + serverId: serverId, } return r.Execute() } -type ApiGetNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string -} - -func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { +type ApiGetSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + snapshotId string +} + +func (r ApiGetSnapshotRequest) Execute() (*Snapshot, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkArea + localVarReturnValue *Snapshot ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSnapshot") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.snapshotId) < 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.snapshotId) > 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have less than 36 elements") } // to determine the Content-Type header @@ -6564,80 +11880,72 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { } /* -GetNetworkArea: Get details about a network area. +GetSnapshot: Get details about a snapshot. -Get details about a network area in an organization. +Get details about a block device snapshot. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiGetNetworkAreaRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiGetSnapshotRequest */ -func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { - return ApiGetNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) GetSnapshot(ctx context.Context, projectId string, snapshotId string) ApiGetSnapshotRequest { + return ApiGetSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + snapshotId: snapshotId, } } -func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { - r := ApiGetNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) GetSnapshotExecute(ctx context.Context, projectId string, snapshotId string) (*Snapshot, error) { + r := ApiGetSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + snapshotId: snapshotId, } return r.Execute() } -type ApiGetNetworkAreaRangeRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - networkRangeId string +type ApiGetVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string } -func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { +func (r ApiGetVolumeRequest) Execute() (*Volume, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkRange + localVarReturnValue *Volume ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRange") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkRangeId) < 36 { - return localVarReturnValue, fmt.Errorf("networkRangeId must have at least 36 elements") + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") } - if strlen(r.networkRangeId) > 36 { - return localVarReturnValue, fmt.Errorf("networkRangeId must have less than 36 elements") + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") } // to determine the Content-Type header @@ -6760,83 +12068,69 @@ func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { } /* -GetNetworkAreaRange: Get details about a network range. +GetVolume: Get details about a volume. -Get details about a network range in a network area. +Get details about a block device volume. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @param networkRangeId The identifier (ID) of a STACKIT Network Range. - @return ApiGetNetworkAreaRangeRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest */ -func (a *APIClient) GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiGetNetworkAreaRangeRequest { - return ApiGetNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - networkRangeId: networkRangeId, +func (a *APIClient) GetVolume(ctx context.Context, projectId string, volumeId string) ApiGetVolumeRequest { + return ApiGetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } } -func (a *APIClient) GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) (*NetworkRange, error) { - r := ApiGetNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - networkRangeId: networkRangeId, +func (a *APIClient) GetVolumeExecute(ctx context.Context, projectId string, volumeId string) (*Volume, error) { + r := ApiGetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } return r.Execute() } -type ApiGetNetworkAreaRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - routeId string +type ApiGetVolumePerformanceClassRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumePerformanceClass string } -func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { +func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Route + localVarReturnValue *VolumePerformanceClass ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolumePerformanceClass") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(r.volumePerformanceClass, "volumePerformanceClass")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") - } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.routeId) < 36 { - return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.routeId) > 36 { - return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + if strlen(r.volumePerformanceClass) > 63 { + return localVarReturnValue, fmt.Errorf("volumePerformanceClass must have less than 63 elements") } // to determine the Content-Type header @@ -6959,62 +12253,55 @@ func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { } /* -GetNetworkAreaRoute: Get details about a network route. +GetVolumePerformanceClass: Get details about a volume performance class. -Get details about a network route defined in a network area. +Get details about a specific volume performance class. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @param routeId The identifier (ID) of a STACKIT Route. - @return ApiGetNetworkAreaRouteRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest */ -func (a *APIClient) GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiGetNetworkAreaRouteRequest { - return ApiGetNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - routeId: routeId, +func (a *APIClient) GetVolumePerformanceClass(ctx context.Context, projectId string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest { + return ApiGetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumePerformanceClass: volumePerformanceClass, } } -func (a *APIClient) GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) (*Route, error) { - r := ApiGetNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - routeId: routeId, +func (a *APIClient) GetVolumePerformanceClassExecute(ctx context.Context, projectId string, volumePerformanceClass string) (*VolumePerformanceClass, error) { + r := ApiGetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumePerformanceClass: volumePerformanceClass, } return r.Execute() } -type ApiGetNicRequest struct { +type ApiListAffinityGroupsRequest struct { ctx context.Context apiService *DefaultApiService projectId string - networkId string - nicId string } -func (r ApiGetNicRequest) Execute() (*NIC, error) { +func (r ApiListAffinityGroupsRequest) Execute() (*AffinityGroupListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NIC + localVarReturnValue *AffinityGroupListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNic") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAffinityGroups") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/affinity-groups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -7025,18 +12312,6 @@ func (r ApiGetNicRequest) Execute() (*NIC, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") - } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") - } - if strlen(r.nicId) < 36 { - return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") - } - if strlen(r.nicId) > 36 { - return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -7131,6 +12406,17 @@ func (r ApiGetNicRequest) Execute() (*NIC, error) { newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -7158,75 +12444,69 @@ func (r ApiGetNicRequest) Execute() (*NIC, error) { } /* -GetNic: Get details about a network interface. +ListAffinityGroups: Get the affinity groups setup for a project. -Get details about a network interface inside a network. +Get the affinity groups created in a project. Affinity groups are an indication of locality of a server relative to another group of servers. They can be either running on the same host (affinity) or on different ones (anti-affinity). @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @param nicId The identifier (ID) of a network interface. - @return ApiGetNicRequest + @return ApiListAffinityGroupsRequest */ -func (a *APIClient) GetNic(ctx context.Context, projectId string, networkId string, nicId string) ApiGetNicRequest { - return ApiGetNicRequest{ +func (a *APIClient) ListAffinityGroups(ctx context.Context, projectId string) ApiListAffinityGroupsRequest { + return ApiListAffinityGroupsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, - nicId: nicId, } } -func (a *APIClient) GetNicExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { - r := ApiGetNicRequest{ +func (a *APIClient) ListAffinityGroupsExecute(ctx context.Context, projectId string) (*AffinityGroupListResponse, error) { + r := ApiListAffinityGroupsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, - nicId: nicId, } return r.Execute() } -type ApiGetOrganizationRequestRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - requestId string +type ApiListAttachedVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { +func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Request + localVarReturnValue *VolumeAttachmentListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/requests/{requestId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments" + 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{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.requestId) < 36 { - return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.requestId) > 36 { - return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -7349,73 +12629,57 @@ func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { } /* -GetOrganizationRequest: Lookup an organization request ID. +ListAttachedVolumes: List all volume attachments of a server. -Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. +Get a list of all volume attachments of a server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param requestId The identifier (ID) of a STACKIT Request. - @return ApiGetOrganizationRequestRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest */ -func (a *APIClient) GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest { - return ApiGetOrganizationRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - requestId: requestId, +func (a *APIClient) ListAttachedVolumes(ctx context.Context, projectId string, serverId string) ApiListAttachedVolumesRequest { + return ApiListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { - r := ApiGetOrganizationRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - requestId: requestId, +func (a *APIClient) ListAttachedVolumesExecute(ctx context.Context, projectId string, serverId string) (*VolumeAttachmentListResponse, error) { + r := ApiListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiGetProjectRequestRequest struct { +type ApiListAvailabilityZonesRequest struct { ctx context.Context apiService *DefaultApiService - projectId string - requestId string } -func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { +func (r ApiListAvailabilityZonesRequest) Execute() (*AvailabilityZoneListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Request + localVarReturnValue *AvailabilityZoneListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAvailabilityZones") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/requests/{requestId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + localVarPath := localBasePath + "/v1beta1/availability-zones" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") - } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.requestId) < 36 { - return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") - } - if strlen(r.requestId) > 36 { - return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -7537,57 +12801,57 @@ func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { } /* -GetProjectRequest: Lookup a project request ID. +ListAvailabilityZones: List all availability zones. -Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. +Get a list of all availability zones. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param requestId The identifier (ID) of a STACKIT Request. - @return ApiGetProjectRequestRequest + @return ApiListAvailabilityZonesRequest */ -func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, requestId string) ApiGetProjectRequestRequest { - return ApiGetProjectRequestRequest{ +func (a *APIClient) ListAvailabilityZones(ctx context.Context) ApiListAvailabilityZonesRequest { + return ApiListAvailabilityZonesRequest{ apiService: a.defaultApi, ctx: ctx, - projectId: projectId, - requestId: requestId, } } -func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, requestId string) (*Request, error) { - r := ApiGetProjectRequestRequest{ +func (a *APIClient) ListAvailabilityZonesExecute(ctx context.Context) (*AvailabilityZoneListResponse, error) { + r := ApiListAvailabilityZonesRequest{ apiService: a.defaultApi, ctx: ctx, - projectId: projectId, - requestId: requestId, } return r.Execute() } -type ApiGetPublicIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - publicIpId string +type ApiListBackupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } -func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { +// Filter resources by labels. + +func (r ApiListBackupsRequest) LabelSelector(labelSelector string) ApiListBackupsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListBackupsRequest) Execute() (*BackupListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PublicIp + localVarReturnValue *BackupListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListBackups") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/backups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -7598,13 +12862,10 @@ func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.publicIpId) < 36 { - return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") - } - if strlen(r.publicIpId) > 36 { - return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") - } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -7725,57 +12986,60 @@ func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { } /* -GetPublicIP: Get details about a public IP. +ListBackups: List all backups inside a project. -Get details about a public IP inside a project. +Get a list of all backups inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiGetPublicIPRequest + @return ApiListBackupsRequest */ -func (a *APIClient) GetPublicIP(ctx context.Context, projectId string, publicIpId string) ApiGetPublicIPRequest { - return ApiGetPublicIPRequest{ +func (a *APIClient) ListBackups(ctx context.Context, projectId string) ApiListBackupsRequest { + return ApiListBackupsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - publicIpId: publicIpId, } } -func (a *APIClient) GetPublicIPExecute(ctx context.Context, projectId string, publicIpId string) (*PublicIp, error) { - r := ApiGetPublicIPRequest{ +func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string) (*BackupListResponse, error) { + r := ApiListBackupsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - publicIpId: publicIpId, } return r.Execute() } -type ApiGetSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string +type ApiListImagesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } -func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { +// Filter resources by labels. + +func (r ApiListImagesRequest) LabelSelector(labelSelector string) ApiListImagesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListImagesRequest) Execute() (*ImageListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroup + localVarReturnValue *ImageListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListImages") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -7786,13 +13050,10 @@ func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") - } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") - } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -7913,82 +13174,66 @@ func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { } /* -GetSecurityGroup: Get security group details. +ListImages: List all Images inside a project. -Get details about a security group of a project. +Get a list of all images inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiGetSecurityGroupRequest + @return ApiListImagesRequest */ -func (a *APIClient) GetSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiGetSecurityGroupRequest { - return ApiGetSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) ListImages(ctx context.Context, projectId string) ApiListImagesRequest { + return ApiListImagesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) GetSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroup, error) { - r := ApiGetSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) ListImagesExecute(ctx context.Context, projectId string) (*ImageListResponse, error) { + r := ApiListImagesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiGetSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - securityGroupRuleId string +type ApiListKeyPairsRequest struct { + ctx context.Context + apiService *DefaultApiService + labelSelector *string } -func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { +// Filter resources by labels. + +func (r ApiListKeyPairsRequest) LabelSelector(labelSelector string) ApiListKeyPairsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListKeyPairsRequest) Execute() (*KeyPairListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroupRule + localVarReturnValue *KeyPairListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListKeyPairs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + localVarPath := localBasePath + "/v1beta1/keypairs" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") - } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") - } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") - } - if strlen(r.securityGroupRuleId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") - } - if strlen(r.securityGroupRuleId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") - } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -8109,68 +13354,49 @@ func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { } /* -GetSecurityGroupRule: Get security group rule details. +ListKeyPairs: List all SSH keypairs for the requesting user. -Get details about a security group rule of a project. +Get a list of all SSH keypairs assigned to the requesting user. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. - @return ApiGetSecurityGroupRuleRequest + @return ApiListKeyPairsRequest */ -func (a *APIClient) GetSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest { - return ApiGetSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, - securityGroupRuleId: securityGroupRuleId, +func (a *APIClient) ListKeyPairs(ctx context.Context) ApiListKeyPairsRequest { + return ApiListKeyPairsRequest{ + apiService: a.defaultApi, + ctx: ctx, } } -func (a *APIClient) GetSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) { - r := ApiGetSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, - securityGroupRuleId: securityGroupRuleId, +func (a *APIClient) ListKeyPairsExecute(ctx context.Context) (*KeyPairListResponse, error) { + r := ApiListKeyPairsRequest{ + apiService: a.defaultApi, + ctx: ctx, } return r.Execute() } -type ApiGetServerRequest struct { +type ApiListMachineTypesRequest struct { ctx context.Context apiService *DefaultApiService projectId string - serverId string - details *bool -} - -// Show detailed information about server. - -func (r ApiGetServerRequest) Details(details bool) ApiGetServerRequest { - r.details = &details - return r } -func (r ApiGetServerRequest) Execute() (*Server, error) { +func (r ApiListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Server + localVarReturnValue *MachineTypeListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListMachineTypes") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/machine-types" 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{} @@ -8181,16 +13407,7 @@ func (r ApiGetServerRequest) Execute() (*Server, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") - } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") - } - if r.details != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -8311,72 +13528,69 @@ func (r ApiGetServerRequest) Execute() (*Server, error) { } /* -GetServer: Get server details. +ListMachineTypes: List all machine types available for a project. -Get details about a server by its ID. +Get a list of all machine type available in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiGetServerRequest + @return ApiListMachineTypesRequest */ -func (a *APIClient) GetServer(ctx context.Context, projectId string, serverId string) ApiGetServerRequest { - return ApiGetServerRequest{ +func (a *APIClient) ListMachineTypes(ctx context.Context, projectId string) ApiListMachineTypesRequest { + return ApiListMachineTypesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } } -func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, serverId string) (*Server, error) { - r := ApiGetServerRequest{ +func (a *APIClient) ListMachineTypesExecute(ctx context.Context, projectId string) (*MachineTypeListResponse, error) { + r := ApiListMachineTypesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } return r.Execute() } -type ApiGetServerConsoleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiListNetworkAreaProjectsRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string } -func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { +func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ServerConsoleUrl + localVarReturnValue *ProjectListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaProjects") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/console" - 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 := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } // to determine the Content-Type header @@ -8499,84 +13713,76 @@ func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { } /* -GetServerConsole: Get server console. +ListNetworkAreaProjects: List all projects using a network area. -Get a URL for server remote console. +Get a list of all projects using a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiGetServerConsoleRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaProjectsRequest */ -func (a *APIClient) GetServerConsole(ctx context.Context, projectId string, serverId string) ApiGetServerConsoleRequest { - return ApiGetServerConsoleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest { + return ApiListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId string, serverId string) (*ServerConsoleUrl, error) { - r := ApiGetServerConsoleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) { + r := ApiListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiGetServerLogRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - getServerLogRequest *GetServerLogRequest -} - -// Request the server log. By default the length is limited to 2000 lines. - -func (r ApiGetServerLogRequest) GetServerLogRequest(getServerLogRequest GetServerLogRequest) ApiGetServerLogRequest { - r.getServerLogRequest = &getServerLogRequest - return r +type ApiListNetworkAreaRangesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string } -func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { +func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetServerLog200Response + localVarReturnValue *NetworkRangeListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRanges") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/log" - 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 := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -8592,8 +13798,6 @@ func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.getServerLogRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -8697,74 +13901,85 @@ func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { } /* -GetServerLog: Get server log. +ListNetworkAreaRanges: List all network ranges in a network area. -Get server console log. +Get a list of all network ranges in a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiGetServerLogRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaRangesRequest */ -func (a *APIClient) GetServerLog(ctx context.Context, projectId string, serverId string) ApiGetServerLogRequest { - return ApiGetServerLogRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRangesRequest { + return ApiListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, serverId string) (*GetServerLog200Response, error) { - r := ApiGetServerLogRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { + r := ApiListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiGetVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumeId string +type ApiListNetworkAreaRoutesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + labelSelector *string } -func (r ApiGetVolumeRequest) Execute() (*Volume, error) { +// Filter resources by labels. + +func (r ApiListNetworkAreaRoutesRequest) LabelSelector(labelSelector string) ApiListNetworkAreaRoutesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Volume + localVarReturnValue *RouteListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRoutes") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if strlen(r.volumeId) < 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -8885,71 +14100,77 @@ func (r ApiGetVolumeRequest) Execute() (*Volume, error) { } /* -GetVolume: Get details about a volume. +ListNetworkAreaRoutes: List all network routes in a network area. -Get details about a block device volume. +Get a list of all network routes defined in a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiGetVolumeRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaRoutesRequest */ -func (a *APIClient) GetVolume(ctx context.Context, projectId string, volumeId string) ApiGetVolumeRequest { - return ApiGetVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRoutesRequest { + return ApiListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) GetVolumeExecute(ctx context.Context, projectId string, volumeId string) (*Volume, error) { - r := ApiGetVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { + r := ApiListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiGetVolumePerformanceClassRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumePerformanceClass string +type ApiListNetworkAreasRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + labelSelector *string } -func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, error) { +// Filter resources by labels. + +func (r ApiListNetworkAreasRequest) LabelSelector(labelSelector string) ApiListNetworkAreasRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumePerformanceClass + localVarReturnValue *NetworkAreaListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolumePerformanceClass") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreas") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(r.volumePerformanceClass, "volumePerformanceClass")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") - } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.volumePerformanceClass) > 63 { - return localVarReturnValue, fmt.Errorf("volumePerformanceClass must have less than 63 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -9070,57 +14291,60 @@ func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, } /* -GetVolumePerformanceClass: Get details about a volume performance class. +ListNetworkAreas: List all network areas in an organization. -Get details about a specific volume performance class. +Get a list of all visible network areas defined in an organization. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param volumePerformanceClass The name of a STACKIT Volume performance class. - @return ApiGetVolumePerformanceClassRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiListNetworkAreasRequest */ -func (a *APIClient) GetVolumePerformanceClass(ctx context.Context, projectId string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest { - return ApiGetVolumePerformanceClassRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumePerformanceClass: volumePerformanceClass, +func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { + return ApiListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, } } -func (a *APIClient) GetVolumePerformanceClassExecute(ctx context.Context, projectId string, volumePerformanceClass string) (*VolumePerformanceClass, error) { - r := ApiGetVolumePerformanceClassRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumePerformanceClass: volumePerformanceClass, +func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { + r := ApiListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, } return r.Execute() } -type ApiListAttachedVolumesRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiListNetworksRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } -func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { +// Filter resources by labels. + +func (r ApiListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachmentListResponse + localVarReturnValue *NetworkListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" 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{} @@ -9131,13 +14355,10 @@ func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") - } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") - } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -9258,65 +14479,78 @@ func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, } /* -ListAttachedVolumes: List all volume attachments of a server. +ListNetworks: List all networks inside a project. -Get a list of all volume attachments of a server. +Get a list of all networks inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiListAttachedVolumesRequest + @return ApiListNetworksRequest */ -func (a *APIClient) ListAttachedVolumes(ctx context.Context, projectId string, serverId string) ApiListAttachedVolumesRequest { - return ApiListAttachedVolumesRequest{ +func (a *APIClient) ListNetworks(ctx context.Context, projectId string) ApiListNetworksRequest { + return ApiListNetworksRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } } -func (a *APIClient) ListAttachedVolumesExecute(ctx context.Context, projectId string, serverId string) (*VolumeAttachmentListResponse, error) { - r := ApiListAttachedVolumesRequest{ +func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string) (*NetworkListResponse, error) { + r := ApiListNetworksRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } return r.Execute() } -type ApiListKeyPairsRequest struct { +type ApiListNicsRequest struct { ctx context.Context apiService *DefaultApiService + projectId string + networkId string labelSelector *string } // Filter resources by labels. -func (r ApiListKeyPairsRequest) LabelSelector(labelSelector string) ApiListKeyPairsRequest { +func (r ApiListNicsRequest) LabelSelector(labelSelector string) ApiListNicsRequest { r.labelSelector = &labelSelector return r } -func (r ApiListKeyPairsRequest) Execute() (*KeyPairListResponse, error) { +func (r ApiListNicsRequest) Execute() (*NICListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *KeyPairListResponse + localVarReturnValue *NICListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListKeyPairs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNics") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/keypairs" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } if r.labelSelector != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") @@ -9441,48 +14675,62 @@ func (r ApiListKeyPairsRequest) Execute() (*KeyPairListResponse, error) { } /* -ListKeyPairs: List all SSH keypairs for the requesting user. +ListNics: List all network interfaces inside a network. -Get a list of all SSH keypairs assigned to the requesting user. +Get a list of all network interfaces inside a network. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiListKeyPairsRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNicsRequest */ -func (a *APIClient) ListKeyPairs(ctx context.Context) ApiListKeyPairsRequest { - return ApiListKeyPairsRequest{ +func (a *APIClient) ListNics(ctx context.Context, projectId string, networkId string) ApiListNicsRequest { + return ApiListNicsRequest{ apiService: a.defaultApi, ctx: ctx, + projectId: projectId, + networkId: networkId, } } -func (a *APIClient) ListKeyPairsExecute(ctx context.Context) (*KeyPairListResponse, error) { - r := ApiListKeyPairsRequest{ +func (a *APIClient) ListNicsExecute(ctx context.Context, projectId string, networkId string) (*NICListResponse, error) { + r := ApiListNicsRequest{ apiService: a.defaultApi, ctx: ctx, + projectId: projectId, + networkId: networkId, } return r.Execute() } -type ApiListMachineTypesRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string +type ApiListProjectNICsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } -func (r ApiListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) { +// Filter resources by labels. + +func (r ApiListProjectNICsRequest) LabelSelector(labelSelector string) ApiListProjectNICsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListProjectNICsRequest) Execute() (*NICListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *MachineTypeListResponse + localVarReturnValue *NICListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListMachineTypes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListProjectNICs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/machine-types" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/nics" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -9495,6 +14743,9 @@ func (r ApiListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -9615,24 +14866,24 @@ func (r ApiListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) } /* -ListMachineTypes: List all machine types available for a project. +ListProjectNICs: List all network interfaces inside a project. -Get a list of all machine type available in a project. +Get a list of all network interfaces inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListMachineTypesRequest + @return ApiListProjectNICsRequest */ -func (a *APIClient) ListMachineTypes(ctx context.Context, projectId string) ApiListMachineTypesRequest { - return ApiListMachineTypesRequest{ +func (a *APIClient) ListProjectNICs(ctx context.Context, projectId string) ApiListProjectNICsRequest { + return ApiListProjectNICsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) ListMachineTypesExecute(ctx context.Context, projectId string) (*MachineTypeListResponse, error) { - r := ApiListMachineTypesRequest{ +func (a *APIClient) ListProjectNICsExecute(ctx context.Context, projectId string) (*NICListResponse, error) { + r := ApiListProjectNICsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -9640,46 +14891,49 @@ func (a *APIClient) ListMachineTypesExecute(ctx context.Context, projectId strin return r.Execute() } -type ApiListNetworkAreaProjectsRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiListPublicIPsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ApiListPublicIPsRequest) LabelSelector(labelSelector string) ApiListPublicIPsRequest { + r.labelSelector = &labelSelector + return r } -func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, error) { +func (r ApiListPublicIPsRequest) Execute() (*PublicIpListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectListResponse + localVarReturnValue *PublicIpListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaProjects") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -9800,72 +15054,69 @@ func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, erro } /* -ListNetworkAreaProjects: List all projects using a network area. +ListPublicIPs: List all public IPs inside a project. -Get a list of all projects using a network area. +Get a list of all public IPs inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiListNetworkAreaProjectsRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListPublicIPsRequest */ -func (a *APIClient) ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest { - return ApiListNetworkAreaProjectsRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) ListPublicIPs(ctx context.Context, projectId string) ApiListPublicIPsRequest { + return ApiListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) { - r := ApiListNetworkAreaProjectsRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string) (*PublicIpListResponse, error) { + r := ApiListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiListNetworkAreaRangesRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiListSecurityGroupRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string } -func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, error) { +func (r ApiListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkRangeListResponse + localVarReturnValue *SecurityGroupRuleListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRanges") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroupRules") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header @@ -9988,80 +15239,72 @@ func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, e } /* -ListNetworkAreaRanges: List all network ranges in a network area. +ListSecurityGroupRules: List all rules for a security group. -Get a list of all network ranges in a network area. +Get a list of all rules inside a security group. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiListNetworkAreaRangesRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiListSecurityGroupRulesRequest */ -func (a *APIClient) ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRangesRequest { - return ApiListNetworkAreaRangesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) ListSecurityGroupRules(ctx context.Context, projectId string, securityGroupId string) ApiListSecurityGroupRulesRequest { + return ApiListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { - r := ApiListNetworkAreaRangesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) ListSecurityGroupRulesExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRuleListResponse, error) { + r := ApiListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiListNetworkAreaRoutesRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - labelSelector *string +type ApiListSecurityGroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } // Filter resources by labels. -func (r ApiListNetworkAreaRoutesRequest) LabelSelector(labelSelector string) ApiListNetworkAreaRoutesRequest { +func (r ApiListSecurityGroupsRequest) LabelSelector(labelSelector string) ApiListSecurityGroupsRequest { r.labelSelector = &labelSelector return r } -func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { +func (r ApiListSecurityGroupsRequest) Execute() (*SecurityGroupListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RouteListResponse + localVarReturnValue *SecurityGroupListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRoutes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroups") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if r.labelSelector != nil { @@ -10187,77 +15430,71 @@ func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { } /* -ListNetworkAreaRoutes: List all network routes in a network area. +ListSecurityGroups: List all security groups inside a project. -Get a list of all network routes defined in a network area. +Get a list of all security groups inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiListNetworkAreaRoutesRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListSecurityGroupsRequest */ -func (a *APIClient) ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRoutesRequest { - return ApiListNetworkAreaRoutesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) ListSecurityGroups(ctx context.Context, projectId string) ApiListSecurityGroupsRequest { + return ApiListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { - r := ApiListNetworkAreaRoutesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId string) (*SecurityGroupListResponse, error) { + r := ApiListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiListNetworkAreasRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - labelSelector *string -} - -// Filter resources by labels. - -func (r ApiListNetworkAreasRequest) LabelSelector(labelSelector string) ApiListNetworkAreasRequest { - r.labelSelector = &labelSelector - return r +type ApiListServerNicsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) { +func (r ApiListServerNicsRequest) Execute() (*NICListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkAreaListResponse + localVarReturnValue *NICListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreas") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNics") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics" + 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{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -10378,60 +15615,57 @@ func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) } /* -ListNetworkAreas: List all network areas in an organization. +ListServerNics: Get all network interfaces. -Get a list of all visible network areas defined in an organization. +Get all network interfaces attached to the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @return ApiListNetworkAreasRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerNicsRequest */ -func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { - return ApiListNetworkAreasRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) ListServerNics(ctx context.Context, projectId string, serverId string) ApiListServerNicsRequest { + return ApiListServerNicsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { - r := ApiListNetworkAreasRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) ListServerNicsExecute(ctx context.Context, projectId string, serverId string) (*NICListResponse, error) { + r := ApiListServerNicsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiListNetworksRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - labelSelector *string -} - -// Filter resources by labels. - -func (r ApiListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { - r.labelSelector = &labelSelector - return r +type ApiListServerServiceAccountsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { +func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkListResponse + localVarReturnValue *ServiceAccountMailListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerServiceAccounts") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts" 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{} @@ -10442,10 +15676,13 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -10566,62 +15803,71 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { } /* -ListNetworks: List all networks inside a project. +ListServerServiceAccounts: List all service accounts of the Server. -Get a list of all networks inside a project. +Get the list of the service accounts of the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListNetworksRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerServiceAccountsRequest */ -func (a *APIClient) ListNetworks(ctx context.Context, projectId string) ApiListNetworksRequest { - return ApiListNetworksRequest{ +func (a *APIClient) ListServerServiceAccounts(ctx context.Context, projectId string, serverId string) ApiListServerServiceAccountsRequest { + return ApiListServerServiceAccountsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, } } -func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string) (*NetworkListResponse, error) { - r := ApiListNetworksRequest{ +func (a *APIClient) ListServerServiceAccountsExecute(ctx context.Context, projectId string, serverId string) (*ServiceAccountMailListResponse, error) { + r := ApiListServerServiceAccountsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiListNicsRequest struct { +type ApiListServersRequest struct { ctx context.Context apiService *DefaultApiService projectId string - networkId string + details *bool labelSelector *string } +// Show detailed information about server. + +func (r ApiListServersRequest) Details(details bool) ApiListServersRequest { + r.details = &details + return r +} + // Filter resources by labels. -func (r ApiListNicsRequest) LabelSelector(labelSelector string) ApiListNicsRequest { +func (r ApiListServersRequest) LabelSelector(labelSelector string) ApiListServersRequest { r.labelSelector = &labelSelector return r } -func (r ApiListNicsRequest) Execute() (*NICListResponse, error) { +func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NICListResponse + localVarReturnValue *ServerListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNics") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -10632,13 +15878,10 @@ func (r ApiListNicsRequest) Execute() (*NICListResponse, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") - } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") - } + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } if r.labelSelector != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") } @@ -10762,35 +16005,32 @@ func (r ApiListNicsRequest) Execute() (*NICListResponse, error) { } /* -ListNics: List all network interfaces inside a network. +ListServers: List all servers inside a project. -Get a list of all network interfaces inside a network. +Get a list of all servers inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiListNicsRequest + @return ApiListServersRequest */ -func (a *APIClient) ListNics(ctx context.Context, projectId string, networkId string) ApiListNicsRequest { - return ApiListNicsRequest{ +func (a *APIClient) ListServers(ctx context.Context, projectId string) ApiListServersRequest { + return ApiListServersRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, } } -func (a *APIClient) ListNicsExecute(ctx context.Context, projectId string, networkId string) (*NICListResponse, error) { - r := ApiListNicsRequest{ +func (a *APIClient) ListServersExecute(ctx context.Context, projectId string) (*ServerListResponse, error) { + r := ApiListServersRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, } return r.Execute() } -type ApiListPublicIPsRequest struct { +type ApiListSnapshotsRequest struct { ctx context.Context apiService *DefaultApiService projectId string @@ -10799,25 +16039,25 @@ type ApiListPublicIPsRequest struct { // Filter resources by labels. -func (r ApiListPublicIPsRequest) LabelSelector(labelSelector string) ApiListPublicIPsRequest { +func (r ApiListSnapshotsRequest) LabelSelector(labelSelector string) ApiListSnapshotsRequest { r.labelSelector = &labelSelector return r } -func (r ApiListPublicIPsRequest) Execute() (*PublicIpListResponse, error) { +func (r ApiListSnapshotsRequest) Execute() (*SnapshotListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PublicIpListResponse + localVarReturnValue *SnapshotListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSnapshots") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/snapshots" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -10953,24 +16193,24 @@ func (r ApiListPublicIPsRequest) Execute() (*PublicIpListResponse, error) { } /* -ListPublicIPs: List all public IPs inside a project. +ListSnapshots: List all snapshots inside a project. -Get a list of all public IPs inside a project. +Get a list of all snapshots inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListPublicIPsRequest + @return ApiListSnapshotsRequest */ -func (a *APIClient) ListPublicIPs(ctx context.Context, projectId string) ApiListPublicIPsRequest { - return ApiListPublicIPsRequest{ +func (a *APIClient) ListSnapshots(ctx context.Context, projectId string) ApiListSnapshotsRequest { + return ApiListSnapshotsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string) (*PublicIpListResponse, error) { - r := ApiListPublicIPsRequest{ +func (a *APIClient) ListSnapshotsExecute(ctx context.Context, projectId string) (*SnapshotListResponse, error) { + r := ApiListSnapshotsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -10978,29 +16218,35 @@ func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string) return r.Execute() } -type ApiListSecurityGroupRulesRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string +type ApiListVolumePerformanceClassesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } -func (r ApiListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListResponse, error) { +// Filter resources by labels. + +func (r ApiListVolumePerformanceClassesRequest) LabelSelector(labelSelector string) ApiListVolumePerformanceClassesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceClassListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroupRuleListResponse + localVarReturnValue *VolumePerformanceClassListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroupRules") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumePerformanceClasses") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volume-performance-classes" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -11011,13 +16257,10 @@ func (r ApiListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListRespo if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") - } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") - } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -11138,35 +16381,32 @@ func (r ApiListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListRespo } /* -ListSecurityGroupRules: List all rules for a security group. +ListVolumePerformanceClasses: List all volume performance classes available for a project. -Get a list of all rules inside a security group. +Get a list of all volume performance classes available inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiListSecurityGroupRulesRequest + @return ApiListVolumePerformanceClassesRequest */ -func (a *APIClient) ListSecurityGroupRules(ctx context.Context, projectId string, securityGroupId string) ApiListSecurityGroupRulesRequest { - return ApiListSecurityGroupRulesRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) ListVolumePerformanceClasses(ctx context.Context, projectId string) ApiListVolumePerformanceClassesRequest { + return ApiListVolumePerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) ListSecurityGroupRulesExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRuleListResponse, error) { - r := ApiListSecurityGroupRulesRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) ListVolumePerformanceClassesExecute(ctx context.Context, projectId string) (*VolumePerformanceClassListResponse, error) { + r := ApiListVolumePerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiListSecurityGroupsRequest struct { +type ApiListVolumesRequest struct { ctx context.Context apiService *DefaultApiService projectId string @@ -11175,25 +16415,25 @@ type ApiListSecurityGroupsRequest struct { // Filter resources by labels. -func (r ApiListSecurityGroupsRequest) LabelSelector(labelSelector string) ApiListSecurityGroupsRequest { +func (r ApiListVolumesRequest) LabelSelector(labelSelector string) ApiListVolumesRequest { r.labelSelector = &labelSelector return r } -func (r ApiListSecurityGroupsRequest) Execute() (*SecurityGroupListResponse, error) { +func (r ApiListVolumesRequest) Execute() (*VolumeListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroupListResponse + localVarReturnValue *VolumeListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroups") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumes") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -11329,24 +16569,24 @@ func (r ApiListSecurityGroupsRequest) Execute() (*SecurityGroupListResponse, err } /* -ListSecurityGroups: List all security groups inside a project. +ListVolumes: List all volumes inside a project. -Get a list of all security groups inside a project. +Get a list of all volumes inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListSecurityGroupsRequest + @return ApiListVolumesRequest */ -func (a *APIClient) ListSecurityGroups(ctx context.Context, projectId string) ApiListSecurityGroupsRequest { - return ApiListSecurityGroupsRequest{ +func (a *APIClient) ListVolumes(ctx context.Context, projectId string) ApiListVolumesRequest { + return ApiListVolumesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId string) (*SecurityGroupListResponse, error) { - r := ApiListSecurityGroupsRequest{ +func (a *APIClient) ListVolumesExecute(ctx context.Context, projectId string) (*VolumeListResponse, error) { + r := ApiListVolumesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -11354,48 +16594,58 @@ func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId str return r.Execute() } -type ApiListServerNicsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiPartialUpdateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + partialUpdateNetworkPayload *PartialUpdateNetworkPayload } -func (r ApiListServerNicsRequest) Execute() (*NICListResponse, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *NICListResponse +// Request an update of a network. + +func (r ApiPartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { + r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload + return r +} + +func (r ApiPartialUpdateNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNics") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" 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, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if r.partialUpdateNetworkPayload == nil { + return fmt.Errorf("partialUpdateNetworkPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -11411,9 +16661,11 @@ func (r ApiListServerNicsRequest) Execute() (*NICListResponse, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.partialUpdateNetworkPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -11427,14 +16679,14 @@ func (r ApiListServerNicsRequest) Execute() (*NICListResponse, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -11448,142 +16700,143 @@ func (r ApiListServerNicsRequest) Execute() (*NICListResponse, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -ListServerNics: Get all network interfaces. +PartialUpdateNetwork: Update network settings. -Get all network interfaces attached to the server. +Update the settings of a network inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiListServerNicsRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest */ -func (a *APIClient) ListServerNics(ctx context.Context, projectId string, serverId string) ApiListServerNicsRequest { - return ApiListServerNicsRequest{ +func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, networkId string) ApiPartialUpdateNetworkRequest { + return ApiPartialUpdateNetworkRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + networkId: networkId, } } -func (a *APIClient) ListServerNicsExecute(ctx context.Context, projectId string, serverId string) (*NICListResponse, error) { - r := ApiListServerNicsRequest{ +func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, networkId string) error { + r := ApiPartialUpdateNetworkRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + networkId: networkId, } return r.Execute() } -type ApiListServerServiceAccountsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiPartialUpdateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + partialUpdateNetworkAreaPayload *PartialUpdateNetworkAreaPayload } -func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListResponse, error) { +// Request to update an Area. + +func (r ApiPartialUpdateNetworkAreaRequest) PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest { + r.partialUpdateNetworkAreaPayload = &partialUpdateNetworkAreaPayload + return r +} + +func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ServiceAccountMailListResponse + localVarReturnValue *NetworkArea ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerServiceAccounts") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetworkArea") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts" - 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 := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.partialUpdateNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("partialUpdateNetworkAreaPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -11599,6 +16852,8 @@ func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListR if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.partialUpdateNetworkAreaPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -11702,87 +16957,83 @@ func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListR } /* -ListServerServiceAccounts: List all service accounts of the Server. +PartialUpdateNetworkArea: Update network area settings. -Get the list of the service accounts of the server. +Update the settings of a network area in an organization. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiListServerServiceAccountsRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiPartialUpdateNetworkAreaRequest */ -func (a *APIClient) ListServerServiceAccounts(ctx context.Context, projectId string, serverId string) ApiListServerServiceAccountsRequest { - return ApiListServerServiceAccountsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest { + return ApiPartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) ListServerServiceAccountsExecute(ctx context.Context, projectId string, serverId string) (*ServiceAccountMailListResponse, error) { - r := ApiListServerServiceAccountsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := ApiPartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiListServersRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - details *bool - labelSelector *string -} - -// Show detailed information about server. - -func (r ApiListServersRequest) Details(details bool) ApiListServersRequest { - r.details = &details - return r +type ApiRebootServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + action *string } -// Filter resources by labels. +// Defines if it is a soft or a hard reboot. -func (r ApiListServersRequest) LabelSelector(labelSelector string) ApiListServersRequest { - r.labelSelector = &labelSelector +func (r ApiRebootServerRequest) Action(action string) ApiRebootServerRequest { + r.action = &action return r } -func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { +func (r ApiRebootServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ServerListResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RebootServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/reboot" 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{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - - if r.details != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + if r.action != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "action", r.action, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -11803,7 +17054,7 @@ func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -11817,14 +17068,14 @@ func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -11838,140 +17089,148 @@ func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 401 { + if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 403 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -ListServers: List all servers inside a project. +RebootServer: Reboot the server. -Get a list of all servers inside a project. +Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListServersRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRebootServerRequest */ -func (a *APIClient) ListServers(ctx context.Context, projectId string) ApiListServersRequest { - return ApiListServersRequest{ +func (a *APIClient) RebootServer(ctx context.Context, projectId string, serverId string) ApiRebootServerRequest { + return ApiRebootServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, } } -func (a *APIClient) ListServersExecute(ctx context.Context, projectId string) (*ServerListResponse, error) { - r := ApiListServersRequest{ +func (a *APIClient) RebootServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiRebootServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiListVolumePerformanceClassesRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - labelSelector *string -} - -// Filter resources by labels. - -func (r ApiListVolumePerformanceClassesRequest) LabelSelector(labelSelector string) ApiListVolumePerformanceClassesRequest { - r.labelSelector = &labelSelector - return r +type ApiRemoveNetworkFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + networkId string } -func (r ApiListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceClassListResponse, error) { +func (r ApiRemoveNetworkFromServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *VolumePerformanceClassListResponse + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumePerformanceClasses") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNetworkFromServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volume-performance-classes" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" 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, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -11991,7 +17250,7 @@ func (r ApiListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceCla } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -12005,14 +17264,14 @@ func (r ApiListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceCla *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -12026,140 +17285,140 @@ func (r ApiListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceCla err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -ListVolumePerformanceClasses: List all volume performance classes available for a project. +RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. -Get a list of all volume performance classes available inside a project. +Detach and delete all network interfaces associated with the specified network from the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListVolumePerformanceClassesRequest + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest */ -func (a *APIClient) ListVolumePerformanceClasses(ctx context.Context, projectId string) ApiListVolumePerformanceClassesRequest { - return ApiListVolumePerformanceClassesRequest{ +func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { + return ApiRemoveNetworkFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, + networkId: networkId, } } -func (a *APIClient) ListVolumePerformanceClassesExecute(ctx context.Context, projectId string) (*VolumePerformanceClassListResponse, error) { - r := ApiListVolumePerformanceClassesRequest{ +func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, serverId string, networkId string) error { + r := ApiRemoveNetworkFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, + networkId: networkId, } return r.Execute() } -type ApiListVolumesRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - labelSelector *string -} - -// Filter resources by labels. - -func (r ApiListVolumesRequest) LabelSelector(labelSelector string) ApiListVolumesRequest { - r.labelSelector = &labelSelector - return r +type ApiRemoveNicFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + nicId string } -func (r ApiListVolumesRequest) Execute() (*VolumeListResponse, error) { +func (r ApiRemoveNicFromServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *VolumeListResponse + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNicFromServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" 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, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -12179,7 +17438,7 @@ func (r ApiListVolumesRequest) Execute() (*VolumeListResponse, error) { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -12193,14 +17452,14 @@ func (r ApiListVolumesRequest) Execute() (*VolumeListResponse, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -12214,127 +17473,117 @@ func (r ApiListVolumesRequest) Execute() (*VolumeListResponse, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error 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 - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -ListVolumes: List all volumes inside a project. +RemoveNicFromServer: Detach a network interface. -Get a list of all volumes inside a project. +Detach a network interface from a server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListVolumesRequest + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiRemoveNicFromServerRequest */ -func (a *APIClient) ListVolumes(ctx context.Context, projectId string) ApiListVolumesRequest { - return ApiListVolumesRequest{ +func (a *APIClient) RemoveNicFromServer(ctx context.Context, projectId string, serverId string, nicId string) ApiRemoveNicFromServerRequest { + return ApiRemoveNicFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, + nicId: nicId, } } -func (a *APIClient) ListVolumesExecute(ctx context.Context, projectId string) (*VolumeListResponse, error) { - r := ApiListVolumesRequest{ +func (a *APIClient) RemoveNicFromServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { + r := ApiRemoveNicFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + serverId: serverId, + nicId: nicId, } return r.Execute() } -type ApiPartialUpdateNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - partialUpdateNetworkPayload *PartialUpdateNetworkPayload -} - -// Request an update of a network. - -func (r ApiPartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { - r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload - return r +type ApiRemovePublicIpFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + publicIpId string } -func (r ApiPartialUpdateNetworkRequest) Execute() error { +func (r ApiRemovePublicIpFromServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPatch + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemovePublicIpFromServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -12345,18 +17594,21 @@ func (r ApiPartialUpdateNetworkRequest) Execute() error { if strlen(r.projectId) > 36 { return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } - if r.partialUpdateNetworkPayload == nil { - return fmt.Errorf("partialUpdateNetworkPayload is required and must be specified") + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -12372,8 +17624,6 @@ func (r ApiPartialUpdateNetworkRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.partialUpdateNetworkPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -12450,6 +17700,17 @@ func (r ApiPartialUpdateNetworkRequest) Execute() error { newErr.Model = v return newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -12467,87 +17728,86 @@ func (r ApiPartialUpdateNetworkRequest) Execute() error { } /* -PartialUpdateNetwork: Update network settings. +RemovePublicIpFromServer: Dissociate a public IP from a server. -Update the settings of a network inside a project. +Dissociate a public IP on an existing server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiPartialUpdateNetworkRequest + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiRemovePublicIpFromServerRequest */ -func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, networkId string) ApiPartialUpdateNetworkRequest { - return ApiPartialUpdateNetworkRequest{ +func (a *APIClient) RemovePublicIpFromServer(ctx context.Context, projectId string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest { + return ApiRemovePublicIpFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, + serverId: serverId, + publicIpId: publicIpId, } } -func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, networkId string) error { - r := ApiPartialUpdateNetworkRequest{ +func (a *APIClient) RemovePublicIpFromServerExecute(ctx context.Context, projectId string, serverId string, publicIpId string) error { + r := ApiRemovePublicIpFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, + serverId: serverId, + publicIpId: publicIpId, } return r.Execute() } -type ApiPartialUpdateNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - partialUpdateNetworkAreaPayload *PartialUpdateNetworkAreaPayload -} - -// Request to update an Area. - -func (r ApiPartialUpdateNetworkAreaRequest) PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest { - r.partialUpdateNetworkAreaPayload = &partialUpdateNetworkAreaPayload - return r +type ApiRemoveSecurityGroupFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + securityGroupId string } -func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { +func (r ApiRemoveSecurityGroupFromServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *NetworkArea + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveSecurityGroupFromServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + 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, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } - if r.partialUpdateNetworkAreaPayload == nil { - return localVarReturnValue, fmt.Errorf("partialUpdateNetworkAreaPayload is required and must be specified") + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -12563,11 +17823,9 @@ func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.partialUpdateNetworkAreaPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -12581,14 +17839,14 @@ func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -12602,150 +17860,149 @@ func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 500 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return newErr } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -PartialUpdateNetworkArea: Update network area settings. +RemoveSecurityGroupFromServer: Remove a server from a security group. -Update the settings of a network area in an organization. +Remove a server from a attached security group. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiPartialUpdateNetworkAreaRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiRemoveSecurityGroupFromServerRequest */ -func (a *APIClient) PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest { - return ApiPartialUpdateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) RemoveSecurityGroupFromServer(ctx context.Context, projectId string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest { + return ApiRemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + securityGroupId: securityGroupId, } } -func (a *APIClient) PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { - r := ApiPartialUpdateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, serverId string, securityGroupId string) error { + r := ApiRemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiRebootServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - action *string -} - -// Defines if it is a soft or a hard reboot. - -func (r ApiRebootServerRequest) Action(action string) ApiRebootServerRequest { - r.action = &action - return r +type ApiRemoveServiceAccountFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + serviceAccountMail string } -func (r ApiRebootServerRequest) Execute() error { +func (r ApiRemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMailListResponse, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RebootServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveServiceAccountFromServer") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/reboot" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" 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, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } - - if r.action != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "action", r.action, "") + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") } + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -12765,7 +18022,7 @@ func (r ApiRebootServerRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -12779,14 +18036,14 @@ func (r ApiRebootServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -12800,125 +18057,138 @@ func (r ApiRebootServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -RebootServer: Reboot the server. +RemoveServiceAccountFromServer: Detach a service account from a server. -Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. +Detach an additional service account from the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiRebootServerRequest + @param serviceAccountMail The e-mail address of a service account. + @return ApiRemoveServiceAccountFromServerRequest */ -func (a *APIClient) RebootServer(ctx context.Context, projectId string, serverId string) ApiRebootServerRequest { - return ApiRebootServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) RemoveServiceAccountFromServer(ctx context.Context, projectId string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest { + return ApiRemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + serviceAccountMail: serviceAccountMail, } } -func (a *APIClient) RebootServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiRebootServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := ApiRemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + serviceAccountMail: serviceAccountMail, } return r.Execute() } -type ApiRemoveNetworkFromServerRequest struct { +type ApiRemoveVolumeFromServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string serverId string - networkId string + volumeId string } -func (r ApiRemoveNetworkFromServerRequest) Execute() error { +func (r ApiRemoveVolumeFromServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNetworkFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveVolumeFromServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" 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, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -12935,11 +18205,11 @@ func (r ApiRemoveNetworkFromServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") } // to determine the Content-Type header @@ -13035,6 +18305,17 @@ func (r ApiRemoveNetworkFromServerRequest) Execute() error { newErr.Model = v return newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -13052,61 +18333,67 @@ func (r ApiRemoveNetworkFromServerRequest) Execute() error { } /* -RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. +RemoveVolumeFromServer: Detach a volume from a server. -Detach and delete all network interfaces associated with the specified network from the server. +Detach an existing volume from an existing server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiRemoveNetworkFromServerRequest + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiRemoveVolumeFromServerRequest */ -func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { - return ApiRemoveNetworkFromServerRequest{ +func (a *APIClient) RemoveVolumeFromServer(ctx context.Context, projectId string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest { + return ApiRemoveVolumeFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - networkId: networkId, + volumeId: volumeId, } } -func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, serverId string, networkId string) error { - r := ApiRemoveNetworkFromServerRequest{ +func (a *APIClient) RemoveVolumeFromServerExecute(ctx context.Context, projectId string, serverId string, volumeId string) error { + r := ApiRemoveVolumeFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - networkId: networkId, + volumeId: volumeId, } return r.Execute() } -type ApiRemoveNicFromServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - nicId string +type ApiRescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + rescueServerPayload *RescueServerPayload } -func (r ApiRemoveNicFromServerRequest) Execute() error { +// Request a server rescue. + +func (r ApiRescueServerRequest) RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest { + r.rescueServerPayload = &rescueServerPayload + return r +} + +func (r ApiRescueServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodDelete + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNicFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RescueServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/rescue" 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, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -13123,15 +18410,12 @@ func (r ApiRemoveNicFromServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.nicId) < 36 { - return fmt.Errorf("nicId must have at least 36 elements") - } - if strlen(r.nicId) > 36 { - return fmt.Errorf("nicId must have less than 36 elements") + if r.rescueServerPayload == nil { + return fmt.Errorf("rescueServerPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -13147,6 +18431,8 @@ func (r ApiRemoveNicFromServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.rescueServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -13223,6 +18509,17 @@ func (r ApiRemoveNicFromServerRequest) Execute() error { newErr.Model = v return newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + 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 + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -13240,61 +18537,64 @@ func (r ApiRemoveNicFromServerRequest) Execute() error { } /* -RemoveNicFromServer: Detach a network interface. +RescueServer: Rescue an existing server. -Detach a network interface from a server. +Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @param nicId The identifier (ID) of a network interface. - @return ApiRemoveNicFromServerRequest + @return ApiRescueServerRequest */ -func (a *APIClient) RemoveNicFromServer(ctx context.Context, projectId string, serverId string, nicId string) ApiRemoveNicFromServerRequest { - return ApiRemoveNicFromServerRequest{ +func (a *APIClient) RescueServer(ctx context.Context, projectId string, serverId string) ApiRescueServerRequest { + return ApiRescueServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - nicId: nicId, } } -func (a *APIClient) RemoveNicFromServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { - r := ApiRemoveNicFromServerRequest{ +func (a *APIClient) RescueServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiRescueServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - nicId: nicId, } return r.Execute() } -type ApiRemovePublicIpFromServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - publicIpId string +type ApiResizeServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + resizeServerPayload *ResizeServerPayload +} + +// Request a resize of a server. + +func (r ApiResizeServerRequest) ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest { + r.resizeServerPayload = &resizeServerPayload + return r } -func (r ApiRemovePublicIpFromServerRequest) Execute() error { +func (r ApiResizeServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodDelete + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemovePublicIpFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/resize" 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, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -13311,15 +18611,12 @@ func (r ApiRemovePublicIpFromServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.publicIpId) < 36 { - return fmt.Errorf("publicIpId must have at least 36 elements") - } - if strlen(r.publicIpId) > 36 { - return fmt.Errorf("publicIpId must have less than 36 elements") + if r.resizeServerPayload == nil { + return fmt.Errorf("resizeServerPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -13335,6 +18632,8 @@ func (r ApiRemovePublicIpFromServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.resizeServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -13439,61 +18738,64 @@ func (r ApiRemovePublicIpFromServerRequest) Execute() error { } /* -RemovePublicIpFromServer: Dissociate a public IP from a server. +ResizeServer: Resize a server. -Dissociate a public IP on an existing server. +Resize the server to the given machine type. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiRemovePublicIpFromServerRequest + @return ApiResizeServerRequest */ -func (a *APIClient) RemovePublicIpFromServer(ctx context.Context, projectId string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest { - return ApiRemovePublicIpFromServerRequest{ +func (a *APIClient) ResizeServer(ctx context.Context, projectId string, serverId string) ApiResizeServerRequest { + return ApiResizeServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - publicIpId: publicIpId, } } -func (a *APIClient) RemovePublicIpFromServerExecute(ctx context.Context, projectId string, serverId string, publicIpId string) error { - r := ApiRemovePublicIpFromServerRequest{ +func (a *APIClient) ResizeServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiResizeServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - publicIpId: publicIpId, } return r.Execute() } -type ApiRemoveSecurityGroupFromServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - securityGroupId string +type ApiResizeVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string + resizeVolumePayload *ResizeVolumePayload } -func (r ApiRemoveSecurityGroupFromServerRequest) Execute() error { +// Request a volume resize. + +func (r ApiResizeVolumeRequest) ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest { + r.resizeVolumePayload = &resizeVolumePayload + return r +} + +func (r ApiResizeVolumeRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodDelete + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveSecurityGroupFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeVolume") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}/resize" 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, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -13504,21 +18806,15 @@ func (r ApiRemoveSecurityGroupFromServerRequest) Execute() error { if strlen(r.projectId) > 36 { return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") - } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") - } - if strlen(r.securityGroupId) < 36 { - return fmt.Errorf("securityGroupId must have at least 36 elements") + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId must have less than 36 elements") + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -13534,6 +18830,8 @@ func (r ApiRemoveSecurityGroupFromServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.resizeVolumePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -13638,80 +18936,71 @@ func (r ApiRemoveSecurityGroupFromServerRequest) Execute() error { } /* -RemoveSecurityGroupFromServer: Remove a server from a security group. +ResizeVolume: Update the size of a volume. -Remove a server from a attached security group. +Update the size of a block device volume. The new volume size must be larger than the current size. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiRemoveSecurityGroupFromServerRequest + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest */ -func (a *APIClient) RemoveSecurityGroupFromServer(ctx context.Context, projectId string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest { - return ApiRemoveSecurityGroupFromServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - securityGroupId: securityGroupId, +func (a *APIClient) ResizeVolume(ctx context.Context, projectId string, volumeId string) ApiResizeVolumeRequest { + return ApiResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } } -func (a *APIClient) RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, serverId string, securityGroupId string) error { - r := ApiRemoveSecurityGroupFromServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - securityGroupId: securityGroupId, +func (a *APIClient) ResizeVolumeExecute(ctx context.Context, projectId string, volumeId string) error { + r := ApiResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } return r.Execute() } -type ApiRemoveServiceAccountFromServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - serviceAccountMail string +type ApiRestoreBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + backupId string } -func (r ApiRemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMailListResponse, error) { +func (r ApiRestoreBackupRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ServiceAccountMailListResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveServiceAccountFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RestoreBackup") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.backupId) < 36 { + return fmt.Errorf("backupId must have at least 36 elements") } - if strlen(r.serviceAccountMail) > 255 { - return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") + if strlen(r.backupId) > 36 { + return fmt.Errorf("backupId must have less than 36 elements") } // to determine the Content-Type header @@ -13733,7 +19022,7 @@ func (r ApiRemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMail } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -13747,14 +19036,14 @@ func (r ApiRemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMail *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -13768,163 +19057,143 @@ func (r ApiRemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMail err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -RemoveServiceAccountFromServer: Detach a service account from a server. +RestoreBackup: Restore Backup to the referenced source Volume. -Detach an additional service account from the server. +Restores a Backup to the existing Volume it references to. The use of this endpoint is disruptive as the volume needs to be detached. If a new volume is to be created use the volumes endpoint with the option to create from backup. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param serviceAccountMail The e-mail address of a service account. - @return ApiRemoveServiceAccountFromServerRequest + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiRestoreBackupRequest */ -func (a *APIClient) RemoveServiceAccountFromServer(ctx context.Context, projectId string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest { - return ApiRemoveServiceAccountFromServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - serviceAccountMail: serviceAccountMail, +func (a *APIClient) RestoreBackup(ctx context.Context, projectId string, backupId string) ApiRestoreBackupRequest { + return ApiRestoreBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + backupId: backupId, } } -func (a *APIClient) RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { - r := ApiRemoveServiceAccountFromServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - serviceAccountMail: serviceAccountMail, +func (a *APIClient) RestoreBackupExecute(ctx context.Context, projectId string, backupId string) error { + r := ApiRestoreBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + backupId: backupId, } return r.Execute() } -type ApiRemoveVolumeFromServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - volumeId string +type ApiSetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + setImageSharePayload *SetImageSharePayload } -func (r ApiRemoveVolumeFromServerRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile +// Settings for an Image Share. + +func (r ApiSetImageShareRequest) SetImageSharePayload(setImageSharePayload SetImageSharePayload) ApiSetImageShareRequest { + r.setImageSharePayload = &setImageSharePayload + return r +} + +func (r ApiSetImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveVolumeFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.SetImageShare") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}/share" 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, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.volumeId) < 36 { - return fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") } - if strlen(r.volumeId) > 36 { - return fmt.Errorf("volumeId must have less than 36 elements") + if r.setImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("setImageSharePayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -13940,9 +19209,11 @@ func (r ApiRemoveVolumeFromServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.setImageSharePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -13956,14 +19227,14 @@ func (r ApiRemoveVolumeFromServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -13977,132 +19248,120 @@ func (r ApiRemoveVolumeFromServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -RemoveVolumeFromServer: Detach a volume from a server. +SetImageShare: Set image share. -Detach an existing volume from an existing server. +Set share of an Image. New Options will replace existing settings. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiRemoveVolumeFromServerRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiSetImageShareRequest */ -func (a *APIClient) RemoveVolumeFromServer(ctx context.Context, projectId string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest { - return ApiRemoveVolumeFromServerRequest{ +func (a *APIClient) SetImageShare(ctx context.Context, projectId string, imageId string) ApiSetImageShareRequest { + return ApiSetImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } } -func (a *APIClient) RemoveVolumeFromServerExecute(ctx context.Context, projectId string, serverId string, volumeId string) error { - r := ApiRemoveVolumeFromServerRequest{ +func (a *APIClient) SetImageShareExecute(ctx context.Context, projectId string, imageId string) (*ImageShare, error) { + r := ApiSetImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } return r.Execute() } -type ApiRescueServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - rescueServerPayload *RescueServerPayload -} - -// Request a server rescue. - -func (r ApiRescueServerRequest) RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest { - r.rescueServerPayload = &rescueServerPayload - return r +type ApiStartServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiRescueServerRequest) Execute() error { +func (r ApiStartServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RescueServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StartServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/rescue" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/start" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) @@ -14121,12 +19380,9 @@ func (r ApiRescueServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if r.rescueServerPayload == nil { - return fmt.Errorf("rescueServerPayload is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -14142,8 +19398,6 @@ func (r ApiRescueServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.rescueServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -14248,17 +19502,17 @@ func (r ApiRescueServerRequest) Execute() error { } /* -RescueServer: Rescue an existing server. +StartServer: Boot up a server. -Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. +Start an existing server or allocates the server if deallocated. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiRescueServerRequest + @return ApiStartServerRequest */ -func (a *APIClient) RescueServer(ctx context.Context, projectId string, serverId string) ApiRescueServerRequest { - return ApiRescueServerRequest{ +func (a *APIClient) StartServer(ctx context.Context, projectId string, serverId string) ApiStartServerRequest { + return ApiStartServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -14266,8 +19520,8 @@ func (a *APIClient) RescueServer(ctx context.Context, projectId string, serverId } } -func (a *APIClient) RescueServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiRescueServerRequest{ +func (a *APIClient) StartServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiStartServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -14276,34 +19530,26 @@ func (a *APIClient) RescueServerExecute(ctx context.Context, projectId string, s return r.Execute() } -type ApiResizeServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - resizeServerPayload *ResizeServerPayload -} - -// Request a resize of a server. - -func (r ApiResizeServerRequest) ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest { - r.resizeServerPayload = &resizeServerPayload - return r +type ApiStopServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiResizeServerRequest) Execute() error { +func (r ApiStopServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StopServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/resize" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/stop" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) @@ -14322,12 +19568,9 @@ func (r ApiResizeServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if r.resizeServerPayload == nil { - return fmt.Errorf("resizeServerPayload is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -14343,8 +19586,6 @@ func (r ApiResizeServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.resizeServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -14449,17 +19690,17 @@ func (r ApiResizeServerRequest) Execute() error { } /* -ResizeServer: Resize a server. +StopServer: Stop an existing server. -Resize the server to the given machine type. +Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiResizeServerRequest + @return ApiStopServerRequest */ -func (a *APIClient) ResizeServer(ctx context.Context, projectId string, serverId string) ApiResizeServerRequest { - return ApiResizeServerRequest{ +func (a *APIClient) StopServer(ctx context.Context, projectId string, serverId string) ApiStopServerRequest { + return ApiStopServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -14467,8 +19708,8 @@ func (a *APIClient) ResizeServer(ctx context.Context, projectId string, serverId } } -func (a *APIClient) ResizeServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiResizeServerRequest{ +func (a *APIClient) StopServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiStopServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -14477,36 +19718,28 @@ func (a *APIClient) ResizeServerExecute(ctx context.Context, projectId string, s return r.Execute() } -type ApiResizeVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumeId string - resizeVolumePayload *ResizeVolumePayload -} - -// Request a volume resize. - -func (r ApiResizeVolumeRequest) ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest { - r.resizeVolumePayload = &resizeVolumePayload - return r +type ApiUnrescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiResizeVolumeRequest) Execute() error { +func (r ApiUnrescueServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UnrescueServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}/resize" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/unrescue" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -14517,15 +19750,15 @@ func (r ApiResizeVolumeRequest) Execute() error { if strlen(r.projectId) > 36 { return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.volumeId) < 36 { - return fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -14541,8 +19774,6 @@ func (r ApiResizeVolumeRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.resizeVolumePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return err @@ -14647,75 +19878,95 @@ func (r ApiResizeVolumeRequest) Execute() error { } /* -ResizeVolume: Update the size of a volume. +UnrescueServer: Unrescue an existing server. -Update the size of a block device volume. The new volume size must be larger than the current size. +Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiResizeVolumeRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest */ -func (a *APIClient) ResizeVolume(ctx context.Context, projectId string, volumeId string) ApiResizeVolumeRequest { - return ApiResizeVolumeRequest{ +func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, serverId string) ApiUnrescueServerRequest { + return ApiUnrescueServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - volumeId: volumeId, + serverId: serverId, } } -func (a *APIClient) ResizeVolumeExecute(ctx context.Context, projectId string, volumeId string) error { - r := ApiResizeVolumeRequest{ +func (a *APIClient) UnrescueServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiUnrescueServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - volumeId: volumeId, + serverId: serverId, } return r.Execute() } -type ApiStartServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiUpdateAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string + updateAttachedVolumePayload *UpdateAttachedVolumePayload +} + +// Request a volume attachment update. + +func (r ApiUpdateAttachedVolumeRequest) UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest { + r.updateAttachedVolumePayload = &updateAttachedVolumePayload + return r } -func (r ApiStartServerRequest) Execute() error { +func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StartServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/start" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" 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, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + if r.updateAttachedVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateAttachedVolumePayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -14731,9 +19982,11 @@ func (r ApiStartServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateAttachedVolumePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -14747,14 +20000,14 @@ func (r ApiStartServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -14768,142 +20021,156 @@ func (r ApiStartServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -StartServer: Boot up a server. +UpdateAttachedVolume: Update Volume Attachment Parameters. -Start an existing server or allocates the server if deallocated. +Update the properties of an existing Volume Attachment. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiStartServerRequest + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest */ -func (a *APIClient) StartServer(ctx context.Context, projectId string, serverId string) ApiStartServerRequest { - return ApiStartServerRequest{ +func (a *APIClient) UpdateAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest { + return ApiUpdateAttachedVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + volumeId: volumeId, } } -func (a *APIClient) StartServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiStartServerRequest{ +func (a *APIClient) UpdateAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := ApiUpdateAttachedVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + volumeId: volumeId, } return r.Execute() } -type ApiStopServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiUpdateBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + backupId string + updateBackupPayload *UpdateBackupPayload } -func (r ApiStopServerRequest) Execute() error { +// Request an update of a backup. + +func (r ApiUpdateBackupRequest) UpdateBackupPayload(updateBackupPayload UpdateBackupPayload) ApiUpdateBackupRequest { + r.updateBackupPayload = &updateBackupPayload + return r +} + +func (r ApiUpdateBackupRequest) Execute() (*Backup, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StopServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateBackup") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/stop" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.backupId) < 36 { + return localVarReturnValue, fmt.Errorf("backupId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.backupId) > 36 { + return localVarReturnValue, fmt.Errorf("backupId must have less than 36 elements") + } + if r.updateBackupPayload == nil { + return localVarReturnValue, fmt.Errorf("updateBackupPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -14919,9 +20186,11 @@ func (r ApiStopServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateBackupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -14935,14 +20204,14 @@ func (r ApiStopServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -14956,142 +20225,153 @@ func (r ApiStopServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -StopServer: Stop an existing server. +UpdateBackup: Update information of a backup. -Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. +Update name or labels of the backup. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiStopServerRequest + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiUpdateBackupRequest */ -func (a *APIClient) StopServer(ctx context.Context, projectId string, serverId string) ApiStopServerRequest { - return ApiStopServerRequest{ +func (a *APIClient) UpdateBackup(ctx context.Context, projectId string, backupId string) ApiUpdateBackupRequest { + return ApiUpdateBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + backupId: backupId, } } -func (a *APIClient) StopServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiStopServerRequest{ +func (a *APIClient) UpdateBackupExecute(ctx context.Context, projectId string, backupId string) (*Backup, error) { + r := ApiUpdateBackupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + backupId: backupId, } return r.Execute() } -type ApiUnrescueServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiUpdateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + updateImagePayload *UpdateImagePayload } -func (r ApiUnrescueServerRequest) Execute() error { +// Request an update of an Image. + +func (r ApiUpdateImageRequest) UpdateImagePayload(updateImagePayload UpdateImagePayload) ApiUpdateImageRequest { + r.updateImagePayload = &updateImagePayload + return r +} + +func (r ApiUpdateImageRequest) Execute() (*Image, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Image ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UnrescueServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImage") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/unrescue" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}" 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, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.updateImagePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImagePayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -15107,9 +20387,11 @@ func (r ApiUnrescueServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateImagePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -15123,14 +20405,14 @@ func (r ApiUnrescueServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -15144,134 +20426,131 @@ func (r ApiUnrescueServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error 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 - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -UnrescueServer: Unrescue an existing server. +UpdateImage: Update Image Parameters. -Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. +Update the properties of an existing Image inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiUnrescueServerRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageRequest */ -func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, serverId string) ApiUnrescueServerRequest { - return ApiUnrescueServerRequest{ +func (a *APIClient) UpdateImage(ctx context.Context, projectId string, imageId string) ApiUpdateImageRequest { + return ApiUpdateImageRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + imageId: imageId, } } -func (a *APIClient) UnrescueServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiUnrescueServerRequest{ +func (a *APIClient) UpdateImageExecute(ctx context.Context, projectId string, imageId string) (*Image, error) { + r := ApiUpdateImageRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + imageId: imageId, } return r.Execute() } -type ApiUpdateAttachedVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - volumeId string - updateAttachedVolumePayload *UpdateAttachedVolumePayload +type ApiUpdateImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + updateImageSharePayload *UpdateImageSharePayload } -// Request a volume attachment update. +// Update an Image Share. -func (r ApiUpdateAttachedVolumeRequest) UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest { - r.updateAttachedVolumePayload = &updateAttachedVolumePayload +func (r ApiUpdateImageShareRequest) UpdateImageSharePayload(updateImageSharePayload UpdateImageSharePayload) ApiUpdateImageShareRequest { + r.updateImageSharePayload = &updateImageSharePayload return r } -func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { +func (r ApiUpdateImageShareRequest) Execute() (*ImageShare, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachment + localVarReturnValue *ImageShare ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImageShare") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/images/{imageId}/share" 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, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -15282,20 +20561,14 @@ func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") - } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") - } - if strlen(r.volumeId) < 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") } - if r.updateAttachedVolumePayload == nil { - return localVarReturnValue, fmt.Errorf("updateAttachedVolumePayload is required and must be specified") + if r.updateImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImageSharePayload is required and must be specified") } // to determine the Content-Type header @@ -15316,7 +20589,7 @@ func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateAttachedVolumePayload + localVarPostBody = r.updateImageSharePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -15420,33 +20693,30 @@ func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { } /* -UpdateAttachedVolume: Update Volume Attachment Parameters. +UpdateImageShare: Update image share. -Update the properties of an existing Volume Attachment. +Update share of an Image. Projects will be appended to existing list. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiUpdateAttachedVolumeRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageShareRequest */ -func (a *APIClient) UpdateAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest { - return ApiUpdateAttachedVolumeRequest{ +func (a *APIClient) UpdateImageShare(ctx context.Context, projectId string, imageId string) ApiUpdateImageShareRequest { + return ApiUpdateImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } } -func (a *APIClient) UpdateAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { - r := ApiUpdateAttachedVolumeRequest{ +func (a *APIClient) UpdateImageShareExecute(ctx context.Context, projectId string, imageId string) (*ImageShare, error) { + r := ApiUpdateImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } return r.Execute() } @@ -16676,6 +21946,207 @@ func (a *APIClient) UpdateServerExecute(ctx context.Context, projectId string, s return r.Execute() } +type ApiUpdateSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + snapshotId string + updateSnapshotPayload *UpdateSnapshotPayload +} + +// Request an update of a snapshot. + +func (r ApiUpdateSnapshotRequest) UpdateSnapshotPayload(updateSnapshotPayload UpdateSnapshotPayload) ApiUpdateSnapshotRequest { + r.updateSnapshotPayload = &updateSnapshotPayload + return r +} + +func (r ApiUpdateSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have less than 36 elements") + } + if r.updateSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("updateSnapshotPayload is required and must be specified") + } + + // 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{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateSnapshotPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, 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 localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateSnapshot: Update information of the snapshot. + +Update information like name or labels of the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiUpdateSnapshotRequest +*/ +func (a *APIClient) UpdateSnapshot(ctx context.Context, projectId string, snapshotId string) ApiUpdateSnapshotRequest { + return ApiUpdateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + snapshotId: snapshotId, + } +} + +func (a *APIClient) UpdateSnapshotExecute(ctx context.Context, projectId string, snapshotId string) (*Snapshot, error) { + r := ApiUpdateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + snapshotId: snapshotId, + } + return r.Execute() +} + type ApiUpdateVolumeRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/iaas/api_default_test.go b/services/iaas/api_default_test.go index 4142b026..8327dc81 100644 --- a/services/iaas/api_default_test.go +++ b/services/iaas/api_default_test.go @@ -347,6 +347,165 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService CreateAffinityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/affinity-groups" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := AffinityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + createAffinityGroupPayload := CreateAffinityGroupPayload{} + + resp, reqErr := apiClient.CreateAffinityGroup(context.Background(), projectId).CreateAffinityGroupPayload(createAffinityGroupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/backups" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Backup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + createBackupPayload := CreateBackupPayload{} + + resp, reqErr := apiClient.CreateBackup(context.Background(), projectId).CreateBackupPayload(createBackupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateImage", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ImageCreateResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + createImagePayload := CreateImagePayload{} + + resp, reqErr := apiClient.CreateImage(context.Background(), projectId).CreateImagePayload(createImagePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService CreateKeyPair", func(t *testing.T) { path := "/v1beta1/keypairs" @@ -886,14 +1045,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService CreateVolume", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volumes" + t.Run("Test DefaultApiService CreateSnapshot", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/snapshots" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Volume{} + data := Snapshot{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -927,9 +1086,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - createVolumePayload := CreateVolumePayload{} + createSnapshotPayload := CreateSnapshotPayload{} - resp, reqErr := apiClient.CreateVolume(context.Background(), projectId).CreateVolumePayload(createVolumePayload).Execute() + resp, reqErr := apiClient.CreateSnapshot(context.Background(), projectId).CreateSnapshotPayload(createSnapshotPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -939,15 +1098,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeallocateServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/deallocate" + t.Run("Test DefaultApiService CreateVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes" 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) { + data := Volume{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -979,19 +1139,24 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" + createVolumePayload := CreateVolumePayload{} - reqErr := apiClient.DeallocateServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.CreateVolume(context.Background(), projectId).CreateVolumePayload(createVolumePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) { - path := "/v1beta1/keypairs/{keypairName}" - keypairNameValue := "keypairName" - path = strings.Replace(path, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + t.Run("Test DefaultApiService DeallocateServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/deallocate" + 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) { @@ -1025,21 +1190,22 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - keypairName := "keypairName" + projectId := "projectId" + serverId := "serverId" - reqErr := apiClient.DeleteKeyPair(context.Background(), keypairName).Execute() + reqErr := apiClient.DeallocateServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}" + t.Run("Test DefaultApiService DeleteAffinityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/affinity-groups/{affinityGroupId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + affinityGroupIdValue := "affinityGroupId" + path = strings.Replace(path, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(affinityGroupIdValue, "affinityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1074,21 +1240,21 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" + affinityGroupId := "affinityGroupId" - reqErr := apiClient.DeleteNetwork(context.Background(), projectId, networkId).Execute() + reqErr := apiClient.DeleteAffinityGroup(context.Background(), projectId, affinityGroupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService DeleteBackup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/backups/{backupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + backupIdValue := "backupId" + path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1122,24 +1288,22 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + backupId := "backupId" - reqErr := apiClient.DeleteNetworkArea(context.Background(), organizationId, areaId).Execute() + reqErr := apiClient.DeleteBackup(context.Background(), projectId, backupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetworkAreaRange", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - networkRangeIdValue := "networkRangeId" - path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + t.Run("Test DefaultApiService DeleteImage", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1173,25 +1337,22 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - networkRangeId := "networkRangeId" + projectId := "projectId" + imageId := "imageId" - reqErr := apiClient.DeleteNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + reqErr := apiClient.DeleteImage(context.Background(), projectId, imageId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetworkAreaRoute", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - routeIdValue := "routeId" - path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + t.Run("Test DefaultApiService DeleteImageShare", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}/share" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1225,25 +1386,24 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - routeId := "routeId" + projectId := "projectId" + imageId := "imageId" - reqErr := apiClient.DeleteNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + reqErr := apiClient.DeleteImageShare(context.Background(), projectId, imageId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNic", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + t.Run("Test DefaultApiService DeleteImageShareConsumer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) - nicIdValue := "nicId" - path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + consumerProjectIdValue := "consumerProjectId" + path = strings.Replace(path, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(consumerProjectIdValue, "consumerProjectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1278,22 +1438,20 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" - nicId := "nicId" + imageId := "imageId" + consumerProjectId := "consumerProjectId" - reqErr := apiClient.DeleteNic(context.Background(), projectId, networkId, nicId).Execute() + reqErr := apiClient.DeleteImageShareConsumer(context.Background(), projectId, imageId, consumerProjectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeletePublicIP", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - publicIpIdValue := "publicIpId" - path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) { + path := "/v1beta1/keypairs/{keypairName}" + keypairNameValue := "keypairName" + path = strings.Replace(path, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1327,25 +1485,1249 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - publicIpId := "publicIpId" + keypairName := "keypairName" - reqErr := apiClient.DeletePublicIP(context.Background(), projectId, publicIpId).Execute() + reqErr := apiClient.DeleteKeyPair(context.Background(), keypairName).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteSecurityGroup", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaas_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" + networkId := "networkId" + + reqErr := apiClient.DeleteNetwork(context.Background(), projectId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 iaas_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) + } + + organizationId := "organizationId" + areaId := "areaId" + + reqErr := apiClient.DeleteNetworkArea(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkAreaRange", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + networkRangeIdValue := "networkRangeId" + path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -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 iaas_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) + } + + organizationId := "organizationId" + areaId := "areaId" + networkRangeId := "networkRangeId" + + reqErr := apiClient.DeleteNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkAreaRoute", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + routeIdValue := "routeId" + path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -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 iaas_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) + } + + organizationId := "organizationId" + areaId := "areaId" + routeId := "routeId" + + reqErr := apiClient.DeleteNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNic", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -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 iaas_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" + networkId := "networkId" + nicId := "nicId" + + reqErr := apiClient.DeleteNic(context.Background(), projectId, networkId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeletePublicIP", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -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 iaas_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" + publicIpId := "publicIpId" + + reqErr := apiClient.DeletePublicIP(context.Background(), projectId, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSecurityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -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 iaas_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" + securityGroupId := "securityGroupId" + + reqErr := apiClient.DeleteSecurityGroup(context.Background(), projectId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSecurityGroupRule", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) securityGroupIdValue := "securityGroupId" path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + securityGroupRuleIdValue := "securityGroupRuleId" + path = strings.Replace(path, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -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 iaas_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" + securityGroupId := "securityGroupId" + securityGroupRuleId := "securityGroupRuleId" + + reqErr := apiClient.DeleteSecurityGroupRule(context.Background(), projectId, securityGroupId, securityGroupRuleId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteServer", func(t *testing.T) { + path := "/v1beta1/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 iaas_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.DeleteServer(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSnapshot", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/snapshots/{snapshotId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + snapshotIdValue := "snapshotId" + path = strings.Replace(path, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -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 iaas_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" + snapshotId := "snapshotId" + + reqErr := apiClient.DeleteSnapshot(context.Background(), projectId, snapshotId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -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 iaas_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" + volumeId := "volumeId" + + reqErr := apiClient.DeleteVolume(context.Background(), projectId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAffinityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/affinity-groups/{affinityGroupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + affinityGroupIdValue := "affinityGroupId" + path = strings.Replace(path, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(affinityGroupIdValue, "affinityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := AffinityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + affinityGroupId := "affinityGroupId" + + resp, reqErr := apiClient.GetAffinityGroup(context.Background(), projectId, affinityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + 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) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + volumeId := "volumeId" + + resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, serverId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/backups/{backupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + backupIdValue := "backupId" + path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Backup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + backupId := "backupId" + + resp, reqErr := apiClient.GetBackup(context.Background(), projectId, backupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetImage", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Image{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + imageId := "imageId" + + resp, reqErr := apiClient.GetImage(context.Background(), projectId, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetImageShare", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}/share" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ImageShare{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + imageId := "imageId" + + resp, reqErr := apiClient.GetImageShare(context.Background(), projectId, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetImageShareConsumer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + consumerProjectIdValue := "consumerProjectId" + path = strings.Replace(path, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(consumerProjectIdValue, "consumerProjectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ImageShareConsumer{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + imageId := "imageId" + consumerProjectId := "consumerProjectId" + + resp, reqErr := apiClient.GetImageShareConsumer(context.Background(), projectId, imageId, consumerProjectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) { + path := "/v1beta1/keypairs/{keypairName}" + keypairNameValue := "keypairName" + path = strings.Replace(path, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Keypair{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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) + } + + keypairName := "keypairName" + + resp, reqErr := apiClient.GetKeyPair(context.Background(), keypairName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetMachineType", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/machine-types/{machineType}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + machineTypeValue := "machineType" + path = strings.Replace(path, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := MachineType{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + machineType := "machineType" + + resp, reqErr := apiClient.GetMachineType(context.Background(), projectId, machineType).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + networkId := "networkId" + + resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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) + } + + organizationId := "organizationId" + areaId := "areaId" + + resp, reqErr := apiClient.GetNetworkArea(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkAreaRange", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + networkRangeIdValue := "networkRangeId" + path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRange{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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) + } + + organizationId := "organizationId" + areaId := "areaId" + networkRangeId := "networkRangeId" + + resp, reqErr := apiClient.GetNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkAreaRoute", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + routeIdValue := "routeId" + path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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) + } + + organizationId := "organizationId" + areaId := "areaId" + routeId := "routeId" + + resp, reqErr := apiClient.GetNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNic", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1377,26 +2759,86 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - securityGroupId := "securityGroupId" + networkId := "networkId" + nicId := "nicId" - reqErr := apiClient.DeleteSecurityGroup(context.Background(), projectId, securityGroupId).Execute() + resp, reqErr := apiClient.GetNic(context.Background(), projectId, networkId, nicId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService DeleteSecurityGroupRule", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + t.Run("Test DefaultApiService GetOrganizationRequest", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/requests/{requestId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + requestIdValue := "requestId" + path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Request{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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) + } + + organizationId := "organizationId" + requestId := "requestId" + + resp, reqErr := apiClient.GetOrganizationRequest(context.Background(), organizationId, requestId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetProjectNIC", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/nics/{nicId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - securityGroupIdValue := "securityGroupId" - path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) - securityGroupRuleIdValue := "securityGroupRuleId" - path = strings.Replace(path, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1428,25 +2870,30 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - securityGroupId := "securityGroupId" - securityGroupRuleId := "securityGroupRuleId" + nicId := "nicId" - reqErr := apiClient.DeleteSecurityGroupRule(context.Background(), projectId, securityGroupId, securityGroupRuleId).Execute() + resp, reqErr := apiClient.GetProjectNIC(context.Background(), projectId, nicId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService DeleteServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}" + t.Run("Test DefaultApiService GetProjectRequest", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/requests/{requestId}" 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) + requestIdValue := "requestId" + path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Request{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1478,24 +2925,30 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" + requestId := "requestId" - reqErr := apiClient.DeleteServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.GetProjectRequest(context.Background(), projectId, requestId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" + t.Run("Test DefaultApiService GetPublicIP", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PublicIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1527,27 +2980,28 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - volumeId := "volumeId" + publicIpId := "publicIpId" - reqErr := apiClient.DeleteVolume(context.Background(), projectId, volumeId).Execute() + resp, reqErr := apiClient.GetPublicIP(context.Background(), projectId, publicIpId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + t.Run("Test DefaultApiService GetSecurityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" 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) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := VolumeAttachment{} + data := SecurityGroup{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1581,10 +3035,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - volumeId := "volumeId" + securityGroupId := "securityGroupId" - resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, serverId, volumeId).Execute() + resp, reqErr := apiClient.GetSecurityGroup(context.Background(), projectId, securityGroupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1594,14 +3047,74 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) { - path := "/v1beta1/keypairs/{keypairName}" - keypairNameValue := "keypairName" - path = strings.Replace(path, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + t.Run("Test DefaultApiService GetSecurityGroupRule", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + securityGroupRuleIdValue := "securityGroupRuleId" + path = strings.Replace(path, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRule{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + securityGroupId := "securityGroupId" + securityGroupRuleId := "securityGroupRuleId" + + resp, reqErr := apiClient.GetSecurityGroupRule(context.Background(), projectId, securityGroupId, securityGroupRuleId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServer", func(t *testing.T) { + path := "/v1beta1/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) { - data := Keypair{} + data := Server{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1634,9 +3147,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - keypairName := "keypairName" + projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.GetKeyPair(context.Background(), keypairName).Execute() + resp, reqErr := apiClient.GetServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1646,16 +3160,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetMachineType", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/machine-types/{machineType}" + t.Run("Test DefaultApiService GetServerConsole", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/console" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - machineTypeValue := "machineType" - path = strings.Replace(path, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -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) { - data := MachineType{} + data := ServerConsoleUrl{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1689,9 +3203,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - machineType := "machineType" + serverId := "serverId" - resp, reqErr := apiClient.GetMachineType(context.Background(), projectId, machineType).Execute() + resp, reqErr := apiClient.GetServerConsole(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1701,16 +3215,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}" + t.Run("Test DefaultApiService GetServerLog", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/log" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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) { - data := Network{} + data := GetServerLog200Response{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1744,9 +3258,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" + serverId := "serverId" - resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, networkId).Execute() + resp, reqErr := apiClient.GetServerLog(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1756,16 +3270,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService GetSnapshot", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/snapshots/{snapshotId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + snapshotIdValue := "snapshotId" + path = strings.Replace(path, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkArea{} + data := Snapshot{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1798,10 +3312,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + snapshotId := "snapshotId" - resp, reqErr := apiClient.GetNetworkArea(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.GetSnapshot(context.Background(), projectId, snapshotId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1811,18 +3325,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetNetworkAreaRange", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - networkRangeIdValue := "networkRangeId" - path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + t.Run("Test DefaultApiService GetVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkRange{} + data := Volume{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1855,11 +3367,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - networkRangeId := "networkRangeId" + projectId := "projectId" + volumeId := "volumeId" - resp, reqErr := apiClient.GetNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + resp, reqErr := apiClient.GetVolume(context.Background(), projectId, volumeId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1869,18 +3380,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetNetworkAreaRoute", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - routeIdValue := "routeId" - path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + t.Run("Test DefaultApiService GetVolumePerformanceClass", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + volumePerformanceClassValue := "volumePerformanceClass" + path = strings.Replace(path, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(volumePerformanceClassValue, "volumePerformanceClass")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Route{} + data := VolumePerformanceClass{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1913,11 +3422,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - routeId := "routeId" + projectId := "projectId" + volumePerformanceClass := "volumePerformanceClass" - resp, reqErr := apiClient.GetNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + resp, reqErr := apiClient.GetVolumePerformanceClass(context.Background(), projectId, volumePerformanceClass).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1927,18 +3435,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetNic", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + t.Run("Test DefaultApiService ListAffinityGroups", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/affinity-groups" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) - nicIdValue := "nicId" - path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NIC{} + data := AffinityGroupListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1972,10 +3476,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" - nicId := "nicId" - resp, reqErr := apiClient.GetNic(context.Background(), projectId, networkId, nicId).Execute() + resp, reqErr := apiClient.ListAffinityGroups(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1985,16 +3487,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetOrganizationRequest", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/requests/{requestId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - requestIdValue := "requestId" - path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + t.Run("Test DefaultApiService ListAttachedVolumes", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments" + 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) { - data := Request{} + data := VolumeAttachmentListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2027,10 +3529,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - requestId := "requestId" + projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.GetOrganizationRequest(context.Background(), organizationId, requestId).Execute() + resp, reqErr := apiClient.ListAttachedVolumes(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2040,16 +3542,12 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetProjectRequest", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/requests/{requestId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - requestIdValue := "requestId" - path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + t.Run("Test DefaultApiService ListAvailabilityZones", func(t *testing.T) { + path := "/v1beta1/availability-zones" testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Request{} + data := AvailabilityZoneListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2082,10 +3580,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - requestId := "requestId" - - resp, reqErr := apiClient.GetProjectRequest(context.Background(), projectId, requestId).Execute() + resp, reqErr := apiClient.ListAvailabilityZones(context.Background()).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2095,16 +3590,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetPublicIP", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/backups" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - publicIpIdValue := "publicIpId" - path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := PublicIp{} + data := BackupListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2138,9 +3631,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - publicIpId := "publicIpId" - resp, reqErr := apiClient.GetPublicIP(context.Background(), projectId, publicIpId).Execute() + resp, reqErr := apiClient.ListBackups(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2150,16 +3642,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetSecurityGroup", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + t.Run("Test DefaultApiService ListImages", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - securityGroupIdValue := "securityGroupId" - path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := SecurityGroup{} + data := ImageListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2193,9 +3683,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - securityGroupId := "securityGroupId" - resp, reqErr := apiClient.GetSecurityGroup(context.Background(), projectId, securityGroupId).Execute() + resp, reqErr := apiClient.ListImages(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2205,18 +3694,12 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetSecurityGroupRule", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - securityGroupIdValue := "securityGroupId" - path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) - securityGroupRuleIdValue := "securityGroupRuleId" - path = strings.Replace(path, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + t.Run("Test DefaultApiService ListKeyPairs", func(t *testing.T) { + path := "/v1beta1/keypairs" testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := SecurityGroupRule{} + data := KeyPairListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2249,11 +3732,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - securityGroupId := "securityGroupId" - securityGroupRuleId := "securityGroupRuleId" - - resp, reqErr := apiClient.GetSecurityGroupRule(context.Background(), projectId, securityGroupId, securityGroupRuleId).Execute() + resp, reqErr := apiClient.ListKeyPairs(context.Background()).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2263,16 +3742,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}" + t.Run("Test DefaultApiService ListMachineTypes", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/machine-types" 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) { - data := Server{} + data := MachineTypeListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2306,9 +3783,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - resp, reqErr := apiClient.GetServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListMachineTypes(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2318,16 +3794,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetServerConsole", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/console" - 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) + t.Run("Test DefaultApiService ListNetworkAreaProjects", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ServerConsoleUrl{} + data := ProjectListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2360,10 +3836,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + organizationId := "organizationId" + areaId := "areaId" - resp, reqErr := apiClient.GetServerConsole(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2373,16 +3849,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetServerLog", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/log" - 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) + t.Run("Test DefaultApiService ListNetworkAreaRanges", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := GetServerLog200Response{} + data := NetworkRangeListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2415,10 +3891,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + organizationId := "organizationId" + areaId := "areaId" - resp, reqErr := apiClient.GetServerLog(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListNetworkAreaRanges(context.Background(), organizationId, areaId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2428,16 +3904,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetVolume", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + t.Run("Test DefaultApiService ListNetworkAreaRoutes", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Volume{} + data := RouteListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2470,29 +3946,27 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - volumeId := "volumeId" + organizationId := "organizationId" + areaId := "areaId" - resp, reqErr := apiClient.GetVolume(context.Background(), projectId, volumeId).Execute() + resp, reqErr := apiClient.ListNetworkAreaRoutes(context.Background(), organizationId, areaId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService GetVolumePerformanceClass", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumePerformanceClassValue := "volumePerformanceClass" - path = strings.Replace(path, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(volumePerformanceClassValue, "volumePerformanceClass")), -1) + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := VolumePerformanceClass{} + data := NetworkAreaListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2525,10 +3999,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - volumePerformanceClass := "volumePerformanceClass" + organizationId := "organizationId" - resp, reqErr := apiClient.GetVolumePerformanceClass(context.Background(), projectId, volumePerformanceClass).Execute() + resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2538,16 +4011,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListAttachedVolumes", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments" + t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks" 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) { - data := VolumeAttachmentListResponse{} + data := NetworkListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2581,9 +4052,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - resp, reqErr := apiClient.ListAttachedVolumes(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListNetworks(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2593,12 +4063,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListKeyPairs", func(t *testing.T) { - path := "/v1beta1/keypairs" + t.Run("Test DefaultApiService ListNics", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := KeyPairListResponse{} + data := NICListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2631,7 +4105,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - resp, reqErr := apiClient.ListKeyPairs(context.Background()).Execute() + projectId := "projectId" + networkId := "networkId" + + resp, reqErr := apiClient.ListNics(context.Background(), projectId, networkId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2641,14 +4118,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListMachineTypes", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/machine-types" + t.Run("Test DefaultApiService ListProjectNICs", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/nics" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := MachineTypeListResponse{} + data := NICListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2683,7 +4160,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" - resp, reqErr := apiClient.ListMachineTypes(context.Background(), projectId).Execute() + resp, reqErr := apiClient.ListProjectNICs(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2693,16 +4170,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreaProjects", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService ListPublicIPs", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ProjectListResponse{} + data := PublicIpListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2735,10 +4210,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" - resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.ListPublicIPs(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2748,16 +4222,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreaRanges", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService ListSecurityGroupRules", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkRangeListResponse{} + data := SecurityGroupRuleListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2790,10 +4264,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + securityGroupId := "securityGroupId" - resp, reqErr := apiClient.ListNetworkAreaRanges(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.ListSecurityGroupRules(context.Background(), projectId, securityGroupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2803,16 +4277,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreaRoutes", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService ListSecurityGroups", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := RouteListResponse{} + data := SecurityGroupListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2845,10 +4317,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" - resp, reqErr := apiClient.ListNetworkAreaRoutes(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.ListSecurityGroups(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2858,14 +4329,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + t.Run("Test DefaultApiService ListServerNics", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics" + 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) { - data := NetworkAreaListResponse{} + data := NICListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2898,9 +4371,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" + projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() + resp, reqErr := apiClient.ListServerNics(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2910,14 +4384,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks" + t.Run("Test DefaultApiService ListServerServiceAccounts", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts" 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) { - data := NetworkListResponse{} + data := ServiceAccountMailListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2951,8 +4427,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.ListNetworks(context.Background(), projectId).Execute() + resp, reqErr := apiClient.ListServerServiceAccounts(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2962,16 +4439,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNics", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + t.Run("Test DefaultApiService ListServers", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NICListResponse{} + data := ServerListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -3005,9 +4480,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" - resp, reqErr := apiClient.ListNics(context.Background(), projectId, networkId).Execute() + resp, reqErr := apiClient.ListServers(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -3017,14 +4491,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListPublicIPs", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/public-ips" + t.Run("Test DefaultApiService ListSnapshots", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/snapshots" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := PublicIpListResponse{} + data := SnapshotListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -3059,7 +4533,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" - resp, reqErr := apiClient.ListPublicIPs(context.Background(), projectId).Execute() + resp, reqErr := apiClient.ListSnapshots(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -3069,16 +4543,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListSecurityGroupRules", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + t.Run("Test DefaultApiService ListVolumePerformanceClasses", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volume-performance-classes" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - securityGroupIdValue := "securityGroupId" - path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := SecurityGroupRuleListResponse{} + data := VolumePerformanceClassListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -3112,9 +4584,8 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - securityGroupId := "securityGroupId" - resp, reqErr := apiClient.ListSecurityGroupRules(context.Background(), projectId, securityGroupId).Execute() + resp, reqErr := apiClient.ListVolumePerformanceClasses(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -3124,14 +4595,14 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListSecurityGroups", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/security-groups" + t.Run("Test DefaultApiService ListVolumes", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := SecurityGroupListResponse{} + data := VolumeListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -3166,7 +4637,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" - resp, reqErr := apiClient.ListSecurityGroups(context.Background(), projectId).Execute() + resp, reqErr := apiClient.ListVolumes(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -3176,18 +4647,15 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListServerNics", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics" + t.Run("Test DefaultApiService PartialUpdateNetwork", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}" 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) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NICListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3219,28 +4687,26 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" + networkId := "networkId" + partialUpdateNetworkPayload := PartialUpdateNetworkPayload{} - resp, reqErr := apiClient.ListServerNics(context.Background(), projectId, serverId).Execute() + reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService ListServerServiceAccounts", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts" - 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) + t.Run("Test DefaultApiService PartialUpdateNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ServiceAccountMailListResponse{} + data := NetworkArea{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -3273,10 +4739,11 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - serverId := "serverId" + organizationId := "organizationId" + areaId := "areaId" + partialUpdateNetworkAreaPayload := PartialUpdateNetworkAreaPayload{} - resp, reqErr := apiClient.ListServerServiceAccounts(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.PartialUpdateNetworkArea(context.Background(), organizationId, areaId).PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -3286,16 +4753,15 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListServers", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers" + t.Run("Test DefaultApiService RebootServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/reboot" 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) { - data := ServerListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3327,27 +4793,26 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.ListServers(context.Background(), projectId).Execute() + reqErr := apiClient.RebootServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService ListVolumePerformanceClasses", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volume-performance-classes" + t.Run("Test DefaultApiService RemoveNetworkFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" 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) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := VolumePerformanceClassListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3379,27 +4844,27 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" + serverId := "serverId" + networkId := "networkId" - resp, reqErr := apiClient.ListVolumePerformanceClasses(context.Background(), projectId).Execute() + reqErr := apiClient.RemoveNetworkFromServer(context.Background(), projectId, serverId, networkId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService ListVolumes", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volumes" + t.Run("Test DefaultApiService RemoveNicFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" 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) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := VolumeListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3431,23 +4896,24 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" + serverId := "serverId" + nicId := "nicId" - resp, reqErr := apiClient.ListVolumes(context.Background(), projectId).Execute() + reqErr := apiClient.RemoveNicFromServer(context.Background(), projectId, serverId, nicId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService PartialUpdateNetwork", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}" + t.Run("Test DefaultApiService RemovePublicIpFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -3482,28 +4948,27 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" - partialUpdateNetworkPayload := PartialUpdateNetworkPayload{} + serverId := "serverId" + publicIpId := "publicIpId" - reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute() + reqErr := apiClient.RemovePublicIpFromServer(context.Background(), projectId, serverId, publicIpId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService PartialUpdateNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService RemoveSecurityGroupFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + 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) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkArea{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3534,29 +4999,31 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - partialUpdateNetworkAreaPayload := PartialUpdateNetworkAreaPayload{} + projectId := "projectId" + serverId := "serverId" + securityGroupId := "securityGroupId" - resp, reqErr := apiClient.PartialUpdateNetworkArea(context.Background(), organizationId, areaId).PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload).Execute() + reqErr := apiClient.RemoveSecurityGroupFromServer(context.Background(), projectId, serverId, securityGroupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService RebootServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/reboot" + t.Run("Test DefaultApiService RemoveServiceAccountFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" 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) + serviceAccountMailValue := "serviceAccountMail" + path = strings.Replace(path, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ServiceAccountMailListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3589,22 +5056,26 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" + serviceAccountMail := "serviceAccountMail" - reqErr := apiClient.RebootServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.RemoveServiceAccountFromServer(context.Background(), projectId, serverId, serviceAccountMail).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService RemoveNetworkFromServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + t.Run("Test DefaultApiService RemoveVolumeFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" 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) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -3640,23 +5111,21 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" - networkId := "networkId" + volumeId := "volumeId" - reqErr := apiClient.RemoveNetworkFromServer(context.Background(), projectId, serverId, networkId).Execute() + reqErr := apiClient.RemoveVolumeFromServer(context.Background(), projectId, serverId, volumeId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService RemoveNicFromServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + t.Run("Test DefaultApiService RescueServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/rescue" 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) - nicIdValue := "nicId" - path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -3692,23 +5161,21 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" - nicId := "nicId" + rescueServerPayload := RescueServerPayload{} - reqErr := apiClient.RemoveNicFromServer(context.Background(), projectId, serverId, nicId).Execute() + reqErr := apiClient.RescueServer(context.Background(), projectId, serverId).RescueServerPayload(rescueServerPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService RemovePublicIpFromServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + t.Run("Test DefaultApiService ResizeServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/resize" 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) - publicIpIdValue := "publicIpId" - path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -3744,23 +5211,21 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" - publicIpId := "publicIpId" + resizeServerPayload := ResizeServerPayload{} - reqErr := apiClient.RemovePublicIpFromServer(context.Background(), projectId, serverId, publicIpId).Execute() + reqErr := apiClient.ResizeServer(context.Background(), projectId, serverId).ResizeServerPayload(resizeServerPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService RemoveSecurityGroupFromServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + t.Run("Test DefaultApiService ResizeVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}/resize" 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) - securityGroupIdValue := "securityGroupId" - path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -3795,30 +5260,24 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - securityGroupId := "securityGroupId" + volumeId := "volumeId" - reqErr := apiClient.RemoveSecurityGroupFromServer(context.Background(), projectId, serverId, securityGroupId).Execute() + reqErr := apiClient.ResizeVolume(context.Background(), projectId, volumeId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService RemoveServiceAccountFromServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + t.Run("Test DefaultApiService RestoreBackup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/backups/{backupId}/restore" 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) - serviceAccountMailValue := "serviceAccountMail" - path = strings.Replace(path, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) + backupIdValue := "backupId" + path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ServiceAccountMailListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3850,30 +5309,27 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - serviceAccountMail := "serviceAccountMail" + backupId := "backupId" - resp, reqErr := apiClient.RemoveServiceAccountFromServer(context.Background(), projectId, serverId, serviceAccountMail).Execute() + reqErr := apiClient.RestoreBackup(context.Background(), projectId, backupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService RemoveVolumeFromServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + t.Run("Test DefaultApiService SetImageShare", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}/share" 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) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ImageShare{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -3905,18 +5361,21 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - volumeId := "volumeId" + imageId := "imageId" + setImageSharePayload := SetImageSharePayload{} - reqErr := apiClient.RemoveVolumeFromServer(context.Background(), projectId, serverId, volumeId).Execute() + resp, reqErr := apiClient.SetImageShare(context.Background(), projectId, imageId).SetImageSharePayload(setImageSharePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService RescueServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/rescue" + t.Run("Test DefaultApiService StartServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/start" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" @@ -3956,17 +5415,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" - rescueServerPayload := RescueServerPayload{} - reqErr := apiClient.RescueServer(context.Background(), projectId, serverId).RescueServerPayload(rescueServerPayload).Execute() + reqErr := apiClient.StartServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService ResizeServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/resize" + t.Run("Test DefaultApiService StopServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/stop" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := "serverId" @@ -4006,21 +5464,20 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" - resizeServerPayload := ResizeServerPayload{} - reqErr := apiClient.ResizeServer(context.Background(), projectId, serverId).ResizeServerPayload(resizeServerPayload).Execute() + reqErr := apiClient.StopServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService ResizeVolume", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/volumes/{volumeId}/resize" + t.Run("Test DefaultApiService UnrescueServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/unrescue" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -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) { @@ -4055,24 +5512,29 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - volumeId := "volumeId" + serverId := "serverId" - reqErr := apiClient.ResizeVolume(context.Background(), projectId, volumeId).Execute() + reqErr := apiClient.UnrescueServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService StartServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/start" + t.Run("Test DefaultApiService UpdateAttachedVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" 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) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -4105,23 +5567,31 @@ func Test_iaas_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" + volumeId := "volumeId" + updateAttachedVolumePayload := UpdateAttachedVolumePayload{} - reqErr := apiClient.StartServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.UpdateAttachedVolume(context.Background(), projectId, serverId, volumeId).UpdateAttachedVolumePayload(updateAttachedVolumePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService StopServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/stop" + t.Run("Test DefaultApiService UpdateBackup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/backups/{backupId}" 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) + backupIdValue := "backupId" + path = strings.Replace(path, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Backup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -4153,24 +5623,31 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" + backupId := "backupId" + updateBackupPayload := UpdateBackupPayload{} - reqErr := apiClient.StopServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.UpdateBackup(context.Background(), projectId, backupId).UpdateBackupPayload(updateBackupPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService UnrescueServer", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/unrescue" + t.Run("Test DefaultApiService UpdateImage", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}" 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) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Image{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -4202,27 +5679,29 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" + imageId := "imageId" + updateImagePayload := UpdateImagePayload{} - reqErr := apiClient.UnrescueServer(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.UpdateImage(context.Background(), projectId, imageId).UpdateImagePayload(updateImagePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService UpdateAttachedVolume", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + t.Run("Test DefaultApiService UpdateImageShare", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/images/{imageId}/share" 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) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := VolumeAttachment{} + data := ImageShare{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -4256,11 +5735,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - volumeId := "volumeId" - updateAttachedVolumePayload := UpdateAttachedVolumePayload{} + imageId := "imageId" + updateImageSharePayload := UpdateImageSharePayload{} - resp, reqErr := apiClient.UpdateAttachedVolume(context.Background(), projectId, serverId, volumeId).UpdateAttachedVolumePayload(updateAttachedVolumePayload).Execute() + resp, reqErr := apiClient.UpdateImageShare(context.Background(), projectId, imageId).UpdateImageSharePayload(updateImageSharePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -4609,6 +6087,62 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService UpdateSnapshot", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/snapshots/{snapshotId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + snapshotIdValue := "snapshotId" + path = strings.Replace(path, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Snapshot{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + 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 iaas_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" + snapshotId := "snapshotId" + updateSnapshotPayload := UpdateSnapshotPayload{} + + resp, reqErr := apiClient.UpdateSnapshot(context.Background(), projectId, snapshotId).UpdateSnapshotPayload(updateSnapshotPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService UpdateVolume", func(t *testing.T) { path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" projectIdValue := "projectId" diff --git a/services/iaas/model_affinity_group.go b/services/iaas/model_affinity_group.go new file mode 100644 index 00000000..bc2ebd1c --- /dev/null +++ b/services/iaas/model_affinity_group.go @@ -0,0 +1,214 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AffinityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AffinityGroup{} + +// AffinityGroup Definition of an affinity group. +type AffinityGroup struct { + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // The servers that are part of the affinity group. + Members *[]string `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // The affinity group policy. + // REQUIRED + Policy *string `json:"policy"` +} + +type _AffinityGroup AffinityGroup + +// NewAffinityGroup instantiates a new AffinityGroup 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 NewAffinityGroup(name *string, policy *string) *AffinityGroup { + this := AffinityGroup{} + this.Name = name + this.Policy = policy + return &this +} + +// NewAffinityGroupWithDefaults instantiates a new AffinityGroup 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 NewAffinityGroupWithDefaults() *AffinityGroup { + this := AffinityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AffinityGroup) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *AffinityGroup) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AffinityGroup) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AffinityGroup) SetId(v *string) { + o.Id = v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *AffinityGroup) GetMembers() *[]string { + if o == nil || IsNil(o.Members) { + var ret *[]string + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetMembersOk() (*[]string, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *AffinityGroup) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *AffinityGroup) SetMembers(v *[]string) { + o.Members = v +} + +// GetName returns the Name field value +func (o *AffinityGroup) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *AffinityGroup) SetName(v *string) { + o.Name = v +} + +// GetPolicy returns the Policy field value +func (o *AffinityGroup) GetPolicy() *string { + if o == nil || IsNil(o.Policy) { + var ret *string + return ret + } + + return o.Policy +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetPolicyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Policy, true +} + +// SetPolicy sets field value +func (o *AffinityGroup) SetPolicy(v *string) { + o.Policy = v +} + +func (o AffinityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + toSerialize["name"] = o.Name + toSerialize["policy"] = o.Policy + return toSerialize, nil +} + +type NullableAffinityGroup struct { + value *AffinityGroup + isSet bool +} + +func (v NullableAffinityGroup) Get() *AffinityGroup { + return v.value +} + +func (v *NullableAffinityGroup) Set(val *AffinityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableAffinityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableAffinityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAffinityGroup(val *AffinityGroup) *NullableAffinityGroup { + return &NullableAffinityGroup{value: val, isSet: true} +} + +func (v NullableAffinityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAffinityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_affinity_group_list_response.go b/services/iaas/model_affinity_group_list_response.go new file mode 100644 index 00000000..d58d96ba --- /dev/null +++ b/services/iaas/model_affinity_group_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AffinityGroupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AffinityGroupListResponse{} + +// AffinityGroupListResponse Response object for affinity group list request. +type AffinityGroupListResponse struct { + // A list of affinity groups. + // REQUIRED + Items *[]AffinityGroup `json:"items"` +} + +type _AffinityGroupListResponse AffinityGroupListResponse + +// NewAffinityGroupListResponse instantiates a new AffinityGroupListResponse 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 NewAffinityGroupListResponse(items *[]AffinityGroup) *AffinityGroupListResponse { + this := AffinityGroupListResponse{} + this.Items = items + return &this +} + +// NewAffinityGroupListResponseWithDefaults instantiates a new AffinityGroupListResponse 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 NewAffinityGroupListResponseWithDefaults() *AffinityGroupListResponse { + this := AffinityGroupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *AffinityGroupListResponse) GetItems() *[]AffinityGroup { + if o == nil || IsNil(o.Items) { + var ret *[]AffinityGroup + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AffinityGroupListResponse) GetItemsOk() (*[]AffinityGroup, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *AffinityGroupListResponse) SetItems(v *[]AffinityGroup) { + o.Items = v +} + +func (o AffinityGroupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableAffinityGroupListResponse struct { + value *AffinityGroupListResponse + isSet bool +} + +func (v NullableAffinityGroupListResponse) Get() *AffinityGroupListResponse { + return v.value +} + +func (v *NullableAffinityGroupListResponse) Set(val *AffinityGroupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAffinityGroupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAffinityGroupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAffinityGroupListResponse(val *AffinityGroupListResponse) *NullableAffinityGroupListResponse { + return &NullableAffinityGroupListResponse{value: val, isSet: true} +} + +func (v NullableAffinityGroupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAffinityGroupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_area_config.go b/services/iaas/model_area_config.go index 9a2f6f1a..5c39eca5 100644 --- a/services/iaas/model_area_config.go +++ b/services/iaas/model_area_config.go @@ -85,7 +85,7 @@ func (o *AreaConfig) SetDefaultNameservers(v *[]string) { // GetNetworkRanges returns the NetworkRanges field value func (o *AreaConfig) GetNetworkRanges() *[]NetworkRange { - if o == nil { + if o == nil || IsNil(o.NetworkRanges) { var ret *[]NetworkRange return ret } @@ -141,7 +141,7 @@ func (o *AreaConfig) SetRoutes(v *[]Route) { // GetTransferNetwork returns the TransferNetwork field value func (o *AreaConfig) GetTransferNetwork() *string { - if o == nil { + if o == nil || IsNil(o.TransferNetwork) { var ret *string return ret } diff --git a/services/iaas/model_availability_zone_list_response.go b/services/iaas/model_availability_zone_list_response.go new file mode 100644 index 00000000..11c9bd37 --- /dev/null +++ b/services/iaas/model_availability_zone_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AvailabilityZoneListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AvailabilityZoneListResponse{} + +// AvailabilityZoneListResponse Availability Zone list response. +type AvailabilityZoneListResponse struct { + // A list of availability zones. + // REQUIRED + Items *[]string `json:"items"` +} + +type _AvailabilityZoneListResponse AvailabilityZoneListResponse + +// NewAvailabilityZoneListResponse instantiates a new AvailabilityZoneListResponse 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 NewAvailabilityZoneListResponse(items *[]string) *AvailabilityZoneListResponse { + this := AvailabilityZoneListResponse{} + this.Items = items + return &this +} + +// NewAvailabilityZoneListResponseWithDefaults instantiates a new AvailabilityZoneListResponse 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 NewAvailabilityZoneListResponseWithDefaults() *AvailabilityZoneListResponse { + this := AvailabilityZoneListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *AvailabilityZoneListResponse) GetItems() *[]string { + if o == nil || IsNil(o.Items) { + var ret *[]string + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AvailabilityZoneListResponse) GetItemsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *AvailabilityZoneListResponse) SetItems(v *[]string) { + o.Items = v +} + +func (o AvailabilityZoneListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableAvailabilityZoneListResponse struct { + value *AvailabilityZoneListResponse + isSet bool +} + +func (v NullableAvailabilityZoneListResponse) Get() *AvailabilityZoneListResponse { + return v.value +} + +func (v *NullableAvailabilityZoneListResponse) Set(val *AvailabilityZoneListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAvailabilityZoneListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAvailabilityZoneListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAvailabilityZoneListResponse(val *AvailabilityZoneListResponse) *NullableAvailabilityZoneListResponse { + return &NullableAvailabilityZoneListResponse{value: val, isSet: true} +} + +func (v NullableAvailabilityZoneListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAvailabilityZoneListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_backup.go b/services/iaas/model_backup.go new file mode 100644 index 00000000..c2f226f3 --- /dev/null +++ b/services/iaas/model_backup.go @@ -0,0 +1,451 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Backup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Backup{} + +// Backup Object that represents a backup. +type Backup struct { + // Object that represents an availability zone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + // Universally Unique Identifier (UUID). + SnapshotId *string `json:"snapshotId,omitempty"` + // The status of a backup object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId *string `json:"volumeId,omitempty"` +} + +// NewBackup instantiates a new Backup 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 NewBackup() *Backup { + this := Backup{} + return &this +} + +// NewBackupWithDefaults instantiates a new Backup 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 NewBackupWithDefaults() *Backup { + this := Backup{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *Backup) GetAvailabilityZone() *string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret *string + return ret + } + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetAvailabilityZoneOk() (*string, bool) { + if o == nil || IsNil(o.AvailabilityZone) { + return nil, false + } + return o.AvailabilityZone, true +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *Backup) HasAvailabilityZone() bool { + if o != nil && !IsNil(o.AvailabilityZone) { + return true + } + + return false +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *Backup) SetAvailabilityZone(v *string) { + o.AvailabilityZone = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Backup) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Backup) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Backup) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Backup) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *Backup) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Backup) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Backup) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Backup) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Backup) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Backup) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Backup) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *Backup) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Backup) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Backup) SetName(v *string) { + 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 +} + +// 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 +} + +// 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 +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Backup) SetSize(v *int64) { + o.Size = v +} + +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *Backup) GetSnapshotId() *string { + if o == nil || IsNil(o.SnapshotId) { + var ret *string + return ret + } + return o.SnapshotId +} + +// GetSnapshotIdOk returns a tuple with the SnapshotId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetSnapshotIdOk() (*string, bool) { + if o == nil || IsNil(o.SnapshotId) { + return nil, false + } + return o.SnapshotId, true +} + +// HasSnapshotId returns a boolean if a field has been set. +func (o *Backup) HasSnapshotId() bool { + if o != nil && !IsNil(o.SnapshotId) { + return true + } + + return false +} + +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *Backup) SetSnapshotId(v *string) { + o.SnapshotId = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Backup) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// 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 *Backup) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Backup) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Backup) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Backup) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Backup) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Backup) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *Backup) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + return o.VolumeId +} + +// 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 *Backup) GetVolumeIdOk() (*string, bool) { + if o == nil || IsNil(o.VolumeId) { + return nil, false + } + return o.VolumeId, true +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *Backup) HasVolumeId() bool { + if o != nil && !IsNil(o.VolumeId) { + return true + } + + return false +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *Backup) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o Backup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvailabilityZone) { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.SnapshotId) { + toSerialize["snapshotId"] = o.SnapshotId + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + if !IsNil(o.VolumeId) { + toSerialize["volumeId"] = o.VolumeId + } + return toSerialize, nil +} + +type NullableBackup struct { + value *Backup + isSet bool +} + +func (v NullableBackup) Get() *Backup { + return v.value +} + +func (v *NullableBackup) Set(val *Backup) { + v.value = val + v.isSet = true +} + +func (v NullableBackup) IsSet() bool { + return v.isSet +} + +func (v *NullableBackup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackup(val *Backup) *NullableBackup { + return &NullableBackup{value: val, isSet: true} +} + +func (v NullableBackup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_backup_list_response.go b/services/iaas/model_backup_list_response.go new file mode 100644 index 00000000..eac2a32a --- /dev/null +++ b/services/iaas/model_backup_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BackupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupListResponse{} + +// BackupListResponse Backup list response. +type BackupListResponse struct { + // A list containing backup objects. + // REQUIRED + Items *[]Backup `json:"items"` +} + +type _BackupListResponse BackupListResponse + +// NewBackupListResponse instantiates a new BackupListResponse 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 NewBackupListResponse(items *[]Backup) *BackupListResponse { + this := BackupListResponse{} + this.Items = items + return &this +} + +// NewBackupListResponseWithDefaults instantiates a new BackupListResponse 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 NewBackupListResponseWithDefaults() *BackupListResponse { + this := BackupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *BackupListResponse) GetItems() *[]Backup { + if o == nil || IsNil(o.Items) { + var ret *[]Backup + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *BackupListResponse) GetItemsOk() (*[]Backup, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *BackupListResponse) SetItems(v *[]Backup) { + o.Items = v +} + +func (o BackupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableBackupListResponse struct { + value *BackupListResponse + isSet bool +} + +func (v NullableBackupListResponse) Get() *BackupListResponse { + return v.value +} + +func (v *NullableBackupListResponse) Set(val *BackupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBackupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupListResponse(val *BackupListResponse) *NullableBackupListResponse { + return &NullableBackupListResponse{value: val, isSet: true} +} + +func (v NullableBackupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_backup_source.go b/services/iaas/model_backup_source.go new file mode 100644 index 00000000..bb40f8c4 --- /dev/null +++ b/services/iaas/model_backup_source.go @@ -0,0 +1,140 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BackupSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupSource{} + +// BackupSource The source object of a backup. +type BackupSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id *string `json:"id"` + // The source types of a backup. + // REQUIRED + Type *string `json:"type"` +} + +type _BackupSource BackupSource + +// NewBackupSource instantiates a new BackupSource 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 NewBackupSource(id *string, type_ *string) *BackupSource { + this := BackupSource{} + this.Id = id + this.Type = type_ + return &this +} + +// NewBackupSourceWithDefaults instantiates a new BackupSource 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 NewBackupSourceWithDefaults() *BackupSource { + this := BackupSource{} + return &this +} + +// GetId returns the Id field value +func (o *BackupSource) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *BackupSource) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *BackupSource) SetId(v *string) { + o.Id = v +} + +// GetType returns the Type field value +func (o *BackupSource) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BackupSource) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *BackupSource) SetType(v *string) { + o.Type = v +} + +func (o BackupSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableBackupSource struct { + value *BackupSource + isSet bool +} + +func (v NullableBackupSource) Get() *BackupSource { + return v.value +} + +func (v *NullableBackupSource) Set(val *BackupSource) { + v.value = val + v.isSet = true +} + +func (v NullableBackupSource) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupSource(val *BackupSource) *NullableBackupSource { + return &NullableBackupSource{value: val, isSet: true} +} + +func (v NullableBackupSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_base_security_group_rule.go b/services/iaas/model_base_security_group_rule.go index 9f3e03fe..bce790e9 100644 --- a/services/iaas/model_base_security_group_rule.go +++ b/services/iaas/model_base_security_group_rule.go @@ -96,7 +96,7 @@ func (o *BaseSecurityGroupRule) SetDescription(v *string) { // GetDirection returns the Direction field value func (o *BaseSecurityGroupRule) GetDirection() *string { - if o == nil { + if o == nil || IsNil(o.Direction) { var ret *string return ret } diff --git a/services/iaas/model_boot_volume_source.go b/services/iaas/model_boot_volume_source.go index d89bad49..0b6dbe85 100644 --- a/services/iaas/model_boot_volume_source.go +++ b/services/iaas/model_boot_volume_source.go @@ -50,7 +50,7 @@ func NewBootVolumeSourceWithDefaults() *BootVolumeSource { // GetId returns the Id field value func (o *BootVolumeSource) GetId() *string { - if o == nil { + if o == nil || IsNil(o.Id) { var ret *string return ret } @@ -74,7 +74,7 @@ func (o *BootVolumeSource) SetId(v *string) { // GetType returns the Type field value func (o *BootVolumeSource) GetType() *string { - if o == nil { + if o == nil || IsNil(o.Type) { var ret *string return ret } diff --git a/services/iaas/model_create_affinity_group_payload.go b/services/iaas/model_create_affinity_group_payload.go new file mode 100644 index 00000000..1f9d1132 --- /dev/null +++ b/services/iaas/model_create_affinity_group_payload.go @@ -0,0 +1,214 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateAffinityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAffinityGroupPayload{} + +// CreateAffinityGroupPayload Definition of an affinity group. +type CreateAffinityGroupPayload struct { + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // The servers that are part of the affinity group. + Members *[]string `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // The affinity group policy. + // REQUIRED + Policy *string `json:"policy"` +} + +type _CreateAffinityGroupPayload CreateAffinityGroupPayload + +// NewCreateAffinityGroupPayload instantiates a new CreateAffinityGroupPayload 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 NewCreateAffinityGroupPayload(name *string, policy *string) *CreateAffinityGroupPayload { + this := CreateAffinityGroupPayload{} + this.Name = name + this.Policy = policy + return &this +} + +// NewCreateAffinityGroupPayloadWithDefaults instantiates a new CreateAffinityGroupPayload 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 NewCreateAffinityGroupPayloadWithDefaults() *CreateAffinityGroupPayload { + this := CreateAffinityGroupPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateAffinityGroupPayload) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *CreateAffinityGroupPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateAffinityGroupPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateAffinityGroupPayload) SetId(v *string) { + o.Id = v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *CreateAffinityGroupPayload) GetMembers() *[]string { + if o == nil || IsNil(o.Members) { + var ret *[]string + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetMembersOk() (*[]string, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *CreateAffinityGroupPayload) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *CreateAffinityGroupPayload) SetMembers(v *[]string) { + o.Members = v +} + +// GetName returns the Name field value +func (o *CreateAffinityGroupPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CreateAffinityGroupPayload) SetName(v *string) { + o.Name = v +} + +// GetPolicy returns the Policy field value +func (o *CreateAffinityGroupPayload) GetPolicy() *string { + if o == nil || IsNil(o.Policy) { + var ret *string + return ret + } + + return o.Policy +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetPolicyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Policy, true +} + +// SetPolicy sets field value +func (o *CreateAffinityGroupPayload) SetPolicy(v *string) { + o.Policy = v +} + +func (o CreateAffinityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + toSerialize["name"] = o.Name + toSerialize["policy"] = o.Policy + return toSerialize, nil +} + +type NullableCreateAffinityGroupPayload struct { + value *CreateAffinityGroupPayload + isSet bool +} + +func (v NullableCreateAffinityGroupPayload) Get() *CreateAffinityGroupPayload { + return v.value +} + +func (v *NullableCreateAffinityGroupPayload) Set(val *CreateAffinityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAffinityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAffinityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAffinityGroupPayload(val *CreateAffinityGroupPayload) *NullableCreateAffinityGroupPayload { + return &NullableCreateAffinityGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateAffinityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAffinityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_area_ipv4.go b/services/iaas/model_create_area_ipv4.go index edb39185..283430dc 100644 --- a/services/iaas/model_create_area_ipv4.go +++ b/services/iaas/model_create_area_ipv4.go @@ -103,7 +103,7 @@ func (o *CreateAreaIPv4) SetDefaultNameservers(v *[]string) { // GetNetworkRanges returns the NetworkRanges field value func (o *CreateAreaIPv4) GetNetworkRanges() *[]NetworkRange { - if o == nil { + if o == nil || IsNil(o.NetworkRanges) { var ret *[]NetworkRange return ret } @@ -159,7 +159,7 @@ func (o *CreateAreaIPv4) SetRoutes(v *[]Route) { // GetTransferNetwork returns the TransferNetwork field value func (o *CreateAreaIPv4) GetTransferNetwork() *string { - if o == nil { + if o == nil || IsNil(o.TransferNetwork) { var ret *string return ret } diff --git a/services/iaas/model_create_backup_payload.go b/services/iaas/model_create_backup_payload.go new file mode 100644 index 00000000..d195676d --- /dev/null +++ b/services/iaas/model_create_backup_payload.go @@ -0,0 +1,184 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateBackupPayload{} + +// CreateBackupPayload Object that represents a backup create request body. +type CreateBackupPayload struct { + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // REQUIRED + Source *BackupSource `json:"source"` +} + +type _CreateBackupPayload CreateBackupPayload + +// NewCreateBackupPayload instantiates a new CreateBackupPayload 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 NewCreateBackupPayload(source *BackupSource) *CreateBackupPayload { + this := CreateBackupPayload{} + this.Source = source + return &this +} + +// NewCreateBackupPayloadWithDefaults instantiates a new CreateBackupPayload 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 NewCreateBackupPayloadWithDefaults() *CreateBackupPayload { + this := CreateBackupPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateBackupPayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateBackupPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateBackupPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateBackupPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *CreateBackupPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CreateBackupPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateBackupPayload) SetName(v *string) { + o.Name = v +} + +// GetSource returns the Source field value +func (o *CreateBackupPayload) GetSource() *BackupSource { + if o == nil || IsNil(o.Source) { + var ret *BackupSource + return ret + } + + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetSourceOk() (*BackupSource, bool) { + if o == nil { + return nil, false + } + return o.Source, true +} + +// SetSource sets field value +func (o *CreateBackupPayload) SetSource(v *BackupSource) { + o.Source = v +} + +func (o CreateBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["source"] = o.Source + return toSerialize, nil +} + +type NullableCreateBackupPayload struct { + value *CreateBackupPayload + isSet bool +} + +func (v NullableCreateBackupPayload) Get() *CreateBackupPayload { + return v.value +} + +func (v *NullableCreateBackupPayload) Set(val *CreateBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateBackupPayload(val *CreateBackupPayload) *NullableCreateBackupPayload { + return &NullableCreateBackupPayload{value: val, isSet: true} +} + +func (v NullableCreateBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_image_payload.go b/services/iaas/model_create_image_payload.go new file mode 100644 index 00000000..118ab95c --- /dev/null +++ b/services/iaas/model_create_image_payload.go @@ -0,0 +1,582 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateImagePayload{} + +// CreateImagePayload Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type CreateImagePayload struct { + Checksum *ImageChecksum `json:"checksum,omitempty"` + Config *ImageConfig `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Object that represents a disk format. + // REQUIRED + DiskFormat *string `json:"diskFormat"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize *int64 `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam *int64 `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // Universally Unique Identifier (UUID). + Owner *string `json:"owner,omitempty"` + Protected *bool `json:"protected,omitempty"` + // Scope of an Image. + Scope *string `json:"scope,omitempty"` + // The status of an image object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _CreateImagePayload CreateImagePayload + +// NewCreateImagePayload instantiates a new CreateImagePayload 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 NewCreateImagePayload(diskFormat *string, name *string) *CreateImagePayload { + this := CreateImagePayload{} + this.DiskFormat = diskFormat + this.Name = name + return &this +} + +// NewCreateImagePayloadWithDefaults instantiates a new CreateImagePayload 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 NewCreateImagePayloadWithDefaults() *CreateImagePayload { + this := CreateImagePayload{} + return &this +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *CreateImagePayload) GetChecksum() *ImageChecksum { + if o == nil || IsNil(o.Checksum) { + var ret *ImageChecksum + return ret + } + return o.Checksum +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetChecksumOk() (*ImageChecksum, bool) { + if o == nil || IsNil(o.Checksum) { + return nil, false + } + return o.Checksum, true +} + +// HasChecksum returns a boolean if a field has been set. +func (o *CreateImagePayload) HasChecksum() bool { + if o != nil && !IsNil(o.Checksum) { + return true + } + + return false +} + +// SetChecksum gets a reference to the given ImageChecksum and assigns it to the Checksum field. +func (o *CreateImagePayload) SetChecksum(v *ImageChecksum) { + o.Checksum = v +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *CreateImagePayload) GetConfig() *ImageConfig { + if o == nil || IsNil(o.Config) { + var ret *ImageConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *CreateImagePayload) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *CreateImagePayload) SetConfig(v *ImageConfig) { + o.Config = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateImagePayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDiskFormat returns the DiskFormat field value +func (o *CreateImagePayload) GetDiskFormat() *string { + if o == nil || IsNil(o.DiskFormat) { + var ret *string + return ret + } + + return o.DiskFormat +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetDiskFormatOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DiskFormat, true +} + +// SetDiskFormat sets field value +func (o *CreateImagePayload) SetDiskFormat(v *string) { + o.DiskFormat = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateImagePayload) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *CreateImagePayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateImagePayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateImagePayload) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateImagePayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateImagePayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateImagePayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinDiskSize() *int64 { + if o == nil || IsNil(o.MinDiskSize) { + var ret *int64 + return ret + } + return o.MinDiskSize +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinDiskSizeOk() (*int64, bool) { + if o == nil || IsNil(o.MinDiskSize) { + return nil, false + } + return o.MinDiskSize, true +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinDiskSize() bool { + if o != nil && !IsNil(o.MinDiskSize) { + return true + } + + return false +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *CreateImagePayload) SetMinDiskSize(v *int64) { + o.MinDiskSize = v +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinRam() *int64 { + if o == nil || IsNil(o.MinRam) { + var ret *int64 + return ret + } + return o.MinRam +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinRamOk() (*int64, bool) { + if o == nil || IsNil(o.MinRam) { + return nil, false + } + return o.MinRam, true +} + +// HasMinRam returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinRam() bool { + if o != nil && !IsNil(o.MinRam) { + return true + } + + return false +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *CreateImagePayload) SetMinRam(v *int64) { + o.MinRam = v +} + +// GetName returns the Name field value +func (o *CreateImagePayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CreateImagePayload) SetName(v *string) { + o.Name = v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *CreateImagePayload) GetOwner() *string { + if o == nil || IsNil(o.Owner) { + var ret *string + return ret + } + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetOwnerOk() (*string, bool) { + if o == nil || IsNil(o.Owner) { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *CreateImagePayload) HasOwner() bool { + if o != nil && !IsNil(o.Owner) { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *CreateImagePayload) SetOwner(v *string) { + o.Owner = v +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *CreateImagePayload) GetProtected() *bool { + if o == nil || IsNil(o.Protected) { + var ret *bool + return ret + } + return o.Protected +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetProtectedOk() (*bool, bool) { + if o == nil || IsNil(o.Protected) { + return nil, false + } + return o.Protected, true +} + +// HasProtected returns a boolean if a field has been set. +func (o *CreateImagePayload) HasProtected() bool { + if o != nil && !IsNil(o.Protected) { + return true + } + + return false +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *CreateImagePayload) SetProtected(v *bool) { + o.Protected = v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *CreateImagePayload) GetScope() *string { + if o == nil || IsNil(o.Scope) { + var ret *string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetScopeOk() (*string, bool) { + if o == nil || IsNil(o.Scope) { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *CreateImagePayload) HasScope() bool { + if o != nil && !IsNil(o.Scope) { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *CreateImagePayload) SetScope(v *string) { + o.Scope = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateImagePayload) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// 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 *CreateImagePayload) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateImagePayload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateImagePayload) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateImagePayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o CreateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Checksum) { + toSerialize["checksum"] = o.Checksum + } + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + toSerialize["diskFormat"] = o.DiskFormat + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.MinDiskSize) { + toSerialize["minDiskSize"] = o.MinDiskSize + } + if !IsNil(o.MinRam) { + toSerialize["minRam"] = o.MinRam + } + toSerialize["name"] = o.Name + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } + if !IsNil(o.Protected) { + toSerialize["protected"] = o.Protected + } + if !IsNil(o.Scope) { + toSerialize["scope"] = o.Scope + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableCreateImagePayload struct { + value *CreateImagePayload + isSet bool +} + +func (v NullableCreateImagePayload) Get() *CreateImagePayload { + return v.value +} + +func (v *NullableCreateImagePayload) Set(val *CreateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateImagePayload(val *CreateImagePayload) *NullableCreateImagePayload { + return &NullableCreateImagePayload{value: val, isSet: true} +} + +func (v NullableCreateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_key_pair_payload.go b/services/iaas/model_create_key_pair_payload.go index cee140a2..7375ba88 100644 --- a/services/iaas/model_create_key_pair_payload.go +++ b/services/iaas/model_create_key_pair_payload.go @@ -185,7 +185,7 @@ func (o *CreateKeyPairPayload) SetName(v *string) { // GetPublicKey returns the PublicKey field value func (o *CreateKeyPairPayload) GetPublicKey() *string { - if o == nil { + if o == nil || IsNil(o.PublicKey) { var ret *string return ret } diff --git a/services/iaas/model_create_network_area_payload.go b/services/iaas/model_create_network_area_payload.go index b05d3a58..6b09cfc2 100644 --- a/services/iaas/model_create_network_area_payload.go +++ b/services/iaas/model_create_network_area_payload.go @@ -51,7 +51,7 @@ func NewCreateNetworkAreaPayloadWithDefaults() *CreateNetworkAreaPayload { // GetAddressFamily returns the AddressFamily field value func (o *CreateNetworkAreaPayload) GetAddressFamily() *CreateAreaAddressFamily { - if o == nil { + if o == nil || IsNil(o.AddressFamily) { var ret *CreateAreaAddressFamily return ret } @@ -107,7 +107,7 @@ func (o *CreateNetworkAreaPayload) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *CreateNetworkAreaPayload) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_create_network_ipv4_body.go b/services/iaas/model_create_network_ipv4_body.go index 77af598d..cf1a8ad4 100644 --- a/services/iaas/model_create_network_ipv4_body.go +++ b/services/iaas/model_create_network_ipv4_body.go @@ -47,7 +47,7 @@ func NewCreateNetworkIPv4BodyWithDefaults() *CreateNetworkIPv4Body { // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). func (o *CreateNetworkIPv4Body) GetGateway() *string { - if o == nil || IsNil(o.Gateway.Get()) { + if o == nil || IsNil(o.Gateway) || IsNil(o.Gateway.Get()) { var ret *string return ret } @@ -58,7 +58,7 @@ func (o *CreateNetworkIPv4Body) GetGateway() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateNetworkIPv4Body) GetGatewayOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Gateway) { return nil, false } return o.Gateway.Get(), o.Gateway.IsSet() @@ -66,7 +66,7 @@ func (o *CreateNetworkIPv4Body) GetGatewayOk() (*string, bool) { // HasGateway returns a boolean if a field has been set. func (o *CreateNetworkIPv4Body) HasGateway() bool { - if o != nil && o.Gateway.IsSet() { + if o != nil && !IsNil(o.Gateway) && o.Gateway.IsSet() { return true } @@ -75,16 +75,25 @@ func (o *CreateNetworkIPv4Body) HasGateway() bool { // SetGateway gets a reference to the given string and assigns it to the Gateway field. func (o *CreateNetworkIPv4Body) SetGateway(v *string) { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(v) } // SetGatewayNil sets the value for Gateway to be an explicit nil func (o *CreateNetworkIPv4Body) SetGatewayNil() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(nil) } // UnsetGateway ensures that no value is present for Gateway, not even an explicit nil func (o *CreateNetworkIPv4Body) UnsetGateway() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Unset() } diff --git a/services/iaas/model_create_network_ipv6_body.go b/services/iaas/model_create_network_ipv6_body.go index d3fd0b2a..66f52b64 100644 --- a/services/iaas/model_create_network_ipv6_body.go +++ b/services/iaas/model_create_network_ipv6_body.go @@ -47,7 +47,7 @@ func NewCreateNetworkIPv6BodyWithDefaults() *CreateNetworkIPv6Body { // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). func (o *CreateNetworkIPv6Body) GetGateway() *string { - if o == nil || IsNil(o.Gateway.Get()) { + if o == nil || IsNil(o.Gateway) || IsNil(o.Gateway.Get()) { var ret *string return ret } @@ -58,7 +58,7 @@ func (o *CreateNetworkIPv6Body) GetGateway() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateNetworkIPv6Body) GetGatewayOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Gateway) { return nil, false } return o.Gateway.Get(), o.Gateway.IsSet() @@ -66,7 +66,7 @@ func (o *CreateNetworkIPv6Body) GetGatewayOk() (*string, bool) { // HasGateway returns a boolean if a field has been set. func (o *CreateNetworkIPv6Body) HasGateway() bool { - if o != nil && o.Gateway.IsSet() { + if o != nil && !IsNil(o.Gateway) && o.Gateway.IsSet() { return true } @@ -75,16 +75,25 @@ func (o *CreateNetworkIPv6Body) HasGateway() bool { // SetGateway gets a reference to the given string and assigns it to the Gateway field. func (o *CreateNetworkIPv6Body) SetGateway(v *string) { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(v) } // SetGatewayNil sets the value for Gateway to be an explicit nil func (o *CreateNetworkIPv6Body) SetGatewayNil() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(nil) } // UnsetGateway ensures that no value is present for Gateway, not even an explicit nil func (o *CreateNetworkIPv6Body) UnsetGateway() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Unset() } diff --git a/services/iaas/model_create_network_payload.go b/services/iaas/model_create_network_payload.go index 6cc8b548..3681ff3a 100644 --- a/services/iaas/model_create_network_payload.go +++ b/services/iaas/model_create_network_payload.go @@ -115,7 +115,7 @@ func (o *CreateNetworkPayload) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *CreateNetworkPayload) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_create_public_ip_payload.go b/services/iaas/model_create_public_ip_payload.go index c1d12ac7..be131c15 100644 --- a/services/iaas/model_create_public_ip_payload.go +++ b/services/iaas/model_create_public_ip_payload.go @@ -144,7 +144,7 @@ func (o *CreatePublicIPPayload) SetLabels(v *map[string]interface{}) { // GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). func (o *CreatePublicIPPayload) GetNetworkInterface() *string { - if o == nil || IsNil(o.NetworkInterface.Get()) { + if o == nil || IsNil(o.NetworkInterface) || IsNil(o.NetworkInterface.Get()) { var ret *string return ret } @@ -155,7 +155,7 @@ func (o *CreatePublicIPPayload) GetNetworkInterface() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreatePublicIPPayload) GetNetworkInterfaceOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NetworkInterface) { return nil, false } return o.NetworkInterface.Get(), o.NetworkInterface.IsSet() @@ -163,7 +163,7 @@ func (o *CreatePublicIPPayload) GetNetworkInterfaceOk() (*string, bool) { // HasNetworkInterface returns a boolean if a field has been set. func (o *CreatePublicIPPayload) HasNetworkInterface() bool { - if o != nil && o.NetworkInterface.IsSet() { + if o != nil && !IsNil(o.NetworkInterface) && o.NetworkInterface.IsSet() { return true } @@ -172,16 +172,25 @@ func (o *CreatePublicIPPayload) HasNetworkInterface() bool { // SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. func (o *CreatePublicIPPayload) SetNetworkInterface(v *string) { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Set(v) } // SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil func (o *CreatePublicIPPayload) SetNetworkInterfaceNil() { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Set(nil) } // UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil func (o *CreatePublicIPPayload) UnsetNetworkInterface() { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Unset() } diff --git a/services/iaas/model_create_security_group_payload.go b/services/iaas/model_create_security_group_payload.go index 65cc2113..6f6acba9 100644 --- a/services/iaas/model_create_security_group_payload.go +++ b/services/iaas/model_create_security_group_payload.go @@ -193,7 +193,7 @@ func (o *CreateSecurityGroupPayload) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *CreateSecurityGroupPayload) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_create_security_group_rule_payload.go b/services/iaas/model_create_security_group_rule_payload.go index 8038a45b..a9ef31b4 100644 --- a/services/iaas/model_create_security_group_rule_payload.go +++ b/services/iaas/model_create_security_group_rule_payload.go @@ -97,7 +97,7 @@ func (o *CreateSecurityGroupRulePayload) SetDescription(v *string) { // GetDirection returns the Direction field value func (o *CreateSecurityGroupRulePayload) GetDirection() *string { - if o == nil { + if o == nil || IsNil(o.Direction) { var ret *string return ret } diff --git a/services/iaas/model_create_server_payload.go b/services/iaas/model_create_server_payload.go index a5e91a8d..5bed30b1 100644 --- a/services/iaas/model_create_server_payload.go +++ b/services/iaas/model_create_server_payload.go @@ -408,7 +408,7 @@ func (o *CreateServerPayload) SetLaunchedAt(v *time.Time) { // GetMachineType returns the MachineType field value func (o *CreateServerPayload) GetMachineType() *string { - if o == nil { + if o == nil || IsNil(o.MachineType) { var ret *string return ret } @@ -464,7 +464,7 @@ func (o *CreateServerPayload) SetMaintenanceWindow(v *ServerMaintenance) { // GetName returns the Name field value func (o *CreateServerPayload) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_create_snapshot_payload.go b/services/iaas/model_create_snapshot_payload.go new file mode 100644 index 00000000..8ceeae25 --- /dev/null +++ b/services/iaas/model_create_snapshot_payload.go @@ -0,0 +1,371 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSnapshotPayload{} + +// CreateSnapshotPayload Object that represents a snapshot. +type CreateSnapshotPayload struct { + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + // The status of a snapshot object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + VolumeId *string `json:"volumeId"` +} + +type _CreateSnapshotPayload CreateSnapshotPayload + +// NewCreateSnapshotPayload instantiates a new CreateSnapshotPayload 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 NewCreateSnapshotPayload(volumeId *string) *CreateSnapshotPayload { + this := CreateSnapshotPayload{} + this.VolumeId = volumeId + return &this +} + +// NewCreateSnapshotPayloadWithDefaults instantiates a new CreateSnapshotPayload 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 NewCreateSnapshotPayloadWithDefaults() *CreateSnapshotPayload { + this := CreateSnapshotPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateSnapshotPayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *CreateSnapshotPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSnapshotPayload) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateSnapshotPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *CreateSnapshotPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateSnapshotPayload) SetName(v *string) { + o.Name = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// 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 *CreateSnapshotPayload) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateSnapshotPayload) SetSize(v *int64) { + o.Size = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// 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 *CreateSnapshotPayload) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateSnapshotPayload) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateSnapshotPayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +// GetVolumeId returns the VolumeId field value +func (o *CreateSnapshotPayload) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + + return o.VolumeId +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetVolumeIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VolumeId, true +} + +// SetVolumeId sets field value +func (o *CreateSnapshotPayload) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o CreateSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + toSerialize["volumeId"] = o.VolumeId + return toSerialize, nil +} + +type NullableCreateSnapshotPayload struct { + value *CreateSnapshotPayload + isSet bool +} + +func (v NullableCreateSnapshotPayload) Get() *CreateSnapshotPayload { + return v.value +} + +func (v *NullableCreateSnapshotPayload) Set(val *CreateSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSnapshotPayload(val *CreateSnapshotPayload) *NullableCreateSnapshotPayload { + return &NullableCreateSnapshotPayload{value: val, isSet: true} +} + +func (v NullableCreateSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_volume_payload.go b/services/iaas/model_create_volume_payload.go index f295bd00..10f332e8 100644 --- a/services/iaas/model_create_volume_payload.go +++ b/services/iaas/model_create_volume_payload.go @@ -30,7 +30,8 @@ type CreateVolumePayload struct { // Description Object. Allows string up to 127 Characters. Description *string `json:"description,omitempty"` // Universally Unique Identifier (UUID). - Id *string `json:"id,omitempty"` + Id *string `json:"id,omitempty"` + ImageConfig *ImageConfig `json:"imageConfig,omitempty"` // Object that represents the labels of an object. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. @@ -70,7 +71,7 @@ func NewCreateVolumePayloadWithDefaults() *CreateVolumePayload { // GetAvailabilityZone returns the AvailabilityZone field value func (o *CreateVolumePayload) GetAvailabilityZone() *string { - if o == nil { + if o == nil || IsNil(o.AvailabilityZone) { var ret *string return ret } @@ -220,6 +221,38 @@ func (o *CreateVolumePayload) SetId(v *string) { o.Id = v } +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetImageConfig() *ImageConfig { + if o == nil || IsNil(o.ImageConfig) { + var ret *ImageConfig + return ret + } + return o.ImageConfig +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetImageConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.ImageConfig) { + return nil, false + } + return o.ImageConfig, true +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasImageConfig() bool { + if o != nil && !IsNil(o.ImageConfig) { + return true + } + + return false +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *CreateVolumePayload) SetImageConfig(v *ImageConfig) { + o.ImageConfig = v +} + // GetLabels returns the Labels field value if set, zero value otherwise. func (o *CreateVolumePayload) GetLabels() *map[string]interface{} { if o == nil || IsNil(o.Labels) { @@ -491,6 +524,9 @@ func (o CreateVolumePayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Id) { toSerialize["id"] = o.Id } + if !IsNil(o.ImageConfig) { + toSerialize["imageConfig"] = o.ImageConfig + } if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } diff --git a/services/iaas/model_error.go b/services/iaas/model_error.go index 1b134c61..61ea45dc 100644 --- a/services/iaas/model_error.go +++ b/services/iaas/model_error.go @@ -49,7 +49,7 @@ func NewErrorWithDefaults() *Error { // GetCode returns the Code field value func (o *Error) GetCode() *int64 { - if o == nil { + if o == nil || IsNil(o.Code) { var ret *int64 return ret } @@ -73,7 +73,7 @@ func (o *Error) SetCode(v *int64) { // GetMsg returns the Msg field value func (o *Error) GetMsg() *string { - if o == nil { + if o == nil || IsNil(o.Msg) { var ret *string return ret } diff --git a/services/iaas/model_get_server_log_request.go b/services/iaas/model_get_server_log_request.go deleted file mode 100644 index aaf3ac84..00000000 --- a/services/iaas/model_get_server_log_request.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -IaaS-API - -This API allows you to create and modify IaaS resources. - -API version: 1beta1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package iaas - -import ( - "encoding/json" -) - -// checks if the GetServerLogRequest type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &GetServerLogRequest{} - -// GetServerLogRequest struct for GetServerLogRequest -type GetServerLogRequest struct { - // Set to 0 to retrieve the complete log. - Length *int64 `json:"length,omitempty"` -} - -// NewGetServerLogRequest instantiates a new GetServerLogRequest 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 NewGetServerLogRequest() *GetServerLogRequest { - this := GetServerLogRequest{} - var length int64 = 2000 - this.Length = &length - return &this -} - -// NewGetServerLogRequestWithDefaults instantiates a new GetServerLogRequest 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 NewGetServerLogRequestWithDefaults() *GetServerLogRequest { - this := GetServerLogRequest{} - var length int64 = 2000 - this.Length = &length - return &this -} - -// GetLength returns the Length field value if set, zero value otherwise. -func (o *GetServerLogRequest) GetLength() *int64 { - if o == nil || IsNil(o.Length) { - var ret *int64 - return ret - } - return o.Length -} - -// GetLengthOk returns a tuple with the Length field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GetServerLogRequest) GetLengthOk() (*int64, bool) { - if o == nil || IsNil(o.Length) { - return nil, false - } - return o.Length, true -} - -// HasLength returns a boolean if a field has been set. -func (o *GetServerLogRequest) HasLength() bool { - if o != nil && !IsNil(o.Length) { - return true - } - - return false -} - -// SetLength gets a reference to the given int64 and assigns it to the Length field. -func (o *GetServerLogRequest) SetLength(v *int64) { - o.Length = v -} - -func (o GetServerLogRequest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Length) { - toSerialize["length"] = o.Length - } - return toSerialize, nil -} - -type NullableGetServerLogRequest struct { - value *GetServerLogRequest - isSet bool -} - -func (v NullableGetServerLogRequest) Get() *GetServerLogRequest { - return v.value -} - -func (v *NullableGetServerLogRequest) Set(val *GetServerLogRequest) { - v.value = val - v.isSet = true -} - -func (v NullableGetServerLogRequest) IsSet() bool { - return v.isSet -} - -func (v *NullableGetServerLogRequest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableGetServerLogRequest(val *GetServerLogRequest) *NullableGetServerLogRequest { - return &NullableGetServerLogRequest{value: val, isSet: true} -} - -func (v NullableGetServerLogRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableGetServerLogRequest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/iaas/model_icmp_parameters.go b/services/iaas/model_icmp_parameters.go index a36d4de8..93ba53e9 100644 --- a/services/iaas/model_icmp_parameters.go +++ b/services/iaas/model_icmp_parameters.go @@ -50,7 +50,7 @@ func NewICMPParametersWithDefaults() *ICMPParameters { // GetCode returns the Code field value func (o *ICMPParameters) GetCode() *int64 { - if o == nil { + if o == nil || IsNil(o.Code) { var ret *int64 return ret } @@ -74,7 +74,7 @@ func (o *ICMPParameters) SetCode(v *int64) { // GetType returns the Type field value func (o *ICMPParameters) GetType() *int64 { - if o == nil { + if o == nil || IsNil(o.Type) { var ret *int64 return ret } diff --git a/services/iaas/model_image.go b/services/iaas/model_image.go new file mode 100644 index 00000000..6d1bf223 --- /dev/null +++ b/services/iaas/model_image.go @@ -0,0 +1,582 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Image type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Image{} + +// Image Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type Image struct { + Checksum *ImageChecksum `json:"checksum,omitempty"` + Config *ImageConfig `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Object that represents a disk format. + // REQUIRED + DiskFormat *string `json:"diskFormat"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize *int64 `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam *int64 `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // Universally Unique Identifier (UUID). + Owner *string `json:"owner,omitempty"` + Protected *bool `json:"protected,omitempty"` + // Scope of an Image. + Scope *string `json:"scope,omitempty"` + // The status of an image object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _Image Image + +// NewImage instantiates a new Image 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 NewImage(diskFormat *string, name *string) *Image { + this := Image{} + this.DiskFormat = diskFormat + this.Name = name + return &this +} + +// NewImageWithDefaults instantiates a new Image 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 NewImageWithDefaults() *Image { + this := Image{} + return &this +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *Image) GetChecksum() *ImageChecksum { + if o == nil || IsNil(o.Checksum) { + var ret *ImageChecksum + return ret + } + return o.Checksum +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetChecksumOk() (*ImageChecksum, bool) { + if o == nil || IsNil(o.Checksum) { + return nil, false + } + return o.Checksum, true +} + +// HasChecksum returns a boolean if a field has been set. +func (o *Image) HasChecksum() bool { + if o != nil && !IsNil(o.Checksum) { + return true + } + + return false +} + +// SetChecksum gets a reference to the given ImageChecksum and assigns it to the Checksum field. +func (o *Image) SetChecksum(v *ImageChecksum) { + o.Checksum = v +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *Image) GetConfig() *ImageConfig { + if o == nil || IsNil(o.Config) { + var ret *ImageConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *Image) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *Image) SetConfig(v *ImageConfig) { + o.Config = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Image) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Image) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Image) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDiskFormat returns the DiskFormat field value +func (o *Image) GetDiskFormat() *string { + if o == nil || IsNil(o.DiskFormat) { + var ret *string + return ret + } + + return o.DiskFormat +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *Image) GetDiskFormatOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DiskFormat, true +} + +// SetDiskFormat sets field value +func (o *Image) SetDiskFormat(v *string) { + o.DiskFormat = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Image) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *Image) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Image) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Image) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Image) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Image) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Image) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *Image) GetMinDiskSize() *int64 { + if o == nil || IsNil(o.MinDiskSize) { + var ret *int64 + return ret + } + return o.MinDiskSize +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinDiskSizeOk() (*int64, bool) { + if o == nil || IsNil(o.MinDiskSize) { + return nil, false + } + return o.MinDiskSize, true +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *Image) HasMinDiskSize() bool { + if o != nil && !IsNil(o.MinDiskSize) { + return true + } + + return false +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *Image) SetMinDiskSize(v *int64) { + o.MinDiskSize = v +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *Image) GetMinRam() *int64 { + if o == nil || IsNil(o.MinRam) { + var ret *int64 + return ret + } + return o.MinRam +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinRamOk() (*int64, bool) { + if o == nil || IsNil(o.MinRam) { + return nil, false + } + return o.MinRam, true +} + +// HasMinRam returns a boolean if a field has been set. +func (o *Image) HasMinRam() bool { + if o != nil && !IsNil(o.MinRam) { + return true + } + + return false +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *Image) SetMinRam(v *int64) { + o.MinRam = v +} + +// GetName returns the Name field value +func (o *Image) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Image) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *Image) SetName(v *string) { + o.Name = v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *Image) GetOwner() *string { + if o == nil || IsNil(o.Owner) { + var ret *string + return ret + } + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetOwnerOk() (*string, bool) { + if o == nil || IsNil(o.Owner) { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *Image) HasOwner() bool { + if o != nil && !IsNil(o.Owner) { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *Image) SetOwner(v *string) { + o.Owner = v +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *Image) GetProtected() *bool { + if o == nil || IsNil(o.Protected) { + var ret *bool + return ret + } + return o.Protected +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetProtectedOk() (*bool, bool) { + if o == nil || IsNil(o.Protected) { + return nil, false + } + return o.Protected, true +} + +// HasProtected returns a boolean if a field has been set. +func (o *Image) HasProtected() bool { + if o != nil && !IsNil(o.Protected) { + return true + } + + return false +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *Image) SetProtected(v *bool) { + o.Protected = v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *Image) GetScope() *string { + if o == nil || IsNil(o.Scope) { + var ret *string + return ret + } + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetScopeOk() (*string, bool) { + if o == nil || IsNil(o.Scope) { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *Image) HasScope() bool { + if o != nil && !IsNil(o.Scope) { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *Image) SetScope(v *string) { + o.Scope = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Image) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// 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 *Image) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Image) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Image) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Image) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Image) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Image) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o Image) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Checksum) { + toSerialize["checksum"] = o.Checksum + } + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + toSerialize["diskFormat"] = o.DiskFormat + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.MinDiskSize) { + toSerialize["minDiskSize"] = o.MinDiskSize + } + if !IsNil(o.MinRam) { + toSerialize["minRam"] = o.MinRam + } + toSerialize["name"] = o.Name + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } + if !IsNil(o.Protected) { + toSerialize["protected"] = o.Protected + } + if !IsNil(o.Scope) { + toSerialize["scope"] = o.Scope + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableImage struct { + value *Image + isSet bool +} + +func (v NullableImage) Get() *Image { + return v.value +} + +func (v *NullableImage) Set(val *Image) { + v.value = val + v.isSet = true +} + +func (v NullableImage) IsSet() bool { + return v.isSet +} + +func (v *NullableImage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImage(val *Image) *NullableImage { + return &NullableImage{value: val, isSet: true} +} + +func (v NullableImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_image_checksum.go b/services/iaas/model_image_checksum.go new file mode 100644 index 00000000..bfbe73eb --- /dev/null +++ b/services/iaas/model_image_checksum.go @@ -0,0 +1,140 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageChecksum type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageChecksum{} + +// ImageChecksum Representation of an image checksum. +type ImageChecksum struct { + // Algorithm for the checksum of the image data. + // REQUIRED + Algorithm *string `json:"algorithm"` + // Hexdigest of the checksum of the image data. + // REQUIRED + Digest *string `json:"digest"` +} + +type _ImageChecksum ImageChecksum + +// NewImageChecksum instantiates a new ImageChecksum 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 NewImageChecksum(algorithm *string, digest *string) *ImageChecksum { + this := ImageChecksum{} + this.Algorithm = algorithm + this.Digest = digest + return &this +} + +// NewImageChecksumWithDefaults instantiates a new ImageChecksum 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 NewImageChecksumWithDefaults() *ImageChecksum { + this := ImageChecksum{} + return &this +} + +// GetAlgorithm returns the Algorithm field value +func (o *ImageChecksum) GetAlgorithm() *string { + if o == nil || IsNil(o.Algorithm) { + var ret *string + return ret + } + + return o.Algorithm +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *ImageChecksum) GetAlgorithmOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Algorithm, true +} + +// SetAlgorithm sets field value +func (o *ImageChecksum) SetAlgorithm(v *string) { + o.Algorithm = v +} + +// GetDigest returns the Digest field value +func (o *ImageChecksum) GetDigest() *string { + if o == nil || IsNil(o.Digest) { + var ret *string + return ret + } + + return o.Digest +} + +// GetDigestOk returns a tuple with the Digest field value +// and a boolean to check if the value has been set. +func (o *ImageChecksum) GetDigestOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Digest, true +} + +// SetDigest sets field value +func (o *ImageChecksum) SetDigest(v *string) { + o.Digest = v +} + +func (o ImageChecksum) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["algorithm"] = o.Algorithm + toSerialize["digest"] = o.Digest + return toSerialize, nil +} + +type NullableImageChecksum struct { + value *ImageChecksum + isSet bool +} + +func (v NullableImageChecksum) Get() *ImageChecksum { + return v.value +} + +func (v *NullableImageChecksum) Set(val *ImageChecksum) { + v.value = val + v.isSet = true +} + +func (v NullableImageChecksum) IsSet() bool { + return v.isSet +} + +func (v *NullableImageChecksum) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageChecksum(val *ImageChecksum) *NullableImageChecksum { + return &NullableImageChecksum{value: val, isSet: true} +} + +func (v NullableImageChecksum) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageChecksum) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_image_config.go b/services/iaas/model_image_config.go new file mode 100644 index 00000000..484c0eb8 --- /dev/null +++ b/services/iaas/model_image_config.go @@ -0,0 +1,737 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageConfig{} + +// ImageConfig Properties to set hardware and scheduling settings for an Image. +type ImageConfig struct { + // Enables the BIOS bootmenu. + BootMenu *bool `json:"bootMenu,omitempty"` + // Sets CDROM bus controller type. + CdromBus *NullableString `json:"cdromBus,omitempty"` + // Sets Disk bus controller type. + DiskBus *NullableString `json:"diskBus,omitempty"` + // Sets virtual nic model. + NicModel *NullableString `json:"nicModel,omitempty"` + // Enables OS specific optimizations. + OperatingSystem *string `json:"operatingSystem,omitempty"` + // Operating System Distribution. + OperatingSystemDistro *NullableString `json:"operatingSystemDistro,omitempty"` + // Version of the OS. + OperatingSystemVersion *NullableString `json:"operatingSystemVersion,omitempty"` + // Sets the device bus when the image is used as a rescue image. + RescueBus *NullableString `json:"rescueBus,omitempty"` + // Sets the device when the image is used as a rescue image. + RescueDevice *NullableString `json:"rescueDevice,omitempty"` + // Enables Secure Boot. + SecureBoot *bool `json:"secureBoot,omitempty"` + // Enables UEFI boot. + Uefi *bool `json:"uefi,omitempty"` + // Sets Graphic device model. + VideoModel *NullableString `json:"videoModel,omitempty"` + // Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block. + VirtioScsi *bool `json:"virtioScsi,omitempty"` +} + +// NewImageConfig instantiates a new ImageConfig 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 NewImageConfig() *ImageConfig { + this := ImageConfig{} + var bootMenu bool = false + this.BootMenu = &bootMenu + var secureBoot bool = false + this.SecureBoot = &secureBoot + var uefi bool = false + this.Uefi = &uefi + var virtioScsi bool = false + this.VirtioScsi = &virtioScsi + return &this +} + +// NewImageConfigWithDefaults instantiates a new ImageConfig 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 NewImageConfigWithDefaults() *ImageConfig { + this := ImageConfig{} + var bootMenu bool = false + this.BootMenu = &bootMenu + var secureBoot bool = false + this.SecureBoot = &secureBoot + var uefi bool = false + this.Uefi = &uefi + var virtioScsi bool = false + this.VirtioScsi = &virtioScsi + return &this +} + +// GetBootMenu returns the BootMenu field value if set, zero value otherwise. +func (o *ImageConfig) GetBootMenu() *bool { + if o == nil || IsNil(o.BootMenu) { + var ret *bool + return ret + } + return o.BootMenu +} + +// GetBootMenuOk returns a tuple with the BootMenu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetBootMenuOk() (*bool, bool) { + if o == nil || IsNil(o.BootMenu) { + return nil, false + } + return o.BootMenu, true +} + +// HasBootMenu returns a boolean if a field has been set. +func (o *ImageConfig) HasBootMenu() bool { + if o != nil && !IsNil(o.BootMenu) { + return true + } + + return false +} + +// SetBootMenu gets a reference to the given bool and assigns it to the BootMenu field. +func (o *ImageConfig) SetBootMenu(v *bool) { + o.BootMenu = v +} + +// GetCdromBus returns the CdromBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetCdromBus() *string { + if o == nil || IsNil(o.CdromBus) || IsNil(o.CdromBus.Get()) { + var ret *string + return ret + } + return o.CdromBus.Get() +} + +// GetCdromBusOk returns a tuple with the CdromBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetCdromBusOk() (*string, bool) { + if o == nil || IsNil(o.CdromBus) { + return nil, false + } + return o.CdromBus.Get(), o.CdromBus.IsSet() +} + +// HasCdromBus returns a boolean if a field has been set. +func (o *ImageConfig) HasCdromBus() bool { + if o != nil && !IsNil(o.CdromBus) && o.CdromBus.IsSet() { + return true + } + + return false +} + +// SetCdromBus gets a reference to the given string and assigns it to the CdromBus field. +func (o *ImageConfig) SetCdromBus(v *string) { + if IsNil(o.CdromBus) { + o.CdromBus = new(NullableString) + } + o.CdromBus.Set(v) +} + +// SetCdromBusNil sets the value for CdromBus to be an explicit nil +func (o *ImageConfig) SetCdromBusNil() { + if IsNil(o.CdromBus) { + o.CdromBus = new(NullableString) + } + o.CdromBus.Set(nil) +} + +// UnsetCdromBus ensures that no value is present for CdromBus, not even an explicit nil +func (o *ImageConfig) UnsetCdromBus() { + if IsNil(o.CdromBus) { + o.CdromBus = new(NullableString) + } + o.CdromBus.Unset() +} + +// GetDiskBus returns the DiskBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetDiskBus() *string { + if o == nil || IsNil(o.DiskBus) || IsNil(o.DiskBus.Get()) { + var ret *string + return ret + } + return o.DiskBus.Get() +} + +// GetDiskBusOk returns a tuple with the DiskBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetDiskBusOk() (*string, bool) { + if o == nil || IsNil(o.DiskBus) { + return nil, false + } + return o.DiskBus.Get(), o.DiskBus.IsSet() +} + +// HasDiskBus returns a boolean if a field has been set. +func (o *ImageConfig) HasDiskBus() bool { + if o != nil && !IsNil(o.DiskBus) && o.DiskBus.IsSet() { + return true + } + + return false +} + +// SetDiskBus gets a reference to the given string and assigns it to the DiskBus field. +func (o *ImageConfig) SetDiskBus(v *string) { + if IsNil(o.DiskBus) { + o.DiskBus = new(NullableString) + } + o.DiskBus.Set(v) +} + +// SetDiskBusNil sets the value for DiskBus to be an explicit nil +func (o *ImageConfig) SetDiskBusNil() { + if IsNil(o.DiskBus) { + o.DiskBus = new(NullableString) + } + o.DiskBus.Set(nil) +} + +// UnsetDiskBus ensures that no value is present for DiskBus, not even an explicit nil +func (o *ImageConfig) UnsetDiskBus() { + if IsNil(o.DiskBus) { + o.DiskBus = new(NullableString) + } + o.DiskBus.Unset() +} + +// GetNicModel returns the NicModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetNicModel() *string { + if o == nil || IsNil(o.NicModel) || IsNil(o.NicModel.Get()) { + var ret *string + return ret + } + return o.NicModel.Get() +} + +// GetNicModelOk returns a tuple with the NicModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetNicModelOk() (*string, bool) { + if o == nil || IsNil(o.NicModel) { + return nil, false + } + return o.NicModel.Get(), o.NicModel.IsSet() +} + +// HasNicModel returns a boolean if a field has been set. +func (o *ImageConfig) HasNicModel() bool { + if o != nil && !IsNil(o.NicModel) && o.NicModel.IsSet() { + return true + } + + return false +} + +// SetNicModel gets a reference to the given string and assigns it to the NicModel field. +func (o *ImageConfig) SetNicModel(v *string) { + if IsNil(o.NicModel) { + o.NicModel = new(NullableString) + } + o.NicModel.Set(v) +} + +// SetNicModelNil sets the value for NicModel to be an explicit nil +func (o *ImageConfig) SetNicModelNil() { + if IsNil(o.NicModel) { + o.NicModel = new(NullableString) + } + o.NicModel.Set(nil) +} + +// UnsetNicModel ensures that no value is present for NicModel, not even an explicit nil +func (o *ImageConfig) UnsetNicModel() { + if IsNil(o.NicModel) { + o.NicModel = new(NullableString) + } + o.NicModel.Unset() +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *ImageConfig) GetOperatingSystem() *string { + if o == nil || IsNil(o.OperatingSystem) { + var ret *string + return ret + } + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetOperatingSystemOk() (*string, bool) { + if o == nil || IsNil(o.OperatingSystem) { + return nil, false + } + return o.OperatingSystem, true +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystem() bool { + if o != nil && !IsNil(o.OperatingSystem) { + return true + } + + return false +} + +// SetOperatingSystem gets a reference to the given string and assigns it to the OperatingSystem field. +func (o *ImageConfig) SetOperatingSystem(v *string) { + o.OperatingSystem = v +} + +// GetOperatingSystemDistro returns the OperatingSystemDistro field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemDistro() *string { + if o == nil || IsNil(o.OperatingSystemDistro) || IsNil(o.OperatingSystemDistro.Get()) { + var ret *string + return ret + } + return o.OperatingSystemDistro.Get() +} + +// GetOperatingSystemDistroOk returns a tuple with the OperatingSystemDistro field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemDistroOk() (*string, bool) { + if o == nil || IsNil(o.OperatingSystemDistro) { + return nil, false + } + return o.OperatingSystemDistro.Get(), o.OperatingSystemDistro.IsSet() +} + +// HasOperatingSystemDistro returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemDistro() bool { + if o != nil && !IsNil(o.OperatingSystemDistro) && o.OperatingSystemDistro.IsSet() { + return true + } + + return false +} + +// SetOperatingSystemDistro gets a reference to the given string and assigns it to the OperatingSystemDistro field. +func (o *ImageConfig) SetOperatingSystemDistro(v *string) { + if IsNil(o.OperatingSystemDistro) { + o.OperatingSystemDistro = new(NullableString) + } + o.OperatingSystemDistro.Set(v) +} + +// SetOperatingSystemDistroNil sets the value for OperatingSystemDistro to be an explicit nil +func (o *ImageConfig) SetOperatingSystemDistroNil() { + if IsNil(o.OperatingSystemDistro) { + o.OperatingSystemDistro = new(NullableString) + } + o.OperatingSystemDistro.Set(nil) +} + +// UnsetOperatingSystemDistro ensures that no value is present for OperatingSystemDistro, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemDistro() { + if IsNil(o.OperatingSystemDistro) { + o.OperatingSystemDistro = new(NullableString) + } + o.OperatingSystemDistro.Unset() +} + +// GetOperatingSystemVersion returns the OperatingSystemVersion field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemVersion() *string { + if o == nil || IsNil(o.OperatingSystemVersion) || IsNil(o.OperatingSystemVersion.Get()) { + var ret *string + return ret + } + return o.OperatingSystemVersion.Get() +} + +// GetOperatingSystemVersionOk returns a tuple with the OperatingSystemVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemVersionOk() (*string, bool) { + if o == nil || IsNil(o.OperatingSystemVersion) { + return nil, false + } + return o.OperatingSystemVersion.Get(), o.OperatingSystemVersion.IsSet() +} + +// HasOperatingSystemVersion returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemVersion() bool { + if o != nil && !IsNil(o.OperatingSystemVersion) && o.OperatingSystemVersion.IsSet() { + return true + } + + return false +} + +// SetOperatingSystemVersion gets a reference to the given string and assigns it to the OperatingSystemVersion field. +func (o *ImageConfig) SetOperatingSystemVersion(v *string) { + if IsNil(o.OperatingSystemVersion) { + o.OperatingSystemVersion = new(NullableString) + } + o.OperatingSystemVersion.Set(v) +} + +// SetOperatingSystemVersionNil sets the value for OperatingSystemVersion to be an explicit nil +func (o *ImageConfig) SetOperatingSystemVersionNil() { + if IsNil(o.OperatingSystemVersion) { + o.OperatingSystemVersion = new(NullableString) + } + o.OperatingSystemVersion.Set(nil) +} + +// UnsetOperatingSystemVersion ensures that no value is present for OperatingSystemVersion, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemVersion() { + if IsNil(o.OperatingSystemVersion) { + o.OperatingSystemVersion = new(NullableString) + } + o.OperatingSystemVersion.Unset() +} + +// GetRescueBus returns the RescueBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetRescueBus() *string { + if o == nil || IsNil(o.RescueBus) || IsNil(o.RescueBus.Get()) { + var ret *string + return ret + } + return o.RescueBus.Get() +} + +// GetRescueBusOk returns a tuple with the RescueBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueBusOk() (*string, bool) { + if o == nil || IsNil(o.RescueBus) { + return nil, false + } + return o.RescueBus.Get(), o.RescueBus.IsSet() +} + +// HasRescueBus returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueBus() bool { + if o != nil && !IsNil(o.RescueBus) && o.RescueBus.IsSet() { + return true + } + + return false +} + +// SetRescueBus gets a reference to the given string and assigns it to the RescueBus field. +func (o *ImageConfig) SetRescueBus(v *string) { + if IsNil(o.RescueBus) { + o.RescueBus = new(NullableString) + } + o.RescueBus.Set(v) +} + +// SetRescueBusNil sets the value for RescueBus to be an explicit nil +func (o *ImageConfig) SetRescueBusNil() { + if IsNil(o.RescueBus) { + o.RescueBus = new(NullableString) + } + o.RescueBus.Set(nil) +} + +// UnsetRescueBus ensures that no value is present for RescueBus, not even an explicit nil +func (o *ImageConfig) UnsetRescueBus() { + if IsNil(o.RescueBus) { + o.RescueBus = new(NullableString) + } + o.RescueBus.Unset() +} + +// GetRescueDevice returns the RescueDevice field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetRescueDevice() *string { + if o == nil || IsNil(o.RescueDevice) || IsNil(o.RescueDevice.Get()) { + var ret *string + return ret + } + return o.RescueDevice.Get() +} + +// GetRescueDeviceOk returns a tuple with the RescueDevice field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueDeviceOk() (*string, bool) { + if o == nil || IsNil(o.RescueDevice) { + return nil, false + } + return o.RescueDevice.Get(), o.RescueDevice.IsSet() +} + +// HasRescueDevice returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueDevice() bool { + if o != nil && !IsNil(o.RescueDevice) && o.RescueDevice.IsSet() { + return true + } + + return false +} + +// SetRescueDevice gets a reference to the given string and assigns it to the RescueDevice field. +func (o *ImageConfig) SetRescueDevice(v *string) { + if IsNil(o.RescueDevice) { + o.RescueDevice = new(NullableString) + } + o.RescueDevice.Set(v) +} + +// SetRescueDeviceNil sets the value for RescueDevice to be an explicit nil +func (o *ImageConfig) SetRescueDeviceNil() { + if IsNil(o.RescueDevice) { + o.RescueDevice = new(NullableString) + } + o.RescueDevice.Set(nil) +} + +// UnsetRescueDevice ensures that no value is present for RescueDevice, not even an explicit nil +func (o *ImageConfig) UnsetRescueDevice() { + if IsNil(o.RescueDevice) { + o.RescueDevice = new(NullableString) + } + o.RescueDevice.Unset() +} + +// GetSecureBoot returns the SecureBoot field value if set, zero value otherwise. +func (o *ImageConfig) GetSecureBoot() *bool { + if o == nil || IsNil(o.SecureBoot) { + var ret *bool + return ret + } + return o.SecureBoot +} + +// GetSecureBootOk returns a tuple with the SecureBoot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetSecureBootOk() (*bool, bool) { + if o == nil || IsNil(o.SecureBoot) { + return nil, false + } + return o.SecureBoot, true +} + +// HasSecureBoot returns a boolean if a field has been set. +func (o *ImageConfig) HasSecureBoot() bool { + if o != nil && !IsNil(o.SecureBoot) { + return true + } + + return false +} + +// SetSecureBoot gets a reference to the given bool and assigns it to the SecureBoot field. +func (o *ImageConfig) SetSecureBoot(v *bool) { + o.SecureBoot = v +} + +// GetUefi returns the Uefi field value if set, zero value otherwise. +func (o *ImageConfig) GetUefi() *bool { + if o == nil || IsNil(o.Uefi) { + var ret *bool + return ret + } + return o.Uefi +} + +// GetUefiOk returns a tuple with the Uefi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetUefiOk() (*bool, bool) { + if o == nil || IsNil(o.Uefi) { + return nil, false + } + return o.Uefi, true +} + +// HasUefi returns a boolean if a field has been set. +func (o *ImageConfig) HasUefi() bool { + if o != nil && !IsNil(o.Uefi) { + return true + } + + return false +} + +// SetUefi gets a reference to the given bool and assigns it to the Uefi field. +func (o *ImageConfig) SetUefi(v *bool) { + o.Uefi = v +} + +// GetVideoModel returns the VideoModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetVideoModel() *string { + if o == nil || IsNil(o.VideoModel) || IsNil(o.VideoModel.Get()) { + var ret *string + return ret + } + return o.VideoModel.Get() +} + +// GetVideoModelOk returns a tuple with the VideoModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetVideoModelOk() (*string, bool) { + if o == nil || IsNil(o.VideoModel) { + return nil, false + } + return o.VideoModel.Get(), o.VideoModel.IsSet() +} + +// HasVideoModel returns a boolean if a field has been set. +func (o *ImageConfig) HasVideoModel() bool { + if o != nil && !IsNil(o.VideoModel) && o.VideoModel.IsSet() { + return true + } + + return false +} + +// SetVideoModel gets a reference to the given string and assigns it to the VideoModel field. +func (o *ImageConfig) SetVideoModel(v *string) { + if IsNil(o.VideoModel) { + o.VideoModel = new(NullableString) + } + o.VideoModel.Set(v) +} + +// SetVideoModelNil sets the value for VideoModel to be an explicit nil +func (o *ImageConfig) SetVideoModelNil() { + if IsNil(o.VideoModel) { + o.VideoModel = new(NullableString) + } + o.VideoModel.Set(nil) +} + +// UnsetVideoModel ensures that no value is present for VideoModel, not even an explicit nil +func (o *ImageConfig) UnsetVideoModel() { + if IsNil(o.VideoModel) { + o.VideoModel = new(NullableString) + } + o.VideoModel.Unset() +} + +// GetVirtioScsi returns the VirtioScsi field value if set, zero value otherwise. +func (o *ImageConfig) GetVirtioScsi() *bool { + if o == nil || IsNil(o.VirtioScsi) { + var ret *bool + return ret + } + return o.VirtioScsi +} + +// GetVirtioScsiOk returns a tuple with the VirtioScsi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetVirtioScsiOk() (*bool, bool) { + if o == nil || IsNil(o.VirtioScsi) { + return nil, false + } + return o.VirtioScsi, true +} + +// HasVirtioScsi returns a boolean if a field has been set. +func (o *ImageConfig) HasVirtioScsi() bool { + if o != nil && !IsNil(o.VirtioScsi) { + return true + } + + return false +} + +// SetVirtioScsi gets a reference to the given bool and assigns it to the VirtioScsi field. +func (o *ImageConfig) SetVirtioScsi(v *bool) { + o.VirtioScsi = v +} + +func (o ImageConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BootMenu) { + toSerialize["bootMenu"] = o.BootMenu + } + if o.CdromBus.IsSet() { + toSerialize["cdromBus"] = o.CdromBus.Get() + } + if o.DiskBus.IsSet() { + toSerialize["diskBus"] = o.DiskBus.Get() + } + if o.NicModel.IsSet() { + toSerialize["nicModel"] = o.NicModel.Get() + } + if !IsNil(o.OperatingSystem) { + toSerialize["operatingSystem"] = o.OperatingSystem + } + if o.OperatingSystemDistro.IsSet() { + toSerialize["operatingSystemDistro"] = o.OperatingSystemDistro.Get() + } + if o.OperatingSystemVersion.IsSet() { + toSerialize["operatingSystemVersion"] = o.OperatingSystemVersion.Get() + } + if o.RescueBus.IsSet() { + toSerialize["rescueBus"] = o.RescueBus.Get() + } + if o.RescueDevice.IsSet() { + toSerialize["rescueDevice"] = o.RescueDevice.Get() + } + if !IsNil(o.SecureBoot) { + toSerialize["secureBoot"] = o.SecureBoot + } + if !IsNil(o.Uefi) { + toSerialize["uefi"] = o.Uefi + } + if o.VideoModel.IsSet() { + toSerialize["videoModel"] = o.VideoModel.Get() + } + if !IsNil(o.VirtioScsi) { + toSerialize["virtioScsi"] = o.VirtioScsi + } + return toSerialize, nil +} + +type NullableImageConfig struct { + value *ImageConfig + isSet bool +} + +func (v NullableImageConfig) Get() *ImageConfig { + return v.value +} + +func (v *NullableImageConfig) Set(val *ImageConfig) { + v.value = val + v.isSet = true +} + +func (v NullableImageConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableImageConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageConfig(val *ImageConfig) *NullableImageConfig { + return &NullableImageConfig{value: val, isSet: true} +} + +func (v NullableImageConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_image_create_response.go b/services/iaas/model_image_create_response.go new file mode 100644 index 00000000..bd016053 --- /dev/null +++ b/services/iaas/model_image_create_response.go @@ -0,0 +1,139 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageCreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageCreateResponse{} + +// ImageCreateResponse Image creation response. +type ImageCreateResponse struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id *string `json:"id"` + // REQUIRED + UploadUrl *string `json:"uploadUrl"` +} + +type _ImageCreateResponse ImageCreateResponse + +// NewImageCreateResponse instantiates a new ImageCreateResponse 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 NewImageCreateResponse(id *string, uploadUrl *string) *ImageCreateResponse { + this := ImageCreateResponse{} + this.Id = id + this.UploadUrl = uploadUrl + return &this +} + +// NewImageCreateResponseWithDefaults instantiates a new ImageCreateResponse 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 NewImageCreateResponseWithDefaults() *ImageCreateResponse { + this := ImageCreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *ImageCreateResponse) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *ImageCreateResponse) SetId(v *string) { + o.Id = v +} + +// GetUploadUrl returns the UploadUrl field value +func (o *ImageCreateResponse) GetUploadUrl() *string { + if o == nil || IsNil(o.UploadUrl) { + var ret *string + return ret + } + + return o.UploadUrl +} + +// GetUploadUrlOk returns a tuple with the UploadUrl field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetUploadUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.UploadUrl, true +} + +// SetUploadUrl sets field value +func (o *ImageCreateResponse) SetUploadUrl(v *string) { + o.UploadUrl = v +} + +func (o ImageCreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["uploadUrl"] = o.UploadUrl + return toSerialize, nil +} + +type NullableImageCreateResponse struct { + value *ImageCreateResponse + isSet bool +} + +func (v NullableImageCreateResponse) Get() *ImageCreateResponse { + return v.value +} + +func (v *NullableImageCreateResponse) Set(val *ImageCreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageCreateResponse(val *ImageCreateResponse) *NullableImageCreateResponse { + return &NullableImageCreateResponse{value: val, isSet: true} +} + +func (v NullableImageCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_image_list_response.go b/services/iaas/model_image_list_response.go new file mode 100644 index 00000000..13506e80 --- /dev/null +++ b/services/iaas/model_image_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageListResponse{} + +// ImageListResponse Image list response. +type ImageListResponse struct { + // A list containing image objects. + // REQUIRED + Items *[]Image `json:"items"` +} + +type _ImageListResponse ImageListResponse + +// NewImageListResponse instantiates a new ImageListResponse 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 NewImageListResponse(items *[]Image) *ImageListResponse { + this := ImageListResponse{} + this.Items = items + return &this +} + +// NewImageListResponseWithDefaults instantiates a new ImageListResponse 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 NewImageListResponseWithDefaults() *ImageListResponse { + this := ImageListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ImageListResponse) GetItems() *[]Image { + if o == nil || IsNil(o.Items) { + var ret *[]Image + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ImageListResponse) GetItemsOk() (*[]Image, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ImageListResponse) SetItems(v *[]Image) { + o.Items = v +} + +func (o ImageListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableImageListResponse struct { + value *ImageListResponse + isSet bool +} + +func (v NullableImageListResponse) Get() *ImageListResponse { + return v.value +} + +func (v *NullableImageListResponse) Set(val *ImageListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageListResponse(val *ImageListResponse) *NullableImageListResponse { + return &NullableImageListResponse{value: val, isSet: true} +} + +func (v NullableImageListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_image_share.go b/services/iaas/model_image_share.go new file mode 100644 index 00000000..21726d7a --- /dev/null +++ b/services/iaas/model_image_share.go @@ -0,0 +1,154 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShare{} + +// ImageShare Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type ImageShare struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization *bool `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects *[]string `json:"projects,omitempty"` +} + +// NewImageShare instantiates a new ImageShare 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 NewImageShare() *ImageShare { + this := ImageShare{} + return &this +} + +// NewImageShareWithDefaults instantiates a new ImageShare 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 NewImageShareWithDefaults() *ImageShare { + this := ImageShare{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *ImageShare) GetParentOrganization() *bool { + if o == nil || IsNil(o.ParentOrganization) { + var ret *bool + return ret + } + return o.ParentOrganization +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShare) GetParentOrganizationOk() (*bool, bool) { + if o == nil || IsNil(o.ParentOrganization) { + return nil, false + } + return o.ParentOrganization, true +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *ImageShare) HasParentOrganization() bool { + if o != nil && !IsNil(o.ParentOrganization) { + return true + } + + return false +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *ImageShare) SetParentOrganization(v *bool) { + o.ParentOrganization = v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *ImageShare) GetProjects() *[]string { + if o == nil || IsNil(o.Projects) { + var ret *[]string + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShare) GetProjectsOk() (*[]string, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *ImageShare) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *ImageShare) SetProjects(v *[]string) { + o.Projects = v +} + +func (o ImageShare) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ParentOrganization) { + toSerialize["parentOrganization"] = o.ParentOrganization + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + return toSerialize, nil +} + +type NullableImageShare struct { + value *ImageShare + isSet bool +} + +func (v NullableImageShare) Get() *ImageShare { + return v.value +} + +func (v *NullableImageShare) Set(val *ImageShare) { + v.value = val + v.isSet = true +} + +func (v NullableImageShare) IsSet() bool { + return v.isSet +} + +func (v *NullableImageShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageShare(val *ImageShare) *NullableImageShare { + return &NullableImageShare{value: val, isSet: true} +} + +func (v NullableImageShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_image_share_consumer.go b/services/iaas/model_image_share_consumer.go new file mode 100644 index 00000000..05623958 --- /dev/null +++ b/services/iaas/model_image_share_consumer.go @@ -0,0 +1,229 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the ImageShareConsumer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShareConsumer{} + +// ImageShareConsumer The details of an Image share consumer. +type ImageShareConsumer struct { + // Universally Unique Identifier (UUID). + ConsumerProjectId *string `json:"consumerProjectId,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + ImageId *string `json:"imageId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// NewImageShareConsumer instantiates a new ImageShareConsumer 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 NewImageShareConsumer() *ImageShareConsumer { + this := ImageShareConsumer{} + return &this +} + +// NewImageShareConsumerWithDefaults instantiates a new ImageShareConsumer 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 NewImageShareConsumerWithDefaults() *ImageShareConsumer { + this := ImageShareConsumer{} + return &this +} + +// GetConsumerProjectId returns the ConsumerProjectId field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetConsumerProjectId() *string { + if o == nil || IsNil(o.ConsumerProjectId) { + var ret *string + return ret + } + return o.ConsumerProjectId +} + +// GetConsumerProjectIdOk returns a tuple with the ConsumerProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetConsumerProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.ConsumerProjectId) { + return nil, false + } + return o.ConsumerProjectId, true +} + +// HasConsumerProjectId returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasConsumerProjectId() bool { + if o != nil && !IsNil(o.ConsumerProjectId) { + return true + } + + return false +} + +// SetConsumerProjectId gets a reference to the given string and assigns it to the ConsumerProjectId field. +func (o *ImageShareConsumer) SetConsumerProjectId(v *string) { + o.ConsumerProjectId = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ImageShareConsumer) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetImageId() *string { + if o == nil || IsNil(o.ImageId) { + var ret *string + return ret + } + return o.ImageId +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetImageIdOk() (*string, bool) { + if o == nil || IsNil(o.ImageId) { + return nil, false + } + return o.ImageId, true +} + +// HasImageId returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasImageId() bool { + if o != nil && !IsNil(o.ImageId) { + return true + } + + return false +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *ImageShareConsumer) SetImageId(v *string) { + o.ImageId = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *ImageShareConsumer) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o ImageShareConsumer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ConsumerProjectId) { + toSerialize["consumerProjectId"] = o.ConsumerProjectId + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.ImageId) { + toSerialize["imageId"] = o.ImageId + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableImageShareConsumer struct { + value *ImageShareConsumer + isSet bool +} + +func (v NullableImageShareConsumer) Get() *ImageShareConsumer { + return v.value +} + +func (v *NullableImageShareConsumer) Set(val *ImageShareConsumer) { + v.value = val + v.isSet = true +} + +func (v NullableImageShareConsumer) IsSet() bool { + return v.isSet +} + +func (v *NullableImageShareConsumer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageShareConsumer(val *ImageShareConsumer) *NullableImageShareConsumer { + return &NullableImageShareConsumer{value: val, isSet: true} +} + +func (v NullableImageShareConsumer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageShareConsumer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_key_pair_list_response.go b/services/iaas/model_key_pair_list_response.go index e2aff0fe..07c90348 100644 --- a/services/iaas/model_key_pair_list_response.go +++ b/services/iaas/model_key_pair_list_response.go @@ -46,7 +46,7 @@ func NewKeyPairListResponseWithDefaults() *KeyPairListResponse { // GetItems returns the Items field value func (o *KeyPairListResponse) GetItems() *[]Keypair { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]Keypair return ret } diff --git a/services/iaas/model_keypair.go b/services/iaas/model_keypair.go index 691454a5..282ef75d 100644 --- a/services/iaas/model_keypair.go +++ b/services/iaas/model_keypair.go @@ -185,7 +185,7 @@ func (o *Keypair) SetName(v *string) { // GetPublicKey returns the PublicKey field value func (o *Keypair) GetPublicKey() *string { - if o == nil { + if o == nil || IsNil(o.PublicKey) { var ret *string return ret } diff --git a/services/iaas/model_machine_type.go b/services/iaas/model_machine_type.go index 30c914b0..5bae7994 100644 --- a/services/iaas/model_machine_type.go +++ b/services/iaas/model_machine_type.go @@ -94,7 +94,7 @@ func (o *MachineType) SetDescription(v *string) { // GetDisk returns the Disk field value func (o *MachineType) GetDisk() *int64 { - if o == nil { + if o == nil || IsNil(o.Disk) { var ret *int64 return ret } @@ -150,7 +150,7 @@ func (o *MachineType) SetExtraSpecs(v *map[string]interface{}) { // GetName returns the Name field value func (o *MachineType) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } @@ -174,7 +174,7 @@ func (o *MachineType) SetName(v *string) { // GetRam returns the Ram field value func (o *MachineType) GetRam() *int64 { - if o == nil { + if o == nil || IsNil(o.Ram) { var ret *int64 return ret } @@ -198,7 +198,7 @@ func (o *MachineType) SetRam(v *int64) { // GetVcpus returns the Vcpus field value func (o *MachineType) GetVcpus() *int64 { - if o == nil { + if o == nil || IsNil(o.Vcpus) { var ret *int64 return ret } diff --git a/services/iaas/model_machine_type_list_response.go b/services/iaas/model_machine_type_list_response.go index 17c34e14..4fda880d 100644 --- a/services/iaas/model_machine_type_list_response.go +++ b/services/iaas/model_machine_type_list_response.go @@ -46,7 +46,7 @@ func NewMachineTypeListResponseWithDefaults() *MachineTypeListResponse { // GetItems returns the Items field value func (o *MachineTypeListResponse) GetItems() *[]MachineType { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]MachineType return ret } diff --git a/services/iaas/model_network.go b/services/iaas/model_network.go index 0f8b0ba0..e555379e 100644 --- a/services/iaas/model_network.go +++ b/services/iaas/model_network.go @@ -106,7 +106,7 @@ func (o *Network) SetCreatedAt(v *time.Time) { // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). func (o *Network) GetGateway() *string { - if o == nil || IsNil(o.Gateway.Get()) { + if o == nil || IsNil(o.Gateway) || IsNil(o.Gateway.Get()) { var ret *string return ret } @@ -117,7 +117,7 @@ func (o *Network) GetGateway() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Network) GetGatewayOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Gateway) { return nil, false } return o.Gateway.Get(), o.Gateway.IsSet() @@ -125,7 +125,7 @@ func (o *Network) GetGatewayOk() (*string, bool) { // HasGateway returns a boolean if a field has been set. func (o *Network) HasGateway() bool { - if o != nil && o.Gateway.IsSet() { + if o != nil && !IsNil(o.Gateway) && o.Gateway.IsSet() { return true } @@ -134,22 +134,31 @@ func (o *Network) HasGateway() bool { // SetGateway gets a reference to the given string and assigns it to the Gateway field. func (o *Network) SetGateway(v *string) { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(v) } // SetGatewayNil sets the value for Gateway to be an explicit nil func (o *Network) SetGatewayNil() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(nil) } // UnsetGateway ensures that no value is present for Gateway, not even an explicit nil func (o *Network) UnsetGateway() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Unset() } // GetGatewayv6 returns the Gatewayv6 field value if set, zero value otherwise (both if not set or set to explicit null). func (o *Network) GetGatewayv6() *string { - if o == nil || IsNil(o.Gatewayv6.Get()) { + if o == nil || IsNil(o.Gatewayv6) || IsNil(o.Gatewayv6.Get()) { var ret *string return ret } @@ -160,7 +169,7 @@ func (o *Network) GetGatewayv6() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Network) GetGatewayv6Ok() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Gatewayv6) { return nil, false } return o.Gatewayv6.Get(), o.Gatewayv6.IsSet() @@ -168,7 +177,7 @@ func (o *Network) GetGatewayv6Ok() (*string, bool) { // HasGatewayv6 returns a boolean if a field has been set. func (o *Network) HasGatewayv6() bool { - if o != nil && o.Gatewayv6.IsSet() { + if o != nil && !IsNil(o.Gatewayv6) && o.Gatewayv6.IsSet() { return true } @@ -177,16 +186,25 @@ func (o *Network) HasGatewayv6() bool { // SetGatewayv6 gets a reference to the given string and assigns it to the Gatewayv6 field. func (o *Network) SetGatewayv6(v *string) { + if IsNil(o.Gatewayv6) { + o.Gatewayv6 = new(NullableString) + } o.Gatewayv6.Set(v) } // SetGatewayv6Nil sets the value for Gatewayv6 to be an explicit nil func (o *Network) SetGatewayv6Nil() { + if IsNil(o.Gatewayv6) { + o.Gatewayv6 = new(NullableString) + } o.Gatewayv6.Set(nil) } // UnsetGatewayv6 ensures that no value is present for Gatewayv6, not even an explicit nil func (o *Network) UnsetGatewayv6() { + if IsNil(o.Gatewayv6) { + o.Gatewayv6 = new(NullableString) + } o.Gatewayv6.Unset() } @@ -224,7 +242,7 @@ func (o *Network) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *Network) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } @@ -312,7 +330,7 @@ func (o *Network) SetNameserversV6(v *[]string) { // GetNetworkId returns the NetworkId field value func (o *Network) GetNetworkId() *string { - if o == nil { + if o == nil || IsNil(o.NetworkId) { var ret *string return ret } @@ -464,7 +482,7 @@ func (o *Network) SetRouted(v *bool) { // GetState returns the State field value func (o *Network) GetState() *string { - if o == nil { + if o == nil || IsNil(o.State) { var ret *string return ret } diff --git a/services/iaas/model_network_area.go b/services/iaas/model_network_area.go index 280c4db0..aab900b2 100644 --- a/services/iaas/model_network_area.go +++ b/services/iaas/model_network_area.go @@ -65,7 +65,7 @@ func NewNetworkAreaWithDefaults() *NetworkArea { // GetAreaId returns the AreaId field value func (o *NetworkArea) GetAreaId() *string { - if o == nil { + if o == nil || IsNil(o.AreaId) { var ret *string return ret } @@ -185,7 +185,7 @@ func (o *NetworkArea) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *NetworkArea) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } @@ -209,7 +209,7 @@ func (o *NetworkArea) SetName(v *string) { // GetProjectCount returns the ProjectCount field value func (o *NetworkArea) GetProjectCount() *int64 { - if o == nil { + if o == nil || IsNil(o.ProjectCount) { var ret *int64 return ret } @@ -233,7 +233,7 @@ func (o *NetworkArea) SetProjectCount(v *int64) { // GetState returns the State field value func (o *NetworkArea) GetState() *string { - if o == nil { + if o == nil || IsNil(o.State) { var ret *string return ret } diff --git a/services/iaas/model_network_area_list_response.go b/services/iaas/model_network_area_list_response.go index 480ec090..9478ec96 100644 --- a/services/iaas/model_network_area_list_response.go +++ b/services/iaas/model_network_area_list_response.go @@ -46,7 +46,7 @@ func NewNetworkAreaListResponseWithDefaults() *NetworkAreaListResponse { // GetItems returns the Items field value func (o *NetworkAreaListResponse) GetItems() *[]NetworkArea { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]NetworkArea return ret } diff --git a/services/iaas/model_network_list_response.go b/services/iaas/model_network_list_response.go index f897d1c7..66ef63df 100644 --- a/services/iaas/model_network_list_response.go +++ b/services/iaas/model_network_list_response.go @@ -46,7 +46,7 @@ func NewNetworkListResponseWithDefaults() *NetworkListResponse { // GetItems returns the Items field value func (o *NetworkListResponse) GetItems() *[]Network { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]Network return ret } diff --git a/services/iaas/model_network_range.go b/services/iaas/model_network_range.go index 0a6a32ae..6b9b9a03 100644 --- a/services/iaas/model_network_range.go +++ b/services/iaas/model_network_range.go @@ -117,7 +117,7 @@ func (o *NetworkRange) SetNetworkRangeId(v *string) { // GetPrefix returns the Prefix field value func (o *NetworkRange) GetPrefix() *string { - if o == nil { + if o == nil || IsNil(o.Prefix) { var ret *string return ret } diff --git a/services/iaas/model_network_range_list_response.go b/services/iaas/model_network_range_list_response.go index 09abb9a7..84b5f755 100644 --- a/services/iaas/model_network_range_list_response.go +++ b/services/iaas/model_network_range_list_response.go @@ -46,7 +46,7 @@ func NewNetworkRangeListResponseWithDefaults() *NetworkRangeListResponse { // GetItems returns the Items field value func (o *NetworkRangeListResponse) GetItems() *[]NetworkRange { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]NetworkRange return ret } diff --git a/services/iaas/model_nic_list_response.go b/services/iaas/model_nic_list_response.go index e045780d..779c0d4e 100644 --- a/services/iaas/model_nic_list_response.go +++ b/services/iaas/model_nic_list_response.go @@ -46,7 +46,7 @@ func NewNICListResponseWithDefaults() *NICListResponse { // GetItems returns the Items field value func (o *NICListResponse) GetItems() *[]NIC { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]NIC return ret } diff --git a/services/iaas/model_port_range.go b/services/iaas/model_port_range.go index c2ba08fa..d652cf5e 100644 --- a/services/iaas/model_port_range.go +++ b/services/iaas/model_port_range.go @@ -50,7 +50,7 @@ func NewPortRangeWithDefaults() *PortRange { // GetMax returns the Max field value func (o *PortRange) GetMax() *int64 { - if o == nil { + if o == nil || IsNil(o.Max) { var ret *int64 return ret } @@ -74,7 +74,7 @@ func (o *PortRange) SetMax(v *int64) { // GetMin returns the Min field value func (o *PortRange) GetMin() *int64 { - if o == nil { + if o == nil || IsNil(o.Min) { var ret *int64 return ret } diff --git a/services/iaas/model_project_list_response.go b/services/iaas/model_project_list_response.go index 82abca80..9de20680 100644 --- a/services/iaas/model_project_list_response.go +++ b/services/iaas/model_project_list_response.go @@ -46,7 +46,7 @@ func NewProjectListResponseWithDefaults() *ProjectListResponse { // GetItems returns the Items field value func (o *ProjectListResponse) GetItems() *[]string { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]string return ret } diff --git a/services/iaas/model_public_ip.go b/services/iaas/model_public_ip.go index e41de322..8726f908 100644 --- a/services/iaas/model_public_ip.go +++ b/services/iaas/model_public_ip.go @@ -144,7 +144,7 @@ func (o *PublicIp) SetLabels(v *map[string]interface{}) { // GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). func (o *PublicIp) GetNetworkInterface() *string { - if o == nil || IsNil(o.NetworkInterface.Get()) { + if o == nil || IsNil(o.NetworkInterface) || IsNil(o.NetworkInterface.Get()) { var ret *string return ret } @@ -155,7 +155,7 @@ func (o *PublicIp) GetNetworkInterface() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *PublicIp) GetNetworkInterfaceOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NetworkInterface) { return nil, false } return o.NetworkInterface.Get(), o.NetworkInterface.IsSet() @@ -163,7 +163,7 @@ func (o *PublicIp) GetNetworkInterfaceOk() (*string, bool) { // HasNetworkInterface returns a boolean if a field has been set. func (o *PublicIp) HasNetworkInterface() bool { - if o != nil && o.NetworkInterface.IsSet() { + if o != nil && !IsNil(o.NetworkInterface) && o.NetworkInterface.IsSet() { return true } @@ -172,16 +172,25 @@ func (o *PublicIp) HasNetworkInterface() bool { // SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. func (o *PublicIp) SetNetworkInterface(v *string) { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Set(v) } // SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil func (o *PublicIp) SetNetworkInterfaceNil() { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Set(nil) } // UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil func (o *PublicIp) UnsetNetworkInterface() { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Unset() } diff --git a/services/iaas/model_public_ip_list_response.go b/services/iaas/model_public_ip_list_response.go index 6b8c2863..b48d5730 100644 --- a/services/iaas/model_public_ip_list_response.go +++ b/services/iaas/model_public_ip_list_response.go @@ -46,7 +46,7 @@ func NewPublicIpListResponseWithDefaults() *PublicIpListResponse { // GetItems returns the Items field value func (o *PublicIpListResponse) GetItems() *[]PublicIp { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]PublicIp return ret } diff --git a/services/iaas/model_request.go b/services/iaas/model_request.go index 3e7f86bb..c44be681 100644 --- a/services/iaas/model_request.go +++ b/services/iaas/model_request.go @@ -94,7 +94,7 @@ func (o *Request) SetDetails(v *string) { // GetRequestAction returns the RequestAction field value func (o *Request) GetRequestAction() *string { - if o == nil { + if o == nil || IsNil(o.RequestAction) { var ret *string return ret } @@ -118,7 +118,7 @@ func (o *Request) SetRequestAction(v *string) { // GetRequestId returns the RequestId field value func (o *Request) GetRequestId() *string { - if o == nil { + if o == nil || IsNil(o.RequestId) { var ret *string return ret } @@ -142,7 +142,7 @@ func (o *Request) SetRequestId(v *string) { // GetRequestType returns the RequestType field value func (o *Request) GetRequestType() *string { - if o == nil { + if o == nil || IsNil(o.RequestType) { var ret *string return ret } @@ -166,7 +166,7 @@ func (o *Request) SetRequestType(v *string) { // GetResources returns the Resources field value func (o *Request) GetResources() *[]RequestResource { - if o == nil { + if o == nil || IsNil(o.Resources) { var ret *[]RequestResource return ret } @@ -190,7 +190,7 @@ func (o *Request) SetResources(v *[]RequestResource) { // GetStatus returns the Status field value func (o *Request) GetStatus() *string { - if o == nil { + if o == nil || IsNil(o.Status) { var ret *string return ret } diff --git a/services/iaas/model_request_resource.go b/services/iaas/model_request_resource.go index ac087e30..5d718471 100644 --- a/services/iaas/model_request_resource.go +++ b/services/iaas/model_request_resource.go @@ -54,7 +54,7 @@ func NewRequestResourceWithDefaults() *RequestResource { // GetId returns the Id field value func (o *RequestResource) GetId() *string { - if o == nil { + if o == nil || IsNil(o.Id) { var ret *string return ret } @@ -78,7 +78,7 @@ func (o *RequestResource) SetId(v *string) { // GetStatus returns the Status field value func (o *RequestResource) GetStatus() *string { - if o == nil { + if o == nil || IsNil(o.Status) { var ret *string return ret } @@ -102,7 +102,7 @@ func (o *RequestResource) SetStatus(v *string) { // GetType returns the Type field value func (o *RequestResource) GetType() *string { - if o == nil { + if o == nil || IsNil(o.Type) { var ret *string return ret } diff --git a/services/iaas/model_rescue_server_payload.go b/services/iaas/model_rescue_server_payload.go index 099ef282..fdf3ce39 100644 --- a/services/iaas/model_rescue_server_payload.go +++ b/services/iaas/model_rescue_server_payload.go @@ -46,7 +46,7 @@ func NewRescueServerPayloadWithDefaults() *RescueServerPayload { // GetImage returns the Image field value func (o *RescueServerPayload) GetImage() *string { - if o == nil { + if o == nil || IsNil(o.Image) { var ret *string return ret } diff --git a/services/iaas/model_resize_server_payload.go b/services/iaas/model_resize_server_payload.go index 95f585ee..d89275bc 100644 --- a/services/iaas/model_resize_server_payload.go +++ b/services/iaas/model_resize_server_payload.go @@ -46,7 +46,7 @@ func NewResizeServerPayloadWithDefaults() *ResizeServerPayload { // GetMachineType returns the MachineType field value func (o *ResizeServerPayload) GetMachineType() *string { - if o == nil { + if o == nil || IsNil(o.MachineType) { var ret *string return ret } diff --git a/services/iaas/model_resize_volume_payload.go b/services/iaas/model_resize_volume_payload.go index 7ba247a6..8863bc87 100644 --- a/services/iaas/model_resize_volume_payload.go +++ b/services/iaas/model_resize_volume_payload.go @@ -46,7 +46,7 @@ func NewResizeVolumePayloadWithDefaults() *ResizeVolumePayload { // GetSize returns the Size field value func (o *ResizeVolumePayload) GetSize() *int64 { - if o == nil { + if o == nil || IsNil(o.Size) { var ret *int64 return ret } diff --git a/services/iaas/model_route.go b/services/iaas/model_route.go index 5b2e09ff..2cc01ae3 100644 --- a/services/iaas/model_route.go +++ b/services/iaas/model_route.go @@ -123,7 +123,7 @@ func (o *Route) SetLabels(v *map[string]interface{}) { // GetNexthop returns the Nexthop field value func (o *Route) GetNexthop() *string { - if o == nil { + if o == nil || IsNil(o.Nexthop) { var ret *string return ret } @@ -147,7 +147,7 @@ func (o *Route) SetNexthop(v *string) { // GetPrefix returns the Prefix field value func (o *Route) GetPrefix() *string { - if o == nil { + if o == nil || IsNil(o.Prefix) { var ret *string return ret } diff --git a/services/iaas/model_route_list_response.go b/services/iaas/model_route_list_response.go index fe896100..705765b9 100644 --- a/services/iaas/model_route_list_response.go +++ b/services/iaas/model_route_list_response.go @@ -46,7 +46,7 @@ func NewRouteListResponseWithDefaults() *RouteListResponse { // GetItems returns the Items field value func (o *RouteListResponse) GetItems() *[]Route { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]Route return ret } diff --git a/services/iaas/model_security_group.go b/services/iaas/model_security_group.go index e041b627..7a2f4e30 100644 --- a/services/iaas/model_security_group.go +++ b/services/iaas/model_security_group.go @@ -193,7 +193,7 @@ func (o *SecurityGroup) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *SecurityGroup) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_security_group_list_response.go b/services/iaas/model_security_group_list_response.go index c680b20b..847bf4b9 100644 --- a/services/iaas/model_security_group_list_response.go +++ b/services/iaas/model_security_group_list_response.go @@ -46,7 +46,7 @@ func NewSecurityGroupListResponseWithDefaults() *SecurityGroupListResponse { // GetItems returns the Items field value func (o *SecurityGroupListResponse) GetItems() *[]SecurityGroup { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]SecurityGroup return ret } diff --git a/services/iaas/model_security_group_rule.go b/services/iaas/model_security_group_rule.go index e66517d5..dfa9d688 100644 --- a/services/iaas/model_security_group_rule.go +++ b/services/iaas/model_security_group_rule.go @@ -97,7 +97,7 @@ func (o *SecurityGroupRule) SetDescription(v *string) { // GetDirection returns the Direction field value func (o *SecurityGroupRule) GetDirection() *string { - if o == nil { + if o == nil || IsNil(o.Direction) { var ret *string return ret } diff --git a/services/iaas/model_security_group_rule_list_response.go b/services/iaas/model_security_group_rule_list_response.go index 161d325d..40157f3b 100644 --- a/services/iaas/model_security_group_rule_list_response.go +++ b/services/iaas/model_security_group_rule_list_response.go @@ -46,7 +46,7 @@ func NewSecurityGroupRuleListResponseWithDefaults() *SecurityGroupRuleListRespon // GetItems returns the Items field value func (o *SecurityGroupRuleListResponse) GetItems() *[]SecurityGroupRule { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]SecurityGroupRule return ret } diff --git a/services/iaas/model_server.go b/services/iaas/model_server.go index 935bc509..3176a658 100644 --- a/services/iaas/model_server.go +++ b/services/iaas/model_server.go @@ -408,7 +408,7 @@ func (o *Server) SetLaunchedAt(v *time.Time) { // GetMachineType returns the MachineType field value func (o *Server) GetMachineType() *string { - if o == nil { + if o == nil || IsNil(o.MachineType) { var ret *string return ret } @@ -464,7 +464,7 @@ func (o *Server) SetMaintenanceWindow(v *ServerMaintenance) { // GetName returns the Name field value func (o *Server) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_server_console_url.go b/services/iaas/model_server_console_url.go index d583eb1f..e86c3ce0 100644 --- a/services/iaas/model_server_console_url.go +++ b/services/iaas/model_server_console_url.go @@ -45,7 +45,7 @@ func NewServerConsoleUrlWithDefaults() *ServerConsoleUrl { // GetUrl returns the Url field value func (o *ServerConsoleUrl) GetUrl() *string { - if o == nil { + if o == nil || IsNil(o.Url) { var ret *string return ret } diff --git a/services/iaas/model_server_list_response.go b/services/iaas/model_server_list_response.go index d0eb3787..7c501b91 100644 --- a/services/iaas/model_server_list_response.go +++ b/services/iaas/model_server_list_response.go @@ -46,7 +46,7 @@ func NewServerListResponseWithDefaults() *ServerListResponse { // GetItems returns the Items field value func (o *ServerListResponse) GetItems() *[]Server { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]Server return ret } diff --git a/services/iaas/model_server_maintenance.go b/services/iaas/model_server_maintenance.go index 2b007e48..00d1fd56 100644 --- a/services/iaas/model_server_maintenance.go +++ b/services/iaas/model_server_maintenance.go @@ -87,7 +87,7 @@ func (o *ServerMaintenance) SetDetails(v *string) { // GetEndsAt returns the EndsAt field value func (o *ServerMaintenance) GetEndsAt() *time.Time { - if o == nil { + if o == nil || IsNil(o.EndsAt) { var ret *time.Time return ret } @@ -111,7 +111,7 @@ func (o *ServerMaintenance) SetEndsAt(v *time.Time) { // GetStartsAt returns the StartsAt field value func (o *ServerMaintenance) GetStartsAt() *time.Time { - if o == nil { + if o == nil || IsNil(o.StartsAt) { var ret *time.Time return ret } @@ -135,7 +135,7 @@ func (o *ServerMaintenance) SetStartsAt(v *time.Time) { // GetStatus returns the Status field value func (o *ServerMaintenance) GetStatus() *string { - if o == nil { + if o == nil || IsNil(o.Status) { var ret *string return ret } diff --git a/services/iaas/model_server_network.go b/services/iaas/model_server_network.go index b4de0ec3..2cd5a8e6 100644 --- a/services/iaas/model_server_network.go +++ b/services/iaas/model_server_network.go @@ -170,7 +170,7 @@ func (o *ServerNetwork) SetIpv6(v *string) { // GetMac returns the Mac field value func (o *ServerNetwork) GetMac() *string { - if o == nil { + if o == nil || IsNil(o.Mac) { var ret *string return ret } @@ -194,7 +194,7 @@ func (o *ServerNetwork) SetMac(v *string) { // GetNetworkId returns the NetworkId field value func (o *ServerNetwork) GetNetworkId() *string { - if o == nil { + if o == nil || IsNil(o.NetworkId) { var ret *string return ret } @@ -218,7 +218,7 @@ func (o *ServerNetwork) SetNetworkId(v *string) { // GetNetworkName returns the NetworkName field value func (o *ServerNetwork) GetNetworkName() *string { - if o == nil { + if o == nil || IsNil(o.NetworkName) { var ret *string return ret } @@ -242,7 +242,7 @@ func (o *ServerNetwork) SetNetworkName(v *string) { // GetNicId returns the NicId field value func (o *ServerNetwork) GetNicId() *string { - if o == nil { + if o == nil || IsNil(o.NicId) { var ret *string return ret } @@ -266,7 +266,7 @@ func (o *ServerNetwork) SetNicId(v *string) { // GetNicSecurity returns the NicSecurity field value func (o *ServerNetwork) GetNicSecurity() *bool { - if o == nil { + if o == nil || IsNil(o.NicSecurity) { var ret *bool return ret } diff --git a/services/iaas/model_service_account_mail_list_response.go b/services/iaas/model_service_account_mail_list_response.go index 3698d9c6..689fd647 100644 --- a/services/iaas/model_service_account_mail_list_response.go +++ b/services/iaas/model_service_account_mail_list_response.go @@ -46,7 +46,7 @@ func NewServiceAccountMailListResponseWithDefaults() *ServiceAccountMailListResp // GetItems returns the Items field value func (o *ServiceAccountMailListResponse) GetItems() *[]string { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]string return ret } diff --git a/services/iaas/model_set_image_share_payload.go b/services/iaas/model_set_image_share_payload.go new file mode 100644 index 00000000..bc72e77b --- /dev/null +++ b/services/iaas/model_set_image_share_payload.go @@ -0,0 +1,154 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SetImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SetImageSharePayload{} + +// SetImageSharePayload Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type SetImageSharePayload struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization *bool `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects *[]string `json:"projects,omitempty"` +} + +// NewSetImageSharePayload instantiates a new SetImageSharePayload 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 NewSetImageSharePayload() *SetImageSharePayload { + this := SetImageSharePayload{} + return &this +} + +// NewSetImageSharePayloadWithDefaults instantiates a new SetImageSharePayload 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 NewSetImageSharePayloadWithDefaults() *SetImageSharePayload { + this := SetImageSharePayload{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *SetImageSharePayload) GetParentOrganization() *bool { + if o == nil || IsNil(o.ParentOrganization) { + var ret *bool + return ret + } + return o.ParentOrganization +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetImageSharePayload) GetParentOrganizationOk() (*bool, bool) { + if o == nil || IsNil(o.ParentOrganization) { + return nil, false + } + return o.ParentOrganization, true +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *SetImageSharePayload) HasParentOrganization() bool { + if o != nil && !IsNil(o.ParentOrganization) { + return true + } + + return false +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *SetImageSharePayload) SetParentOrganization(v *bool) { + o.ParentOrganization = v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *SetImageSharePayload) GetProjects() *[]string { + if o == nil || IsNil(o.Projects) { + var ret *[]string + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetImageSharePayload) GetProjectsOk() (*[]string, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *SetImageSharePayload) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *SetImageSharePayload) SetProjects(v *[]string) { + o.Projects = v +} + +func (o SetImageSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ParentOrganization) { + toSerialize["parentOrganization"] = o.ParentOrganization + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + return toSerialize, nil +} + +type NullableSetImageSharePayload struct { + value *SetImageSharePayload + isSet bool +} + +func (v NullableSetImageSharePayload) Get() *SetImageSharePayload { + return v.value +} + +func (v *NullableSetImageSharePayload) Set(val *SetImageSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableSetImageSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableSetImageSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSetImageSharePayload(val *SetImageSharePayload) *NullableSetImageSharePayload { + return &NullableSetImageSharePayload{value: val, isSet: true} +} + +func (v NullableSetImageSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSetImageSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_snapshot.go b/services/iaas/model_snapshot.go new file mode 100644 index 00000000..a0313ea2 --- /dev/null +++ b/services/iaas/model_snapshot.go @@ -0,0 +1,371 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Snapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Snapshot{} + +// Snapshot Object that represents a snapshot. +type Snapshot struct { + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + // The status of a snapshot object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + VolumeId *string `json:"volumeId"` +} + +type _Snapshot Snapshot + +// NewSnapshot instantiates a new Snapshot 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 NewSnapshot(volumeId *string) *Snapshot { + this := Snapshot{} + this.VolumeId = volumeId + return &this +} + +// NewSnapshotWithDefaults instantiates a new Snapshot 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 NewSnapshotWithDefaults() *Snapshot { + this := Snapshot{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Snapshot) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Snapshot) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Snapshot) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Snapshot) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *Snapshot) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Snapshot) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Snapshot) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Snapshot) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Snapshot) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Snapshot) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Snapshot) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *Snapshot) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Snapshot) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Snapshot) SetName(v *string) { + o.Name = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Snapshot) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// 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 *Snapshot) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Snapshot) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Snapshot) SetSize(v *int64) { + o.Size = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Snapshot) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// 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 *Snapshot) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Snapshot) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Snapshot) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Snapshot) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Snapshot) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Snapshot) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +// GetVolumeId returns the VolumeId field value +func (o *Snapshot) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + + return o.VolumeId +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value +// and a boolean to check if the value has been set. +func (o *Snapshot) GetVolumeIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VolumeId, true +} + +// SetVolumeId sets field value +func (o *Snapshot) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o Snapshot) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + toSerialize["volumeId"] = o.VolumeId + return toSerialize, nil +} + +type NullableSnapshot struct { + value *Snapshot + isSet bool +} + +func (v NullableSnapshot) Get() *Snapshot { + return v.value +} + +func (v *NullableSnapshot) Set(val *Snapshot) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshot(val *Snapshot) *NullableSnapshot { + return &NullableSnapshot{value: val, isSet: true} +} + +func (v NullableSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_snapshot_list_response.go b/services/iaas/model_snapshot_list_response.go new file mode 100644 index 00000000..2d6b3d44 --- /dev/null +++ b/services/iaas/model_snapshot_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SnapshotListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotListResponse{} + +// SnapshotListResponse Snapshot list response. +type SnapshotListResponse struct { + // A list containing snapshot objects. + // REQUIRED + Items *[]Snapshot `json:"items"` +} + +type _SnapshotListResponse SnapshotListResponse + +// NewSnapshotListResponse instantiates a new SnapshotListResponse 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 NewSnapshotListResponse(items *[]Snapshot) *SnapshotListResponse { + this := SnapshotListResponse{} + this.Items = items + return &this +} + +// NewSnapshotListResponseWithDefaults instantiates a new SnapshotListResponse 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 NewSnapshotListResponseWithDefaults() *SnapshotListResponse { + this := SnapshotListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SnapshotListResponse) GetItems() *[]Snapshot { + if o == nil || IsNil(o.Items) { + var ret *[]Snapshot + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SnapshotListResponse) GetItemsOk() (*[]Snapshot, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *SnapshotListResponse) SetItems(v *[]Snapshot) { + o.Items = v +} + +func (o SnapshotListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableSnapshotListResponse struct { + value *SnapshotListResponse + isSet bool +} + +func (v NullableSnapshotListResponse) Get() *SnapshotListResponse { + return v.value +} + +func (v *NullableSnapshotListResponse) Set(val *SnapshotListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotListResponse(val *SnapshotListResponse) *NullableSnapshotListResponse { + return &NullableSnapshotListResponse{value: val, isSet: true} +} + +func (v NullableSnapshotListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_backup_payload.go b/services/iaas/model_update_backup_payload.go new file mode 100644 index 00000000..7a06b479 --- /dev/null +++ b/services/iaas/model_update_backup_payload.go @@ -0,0 +1,451 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the UpdateBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateBackupPayload{} + +// UpdateBackupPayload Object that represents a backup. +type UpdateBackupPayload struct { + // Object that represents an availability zone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + // Universally Unique Identifier (UUID). + SnapshotId *string `json:"snapshotId,omitempty"` + // The status of a backup object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId *string `json:"volumeId,omitempty"` +} + +// NewUpdateBackupPayload instantiates a new UpdateBackupPayload 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 NewUpdateBackupPayload() *UpdateBackupPayload { + this := UpdateBackupPayload{} + return &this +} + +// NewUpdateBackupPayloadWithDefaults instantiates a new UpdateBackupPayload 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 NewUpdateBackupPayloadWithDefaults() *UpdateBackupPayload { + this := UpdateBackupPayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetAvailabilityZone() *string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret *string + return ret + } + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetAvailabilityZoneOk() (*string, bool) { + if o == nil || IsNil(o.AvailabilityZone) { + return nil, false + } + return o.AvailabilityZone, true +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasAvailabilityZone() bool { + if o != nil && !IsNil(o.AvailabilityZone) { + return true + } + + return false +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *UpdateBackupPayload) SetAvailabilityZone(v *string) { + o.AvailabilityZone = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UpdateBackupPayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// 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 *UpdateBackupPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateBackupPayload) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateBackupPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *UpdateBackupPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateBackupPayload) SetName(v *string) { + o.Name = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// 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 *UpdateBackupPayload) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *UpdateBackupPayload) SetSize(v *int64) { + o.Size = v +} + +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetSnapshotId() *string { + if o == nil || IsNil(o.SnapshotId) { + var ret *string + return ret + } + return o.SnapshotId +} + +// GetSnapshotIdOk returns a tuple with the SnapshotId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetSnapshotIdOk() (*string, bool) { + if o == nil || IsNil(o.SnapshotId) { + return nil, false + } + return o.SnapshotId, true +} + +// HasSnapshotId returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasSnapshotId() bool { + if o != nil && !IsNil(o.SnapshotId) { + return true + } + + return false +} + +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *UpdateBackupPayload) SetSnapshotId(v *string) { + o.SnapshotId = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// 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 *UpdateBackupPayload) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *UpdateBackupPayload) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *UpdateBackupPayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + return o.VolumeId +} + +// 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 *UpdateBackupPayload) GetVolumeIdOk() (*string, bool) { + if o == nil || IsNil(o.VolumeId) { + return nil, false + } + return o.VolumeId, true +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasVolumeId() bool { + if o != nil && !IsNil(o.VolumeId) { + return true + } + + return false +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *UpdateBackupPayload) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o UpdateBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AvailabilityZone) { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.SnapshotId) { + toSerialize["snapshotId"] = o.SnapshotId + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + if !IsNil(o.VolumeId) { + toSerialize["volumeId"] = o.VolumeId + } + return toSerialize, nil +} + +type NullableUpdateBackupPayload struct { + value *UpdateBackupPayload + isSet bool +} + +func (v NullableUpdateBackupPayload) Get() *UpdateBackupPayload { + return v.value +} + +func (v *NullableUpdateBackupPayload) Set(val *UpdateBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateBackupPayload(val *UpdateBackupPayload) *NullableUpdateBackupPayload { + return &NullableUpdateBackupPayload{value: val, isSet: true} +} + +func (v NullableUpdateBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_image_payload.go b/services/iaas/model_update_image_payload.go new file mode 100644 index 00000000..7c8ca3f2 --- /dev/null +++ b/services/iaas/model_update_image_payload.go @@ -0,0 +1,337 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImagePayload{} + +// UpdateImagePayload Object that represents an update request body of an Image. +type UpdateImagePayload struct { + Config *ImageConfig `json:"config,omitempty"` + // Object that represents a disk format. + DiskFormat *string `json:"diskFormat,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize *int64 `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam *int64 `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + Protected *bool `json:"protected,omitempty"` +} + +// NewUpdateImagePayload instantiates a new UpdateImagePayload 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 NewUpdateImagePayload() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// NewUpdateImagePayloadWithDefaults instantiates a new UpdateImagePayload 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 NewUpdateImagePayloadWithDefaults() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetConfig() *ImageConfig { + if o == nil || IsNil(o.Config) { + var ret *ImageConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *UpdateImagePayload) SetConfig(v *ImageConfig) { + o.Config = v +} + +// GetDiskFormat returns the DiskFormat field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetDiskFormat() *string { + if o == nil || IsNil(o.DiskFormat) { + var ret *string + return ret + } + return o.DiskFormat +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetDiskFormatOk() (*string, bool) { + if o == nil || IsNil(o.DiskFormat) { + return nil, false + } + return o.DiskFormat, true +} + +// HasDiskFormat returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasDiskFormat() bool { + if o != nil && !IsNil(o.DiskFormat) { + return true + } + + return false +} + +// SetDiskFormat gets a reference to the given string and assigns it to the DiskFormat field. +func (o *UpdateImagePayload) SetDiskFormat(v *string) { + o.DiskFormat = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateImagePayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinDiskSize() *int64 { + if o == nil || IsNil(o.MinDiskSize) { + var ret *int64 + return ret + } + return o.MinDiskSize +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinDiskSizeOk() (*int64, bool) { + if o == nil || IsNil(o.MinDiskSize) { + return nil, false + } + return o.MinDiskSize, true +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinDiskSize() bool { + if o != nil && !IsNil(o.MinDiskSize) { + return true + } + + return false +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *UpdateImagePayload) SetMinDiskSize(v *int64) { + o.MinDiskSize = v +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinRam() *int64 { + if o == nil || IsNil(o.MinRam) { + var ret *int64 + return ret + } + return o.MinRam +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinRamOk() (*int64, bool) { + if o == nil || IsNil(o.MinRam) { + return nil, false + } + return o.MinRam, true +} + +// HasMinRam returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinRam() bool { + if o != nil && !IsNil(o.MinRam) { + return true + } + + return false +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *UpdateImagePayload) SetMinRam(v *int64) { + o.MinRam = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *UpdateImagePayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateImagePayload) SetName(v *string) { + o.Name = v +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetProtected() *bool { + if o == nil || IsNil(o.Protected) { + var ret *bool + return ret + } + return o.Protected +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetProtectedOk() (*bool, bool) { + if o == nil || IsNil(o.Protected) { + return nil, false + } + return o.Protected, true +} + +// HasProtected returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasProtected() bool { + if o != nil && !IsNil(o.Protected) { + return true + } + + return false +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *UpdateImagePayload) SetProtected(v *bool) { + o.Protected = v +} + +func (o UpdateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.DiskFormat) { + toSerialize["diskFormat"] = o.DiskFormat + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.MinDiskSize) { + toSerialize["minDiskSize"] = o.MinDiskSize + } + if !IsNil(o.MinRam) { + toSerialize["minRam"] = o.MinRam + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Protected) { + toSerialize["protected"] = o.Protected + } + return toSerialize, nil +} + +type NullableUpdateImagePayload struct { + value *UpdateImagePayload + isSet bool +} + +func (v NullableUpdateImagePayload) Get() *UpdateImagePayload { + return v.value +} + +func (v *NullableUpdateImagePayload) Set(val *UpdateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImagePayload(val *UpdateImagePayload) *NullableUpdateImagePayload { + return &NullableUpdateImagePayload{value: val, isSet: true} +} + +func (v NullableUpdateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_image_share_payload.go b/services/iaas/model_update_image_share_payload.go new file mode 100644 index 00000000..684537c2 --- /dev/null +++ b/services/iaas/model_update_image_share_payload.go @@ -0,0 +1,154 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImageSharePayload{} + +// UpdateImageSharePayload Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type UpdateImageSharePayload struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization *bool `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects *[]string `json:"projects,omitempty"` +} + +// NewUpdateImageSharePayload instantiates a new UpdateImageSharePayload 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 NewUpdateImageSharePayload() *UpdateImageSharePayload { + this := UpdateImageSharePayload{} + return &this +} + +// NewUpdateImageSharePayloadWithDefaults instantiates a new UpdateImageSharePayload 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 NewUpdateImageSharePayloadWithDefaults() *UpdateImageSharePayload { + this := UpdateImageSharePayload{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *UpdateImageSharePayload) GetParentOrganization() *bool { + if o == nil || IsNil(o.ParentOrganization) { + var ret *bool + return ret + } + return o.ParentOrganization +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImageSharePayload) GetParentOrganizationOk() (*bool, bool) { + if o == nil || IsNil(o.ParentOrganization) { + return nil, false + } + return o.ParentOrganization, true +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *UpdateImageSharePayload) HasParentOrganization() bool { + if o != nil && !IsNil(o.ParentOrganization) { + return true + } + + return false +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *UpdateImageSharePayload) SetParentOrganization(v *bool) { + o.ParentOrganization = v +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *UpdateImageSharePayload) GetProjects() *[]string { + if o == nil || IsNil(o.Projects) { + var ret *[]string + return ret + } + return o.Projects +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImageSharePayload) GetProjectsOk() (*[]string, bool) { + if o == nil || IsNil(o.Projects) { + return nil, false + } + return o.Projects, true +} + +// HasProjects returns a boolean if a field has been set. +func (o *UpdateImageSharePayload) HasProjects() bool { + if o != nil && !IsNil(o.Projects) { + return true + } + + return false +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *UpdateImageSharePayload) SetProjects(v *[]string) { + o.Projects = v +} + +func (o UpdateImageSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ParentOrganization) { + toSerialize["parentOrganization"] = o.ParentOrganization + } + if !IsNil(o.Projects) { + toSerialize["projects"] = o.Projects + } + return toSerialize, nil +} + +type NullableUpdateImageSharePayload struct { + value *UpdateImageSharePayload + isSet bool +} + +func (v NullableUpdateImageSharePayload) Get() *UpdateImageSharePayload { + return v.value +} + +func (v *NullableUpdateImageSharePayload) Set(val *UpdateImageSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImageSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImageSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImageSharePayload(val *UpdateImageSharePayload) *NullableUpdateImageSharePayload { + return &NullableUpdateImageSharePayload{value: val, isSet: true} +} + +func (v NullableUpdateImageSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImageSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_network_ipv4_body.go b/services/iaas/model_update_network_ipv4_body.go index 84d636b4..546385e8 100644 --- a/services/iaas/model_update_network_ipv4_body.go +++ b/services/iaas/model_update_network_ipv4_body.go @@ -44,7 +44,7 @@ func NewUpdateNetworkIPv4BodyWithDefaults() *UpdateNetworkIPv4Body { // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). func (o *UpdateNetworkIPv4Body) GetGateway() *string { - if o == nil || IsNil(o.Gateway.Get()) { + if o == nil || IsNil(o.Gateway) || IsNil(o.Gateway.Get()) { var ret *string return ret } @@ -55,7 +55,7 @@ func (o *UpdateNetworkIPv4Body) GetGateway() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateNetworkIPv4Body) GetGatewayOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Gateway) { return nil, false } return o.Gateway.Get(), o.Gateway.IsSet() @@ -63,7 +63,7 @@ func (o *UpdateNetworkIPv4Body) GetGatewayOk() (*string, bool) { // HasGateway returns a boolean if a field has been set. func (o *UpdateNetworkIPv4Body) HasGateway() bool { - if o != nil && o.Gateway.IsSet() { + if o != nil && !IsNil(o.Gateway) && o.Gateway.IsSet() { return true } @@ -72,16 +72,25 @@ func (o *UpdateNetworkIPv4Body) HasGateway() bool { // SetGateway gets a reference to the given string and assigns it to the Gateway field. func (o *UpdateNetworkIPv4Body) SetGateway(v *string) { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(v) } // SetGatewayNil sets the value for Gateway to be an explicit nil func (o *UpdateNetworkIPv4Body) SetGatewayNil() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(nil) } // UnsetGateway ensures that no value is present for Gateway, not even an explicit nil func (o *UpdateNetworkIPv4Body) UnsetGateway() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Unset() } diff --git a/services/iaas/model_update_network_ipv6_body.go b/services/iaas/model_update_network_ipv6_body.go index 9a67fb1f..7fd66ef6 100644 --- a/services/iaas/model_update_network_ipv6_body.go +++ b/services/iaas/model_update_network_ipv6_body.go @@ -44,7 +44,7 @@ func NewUpdateNetworkIPv6BodyWithDefaults() *UpdateNetworkIPv6Body { // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). func (o *UpdateNetworkIPv6Body) GetGateway() *string { - if o == nil || IsNil(o.Gateway.Get()) { + if o == nil || IsNil(o.Gateway) || IsNil(o.Gateway.Get()) { var ret *string return ret } @@ -55,7 +55,7 @@ func (o *UpdateNetworkIPv6Body) GetGateway() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateNetworkIPv6Body) GetGatewayOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Gateway) { return nil, false } return o.Gateway.Get(), o.Gateway.IsSet() @@ -63,7 +63,7 @@ func (o *UpdateNetworkIPv6Body) GetGatewayOk() (*string, bool) { // HasGateway returns a boolean if a field has been set. func (o *UpdateNetworkIPv6Body) HasGateway() bool { - if o != nil && o.Gateway.IsSet() { + if o != nil && !IsNil(o.Gateway) && o.Gateway.IsSet() { return true } @@ -72,16 +72,25 @@ func (o *UpdateNetworkIPv6Body) HasGateway() bool { // SetGateway gets a reference to the given string and assigns it to the Gateway field. func (o *UpdateNetworkIPv6Body) SetGateway(v *string) { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(v) } // SetGatewayNil sets the value for Gateway to be an explicit nil func (o *UpdateNetworkIPv6Body) SetGatewayNil() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Set(nil) } // UnsetGateway ensures that no value is present for Gateway, not even an explicit nil func (o *UpdateNetworkIPv6Body) UnsetGateway() { + if IsNil(o.Gateway) { + o.Gateway = new(NullableString) + } o.Gateway.Unset() } diff --git a/services/iaas/model_update_public_ip_payload.go b/services/iaas/model_update_public_ip_payload.go index 1c0f9743..6263b729 100644 --- a/services/iaas/model_update_public_ip_payload.go +++ b/services/iaas/model_update_public_ip_payload.go @@ -144,7 +144,7 @@ func (o *UpdatePublicIPPayload) SetLabels(v *map[string]interface{}) { // GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). func (o *UpdatePublicIPPayload) GetNetworkInterface() *string { - if o == nil || IsNil(o.NetworkInterface.Get()) { + if o == nil || IsNil(o.NetworkInterface) || IsNil(o.NetworkInterface.Get()) { var ret *string return ret } @@ -155,7 +155,7 @@ func (o *UpdatePublicIPPayload) GetNetworkInterface() *string { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdatePublicIPPayload) GetNetworkInterfaceOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NetworkInterface) { return nil, false } return o.NetworkInterface.Get(), o.NetworkInterface.IsSet() @@ -163,7 +163,7 @@ func (o *UpdatePublicIPPayload) GetNetworkInterfaceOk() (*string, bool) { // HasNetworkInterface returns a boolean if a field has been set. func (o *UpdatePublicIPPayload) HasNetworkInterface() bool { - if o != nil && o.NetworkInterface.IsSet() { + if o != nil && !IsNil(o.NetworkInterface) && o.NetworkInterface.IsSet() { return true } @@ -172,16 +172,25 @@ func (o *UpdatePublicIPPayload) HasNetworkInterface() bool { // SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. func (o *UpdatePublicIPPayload) SetNetworkInterface(v *string) { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Set(v) } // SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil func (o *UpdatePublicIPPayload) SetNetworkInterfaceNil() { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Set(nil) } // UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil func (o *UpdatePublicIPPayload) UnsetNetworkInterface() { + if IsNil(o.NetworkInterface) { + o.NetworkInterface = new(NullableString) + } o.NetworkInterface.Unset() } diff --git a/services/iaas/model_update_snapshot_payload.go b/services/iaas/model_update_snapshot_payload.go new file mode 100644 index 00000000..4cc2a0c2 --- /dev/null +++ b/services/iaas/model_update_snapshot_payload.go @@ -0,0 +1,154 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSnapshotPayload{} + +// UpdateSnapshotPayload Object that represents an update request body of a snapshot. +type UpdateSnapshotPayload struct { + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` +} + +// NewUpdateSnapshotPayload instantiates a new UpdateSnapshotPayload 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 NewUpdateSnapshotPayload() *UpdateSnapshotPayload { + this := UpdateSnapshotPayload{} + return &this +} + +// NewUpdateSnapshotPayloadWithDefaults instantiates a new UpdateSnapshotPayload 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 NewUpdateSnapshotPayloadWithDefaults() *UpdateSnapshotPayload { + this := UpdateSnapshotPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateSnapshotPayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSnapshotPayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateSnapshotPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateSnapshotPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateSnapshotPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// 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 *UpdateSnapshotPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateSnapshotPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateSnapshotPayload) SetName(v *string) { + o.Name = v +} + +func (o UpdateSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableUpdateSnapshotPayload struct { + value *UpdateSnapshotPayload + isSet bool +} + +func (v NullableUpdateSnapshotPayload) Get() *UpdateSnapshotPayload { + return v.value +} + +func (v *NullableUpdateSnapshotPayload) Set(val *UpdateSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateSnapshotPayload(val *UpdateSnapshotPayload) *NullableUpdateSnapshotPayload { + return &NullableUpdateSnapshotPayload{value: val, isSet: true} +} + +func (v NullableUpdateSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_volume_payload.go b/services/iaas/model_update_volume_payload.go index ea1a84d5..cb69b67e 100644 --- a/services/iaas/model_update_volume_payload.go +++ b/services/iaas/model_update_volume_payload.go @@ -22,7 +22,8 @@ type UpdateVolumePayload struct { // Indicates if a volume is bootable. Bootable *bool `json:"bootable,omitempty"` // Description Object. Allows string up to 127 Characters. - Description *string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` + ImageConfig *ImageConfig `json:"imageConfig,omitempty"` // Object that represents the labels of an object. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. @@ -114,6 +115,38 @@ func (o *UpdateVolumePayload) SetDescription(v *string) { o.Description = v } +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetImageConfig() *ImageConfig { + if o == nil || IsNil(o.ImageConfig) { + var ret *ImageConfig + return ret + } + return o.ImageConfig +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetImageConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.ImageConfig) { + return nil, false + } + return o.ImageConfig, true +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasImageConfig() bool { + if o != nil && !IsNil(o.ImageConfig) { + return true + } + + return false +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *UpdateVolumePayload) SetImageConfig(v *ImageConfig) { + o.ImageConfig = v +} + // GetLabels returns the Labels field value if set, zero value otherwise. func (o *UpdateVolumePayload) GetLabels() *map[string]interface{} { if o == nil || IsNil(o.Labels) { @@ -186,6 +219,9 @@ func (o UpdateVolumePayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } + if !IsNil(o.ImageConfig) { + toSerialize["imageConfig"] = o.ImageConfig + } if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } diff --git a/services/iaas/model_volume.go b/services/iaas/model_volume.go index 0fc6f45b..29314efe 100644 --- a/services/iaas/model_volume.go +++ b/services/iaas/model_volume.go @@ -30,7 +30,8 @@ type Volume struct { // Description Object. Allows string up to 127 Characters. Description *string `json:"description,omitempty"` // Universally Unique Identifier (UUID). - Id *string `json:"id,omitempty"` + Id *string `json:"id,omitempty"` + ImageConfig *ImageConfig `json:"imageConfig,omitempty"` // Object that represents the labels of an object. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. @@ -70,7 +71,7 @@ func NewVolumeWithDefaults() *Volume { // GetAvailabilityZone returns the AvailabilityZone field value func (o *Volume) GetAvailabilityZone() *string { - if o == nil { + if o == nil || IsNil(o.AvailabilityZone) { var ret *string return ret } @@ -220,6 +221,38 @@ func (o *Volume) SetId(v *string) { o.Id = v } +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *Volume) GetImageConfig() *ImageConfig { + if o == nil || IsNil(o.ImageConfig) { + var ret *ImageConfig + return ret + } + return o.ImageConfig +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetImageConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.ImageConfig) { + return nil, false + } + return o.ImageConfig, true +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *Volume) HasImageConfig() bool { + if o != nil && !IsNil(o.ImageConfig) { + return true + } + + return false +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *Volume) SetImageConfig(v *ImageConfig) { + o.ImageConfig = v +} + // GetLabels returns the Labels field value if set, zero value otherwise. func (o *Volume) GetLabels() *map[string]interface{} { if o == nil || IsNil(o.Labels) { @@ -491,6 +524,9 @@ func (o Volume) ToMap() (map[string]interface{}, error) { if !IsNil(o.Id) { toSerialize["id"] = o.Id } + if !IsNil(o.ImageConfig) { + toSerialize["imageConfig"] = o.ImageConfig + } if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } diff --git a/services/iaas/model_volume_attachment_list_response.go b/services/iaas/model_volume_attachment_list_response.go index 75da5621..60dcb371 100644 --- a/services/iaas/model_volume_attachment_list_response.go +++ b/services/iaas/model_volume_attachment_list_response.go @@ -46,7 +46,7 @@ func NewVolumeAttachmentListResponseWithDefaults() *VolumeAttachmentListResponse // GetItems returns the Items field value func (o *VolumeAttachmentListResponse) GetItems() *[]VolumeAttachment { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]VolumeAttachment return ret } diff --git a/services/iaas/model_volume_list_response.go b/services/iaas/model_volume_list_response.go index d8ea37c3..db92419c 100644 --- a/services/iaas/model_volume_list_response.go +++ b/services/iaas/model_volume_list_response.go @@ -46,7 +46,7 @@ func NewVolumeListResponseWithDefaults() *VolumeListResponse { // GetItems returns the Items field value func (o *VolumeListResponse) GetItems() *[]Volume { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]Volume return ret } diff --git a/services/iaas/model_volume_performance_class.go b/services/iaas/model_volume_performance_class.go index 5174f006..f6eec0ef 100644 --- a/services/iaas/model_volume_performance_class.go +++ b/services/iaas/model_volume_performance_class.go @@ -150,7 +150,7 @@ func (o *VolumePerformanceClass) SetLabels(v *map[string]interface{}) { // GetName returns the Name field value func (o *VolumePerformanceClass) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } diff --git a/services/iaas/model_volume_performance_class_list_response.go b/services/iaas/model_volume_performance_class_list_response.go index 63b700b5..83b346e2 100644 --- a/services/iaas/model_volume_performance_class_list_response.go +++ b/services/iaas/model_volume_performance_class_list_response.go @@ -46,7 +46,7 @@ func NewVolumePerformanceClassListResponseWithDefaults() *VolumePerformanceClass // GetItems returns the Items field value func (o *VolumePerformanceClassListResponse) GetItems() *[]VolumePerformanceClass { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]VolumePerformanceClass return ret } diff --git a/services/iaas/model_volume_source.go b/services/iaas/model_volume_source.go index a18f1349..26d74137 100644 --- a/services/iaas/model_volume_source.go +++ b/services/iaas/model_volume_source.go @@ -50,7 +50,7 @@ func NewVolumeSourceWithDefaults() *VolumeSource { // GetId returns the Id field value func (o *VolumeSource) GetId() *string { - if o == nil { + if o == nil || IsNil(o.Id) { var ret *string return ret } @@ -74,7 +74,7 @@ func (o *VolumeSource) SetId(v *string) { // GetType returns the Type field value func (o *VolumeSource) GetType() *string { - if o == nil { + if o == nil || IsNil(o.Type) { var ret *string return ret }