diff --git a/services/iaasalpha/api_default.go b/services/iaasalpha/api_default.go index dd52be3ff..e9ab87dd4 100644 --- a/services/iaasalpha/api_default.go +++ b/services/iaasalpha/api_default.go @@ -26,55 +26,67 @@ import ( // DefaultApiService DefaultApi service type DefaultApiService service -type ApiAddNICToServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - nicId string +type ApiAddMemberToVirtualIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + virtualIpId string + addMemberToVirtualIPPayload *AddMemberToVirtualIPPayload } -func (r ApiAddNICToServerRequest) Execute() error { +// Request to add a member to a virtual IP. + +func (r ApiAddMemberToVirtualIPRequest) AddMemberToVirtualIPPayload(addMemberToVirtualIPPayload AddMemberToVirtualIPPayload) ApiAddMemberToVirtualIPRequest { + r.addMemberToVirtualIPPayload = &addMemberToVirtualIPPayload + return r +} + +func (r ApiAddMemberToVirtualIPRequest) Execute() (*VirtualIp, error) { var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNICToServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddMemberToVirtualIP") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}/add-member" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + 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") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") } - if strlen(r.nicId) < 36 { - return fmt.Errorf("nicId must have at least 36 elements") + if strlen(r.virtualIpId) < 36 { + return localVarReturnValue, fmt.Errorf("virtualIpId must have at least 36 elements") } - if strlen(r.nicId) > 36 { - return fmt.Errorf("nicId must have less than 36 elements") + if strlen(r.virtualIpId) > 36 { + return localVarReturnValue, fmt.Errorf("virtualIpId must have less than 36 elements") + } + if r.addMemberToVirtualIPPayload == nil { + return localVarReturnValue, fmt.Errorf("addMemberToVirtualIPPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -90,9 +102,11 @@ func (r ApiAddNICToServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.addMemberToVirtualIPPayload 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) @@ -106,14 +120,14 @@ func (r ApiAddNICToServerRequest) 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 { @@ -127,100 +141,99 @@ func (r ApiAddNICToServerRequest) 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 } /* -AddNICToServer: Attach an existing network interface. +AddMemberToVirtualIP: Add a member to the virtual IP. -Attach an existing network interface to a server. +Atomically add a member to the virtual IP. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param nicId The identifier (ID) of a network interface. - @return ApiAddNICToServerRequest + @param networkId The identifier (ID) of a STACKIT Network. + @param virtualIpId The identifier (ID) of a Virtual IP. + @return ApiAddMemberToVirtualIPRequest */ -func (a *APIClient) AddNICToServer(ctx context.Context, projectId string, serverId string, nicId string) ApiAddNICToServerRequest { - return ApiAddNICToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - nicId: nicId, +func (a *APIClient) AddMemberToVirtualIP(ctx context.Context, projectId string, networkId string, virtualIpId string) ApiAddMemberToVirtualIPRequest { + return ApiAddMemberToVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, } } -func (a *APIClient) AddNICToServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { - r := ApiAddNICToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - nicId: nicId, +func (a *APIClient) AddMemberToVirtualIPExecute(ctx context.Context, projectId string, networkId string, virtualIpId string) (*VirtualIp, error) { + r := ApiAddMemberToVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, } return r.Execute() } @@ -413,30 +426,30 @@ func (a *APIClient) AddNetworkToServerExecute(ctx context.Context, projectId str return r.Execute() } -type ApiAddPublicIpToServerRequest struct { +type ApiAddNicToServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string serverId string - publicIpId string + nicId string } -func (r ApiAddPublicIpToServerRequest) Execute() error { +func (r ApiAddNicToServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddPublicIpToServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNicToServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -453,11 +466,11 @@ func (r ApiAddPublicIpToServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.publicIpId) < 36 { - return fmt.Errorf("publicIpId must have at least 36 elements") + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") } - if strlen(r.publicIpId) > 36 { - return fmt.Errorf("publicIpId must have less than 36 elements") + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") } // to determine the Content-Type header @@ -581,61 +594,61 @@ func (r ApiAddPublicIpToServerRequest) Execute() error { } /* -AddPublicIpToServer: Associate a public IP to the server. +AddNicToServer: Attach an existing network interface. -Associate a public IP to a server. +Attach an existing network interface to 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 serverId The identifier (ID) of a STACKIT Server. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiAddPublicIpToServerRequest + @param nicId The identifier (ID) of a network interface. + @return ApiAddNicToServerRequest */ -func (a *APIClient) AddPublicIpToServer(ctx context.Context, projectId string, serverId string, publicIpId string) ApiAddPublicIpToServerRequest { - return ApiAddPublicIpToServerRequest{ +func (a *APIClient) AddNicToServer(ctx context.Context, projectId string, serverId string, nicId string) ApiAddNicToServerRequest { + return ApiAddNicToServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - publicIpId: publicIpId, + nicId: nicId, } } -func (a *APIClient) AddPublicIpToServerExecute(ctx context.Context, projectId string, serverId string, publicIpId string) error { - r := ApiAddPublicIpToServerRequest{ +func (a *APIClient) AddNicToServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { + r := ApiAddNicToServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - publicIpId: publicIpId, + nicId: nicId, } return r.Execute() } -type ApiAddSecurityGroupToServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - securityGroupId string +type ApiAddPublicIpToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + publicIpId string } -func (r ApiAddSecurityGroupToServerRequest) Execute() error { +func (r ApiAddPublicIpToServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddSecurityGroupToServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddPublicIpToServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -652,11 +665,11 @@ func (r ApiAddSecurityGroupToServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return fmt.Errorf("securityGroupId must have at least 36 elements") + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId 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 @@ -780,80 +793,82 @@ func (r ApiAddSecurityGroupToServerRequest) Execute() error { } /* -AddSecurityGroupToServer: Add a server to a security group. +AddPublicIpToServer: Associate a public IP to the server. -Add an existing server to an existing security group. +Associate a public IP to 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 serverId The identifier (ID) of a STACKIT Server. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiAddSecurityGroupToServerRequest + @param publicIpId The identifier (ID) of a Public IP. + @return ApiAddPublicIpToServerRequest */ -func (a *APIClient) AddSecurityGroupToServer(ctx context.Context, projectId string, serverId string, securityGroupId string) ApiAddSecurityGroupToServerRequest { - return ApiAddSecurityGroupToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - securityGroupId: securityGroupId, +func (a *APIClient) AddPublicIpToServer(ctx context.Context, projectId string, serverId string, publicIpId string) ApiAddPublicIpToServerRequest { + return ApiAddPublicIpToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + publicIpId: publicIpId, } } -func (a *APIClient) AddSecurityGroupToServerExecute(ctx context.Context, projectId string, serverId string, securityGroupId string) error { - r := ApiAddSecurityGroupToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - securityGroupId: securityGroupId, +func (a *APIClient) AddPublicIpToServerExecute(ctx context.Context, projectId string, serverId string, publicIpId string) error { + r := ApiAddPublicIpToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + publicIpId: publicIpId, } return r.Execute() } -type ApiAddServiceAccountToServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - serviceAccountMail string +type ApiAddSecurityGroupToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + securityGroupId string } -func (r ApiAddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListResponse, error) { +func (r ApiAddSecurityGroupToServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ServiceAccountMailListResponse + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddServiceAccountToServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddSecurityGroupToServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + return 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") + return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.serviceAccountMail) > 255 { - return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header @@ -875,7 +890,7 @@ func (r ApiAddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListR } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -889,14 +904,14 @@ func (r ApiAddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListR *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -910,147 +925,129 @@ func (r ApiAddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListR err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -AddServiceAccountToServer: Attach service account to a server. +AddSecurityGroupToServer: Add a server to a security group. -Attach an additional service account to the server. +Add an existing server to an existing 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. - @param serviceAccountMail The e-mail address of a service account. - @return ApiAddServiceAccountToServerRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiAddSecurityGroupToServerRequest */ -func (a *APIClient) AddServiceAccountToServer(ctx context.Context, projectId string, serverId string, serviceAccountMail string) ApiAddServiceAccountToServerRequest { - return ApiAddServiceAccountToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - serviceAccountMail: serviceAccountMail, +func (a *APIClient) AddSecurityGroupToServer(ctx context.Context, projectId string, serverId string, securityGroupId string) ApiAddSecurityGroupToServerRequest { + return ApiAddSecurityGroupToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + securityGroupId: securityGroupId, } } -func (a *APIClient) AddServiceAccountToServerExecute(ctx context.Context, projectId string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { - r := ApiAddServiceAccountToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - serviceAccountMail: serviceAccountMail, +func (a *APIClient) AddSecurityGroupToServerExecute(ctx context.Context, projectId string, serverId string, securityGroupId string) error { + r := ApiAddSecurityGroupToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiAddVolumeToServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - volumeId string - addVolumeToServerPayload *AddVolumeToServerPayload -} - -// Request a volume attachment creation. - -func (r ApiAddVolumeToServerRequest) AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest { - r.addVolumeToServerPayload = &addVolumeToServerPayload - return r +type ApiAddServiceAccountToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + serviceAccountMail string } -func (r ApiAddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { +func (r ApiAddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListResponse, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachment + localVarReturnValue *ServiceAccountMailListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddVolumeToServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddServiceAccountToServer") 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}/servers/{serverId}/service-accounts/{serviceAccountMail}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1067,15 +1064,12 @@ func (r ApiAddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { 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") + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1091,8 +1085,6 @@ func (r ApiAddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.addVolumeToServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1207,70 +1199,91 @@ func (r ApiAddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { } /* -AddVolumeToServer: Attach a volume to a server. +AddServiceAccountToServer: Attach service account to a server. -Attach an existing volume to an existing server. +Attach an additional service account to the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiAddVolumeToServerRequest + @param serviceAccountMail The e-mail address of a service account. + @return ApiAddServiceAccountToServerRequest */ -func (a *APIClient) AddVolumeToServer(ctx context.Context, projectId string, serverId string, volumeId string) ApiAddVolumeToServerRequest { - return ApiAddVolumeToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - volumeId: volumeId, +func (a *APIClient) AddServiceAccountToServer(ctx context.Context, projectId string, serverId string, serviceAccountMail string) ApiAddServiceAccountToServerRequest { + return ApiAddServiceAccountToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + serviceAccountMail: serviceAccountMail, } } -func (a *APIClient) AddVolumeToServerExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { - r := ApiAddVolumeToServerRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, - volumeId: volumeId, +func (a *APIClient) AddServiceAccountToServerExecute(ctx context.Context, projectId string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := ApiAddServiceAccountToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + serviceAccountMail: serviceAccountMail, } return r.Execute() } -type ApiCreateKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - createKeyPairPayload *CreateKeyPairPayload +type ApiAddVolumeToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string + addVolumeToServerPayload *AddVolumeToServerPayload } -// Request a public key import. +// Request a volume attachment creation. -func (r ApiCreateKeyPairRequest) CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest { - r.createKeyPairPayload = &createKeyPairPayload +func (r ApiAddVolumeToServerRequest) AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest { + r.addVolumeToServerPayload = &addVolumeToServerPayload return r } -func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { +func (r ApiAddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Keypair + localVarReturnValue *VolumeAttachment ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddVolumeToServer") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/keypairs" + 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 r.createKeyPairPayload == nil { - return localVarReturnValue, fmt.Errorf("createKeyPairPayload is required and must be specified") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if 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 @@ -1291,7 +1304,7 @@ func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createKeyPairPayload + localVarPostBody = r.addVolumeToServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1406,59 +1419,66 @@ func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { } /* -CreateKeyPair: Import a public key. +AddVolumeToServer: Attach a volume to a server. -Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. +Attach an existing volume to an existing server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateKeyPairRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiAddVolumeToServerRequest */ -func (a *APIClient) CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest { - return ApiCreateKeyPairRequest{ +func (a *APIClient) AddVolumeToServer(ctx context.Context, projectId string, serverId string, volumeId string) ApiAddVolumeToServerRequest { + return ApiAddVolumeToServerRequest{ apiService: a.defaultApi, ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, } } -func (a *APIClient) CreateKeyPairExecute(ctx context.Context) (*Keypair, error) { - r := ApiCreateKeyPairRequest{ +func (a *APIClient) AddVolumeToServerExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := ApiAddVolumeToServerRequest{ apiService: a.defaultApi, ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, } return r.Execute() } -type ApiCreateNICRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - createNICPayload *CreateNICPayload +type ApiCreateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createImagePayload *CreateImagePayload } -// Request a network interface creation. +// Request an image creation. -func (r ApiCreateNICRequest) CreateNICPayload(createNICPayload CreateNICPayload) ApiCreateNICRequest { - r.createNICPayload = &createNICPayload +func (r ApiCreateImageRequest) CreateImagePayload(createImagePayload CreateImagePayload) ApiCreateImageRequest { + r.createImagePayload = &createImagePayload return r } -func (r ApiCreateNICRequest) Execute() (*NIC, error) { +func (r ApiCreateImageRequest) Execute() (*ImageCreateResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NIC + localVarReturnValue *ImageCreateResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNIC") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateImage") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/images" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1469,14 +1489,8 @@ func (r ApiCreateNICRequest) Execute() (*NIC, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") - } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") - } - if r.createNICPayload == nil { - return localVarReturnValue, fmt.Errorf("createNICPayload is required and must be specified") + if r.createImagePayload == nil { + return localVarReturnValue, fmt.Errorf("createImagePayload is required and must be specified") } // to determine the Content-Type header @@ -1497,7 +1511,7 @@ func (r ApiCreateNICRequest) Execute() (*NIC, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createNICPayload + localVarPostBody = r.createImagePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1574,17 +1588,6 @@ func (r ApiCreateNICRequest) Execute() (*NIC, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } if localVarHTTPResponse.StatusCode == 429 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1623,75 +1626,64 @@ func (r ApiCreateNICRequest) Execute() (*NIC, error) { } /* -CreateNIC: Create new network interface. +CreateImage: Create new Image. -Create a new network interface in a project. +Create a new Image in a project. This call, if successful, returns a pre-signed URL for the customer to upload the image. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiCreateNICRequest + @return ApiCreateImageRequest */ -func (a *APIClient) CreateNIC(ctx context.Context, projectId string, networkId string) ApiCreateNICRequest { - return ApiCreateNICRequest{ +func (a *APIClient) CreateImage(ctx context.Context, projectId string) ApiCreateImageRequest { + return ApiCreateImageRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, } } -func (a *APIClient) CreateNICExecute(ctx context.Context, projectId string, networkId string) (*NIC, error) { - r := ApiCreateNICRequest{ +func (a *APIClient) CreateImageExecute(ctx context.Context, projectId string) (*ImageCreateResponse, error) { + r := ApiCreateImageRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, } return r.Execute() } -type ApiCreatePublicIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createPublicIPPayload *CreatePublicIPPayload +type ApiCreateKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + createKeyPairPayload *CreateKeyPairPayload } -// Request a public IP creation. +// Request a public key import. -func (r ApiCreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { - r.createPublicIPPayload = &createPublicIPPayload +func (r ApiCreateKeyPairRequest) CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest { + r.createKeyPairPayload = &createKeyPairPayload return r } -func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { +func (r ApiCreateKeyPairRequest) Execute() (*Keypair, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PublicIp + localVarReturnValue *Keypair ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyPair") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/public-ips" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath := localBasePath + "/v1alpha1/keypairs" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") - } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") - } - if r.createPublicIPPayload == nil { - return localVarReturnValue, fmt.Errorf("createPublicIPPayload is required and must be specified") + if r.createKeyPairPayload == nil { + return localVarReturnValue, fmt.Errorf("createKeyPairPayload is required and must be specified") } // to determine the Content-Type header @@ -1712,7 +1704,7 @@ func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createPublicIPPayload + localVarPostBody = r.createKeyPairPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1789,7 +1781,7 @@ func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1827,60 +1819,59 @@ func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { } /* -CreatePublicIP: Create new public IP. +CreateKeyPair: Import a public key. -Create a new public IP in a project. +Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreatePublicIPRequest + @return ApiCreateKeyPairRequest */ -func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string) ApiCreatePublicIPRequest { - return ApiCreatePublicIPRequest{ +func (a *APIClient) CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest { + return ApiCreateKeyPairRequest{ apiService: a.defaultApi, ctx: ctx, - projectId: projectId, } } -func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string) (*PublicIp, error) { - r := ApiCreatePublicIPRequest{ +func (a *APIClient) CreateKeyPairExecute(ctx context.Context) (*Keypair, error) { + r := ApiCreateKeyPairRequest{ apiService: a.defaultApi, ctx: ctx, - projectId: projectId, } return r.Execute() } -type ApiCreateSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createSecurityGroupPayload *CreateSecurityGroupPayload +type ApiCreateNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + createNicPayload *CreateNicPayload } -// Request a security group creation. +// Request a network interface creation. -func (r ApiCreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { - r.createSecurityGroupPayload = &createSecurityGroupPayload +func (r ApiCreateNicRequest) CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest { + r.createNicPayload = &createNicPayload return r } -func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { +func (r ApiCreateNicRequest) Execute() (*NIC, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroup + localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNic") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1891,8 +1882,14 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createSecurityGroupPayload == nil { - return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload is required and must be specified") + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if r.createNicPayload == nil { + return localVarReturnValue, fmt.Errorf("createNicPayload is required and must be specified") } // to determine the Content-Type header @@ -1913,7 +1910,7 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createSecurityGroupPayload + localVarPostBody = r.createNicPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1990,6 +1987,28 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2017,62 +2036,63 @@ func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { } /* -CreateSecurityGroup: Create new security group. +CreateNic: Create new network interface. -Create a new security group in a project. +Create a new network interface in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateSecurityGroupRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNicRequest */ -func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string) ApiCreateSecurityGroupRequest { - return ApiCreateSecurityGroupRequest{ +func (a *APIClient) CreateNic(ctx context.Context, projectId string, networkId string) ApiCreateNicRequest { + return ApiCreateNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + networkId: networkId, } } -func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string) (*SecurityGroup, error) { - r := ApiCreateSecurityGroupRequest{ +func (a *APIClient) CreateNicExecute(ctx context.Context, projectId string, networkId string) (*NIC, error) { + r := ApiCreateNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + networkId: networkId, } return r.Execute() } -type ApiCreateSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - createSecurityGroupRulePayload *CreateSecurityGroupRulePayload +type ApiCreatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createPublicIPPayload *CreatePublicIPPayload } -// Request for a security group rule creation. +// Request a public IP creation. -func (r ApiCreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { - r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload +func (r ApiCreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { + r.createPublicIPPayload = &createPublicIPPayload return r } -func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { +func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroupRule + localVarReturnValue *PublicIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}/rules" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/public-ips" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2083,14 +2103,8 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") - } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") - } - if r.createSecurityGroupRulePayload == nil { - return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload is required and must be specified") + if r.createPublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("createPublicIPPayload is required and must be specified") } // to determine the Content-Type header @@ -2111,7 +2125,7 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createSecurityGroupRulePayload + localVarPostBody = r.createPublicIPPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2188,6 +2202,17 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2215,62 +2240,59 @@ func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) } /* -CreateSecurityGroupRule: Create new security group rule. +CreatePublicIP: Create new public IP. -Create a new security group rule in a project. +Create a new public IP in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiCreateSecurityGroupRuleRequest + @return ApiCreatePublicIPRequest */ -func (a *APIClient) CreateSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string) ApiCreateSecurityGroupRuleRequest { - return ApiCreateSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string) ApiCreatePublicIPRequest { + return ApiCreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRule, error) { - r := ApiCreateSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string) (*PublicIp, error) { + r := ApiCreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiCreateServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createServerPayload *CreateServerPayload +type ApiCreateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createSecurityGroupPayload *CreateSecurityGroupPayload } -// Request a server creation. +// Request a security group creation. -func (r ApiCreateServerRequest) CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest { - r.createServerPayload = &createServerPayload +func (r ApiCreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { + r.createSecurityGroupPayload = &createSecurityGroupPayload return r } -func (r ApiCreateServerRequest) Execute() (*Server, error) { +func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Server + localVarReturnValue *SecurityGroup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -2282,8 +2304,8 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createServerPayload == nil { - return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") + if r.createSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload is required and must be specified") } // to determine the Content-Type header @@ -2304,7 +2326,7 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createServerPayload + localVarPostBody = r.createSecurityGroupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2408,24 +2430,24 @@ func (r ApiCreateServerRequest) Execute() (*Server, error) { } /* -CreateServer: Create new server. +CreateSecurityGroup: Create new security group. -Create a new server in a project. +Create a new security group in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateServerRequest + @return ApiCreateSecurityGroupRequest */ -func (a *APIClient) CreateServer(ctx context.Context, projectId string) ApiCreateServerRequest { - return ApiCreateServerRequest{ +func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string) ApiCreateSecurityGroupRequest { + return ApiCreateSecurityGroupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) (*Server, error) { - r := ApiCreateServerRequest{ +func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string) (*SecurityGroup, error) { + r := ApiCreateSecurityGroupRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -2433,35 +2455,37 @@ func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) ( return r.Execute() } -type ApiCreateVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createVolumePayload *CreateVolumePayload +type ApiCreateSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + createSecurityGroupRulePayload *CreateSecurityGroupRulePayload } -// Request a volume creation. +// Request for a security group rule creation. -func (r ApiCreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { - r.createVolumePayload = &createVolumePayload +func (r ApiCreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { + r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload return r } -func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { +func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Volume + localVarReturnValue *SecurityGroupRule ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}/rules" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2472,8 +2496,14 @@ func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createVolumePayload == nil { - return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.createSecurityGroupRulePayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload is required and must be specified") } // to determine the Content-Type header @@ -2494,7 +2524,7 @@ func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createVolumePayload + localVarPostBody = r.createSecurityGroupRulePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2598,72 +2628,79 @@ func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { } /* -CreateVolume: Create new volume. +CreateSecurityGroupRule: Create new security group rule. -Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. +Create a new security group rule in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiCreateVolumeRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest */ -func (a *APIClient) CreateVolume(ctx context.Context, projectId string) ApiCreateVolumeRequest { - return ApiCreateVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) CreateSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string) ApiCreateSecurityGroupRuleRequest { + return ApiCreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string) (*Volume, error) { - r := ApiCreateVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRule, error) { + r := ApiCreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiDeallocateServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiCreateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createServerPayload *CreateServerPayload } -func (r ApiDeallocateServerRequest) Execute() error { +// Request a server creation. + +func (r ApiCreateServerRequest) CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest { + r.createServerPayload = &createServerPayload + return r +} + +func (r ApiCreateServerRequest) Execute() (*Server, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/deallocate" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.serverId) < 36 { - return fmt.Errorf("serverId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if r.createServerPayload == nil { + return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2679,9 +2716,11 @@ func (r ApiDeallocateServerRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createServerPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -2695,14 +2734,14 @@ func (r ApiDeallocateServerRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2716,131 +2755,150 @@ func (r ApiDeallocateServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeallocateServer: Deallocate an existing server. +CreateServer: Create new server. -Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. +Create a new server in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiDeallocateServerRequest + @return ApiCreateServerRequest */ -func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, serverId string) ApiDeallocateServerRequest { - return ApiDeallocateServerRequest{ +func (a *APIClient) CreateServer(ctx context.Context, projectId string) ApiCreateServerRequest { + return ApiCreateServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } } -func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiDeallocateServerRequest{ +func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) (*Server, error) { + r := ApiCreateServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } return r.Execute() } -type ApiDeleteKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - keypairName string +type ApiCreateVirtualIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + createVirtualIPPayload *CreateVirtualIPPayload } -func (r ApiDeleteKeyPairRequest) Execute() error { +// Request a virtual IP creation. + +func (r ApiCreateVirtualIPRequest) CreateVirtualIPPayload(createVirtualIPPayload CreateVirtualIPPayload) ApiCreateVirtualIPRequest { + r.createVirtualIPPayload = &createVirtualIPPayload + return r +} + +func (r ApiCreateVirtualIPRequest) Execute() (*VirtualIp, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVirtualIP") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &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}/networks/{networkId}/virtual-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.keypairName) > 127 { - return fmt.Errorf("keypairName must have less than 127 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if r.createVirtualIPPayload == nil { + return localVarReturnValue, fmt.Errorf("createVirtualIPPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2856,9 +2914,11 @@ func (r ApiDeleteKeyPairRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createVirtualIPPayload 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) @@ -2872,14 +2932,14 @@ func (r ApiDeleteKeyPairRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2893,136 +2953,156 @@ func (r ApiDeleteKeyPairRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 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 } /* -DeleteKeyPair: Delete an SSH keypair. +CreateVirtualIP: Create new virtual IP. -Delete an SSH keypair from a user. +Create a new virtual IP in a project. @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 networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateVirtualIPRequest */ -func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { - return ApiDeleteKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +func (a *APIClient) CreateVirtualIP(ctx context.Context, projectId string, networkId string) ApiCreateVirtualIPRequest { + return ApiCreateVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, } } -func (a *APIClient) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { - r := ApiDeleteKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +func (a *APIClient) CreateVirtualIPExecute(ctx context.Context, projectId string, networkId string) (*VirtualIp, error) { + r := ApiCreateVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, } return r.Execute() } -type ApiDeleteNICRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - nicId string +type ApiCreateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createVolumePayload *CreateVolumePayload } -func (r ApiDeleteNICRequest) Execute() error { +// Request a volume creation. + +func (r ApiCreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { + r.createVolumePayload = &createVolumePayload + return r +} + +func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNIC") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") - } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") - } - if strlen(r.nicId) < 36 { - return fmt.Errorf("nicId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.nicId) > 36 { - return fmt.Errorf("nicId must have less than 36 elements") + if r.createVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -3038,9 +3118,11 @@ func (r ApiDeleteNICRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createVolumePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -3054,14 +3136,14 @@ func (r ApiDeleteNICRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3075,115 +3157,119 @@ func (r ApiDeleteNICRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNIC: Delete a network interface. +CreateVolume: Create new volume. -Delete a network interface that is part of the project. +Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @param nicId The identifier (ID) of a network interface. - @return ApiDeleteNICRequest + @return ApiCreateVolumeRequest */ -func (a *APIClient) DeleteNIC(ctx context.Context, projectId string, networkId string, nicId string) ApiDeleteNICRequest { - return ApiDeleteNICRequest{ +func (a *APIClient) CreateVolume(ctx context.Context, projectId string) ApiCreateVolumeRequest { + return ApiCreateVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, - nicId: nicId, } } -func (a *APIClient) DeleteNICExecute(ctx context.Context, projectId string, networkId string, nicId string) error { - r := ApiDeleteNICRequest{ +func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string) (*Volume, error) { + r := ApiCreateVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, - nicId: nicId, } return r.Execute() } -type ApiDeletePublicIPRequest struct { +type ApiDeallocateServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string - publicIpId string + serverId string } -func (r ApiDeletePublicIPRequest) Execute() error { +func (r ApiDeallocateServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodDelete + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/public-ips/{publicIpId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/deallocate" 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 = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3194,11 +3280,11 @@ func (r ApiDeletePublicIPRequest) Execute() error { 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.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.publicIpId) > 36 { - return fmt.Errorf("publicIpId 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 @@ -3294,6 +3380,17 @@ func (r ApiDeletePublicIPRequest) 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")) @@ -3311,56 +3408,56 @@ func (r ApiDeletePublicIPRequest) Execute() error { } /* -DeletePublicIP: Delete a public IP. +DeallocateServer: Deallocate an existing server. -Delete a public IP that is part of the project. +Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiDeletePublicIPRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest */ -func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, publicIpId string) ApiDeletePublicIPRequest { - return ApiDeletePublicIPRequest{ +func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, serverId string) ApiDeallocateServerRequest { + return ApiDeallocateServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - publicIpId: publicIpId, + serverId: serverId, } } -func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, publicIpId string) error { - r := ApiDeletePublicIPRequest{ +func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeallocateServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - publicIpId: publicIpId, + serverId: serverId, } return r.Execute() } -type ApiDeleteSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string +type ApiDeleteImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string } -func (r ApiDeleteSecurityGroupRequest) Execute() error { +func (r ApiDeleteImageRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImage") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/images/{imageId}" 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, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3371,11 +3468,11 @@ 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.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId must have less than 36 elements") + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") } // to determine the Content-Type header @@ -3471,17 +3568,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")) @@ -3499,79 +3585,242 @@ func (r ApiDeleteSecurityGroupRequest) Execute() error { } /* -DeleteSecurityGroup: Delete security group. +DeleteImage: Delete an Image. -Delete a security group. +Delete an image that is part of the project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiDeleteSecurityGroupRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageRequest */ -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) DeleteImage(ctx context.Context, projectId string, imageId string) ApiDeleteImageRequest { + return ApiDeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, } } -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) DeleteImageExecute(ctx context.Context, projectId string, imageId string) error { + r := ApiDeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, } return r.Execute() } -type ApiDeleteSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - securityGroupRuleId string +type ApiDeleteKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string } -func (r ApiDeleteSecurityGroupRuleRequest) 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.DeleteSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - 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, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -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.keypairName) > 127 { + return fmt.Errorf("keypairName must have less than 127 elements") } - if strlen(r.securityGroupId) < 36 { - return fmt.Errorf("securityGroupId must have at least 36 elements") + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } - if strlen(r.securityGroupId) > 36 { - return fmt.Errorf("securityGroupId must have less than 36 elements") + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if strlen(r.securityGroupRuleId) < 36 { - return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err } - if strlen(r.securityGroupRuleId) > 36 { - return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteKeyPair: Delete an SSH keypair. + +Delete an SSH keypair from a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest +*/ +func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { + return ApiDeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { + r := ApiDeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type ApiDeleteNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + nicId string +} + +func (r ApiDeleteNicRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNic") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") } // to determine the Content-Type header @@ -3684,59 +3933,59 @@ func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { } /* -DeleteSecurityGroupRule: Delete security group rule. +DeleteNic: Delete a network interface. -Delete a security group rule. +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. - @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. - @return ApiDeleteSecurityGroupRuleRequest + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest */ -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) 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) 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) 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 ApiDeleteServerRequest struct { +type ApiDeletePublicIPRequest struct { ctx context.Context apiService *DefaultApiService projectId string - serverId string + publicIpId string } -func (r ApiDeleteServerRequest) 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.DeleteServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/public-ips/{publicIpId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3747,11 +3996,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.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") } // to determine the Content-Type header @@ -3857,78 +4106,1566 @@ func (r ApiDeleteServerRequest) Execute() error { newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return newErr + } + + return nil +} + +/* +DeletePublicIP: Delete a public IP. + +Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest +*/ +func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, publicIpId string) ApiDeletePublicIPRequest { + return ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, publicIpId string) error { + r := ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type ApiDeleteSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string +} + +func (r ApiDeleteSecurityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroup: Delete security group. + +Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest +*/ +func (a *APIClient) DeleteSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiDeleteSecurityGroupRequest { + return ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) DeleteSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) error { + r := ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ApiDeleteSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string +} + +func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroupRule: Delete security group rule. + +Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest +*/ +func (a *APIClient) DeleteSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest { + return ApiDeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) error { + r := ApiDeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type ApiDeleteServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiDeleteServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteServer: Delete a server. + +Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest +*/ +func (a *APIClient) DeleteServer(ctx context.Context, projectId string, serverId string) ApiDeleteServerRequest { + return ApiDeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type 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 *Image + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImage: Get details about an image. + +Get details about a specific Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageRequest +*/ +func (a *APIClient) GetImage(ctx context.Context, projectId string, imageId string) ApiGetImageRequest { + return ApiGetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } +} + +func (a *APIClient) GetImageExecute(ctx context.Context, projectId string, imageId string) (*Image, error) { + r := ApiGetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + imageId: imageId, + } + return r.Execute() +} + +type ApiGetKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r ApiGetKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/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.keypairName) > 127 { + return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr } - return nil + return localVarReturnValue, nil } /* -DeleteServer: Delete a server. +GetKeyPair: Get SSH keypair details. -Delete a server. Volumes won't be deleted. +Get details about an SSH keypair. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiDeleteServerRequest + @param keypairName The name of an SSH keypair. + @return ApiGetKeyPairRequest */ -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) GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest { + return ApiGetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, } } -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) GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { + r := ApiGetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, } return r.Execute() } -type ApiDeleteVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumeId string +type ApiGetMachineTypeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + machineType string } -func (r ApiDeleteVolumeRequest) Execute() error { +func (r ApiGetMachineTypeRequest) Execute() (*MachineType, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MachineType ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMachineType") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes/{volumeId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/machine-types/{machineType}" 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, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(r.machineType, "machineType")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") - } - if strlen(r.volumeId) < 36 { - return fmt.Errorf("volumeId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.volumeId) > 36 { - return fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.machineType) > 63 { + return localVarReturnValue, fmt.Errorf("machineType must have less than 63 elements") } // to determine the Content-Type header @@ -3950,7 +5687,7 @@ func (r ApiDeleteVolumeRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -3964,14 +5701,14 @@ func (r ApiDeleteVolumeRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3985,126 +5722,123 @@ func (r ApiDeleteVolumeRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteVolume: Delete a volume. +GetMachineType: Get details about a machine type. -Delete a volume inside a project. The deletion will fail if the volume is still in use. +Get details about a specific machine type. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiDeleteVolumeRequest + @param machineType STACKIT machine type Name. + @return ApiGetMachineTypeRequest */ -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) GetMachineType(ctx context.Context, projectId string, machineType string) ApiGetMachineTypeRequest { + return ApiGetMachineTypeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + machineType: machineType, } } -func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, volumeId string) error { - r := ApiDeleteVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) GetMachineTypeExecute(ctx context.Context, projectId string, machineType string) (*MachineType, error) { + r := ApiGetMachineTypeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + machineType: machineType, } return r.Execute() } -type ApiGetAttachedVolumeRequest struct { +type ApiGetNetworkRequest struct { ctx context.Context apiService *DefaultApiService projectId string - serverId string - volumeId string + networkId string } -func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { +func (r ApiGetNetworkRequest) Execute() (*Network, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachment + localVarReturnValue *Network ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") 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}/networks/{networkId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -4115,17 +5849,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.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId 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.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") } // to determine the Content-Type header @@ -4248,64 +5976,72 @@ func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { } /* -GetAttachedVolume: Get Volume Attachment details. +GetNetwork: Get network details. -Get the details of an existing Volume Attachment. +Get details about a network of a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiGetAttachedVolumeRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest */ -func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { - return ApiGetAttachedVolumeRequest{ +func (a *APIClient) GetNetwork(ctx context.Context, projectId string, networkId string) ApiGetNetworkRequest { + return ApiGetNetworkRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + networkId: networkId, } } -func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { - r := ApiGetAttachedVolumeRequest{ +func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, networkId string) (*Network, error) { + r := ApiGetNetworkRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + networkId: networkId, } return r.Execute() } -type ApiGetKeyPairRequest struct { - ctx context.Context - apiService *DefaultApiService - keypairName string +type ApiGetNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string } -func (r ApiGetKeyPairRequest) Execute() (*Keypair, error) { +func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Keypair + localVarReturnValue *NetworkArea ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyPair") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") if err != nil { return localVarReturnValue, &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/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.keypairName) > 127 { - return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } // to determine the Content-Type header @@ -4428,32 +6164,35 @@ func (r ApiGetKeyPairRequest) Execute() (*Keypair, error) { } /* -GetKeyPair: Get SSH keypair details. +GetNetworkArea: Get details about a network area. -Get details about an SSH keypair. +Get details about a network area in an organization. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param keypairName The name of an SSH keypair. - @return ApiGetKeyPairRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiGetNetworkAreaRequest */ -func (a *APIClient) GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest { - return ApiGetKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { + return ApiGetNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } } -func (a *APIClient) GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { - r := ApiGetKeyPairRequest{ - apiService: a.defaultApi, - ctx: ctx, - keypairName: keypairName, +func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := ApiGetNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, } return r.Execute() } -type ApiGetNICRequest struct { +type ApiGetNicRequest struct { ctx context.Context apiService *DefaultApiService projectId string @@ -4461,7 +6200,7 @@ type ApiGetNICRequest struct { nicId string } -func (r ApiGetNICRequest) Execute() (*NIC, error) { +func (r ApiGetNicRequest) Execute() (*NIC, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -4469,7 +6208,7 @@ func (r ApiGetNICRequest) Execute() (*NIC, error) { localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNIC") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNic") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } @@ -4621,7 +6360,7 @@ func (r ApiGetNICRequest) Execute() (*NIC, error) { } /* -GetNIC: Get details about a network interface. +GetNic: Get details about a network interface. Get details about a network interface inside a network. @@ -4629,10 +6368,10 @@ Get details about a network interface inside a network. @param projectId The identifier (ID) of a STACKIT Project. @param networkId The identifier (ID) of a STACKIT Network. @param nicId The identifier (ID) of a network interface. - @return ApiGetNICRequest + @return ApiGetNicRequest */ -func (a *APIClient) GetNIC(ctx context.Context, projectId string, networkId string, nicId string) ApiGetNICRequest { - return ApiGetNICRequest{ +func (a *APIClient) GetNic(ctx context.Context, projectId string, networkId string, nicId string) ApiGetNicRequest { + return ApiGetNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -4641,8 +6380,8 @@ func (a *APIClient) GetNIC(ctx context.Context, projectId string, networkId stri } } -func (a *APIClient) GetNICExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { - r := ApiGetNICRequest{ +func (a *APIClient) GetNicExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { + r := ApiGetNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -4652,44 +6391,44 @@ func (a *APIClient) GetNICExecute(ctx context.Context, projectId string, network return r.Execute() } -type ApiGetNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string -} - -func (r ApiGetNetworkRequest) Execute() (*Network, error) { +type ApiGetOrganizationRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + requestId string +} + +func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Network + localVarReturnValue *Request ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath := localBasePath + "/v1alpha1/organizations/{organizationId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") } // to determine the Content-Type header @@ -4812,72 +6551,64 @@ func (r ApiGetNetworkRequest) Execute() (*Network, error) { } /* -GetNetwork: Get network details. +GetOrganizationRequest: Lookup an organization request ID. -Get details about a network of a project. +Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiGetNetworkRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest */ -func (a *APIClient) GetNetwork(ctx context.Context, projectId string, networkId string) ApiGetNetworkRequest { - return ApiGetNetworkRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, +func (a *APIClient) GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest { + return ApiGetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, } } -func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, networkId string) (*Network, error) { - r := ApiGetNetworkRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, +func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { + r := ApiGetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, } return r.Execute() } -type ApiGetNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiGetProjectDetailsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string } -func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { +func (r ApiGetProjectDetailsRequest) Execute() (*Project, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkArea + localVarReturnValue *Project ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectDetails") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/organizations/{organizationId}/network-areas/{areaId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } // to determine the Content-Type header @@ -5000,42 +6731,39 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { } /* -GetNetworkArea: Get details about a network area. +GetProjectDetails: Get project details. -Get details about a network area in an organization. +Get details about a STACKIT project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiGetNetworkAreaRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiGetProjectDetailsRequest */ -func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { - return ApiGetNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) GetProjectDetails(ctx context.Context, projectId string) ApiGetProjectDetailsRequest { + return ApiGetProjectDetailsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { - r := ApiGetNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) GetProjectDetailsExecute(ctx context.Context, projectId string) (*Project, error) { + r := ApiGetProjectDetailsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiGetOrganizationRequestRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - requestId string +type ApiGetProjectRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + requestId string } -func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { +func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -5043,23 +6771,23 @@ func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { localVarReturnValue *Request ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/organizations/{organizationId}/requests/{requestId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.requestId) < 36 { return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") @@ -5188,55 +6916,57 @@ func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { } /* -GetOrganizationRequest: Lookup an organization request ID. +GetProjectRequest: Lookup a project request ID. -Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. +Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. + @param projectId The identifier (ID) of a STACKIT Project. @param requestId The identifier (ID) of a STACKIT Request. - @return ApiGetOrganizationRequestRequest + @return ApiGetProjectRequestRequest */ -func (a *APIClient) GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest { - return ApiGetOrganizationRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - requestId: requestId, +func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, requestId string) ApiGetProjectRequestRequest { + return ApiGetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + requestId: requestId, } } -func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { - r := ApiGetOrganizationRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - requestId: requestId, +func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, requestId string) (*Request, error) { + r := ApiGetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + requestId: requestId, } return r.Execute() } -type ApiGetProjectDetailsRequest struct { +type ApiGetPublicIPRequest struct { ctx context.Context apiService *DefaultApiService projectId string + publicIpId string } -func (r ApiGetProjectDetailsRequest) Execute() (*Project, error) { +func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Project + localVarReturnValue *PublicIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectDetails") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}" + 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) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -5247,6 +6977,12 @@ func (r ApiGetProjectDetailsRequest) Execute() (*Project, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } + if strlen(r.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -5368,54 +7104,57 @@ func (r ApiGetProjectDetailsRequest) Execute() (*Project, error) { } /* -GetProjectDetails: Get project details. +GetPublicIP: Get details about a public IP. -Get details about a STACKIT project. +Get details about a public IP inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiGetProjectDetailsRequest + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest */ -func (a *APIClient) GetProjectDetails(ctx context.Context, projectId string) ApiGetProjectDetailsRequest { - return ApiGetProjectDetailsRequest{ +func (a *APIClient) GetPublicIP(ctx context.Context, projectId string, publicIpId string) ApiGetPublicIPRequest { + return ApiGetPublicIPRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + publicIpId: publicIpId, } } -func (a *APIClient) GetProjectDetailsExecute(ctx context.Context, projectId string) (*Project, error) { - r := ApiGetProjectDetailsRequest{ +func (a *APIClient) GetPublicIPExecute(ctx context.Context, projectId string, publicIpId string) (*PublicIp, error) { + r := ApiGetPublicIPRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + publicIpId: publicIpId, } return r.Execute() } -type ApiGetProjectRequestRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - requestId string +type ApiGetSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string } -func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { +func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Request + localVarReturnValue *SecurityGroup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/requests/{requestId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -5426,11 +7165,11 @@ func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.requestId) < 36 { - return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.requestId) > 36 { - return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header @@ -5553,57 +7292,59 @@ func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { } /* -GetProjectRequest: Lookup a project request ID. +GetSecurityGroup: Get security group details. -Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. +Get details about a security group of a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param requestId The identifier (ID) of a STACKIT Request. - @return ApiGetProjectRequestRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest */ -func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, requestId string) ApiGetProjectRequestRequest { - return ApiGetProjectRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - requestId: requestId, +func (a *APIClient) GetSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiGetSecurityGroupRequest { + return ApiGetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, requestId string) (*Request, error) { - r := ApiGetProjectRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - requestId: requestId, +func (a *APIClient) GetSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroup, error) { + r := ApiGetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiGetPublicIPRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - publicIpId string +type ApiGetSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string } -func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { +func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PublicIp + localVarReturnValue *SecurityGroupRule ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/public-ips/{publicIpId}" + 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, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -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{} @@ -5614,11 +7355,17 @@ func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.publicIpId) < 36 { - return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") } - if strlen(r.publicIpId) > 36 { - return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") } // to determine the Content-Type header @@ -5741,57 +7488,68 @@ func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { } /* -GetPublicIP: Get details about a public IP. +GetSecurityGroupRule: Get security group rule details. -Get details about a public IP inside a project. +Get details about a security group rule of a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param publicIpId The identifier (ID) of a Public IP. - @return ApiGetPublicIPRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiGetSecurityGroupRuleRequest */ -func (a *APIClient) GetPublicIP(ctx context.Context, projectId string, publicIpId string) ApiGetPublicIPRequest { - return ApiGetPublicIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - publicIpId: publicIpId, +func (a *APIClient) GetSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest { + return ApiGetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, } } -func (a *APIClient) GetPublicIPExecute(ctx context.Context, projectId string, publicIpId string) (*PublicIp, error) { - r := ApiGetPublicIPRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - publicIpId: publicIpId, +func (a *APIClient) GetSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) { + r := ApiGetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, } return r.Execute() } -type ApiGetSecurityGroupRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string +type ApiGetServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + details *bool } -func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { +// Show detailed information about server. + +func (r ApiGetServerRequest) Details(details bool) ApiGetServerRequest { + r.details = &details + return r +} + +func (r ApiGetServerRequest) Execute() (*Server, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroup + localVarReturnValue *Server ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}" 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, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -5802,13 +7560,16 @@ func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -5929,59 +7690,57 @@ func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { } /* -GetSecurityGroup: Get security group details. +GetServer: Get server details. -Get details about a security group of a project. +Get details about a server by its ID. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @return ApiGetSecurityGroupRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest */ -func (a *APIClient) GetSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiGetSecurityGroupRequest { - return ApiGetSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) GetServer(ctx context.Context, projectId string, serverId string) ApiGetServerRequest { + return ApiGetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) GetSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroup, error) { - r := ApiGetSecurityGroupRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, +func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, serverId string) (*Server, error) { + r := ApiGetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiGetSecurityGroupRuleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - securityGroupId string - securityGroupRuleId string +type ApiGetServerConsoleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { +func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SecurityGroupRule + localVarReturnValue *ServerConsoleUrl ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/console" 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, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -5992,17 +7751,11 @@ func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.securityGroupId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") - } - if strlen(r.securityGroupId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") - } - if strlen(r.securityGroupRuleId) < 36 { - return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.securityGroupRuleId) > 36 { - return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -6125,66 +7878,63 @@ func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { } /* -GetSecurityGroupRule: Get security group rule details. +GetServerConsole: Get server console. -Get details about a security group rule of a project. +Get a URL for server remote console. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param securityGroupId The identifier (ID) of a STACKIT Security Group. - @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. - @return ApiGetSecurityGroupRuleRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest */ -func (a *APIClient) GetSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest { - return ApiGetSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, - securityGroupRuleId: securityGroupRuleId, +func (a *APIClient) GetServerConsole(ctx context.Context, projectId string, serverId string) ApiGetServerConsoleRequest { + return ApiGetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) GetSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) { - r := ApiGetSecurityGroupRuleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - securityGroupId: securityGroupId, - securityGroupRuleId: securityGroupRuleId, +func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId string, serverId string) (*ServerConsoleUrl, error) { + r := ApiGetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiGetServerRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - details *bool +type ApiGetServerLogRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + getServerLogRequest *GetServerLogRequest } -// Show detailed information about server. +// Request the server log. By default the length is limited to 2000 lines. -func (r ApiGetServerRequest) Details(details bool) ApiGetServerRequest { - r.details = &details +func (r ApiGetServerLogRequest) GetServerLogRequest(getServerLogRequest GetServerLogRequest) ApiGetServerLogRequest { + r.getServerLogRequest = &getServerLogRequest return r } -func (r ApiGetServerRequest) Execute() (*Server, error) { +func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Server + localVarReturnValue *GetServerLog200Response ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/log" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) @@ -6204,11 +7954,8 @@ func (r ApiGetServerRequest) Execute() (*Server, error) { return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } - if r.details != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -6224,6 +7971,8 @@ func (r ApiGetServerRequest) Execute() (*Server, 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 @@ -6327,17 +8076,17 @@ func (r ApiGetServerRequest) Execute() (*Server, error) { } /* -GetServer: Get server details. +GetServerLog: Get server log. -Get details about a server by its ID. +Get server console log. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiGetServerRequest + @return ApiGetServerLogRequest */ -func (a *APIClient) GetServer(ctx context.Context, projectId string, serverId string) ApiGetServerRequest { - return ApiGetServerRequest{ +func (a *APIClient) GetServerLog(ctx context.Context, projectId string, serverId string) ApiGetServerLogRequest { + return ApiGetServerLogRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -6345,8 +8094,8 @@ func (a *APIClient) GetServer(ctx context.Context, projectId string, serverId st } } -func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, serverId string) (*Server, error) { - r := ApiGetServerRequest{ +func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, serverId string) (*GetServerLog200Response, error) { + r := ApiGetServerLogRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -6355,29 +8104,31 @@ func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, serv return r.Execute() } -type ApiGetServerConsoleRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiGetVirtualIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + virtualIpId string } -func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { +func (r ApiGetVirtualIPRequest) Execute() (*VirtualIp, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ServerConsoleUrl + localVarReturnValue *VirtualIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVirtualIP") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/console" + 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, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -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{} @@ -6388,11 +8139,17 @@ func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, 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.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.virtualIpId) < 36 { + return localVarReturnValue, fmt.Errorf("virtualIpId must have at least 36 elements") + } + if strlen(r.virtualIpId) > 36 { + return localVarReturnValue, fmt.Errorf("virtualIpId must have less than 36 elements") } // to determine the Content-Type header @@ -6515,65 +8272,60 @@ func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { } /* -GetServerConsole: Get server console. +GetVirtualIP: Get details about a virtual IP. -Get a URL for server remote console. +Get details about a virtual IP inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiGetServerConsoleRequest + @param networkId The identifier (ID) of a STACKIT Network. + @param virtualIpId The identifier (ID) of a Virtual IP. + @return ApiGetVirtualIPRequest */ -func (a *APIClient) GetServerConsole(ctx context.Context, projectId string, serverId string) ApiGetServerConsoleRequest { - return ApiGetServerConsoleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) GetVirtualIP(ctx context.Context, projectId string, networkId string, virtualIpId string) ApiGetVirtualIPRequest { + return ApiGetVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, } } -func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId string, serverId string) (*ServerConsoleUrl, error) { - r := ApiGetServerConsoleRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serverId: serverId, +func (a *APIClient) GetVirtualIPExecute(ctx context.Context, projectId string, networkId string, virtualIpId string) (*VirtualIp, error) { + r := ApiGetVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, } return r.Execute() } -type ApiGetServerLogRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - getServerLogRequest *GetServerLogRequest -} - -// Request the server log. By default the length is limited to 2000 lines. - -func (r ApiGetServerLogRequest) GetServerLogRequest(getServerLogRequest GetServerLogRequest) ApiGetServerLogRequest { - r.getServerLogRequest = &getServerLogRequest - return r +type ApiGetVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string } -func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { +func (r ApiGetVolumeRequest) Execute() (*Volume, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetServerLog200Response + localVarReturnValue *Volume ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/log" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes/{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{} @@ -6584,15 +8336,15 @@ func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, 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.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId 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 less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -6608,8 +8360,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 @@ -6713,57 +8463,57 @@ func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { } /* -GetServerLog: Get server log. +GetVolume: Get details about a volume. -Get server console log. +Get details about a block device volume. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiGetServerLogRequest + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest */ -func (a *APIClient) GetServerLog(ctx context.Context, projectId string, serverId string) ApiGetServerLogRequest { - return ApiGetServerLogRequest{ +func (a *APIClient) GetVolume(ctx context.Context, projectId string, volumeId string) ApiGetVolumeRequest { + return ApiGetVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + volumeId: volumeId, } } -func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, serverId string) (*GetServerLog200Response, error) { - r := ApiGetServerLogRequest{ +func (a *APIClient) GetVolumeExecute(ctx context.Context, projectId string, volumeId string) (*Volume, error) { + r := ApiGetVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, + volumeId: volumeId, } return r.Execute() } -type ApiGetVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumeId string +type ApiGetVolumePerformanceClassRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumePerformanceClass string } -func (r ApiGetVolumeRequest) Execute() (*Volume, error) { +func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Volume + localVarReturnValue *VolumePerformanceClass ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolumePerformanceClass") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volumes/{volumeId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" 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, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(r.volumePerformanceClass, "volumePerformanceClass")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -6774,11 +8524,8 @@ func (r ApiGetVolumeRequest) Execute() (*Volume, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.volumeId) < 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") - } - if strlen(r.volumeId) > 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.volumePerformanceClass) > 63 { + return localVarReturnValue, fmt.Errorf("volumePerformanceClass must have less than 63 elements") } // to determine the Content-Type header @@ -6901,57 +8648,57 @@ func (r ApiGetVolumeRequest) Execute() (*Volume, error) { } /* -GetVolume: Get details about a volume. +GetVolumePerformanceClass: Get details about a volume performance class. -Get details about a block device volume. +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 volumeId The identifier (ID) of a STACKIT Volume. - @return ApiGetVolumeRequest + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest */ -func (a *APIClient) GetVolume(ctx context.Context, projectId string, volumeId string) ApiGetVolumeRequest { - return ApiGetVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) GetVolumePerformanceClass(ctx context.Context, projectId string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest { + return ApiGetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumePerformanceClass: volumePerformanceClass, } } -func (a *APIClient) GetVolumeExecute(ctx context.Context, projectId string, volumeId string) (*Volume, error) { - r := ApiGetVolumeRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - volumeId: volumeId, +func (a *APIClient) 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 ApiGetVolumePerformanceClassRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - volumePerformanceClass string +type ApiListAttachedVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, error) { +func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumePerformanceClass + localVarReturnValue *VolumeAttachmentListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolumePerformanceClass") + 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}/volume-performance-classes/{volumePerformanceClass}" + 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, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(r.volumePerformanceClass, "volumePerformanceClass")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -6962,8 +8709,11 @@ func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.volumePerformanceClass) > 63 { - return localVarReturnValue, fmt.Errorf("volumePerformanceClass must have less than 63 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -7086,57 +8836,63 @@ func (r ApiGetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, } /* -GetVolumePerformanceClass: Get details about a volume performance class. +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 { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string +type ApiListImagesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string } -func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { +// Filter resources by labels. + +func (r ApiListImagesRequest) LabelSelector(labelSelector string) ApiListImagesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListImagesRequest) Execute() (*ImageListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachmentListResponse + localVarReturnValue *ImageListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListImages") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/volume-attachments" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/images" 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{} @@ -7147,13 +8903,10 @@ func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") - } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") - } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -7274,30 +9027,27 @@ func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, } /* -ListAttachedVolumes: List all volume attachments of a server. +ListImages: List all Images inside a project. -Get a list of all volume attachments of a server. +Get a list of all images inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiListAttachedVolumesRequest + @return ApiListImagesRequest */ -func (a *APIClient) ListAttachedVolumes(ctx context.Context, projectId string, serverId string) ApiListAttachedVolumesRequest { - return ApiListAttachedVolumesRequest{ +func (a *APIClient) ListImages(ctx context.Context, projectId string) ApiListImagesRequest { + return ApiListImagesRequest{ 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) ListImagesExecute(ctx context.Context, projectId string) (*ImageListResponse, error) { + r := ApiListImagesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } return r.Execute() } @@ -7479,37 +9229,27 @@ func (a *APIClient) ListKeyPairsExecute(ctx context.Context) (*KeyPairListRespon return r.Execute() } -type ApiListNICsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - labelSelector *string -} - -// Filter resources by labels. - -func (r ApiListNICsRequest) LabelSelector(labelSelector string) ApiListNICsRequest { - r.labelSelector = &labelSelector - return r +type ApiListMachineTypesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string } -func (r ApiListNICsRequest) Execute() (*NICListResponse, error) { +func (r ApiListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NICListResponse + localVarReturnValue *MachineTypeListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNICs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListMachineTypes") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/machine-types" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -7520,16 +9260,7 @@ func (r ApiListNICsRequest) Execute() (*NICListResponse, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") - } - if strlen(r.networkId) > 36 { - return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") - } - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -7650,30 +9381,27 @@ func (r ApiListNICsRequest) Execute() (*NICListResponse, error) { } /* -ListNICs: List all network interfaces inside a network. +ListMachineTypes: List all machine types available for a project. -Get a list of all network interfaces inside a network. +Get a list of all machine type available in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiListNICsRequest + @return ApiListMachineTypesRequest */ -func (a *APIClient) ListNICs(ctx context.Context, projectId string, networkId string) ApiListNICsRequest { - return ApiListNICsRequest{ +func (a *APIClient) ListMachineTypes(ctx context.Context, projectId string) ApiListMachineTypesRequest { + return ApiListMachineTypesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, } } -func (a *APIClient) ListNICsExecute(ctx context.Context, projectId string, networkId string) (*NICListResponse, error) { - r := ApiListNICsRequest{ +func (a *APIClient) ListMachineTypesExecute(ctx context.Context, projectId string) (*MachineTypeListResponse, error) { + r := ApiListMachineTypesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, } return r.Execute() } @@ -8029,60 +9757,250 @@ func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) } /* -ListNetworkAreas: List all network areas in an organization. +ListNetworkAreas: List all network areas in an organization. + +Get a list of all visible network areas defined in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiListNetworkAreasRequest +*/ +func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { + return ApiListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } +} + +func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { + r := ApiListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } + return r.Execute() +} + +type ApiListNetworksRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ApiListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // 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 +} + +/* +ListNetworks: List all networks inside a project. -Get a list of all visible network areas defined in an organization. +Get a list of all networks inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @return ApiListNetworkAreasRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListNetworksRequest */ -func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { - return ApiListNetworkAreasRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) ListNetworks(ctx context.Context, projectId string) ApiListNetworksRequest { + return ApiListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { - r := ApiListNetworkAreasRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string) (*NetworkListResponse, error) { + r := ApiListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiListNetworksRequest struct { +type ApiListNicsRequest struct { ctx context.Context apiService *DefaultApiService projectId string + networkId string labelSelector *string } // Filter resources by labels. -func (r ApiListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { +func (r ApiListNicsRequest) LabelSelector(labelSelector string) ApiListNicsRequest { r.labelSelector = &labelSelector return r } -func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { +func (r ApiListNicsRequest) Execute() (*NICListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkListResponse + localVarReturnValue *NICListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNics") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -8093,6 +10011,12 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } if r.labelSelector != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") @@ -8217,27 +10141,30 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { } /* -ListNetworks: List all networks inside a project. +ListNics: List all network interfaces inside a network. -Get a list of all networks inside a project. +Get a list of all network interfaces inside a network. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListNetworksRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNicsRequest */ -func (a *APIClient) ListNetworks(ctx context.Context, projectId string) ApiListNetworksRequest { - return ApiListNetworksRequest{ +func (a *APIClient) ListNics(ctx context.Context, projectId string, networkId string) ApiListNicsRequest { + return ApiListNicsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + networkId: networkId, } } -func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string) (*NetworkListResponse, error) { - r := ApiListNetworksRequest{ +func (a *APIClient) ListNicsExecute(ctx context.Context, projectId string, networkId string) (*NICListResponse, error) { + r := ApiListNicsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + networkId: networkId, } return r.Execute() } @@ -8972,14 +10899,14 @@ func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId str return r.Execute() } -type ApiListServerNICsRequest struct { +type ApiListServerNicsRequest struct { ctx context.Context apiService *DefaultApiService projectId string serverId string } -func (r ApiListServerNICsRequest) Execute() (*NICListResponse, error) { +func (r ApiListServerNicsRequest) Execute() (*NICListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -8987,7 +10914,7 @@ func (r ApiListServerNICsRequest) Execute() (*NICListResponse, error) { localVarReturnValue *NICListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNICs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNics") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } @@ -9132,17 +11059,17 @@ func (r ApiListServerNICsRequest) Execute() (*NICListResponse, error) { } /* -ListServerNICs: Get all network interfaces. +ListServerNics: Get all network interfaces. Get all network interfaces attached to the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiListServerNICsRequest + @return ApiListServerNicsRequest */ -func (a *APIClient) ListServerNICs(ctx context.Context, projectId string, serverId string) ApiListServerNICsRequest { - return ApiListServerNICsRequest{ +func (a *APIClient) ListServerNics(ctx context.Context, projectId string, serverId string) ApiListServerNicsRequest { + return ApiListServerNicsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -9150,8 +11077,8 @@ func (a *APIClient) ListServerNICs(ctx context.Context, projectId string, server } } -func (a *APIClient) ListServerNICsExecute(ctx context.Context, projectId string, serverId string) (*NICListResponse, error) { - r := ApiListServerNICsRequest{ +func (a *APIClient) ListServerNicsExecute(ctx context.Context, projectId string, serverId string) (*NICListResponse, error) { + r := ApiListServerNicsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -9167,22 +11094,224 @@ type ApiListServerServiceAccountsRequest struct { serverId string } -func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListResponse, error) { +func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerServiceAccounts") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/service-accounts" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + 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 +} + +/* +ListServerServiceAccounts: List all service accounts of the Server. + +Get the list of the service accounts of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerServiceAccountsRequest +*/ +func (a *APIClient) ListServerServiceAccounts(ctx context.Context, projectId string, serverId string) ApiListServerServiceAccountsRequest { + return ApiListServerServiceAccountsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) ListServerServiceAccountsExecute(ctx context.Context, projectId string, serverId string) (*ServiceAccountMailListResponse, error) { + r := ApiListServerServiceAccountsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiListServersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + details *bool + labelSelector *string +} + +// Show detailed information about server. + +func (r ApiListServersRequest) Details(details bool) ApiListServersRequest { + r.details = &details + return r +} + +// Filter resources by labels. + +func (r ApiListServersRequest) LabelSelector(labelSelector string) ApiListServersRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ServiceAccountMailListResponse + localVarReturnValue *ServerListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerServiceAccounts") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/service-accounts" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers" 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{} @@ -9193,13 +11322,13 @@ func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListR 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 r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") } - // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -9320,71 +11449,62 @@ func (r ApiListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListR } /* -ListServerServiceAccounts: List all service accounts of the Server. +ListServers: List all servers inside a project. -Get the list of the service accounts of the server. +Get a list of all servers inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @return ApiListServerServiceAccountsRequest + @return ApiListServersRequest */ -func (a *APIClient) ListServerServiceAccounts(ctx context.Context, projectId string, serverId string) ApiListServerServiceAccountsRequest { - return ApiListServerServiceAccountsRequest{ +func (a *APIClient) ListServers(ctx context.Context, projectId string) ApiListServersRequest { + return ApiListServersRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } } -func (a *APIClient) ListServerServiceAccountsExecute(ctx context.Context, projectId string, serverId string) (*ServiceAccountMailListResponse, error) { - r := ApiListServerServiceAccountsRequest{ +func (a *APIClient) ListServersExecute(ctx context.Context, projectId string) (*ServerListResponse, error) { + r := ApiListServersRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, } return r.Execute() } -type ApiListServersRequest struct { +type ApiListVirtualIPsRequest struct { ctx context.Context apiService *DefaultApiService projectId string - details *bool + networkId string labelSelector *string } -// Show detailed information about server. - -func (r ApiListServersRequest) Details(details bool) ApiListServersRequest { - r.details = &details - return r -} - // Filter resources by labels. -func (r ApiListServersRequest) LabelSelector(labelSelector string) ApiListServersRequest { +func (r ApiListVirtualIPsRequest) LabelSelector(labelSelector string) ApiListVirtualIPsRequest { r.labelSelector = &labelSelector return r } -func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { +func (r ApiListVirtualIPsRequest) Execute() (*VirtualIpListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ServerListResponse + localVarReturnValue *VirtualIpListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVirtualIPs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -9395,10 +11515,13 @@ func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - - if r.details != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") } + if r.labelSelector != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") } @@ -9522,27 +11645,30 @@ func (r ApiListServersRequest) Execute() (*ServerListResponse, error) { } /* -ListServers: List all servers inside a project. +ListVirtualIPs: List all virtual IPs inside a project. -Get a list of all servers inside a project. +Get a list of all virtual IPs inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @return ApiListServersRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListVirtualIPsRequest */ -func (a *APIClient) ListServers(ctx context.Context, projectId string) ApiListServersRequest { - return ApiListServersRequest{ +func (a *APIClient) ListVirtualIPs(ctx context.Context, projectId string, networkId string) ApiListVirtualIPsRequest { + return ApiListVirtualIPsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + networkId: networkId, } } -func (a *APIClient) ListServersExecute(ctx context.Context, projectId string) (*ServerListResponse, error) { - r := ApiListServersRequest{ +func (a *APIClient) ListVirtualIPsExecute(ctx context.Context, projectId string, networkId string) (*VirtualIpListResponse, error) { + r := ApiListVirtualIPsRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, + networkId: networkId, } return r.Execute() } @@ -10122,30 +12248,242 @@ func (a *APIClient) RebootServerExecute(ctx context.Context, projectId string, s return r.Execute() } -type ApiRemoveNICFromServerRequest struct { +type ApiRemoveMemberFromVirtualIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + virtualIpId string + removeMemberFromVirtualIPPayload *RemoveMemberFromVirtualIPPayload +} + +// Request to remove a member from a virtual IP. + +func (r ApiRemoveMemberFromVirtualIPRequest) RemoveMemberFromVirtualIPPayload(removeMemberFromVirtualIPPayload RemoveMemberFromVirtualIPPayload) ApiRemoveMemberFromVirtualIPRequest { + r.removeMemberFromVirtualIPPayload = &removeMemberFromVirtualIPPayload + return r +} + +func (r ApiRemoveMemberFromVirtualIPRequest) Execute() (*VirtualIp, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VirtualIp + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveMemberFromVirtualIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}/remove-member" + 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 localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.virtualIpId) < 36 { + return localVarReturnValue, fmt.Errorf("virtualIpId must have at least 36 elements") + } + if strlen(r.virtualIpId) > 36 { + return localVarReturnValue, fmt.Errorf("virtualIpId must have less than 36 elements") + } + if r.removeMemberFromVirtualIPPayload == nil { + return localVarReturnValue, fmt.Errorf("removeMemberFromVirtualIPPayload 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.removeMemberFromVirtualIPPayload + 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 +} + +/* +RemoveMemberFromVirtualIP: Remove a member from the virtual IP. + +Atomically remove a member from the virtual IP. + + @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 ApiRemoveMemberFromVirtualIPRequest +*/ +func (a *APIClient) RemoveMemberFromVirtualIP(ctx context.Context, projectId string, networkId string, virtualIpId string) ApiRemoveMemberFromVirtualIPRequest { + return ApiRemoveMemberFromVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, + } +} + +func (a *APIClient) RemoveMemberFromVirtualIPExecute(ctx context.Context, projectId string, networkId string, virtualIpId string) (*VirtualIp, error) { + r := ApiRemoveMemberFromVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, + } + return r.Execute() +} + +type ApiRemoveNetworkFromServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string serverId string - nicId string + networkId string } -func (r ApiRemoveNICFromServerRequest) Execute() error { +func (r ApiRemoveNetworkFromServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNICFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNetworkFromServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/networks/{networkId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -10162,11 +12500,11 @@ func (r ApiRemoveNICFromServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.nicId) < 36 { - return fmt.Errorf("nicId must have at least 36 elements") + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") } - if strlen(r.nicId) > 36 { - return fmt.Errorf("nicId must have less than 36 elements") + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") } // to determine the Content-Type header @@ -10279,61 +12617,61 @@ func (r ApiRemoveNICFromServerRequest) Execute() error { } /* -RemoveNICFromServer: Detach a network interface. +RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. -Detach a network interface from a server. +Detach and delete all network interfaces associated with the specified network from the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @param nicId The identifier (ID) of a network interface. - @return ApiRemoveNICFromServerRequest + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest */ -func (a *APIClient) RemoveNICFromServer(ctx context.Context, projectId string, serverId string, nicId string) ApiRemoveNICFromServerRequest { - return ApiRemoveNICFromServerRequest{ +func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { + return ApiRemoveNetworkFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - nicId: nicId, + networkId: networkId, } } -func (a *APIClient) RemoveNICFromServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { - r := ApiRemoveNICFromServerRequest{ +func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, serverId string, networkId string) error { + r := ApiRemoveNetworkFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - nicId: nicId, + networkId: networkId, } return r.Execute() } -type ApiRemoveNetworkFromServerRequest struct { +type ApiRemoveNicFromServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string serverId string - networkId string + nicId string } -func (r ApiRemoveNetworkFromServerRequest) Execute() error { +func (r ApiRemoveNicFromServerRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNetworkFromServer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNicFromServer") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"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{} @@ -10350,11 +12688,11 @@ func (r ApiRemoveNetworkFromServerRequest) Execute() error { if strlen(r.serverId) > 36 { return fmt.Errorf("serverId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") } // to determine the Content-Type header @@ -10467,33 +12805,33 @@ func (r ApiRemoveNetworkFromServerRequest) Execute() error { } /* -RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. +RemoveNicFromServer: Detach a network interface. -Detach and delete all network interfaces associated with the specified network from the server. +Detach a network interface from a server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiRemoveNetworkFromServerRequest + @param nicId The identifier (ID) of a network interface. + @return ApiRemoveNicFromServerRequest */ -func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { - return ApiRemoveNetworkFromServerRequest{ +func (a *APIClient) RemoveNicFromServer(ctx context.Context, projectId string, serverId string, nicId string) ApiRemoveNicFromServerRequest { + return ApiRemoveNicFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - networkId: networkId, + nicId: nicId, } } -func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, serverId string, networkId string) error { - r := ApiRemoveNetworkFromServerRequest{ +func (a *APIClient) RemoveNicFromServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { + r := ApiRemoveNicFromServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, - networkId: networkId, + nicId: nicId, } return r.Execute() } @@ -12404,101 +14742,311 @@ func (r ApiUnrescueServerRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return 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 +} + +/* +UnrescueServer: Unrescue an existing server. + +Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest +*/ +func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, serverId string) ApiUnrescueServerRequest { + return ApiUnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) UnrescueServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiUnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiUpdateAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string + updateAttachedVolumePayload *UpdateAttachedVolumePayload +} + +// Request a volume attachment update. + +func (r ApiUpdateAttachedVolumeRequest) UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest { + r.updateAttachedVolumePayload = &updateAttachedVolumePayload + return r +} + +func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") + 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") + } + if r.updateAttachedVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateAttachedVolumePayload 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.updateAttachedVolumePayload + 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 newErr + return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 409 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -UnrescueServer: Unrescue an existing server. +UpdateAttachedVolume: Update Volume Attachment Parameters. -Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. +Update the properties of an existing Volume Attachment. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. @param serverId The identifier (ID) of a STACKIT Server. - @return ApiUnrescueServerRequest + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest */ -func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, serverId string) ApiUnrescueServerRequest { - return ApiUnrescueServerRequest{ +func (a *APIClient) UpdateAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest { + return ApiUpdateAttachedVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + volumeId: volumeId, } } -func (a *APIClient) UnrescueServerExecute(ctx context.Context, projectId string, serverId string) error { - r := ApiUnrescueServerRequest{ +func (a *APIClient) UpdateAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := ApiUpdateAttachedVolumeRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serverId: serverId, + volumeId: volumeId, } return r.Execute() } -type ApiUpdateAttachedVolumeRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serverId string - volumeId string - updateAttachedVolumePayload *UpdateAttachedVolumePayload +type ApiUpdateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + imageId string + updateImagePayload *UpdateImagePayload } -// Request a volume attachment update. +// Request an update of an Image. -func (r ApiUpdateAttachedVolumeRequest) UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest { - r.updateAttachedVolumePayload = &updateAttachedVolumePayload +func (r ApiUpdateImageRequest) UpdateImagePayload(updateImagePayload UpdateImagePayload) ApiUpdateImageRequest { + r.updateImagePayload = &updateImagePayload return r } -func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { +func (r ApiUpdateImageRequest) Execute() (*Image, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *VolumeAttachment + localVarReturnValue *Image ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImage") 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{} @@ -12509,20 +15057,14 @@ func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.serverId) < 36 { - return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") - } - if strlen(r.serverId) > 36 { - return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") - } - if strlen(r.volumeId) < 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") } - if strlen(r.volumeId) > 36 { - return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") } - if r.updateAttachedVolumePayload == nil { - return localVarReturnValue, fmt.Errorf("updateAttachedVolumePayload is required and must be specified") + if r.updateImagePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImagePayload is required and must be specified") } // to determine the Content-Type header @@ -12543,7 +15085,7 @@ func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateAttachedVolumePayload + localVarPostBody = r.updateImagePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -12647,33 +15189,30 @@ func (r ApiUpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { } /* -UpdateAttachedVolume: Update Volume Attachment Parameters. +UpdateImage: Update Image Parameters. -Update the properties of an existing Volume Attachment. +Update the properties of an existing Image inside a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param serverId The identifier (ID) of a STACKIT Server. - @param volumeId The identifier (ID) of a STACKIT Volume. - @return ApiUpdateAttachedVolumeRequest + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageRequest */ -func (a *APIClient) UpdateAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest { - return ApiUpdateAttachedVolumeRequest{ +func (a *APIClient) UpdateImage(ctx context.Context, projectId string, imageId string) ApiUpdateImageRequest { + return ApiUpdateImageRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } } -func (a *APIClient) UpdateAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { - r := ApiUpdateAttachedVolumeRequest{ +func (a *APIClient) UpdateImageExecute(ctx context.Context, projectId string, imageId string) (*Image, error) { + r := ApiUpdateImageRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - serverId: serverId, - volumeId: volumeId, + imageId: imageId, } return r.Execute() } @@ -12865,23 +15404,23 @@ func (a *APIClient) UpdateKeyPairExecute(ctx context.Context, keypairName string return r.Execute() } -type ApiUpdateNICRequest struct { +type ApiUpdateNicRequest struct { ctx context.Context apiService *DefaultApiService projectId string networkId string nicId string - updateNICPayload *UpdateNICPayload + updateNicPayload *UpdateNicPayload } // Request an update of a network interface. -func (r ApiUpdateNICRequest) UpdateNICPayload(updateNICPayload UpdateNICPayload) ApiUpdateNICRequest { - r.updateNICPayload = &updateNICPayload +func (r ApiUpdateNicRequest) UpdateNicPayload(updateNicPayload UpdateNicPayload) ApiUpdateNicRequest { + r.updateNicPayload = &updateNicPayload return r } -func (r ApiUpdateNICRequest) Execute() (*NIC, error) { +func (r ApiUpdateNicRequest) Execute() (*NIC, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} @@ -12889,7 +15428,7 @@ func (r ApiUpdateNICRequest) Execute() (*NIC, error) { localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNIC") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNic") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } @@ -12920,8 +15459,8 @@ func (r ApiUpdateNICRequest) Execute() (*NIC, error) { if strlen(r.nicId) > 36 { return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") } - if r.updateNICPayload == nil { - return localVarReturnValue, fmt.Errorf("updateNICPayload is required and must be specified") + if r.updateNicPayload == nil { + return localVarReturnValue, fmt.Errorf("updateNicPayload is required and must be specified") } // to determine the Content-Type header @@ -12942,7 +15481,7 @@ func (r ApiUpdateNICRequest) Execute() (*NIC, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateNICPayload + localVarPostBody = r.updateNicPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -13057,7 +15596,7 @@ func (r ApiUpdateNICRequest) Execute() (*NIC, error) { } /* -UpdateNIC: Update a network interface. +UpdateNic: Update a network interface. Update the properties of an existing network interface inside a network. @@ -13065,10 +15604,10 @@ Update the properties of an existing network interface inside a network. @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 ApiUpdateNICRequest + @return ApiUpdateNicRequest */ -func (a *APIClient) UpdateNIC(ctx context.Context, projectId string, networkId string, nicId string) ApiUpdateNICRequest { - return ApiUpdateNICRequest{ +func (a *APIClient) UpdateNic(ctx context.Context, projectId string, networkId string, nicId string) ApiUpdateNicRequest { + return ApiUpdateNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -13077,8 +15616,8 @@ func (a *APIClient) UpdateNIC(ctx context.Context, projectId string, networkId s } } -func (a *APIClient) UpdateNICExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { - r := ApiUpdateNICRequest{ +func (a *APIClient) UpdateNicExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { + r := ApiUpdateNicRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -13691,6 +16230,207 @@ func (a *APIClient) UpdateServerExecute(ctx context.Context, projectId string, s return r.Execute() } +type ApiUpdateVirtualIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + virtualIpId string + updateVirtualIPPayload *UpdateVirtualIPPayload +} + +// Request an update of a virtual IP. + +func (r ApiUpdateVirtualIPRequest) UpdateVirtualIPPayload(updateVirtualIPPayload UpdateVirtualIPPayload) ApiUpdateVirtualIPRequest { + r.updateVirtualIPPayload = &updateVirtualIPPayload + return r +} + +func (r ApiUpdateVirtualIPRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateVirtualIP") + 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") + } + if r.updateVirtualIPPayload == nil { + return fmt.Errorf("updateVirtualIPPayload 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.updateVirtualIPPayload + 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 +} + +/* +UpdateVirtualIP: Update a virtual IP. + +Update the properties of an existing virtual IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @param virtualIpId The identifier (ID) of a Virtual IP. + @return ApiUpdateVirtualIPRequest +*/ +func (a *APIClient) UpdateVirtualIP(ctx context.Context, projectId string, networkId string, virtualIpId string) ApiUpdateVirtualIPRequest { + return ApiUpdateVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, + } +} + +func (a *APIClient) UpdateVirtualIPExecute(ctx context.Context, projectId string, networkId string, virtualIpId string) error { + r := ApiUpdateVirtualIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + virtualIpId: virtualIpId, + } + return r.Execute() +} + type ApiUpdateVolumeRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/iaasalpha/api_default_test.go b/services/iaasalpha/api_default_test.go index fd2df0bf2..4b56d9e33 100644 --- a/services/iaasalpha/api_default_test.go +++ b/services/iaasalpha/api_default_test.go @@ -23,17 +23,20 @@ import ( func Test_iaasalpha_DefaultApiService(t *testing.T) { - t.Run("Test DefaultApiService AddNICToServer", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + t.Run("Test DefaultApiService AddMemberToVirtualIP", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}/add-member" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - nicIdValue := "nicId" - path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + virtualIpIdValue := "virtualIpId" + path = strings.Replace(path, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(virtualIpIdValue, "virtualIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VirtualIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -65,14 +68,18 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - nicId := "nicId" + networkId := "networkId" + virtualIpId := "virtualIpId" + addMemberToVirtualIPPayload := AddMemberToVirtualIPPayload{} - reqErr := apiClient.AddNICToServer(context.Background(), projectId, serverId, nicId).Execute() + resp, reqErr := apiClient.AddMemberToVirtualIP(context.Background(), projectId, networkId, virtualIpId).AddMemberToVirtualIPPayload(addMemberToVirtualIPPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) t.Run("Test DefaultApiService AddNetworkToServer", func(t *testing.T) { @@ -127,6 +134,58 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService AddNicToServer", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + 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" + serverId := "serverId" + nicId := "nicId" + + reqErr := apiClient.AddNicToServer(context.Background(), projectId, serverId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService AddPublicIpToServer", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" projectIdValue := "projectId" @@ -347,6 +406,59 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService CreateImage", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/images" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ImageCreateResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for 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" + createImagePayload := CreateImagePayload{} + + resp, reqErr := apiClient.CreateImage(context.Background(), projectId).CreateImagePayload(createImagePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService CreateKeyPair", func(t *testing.T) { path := "/v1alpha1/keypairs" @@ -397,7 +509,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService CreateNIC", func(t *testing.T) { + t.Run("Test DefaultApiService CreateNic", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) @@ -441,9 +553,9 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { projectId := "projectId" networkId := "networkId" - createNICPayload := CreateNICPayload{} + createNicPayload := CreateNicPayload{} - resp, reqErr := apiClient.CreateNIC(context.Background(), projectId, networkId).CreateNICPayload(createNICPayload).Execute() + resp, reqErr := apiClient.CreateNic(context.Background(), projectId, networkId).CreateNicPayload(createNicPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -668,6 +780,62 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService CreateVirtualIP", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VirtualIp{} + 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" + networkId := "networkId" + createVirtualIPPayload := CreateVirtualIPPayload{} + + resp, reqErr := apiClient.CreateVirtualIP(context.Background(), projectId, networkId).CreateVirtualIPPayload(createVirtualIPPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService CreateVolume", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/volumes" projectIdValue := "projectId" @@ -770,6 +938,55 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService DeleteImage", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/images/{imageId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + 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.DeleteImage(context.Background(), projectId, imageId).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" @@ -816,7 +1033,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteNIC", func(t *testing.T) { + t.Run("Test DefaultApiService DeleteNic", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) @@ -861,7 +1078,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { networkId := "networkId" nicId := "nicId" - reqErr := apiClient.DeleteNIC(context.Background(), projectId, networkId, nicId).Execute() + reqErr := apiClient.DeleteNic(context.Background(), projectId, networkId, nicId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1067,12 +1284,14 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/volumes/{volumeId}" + t.Run("Test DefaultApiService DeleteVirtualIP", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumeIdValue := "volumeId" - path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + virtualIpIdValue := "virtualIpId" + path = strings.Replace(path, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(virtualIpIdValue, "virtualIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -1107,29 +1326,25 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } projectId := "projectId" - volumeId := "volumeId" + networkId := "networkId" + virtualIpId := "virtualIpId" - reqErr := apiClient.DeleteVolume(context.Background(), projectId, volumeId).Execute() + reqErr := apiClient.DeleteVirtualIP(context.Background(), projectId, networkId, virtualIpId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/volumes/{volumeId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) volumeIdValue := "volumeId" path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := VolumeAttachment{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1161,27 +1376,27 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" volumeId := "volumeId" - resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, serverId, volumeId).Execute() + reqErr := apiClient.DeleteVolume(context.Background(), projectId, volumeId).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" - path = strings.Replace(path, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Keypair{} + data := VolumeAttachment{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1214,9 +1429,11 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - keypairName := "keypairName" + projectId := "projectId" + serverId := "serverId" + volumeId := "volumeId" - resp, reqErr := apiClient.GetKeyPair(context.Background(), keypairName).Execute() + resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, serverId, volumeId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1226,18 +1443,16 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetNIC", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + t.Run("Test DefaultApiService GetImage", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/images/{imageId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) - nicIdValue := "nicId" - path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NIC{} + data := Image{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1271,10 +1486,116 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" - nicId := "nicId" + imageId := "imageId" + + resp, reqErr := apiClient.GetImage(context.Background(), projectId, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) { + path := "/v1alpha1/keypairs/{keypairName}" + keypairNameValue := "keypairName" + path = strings.Replace(path, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Keypair{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for 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) + } + + keypairName := "keypairName" + + resp, reqErr := apiClient.GetKeyPair(context.Background(), keypairName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetMachineType", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/machine-types/{machineType}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + machineTypeValue := "machineType" + path = strings.Replace(path, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := MachineType{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for 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" + machineType := "machineType" - resp, reqErr := apiClient.GetNIC(context.Background(), projectId, networkId, nicId).Execute() + resp, reqErr := apiClient.GetMachineType(context.Background(), projectId, machineType).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1394,6 +1715,64 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService GetNic", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + 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" + networkId := "networkId" + nicId := "nicId" + + resp, reqErr := apiClient.GetNic(context.Background(), projectId, networkId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService GetOrganizationRequest", func(t *testing.T) { path := "/v1alpha1/organizations/{organizationId}/requests/{requestId}" organizationIdValue := "organizationId" @@ -1889,6 +2268,64 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService GetVirtualIP", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + virtualIpIdValue := "virtualIpId" + path = strings.Replace(path, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(virtualIpIdValue, "virtualIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VirtualIp{} + 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" + networkId := "networkId" + virtualIpId := "virtualIpId" + + resp, reqErr := apiClient.GetVirtualIP(context.Background(), projectId, networkId, virtualIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService GetVolume", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/volumes/{volumeId}" projectIdValue := "projectId" @@ -2054,6 +2491,58 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService ListImages", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/images" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ImageListResponse{} + 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" + + resp, reqErr := apiClient.ListImages(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService ListKeyPairs", func(t *testing.T) { path := "/v1alpha1/keypairs" @@ -2102,16 +2591,68 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNICs", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" + t.Run("Test DefaultApiService ListMachineTypes", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/machine-types" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NICListResponse{} + data := MachineTypeListResponse{} + 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" + + resp, reqErr := apiClient.ListMachineTypes(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreaProjects", func(t *testing.T) { + path := "/v1alpha1/organizations/{organizationId}/network-areas/{areaId}/projects" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ProjectListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2144,10 +2685,10 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - projectId := "projectId" - networkId := "networkId" + organizationId := "organizationId" + areaId := "areaId" - resp, reqErr := apiClient.ListNICs(context.Background(), projectId, networkId).Execute() + resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2157,16 +2698,14 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreaProjects", func(t *testing.T) { - path := "/v1alpha1/organizations/{organizationId}/network-areas/{areaId}/projects" + t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { + path := "/v1alpha1/organizations/{organizationId}/network-areas" organizationIdValue := "organizationId" path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ProjectListResponse{} + data := NetworkAreaListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2200,9 +2739,8 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } organizationId := "organizationId" - areaId := "areaId" - resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2212,14 +2750,14 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { - path := "/v1alpha1/organizations/{organizationId}/network-areas" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkAreaListResponse{} + data := NetworkListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2252,9 +2790,9 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" + projectId := "projectId" - resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() + resp, reqErr := apiClient.ListNetworks(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2264,14 +2802,16 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/networks" + t.Run("Test DefaultApiService ListNics", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkListResponse{} + data := NICListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -2305,8 +2845,9 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } projectId := "projectId" + networkId := "networkId" - resp, reqErr := apiClient.ListNetworks(context.Background(), projectId).Execute() + resp, reqErr := apiClient.ListNics(context.Background(), projectId, networkId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2523,7 +3064,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListServerNICs", func(t *testing.T) { + t.Run("Test DefaultApiService ListServerNics", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/servers/{serverId}/nics" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) @@ -2568,7 +3109,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { projectId := "projectId" serverId := "serverId" - resp, reqErr := apiClient.ListServerNICs(context.Background(), projectId, serverId).Execute() + resp, reqErr := apiClient.ListServerNics(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -2685,6 +3226,61 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService ListVirtualIPs", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VirtualIpListResponse{} + 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" + networkId := "networkId" + + resp, reqErr := apiClient.ListVirtualIPs(context.Background(), projectId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService ListVolumePerformanceClasses", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/volume-performance-classes" projectIdValue := "projectId" @@ -2838,17 +3434,20 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService RemoveNICFromServer", func(t *testing.T) { - path := "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + t.Run("Test DefaultApiService RemoveMemberFromVirtualIP", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}/remove-member" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" - path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - nicIdValue := "nicId" - path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + virtualIpIdValue := "virtualIpId" + path = strings.Replace(path, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(virtualIpIdValue, "virtualIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VirtualIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -2880,14 +3479,18 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } projectId := "projectId" - serverId := "serverId" - nicId := "nicId" + networkId := "networkId" + virtualIpId := "virtualIpId" + removeMemberFromVirtualIPPayload := RemoveMemberFromVirtualIPPayload{} - reqErr := apiClient.RemoveNICFromServer(context.Background(), projectId, serverId, nicId).Execute() + resp, reqErr := apiClient.RemoveMemberFromVirtualIP(context.Background(), projectId, networkId, virtualIpId).RemoveMemberFromVirtualIPPayload(removeMemberFromVirtualIPPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) t.Run("Test DefaultApiService RemoveNetworkFromServer", func(t *testing.T) { @@ -2942,6 +3545,58 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService RemoveNicFromServer", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + 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" + serverId := "serverId" + nicId := "nicId" + + reqErr := apiClient.RemoveNicFromServer(context.Background(), projectId, serverId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService RemovePublicIpFromServer", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" projectIdValue := "projectId" @@ -3511,6 +4166,62 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService UpdateImage", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/images/{imageId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + imageIdValue := "imageId" + path = strings.Replace(path, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Image{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for 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" + updateImagePayload := UpdateImagePayload{} + + resp, reqErr := apiClient.UpdateImage(context.Background(), projectId, imageId).UpdateImagePayload(updateImagePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService UpdateKeyPair", func(t *testing.T) { path := "/v1alpha1/keypairs/{keypairName}" keypairNameValue := "keypairName" @@ -3564,7 +4275,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService UpdateNIC", func(t *testing.T) { + t.Run("Test DefaultApiService UpdateNic", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/networks/{networkId}/nics/{nicId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) @@ -3611,9 +4322,9 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { projectId := "projectId" networkId := "networkId" nicId := "nicId" - updateNICPayload := UpdateNICPayload{} + updateNicPayload := UpdateNicPayload{} - resp, reqErr := apiClient.UpdateNIC(context.Background(), projectId, networkId, nicId).UpdateNICPayload(updateNICPayload).Execute() + resp, reqErr := apiClient.UpdateNic(context.Background(), projectId, networkId, nicId).UpdateNicPayload(updateNicPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -3791,6 +4502,59 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService UpdateVirtualIP", func(t *testing.T) { + path := "/v1alpha1/projects/{projectId}/networks/{networkId}/virtual-ips/{virtualIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + virtualIpIdValue := "virtualIpId" + path = strings.Replace(path, "{"+"virtualIpId"+"}", url.PathEscape(ParameterValueToString(virtualIpIdValue, "virtualIpId")), -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" + networkId := "networkId" + virtualIpId := "virtualIpId" + updateVirtualIPPayload := UpdateVirtualIPPayload{} + + reqErr := apiClient.UpdateVirtualIP(context.Background(), projectId, networkId, virtualIpId).UpdateVirtualIPPayload(updateVirtualIPPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService UpdateVolume", func(t *testing.T) { path := "/v1alpha1/projects/{projectId}/volumes/{volumeId}" projectIdValue := "projectId" diff --git a/services/iaasalpha/model_add_member_to_virtual_ip_payload.go b/services/iaasalpha/model_add_member_to_virtual_ip_payload.go new file mode 100644 index 000000000..704cbd917 --- /dev/null +++ b/services/iaasalpha/model_add_member_to_virtual_ip_payload.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 AddMemberToVirtualIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddMemberToVirtualIPPayload{} + +// AddMemberToVirtualIPPayload Object that represents a virtual IP member. +type AddMemberToVirtualIPPayload struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Member *string `json:"member"` +} + +type _AddMemberToVirtualIPPayload AddMemberToVirtualIPPayload + +// NewAddMemberToVirtualIPPayload instantiates a new AddMemberToVirtualIPPayload 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 NewAddMemberToVirtualIPPayload(member *string) *AddMemberToVirtualIPPayload { + this := AddMemberToVirtualIPPayload{} + this.Member = member + return &this +} + +// NewAddMemberToVirtualIPPayloadWithDefaults instantiates a new AddMemberToVirtualIPPayload 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 NewAddMemberToVirtualIPPayloadWithDefaults() *AddMemberToVirtualIPPayload { + this := AddMemberToVirtualIPPayload{} + return &this +} + +// GetMember returns the Member field value +func (o *AddMemberToVirtualIPPayload) GetMember() *string { + if o == nil { + var ret *string + return ret + } + + return o.Member +} + +// GetMemberOk returns a tuple with the Member field value +// and a boolean to check if the value has been set. +func (o *AddMemberToVirtualIPPayload) GetMemberOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Member, true +} + +// SetMember sets field value +func (o *AddMemberToVirtualIPPayload) SetMember(v *string) { + o.Member = v +} + +func (o AddMemberToVirtualIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["member"] = o.Member + return toSerialize, nil +} + +type NullableAddMemberToVirtualIPPayload struct { + value *AddMemberToVirtualIPPayload + isSet bool +} + +func (v NullableAddMemberToVirtualIPPayload) Get() *AddMemberToVirtualIPPayload { + return v.value +} + +func (v *NullableAddMemberToVirtualIPPayload) Set(val *AddMemberToVirtualIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddMemberToVirtualIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddMemberToVirtualIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddMemberToVirtualIPPayload(val *AddMemberToVirtualIPPayload) *NullableAddMemberToVirtualIPPayload { + return &NullableAddMemberToVirtualIPPayload{value: val, isSet: true} +} + +func (v NullableAddMemberToVirtualIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddMemberToVirtualIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_create_image_payload.go b/services/iaasalpha/model_create_image_payload.go new file mode 100644 index 000000000..c467540d0 --- /dev/null +++ b/services/iaasalpha/model_create_image_payload.go @@ -0,0 +1,472 @@ +/* +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 CreateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateImagePayload{} + +// CreateImagePayload Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type CreateImagePayload struct { + Config *ImageConfig `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Object that represents a disk format. + // REQUIRED + DiskFormat *string `json:"diskFormat"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize *int64 `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam *int64 `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + Protected *bool `json:"protected,omitempty"` + // The status of an image object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _CreateImagePayload CreateImagePayload + +// NewCreateImagePayload instantiates a new CreateImagePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateImagePayload(diskFormat *string, name *string) *CreateImagePayload { + this := CreateImagePayload{} + this.DiskFormat = diskFormat + this.Name = name + return &this +} + +// NewCreateImagePayloadWithDefaults instantiates a new CreateImagePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateImagePayloadWithDefaults() *CreateImagePayload { + this := CreateImagePayload{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *CreateImagePayload) GetConfig() *ImageConfig { + if o == nil || IsNil(o.Config) { + var ret *ImageConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *CreateImagePayload) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *CreateImagePayload) SetConfig(v *ImageConfig) { + o.Config = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateImagePayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDiskFormat returns the DiskFormat field value +func (o *CreateImagePayload) GetDiskFormat() *string { + if o == nil { + var ret *string + return ret + } + + return o.DiskFormat +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetDiskFormatOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DiskFormat, true +} + +// SetDiskFormat sets field value +func (o *CreateImagePayload) SetDiskFormat(v *string) { + o.DiskFormat = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateImagePayload) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateImagePayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateImagePayload) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateImagePayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateImagePayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateImagePayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinDiskSize() *int64 { + if o == nil || IsNil(o.MinDiskSize) { + var ret *int64 + return ret + } + return o.MinDiskSize +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinDiskSizeOk() (*int64, bool) { + if o == nil || IsNil(o.MinDiskSize) { + return nil, false + } + return o.MinDiskSize, true +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinDiskSize() bool { + if o != nil && !IsNil(o.MinDiskSize) { + return true + } + + return false +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *CreateImagePayload) SetMinDiskSize(v *int64) { + o.MinDiskSize = v +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinRam() *int64 { + if o == nil || IsNil(o.MinRam) { + var ret *int64 + return ret + } + return o.MinRam +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinRamOk() (*int64, bool) { + if o == nil || IsNil(o.MinRam) { + return nil, false + } + return o.MinRam, true +} + +// HasMinRam returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinRam() bool { + if o != nil && !IsNil(o.MinRam) { + return true + } + + return false +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *CreateImagePayload) SetMinRam(v *int64) { + o.MinRam = v +} + +// GetName returns the Name field value +func (o *CreateImagePayload) GetName() *string { + if o == nil { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CreateImagePayload) SetName(v *string) { + o.Name = v +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *CreateImagePayload) GetProtected() *bool { + if o == nil || IsNil(o.Protected) { + var ret *bool + return ret + } + return o.Protected +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetProtectedOk() (*bool, bool) { + if o == nil || IsNil(o.Protected) { + return nil, false + } + return o.Protected, true +} + +// HasProtected returns a boolean if a field has been set. +func (o *CreateImagePayload) HasProtected() bool { + if o != nil && !IsNil(o.Protected) { + return true + } + + return false +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *CreateImagePayload) SetProtected(v *bool) { + o.Protected = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateImagePayload) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateImagePayload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateImagePayload) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateImagePayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o CreateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + toSerialize["diskFormat"] = o.DiskFormat + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.MinDiskSize) { + toSerialize["minDiskSize"] = o.MinDiskSize + } + if !IsNil(o.MinRam) { + toSerialize["minRam"] = o.MinRam + } + toSerialize["name"] = o.Name + if !IsNil(o.Protected) { + toSerialize["protected"] = o.Protected + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableCreateImagePayload struct { + value *CreateImagePayload + isSet bool +} + +func (v NullableCreateImagePayload) Get() *CreateImagePayload { + return v.value +} + +func (v *NullableCreateImagePayload) Set(val *CreateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateImagePayload(val *CreateImagePayload) *NullableCreateImagePayload { + return &NullableCreateImagePayload{value: val, isSet: true} +} + +func (v NullableCreateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_create_key_pair_payload.go b/services/iaasalpha/model_create_key_pair_payload.go index 952cb38a8..7b82f33e1 100644 --- a/services/iaasalpha/model_create_key_pair_payload.go +++ b/services/iaasalpha/model_create_key_pair_payload.go @@ -12,6 +12,7 @@ package iaasalpha import ( "encoding/json" + "time" ) // checks if the CreateKeyPairPayload type satisfies the MappedNullable interface at compile time @@ -19,6 +20,8 @@ var _ MappedNullable = &CreateKeyPairPayload{} // CreateKeyPairPayload Object that represents the public key of an SSH keypair and its name. type CreateKeyPairPayload struct { + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` // Object that represents an SSH keypair MD5 fingerprint. Fingerprint *string `json:"fingerprint,omitempty"` // Object that represents the labels of an object. @@ -28,6 +31,8 @@ type CreateKeyPairPayload struct { // Object that represents a public SSH key. // REQUIRED PublicKey *string `json:"publicKey"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } type _CreateKeyPairPayload CreateKeyPairPayload @@ -50,6 +55,38 @@ func NewCreateKeyPairPayloadWithDefaults() *CreateKeyPairPayload { return &this } +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) 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 *CreateKeyPairPayload) 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 *CreateKeyPairPayload) 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 *CreateKeyPairPayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + // GetFingerprint returns the Fingerprint field value if set, zero value otherwise. func (o *CreateKeyPairPayload) GetFingerprint() *string { if o == nil || IsNil(o.Fingerprint) { @@ -170,8 +207,43 @@ func (o *CreateKeyPairPayload) SetPublicKey(v *string) { o.PublicKey = v } +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) 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 *CreateKeyPairPayload) 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 *CreateKeyPairPayload) 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 *CreateKeyPairPayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + func (o CreateKeyPairPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } if !IsNil(o.Fingerprint) { toSerialize["fingerprint"] = o.Fingerprint } @@ -182,6 +254,9 @@ func (o CreateKeyPairPayload) ToMap() (map[string]interface{}, error) { toSerialize["name"] = o.Name } toSerialize["publicKey"] = o.PublicKey + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } return toSerialize, nil } diff --git a/services/iaasalpha/model_create_nic_payload.go b/services/iaasalpha/model_create_nic_payload.go index 6c33e34d9..23928e931 100644 --- a/services/iaasalpha/model_create_nic_payload.go +++ b/services/iaasalpha/model_create_nic_payload.go @@ -14,11 +14,11 @@ import ( "encoding/json" ) -// checks if the CreateNICPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CreateNICPayload{} +// checks if the CreateNicPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNicPayload{} -// CreateNICPayload Object that represents a network interface. -type CreateNICPayload struct { +// CreateNicPayload Object that represents a network interface. +type CreateNicPayload struct { // A list of IPs or CIDR notations. AllowedAddresses *[]AllowedAddressesInner `json:"allowedAddresses,omitempty"` // Universally Unique Identifier (UUID). @@ -45,29 +45,29 @@ type CreateNICPayload struct { Type *string `json:"type,omitempty"` } -// NewCreateNICPayload instantiates a new CreateNICPayload object +// NewCreateNicPayload instantiates a new CreateNicPayload 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 NewCreateNICPayload() *CreateNICPayload { - this := CreateNICPayload{} +func NewCreateNicPayload() *CreateNicPayload { + this := CreateNicPayload{} var nicSecurity bool = true this.NicSecurity = &nicSecurity return &this } -// NewCreateNICPayloadWithDefaults instantiates a new CreateNICPayload object +// NewCreateNicPayloadWithDefaults instantiates a new CreateNicPayload 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 NewCreateNICPayloadWithDefaults() *CreateNICPayload { - this := CreateNICPayload{} +func NewCreateNicPayloadWithDefaults() *CreateNicPayload { + this := CreateNicPayload{} var nicSecurity bool = true this.NicSecurity = &nicSecurity return &this } // GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. -func (o *CreateNICPayload) GetAllowedAddresses() *[]AllowedAddressesInner { +func (o *CreateNicPayload) GetAllowedAddresses() *[]AllowedAddressesInner { if o == nil || IsNil(o.AllowedAddresses) { var ret *[]AllowedAddressesInner return ret @@ -77,7 +77,7 @@ func (o *CreateNICPayload) GetAllowedAddresses() *[]AllowedAddressesInner { // GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bool) { +func (o *CreateNicPayload) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bool) { if o == nil || IsNil(o.AllowedAddresses) { return nil, false } @@ -85,7 +85,7 @@ func (o *CreateNICPayload) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bo } // HasAllowedAddresses returns a boolean if a field has been set. -func (o *CreateNICPayload) HasAllowedAddresses() bool { +func (o *CreateNicPayload) HasAllowedAddresses() bool { if o != nil && !IsNil(o.AllowedAddresses) { return true } @@ -94,12 +94,12 @@ func (o *CreateNICPayload) HasAllowedAddresses() bool { } // SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. -func (o *CreateNICPayload) SetAllowedAddresses(v *[]AllowedAddressesInner) { +func (o *CreateNicPayload) SetAllowedAddresses(v *[]AllowedAddressesInner) { o.AllowedAddresses = v } // GetDevice returns the Device field value if set, zero value otherwise. -func (o *CreateNICPayload) GetDevice() *string { +func (o *CreateNicPayload) GetDevice() *string { if o == nil || IsNil(o.Device) { var ret *string return ret @@ -109,7 +109,7 @@ func (o *CreateNICPayload) GetDevice() *string { // GetDeviceOk returns a tuple with the Device field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetDeviceOk() (*string, bool) { +func (o *CreateNicPayload) GetDeviceOk() (*string, bool) { if o == nil || IsNil(o.Device) { return nil, false } @@ -117,7 +117,7 @@ func (o *CreateNICPayload) GetDeviceOk() (*string, bool) { } // HasDevice returns a boolean if a field has been set. -func (o *CreateNICPayload) HasDevice() bool { +func (o *CreateNicPayload) HasDevice() bool { if o != nil && !IsNil(o.Device) { return true } @@ -126,12 +126,12 @@ func (o *CreateNICPayload) HasDevice() bool { } // SetDevice gets a reference to the given string and assigns it to the Device field. -func (o *CreateNICPayload) SetDevice(v *string) { +func (o *CreateNicPayload) SetDevice(v *string) { o.Device = v } // GetId returns the Id field value if set, zero value otherwise. -func (o *CreateNICPayload) GetId() *string { +func (o *CreateNicPayload) GetId() *string { if o == nil || IsNil(o.Id) { var ret *string return ret @@ -141,7 +141,7 @@ func (o *CreateNICPayload) GetId() *string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetIdOk() (*string, bool) { +func (o *CreateNicPayload) GetIdOk() (*string, bool) { if o == nil || IsNil(o.Id) { return nil, false } @@ -149,7 +149,7 @@ func (o *CreateNICPayload) GetIdOk() (*string, bool) { } // HasId returns a boolean if a field has been set. -func (o *CreateNICPayload) HasId() bool { +func (o *CreateNicPayload) HasId() bool { if o != nil && !IsNil(o.Id) { return true } @@ -158,12 +158,12 @@ func (o *CreateNICPayload) HasId() bool { } // SetId gets a reference to the given string and assigns it to the Id field. -func (o *CreateNICPayload) SetId(v *string) { +func (o *CreateNicPayload) SetId(v *string) { o.Id = v } // GetIpv4 returns the Ipv4 field value if set, zero value otherwise. -func (o *CreateNICPayload) GetIpv4() *string { +func (o *CreateNicPayload) GetIpv4() *string { if o == nil || IsNil(o.Ipv4) { var ret *string return ret @@ -173,7 +173,7 @@ func (o *CreateNICPayload) GetIpv4() *string { // GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetIpv4Ok() (*string, bool) { +func (o *CreateNicPayload) GetIpv4Ok() (*string, bool) { if o == nil || IsNil(o.Ipv4) { return nil, false } @@ -181,7 +181,7 @@ func (o *CreateNICPayload) GetIpv4Ok() (*string, bool) { } // HasIpv4 returns a boolean if a field has been set. -func (o *CreateNICPayload) HasIpv4() bool { +func (o *CreateNicPayload) HasIpv4() bool { if o != nil && !IsNil(o.Ipv4) { return true } @@ -190,12 +190,12 @@ func (o *CreateNICPayload) HasIpv4() bool { } // SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. -func (o *CreateNICPayload) SetIpv4(v *string) { +func (o *CreateNicPayload) SetIpv4(v *string) { o.Ipv4 = v } // GetIpv6 returns the Ipv6 field value if set, zero value otherwise. -func (o *CreateNICPayload) GetIpv6() *string { +func (o *CreateNicPayload) GetIpv6() *string { if o == nil || IsNil(o.Ipv6) { var ret *string return ret @@ -205,7 +205,7 @@ func (o *CreateNICPayload) GetIpv6() *string { // GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetIpv6Ok() (*string, bool) { +func (o *CreateNicPayload) GetIpv6Ok() (*string, bool) { if o == nil || IsNil(o.Ipv6) { return nil, false } @@ -213,7 +213,7 @@ func (o *CreateNICPayload) GetIpv6Ok() (*string, bool) { } // HasIpv6 returns a boolean if a field has been set. -func (o *CreateNICPayload) HasIpv6() bool { +func (o *CreateNicPayload) HasIpv6() bool { if o != nil && !IsNil(o.Ipv6) { return true } @@ -222,12 +222,12 @@ func (o *CreateNICPayload) HasIpv6() bool { } // SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. -func (o *CreateNICPayload) SetIpv6(v *string) { +func (o *CreateNicPayload) SetIpv6(v *string) { o.Ipv6 = v } // GetLabels returns the Labels field value if set, zero value otherwise. -func (o *CreateNICPayload) GetLabels() *map[string]interface{} { +func (o *CreateNicPayload) GetLabels() *map[string]interface{} { if o == nil || IsNil(o.Labels) { var ret *map[string]interface{} return ret @@ -237,7 +237,7 @@ func (o *CreateNICPayload) GetLabels() *map[string]interface{} { // GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetLabelsOk() (*map[string]interface{}, bool) { +func (o *CreateNicPayload) GetLabelsOk() (*map[string]interface{}, bool) { if o == nil || IsNil(o.Labels) { return &map[string]interface{}{}, false } @@ -245,7 +245,7 @@ func (o *CreateNICPayload) GetLabelsOk() (*map[string]interface{}, bool) { } // HasLabels returns a boolean if a field has been set. -func (o *CreateNICPayload) HasLabels() bool { +func (o *CreateNicPayload) HasLabels() bool { if o != nil && !IsNil(o.Labels) { return true } @@ -254,12 +254,12 @@ func (o *CreateNICPayload) HasLabels() bool { } // SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. -func (o *CreateNICPayload) SetLabels(v *map[string]interface{}) { +func (o *CreateNicPayload) SetLabels(v *map[string]interface{}) { o.Labels = v } // GetMac returns the Mac field value if set, zero value otherwise. -func (o *CreateNICPayload) GetMac() *string { +func (o *CreateNicPayload) GetMac() *string { if o == nil || IsNil(o.Mac) { var ret *string return ret @@ -269,7 +269,7 @@ func (o *CreateNICPayload) GetMac() *string { // GetMacOk returns a tuple with the Mac field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetMacOk() (*string, bool) { +func (o *CreateNicPayload) GetMacOk() (*string, bool) { if o == nil || IsNil(o.Mac) { return nil, false } @@ -277,7 +277,7 @@ func (o *CreateNICPayload) GetMacOk() (*string, bool) { } // HasMac returns a boolean if a field has been set. -func (o *CreateNICPayload) HasMac() bool { +func (o *CreateNicPayload) HasMac() bool { if o != nil && !IsNil(o.Mac) { return true } @@ -286,12 +286,12 @@ func (o *CreateNICPayload) HasMac() bool { } // SetMac gets a reference to the given string and assigns it to the Mac field. -func (o *CreateNICPayload) SetMac(v *string) { +func (o *CreateNicPayload) SetMac(v *string) { o.Mac = v } // GetName returns the Name field value if set, zero value otherwise. -func (o *CreateNICPayload) GetName() *string { +func (o *CreateNicPayload) GetName() *string { if o == nil || IsNil(o.Name) { var ret *string return ret @@ -301,7 +301,7 @@ func (o *CreateNICPayload) GetName() *string { // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetNameOk() (*string, bool) { +func (o *CreateNicPayload) GetNameOk() (*string, bool) { if o == nil || IsNil(o.Name) { return nil, false } @@ -309,7 +309,7 @@ func (o *CreateNICPayload) GetNameOk() (*string, bool) { } // HasName returns a boolean if a field has been set. -func (o *CreateNICPayload) HasName() bool { +func (o *CreateNicPayload) HasName() bool { if o != nil && !IsNil(o.Name) { return true } @@ -318,12 +318,12 @@ func (o *CreateNICPayload) HasName() bool { } // SetName gets a reference to the given string and assigns it to the Name field. -func (o *CreateNICPayload) SetName(v *string) { +func (o *CreateNicPayload) SetName(v *string) { o.Name = v } // GetNetworkId returns the NetworkId field value if set, zero value otherwise. -func (o *CreateNICPayload) GetNetworkId() *string { +func (o *CreateNicPayload) GetNetworkId() *string { if o == nil || IsNil(o.NetworkId) { var ret *string return ret @@ -333,7 +333,7 @@ func (o *CreateNICPayload) GetNetworkId() *string { // GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetNetworkIdOk() (*string, bool) { +func (o *CreateNicPayload) GetNetworkIdOk() (*string, bool) { if o == nil || IsNil(o.NetworkId) { return nil, false } @@ -341,7 +341,7 @@ func (o *CreateNICPayload) GetNetworkIdOk() (*string, bool) { } // HasNetworkId returns a boolean if a field has been set. -func (o *CreateNICPayload) HasNetworkId() bool { +func (o *CreateNicPayload) HasNetworkId() bool { if o != nil && !IsNil(o.NetworkId) { return true } @@ -350,12 +350,12 @@ func (o *CreateNICPayload) HasNetworkId() bool { } // SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. -func (o *CreateNICPayload) SetNetworkId(v *string) { +func (o *CreateNicPayload) SetNetworkId(v *string) { o.NetworkId = v } // GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. -func (o *CreateNICPayload) GetNicSecurity() *bool { +func (o *CreateNicPayload) GetNicSecurity() *bool { if o == nil || IsNil(o.NicSecurity) { var ret *bool return ret @@ -365,7 +365,7 @@ func (o *CreateNICPayload) GetNicSecurity() *bool { // GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetNicSecurityOk() (*bool, bool) { +func (o *CreateNicPayload) GetNicSecurityOk() (*bool, bool) { if o == nil || IsNil(o.NicSecurity) { return nil, false } @@ -373,7 +373,7 @@ func (o *CreateNICPayload) GetNicSecurityOk() (*bool, bool) { } // HasNicSecurity returns a boolean if a field has been set. -func (o *CreateNICPayload) HasNicSecurity() bool { +func (o *CreateNicPayload) HasNicSecurity() bool { if o != nil && !IsNil(o.NicSecurity) { return true } @@ -382,12 +382,12 @@ func (o *CreateNICPayload) HasNicSecurity() bool { } // SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. -func (o *CreateNICPayload) SetNicSecurity(v *bool) { +func (o *CreateNicPayload) SetNicSecurity(v *bool) { o.NicSecurity = v } // GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. -func (o *CreateNICPayload) GetSecurityGroups() *[]string { +func (o *CreateNicPayload) GetSecurityGroups() *[]string { if o == nil || IsNil(o.SecurityGroups) { var ret *[]string return ret @@ -397,7 +397,7 @@ func (o *CreateNICPayload) GetSecurityGroups() *[]string { // GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetSecurityGroupsOk() (*[]string, bool) { +func (o *CreateNicPayload) GetSecurityGroupsOk() (*[]string, bool) { if o == nil || IsNil(o.SecurityGroups) { return nil, false } @@ -405,7 +405,7 @@ func (o *CreateNICPayload) GetSecurityGroupsOk() (*[]string, bool) { } // HasSecurityGroups returns a boolean if a field has been set. -func (o *CreateNICPayload) HasSecurityGroups() bool { +func (o *CreateNicPayload) HasSecurityGroups() bool { if o != nil && !IsNil(o.SecurityGroups) { return true } @@ -414,12 +414,12 @@ func (o *CreateNICPayload) HasSecurityGroups() bool { } // SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. -func (o *CreateNICPayload) SetSecurityGroups(v *[]string) { +func (o *CreateNicPayload) SetSecurityGroups(v *[]string) { o.SecurityGroups = v } // GetStatus returns the Status field value if set, zero value otherwise. -func (o *CreateNICPayload) GetStatus() *string { +func (o *CreateNicPayload) GetStatus() *string { if o == nil || IsNil(o.Status) { var ret *string return ret @@ -429,7 +429,7 @@ func (o *CreateNICPayload) GetStatus() *string { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetStatusOk() (*string, bool) { +func (o *CreateNicPayload) GetStatusOk() (*string, bool) { if o == nil || IsNil(o.Status) { return nil, false } @@ -437,7 +437,7 @@ func (o *CreateNICPayload) GetStatusOk() (*string, bool) { } // HasStatus returns a boolean if a field has been set. -func (o *CreateNICPayload) HasStatus() bool { +func (o *CreateNicPayload) HasStatus() bool { if o != nil && !IsNil(o.Status) { return true } @@ -446,12 +446,12 @@ func (o *CreateNICPayload) HasStatus() bool { } // SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *CreateNICPayload) SetStatus(v *string) { +func (o *CreateNicPayload) SetStatus(v *string) { o.Status = v } // GetType returns the Type field value if set, zero value otherwise. -func (o *CreateNICPayload) GetType() *string { +func (o *CreateNicPayload) GetType() *string { if o == nil || IsNil(o.Type) { var ret *string return ret @@ -461,7 +461,7 @@ func (o *CreateNICPayload) GetType() *string { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateNICPayload) GetTypeOk() (*string, bool) { +func (o *CreateNicPayload) GetTypeOk() (*string, bool) { if o == nil || IsNil(o.Type) { return nil, false } @@ -469,7 +469,7 @@ func (o *CreateNICPayload) GetTypeOk() (*string, bool) { } // HasType returns a boolean if a field has been set. -func (o *CreateNICPayload) HasType() bool { +func (o *CreateNicPayload) HasType() bool { if o != nil && !IsNil(o.Type) { return true } @@ -478,11 +478,11 @@ func (o *CreateNICPayload) HasType() bool { } // SetType gets a reference to the given string and assigns it to the Type field. -func (o *CreateNICPayload) SetType(v *string) { +func (o *CreateNicPayload) SetType(v *string) { o.Type = v } -func (o CreateNICPayload) ToMap() (map[string]interface{}, error) { +func (o CreateNicPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !IsNil(o.AllowedAddresses) { toSerialize["allowedAddresses"] = o.AllowedAddresses @@ -526,38 +526,38 @@ func (o CreateNICPayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -type NullableCreateNICPayload struct { - value *CreateNICPayload +type NullableCreateNicPayload struct { + value *CreateNicPayload isSet bool } -func (v NullableCreateNICPayload) Get() *CreateNICPayload { +func (v NullableCreateNicPayload) Get() *CreateNicPayload { return v.value } -func (v *NullableCreateNICPayload) Set(val *CreateNICPayload) { +func (v *NullableCreateNicPayload) Set(val *CreateNicPayload) { v.value = val v.isSet = true } -func (v NullableCreateNICPayload) IsSet() bool { +func (v NullableCreateNicPayload) IsSet() bool { return v.isSet } -func (v *NullableCreateNICPayload) Unset() { +func (v *NullableCreateNicPayload) Unset() { v.value = nil v.isSet = false } -func NewNullableCreateNICPayload(val *CreateNICPayload) *NullableCreateNICPayload { - return &NullableCreateNICPayload{value: val, isSet: true} +func NewNullableCreateNicPayload(val *CreateNicPayload) *NullableCreateNicPayload { + return &NullableCreateNicPayload{value: val, isSet: true} } -func (v NullableCreateNICPayload) MarshalJSON() ([]byte, error) { +func (v NullableCreateNicPayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableCreateNICPayload) UnmarshalJSON(src []byte) error { +func (v *NullableCreateNicPayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/services/iaasalpha/model_create_virtual_ip_payload.go b/services/iaasalpha/model_create_virtual_ip_payload.go new file mode 100644 index 000000000..86dde9cdb --- /dev/null +++ b/services/iaasalpha/model_create_virtual_ip_payload.go @@ -0,0 +1,339 @@ +/* +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 CreateVirtualIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVirtualIPPayload{} + +// CreateVirtualIPPayload Object that represents a virtual IP. +type CreateVirtualIPPayload struct { + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents an IP address. + Ip *string `json:"ip,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // A list of UUIDs. + Members *[]string `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + Network *string `json:"network,omitempty"` + // The state of a resource object. + Status *string `json:"status,omitempty"` +} + +// NewCreateVirtualIPPayload instantiates a new CreateVirtualIPPayload 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 NewCreateVirtualIPPayload() *CreateVirtualIPPayload { + this := CreateVirtualIPPayload{} + return &this +} + +// NewCreateVirtualIPPayloadWithDefaults instantiates a new CreateVirtualIPPayload 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 NewCreateVirtualIPPayloadWithDefaults() *CreateVirtualIPPayload { + this := CreateVirtualIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateVirtualIPPayload) SetId(v *string) { + o.Id = v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetIp() *string { + if o == nil || IsNil(o.Ip) { + var ret *string + return ret + } + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetIpOk() (*string, bool) { + if o == nil || IsNil(o.Ip) { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasIp() bool { + if o != nil && !IsNil(o.Ip) { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *CreateVirtualIPPayload) SetIp(v *string) { + o.Ip = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateVirtualIPPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetMembers() *[]string { + if o == nil || IsNil(o.Members) { + var ret *[]string + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetMembersOk() (*[]string, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *CreateVirtualIPPayload) SetMembers(v *[]string) { + o.Members = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateVirtualIPPayload) SetName(v *string) { + o.Name = v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetNetwork() *string { + if o == nil || IsNil(o.Network) { + var ret *string + return ret + } + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *CreateVirtualIPPayload) SetNetwork(v *string) { + o.Network = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateVirtualIPPayload) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVirtualIPPayload) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateVirtualIPPayload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateVirtualIPPayload) SetStatus(v *string) { + o.Status = v +} + +func (o CreateVirtualIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Ip) { + toSerialize["ip"] = o.Ip + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + return toSerialize, nil +} + +type NullableCreateVirtualIPPayload struct { + value *CreateVirtualIPPayload + isSet bool +} + +func (v NullableCreateVirtualIPPayload) Get() *CreateVirtualIPPayload { + return v.value +} + +func (v *NullableCreateVirtualIPPayload) Set(val *CreateVirtualIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVirtualIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVirtualIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVirtualIPPayload(val *CreateVirtualIPPayload) *NullableCreateVirtualIPPayload { + return &NullableCreateVirtualIPPayload{value: val, isSet: true} +} + +func (v NullableCreateVirtualIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVirtualIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_create_volume_payload.go b/services/iaasalpha/model_create_volume_payload.go index 3f24a41a7..d35849e3d 100644 --- a/services/iaasalpha/model_create_volume_payload.go +++ b/services/iaasalpha/model_create_volume_payload.go @@ -23,6 +23,8 @@ type CreateVolumePayload struct { // Object that represents an availability zone. // REQUIRED AvailabilityZone *string `json:"availabilityZone"` + // Indicates if a volume is bootable. + Bootable *bool `json:"bootable,omitempty"` // Date-time when resource was created. CreatedAt *time.Time `json:"createdAt,omitempty"` // Description Object. Allows string up to 127 Characters. @@ -90,6 +92,38 @@ func (o *CreateVolumePayload) SetAvailabilityZone(v *string) { o.AvailabilityZone = v } +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetBootable() *bool { + if o == nil || IsNil(o.Bootable) { + var ret *bool + return ret + } + return o.Bootable +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetBootableOk() (*bool, bool) { + if o == nil || IsNil(o.Bootable) { + return nil, false + } + return o.Bootable, true +} + +// HasBootable returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasBootable() bool { + if o != nil && !IsNil(o.Bootable) { + return true + } + + return false +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *CreateVolumePayload) SetBootable(v *bool) { + o.Bootable = v +} + // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *CreateVolumePayload) GetCreatedAt() *time.Time { if o == nil || IsNil(o.CreatedAt) { @@ -445,6 +479,9 @@ func (o *CreateVolumePayload) SetUpdatedAt(v *time.Time) { func (o CreateVolumePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["availabilityZone"] = o.AvailabilityZone + if !IsNil(o.Bootable) { + toSerialize["bootable"] = o.Bootable + } if !IsNil(o.CreatedAt) { toSerialize["createdAt"] = o.CreatedAt } diff --git a/services/iaasalpha/model_image.go b/services/iaasalpha/model_image.go new file mode 100644 index 000000000..2cd4e1b99 --- /dev/null +++ b/services/iaasalpha/model_image.go @@ -0,0 +1,472 @@ +/* +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 Image type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Image{} + +// Image Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type Image struct { + Config *ImageConfig `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Object that represents a disk format. + // REQUIRED + DiskFormat *string `json:"diskFormat"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize *int64 `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam *int64 `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + Protected *bool `json:"protected,omitempty"` + // The status of an image object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _Image Image + +// NewImage instantiates a new Image object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImage(diskFormat *string, name *string) *Image { + this := Image{} + this.DiskFormat = diskFormat + this.Name = name + return &this +} + +// NewImageWithDefaults instantiates a new Image object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageWithDefaults() *Image { + this := Image{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *Image) GetConfig() *ImageConfig { + if o == nil || IsNil(o.Config) { + var ret *ImageConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *Image) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *Image) SetConfig(v *ImageConfig) { + o.Config = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Image) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Image) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Image) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDiskFormat returns the DiskFormat field value +func (o *Image) GetDiskFormat() *string { + if o == nil { + var ret *string + return ret + } + + return o.DiskFormat +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *Image) GetDiskFormatOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DiskFormat, true +} + +// SetDiskFormat sets field value +func (o *Image) SetDiskFormat(v *string) { + o.DiskFormat = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Image) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Image) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Image) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Image) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Image) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Image) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *Image) GetMinDiskSize() *int64 { + if o == nil || IsNil(o.MinDiskSize) { + var ret *int64 + return ret + } + return o.MinDiskSize +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinDiskSizeOk() (*int64, bool) { + if o == nil || IsNil(o.MinDiskSize) { + return nil, false + } + return o.MinDiskSize, true +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *Image) HasMinDiskSize() bool { + if o != nil && !IsNil(o.MinDiskSize) { + return true + } + + return false +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *Image) SetMinDiskSize(v *int64) { + o.MinDiskSize = v +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *Image) GetMinRam() *int64 { + if o == nil || IsNil(o.MinRam) { + var ret *int64 + return ret + } + return o.MinRam +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinRamOk() (*int64, bool) { + if o == nil || IsNil(o.MinRam) { + return nil, false + } + return o.MinRam, true +} + +// HasMinRam returns a boolean if a field has been set. +func (o *Image) HasMinRam() bool { + if o != nil && !IsNil(o.MinRam) { + return true + } + + return false +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *Image) SetMinRam(v *int64) { + o.MinRam = v +} + +// GetName returns the Name field value +func (o *Image) GetName() *string { + if o == nil { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Image) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *Image) SetName(v *string) { + o.Name = v +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *Image) GetProtected() *bool { + if o == nil || IsNil(o.Protected) { + var ret *bool + return ret + } + return o.Protected +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetProtectedOk() (*bool, bool) { + if o == nil || IsNil(o.Protected) { + return nil, false + } + return o.Protected, true +} + +// HasProtected returns a boolean if a field has been set. +func (o *Image) HasProtected() bool { + if o != nil && !IsNil(o.Protected) { + return true + } + + return false +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *Image) SetProtected(v *bool) { + o.Protected = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Image) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Image) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Image) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Image) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Image) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Image) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o Image) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + toSerialize["diskFormat"] = o.DiskFormat + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.MinDiskSize) { + toSerialize["minDiskSize"] = o.MinDiskSize + } + if !IsNil(o.MinRam) { + toSerialize["minRam"] = o.MinRam + } + toSerialize["name"] = o.Name + if !IsNil(o.Protected) { + toSerialize["protected"] = o.Protected + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableImage struct { + value *Image + isSet bool +} + +func (v NullableImage) Get() *Image { + return v.value +} + +func (v *NullableImage) Set(val *Image) { + v.value = val + v.isSet = true +} + +func (v NullableImage) IsSet() bool { + return v.isSet +} + +func (v *NullableImage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImage(val *Image) *NullableImage { + return &NullableImage{value: val, isSet: true} +} + +func (v NullableImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_image_config.go b/services/iaasalpha/model_image_config.go new file mode 100644 index 000000000..4ab9cee04 --- /dev/null +++ b/services/iaasalpha/model_image_config.go @@ -0,0 +1,665 @@ +/* +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 ImageConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageConfig{} + +// ImageConfig Properties to set hardware and scheduling settings for an Image. +type ImageConfig struct { + // Enables the BIOS bootmenu. + BootMenu *bool `json:"bootMenu,omitempty"` + // Sets CDROM bus controller type. + CdromBus *NullableString `json:"cdromBus,omitempty"` + // Sets Disk bus controller type. + DiskBus *NullableString `json:"diskBus,omitempty"` + // Sets virtual nic model. + NicModel *NullableString `json:"nicModel,omitempty"` + // Enables OS specific optimizations. + OperatingSystem *string `json:"operatingSystem,omitempty"` + // Operating System Distribution. + OperatingSystemDistro *NullableString `json:"operatingSystemDistro,omitempty"` + // Version of the OS. + OperatingSystemVersion *NullableString `json:"operatingSystemVersion,omitempty"` + // Sets the device bus when the image is used as a rescue image. + RescueBus *NullableString `json:"rescueBus,omitempty"` + // Sets the device when the image is used as a rescue image. + RescueDevice *NullableString `json:"rescueDevice,omitempty"` + // Enables Secure Boot. + SecureBoot *bool `json:"secureBoot,omitempty"` + // Enables UEFI boot. + Uefi *bool `json:"uefi,omitempty"` + // Sets Graphic device model. + VideoModel *NullableString `json:"videoModel,omitempty"` + // Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block. + VirtioScsi *bool `json:"virtioScsi,omitempty"` +} + +// NewImageConfig instantiates a new ImageConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageConfig() *ImageConfig { + this := ImageConfig{} + var bootMenu bool = false + this.BootMenu = &bootMenu + var secureBoot bool = false + this.SecureBoot = &secureBoot + var uefi bool = false + this.Uefi = &uefi + var virtioScsi bool = false + this.VirtioScsi = &virtioScsi + return &this +} + +// NewImageConfigWithDefaults instantiates a new ImageConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageConfigWithDefaults() *ImageConfig { + this := ImageConfig{} + var bootMenu bool = false + this.BootMenu = &bootMenu + var secureBoot bool = false + this.SecureBoot = &secureBoot + var uefi bool = false + this.Uefi = &uefi + var virtioScsi bool = false + this.VirtioScsi = &virtioScsi + return &this +} + +// GetBootMenu returns the BootMenu field value if set, zero value otherwise. +func (o *ImageConfig) GetBootMenu() *bool { + if o == nil || IsNil(o.BootMenu) { + var ret *bool + return ret + } + return o.BootMenu +} + +// GetBootMenuOk returns a tuple with the BootMenu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetBootMenuOk() (*bool, bool) { + if o == nil || IsNil(o.BootMenu) { + return nil, false + } + return o.BootMenu, true +} + +// HasBootMenu returns a boolean if a field has been set. +func (o *ImageConfig) HasBootMenu() bool { + if o != nil && !IsNil(o.BootMenu) { + return true + } + + return false +} + +// SetBootMenu gets a reference to the given bool and assigns it to the BootMenu field. +func (o *ImageConfig) SetBootMenu(v *bool) { + o.BootMenu = v +} + +// GetCdromBus returns the CdromBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetCdromBus() *string { + if o == nil || IsNil(o.CdromBus.Get()) { + var ret *string + return ret + } + return o.CdromBus.Get() +} + +// GetCdromBusOk returns a tuple with the CdromBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetCdromBusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.CdromBus.Get(), o.CdromBus.IsSet() +} + +// HasCdromBus returns a boolean if a field has been set. +func (o *ImageConfig) HasCdromBus() bool { + if o != nil && o.CdromBus.IsSet() { + return true + } + + return false +} + +// SetCdromBus gets a reference to the given string and assigns it to the CdromBus field. +func (o *ImageConfig) SetCdromBus(v *string) { + o.CdromBus.Set(v) +} + +// SetCdromBusNil sets the value for CdromBus to be an explicit nil +func (o *ImageConfig) SetCdromBusNil() { + o.CdromBus.Set(nil) +} + +// UnsetCdromBus ensures that no value is present for CdromBus, not even an explicit nil +func (o *ImageConfig) UnsetCdromBus() { + 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()) { + var ret *string + return ret + } + return o.DiskBus.Get() +} + +// GetDiskBusOk returns a tuple with the DiskBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetDiskBusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DiskBus.Get(), o.DiskBus.IsSet() +} + +// HasDiskBus returns a boolean if a field has been set. +func (o *ImageConfig) HasDiskBus() bool { + if o != nil && o.DiskBus.IsSet() { + return true + } + + return false +} + +// SetDiskBus gets a reference to the given string and assigns it to the DiskBus field. +func (o *ImageConfig) SetDiskBus(v *string) { + o.DiskBus.Set(v) +} + +// SetDiskBusNil sets the value for DiskBus to be an explicit nil +func (o *ImageConfig) SetDiskBusNil() { + o.DiskBus.Set(nil) +} + +// UnsetDiskBus ensures that no value is present for DiskBus, not even an explicit nil +func (o *ImageConfig) UnsetDiskBus() { + 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()) { + var ret *string + return ret + } + return o.NicModel.Get() +} + +// GetNicModelOk returns a tuple with the NicModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetNicModelOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NicModel.Get(), o.NicModel.IsSet() +} + +// HasNicModel returns a boolean if a field has been set. +func (o *ImageConfig) HasNicModel() bool { + if o != nil && o.NicModel.IsSet() { + return true + } + + return false +} + +// SetNicModel gets a reference to the given string and assigns it to the NicModel field. +func (o *ImageConfig) SetNicModel(v *string) { + o.NicModel.Set(v) +} + +// SetNicModelNil sets the value for NicModel to be an explicit nil +func (o *ImageConfig) SetNicModelNil() { + o.NicModel.Set(nil) +} + +// UnsetNicModel ensures that no value is present for NicModel, not even an explicit nil +func (o *ImageConfig) UnsetNicModel() { + o.NicModel.Unset() +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *ImageConfig) GetOperatingSystem() *string { + if o == nil || IsNil(o.OperatingSystem) { + var ret *string + return ret + } + return o.OperatingSystem +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetOperatingSystemOk() (*string, bool) { + if o == nil || IsNil(o.OperatingSystem) { + return nil, false + } + return o.OperatingSystem, true +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystem() bool { + if o != nil && !IsNil(o.OperatingSystem) { + return true + } + + return false +} + +// SetOperatingSystem gets a reference to the given string and assigns it to the OperatingSystem field. +func (o *ImageConfig) SetOperatingSystem(v *string) { + o.OperatingSystem = v +} + +// GetOperatingSystemDistro returns the OperatingSystemDistro field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemDistro() *string { + if o == nil || IsNil(o.OperatingSystemDistro.Get()) { + var ret *string + return ret + } + return o.OperatingSystemDistro.Get() +} + +// GetOperatingSystemDistroOk returns a tuple with the OperatingSystemDistro field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemDistroOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OperatingSystemDistro.Get(), o.OperatingSystemDistro.IsSet() +} + +// HasOperatingSystemDistro returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemDistro() bool { + if o != nil && o.OperatingSystemDistro.IsSet() { + return true + } + + return false +} + +// SetOperatingSystemDistro gets a reference to the given string and assigns it to the OperatingSystemDistro field. +func (o *ImageConfig) SetOperatingSystemDistro(v *string) { + o.OperatingSystemDistro.Set(v) +} + +// SetOperatingSystemDistroNil sets the value for OperatingSystemDistro to be an explicit nil +func (o *ImageConfig) SetOperatingSystemDistroNil() { + o.OperatingSystemDistro.Set(nil) +} + +// UnsetOperatingSystemDistro ensures that no value is present for OperatingSystemDistro, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemDistro() { + 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()) { + var ret *string + return ret + } + return o.OperatingSystemVersion.Get() +} + +// GetOperatingSystemVersionOk returns a tuple with the OperatingSystemVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OperatingSystemVersion.Get(), o.OperatingSystemVersion.IsSet() +} + +// HasOperatingSystemVersion returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemVersion() bool { + if o != nil && o.OperatingSystemVersion.IsSet() { + return true + } + + return false +} + +// SetOperatingSystemVersion gets a reference to the given string and assigns it to the OperatingSystemVersion field. +func (o *ImageConfig) SetOperatingSystemVersion(v *string) { + o.OperatingSystemVersion.Set(v) +} + +// SetOperatingSystemVersionNil sets the value for OperatingSystemVersion to be an explicit nil +func (o *ImageConfig) SetOperatingSystemVersionNil() { + o.OperatingSystemVersion.Set(nil) +} + +// UnsetOperatingSystemVersion ensures that no value is present for OperatingSystemVersion, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemVersion() { + 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()) { + var ret *string + return ret + } + return o.RescueBus.Get() +} + +// GetRescueBusOk returns a tuple with the RescueBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueBusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RescueBus.Get(), o.RescueBus.IsSet() +} + +// HasRescueBus returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueBus() bool { + if o != nil && o.RescueBus.IsSet() { + return true + } + + return false +} + +// SetRescueBus gets a reference to the given string and assigns it to the RescueBus field. +func (o *ImageConfig) SetRescueBus(v *string) { + o.RescueBus.Set(v) +} + +// SetRescueBusNil sets the value for RescueBus to be an explicit nil +func (o *ImageConfig) SetRescueBusNil() { + o.RescueBus.Set(nil) +} + +// UnsetRescueBus ensures that no value is present for RescueBus, not even an explicit nil +func (o *ImageConfig) UnsetRescueBus() { + 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()) { + var ret *string + return ret + } + return o.RescueDevice.Get() +} + +// GetRescueDeviceOk returns a tuple with the RescueDevice field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueDeviceOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RescueDevice.Get(), o.RescueDevice.IsSet() +} + +// HasRescueDevice returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueDevice() bool { + if o != nil && o.RescueDevice.IsSet() { + return true + } + + return false +} + +// SetRescueDevice gets a reference to the given string and assigns it to the RescueDevice field. +func (o *ImageConfig) SetRescueDevice(v *string) { + o.RescueDevice.Set(v) +} + +// SetRescueDeviceNil sets the value for RescueDevice to be an explicit nil +func (o *ImageConfig) SetRescueDeviceNil() { + o.RescueDevice.Set(nil) +} + +// UnsetRescueDevice ensures that no value is present for RescueDevice, not even an explicit nil +func (o *ImageConfig) UnsetRescueDevice() { + o.RescueDevice.Unset() +} + +// GetSecureBoot returns the SecureBoot field value if set, zero value otherwise. +func (o *ImageConfig) GetSecureBoot() *bool { + if o == nil || IsNil(o.SecureBoot) { + var ret *bool + return ret + } + return o.SecureBoot +} + +// GetSecureBootOk returns a tuple with the SecureBoot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetSecureBootOk() (*bool, bool) { + if o == nil || IsNil(o.SecureBoot) { + return nil, false + } + return o.SecureBoot, true +} + +// HasSecureBoot returns a boolean if a field has been set. +func (o *ImageConfig) HasSecureBoot() bool { + if o != nil && !IsNil(o.SecureBoot) { + return true + } + + return false +} + +// SetSecureBoot gets a reference to the given bool and assigns it to the SecureBoot field. +func (o *ImageConfig) SetSecureBoot(v *bool) { + o.SecureBoot = v +} + +// GetUefi returns the Uefi field value if set, zero value otherwise. +func (o *ImageConfig) GetUefi() *bool { + if o == nil || IsNil(o.Uefi) { + var ret *bool + return ret + } + return o.Uefi +} + +// GetUefiOk returns a tuple with the Uefi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetUefiOk() (*bool, bool) { + if o == nil || IsNil(o.Uefi) { + return nil, false + } + return o.Uefi, true +} + +// HasUefi returns a boolean if a field has been set. +func (o *ImageConfig) HasUefi() bool { + if o != nil && !IsNil(o.Uefi) { + return true + } + + return false +} + +// SetUefi gets a reference to the given bool and assigns it to the Uefi field. +func (o *ImageConfig) SetUefi(v *bool) { + o.Uefi = v +} + +// GetVideoModel returns the VideoModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetVideoModel() *string { + if o == nil || IsNil(o.VideoModel.Get()) { + var ret *string + return ret + } + return o.VideoModel.Get() +} + +// GetVideoModelOk returns a tuple with the VideoModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetVideoModelOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VideoModel.Get(), o.VideoModel.IsSet() +} + +// HasVideoModel returns a boolean if a field has been set. +func (o *ImageConfig) HasVideoModel() bool { + if o != nil && o.VideoModel.IsSet() { + return true + } + + return false +} + +// SetVideoModel gets a reference to the given string and assigns it to the VideoModel field. +func (o *ImageConfig) SetVideoModel(v *string) { + o.VideoModel.Set(v) +} + +// SetVideoModelNil sets the value for VideoModel to be an explicit nil +func (o *ImageConfig) SetVideoModelNil() { + o.VideoModel.Set(nil) +} + +// UnsetVideoModel ensures that no value is present for VideoModel, not even an explicit nil +func (o *ImageConfig) UnsetVideoModel() { + o.VideoModel.Unset() +} + +// GetVirtioScsi returns the VirtioScsi field value if set, zero value otherwise. +func (o *ImageConfig) GetVirtioScsi() *bool { + if o == nil || IsNil(o.VirtioScsi) { + var ret *bool + return ret + } + return o.VirtioScsi +} + +// GetVirtioScsiOk returns a tuple with the VirtioScsi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetVirtioScsiOk() (*bool, bool) { + if o == nil || IsNil(o.VirtioScsi) { + return nil, false + } + return o.VirtioScsi, true +} + +// HasVirtioScsi returns a boolean if a field has been set. +func (o *ImageConfig) HasVirtioScsi() bool { + if o != nil && !IsNil(o.VirtioScsi) { + return true + } + + return false +} + +// SetVirtioScsi gets a reference to the given bool and assigns it to the VirtioScsi field. +func (o *ImageConfig) SetVirtioScsi(v *bool) { + o.VirtioScsi = v +} + +func (o ImageConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BootMenu) { + toSerialize["bootMenu"] = o.BootMenu + } + if o.CdromBus.IsSet() { + toSerialize["cdromBus"] = o.CdromBus.Get() + } + if o.DiskBus.IsSet() { + toSerialize["diskBus"] = o.DiskBus.Get() + } + if o.NicModel.IsSet() { + toSerialize["nicModel"] = o.NicModel.Get() + } + if !IsNil(o.OperatingSystem) { + toSerialize["operatingSystem"] = o.OperatingSystem + } + if o.OperatingSystemDistro.IsSet() { + toSerialize["operatingSystemDistro"] = o.OperatingSystemDistro.Get() + } + if o.OperatingSystemVersion.IsSet() { + toSerialize["operatingSystemVersion"] = o.OperatingSystemVersion.Get() + } + if o.RescueBus.IsSet() { + toSerialize["rescueBus"] = o.RescueBus.Get() + } + if o.RescueDevice.IsSet() { + toSerialize["rescueDevice"] = o.RescueDevice.Get() + } + if !IsNil(o.SecureBoot) { + toSerialize["secureBoot"] = o.SecureBoot + } + if !IsNil(o.Uefi) { + toSerialize["uefi"] = o.Uefi + } + if o.VideoModel.IsSet() { + toSerialize["videoModel"] = o.VideoModel.Get() + } + if !IsNil(o.VirtioScsi) { + toSerialize["virtioScsi"] = o.VirtioScsi + } + return toSerialize, nil +} + +type NullableImageConfig struct { + value *ImageConfig + isSet bool +} + +func (v NullableImageConfig) Get() *ImageConfig { + return v.value +} + +func (v *NullableImageConfig) Set(val *ImageConfig) { + v.value = val + v.isSet = true +} + +func (v NullableImageConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableImageConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageConfig(val *ImageConfig) *NullableImageConfig { + return &NullableImageConfig{value: val, isSet: true} +} + +func (v NullableImageConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_image_create_response.go b/services/iaasalpha/model_image_create_response.go new file mode 100644 index 000000000..a010764b8 --- /dev/null +++ b/services/iaasalpha/model_image_create_response.go @@ -0,0 +1,139 @@ +/* +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 ImageCreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageCreateResponse{} + +// ImageCreateResponse Image creation response. +type ImageCreateResponse struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id *string `json:"id"` + // REQUIRED + UploadUrl *string `json:"uploadUrl"` +} + +type _ImageCreateResponse ImageCreateResponse + +// NewImageCreateResponse instantiates a new ImageCreateResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageCreateResponse(id *string, uploadUrl *string) *ImageCreateResponse { + this := ImageCreateResponse{} + this.Id = id + this.UploadUrl = uploadUrl + return &this +} + +// NewImageCreateResponseWithDefaults instantiates a new ImageCreateResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageCreateResponseWithDefaults() *ImageCreateResponse { + this := ImageCreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *ImageCreateResponse) GetId() *string { + if o == nil { + var ret *string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *ImageCreateResponse) SetId(v *string) { + o.Id = v +} + +// GetUploadUrl returns the UploadUrl field value +func (o *ImageCreateResponse) GetUploadUrl() *string { + if o == nil { + var ret *string + return ret + } + + return o.UploadUrl +} + +// GetUploadUrlOk returns a tuple with the UploadUrl field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetUploadUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.UploadUrl, true +} + +// SetUploadUrl sets field value +func (o *ImageCreateResponse) SetUploadUrl(v *string) { + o.UploadUrl = v +} + +func (o ImageCreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["uploadUrl"] = o.UploadUrl + return toSerialize, nil +} + +type NullableImageCreateResponse struct { + value *ImageCreateResponse + isSet bool +} + +func (v NullableImageCreateResponse) Get() *ImageCreateResponse { + return v.value +} + +func (v *NullableImageCreateResponse) Set(val *ImageCreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageCreateResponse(val *ImageCreateResponse) *NullableImageCreateResponse { + return &NullableImageCreateResponse{value: val, isSet: true} +} + +func (v NullableImageCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_image_list_response.go b/services/iaasalpha/model_image_list_response.go new file mode 100644 index 000000000..ebcf12485 --- /dev/null +++ b/services/iaasalpha/model_image_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 ImageListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageListResponse{} + +// ImageListResponse Image list response. +type ImageListResponse struct { + // A list containing image objects. + // REQUIRED + Items *[]Image `json:"items"` +} + +type _ImageListResponse ImageListResponse + +// NewImageListResponse instantiates a new ImageListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageListResponse(items *[]Image) *ImageListResponse { + this := ImageListResponse{} + this.Items = items + return &this +} + +// NewImageListResponseWithDefaults instantiates a new ImageListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageListResponseWithDefaults() *ImageListResponse { + this := ImageListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ImageListResponse) GetItems() *[]Image { + if o == nil { + var ret *[]Image + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ImageListResponse) GetItemsOk() (*[]Image, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ImageListResponse) SetItems(v *[]Image) { + o.Items = v +} + +func (o ImageListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableImageListResponse struct { + value *ImageListResponse + isSet bool +} + +func (v NullableImageListResponse) Get() *ImageListResponse { + return v.value +} + +func (v *NullableImageListResponse) Set(val *ImageListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageListResponse(val *ImageListResponse) *NullableImageListResponse { + return &NullableImageListResponse{value: val, isSet: true} +} + +func (v NullableImageListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_keypair.go b/services/iaasalpha/model_keypair.go index fa841a67e..3dfa2264a 100644 --- a/services/iaasalpha/model_keypair.go +++ b/services/iaasalpha/model_keypair.go @@ -12,6 +12,7 @@ package iaasalpha import ( "encoding/json" + "time" ) // checks if the Keypair type satisfies the MappedNullable interface at compile time @@ -19,6 +20,8 @@ var _ MappedNullable = &Keypair{} // Keypair Object that represents the public key of an SSH keypair and its name. type Keypair struct { + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` // Object that represents an SSH keypair MD5 fingerprint. Fingerprint *string `json:"fingerprint,omitempty"` // Object that represents the labels of an object. @@ -28,6 +31,8 @@ type Keypair struct { // Object that represents a public SSH key. // REQUIRED PublicKey *string `json:"publicKey"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } type _Keypair Keypair @@ -50,6 +55,38 @@ func NewKeypairWithDefaults() *Keypair { return &this } +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Keypair) 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 *Keypair) 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 *Keypair) 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 *Keypair) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + // GetFingerprint returns the Fingerprint field value if set, zero value otherwise. func (o *Keypair) GetFingerprint() *string { if o == nil || IsNil(o.Fingerprint) { @@ -170,8 +207,43 @@ func (o *Keypair) SetPublicKey(v *string) { o.PublicKey = v } +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Keypair) 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 *Keypair) 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 *Keypair) 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 *Keypair) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + func (o Keypair) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } if !IsNil(o.Fingerprint) { toSerialize["fingerprint"] = o.Fingerprint } @@ -182,6 +254,9 @@ func (o Keypair) ToMap() (map[string]interface{}, error) { toSerialize["name"] = o.Name } toSerialize["publicKey"] = o.PublicKey + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } return toSerialize, nil } diff --git a/services/iaasalpha/model_machine_type.go b/services/iaasalpha/model_machine_type.go new file mode 100644 index 000000000..96084b648 --- /dev/null +++ b/services/iaasalpha/model_machine_type.go @@ -0,0 +1,272 @@ +/* +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 MachineType type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineType{} + +// MachineType Machine Type. +type MachineType struct { + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Size in Gigabyte. + // REQUIRED + Disk *int64 `json:"disk"` + // Properties to control certain aspects or scheduling behavior for an object. + ExtraSpecs *map[string]interface{} `json:"extraSpecs,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // Size in Megabyte. + // REQUIRED + Ram *int64 `json:"ram"` + // The number of virtual CPUs of a server. + // REQUIRED + Vcpus *int64 `json:"vcpus"` +} + +type _MachineType MachineType + +// NewMachineType instantiates a new MachineType 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 NewMachineType(disk *int64, name *string, ram *int64, vcpus *int64) *MachineType { + this := MachineType{} + this.Disk = disk + this.Name = name + this.Ram = ram + this.Vcpus = vcpus + return &this +} + +// NewMachineTypeWithDefaults instantiates a new MachineType 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 NewMachineTypeWithDefaults() *MachineType { + this := MachineType{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *MachineType) GetDescription() *string { + if o == nil || IsNil(o.Description) { + var ret *string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MachineType) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *MachineType) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *MachineType) SetDescription(v *string) { + o.Description = v +} + +// GetDisk returns the Disk field value +func (o *MachineType) GetDisk() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Disk +} + +// GetDiskOk returns a tuple with the Disk field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetDiskOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Disk, true +} + +// SetDisk sets field value +func (o *MachineType) SetDisk(v *int64) { + o.Disk = v +} + +// GetExtraSpecs returns the ExtraSpecs field value if set, zero value otherwise. +func (o *MachineType) GetExtraSpecs() *map[string]interface{} { + if o == nil || IsNil(o.ExtraSpecs) { + var ret *map[string]interface{} + return ret + } + return o.ExtraSpecs +} + +// GetExtraSpecsOk returns a tuple with the ExtraSpecs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MachineType) GetExtraSpecsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.ExtraSpecs) { + return &map[string]interface{}{}, false + } + return o.ExtraSpecs, true +} + +// HasExtraSpecs returns a boolean if a field has been set. +func (o *MachineType) HasExtraSpecs() bool { + if o != nil && !IsNil(o.ExtraSpecs) { + return true + } + + return false +} + +// SetExtraSpecs gets a reference to the given map[string]interface{} and assigns it to the ExtraSpecs field. +func (o *MachineType) SetExtraSpecs(v *map[string]interface{}) { + o.ExtraSpecs = v +} + +// GetName returns the Name field value +func (o *MachineType) GetName() *string { + if o == nil { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *MachineType) SetName(v *string) { + o.Name = v +} + +// GetRam returns the Ram field value +func (o *MachineType) GetRam() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Ram +} + +// GetRamOk returns a tuple with the Ram field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetRamOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Ram, true +} + +// SetRam sets field value +func (o *MachineType) SetRam(v *int64) { + o.Ram = v +} + +// GetVcpus returns the Vcpus field value +func (o *MachineType) GetVcpus() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Vcpus +} + +// GetVcpusOk returns a tuple with the Vcpus field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetVcpusOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Vcpus, true +} + +// SetVcpus sets field value +func (o *MachineType) SetVcpus(v *int64) { + o.Vcpus = v +} + +func (o MachineType) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["disk"] = o.Disk + if !IsNil(o.ExtraSpecs) { + toSerialize["extraSpecs"] = o.ExtraSpecs + } + toSerialize["name"] = o.Name + toSerialize["ram"] = o.Ram + toSerialize["vcpus"] = o.Vcpus + return toSerialize, nil +} + +type NullableMachineType struct { + value *MachineType + isSet bool +} + +func (v NullableMachineType) Get() *MachineType { + return v.value +} + +func (v *NullableMachineType) Set(val *MachineType) { + v.value = val + v.isSet = true +} + +func (v NullableMachineType) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineType(val *MachineType) *NullableMachineType { + return &NullableMachineType{value: val, isSet: true} +} + +func (v NullableMachineType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_machine_type_list_response.go b/services/iaasalpha/model_machine_type_list_response.go new file mode 100644 index 000000000..2801cb90d --- /dev/null +++ b/services/iaasalpha/model_machine_type_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 MachineTypeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineTypeListResponse{} + +// MachineTypeListResponse Machine type list response. +type MachineTypeListResponse struct { + // Machine type list. + // REQUIRED + Items *[]MachineType `json:"items"` +} + +type _MachineTypeListResponse MachineTypeListResponse + +// NewMachineTypeListResponse instantiates a new MachineTypeListResponse 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 NewMachineTypeListResponse(items *[]MachineType) *MachineTypeListResponse { + this := MachineTypeListResponse{} + this.Items = items + return &this +} + +// NewMachineTypeListResponseWithDefaults instantiates a new MachineTypeListResponse 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 NewMachineTypeListResponseWithDefaults() *MachineTypeListResponse { + this := MachineTypeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *MachineTypeListResponse) GetItems() *[]MachineType { + if o == nil { + var ret *[]MachineType + 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 *MachineTypeListResponse) GetItemsOk() (*[]MachineType, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *MachineTypeListResponse) SetItems(v *[]MachineType) { + o.Items = v +} + +func (o MachineTypeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableMachineTypeListResponse struct { + value *MachineTypeListResponse + isSet bool +} + +func (v NullableMachineTypeListResponse) Get() *MachineTypeListResponse { + return v.value +} + +func (v *NullableMachineTypeListResponse) Set(val *MachineTypeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMachineTypeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineTypeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineTypeListResponse(val *MachineTypeListResponse) *NullableMachineTypeListResponse { + return &NullableMachineTypeListResponse{value: val, isSet: true} +} + +func (v NullableMachineTypeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineTypeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_port_range.go b/services/iaasalpha/model_port_range.go index 5916f9f2e..314427a6e 100644 --- a/services/iaasalpha/model_port_range.go +++ b/services/iaasalpha/model_port_range.go @@ -22,7 +22,7 @@ type PortRange struct { // The maximum port number. Should be greater or equal to the minimum. // REQUIRED Max *int64 `json:"max"` - // The minimum port number. Should be less or equal to the minimum. + // The minimum port number. Should be less or equal to the maximum. // REQUIRED Min *int64 `json:"min"` } diff --git a/services/iaasalpha/model_remove_member_from_virtual_ip_payload.go b/services/iaasalpha/model_remove_member_from_virtual_ip_payload.go new file mode 100644 index 000000000..4d5282541 --- /dev/null +++ b/services/iaasalpha/model_remove_member_from_virtual_ip_payload.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 RemoveMemberFromVirtualIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RemoveMemberFromVirtualIPPayload{} + +// RemoveMemberFromVirtualIPPayload Object that represents a virtual IP member. +type RemoveMemberFromVirtualIPPayload struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Member *string `json:"member"` +} + +type _RemoveMemberFromVirtualIPPayload RemoveMemberFromVirtualIPPayload + +// NewRemoveMemberFromVirtualIPPayload instantiates a new RemoveMemberFromVirtualIPPayload 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 NewRemoveMemberFromVirtualIPPayload(member *string) *RemoveMemberFromVirtualIPPayload { + this := RemoveMemberFromVirtualIPPayload{} + this.Member = member + return &this +} + +// NewRemoveMemberFromVirtualIPPayloadWithDefaults instantiates a new RemoveMemberFromVirtualIPPayload 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 NewRemoveMemberFromVirtualIPPayloadWithDefaults() *RemoveMemberFromVirtualIPPayload { + this := RemoveMemberFromVirtualIPPayload{} + return &this +} + +// GetMember returns the Member field value +func (o *RemoveMemberFromVirtualIPPayload) GetMember() *string { + if o == nil { + var ret *string + return ret + } + + return o.Member +} + +// GetMemberOk returns a tuple with the Member field value +// and a boolean to check if the value has been set. +func (o *RemoveMemberFromVirtualIPPayload) GetMemberOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Member, true +} + +// SetMember sets field value +func (o *RemoveMemberFromVirtualIPPayload) SetMember(v *string) { + o.Member = v +} + +func (o RemoveMemberFromVirtualIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["member"] = o.Member + return toSerialize, nil +} + +type NullableRemoveMemberFromVirtualIPPayload struct { + value *RemoveMemberFromVirtualIPPayload + isSet bool +} + +func (v NullableRemoveMemberFromVirtualIPPayload) Get() *RemoveMemberFromVirtualIPPayload { + return v.value +} + +func (v *NullableRemoveMemberFromVirtualIPPayload) Set(val *RemoveMemberFromVirtualIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRemoveMemberFromVirtualIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRemoveMemberFromVirtualIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRemoveMemberFromVirtualIPPayload(val *RemoveMemberFromVirtualIPPayload) *NullableRemoveMemberFromVirtualIPPayload { + return &NullableRemoveMemberFromVirtualIPPayload{value: val, isSet: true} +} + +func (v NullableRemoveMemberFromVirtualIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRemoveMemberFromVirtualIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_update_image_payload.go b/services/iaasalpha/model_update_image_payload.go new file mode 100644 index 000000000..9f82ca103 --- /dev/null +++ b/services/iaasalpha/model_update_image_payload.go @@ -0,0 +1,337 @@ +/* +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 UpdateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImagePayload{} + +// UpdateImagePayload Object that represents an update request body of an Image. +type UpdateImagePayload struct { + Config *ImageConfig `json:"config,omitempty"` + // Object that represents a disk format. + DiskFormat *string `json:"diskFormat,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize *int64 `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam *int64 `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + Protected *bool `json:"protected,omitempty"` +} + +// NewUpdateImagePayload instantiates a new UpdateImagePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateImagePayload() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// NewUpdateImagePayloadWithDefaults instantiates a new UpdateImagePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateImagePayloadWithDefaults() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetConfig() *ImageConfig { + if o == nil || IsNil(o.Config) { + var ret *ImageConfig + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetConfigOk() (*ImageConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *UpdateImagePayload) SetConfig(v *ImageConfig) { + o.Config = v +} + +// GetDiskFormat returns the DiskFormat field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetDiskFormat() *string { + if o == nil || IsNil(o.DiskFormat) { + var ret *string + return ret + } + return o.DiskFormat +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetDiskFormatOk() (*string, bool) { + if o == nil || IsNil(o.DiskFormat) { + return nil, false + } + return o.DiskFormat, true +} + +// HasDiskFormat returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasDiskFormat() bool { + if o != nil && !IsNil(o.DiskFormat) { + return true + } + + return false +} + +// SetDiskFormat gets a reference to the given string and assigns it to the DiskFormat field. +func (o *UpdateImagePayload) SetDiskFormat(v *string) { + o.DiskFormat = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateImagePayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinDiskSize() *int64 { + if o == nil || IsNil(o.MinDiskSize) { + var ret *int64 + return ret + } + return o.MinDiskSize +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinDiskSizeOk() (*int64, bool) { + if o == nil || IsNil(o.MinDiskSize) { + return nil, false + } + return o.MinDiskSize, true +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinDiskSize() bool { + if o != nil && !IsNil(o.MinDiskSize) { + return true + } + + return false +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *UpdateImagePayload) SetMinDiskSize(v *int64) { + o.MinDiskSize = v +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinRam() *int64 { + if o == nil || IsNil(o.MinRam) { + var ret *int64 + return ret + } + return o.MinRam +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinRamOk() (*int64, bool) { + if o == nil || IsNil(o.MinRam) { + return nil, false + } + return o.MinRam, true +} + +// HasMinRam returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinRam() bool { + if o != nil && !IsNil(o.MinRam) { + return true + } + + return false +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *UpdateImagePayload) SetMinRam(v *int64) { + o.MinRam = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateImagePayload) SetName(v *string) { + o.Name = v +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetProtected() *bool { + if o == nil || IsNil(o.Protected) { + var ret *bool + return ret + } + return o.Protected +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetProtectedOk() (*bool, bool) { + if o == nil || IsNil(o.Protected) { + return nil, false + } + return o.Protected, true +} + +// HasProtected returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasProtected() bool { + if o != nil && !IsNil(o.Protected) { + return true + } + + return false +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *UpdateImagePayload) SetProtected(v *bool) { + o.Protected = v +} + +func (o UpdateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.DiskFormat) { + toSerialize["diskFormat"] = o.DiskFormat + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.MinDiskSize) { + toSerialize["minDiskSize"] = o.MinDiskSize + } + if !IsNil(o.MinRam) { + toSerialize["minRam"] = o.MinRam + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Protected) { + toSerialize["protected"] = o.Protected + } + return toSerialize, nil +} + +type NullableUpdateImagePayload struct { + value *UpdateImagePayload + isSet bool +} + +func (v NullableUpdateImagePayload) Get() *UpdateImagePayload { + return v.value +} + +func (v *NullableUpdateImagePayload) Set(val *UpdateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImagePayload(val *UpdateImagePayload) *NullableUpdateImagePayload { + return &NullableUpdateImagePayload{value: val, isSet: true} +} + +func (v NullableUpdateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_update_nic_payload.go b/services/iaasalpha/model_update_nic_payload.go index d0290e825..978e429e9 100644 --- a/services/iaasalpha/model_update_nic_payload.go +++ b/services/iaasalpha/model_update_nic_payload.go @@ -14,11 +14,11 @@ import ( "encoding/json" ) -// checks if the UpdateNICPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &UpdateNICPayload{} +// checks if the UpdateNicPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNicPayload{} -// UpdateNICPayload Object that represents a network interface update. -type UpdateNICPayload struct { +// UpdateNicPayload Object that represents a network interface update. +type UpdateNicPayload struct { // A list of IPs or CIDR notations. AllowedAddresses *[]AllowedAddressesInner `json:"allowedAddresses,omitempty"` // Object that represents the labels of an object. @@ -31,25 +31,25 @@ type UpdateNICPayload struct { SecurityGroups *[]string `json:"securityGroups,omitempty"` } -// NewUpdateNICPayload instantiates a new UpdateNICPayload object +// NewUpdateNicPayload instantiates a new UpdateNicPayload 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 NewUpdateNICPayload() *UpdateNICPayload { - this := UpdateNICPayload{} +func NewUpdateNicPayload() *UpdateNicPayload { + this := UpdateNicPayload{} return &this } -// NewUpdateNICPayloadWithDefaults instantiates a new UpdateNICPayload object +// NewUpdateNicPayloadWithDefaults instantiates a new UpdateNicPayload 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 NewUpdateNICPayloadWithDefaults() *UpdateNICPayload { - this := UpdateNICPayload{} +func NewUpdateNicPayloadWithDefaults() *UpdateNicPayload { + this := UpdateNicPayload{} return &this } // GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. -func (o *UpdateNICPayload) GetAllowedAddresses() *[]AllowedAddressesInner { +func (o *UpdateNicPayload) GetAllowedAddresses() *[]AllowedAddressesInner { if o == nil || IsNil(o.AllowedAddresses) { var ret *[]AllowedAddressesInner return ret @@ -59,7 +59,7 @@ func (o *UpdateNICPayload) GetAllowedAddresses() *[]AllowedAddressesInner { // GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateNICPayload) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bool) { +func (o *UpdateNicPayload) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bool) { if o == nil || IsNil(o.AllowedAddresses) { return nil, false } @@ -67,7 +67,7 @@ func (o *UpdateNICPayload) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bo } // HasAllowedAddresses returns a boolean if a field has been set. -func (o *UpdateNICPayload) HasAllowedAddresses() bool { +func (o *UpdateNicPayload) HasAllowedAddresses() bool { if o != nil && !IsNil(o.AllowedAddresses) { return true } @@ -76,12 +76,12 @@ func (o *UpdateNICPayload) HasAllowedAddresses() bool { } // SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. -func (o *UpdateNICPayload) SetAllowedAddresses(v *[]AllowedAddressesInner) { +func (o *UpdateNicPayload) SetAllowedAddresses(v *[]AllowedAddressesInner) { o.AllowedAddresses = v } // GetLabels returns the Labels field value if set, zero value otherwise. -func (o *UpdateNICPayload) GetLabels() *map[string]interface{} { +func (o *UpdateNicPayload) GetLabels() *map[string]interface{} { if o == nil || IsNil(o.Labels) { var ret *map[string]interface{} return ret @@ -91,7 +91,7 @@ func (o *UpdateNICPayload) GetLabels() *map[string]interface{} { // GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateNICPayload) GetLabelsOk() (*map[string]interface{}, bool) { +func (o *UpdateNicPayload) GetLabelsOk() (*map[string]interface{}, bool) { if o == nil || IsNil(o.Labels) { return &map[string]interface{}{}, false } @@ -99,7 +99,7 @@ func (o *UpdateNICPayload) GetLabelsOk() (*map[string]interface{}, bool) { } // HasLabels returns a boolean if a field has been set. -func (o *UpdateNICPayload) HasLabels() bool { +func (o *UpdateNicPayload) HasLabels() bool { if o != nil && !IsNil(o.Labels) { return true } @@ -108,12 +108,12 @@ func (o *UpdateNICPayload) HasLabels() bool { } // SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. -func (o *UpdateNICPayload) SetLabels(v *map[string]interface{}) { +func (o *UpdateNicPayload) SetLabels(v *map[string]interface{}) { o.Labels = v } // GetName returns the Name field value if set, zero value otherwise. -func (o *UpdateNICPayload) GetName() *string { +func (o *UpdateNicPayload) GetName() *string { if o == nil || IsNil(o.Name) { var ret *string return ret @@ -123,7 +123,7 @@ func (o *UpdateNICPayload) GetName() *string { // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateNICPayload) GetNameOk() (*string, bool) { +func (o *UpdateNicPayload) GetNameOk() (*string, bool) { if o == nil || IsNil(o.Name) { return nil, false } @@ -131,7 +131,7 @@ func (o *UpdateNICPayload) GetNameOk() (*string, bool) { } // HasName returns a boolean if a field has been set. -func (o *UpdateNICPayload) HasName() bool { +func (o *UpdateNicPayload) HasName() bool { if o != nil && !IsNil(o.Name) { return true } @@ -140,12 +140,12 @@ func (o *UpdateNICPayload) HasName() bool { } // SetName gets a reference to the given string and assigns it to the Name field. -func (o *UpdateNICPayload) SetName(v *string) { +func (o *UpdateNicPayload) SetName(v *string) { o.Name = v } // GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. -func (o *UpdateNICPayload) GetNicSecurity() *bool { +func (o *UpdateNicPayload) GetNicSecurity() *bool { if o == nil || IsNil(o.NicSecurity) { var ret *bool return ret @@ -155,7 +155,7 @@ func (o *UpdateNICPayload) GetNicSecurity() *bool { // GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateNICPayload) GetNicSecurityOk() (*bool, bool) { +func (o *UpdateNicPayload) GetNicSecurityOk() (*bool, bool) { if o == nil || IsNil(o.NicSecurity) { return nil, false } @@ -163,7 +163,7 @@ func (o *UpdateNICPayload) GetNicSecurityOk() (*bool, bool) { } // HasNicSecurity returns a boolean if a field has been set. -func (o *UpdateNICPayload) HasNicSecurity() bool { +func (o *UpdateNicPayload) HasNicSecurity() bool { if o != nil && !IsNil(o.NicSecurity) { return true } @@ -172,12 +172,12 @@ func (o *UpdateNICPayload) HasNicSecurity() bool { } // SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. -func (o *UpdateNICPayload) SetNicSecurity(v *bool) { +func (o *UpdateNicPayload) SetNicSecurity(v *bool) { o.NicSecurity = v } // GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. -func (o *UpdateNICPayload) GetSecurityGroups() *[]string { +func (o *UpdateNicPayload) GetSecurityGroups() *[]string { if o == nil || IsNil(o.SecurityGroups) { var ret *[]string return ret @@ -187,7 +187,7 @@ func (o *UpdateNICPayload) GetSecurityGroups() *[]string { // GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateNICPayload) GetSecurityGroupsOk() (*[]string, bool) { +func (o *UpdateNicPayload) GetSecurityGroupsOk() (*[]string, bool) { if o == nil || IsNil(o.SecurityGroups) { return nil, false } @@ -195,7 +195,7 @@ func (o *UpdateNICPayload) GetSecurityGroupsOk() (*[]string, bool) { } // HasSecurityGroups returns a boolean if a field has been set. -func (o *UpdateNICPayload) HasSecurityGroups() bool { +func (o *UpdateNicPayload) HasSecurityGroups() bool { if o != nil && !IsNil(o.SecurityGroups) { return true } @@ -204,11 +204,11 @@ func (o *UpdateNICPayload) HasSecurityGroups() bool { } // SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. -func (o *UpdateNICPayload) SetSecurityGroups(v *[]string) { +func (o *UpdateNicPayload) SetSecurityGroups(v *[]string) { o.SecurityGroups = v } -func (o UpdateNICPayload) ToMap() (map[string]interface{}, error) { +func (o UpdateNicPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !IsNil(o.AllowedAddresses) { toSerialize["allowedAddresses"] = o.AllowedAddresses @@ -228,38 +228,38 @@ func (o UpdateNICPayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -type NullableUpdateNICPayload struct { - value *UpdateNICPayload +type NullableUpdateNicPayload struct { + value *UpdateNicPayload isSet bool } -func (v NullableUpdateNICPayload) Get() *UpdateNICPayload { +func (v NullableUpdateNicPayload) Get() *UpdateNicPayload { return v.value } -func (v *NullableUpdateNICPayload) Set(val *UpdateNICPayload) { +func (v *NullableUpdateNicPayload) Set(val *UpdateNicPayload) { v.value = val v.isSet = true } -func (v NullableUpdateNICPayload) IsSet() bool { +func (v NullableUpdateNicPayload) IsSet() bool { return v.isSet } -func (v *NullableUpdateNICPayload) Unset() { +func (v *NullableUpdateNicPayload) Unset() { v.value = nil v.isSet = false } -func NewNullableUpdateNICPayload(val *UpdateNICPayload) *NullableUpdateNICPayload { - return &NullableUpdateNICPayload{value: val, isSet: true} +func NewNullableUpdateNicPayload(val *UpdateNicPayload) *NullableUpdateNicPayload { + return &NullableUpdateNicPayload{value: val, isSet: true} } -func (v NullableUpdateNICPayload) MarshalJSON() ([]byte, error) { +func (v NullableUpdateNicPayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableUpdateNICPayload) UnmarshalJSON(src []byte) error { +func (v *NullableUpdateNicPayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/services/iaasalpha/model_update_virtual_ip_payload.go b/services/iaasalpha/model_update_virtual_ip_payload.go new file mode 100644 index 000000000..2a1ffb863 --- /dev/null +++ b/services/iaasalpha/model_update_virtual_ip_payload.go @@ -0,0 +1,192 @@ +/* +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 UpdateVirtualIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVirtualIPPayload{} + +// UpdateVirtualIPPayload Object that represents a virtual IP update request body. +type UpdateVirtualIPPayload struct { + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // A list of UUIDs. + Members *[]string `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` +} + +// NewUpdateVirtualIPPayload instantiates a new UpdateVirtualIPPayload 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 NewUpdateVirtualIPPayload() *UpdateVirtualIPPayload { + this := UpdateVirtualIPPayload{} + return &this +} + +// NewUpdateVirtualIPPayloadWithDefaults instantiates a new UpdateVirtualIPPayload 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 NewUpdateVirtualIPPayloadWithDefaults() *UpdateVirtualIPPayload { + this := UpdateVirtualIPPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateVirtualIPPayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVirtualIPPayload) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateVirtualIPPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateVirtualIPPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// 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 { + var ret *[]string + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateVirtualIPPayload) GetMembersOk() (*[]string, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *UpdateVirtualIPPayload) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *UpdateVirtualIPPayload) SetMembers(v *[]string) { + o.Members = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateVirtualIPPayload) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVirtualIPPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateVirtualIPPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateVirtualIPPayload) SetName(v *string) { + o.Name = v +} + +func (o UpdateVirtualIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if o.Members != nil { + toSerialize["members"] = o.Members + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableUpdateVirtualIPPayload struct { + value *UpdateVirtualIPPayload + isSet bool +} + +func (v NullableUpdateVirtualIPPayload) Get() *UpdateVirtualIPPayload { + return v.value +} + +func (v *NullableUpdateVirtualIPPayload) Set(val *UpdateVirtualIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVirtualIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVirtualIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVirtualIPPayload(val *UpdateVirtualIPPayload) *NullableUpdateVirtualIPPayload { + return &NullableUpdateVirtualIPPayload{value: val, isSet: true} +} + +func (v NullableUpdateVirtualIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVirtualIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_update_volume_payload.go b/services/iaasalpha/model_update_volume_payload.go index 001de1372..fcb4f589a 100644 --- a/services/iaasalpha/model_update_volume_payload.go +++ b/services/iaasalpha/model_update_volume_payload.go @@ -19,6 +19,8 @@ var _ MappedNullable = &UpdateVolumePayload{} // UpdateVolumePayload Object that represents an update request body of a volume. 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"` // Object that represents the labels of an object. @@ -33,6 +35,8 @@ type UpdateVolumePayload struct { // will change when the set of required properties is changed func NewUpdateVolumePayload() *UpdateVolumePayload { this := UpdateVolumePayload{} + var bootable bool = false + this.Bootable = &bootable return &this } @@ -41,9 +45,43 @@ func NewUpdateVolumePayload() *UpdateVolumePayload { // but it doesn't guarantee that properties required by API are set func NewUpdateVolumePayloadWithDefaults() *UpdateVolumePayload { this := UpdateVolumePayload{} + var bootable bool = false + this.Bootable = &bootable return &this } +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetBootable() *bool { + if o == nil || IsNil(o.Bootable) { + var ret *bool + return ret + } + return o.Bootable +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetBootableOk() (*bool, bool) { + if o == nil || IsNil(o.Bootable) { + return nil, false + } + return o.Bootable, true +} + +// HasBootable returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasBootable() bool { + if o != nil && !IsNil(o.Bootable) { + return true + } + + return false +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *UpdateVolumePayload) SetBootable(v *bool) { + o.Bootable = v +} + // GetDescription returns the Description field value if set, zero value otherwise. func (o *UpdateVolumePayload) GetDescription() *string { if o == nil || IsNil(o.Description) { @@ -142,6 +180,9 @@ func (o *UpdateVolumePayload) SetName(v *string) { func (o UpdateVolumePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.Bootable) { + toSerialize["bootable"] = o.Bootable + } if !IsNil(o.Description) { toSerialize["description"] = o.Description } diff --git a/services/iaasalpha/model_virtual_ip.go b/services/iaasalpha/model_virtual_ip.go new file mode 100644 index 000000000..42a9d6df1 --- /dev/null +++ b/services/iaasalpha/model_virtual_ip.go @@ -0,0 +1,339 @@ +/* +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 VirtualIp type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VirtualIp{} + +// VirtualIp Object that represents a virtual IP. +type VirtualIp struct { + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents an IP address. + Ip *string `json:"ip,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // A list of UUIDs. + Members *[]string `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + Network *string `json:"network,omitempty"` + // The state of a resource object. + Status *string `json:"status,omitempty"` +} + +// NewVirtualIp instantiates a new VirtualIp 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 NewVirtualIp() *VirtualIp { + this := VirtualIp{} + return &this +} + +// NewVirtualIpWithDefaults instantiates a new VirtualIp 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 NewVirtualIpWithDefaults() *VirtualIp { + this := VirtualIp{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VirtualIp) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VirtualIp) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *VirtualIp) SetId(v *string) { + o.Id = v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *VirtualIp) GetIp() *string { + if o == nil || IsNil(o.Ip) { + var ret *string + return ret + } + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetIpOk() (*string, bool) { + if o == nil || IsNil(o.Ip) { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *VirtualIp) HasIp() bool { + if o != nil && !IsNil(o.Ip) { + return true + } + + return false +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *VirtualIp) SetIp(v *string) { + o.Ip = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *VirtualIp) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + var ret *map[string]interface{} + return ret + } + return o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetLabelsOk() (*map[string]interface{}, bool) { + if o == nil || IsNil(o.Labels) { + return &map[string]interface{}{}, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *VirtualIp) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *VirtualIp) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *VirtualIp) GetMembers() *[]string { + if o == nil || IsNil(o.Members) { + var ret *[]string + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetMembersOk() (*[]string, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *VirtualIp) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *VirtualIp) SetMembers(v *[]string) { + o.Members = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VirtualIp) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VirtualIp) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VirtualIp) SetName(v *string) { + o.Name = v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *VirtualIp) GetNetwork() *string { + if o == nil || IsNil(o.Network) { + var ret *string + return ret + } + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetNetworkOk() (*string, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *VirtualIp) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *VirtualIp) SetNetwork(v *string) { + o.Network = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *VirtualIp) GetStatus() *string { + if o == nil || IsNil(o.Status) { + var ret *string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VirtualIp) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *VirtualIp) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *VirtualIp) SetStatus(v *string) { + o.Status = v +} + +func (o VirtualIp) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Ip) { + toSerialize["ip"] = o.Ip + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + return toSerialize, nil +} + +type NullableVirtualIp struct { + value *VirtualIp + isSet bool +} + +func (v NullableVirtualIp) Get() *VirtualIp { + return v.value +} + +func (v *NullableVirtualIp) Set(val *VirtualIp) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualIp) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualIp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualIp(val *VirtualIp) *NullableVirtualIp { + return &NullableVirtualIp{value: val, isSet: true} +} + +func (v NullableVirtualIp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualIp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_virtual_ip_list_response.go b/services/iaasalpha/model_virtual_ip_list_response.go new file mode 100644 index 000000000..dc728ae12 --- /dev/null +++ b/services/iaasalpha/model_virtual_ip_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 VirtualIpListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VirtualIpListResponse{} + +// VirtualIpListResponse Virtual IPs list response. +type VirtualIpListResponse struct { + // A list of virtual IPs. + // REQUIRED + Items *[]VirtualIp `json:"items"` +} + +type _VirtualIpListResponse VirtualIpListResponse + +// NewVirtualIpListResponse instantiates a new VirtualIpListResponse 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 NewVirtualIpListResponse(items *[]VirtualIp) *VirtualIpListResponse { + this := VirtualIpListResponse{} + this.Items = items + return &this +} + +// NewVirtualIpListResponseWithDefaults instantiates a new VirtualIpListResponse 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 NewVirtualIpListResponseWithDefaults() *VirtualIpListResponse { + this := VirtualIpListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VirtualIpListResponse) GetItems() *[]VirtualIp { + if o == nil { + var ret *[]VirtualIp + 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 *VirtualIpListResponse) GetItemsOk() (*[]VirtualIp, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *VirtualIpListResponse) SetItems(v *[]VirtualIp) { + o.Items = v +} + +func (o VirtualIpListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableVirtualIpListResponse struct { + value *VirtualIpListResponse + isSet bool +} + +func (v NullableVirtualIpListResponse) Get() *VirtualIpListResponse { + return v.value +} + +func (v *NullableVirtualIpListResponse) Set(val *VirtualIpListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVirtualIpListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVirtualIpListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVirtualIpListResponse(val *VirtualIpListResponse) *NullableVirtualIpListResponse { + return &NullableVirtualIpListResponse{value: val, isSet: true} +} + +func (v NullableVirtualIpListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVirtualIpListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaasalpha/model_volume.go b/services/iaasalpha/model_volume.go index ee1648167..e5157cbe0 100644 --- a/services/iaasalpha/model_volume.go +++ b/services/iaasalpha/model_volume.go @@ -23,6 +23,8 @@ type Volume struct { // Object that represents an availability zone. // REQUIRED AvailabilityZone *string `json:"availabilityZone"` + // Indicates if a volume is bootable. + Bootable *bool `json:"bootable,omitempty"` // Date-time when resource was created. CreatedAt *time.Time `json:"createdAt,omitempty"` // Description Object. Allows string up to 127 Characters. @@ -90,6 +92,38 @@ func (o *Volume) SetAvailabilityZone(v *string) { o.AvailabilityZone = v } +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *Volume) GetBootable() *bool { + if o == nil || IsNil(o.Bootable) { + var ret *bool + return ret + } + return o.Bootable +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetBootableOk() (*bool, bool) { + if o == nil || IsNil(o.Bootable) { + return nil, false + } + return o.Bootable, true +} + +// HasBootable returns a boolean if a field has been set. +func (o *Volume) HasBootable() bool { + if o != nil && !IsNil(o.Bootable) { + return true + } + + return false +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *Volume) SetBootable(v *bool) { + o.Bootable = v +} + // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *Volume) GetCreatedAt() *time.Time { if o == nil || IsNil(o.CreatedAt) { @@ -445,6 +479,9 @@ func (o *Volume) SetUpdatedAt(v *time.Time) { func (o Volume) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["availabilityZone"] = o.AvailabilityZone + if !IsNil(o.Bootable) { + toSerialize["bootable"] = o.Bootable + } if !IsNil(o.CreatedAt) { toSerialize["createdAt"] = o.CreatedAt } diff --git a/services/iaasalpha/model_volume_performance_class.go b/services/iaasalpha/model_volume_performance_class.go index 2ea704f59..0b6921301 100644 --- a/services/iaasalpha/model_volume_performance_class.go +++ b/services/iaasalpha/model_volume_performance_class.go @@ -21,11 +21,15 @@ var _ MappedNullable = &VolumePerformanceClass{} type VolumePerformanceClass struct { // Description Object. Allows string up to 127 Characters. Description *string `json:"description,omitempty"` + // Input/Output Operations per second. + Iops *int64 `json:"iops,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. // REQUIRED Name *string `json:"name"` + // Throughput in Megabyte per second. + Throughput *int64 `json:"throughput,omitempty"` } type _VolumePerformanceClass VolumePerformanceClass @@ -80,6 +84,38 @@ func (o *VolumePerformanceClass) SetDescription(v *string) { o.Description = v } +// GetIops returns the Iops field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetIops() *int64 { + if o == nil || IsNil(o.Iops) { + var ret *int64 + return ret + } + return o.Iops +} + +// GetIopsOk returns a tuple with the Iops field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetIopsOk() (*int64, bool) { + if o == nil || IsNil(o.Iops) { + return nil, false + } + return o.Iops, true +} + +// HasIops returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasIops() bool { + if o != nil && !IsNil(o.Iops) { + return true + } + + return false +} + +// SetIops gets a reference to the given int64 and assigns it to the Iops field. +func (o *VolumePerformanceClass) SetIops(v *int64) { + o.Iops = v +} + // GetLabels returns the Labels field value if set, zero value otherwise. func (o *VolumePerformanceClass) GetLabels() *map[string]interface{} { if o == nil || IsNil(o.Labels) { @@ -136,15 +172,53 @@ func (o *VolumePerformanceClass) SetName(v *string) { o.Name = v } +// GetThroughput returns the Throughput field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetThroughput() *int64 { + if o == nil || IsNil(o.Throughput) { + var ret *int64 + return ret + } + return o.Throughput +} + +// GetThroughputOk returns a tuple with the Throughput field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetThroughputOk() (*int64, bool) { + if o == nil || IsNil(o.Throughput) { + return nil, false + } + return o.Throughput, true +} + +// HasThroughput returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasThroughput() bool { + if o != nil && !IsNil(o.Throughput) { + return true + } + + return false +} + +// SetThroughput gets a reference to the given int64 and assigns it to the Throughput field. +func (o *VolumePerformanceClass) SetThroughput(v *int64) { + o.Throughput = v +} + func (o VolumePerformanceClass) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !IsNil(o.Description) { toSerialize["description"] = o.Description } + if !IsNil(o.Iops) { + toSerialize["iops"] = o.Iops + } if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } toSerialize["name"] = o.Name + if !IsNil(o.Throughput) { + toSerialize["throughput"] = o.Throughput + } return toSerialize, nil }