diff --git a/services/iaasalpha/api_default.go b/services/iaasalpha/api_default.go index e9ab87dd4..1478d29a6 100644 --- a/services/iaasalpha/api_default.go +++ b/services/iaasalpha/api_default.go @@ -3613,32 +3613,43 @@ func (a *APIClient) DeleteImageExecute(ctx context.Context, projectId string, im return r.Execute() } -type ApiDeleteKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - keypairName string +type ApiDeleteImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string } -func (r ApiDeleteKeyPairRequest) Execute() error { +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.DeleteKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShare") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/keypairs/{keypairName}" - localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + localVarPath := localBasePath + "/v1alpha1/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.keypairName) > 127 { - return fmt.Errorf("keypairName must have less than 127 elements") + 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 @@ -3751,55 +3762,58 @@ func (r ApiDeleteKeyPairRequest) Execute() error { } /* -DeleteKeyPair: Delete an SSH keypair. +DeleteImageShare: Remove image share. -Delete an SSH keypair from a user. +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 keypairName The name of an SSH keypair. - @return ApiDeleteKeyPairRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageShareRequest */ -func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { - return ApiDeleteKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +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) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { - r := ApiDeleteKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +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 ApiDeleteNicRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - nicId string +type ApiDeleteImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + consumerProjectId string } -func (r ApiDeleteNicRequest) Execute() error { +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.DeleteNic") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShareConsumer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" 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) + 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{} @@ -3810,17 +3824,17 @@ func (r ApiDeleteNicRequest) 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.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") } - if strlen(r.nicId) < 36 { - return fmt.Errorf("nicId must have at least 36 elements") + if strlen(r.consumerProjectId) < 36 { + return fmt.Errorf("consumerProjectId must have at least 36 elements") } - if strlen(r.nicId) > 36 { - return fmt.Errorf("nicId must have less than 36 elements") + if strlen(r.consumerProjectId) > 36 { + return fmt.Errorf("consumerProjectId must have less than 36 elements") } // to determine the Content-Type header @@ -3933,74 +3947,63 @@ func (r ApiDeleteNicRequest) Execute() error { } /* -DeleteNic: Delete a network interface. +DeleteImageShareConsumer: Remove an image share consumer. -Delete a network interface that is part of the project. +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 networkId The identifier (ID) of a STACKIT Network. - @param nicId The identifier (ID) of a network interface. - @return ApiDeleteNicRequest + @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) 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) 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) DeleteNicExecute(ctx context.Context, projectId string, networkId string, nicId string) error { - r := ApiDeleteNicRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, - nicId: nicId, +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 ApiDeletePublicIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - publicIpId string +type ApiDeleteKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string } -func (r ApiDeletePublicIPRequest) Execute() error { +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.DeletePublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/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 + "/v1alpha1/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.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") + if strlen(r.keypairName) > 127 { + return fmt.Errorf("keypairName must have less than 127 elements") } // to determine the Content-Type header @@ -4113,56 +4116,55 @@ func (r ApiDeletePublicIPRequest) Execute() error { } /* -DeletePublicIP: Delete a public IP. +DeleteKeyPair: Delete an SSH keypair. -Delete a public IP that is part of the project. +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 projectId The identifier (ID) of a STACKIT Project. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiDeletePublicIPRequest + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest */ -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) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { + return ApiDeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, } } -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) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { + r := ApiDeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, } return r.Execute() } -type ApiDeleteSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string +type ApiDeleteNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + nicId string } -func (r ApiDeleteSecurityGroupRequest) Execute() error { +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.DeleteSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNic") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/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, "{"+"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{} @@ -4173,11 +4175,17 @@ func (r ApiDeleteSecurityGroupRequest) Execute() error { 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.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId must have less than 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 @@ -4273,17 +4281,6 @@ func (r ApiDeleteSecurityGroupRequest) 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")) @@ -4301,58 +4298,59 @@ func (r ApiDeleteSecurityGroupRequest) Execute() error { } /* -DeleteSecurityGroup: Delete security group. +DeleteNic: Delete a network interface. -Delete a security group. +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 securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiDeleteSecurityGroupRequest + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest */ -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) 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) DeleteSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) error { - r := ApiDeleteSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +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 ApiDeleteSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - securityGroupRuleId string +type ApiDeletePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + publicIpId string } -func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { +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.DeleteSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/public-ips/{publicIpId}" 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, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -4363,17 +4361,11 @@ func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { 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.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") } - if strlen(r.securityGroupRuleId) > 36 { - return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") } // to determine the Content-Type header @@ -4486,59 +4478,56 @@ func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { } /* -DeleteSecurityGroupRule: Delete security group rule. +DeletePublicIP: Delete a public IP. -Delete a security group rule. +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 securityGroupId The identifier (ID) of a STACKIT Security Group. - @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. - @return ApiDeleteSecurityGroupRuleRequest + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest */ -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) DeletePublicIP(ctx context.Context, projectId string, publicIpId string) ApiDeletePublicIPRequest { + return ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, } } -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) DeletePublicIPExecute(ctx context.Context, projectId string, publicIpId string) error { + r := ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, } return r.Execute() } -type ApiDeleteServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiDeleteSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string } -func (r ApiDeleteServerRequest) Execute() error { +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.DeleteServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/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{} @@ -4549,11 +4538,11 @@ func (r ApiDeleteServerRequest) 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.securityGroupId) < 36 { + return 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 fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header @@ -4649,6 +4638,17 @@ func (r ApiDeleteServerRequest) 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")) @@ -4666,58 +4666,58 @@ func (r ApiDeleteServerRequest) Execute() error { } /* -DeleteServer: Delete a server. +DeleteSecurityGroup: Delete security group. -Delete a server. Volumes won't be deleted. +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 serverId The identifier (ID) of a STACKIT Server. - @return ApiDeleteServerRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest */ -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) DeleteSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiDeleteSecurityGroupRequest { + return ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiDeleteServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +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 ApiDeleteVirtualIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - virtualIpId string +type ApiDeleteSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string } -func (r ApiDeleteVirtualIPRequest) Execute() error { +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.DeleteVirtualIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" 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, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(r.virtualIpId, "virtualIpId")), -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{} @@ -4728,17 +4728,17 @@ func (r ApiDeleteVirtualIPRequest) 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.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") } - if strlen(r.virtualIpId) < 36 { - return fmt.Errorf("virtualIpId must have at least 36 elements") + if strlen(r.securityGroupRuleId) < 36 { + return fmt.Errorf("securityGroupRuleId must have at least 36 elements") } - if strlen(r.virtualIpId) > 36 { - return fmt.Errorf("virtualIpId must have less than 36 elements") + if strlen(r.securityGroupRuleId) > 36 { + return fmt.Errorf("securityGroupRuleId must have less than 36 elements") } // to determine the Content-Type header @@ -4851,59 +4851,59 @@ func (r ApiDeleteVirtualIPRequest) Execute() error { } /* -DeleteVirtualIP: Delete a virtual IP. +DeleteSecurityGroupRule: Delete security group rule. -Delete a virtual IP that is part of the project. +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 networkId The identifier (ID) of a STACKIT Network. - @param virtualIpId The identifier (ID) of a Virtual IP. - @return ApiDeleteVirtualIPRequest + @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) DeleteVirtualIP(ctx context.Context, projectId string, networkId string, virtualIpId string) ApiDeleteVirtualIPRequest { - return ApiDeleteVirtualIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, - virtualIpId: virtualIpId, +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) DeleteVirtualIPExecute(ctx context.Context, projectId string, networkId string, virtualIpId string) error { - r := ApiDeleteVirtualIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, - virtualIpId: virtualIpId, +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 ApiDeleteVolumeRequest struct { +type ApiDeleteServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string - volumeId string + serverId string } -func (r ApiDeleteVolumeRequest) Execute() error { +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.DeleteVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes/{volumeId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}" 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{} @@ -4914,11 +4914,11 @@ func (r ApiDeleteVolumeRequest) 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 @@ -5014,17 +5014,6 @@ func (r ApiDeleteVolumeRequest) 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")) @@ -5042,59 +5031,820 @@ func (r ApiDeleteVolumeRequest) Execute() error { } /* -DeleteVolume: Delete a volume. +DeleteServer: Delete a server. -Delete a volume inside a project. The deletion will fail if the volume is still in use. +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 volumeId The identifier (ID) of a STACKIT Volume. - @return ApiDeleteVolumeRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest */ -func (a *APIClient) DeleteVolume(ctx context.Context, projectId string, volumeId string) ApiDeleteVolumeRequest { - return ApiDeleteVolumeRequest{ +func (a *APIClient) DeleteServer(ctx context.Context, projectId string, serverId string) ApiDeleteServerRequest { + return ApiDeleteServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - volumeId: volumeId, + serverId: serverId, } } -func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, volumeId string) error { - r := ApiDeleteVolumeRequest{ +func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeleteServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - volumeId: volumeId, + serverId: serverId, } return r.Execute() } -type ApiGetAttachedVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - volumeId string -} - -func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { - var ( +type ApiDeleteVirtualIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + virtualIpId string +} + +func (r ApiDeleteVirtualIPRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVirtualIP") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}" + 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, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(r.virtualIpId, "virtualIpId")), -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.virtualIpId) < 36 { + return fmt.Errorf("virtualIpId must have at least 36 elements") + } + if strlen(r.virtualIpId) > 36 { + return fmt.Errorf("virtualIpId 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 +} + +/* +DeleteVirtualIP: Delete a virtual IP. + +Delete a virtual 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 networkId The identifier (ID) of a STACKIT Network. + @param virtualIpId The identifier (ID) of a Virtual IP. + @return ApiDeleteVirtualIPRequest +*/ +func (a *APIClient) DeleteVirtualIP(ctx context.Context, projectId string, networkId string, virtualIpId string) ApiDeleteVirtualIPRequest { + return ApiDeleteVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, + } +} + +func (a *APIClient) DeleteVirtualIPExecute(ctx context.Context, projectId string, networkId string, virtualIpId string) error { + r := ApiDeleteVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, + } + 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 + "/v1alpha1/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 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 + "/v1alpha1/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 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 *VolumeAttachment + localVarReturnValue *Image ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImage") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath := localBasePath + "/v1alpha1/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, "{"+"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 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 + "/v1alpha1/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{} @@ -5105,17 +5855,11 @@ 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.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") } // to determine the Content-Type header @@ -5238,60 +5982,59 @@ func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { } /* -GetAttachedVolume: Get Volume Attachment details. +GetImageShare: Get share details of an image. -Get the details of an existing Volume Attachment. +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 serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiGetAttachedVolumeRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageShareRequest */ -func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { - return ApiGetAttachedVolumeRequest{ +func (a *APIClient) GetImageShare(ctx context.Context, projectId string, imageId string) ApiGetImageShareRequest { + return ApiGetImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } } -func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { - r := ApiGetAttachedVolumeRequest{ +func (a *APIClient) GetImageShareExecute(ctx context.Context, projectId string, imageId string) (*ImageShare, error) { + r := ApiGetImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } return r.Execute() } -type ApiGetImageRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - imageId string +type ApiGetImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + consumerProjectId string } -func (r ApiGetImageRequest) Execute() (*Image, error) { +func (r ApiGetImageShareConsumerRequest) Execute() (*ImageShareConsumer, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Image + localVarReturnValue *ImageShareConsumer ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImage") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShareConsumer") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/images/{imageId}" + localVarPath := localBasePath + "/v1alpha1/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{} @@ -5308,6 +6051,12 @@ func (r ApiGetImageRequest) Execute() (*Image, error) { 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{} @@ -5429,30 +6178,33 @@ func (r ApiGetImageRequest) Execute() (*Image, error) { } /* -GetImage: Get details about an image. +GetImageShareConsumer: Get image share consumer. -Get details about a specific Image inside a project. +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. - @return ApiGetImageRequest + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiGetImageShareConsumerRequest */ -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) 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) GetImageExecute(ctx context.Context, projectId string, imageId string) (*Image, error) { - r := ApiGetImageRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - imageId: imageId, +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() } @@ -6360,7 +7112,7 @@ func (r ApiGetNicRequest) Execute() (*NIC, error) { } /* -GetNic: Get details about a network interface. +GetNic: Get details about a network interface of a network. Get details about a network interface inside a network. @@ -7907,17 +8659,17 @@ func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId strin } type ApiGetServerLogRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - getServerLogRequest *GetServerLogRequest + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + length *int64 } -// Request the server log. By default the length is limited to 2000 lines. +// Request the server log. By default the length is limited to 2000 lines. Set to 0 to retrieve the complete log. -func (r ApiGetServerLogRequest) GetServerLogRequest(getServerLogRequest GetServerLogRequest) ApiGetServerLogRequest { - r.getServerLogRequest = &getServerLogRequest +func (r ApiGetServerLogRequest) Length(length int64) ApiGetServerLogRequest { + r.length = &length return r } @@ -7954,8 +8706,11 @@ func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { 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{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -7971,8 +8726,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 @@ -8648,73 +9401,245 @@ func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, } /* -GetVolumePerformanceClass: Get details about a volume performance class. +GetVolumePerformanceClass: Get details about a volume performance class. + +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 projectId The identifier (ID) of a STACKIT Project. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest +*/ +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) 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 ApiListAttachedVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachmentListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/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.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") + } + + // 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 +} + +/* +ListAttachedVolumes: List all volume attachments of a server. -Get details about a specific volume performance class. +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 projectId The identifier (ID) of a STACKIT Project. - @param volumePerformanceClass The name of a STACKIT Volume performance class. - @return ApiGetVolumePerformanceClassRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest */ -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) ListAttachedVolumes(ctx context.Context, projectId string, serverId string) ApiListAttachedVolumesRequest { + return ApiListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -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) 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 ApiListAttachedVolumesRequest struct { +type ApiListAvailabilityZonesRequest struct { ctx context.Context apiService *DefaultApiService - projectId string - serverId string } -func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { +func (r ApiListAvailabilityZonesRequest) Execute() (*AvailabilityZoneListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachmentListResponse + localVarReturnValue *AvailabilityZoneListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAvailabilityZones") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/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) + localVarPath := localBasePath + "/v1alpha1/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.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{} @@ -8836,30 +9761,24 @@ func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, } /* -ListAttachedVolumes: List all volume attachments of a server. +ListAvailabilityZones: List all availability zones. -Get a list of all volume attachments of a server. +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 serverId The identifier (ID) of a STACKIT Server. - @return ApiListAttachedVolumesRequest + @return ApiListAvailabilityZonesRequest */ -func (a *APIClient) ListAttachedVolumes(ctx context.Context, projectId string, serverId string) ApiListAttachedVolumesRequest { - return ApiListAttachedVolumesRequest{ +func (a *APIClient) ListAvailabilityZones(ctx context.Context) ApiListAvailabilityZonesRequest { + return ApiListAvailabilityZonesRequest{ 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) ListAvailabilityZonesExecute(ctx context.Context) (*AvailabilityZoneListResponse, error) { + r := ApiListAvailabilityZonesRequest{ apiService: a.defaultApi, ctx: ctx, - projectId: projectId, - serverId: serverId, } return r.Execute() } @@ -14071,22 +14990,224 @@ func (r ApiResizeVolumeRequest) Execute() error { localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes/{volumeId}/resize" 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, "{"+"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{"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.resizeVolumePayload + 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 +} + +/* +ResizeVolume: Update the size of a volume. + +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 volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest +*/ +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) ResizeVolumeExecute(ctx context.Context, projectId string, volumeId string) error { + r := ApiResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiSetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + setImageSharePayload *SetImageSharePayload +} + +// 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.SetImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/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") + 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.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return 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.setImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("setImageSharePayload is required and must be specified") } // to determine the Content-Type header @@ -14107,10 +15228,10 @@ func (r ApiResizeVolumeRequest) Execute() error { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.resizeVolumePayload + 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) @@ -14124,14 +15245,14 @@ func (r ApiResizeVolumeRequest) 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 { @@ -14145,97 +15266,96 @@ func (r ApiResizeVolumeRequest) 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 } /* -ResizeVolume: Update the size of a volume. +SetImageShare: Set image share. -Update the size of a block device volume. The new volume size must be larger than the current size. +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 volumeId The identifier (ID) of a STACKIT Volume. - @return ApiResizeVolumeRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiSetImageShareRequest */ -func (a *APIClient) ResizeVolume(ctx context.Context, projectId string, volumeId string) ApiResizeVolumeRequest { - return ApiResizeVolumeRequest{ +func (a *APIClient) SetImageShare(ctx context.Context, projectId string, imageId string) ApiSetImageShareRequest { + return ApiSetImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - volumeId: volumeId, + imageId: imageId, } } -func (a *APIClient) ResizeVolumeExecute(ctx context.Context, projectId string, volumeId string) error { - r := ApiResizeVolumeRequest{ +func (a *APIClient) SetImageShareExecute(ctx context.Context, projectId string, imageId string) (*ImageShare, error) { + r := ApiSetImageShareRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - volumeId: volumeId, + imageId: imageId, } return r.Execute() } @@ -15217,6 +16337,207 @@ func (a *APIClient) UpdateImageExecute(ctx context.Context, projectId string, im return r.Execute() } +type ApiUpdateImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + updateImageSharePayload *UpdateImageSharePayload +} + +// Update an Image Share. + +func (r ApiUpdateImageShareRequest) UpdateImageSharePayload(updateImageSharePayload UpdateImageSharePayload) ApiUpdateImageShareRequest { + r.updateImageSharePayload = &updateImageSharePayload + return r +} + +func (r ApiUpdateImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/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") + } + if r.updateImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImageSharePayload 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.updateImageSharePayload + 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 +} + +/* +UpdateImageShare: Update image share. + +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 imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageShareRequest +*/ +func (a *APIClient) UpdateImageShare(ctx context.Context, projectId string, imageId string) ApiUpdateImageShareRequest { + return ApiUpdateImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } +} + +func (a *APIClient) UpdateImageShareExecute(ctx context.Context, projectId string, imageId string) (*ImageShare, error) { + r := ApiUpdateImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } + return r.Execute() +} + type ApiUpdateKeyPairRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/iaasalpha/api_default_test.go b/services/iaasalpha/api_default_test.go index 4b56d9e33..f0b6d8266 100644 --- a/services/iaasalpha/api_default_test.go +++ b/services/iaasalpha/api_default_test.go @@ -987,6 +987,107 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService DeleteImageShare", func(t *testing.T) { + path := "/v1alpha1/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) { + }) + 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 iaasalpha_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" + + reqErr := apiClient.DeleteImageShare(context.Background(), projectId, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteImageShareConsumer", func(t *testing.T) { + path := "/v1alpha1/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) { + }) + 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 iaasalpha_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" + + reqErr := apiClient.DeleteImageShareConsumer(context.Background(), projectId, imageId, consumerProjectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) { path := "/v1alpha1/keypairs/{keypairName}" keypairNameValue := "keypairName" @@ -1498,6 +1599,119 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService GetImageShare", func(t *testing.T) { + path := "/v1alpha1/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 iaasalpha_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 := "/v1alpha1/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 iaasalpha_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 := "/v1alpha1/keypairs/{keypairName}" keypairNameValue := "keypairName" @@ -2491,6 +2705,54 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService ListAvailabilityZones", func(t *testing.T) { + path := "/v1alpha1/availability-zones" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := AvailabilityZoneListResponse{} + 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 iaasalpha_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) + } + + resp, reqErr := apiClient.ListAvailabilityZones(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService ListImages", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/images" projectIdValue := "projectId" @@ -3960,6 +4222,62 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService SetImageShare", func(t *testing.T) { + path := "/v1alpha1/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 iaasalpha_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" + setImageSharePayload := SetImageSharePayload{} + + 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 StartServer", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/servers/{serverId}/start" projectIdValue := "projectId" @@ -4222,6 +4540,62 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService UpdateImageShare", func(t *testing.T) { + path := "/v1alpha1/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 iaasalpha_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" + updateImageSharePayload := UpdateImageSharePayload{} + + resp, reqErr := apiClient.UpdateImageShare(context.Background(), projectId, imageId).UpdateImageSharePayload(updateImageSharePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService UpdateKeyPair", func(t *testing.T) { path := "/v1alpha1/keypairs/{keypairName}" keypairNameValue := "keypairName" diff --git a/services/iaasalpha/model_add_member_to_virtual_ip_payload.go b/services/iaasalpha/model_add_member_to_virtual_ip_payload.go index 704cbd917..6ac14e4ee 100644 --- a/services/iaasalpha/model_add_member_to_virtual_ip_payload.go +++ b/services/iaasalpha/model_add_member_to_virtual_ip_payload.go @@ -46,7 +46,7 @@ func NewAddMemberToVirtualIPPayloadWithDefaults() *AddMemberToVirtualIPPayload { // GetMember returns the Member field value func (o *AddMemberToVirtualIPPayload) GetMember() *string { - if o == nil { + if o == nil || IsNil(o.Member) { var ret *string return ret } diff --git a/services/iaasalpha/model_area_config.go b/services/iaasalpha/model_area_config.go index f905e44b9..73b6267bc 100644 --- a/services/iaasalpha/model_area_config.go +++ b/services/iaasalpha/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/iaasalpha/model_availability_zone_list_response.go b/services/iaasalpha/model_availability_zone_list_response.go new file mode 100644 index 000000000..861580497 --- /dev/null +++ b/services/iaasalpha/model_availability_zone_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +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/iaasalpha/model_base_security_group_rule.go b/services/iaasalpha/model_base_security_group_rule.go index a43f1fefb..701b146f1 100644 --- a/services/iaasalpha/model_base_security_group_rule.go +++ b/services/iaasalpha/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/iaasalpha/model_boot_volume_source.go b/services/iaasalpha/model_boot_volume_source.go index c163b12fa..e1cee12b7 100644 --- a/services/iaasalpha/model_boot_volume_source.go +++ b/services/iaasalpha/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/iaasalpha/model_create_area_ipv4.go b/services/iaasalpha/model_create_area_ipv4.go index e206d5fe1..63a26df2f 100644 --- a/services/iaasalpha/model_create_area_ipv4.go +++ b/services/iaasalpha/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/iaasalpha/model_create_image_payload.go b/services/iaasalpha/model_create_image_payload.go index fdc79f52b..055fb4c2e 100644 --- a/services/iaasalpha/model_create_image_payload.go +++ b/services/iaasalpha/model_create_image_payload.go @@ -37,7 +37,9 @@ type CreateImagePayload struct { MinRam *int64 `json:"minRam,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED - Name *string `json:"name"` + 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"` @@ -166,7 +168,7 @@ func (o *CreateImagePayload) SetCreatedAt(v *time.Time) { // GetDiskFormat returns the DiskFormat field value func (o *CreateImagePayload) GetDiskFormat() *string { - if o == nil { + if o == nil || IsNil(o.DiskFormat) { var ret *string return ret } @@ -318,7 +320,7 @@ func (o *CreateImagePayload) SetMinRam(v *int64) { // GetName returns the Name field value func (o *CreateImagePayload) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } @@ -340,6 +342,38 @@ 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) { @@ -493,6 +527,9 @@ func (o CreateImagePayload) ToMap() (map[string]interface{}, error) { toSerialize["minRam"] = o.MinRam } toSerialize["name"] = o.Name + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } if !IsNil(o.Protected) { toSerialize["protected"] = o.Protected } diff --git a/services/iaasalpha/model_create_key_pair_payload.go b/services/iaasalpha/model_create_key_pair_payload.go index 7b82f33e1..5f72936c3 100644 --- a/services/iaasalpha/model_create_key_pair_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_create_public_ip_payload.go b/services/iaasalpha/model_create_public_ip_payload.go index df0c594dc..864b9f646 100644 --- a/services/iaasalpha/model_create_public_ip_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_create_security_group_payload.go b/services/iaasalpha/model_create_security_group_payload.go index cca8cfa47..5de179ad7 100644 --- a/services/iaasalpha/model_create_security_group_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_create_security_group_rule_payload.go b/services/iaasalpha/model_create_security_group_rule_payload.go index 282fce371..515ec9e38 100644 --- a/services/iaasalpha/model_create_security_group_rule_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_create_server_payload.go b/services/iaasalpha/model_create_server_payload.go index a4ff9cc7a..2bcf530f7 100644 --- a/services/iaasalpha/model_create_server_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_create_volume_payload.go b/services/iaasalpha/model_create_volume_payload.go index d35849e3d..8b4963ddd 100644 --- a/services/iaasalpha/model_create_volume_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_error.go b/services/iaasalpha/model_error.go index 6b1c1b4fe..621533326 100644 --- a/services/iaasalpha/model_error.go +++ b/services/iaasalpha/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/iaasalpha/model_get_server_log_request.go b/services/iaasalpha/model_get_server_log_request.go deleted file mode 100644 index 76d4f94d5..000000000 --- a/services/iaasalpha/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: 1alpha1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package iaasalpha - -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/iaasalpha/model_icmp_parameters.go b/services/iaasalpha/model_icmp_parameters.go index 1edbe5386..4b11ab4de 100644 --- a/services/iaasalpha/model_icmp_parameters.go +++ b/services/iaasalpha/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/iaasalpha/model_image.go b/services/iaasalpha/model_image.go index e6e523da5..0ec94b296 100644 --- a/services/iaasalpha/model_image.go +++ b/services/iaasalpha/model_image.go @@ -37,7 +37,9 @@ type Image struct { MinRam *int64 `json:"minRam,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED - Name *string `json:"name"` + 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"` @@ -166,7 +168,7 @@ func (o *Image) SetCreatedAt(v *time.Time) { // GetDiskFormat returns the DiskFormat field value func (o *Image) GetDiskFormat() *string { - if o == nil { + if o == nil || IsNil(o.DiskFormat) { var ret *string return ret } @@ -318,7 +320,7 @@ func (o *Image) SetMinRam(v *int64) { // GetName returns the Name field value func (o *Image) GetName() *string { - if o == nil { + if o == nil || IsNil(o.Name) { var ret *string return ret } @@ -340,6 +342,38 @@ 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) { @@ -493,6 +527,9 @@ func (o Image) ToMap() (map[string]interface{}, error) { toSerialize["minRam"] = o.MinRam } toSerialize["name"] = o.Name + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } if !IsNil(o.Protected) { toSerialize["protected"] = o.Protected } diff --git a/services/iaasalpha/model_image_checksum.go b/services/iaasalpha/model_image_checksum.go index 48df5c5b1..67852b70d 100644 --- a/services/iaasalpha/model_image_checksum.go +++ b/services/iaasalpha/model_image_checksum.go @@ -50,7 +50,7 @@ func NewImageChecksumWithDefaults() *ImageChecksum { // GetAlgorithm returns the Algorithm field value func (o *ImageChecksum) GetAlgorithm() *string { - if o == nil { + if o == nil || IsNil(o.Algorithm) { var ret *string return ret } @@ -74,7 +74,7 @@ func (o *ImageChecksum) SetAlgorithm(v *string) { // GetDigest returns the Digest field value func (o *ImageChecksum) GetDigest() *string { - if o == nil { + if o == nil || IsNil(o.Digest) { var ret *string return ret } diff --git a/services/iaasalpha/model_image_config.go b/services/iaasalpha/model_image_config.go index 4ab9cee04..4de9351eb 100644 --- a/services/iaasalpha/model_image_config.go +++ b/services/iaasalpha/model_image_config.go @@ -114,7 +114,7 @@ func (o *ImageConfig) SetBootMenu(v *bool) { // 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.Get()) { + if o == nil || IsNil(o.CdromBus) || IsNil(o.CdromBus.Get()) { var ret *string return ret } @@ -125,7 +125,7 @@ func (o *ImageConfig) GetCdromBus() *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 *ImageConfig) GetCdromBusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CdromBus) { return nil, false } return o.CdromBus.Get(), o.CdromBus.IsSet() @@ -133,7 +133,7 @@ func (o *ImageConfig) GetCdromBusOk() (*string, bool) { // HasCdromBus returns a boolean if a field has been set. func (o *ImageConfig) HasCdromBus() bool { - if o != nil && o.CdromBus.IsSet() { + if o != nil && !IsNil(o.CdromBus) && o.CdromBus.IsSet() { return true } @@ -142,22 +142,31 @@ func (o *ImageConfig) HasCdromBus() bool { // 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.Get()) { + if o == nil || IsNil(o.DiskBus) || IsNil(o.DiskBus.Get()) { var ret *string return ret } @@ -168,7 +177,7 @@ func (o *ImageConfig) GetDiskBus() *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 *ImageConfig) GetDiskBusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DiskBus) { return nil, false } return o.DiskBus.Get(), o.DiskBus.IsSet() @@ -176,7 +185,7 @@ func (o *ImageConfig) GetDiskBusOk() (*string, bool) { // HasDiskBus returns a boolean if a field has been set. func (o *ImageConfig) HasDiskBus() bool { - if o != nil && o.DiskBus.IsSet() { + if o != nil && !IsNil(o.DiskBus) && o.DiskBus.IsSet() { return true } @@ -185,22 +194,31 @@ func (o *ImageConfig) HasDiskBus() bool { // 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.Get()) { + if o == nil || IsNil(o.NicModel) || IsNil(o.NicModel.Get()) { var ret *string return ret } @@ -211,7 +229,7 @@ func (o *ImageConfig) GetNicModel() *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 *ImageConfig) GetNicModelOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NicModel) { return nil, false } return o.NicModel.Get(), o.NicModel.IsSet() @@ -219,7 +237,7 @@ func (o *ImageConfig) GetNicModelOk() (*string, bool) { // HasNicModel returns a boolean if a field has been set. func (o *ImageConfig) HasNicModel() bool { - if o != nil && o.NicModel.IsSet() { + if o != nil && !IsNil(o.NicModel) && o.NicModel.IsSet() { return true } @@ -228,16 +246,25 @@ func (o *ImageConfig) HasNicModel() bool { // 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() } @@ -275,7 +302,7 @@ func (o *ImageConfig) SetOperatingSystem(v *string) { // 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.Get()) { + if o == nil || IsNil(o.OperatingSystemDistro) || IsNil(o.OperatingSystemDistro.Get()) { var ret *string return ret } @@ -286,7 +313,7 @@ func (o *ImageConfig) GetOperatingSystemDistro() *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 *ImageConfig) GetOperatingSystemDistroOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.OperatingSystemDistro) { return nil, false } return o.OperatingSystemDistro.Get(), o.OperatingSystemDistro.IsSet() @@ -294,7 +321,7 @@ func (o *ImageConfig) GetOperatingSystemDistroOk() (*string, bool) { // HasOperatingSystemDistro returns a boolean if a field has been set. func (o *ImageConfig) HasOperatingSystemDistro() bool { - if o != nil && o.OperatingSystemDistro.IsSet() { + if o != nil && !IsNil(o.OperatingSystemDistro) && o.OperatingSystemDistro.IsSet() { return true } @@ -303,22 +330,31 @@ func (o *ImageConfig) HasOperatingSystemDistro() bool { // 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.Get()) { + if o == nil || IsNil(o.OperatingSystemVersion) || IsNil(o.OperatingSystemVersion.Get()) { var ret *string return ret } @@ -329,7 +365,7 @@ func (o *ImageConfig) GetOperatingSystemVersion() *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 *ImageConfig) GetOperatingSystemVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.OperatingSystemVersion) { return nil, false } return o.OperatingSystemVersion.Get(), o.OperatingSystemVersion.IsSet() @@ -337,7 +373,7 @@ func (o *ImageConfig) GetOperatingSystemVersionOk() (*string, bool) { // HasOperatingSystemVersion returns a boolean if a field has been set. func (o *ImageConfig) HasOperatingSystemVersion() bool { - if o != nil && o.OperatingSystemVersion.IsSet() { + if o != nil && !IsNil(o.OperatingSystemVersion) && o.OperatingSystemVersion.IsSet() { return true } @@ -346,22 +382,31 @@ func (o *ImageConfig) HasOperatingSystemVersion() bool { // 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.Get()) { + if o == nil || IsNil(o.RescueBus) || IsNil(o.RescueBus.Get()) { var ret *string return ret } @@ -372,7 +417,7 @@ func (o *ImageConfig) GetRescueBus() *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 *ImageConfig) GetRescueBusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.RescueBus) { return nil, false } return o.RescueBus.Get(), o.RescueBus.IsSet() @@ -380,7 +425,7 @@ func (o *ImageConfig) GetRescueBusOk() (*string, bool) { // HasRescueBus returns a boolean if a field has been set. func (o *ImageConfig) HasRescueBus() bool { - if o != nil && o.RescueBus.IsSet() { + if o != nil && !IsNil(o.RescueBus) && o.RescueBus.IsSet() { return true } @@ -389,22 +434,31 @@ func (o *ImageConfig) HasRescueBus() bool { // 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.Get()) { + if o == nil || IsNil(o.RescueDevice) || IsNil(o.RescueDevice.Get()) { var ret *string return ret } @@ -415,7 +469,7 @@ func (o *ImageConfig) GetRescueDevice() *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 *ImageConfig) GetRescueDeviceOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.RescueDevice) { return nil, false } return o.RescueDevice.Get(), o.RescueDevice.IsSet() @@ -423,7 +477,7 @@ func (o *ImageConfig) GetRescueDeviceOk() (*string, bool) { // HasRescueDevice returns a boolean if a field has been set. func (o *ImageConfig) HasRescueDevice() bool { - if o != nil && o.RescueDevice.IsSet() { + if o != nil && !IsNil(o.RescueDevice) && o.RescueDevice.IsSet() { return true } @@ -432,16 +486,25 @@ func (o *ImageConfig) HasRescueDevice() bool { // 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() } @@ -511,7 +574,7 @@ func (o *ImageConfig) SetUefi(v *bool) { // 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.Get()) { + if o == nil || IsNil(o.VideoModel) || IsNil(o.VideoModel.Get()) { var ret *string return ret } @@ -522,7 +585,7 @@ func (o *ImageConfig) GetVideoModel() *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 *ImageConfig) GetVideoModelOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.VideoModel) { return nil, false } return o.VideoModel.Get(), o.VideoModel.IsSet() @@ -530,7 +593,7 @@ func (o *ImageConfig) GetVideoModelOk() (*string, bool) { // HasVideoModel returns a boolean if a field has been set. func (o *ImageConfig) HasVideoModel() bool { - if o != nil && o.VideoModel.IsSet() { + if o != nil && !IsNil(o.VideoModel) && o.VideoModel.IsSet() { return true } @@ -539,16 +602,25 @@ func (o *ImageConfig) HasVideoModel() bool { // 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() } diff --git a/services/iaasalpha/model_image_create_response.go b/services/iaasalpha/model_image_create_response.go index a010764b8..5ec35213e 100644 --- a/services/iaasalpha/model_image_create_response.go +++ b/services/iaasalpha/model_image_create_response.go @@ -49,7 +49,7 @@ func NewImageCreateResponseWithDefaults() *ImageCreateResponse { // GetId returns the Id field value func (o *ImageCreateResponse) GetId() *string { - if o == nil { + if o == nil || IsNil(o.Id) { var ret *string return ret } @@ -73,7 +73,7 @@ func (o *ImageCreateResponse) SetId(v *string) { // GetUploadUrl returns the UploadUrl field value func (o *ImageCreateResponse) GetUploadUrl() *string { - if o == nil { + if o == nil || IsNil(o.UploadUrl) { var ret *string return ret } diff --git a/services/iaasalpha/model_image_list_response.go b/services/iaasalpha/model_image_list_response.go index ebcf12485..2bbee9070 100644 --- a/services/iaasalpha/model_image_list_response.go +++ b/services/iaasalpha/model_image_list_response.go @@ -46,7 +46,7 @@ func NewImageListResponseWithDefaults() *ImageListResponse { // GetItems returns the Items field value func (o *ImageListResponse) GetItems() *[]Image { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]Image return ret } diff --git a/services/iaasalpha/model_image_share.go b/services/iaasalpha/model_image_share.go new file mode 100644 index 000000000..140084647 --- /dev/null +++ b/services/iaasalpha/model_image_share.go @@ -0,0 +1,152 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the ImageShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShare{} + +// ImageShare Share details of an Image. ParentOrganization and Projects are mutually exclusive. +type ImageShare struct { + ParentOrganization *bool `json:"parentOrganization,omitempty"` + 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/iaasalpha/model_image_share_consumer.go b/services/iaasalpha/model_image_share_consumer.go new file mode 100644 index 000000000..885dc81e7 --- /dev/null +++ b/services/iaasalpha/model_image_share_consumer.go @@ -0,0 +1,229 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +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/iaasalpha/model_key_pair_list_response.go b/services/iaasalpha/model_key_pair_list_response.go index 1f785141c..898eab2df 100644 --- a/services/iaasalpha/model_key_pair_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_keypair.go b/services/iaasalpha/model_keypair.go index 3dfa2264a..1bf51147b 100644 --- a/services/iaasalpha/model_keypair.go +++ b/services/iaasalpha/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/iaasalpha/model_machine_type.go b/services/iaasalpha/model_machine_type.go index 96084b648..7dab803ea 100644 --- a/services/iaasalpha/model_machine_type.go +++ b/services/iaasalpha/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/iaasalpha/model_machine_type_list_response.go b/services/iaasalpha/model_machine_type_list_response.go index 2801cb90d..0c315c714 100644 --- a/services/iaasalpha/model_machine_type_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_network.go b/services/iaasalpha/model_network.go index 86daaadec..1568848c3 100644 --- a/services/iaasalpha/model_network.go +++ b/services/iaasalpha/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/iaasalpha/model_network_area.go b/services/iaasalpha/model_network_area.go index a37dfac1e..e0916750b 100644 --- a/services/iaasalpha/model_network_area.go +++ b/services/iaasalpha/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/iaasalpha/model_network_area_list_response.go b/services/iaasalpha/model_network_area_list_response.go index d57b68487..7f2b995b6 100644 --- a/services/iaasalpha/model_network_area_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_network_list_response.go b/services/iaasalpha/model_network_list_response.go index 5df8f90a8..031bc1d6d 100644 --- a/services/iaasalpha/model_network_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_network_range.go b/services/iaasalpha/model_network_range.go index 17ad61970..c1f9d088d 100644 --- a/services/iaasalpha/model_network_range.go +++ b/services/iaasalpha/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/iaasalpha/model_nic_list_response.go b/services/iaasalpha/model_nic_list_response.go index fb1da78f1..fe05ca7c1 100644 --- a/services/iaasalpha/model_nic_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_port_range.go b/services/iaasalpha/model_port_range.go index 314427a6e..f6c17d0d7 100644 --- a/services/iaasalpha/model_port_range.go +++ b/services/iaasalpha/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/iaasalpha/model_project.go b/services/iaasalpha/model_project.go index b31b50182..dfb9aadae 100644 --- a/services/iaasalpha/model_project.go +++ b/services/iaasalpha/model_project.go @@ -61,7 +61,7 @@ func NewProjectWithDefaults() *Project { // GetAreaId returns the AreaId field value func (o *Project) GetAreaId() *AreaId { - if o == nil { + if o == nil || IsNil(o.AreaId) { var ret *AreaId return ret } @@ -181,7 +181,7 @@ func (o *Project) SetOpenstackProjectId(v *string) { // GetProjectId returns the ProjectId field value func (o *Project) GetProjectId() *string { - if o == nil { + if o == nil || IsNil(o.ProjectId) { var ret *string return ret } @@ -205,7 +205,7 @@ func (o *Project) SetProjectId(v *string) { // GetState returns the State field value func (o *Project) GetState() *string { - if o == nil { + if o == nil || IsNil(o.State) { var ret *string return ret } diff --git a/services/iaasalpha/model_project_list_response.go b/services/iaasalpha/model_project_list_response.go index b31819009..5538d474d 100644 --- a/services/iaasalpha/model_project_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_public_ip.go b/services/iaasalpha/model_public_ip.go index 550c9a0f4..73a2b3f78 100644 --- a/services/iaasalpha/model_public_ip.go +++ b/services/iaasalpha/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/iaasalpha/model_public_ip_list_response.go b/services/iaasalpha/model_public_ip_list_response.go index a233c225f..784379211 100644 --- a/services/iaasalpha/model_public_ip_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_public_network.go b/services/iaasalpha/model_public_network.go index feb5ee342..4606f27c2 100644 --- a/services/iaasalpha/model_public_network.go +++ b/services/iaasalpha/model_public_network.go @@ -46,7 +46,7 @@ func NewPublicNetworkWithDefaults() *PublicNetwork { // GetCidr returns the Cidr field value func (o *PublicNetwork) GetCidr() *string { - if o == nil { + if o == nil || IsNil(o.Cidr) { var ret *string return ret } diff --git a/services/iaasalpha/model_public_network_list_response.go b/services/iaasalpha/model_public_network_list_response.go index 97a59ef39..b1eacafc5 100644 --- a/services/iaasalpha/model_public_network_list_response.go +++ b/services/iaasalpha/model_public_network_list_response.go @@ -46,7 +46,7 @@ func NewPublicNetworkListResponseWithDefaults() *PublicNetworkListResponse { // GetItems returns the Items field value func (o *PublicNetworkListResponse) GetItems() *[]PublicNetwork { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]PublicNetwork return ret } diff --git a/services/iaasalpha/model_remove_member_from_virtual_ip_payload.go b/services/iaasalpha/model_remove_member_from_virtual_ip_payload.go index 4d5282541..359c476f3 100644 --- a/services/iaasalpha/model_remove_member_from_virtual_ip_payload.go +++ b/services/iaasalpha/model_remove_member_from_virtual_ip_payload.go @@ -46,7 +46,7 @@ func NewRemoveMemberFromVirtualIPPayloadWithDefaults() *RemoveMemberFromVirtualI // GetMember returns the Member field value func (o *RemoveMemberFromVirtualIPPayload) GetMember() *string { - if o == nil { + if o == nil || IsNil(o.Member) { var ret *string return ret } diff --git a/services/iaasalpha/model_request.go b/services/iaasalpha/model_request.go index 224456fa3..59f3d87a7 100644 --- a/services/iaasalpha/model_request.go +++ b/services/iaasalpha/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/iaasalpha/model_request_resource.go b/services/iaasalpha/model_request_resource.go index ceeebc2a8..f2a408f05 100644 --- a/services/iaasalpha/model_request_resource.go +++ b/services/iaasalpha/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/iaasalpha/model_rescue_server_payload.go b/services/iaasalpha/model_rescue_server_payload.go index c67e67b21..e0f2d14a9 100644 --- a/services/iaasalpha/model_rescue_server_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_resize_server_payload.go b/services/iaasalpha/model_resize_server_payload.go index 942cf3b97..6620c4826 100644 --- a/services/iaasalpha/model_resize_server_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_resize_volume_payload.go b/services/iaasalpha/model_resize_volume_payload.go index c10164ea6..53a819529 100644 --- a/services/iaasalpha/model_resize_volume_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_route.go b/services/iaasalpha/model_route.go index 55ad494d0..fcb130c19 100644 --- a/services/iaasalpha/model_route.go +++ b/services/iaasalpha/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/iaasalpha/model_security_group.go b/services/iaasalpha/model_security_group.go index 9bd14c92e..c982f86b8 100644 --- a/services/iaasalpha/model_security_group.go +++ b/services/iaasalpha/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/iaasalpha/model_security_group_list_response.go b/services/iaasalpha/model_security_group_list_response.go index 7598100cb..a3fd14382 100644 --- a/services/iaasalpha/model_security_group_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_security_group_rule.go b/services/iaasalpha/model_security_group_rule.go index f04cf2627..812660ae7 100644 --- a/services/iaasalpha/model_security_group_rule.go +++ b/services/iaasalpha/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/iaasalpha/model_security_group_rule_list_response.go b/services/iaasalpha/model_security_group_rule_list_response.go index 5a6eb248d..5d41178bd 100644 --- a/services/iaasalpha/model_security_group_rule_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_server.go b/services/iaasalpha/model_server.go index eefbb4440..6ab723241 100644 --- a/services/iaasalpha/model_server.go +++ b/services/iaasalpha/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/iaasalpha/model_server_console_url.go b/services/iaasalpha/model_server_console_url.go index ae465d320..cefb4b664 100644 --- a/services/iaasalpha/model_server_console_url.go +++ b/services/iaasalpha/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/iaasalpha/model_server_list_response.go b/services/iaasalpha/model_server_list_response.go index ee671450f..bc1903dc2 100644 --- a/services/iaasalpha/model_server_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_server_maintenance.go b/services/iaasalpha/model_server_maintenance.go index 468cbcb33..589d4096e 100644 --- a/services/iaasalpha/model_server_maintenance.go +++ b/services/iaasalpha/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/iaasalpha/model_server_network.go b/services/iaasalpha/model_server_network.go index 3e69c9187..4d02925a2 100644 --- a/services/iaasalpha/model_server_network.go +++ b/services/iaasalpha/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/iaasalpha/model_service_account_mail_list_response.go b/services/iaasalpha/model_service_account_mail_list_response.go index f5114d775..6df09036c 100644 --- a/services/iaasalpha/model_service_account_mail_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_set_image_share_payload.go b/services/iaasalpha/model_set_image_share_payload.go new file mode 100644 index 000000000..0602dcc7c --- /dev/null +++ b/services/iaasalpha/model_set_image_share_payload.go @@ -0,0 +1,152 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the SetImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SetImageSharePayload{} + +// SetImageSharePayload Share details of an Image. ParentOrganization and Projects are mutually exclusive. +type SetImageSharePayload struct { + ParentOrganization *bool `json:"parentOrganization,omitempty"` + 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/iaasalpha/model_update_image_share_payload.go b/services/iaasalpha/model_update_image_share_payload.go new file mode 100644 index 000000000..1f89fb507 --- /dev/null +++ b/services/iaasalpha/model_update_image_share_payload.go @@ -0,0 +1,152 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the UpdateImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImageSharePayload{} + +// UpdateImageSharePayload Share details of an Image. ParentOrganization and Projects are mutually exclusive. +type UpdateImageSharePayload struct { + ParentOrganization *bool `json:"parentOrganization,omitempty"` + 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/iaasalpha/model_update_public_ip_payload.go b/services/iaasalpha/model_update_public_ip_payload.go index 35aee757d..ee58e8131 100644 --- a/services/iaasalpha/model_update_public_ip_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_update_virtual_ip_payload.go b/services/iaasalpha/model_update_virtual_ip_payload.go index 2a1ffb863..9a3abee54 100644 --- a/services/iaasalpha/model_update_virtual_ip_payload.go +++ b/services/iaasalpha/model_update_virtual_ip_payload.go @@ -78,7 +78,7 @@ func (o *UpdateVirtualIPPayload) SetLabels(v *map[string]interface{}) { // GetMembers returns the Members field value if set, zero value otherwise (both if not set or set to explicit null). func (o *UpdateVirtualIPPayload) GetMembers() *[]string { - if o == nil { + if o == nil || IsNil(o.Members) { var ret *[]string return ret } diff --git a/services/iaasalpha/model_update_volume_payload.go b/services/iaasalpha/model_update_volume_payload.go index fcb4f589a..92e37fe9e 100644 --- a/services/iaasalpha/model_update_volume_payload.go +++ b/services/iaasalpha/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/iaasalpha/model_virtual_ip_list_response.go b/services/iaasalpha/model_virtual_ip_list_response.go index dc728ae12..f0f26874b 100644 --- a/services/iaasalpha/model_virtual_ip_list_response.go +++ b/services/iaasalpha/model_virtual_ip_list_response.go @@ -46,7 +46,7 @@ func NewVirtualIpListResponseWithDefaults() *VirtualIpListResponse { // GetItems returns the Items field value func (o *VirtualIpListResponse) GetItems() *[]VirtualIp { - if o == nil { + if o == nil || IsNil(o.Items) { var ret *[]VirtualIp return ret } diff --git a/services/iaasalpha/model_volume.go b/services/iaasalpha/model_volume.go index e5157cbe0..131fc24be 100644 --- a/services/iaasalpha/model_volume.go +++ b/services/iaasalpha/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/iaasalpha/model_volume_attachment_list_response.go b/services/iaasalpha/model_volume_attachment_list_response.go index cc4133e95..cd22a185d 100644 --- a/services/iaasalpha/model_volume_attachment_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_volume_list_response.go b/services/iaasalpha/model_volume_list_response.go index b247c77ca..51c55b384 100644 --- a/services/iaasalpha/model_volume_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_volume_performance_class.go b/services/iaasalpha/model_volume_performance_class.go index 0b6921301..94c43568b 100644 --- a/services/iaasalpha/model_volume_performance_class.go +++ b/services/iaasalpha/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/iaasalpha/model_volume_performance_class_list_response.go b/services/iaasalpha/model_volume_performance_class_list_response.go index d2fc8037c..13579de7b 100644 --- a/services/iaasalpha/model_volume_performance_class_list_response.go +++ b/services/iaasalpha/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/iaasalpha/model_volume_source.go b/services/iaasalpha/model_volume_source.go index b8cf26a09..7d5a9f003 100644 --- a/services/iaasalpha/model_volume_source.go +++ b/services/iaasalpha/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 }