diff --git a/CHANGELOG.md b/CHANGELOG.md index fd1d51a9..5d61f276 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## Release (2024-10-18) + +- `iaas`: [v0.13.0](services/iaas/CHANGELOG.md#v0130-2024-10-18) + - **Feature:** Add support for managing following resources + - `Volume` + - `Server` + - `NetworkInterface` + - `PublicIP` + - `SecurityGroup` + - `SecurityGroupRule` + - **Breaking change**: Remove `V1NetworkGateway` data model + - **Bugfix**: Network response JSON decoding + ## Release (2024-10-14) - `sqlserverflex`: [v0.7.0](services/sqlserverflex/CHANGELOG.md#v070-2024-09-25) diff --git a/services/iaas/CHANGELOG.md b/services/iaas/CHANGELOG.md index c81004cf..37e1a882 100644 --- a/services/iaas/CHANGELOG.md +++ b/services/iaas/CHANGELOG.md @@ -1,3 +1,15 @@ +## v0.13.0 (2024-10-18) + +- **Feature:** Add support for managing following resources + - `Volume` + - `Server` + - `NetworkInterface` + - `PublicIP` + - `SecurityGroup` + - `SecurityGroupRule` +- **Breaking change**: Remove `V1NetworkGateway` data model +- **Bugfix**: Network response json decoding + ## v0.12.0 (2024-10-14) - **Feature:** Add support for nullable models diff --git a/services/iaas/api_default.go b/services/iaas/api_default.go index 7e3f0255..47d00656 100644 --- a/services/iaas/api_default.go +++ b/services/iaas/api_default.go @@ -26,51 +26,55 @@ import ( // DefaultApiService DefaultApi service type DefaultApiService service -type ApiCreateNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createNetworkPayload *CreateNetworkPayload -} - -// Request a network creation. - -func (r ApiCreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { - r.createNetworkPayload = &createNetworkPayload - return r +type ApiAddNICToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + nicId string } -func (r ApiCreateNetworkRequest) Execute() (*Network, error) { +func (r ApiAddNICToServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Network + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNICToServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - if r.createNetworkPayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkPayload is required and must be specified") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -86,11 +90,9 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.createNetworkPayload 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) @@ -104,14 +106,14 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -125,153 +127,153 @@ func (r ApiCreateNetworkRequest) Execute() (*Network, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 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 } /* -CreateNetwork: Create new network. +AddNICToServer: Attach an existing network interface. -Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. +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. - @return ApiCreateNetworkRequest + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiAddNICToServerRequest */ -func (a *APIClient) CreateNetwork(ctx context.Context, projectId string) ApiCreateNetworkRequest { - return ApiCreateNetworkRequest{ +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) CreateNetworkExecute(ctx context.Context, projectId string) (*Network, error) { - r := ApiCreateNetworkRequest{ +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, } return r.Execute() } -type ApiCreateNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - createNetworkAreaPayload *CreateNetworkAreaPayload -} - -// Request an Area creation. - -func (r ApiCreateNetworkAreaRequest) CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest { - r.createNetworkAreaPayload = &createNetworkAreaPayload - return r +type ApiAddNetworkToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + networkId string } -func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { +func (r ApiAddNetworkToServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *NetworkArea + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNetworkToServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") } - if r.createNetworkAreaPayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkAreaPayload is required and must be specified") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -287,11 +289,9 @@ func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.createNetworkAreaPayload 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) @@ -305,14 +305,14 @@ func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -326,150 +326,142 @@ func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { 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 } /* -CreateNetworkArea: Create new network area in an organization. +AddNetworkToServer: Create and attach a network interface from the specified network. -Create a new network area in an organization. +Create and attach a network interface from the specified network to the server. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @return ApiCreateNetworkAreaRequest + @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 ApiAddNetworkToServerRequest */ -func (a *APIClient) CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest { - return ApiCreateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) AddNetworkToServer(ctx context.Context, projectId string, serverId string, networkId string) ApiAddNetworkToServerRequest { + return ApiAddNetworkToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + networkId: networkId, } } -func (a *APIClient) CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) { - r := ApiCreateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) AddNetworkToServerExecute(ctx context.Context, projectId string, serverId string, networkId string) error { + r := ApiAddNetworkToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + networkId: networkId, } return r.Execute() } -type ApiCreateNetworkAreaRangeRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - createNetworkAreaRangePayload *CreateNetworkAreaRangePayload -} - -// Request an addition of network ranges to an area. - -func (r ApiCreateNetworkAreaRangeRequest) CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest { - r.createNetworkAreaRangePayload = &createNetworkAreaRangePayload - return r +type ApiAddPublicIpToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + publicIpId string } -func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, error) { +func (r ApiAddPublicIpToServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *NetworkRangeListResponse + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRange") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddPublicIpToServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } - if r.createNetworkAreaRangePayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkAreaRangePayload is required and must be specified") + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -485,11 +477,9 @@ func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.createNetworkAreaRangePayload 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) @@ -503,14 +493,14 @@ func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, *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 { @@ -524,164 +514,153 @@ func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, 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 } /* -CreateNetworkAreaRange: Create new network range in a network area. +AddPublicIpToServer: Associate a public IP to the server. -Create a new network range in an existing network area. +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 organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiCreateNetworkAreaRangeRequest + @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 */ -func (a *APIClient) CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRangeRequest { - return ApiCreateNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) 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) CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { - r := ApiCreateNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +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 ApiCreateNetworkAreaRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - createNetworkAreaRoutePayload *CreateNetworkAreaRoutePayload -} - -// Request an addition of routes to an area. - -func (r ApiCreateNetworkAreaRouteRequest) CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest { - r.createNetworkAreaRoutePayload = &createNetworkAreaRoutePayload - return r +type ApiAddSecurityGroupToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + securityGroupId string } -func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) { +func (r ApiAddSecurityGroupToServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *RouteListResponse + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRoute") + 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 + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } - if r.createNetworkAreaRoutePayload == nil { - return localVarReturnValue, fmt.Errorf("createNetworkAreaRoutePayload is required and must be specified") + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -697,11 +676,9 @@ func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.createNetworkAreaRoutePayload 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) @@ -715,14 +692,14 @@ func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -736,148 +713,147 @@ func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 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 } /* -CreateNetworkAreaRoute: Create new network routes. +AddSecurityGroupToServer: Add a server to a security group. -Create one or several new network routes in a network area. +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 organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiCreateNetworkAreaRouteRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiAddSecurityGroupToServerRequest */ -func (a *APIClient) CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRouteRequest { - return ApiCreateNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) 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) CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { - r := ApiCreateNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +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 ApiDeleteNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string +type ApiAddServiceAccountToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + serviceAccountMail string } -func (r ApiDeleteNetworkRequest) Execute() error { +func (r ApiAddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListResponse, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddServiceAccountToServer") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") } // to determine the Content-Type header @@ -899,7 +875,7 @@ func (r ApiDeleteNetworkRequest) Execute() error { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -913,14 +889,14 @@ func (r ApiDeleteNetworkRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -934,142 +910,172 @@ func (r ApiDeleteNetworkRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetwork: Delete network. +AddServiceAccountToServer: Attach service account to a server. -Delete a network. If the network is still in use, the deletion will fail. +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 networkId The identifier (ID) of a STACKIT Network. - @return ApiDeleteNetworkRequest + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiAddServiceAccountToServerRequest */ -func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, networkId string) ApiDeleteNetworkRequest { - return ApiDeleteNetworkRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, +func (a *APIClient) 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) DeleteNetworkExecute(ctx context.Context, projectId string, networkId string) error { - r := ApiDeleteNetworkRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - networkId: networkId, +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 ApiDeleteNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiAddVolumeToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string + addVolumeToServerPayload *AddVolumeToServerPayload } -func (r ApiDeleteNetworkAreaRequest) Execute() error { +// Request a volume attachment creation. + +func (r ApiAddVolumeToServerRequest) AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest { + r.addVolumeToServerPayload = &addVolumeToServerPayload + return r +} + +func (r ApiAddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddVolumeToServer") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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.organizationId) < 36 { - return 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 fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return fmt.Errorf("areaId 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.areaId) > 36 { - return fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.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{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1085,9 +1091,11 @@ func (r ApiDeleteNetworkAreaRequest) Execute() 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 err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -1101,14 +1109,14 @@ func (r ApiDeleteNetworkAreaRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1122,150 +1130,167 @@ func (r ApiDeleteNetworkAreaRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetworkArea: Delete a network area. +AddVolumeToServer: Attach a volume to a server. -Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. +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(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiDeleteNetworkAreaRequest + @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) DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest { - return ApiDeleteNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +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) DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error { - r := ApiDeleteNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +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 ApiDeleteNetworkAreaRangeRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - networkRangeId string +type ApiCreateNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + createNICPayload *CreateNICPayload } -func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { +// Request a network interface creation. + +func (r ApiCreateNICRequest) CreateNICPayload(createNICPayload CreateNICPayload) ApiCreateNICRequest { + r.createNICPayload = &createNICPayload + return r +} + +func (r ApiCreateNICRequest) Execute() (*NIC, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRange") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNIC") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.areaId) < 36 { - return fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) > 36 { - return fmt.Errorf("areaId 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.networkRangeId) < 36 { - return fmt.Errorf("networkRangeId 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.networkRangeId) > 36 { - return fmt.Errorf("networkRangeId 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 - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1281,9 +1306,11 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createNICPayload 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) @@ -1297,14 +1324,14 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1318,153 +1345,167 @@ func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 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 } /* -DeleteNetworkAreaRange: Delete a network range. +CreateNIC: Create new network interface. -Delete a network range of a network area. The deletion will fail if the network range is still used. +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 organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @param networkRangeId The identifier (ID) of a STACKIT Network Range. - @return ApiDeleteNetworkAreaRangeRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNICRequest */ -func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest { - return ApiDeleteNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - networkRangeId: networkRangeId, +func (a *APIClient) CreateNIC(ctx context.Context, projectId string, networkId string) ApiCreateNICRequest { + return ApiCreateNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, } } -func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) error { - r := ApiDeleteNetworkAreaRangeRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - networkRangeId: networkRangeId, +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 ApiDeleteNetworkAreaRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - routeId string +type ApiCreateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createNetworkPayload *CreateNetworkPayload } -func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRoute") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } +// Request a network creation. - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) +func (r ApiCreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { + r.createNetworkPayload = &createNetworkPayload + return r +} + +func (r ApiCreateNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return fmt.Errorf("organizationId must have at least 36 elements") - } - if strlen(r.organizationId) > 36 { - return fmt.Errorf("organizationId must have less than 36 elements") - } - if strlen(r.areaId) < 36 { - return fmt.Errorf("areaId must have at least 36 elements") - } - if strlen(r.areaId) > 36 { - return fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.routeId) < 36 { - return fmt.Errorf("routeId must have at least 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.routeId) > 36 { - return fmt.Errorf("routeId must have less than 36 elements") + if r.createNetworkPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkPayload 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) @@ -1480,9 +1521,11 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createNetworkPayload 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) @@ -1496,14 +1539,14 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1517,135 +1560,153 @@ func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } /* -DeleteNetworkAreaRoute: Delete a network route. +CreateNetwork: Create new network. -Delete a network route of a network area. +Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @param routeId The identifier (ID) of a STACKIT Route. - @return ApiDeleteNetworkAreaRouteRequest + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateNetworkRequest */ -func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiDeleteNetworkAreaRouteRequest { - return ApiDeleteNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - routeId: routeId, +func (a *APIClient) CreateNetwork(ctx context.Context, projectId string) ApiCreateNetworkRequest { + return ApiCreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } } -func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) error { - r := ApiDeleteNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - routeId: routeId, +func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string) (*Network, error) { + r := ApiCreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, } return r.Execute() } -type ApiGetNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string +type ApiCreateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + createNetworkAreaPayload *CreateNetworkAreaPayload } -func (r ApiGetNetworkRequest) Execute() (*Network, error) { +// Request an Area creation. + +func (r ApiCreateNetworkAreaRequest) CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest { + r.createNetworkAreaPayload = &createNetworkAreaPayload + return r +} + +func (r ApiCreateNetworkAreaRequest) Execute() (*NetworkArea, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Network + localVarReturnValue *NetworkArea ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkArea") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") - } - if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") } - if strlen(r.networkId) < 36 { - return localVarReturnValue, fmt.Errorf("networkId must have at least 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 less than 36 elements") + if r.createNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaPayload 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) @@ -1661,6 +1722,8 @@ func (r ApiGetNetworkRequest) Execute() (*Network, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createNetworkAreaPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1764,55 +1827,60 @@ func (r ApiGetNetworkRequest) Execute() (*Network, error) { } /* -GetNetwork: Get network details. +CreateNetworkArea: Create new network area in an organization. -Get details about a network of a project. +Create a new network area in an organization. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The identifier (ID) of a STACKIT Project. - @param networkId The identifier (ID) of a STACKIT Network. - @return ApiGetNetworkRequest + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiCreateNetworkAreaRequest */ -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) CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest { + return ApiCreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, } } -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) CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) { + r := ApiCreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, } return r.Execute() } -type ApiGetNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiCreateNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + createNetworkAreaRangePayload *CreateNetworkAreaRangePayload } -func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { +// Request an addition of network ranges to an area. + +func (r ApiCreateNetworkAreaRangeRequest) CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest { + r.createNetworkAreaRangePayload = &createNetworkAreaRangePayload + return r +} + +func (r ApiCreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkArea + localVarReturnValue *NetworkRangeListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRange") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) @@ -1831,9 +1899,12 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { if strlen(r.areaId) > 36 { return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } + if r.createNetworkAreaRangePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRangePayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1849,6 +1920,8 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createNetworkAreaRangePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1925,7 +1998,7 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 500 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1934,14 +2007,25 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, + 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(), } @@ -1952,17 +2036,17 @@ func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { } /* -GetNetworkArea: Get details about a network area. +CreateNetworkAreaRange: Create new network range in a network area. -Get details about a network area in an organization. +Create a new network range in an existing network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param organizationId The identifier (ID) of a STACKIT Organization. @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiGetNetworkAreaRequest + @return ApiCreateNetworkAreaRangeRequest */ -func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { - return ApiGetNetworkAreaRequest{ +func (a *APIClient) CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRangeRequest { + return ApiCreateNetworkAreaRangeRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -1970,8 +2054,8 @@ func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, a } } -func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { - r := ApiGetNetworkAreaRequest{ +func (a *APIClient) CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { + r := ApiCreateNetworkAreaRangeRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, @@ -1980,31 +2064,37 @@ func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId st return r.Execute() } -type ApiGetNetworkAreaRangeRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - networkRangeId string +type ApiCreateNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + createNetworkAreaRoutePayload *CreateNetworkAreaRoutePayload } -func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { +// Request an addition of routes to an area. + +func (r ApiCreateNetworkAreaRouteRequest) CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest { + r.createNetworkAreaRoutePayload = &createNetworkAreaRoutePayload + return r +} + +func (r ApiCreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkRange + localVarReturnValue *RouteListResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRange") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRoute") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2021,15 +2111,12 @@ func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { if strlen(r.areaId) > 36 { return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") } - if strlen(r.networkRangeId) < 36 { - return localVarReturnValue, fmt.Errorf("networkRangeId must have at least 36 elements") - } - if strlen(r.networkRangeId) > 36 { - return localVarReturnValue, fmt.Errorf("networkRangeId must have less than 36 elements") + if r.createNetworkAreaRoutePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRoutePayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2045,6 +2132,8 @@ func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createNetworkAreaRoutePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2121,6 +2210,17 @@ func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2148,87 +2248,10823 @@ func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { } /* -GetNetworkAreaRange: Get details about a network range. +CreateNetworkAreaRoute: Create new network routes. -Get details about a network range in a network area. +Create one or several new network routes in a network area. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param organizationId The identifier (ID) of a STACKIT Organization. @param areaId The identifier (ID) of a STACKIT Network Area. - @param networkRangeId The identifier (ID) of a STACKIT Network Range. - @return ApiGetNetworkAreaRangeRequest + @return ApiCreateNetworkAreaRouteRequest */ -func (a *APIClient) GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiGetNetworkAreaRangeRequest { - return ApiGetNetworkAreaRangeRequest{ +func (a *APIClient) CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string) ApiCreateNetworkAreaRouteRequest { + return ApiCreateNetworkAreaRouteRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, areaId: areaId, - networkRangeId: networkRangeId, } } -func (a *APIClient) GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) (*NetworkRange, error) { - r := ApiGetNetworkAreaRangeRequest{ +func (a *APIClient) CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { + r := ApiCreateNetworkAreaRouteRequest{ apiService: a.defaultApi, ctx: ctx, organizationId: organizationId, areaId: areaId, - networkRangeId: networkRangeId, } return r.Execute() } -type ApiGetNetworkAreaRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - routeId string +type ApiCreatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createPublicIPPayload *CreatePublicIPPayload } -func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { +// Request a public IP creation. + +func (r ApiCreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { + r.createPublicIPPayload = &createPublicIPPayload + return r +} + +func (r ApiCreatePublicIPRequest) Execute() (*PublicIp, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Route + localVarReturnValue *PublicIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.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") + } + + // 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.createPublicIPPayload + 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 == 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 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 +} + +/* +CreatePublicIP: Create new public IP. + +Create a new public IP in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreatePublicIPRequest +*/ +func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string) ApiCreatePublicIPRequest { + return ApiCreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string) (*PublicIp, error) { + r := ApiCreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiCreateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createSecurityGroupPayload *CreateSecurityGroupPayload +} + +// Request a security group creation. + +func (r ApiCreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { + r.createSecurityGroupPayload = &createSecurityGroupPayload + return r +} + +func (r ApiCreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.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.createSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload 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.createSecurityGroupPayload + 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 +} + +/* +CreateSecurityGroup: Create new security group. + +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 ApiCreateSecurityGroupRequest +*/ +func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string) ApiCreateSecurityGroupRequest { + return ApiCreateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string) (*SecurityGroup, error) { + r := ApiCreateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiCreateSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + createSecurityGroupRulePayload *CreateSecurityGroupRulePayload +} + +// Request for a security group rule creation. + +func (r ApiCreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { + r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload + return r +} + +func (r ApiCreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.createSecurityGroupRulePayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload 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.createSecurityGroupRulePayload + 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 +} + +/* +CreateSecurityGroupRule: Create new security group rule. + +Create a new security group rule in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest +*/ +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) 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 ApiCreateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createServerPayload *CreateServerPayload +} + +// 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 + localVarReturnValue *Server + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createServerPayload == nil { + return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"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.createServerPayload + 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 +} + +/* +CreateServer: Create new server. + +Create a new server in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateServerRequest +*/ +func (a *APIClient) CreateServer(ctx context.Context, projectId string) ApiCreateServerRequest { + return ApiCreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string) (*Server, error) { + r := ApiCreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiCreateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createVolumePayload *CreateVolumePayload +} + +// Request a volume creation. + +func (r ApiCreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { + r.createVolumePayload = &createVolumePayload + return r +} + +func (r ApiCreateVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createVolumePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateVolume: Create new volume. + +Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiCreateVolumeRequest +*/ +func (a *APIClient) CreateVolume(ctx context.Context, projectId string) ApiCreateVolumeRequest { + return ApiCreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string) (*Volume, error) { + r := ApiCreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiDeallocateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiDeallocateServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/deallocate" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeallocateServer: Deallocate an existing server. + +Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest +*/ +func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, serverId string) ApiDeallocateServerRequest { + return ApiDeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiDeleteNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + nicId string +} + +func (r ApiDeleteNICRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNIC") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNIC: Delete a network interface. + +Delete a network interface that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNICRequest +*/ +func (a *APIClient) DeleteNIC(ctx context.Context, projectId string, networkId string, nicId string) ApiDeleteNICRequest { + return ApiDeleteNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) DeleteNICExecute(ctx context.Context, projectId string, networkId string, nicId string) error { + r := ApiDeleteNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type ApiDeleteNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string +} + +func (r ApiDeleteNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetwork: Delete network. + +Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest +*/ +func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, networkId string) ApiDeleteNetworkRequest { + return ApiDeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } +} + +func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, networkId string) error { + r := ApiDeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } + return r.Execute() +} + +type ApiDeleteNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ApiDeleteNetworkAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkArea: Delete a network area. + +Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiDeleteNetworkAreaRequest +*/ +func (a *APIClient) DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest { + return ApiDeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error { + r := ApiDeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ApiDeleteNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + networkRangeId string +} + +func (r ApiDeleteNetworkAreaRangeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRange") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRange: Delete a network range. + +Delete a network range of a network area. The deletion will fail if the network range is still used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiDeleteNetworkAreaRangeRequest +*/ +func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest { + return ApiDeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) error { + r := ApiDeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type ApiDeleteNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + routeId string +} + +func (r ApiDeleteNetworkAreaRouteRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRoute") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRoute: Delete a network route. + +Delete a network route of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteNetworkAreaRouteRequest +*/ +func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiDeleteNetworkAreaRouteRequest { + return ApiDeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + routeId: routeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) error { + r := ApiDeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + routeId: routeId, + } + return r.Execute() +} + +type ApiDeletePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + publicIpId string +} + +func (r ApiDeletePublicIPRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeletePublicIP: Delete a public IP. + +Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest +*/ +func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, publicIpId string) ApiDeletePublicIPRequest { + return ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, publicIpId string) error { + r := ApiDeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type ApiDeleteSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string +} + +func (r ApiDeleteSecurityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroup: Delete security group. + +Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest +*/ +func (a *APIClient) DeleteSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiDeleteSecurityGroupRequest { + return ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) DeleteSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) error { + r := ApiDeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ApiDeleteSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string +} + +func (r ApiDeleteSecurityGroupRuleRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroupRule: Delete security group rule. + +Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest +*/ +func (a *APIClient) DeleteSecurityGroupRule(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest { + return ApiDeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, securityGroupId string, securityGroupRuleId string) error { + r := ApiDeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type ApiDeleteServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiDeleteServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteServer: Delete a server. + +Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest +*/ +func (a *APIClient) DeleteServer(ctx context.Context, projectId string, serverId string) ApiDeleteServerRequest { + return ApiDeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiDeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiDeleteVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string +} + +func (r ApiDeleteVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteVolume: Delete a volume. + +Delete a volume inside a project. The deletion will fail if the volume is still in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiDeleteVolumeRequest +*/ +func (a *APIClient) DeleteVolume(ctx context.Context, projectId string, volumeId string) ApiDeleteVolumeRequest { + return ApiDeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, + } +} + +func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, volumeId string) error { + r := ApiDeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiGetAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string +} + +func (r ApiGetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAttachedVolume: Get Volume Attachment details. + +Get the details of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetAttachedVolumeRequest +*/ +func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { + return ApiGetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := ApiGetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiGetNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + nicId string +} + +func (r ApiGetNICRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNIC") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 +} + +/* +GetNIC: Get details about a network interface. + +Get details about a network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiGetNICRequest +*/ +func (a *APIClient) GetNIC(ctx context.Context, projectId string, networkId string, nicId string) ApiGetNICRequest { + return ApiGetNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) GetNICExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { + r := ApiGetNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type ApiGetNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string +} + +func (r ApiGetNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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") + } + + // 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 +} + +/* +GetNetwork: Get network details. + +Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest +*/ +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) GetNetworkExecute(ctx context.Context, projectId string, networkId string) (*Network, error) { + r := ApiGetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } + return r.Execute() +} + +type ApiGetNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ApiGetNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // 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 +} + +/* +GetNetworkArea: Get details about a network area. + +Get details about a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiGetNetworkAreaRequest +*/ +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) 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 ApiGetNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + networkRangeId string +} + +func (r ApiGetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRange + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRange") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return localVarReturnValue, fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return localVarReturnValue, fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return 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 +} + +/* +GetNetworkAreaRange: Get details about a network range. + +Get details about a network range in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiGetNetworkAreaRangeRequest +*/ +func (a *APIClient) GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, networkRangeId string) ApiGetNetworkAreaRangeRequest { + return ApiGetNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, networkRangeId string) (*NetworkRange, error) { + r := ApiGetNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type ApiGetNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + routeId string +} + +func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRoute") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return 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 +} + +/* +GetNetworkAreaRoute: Get details about a network route. + +Get details about a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetNetworkAreaRouteRequest +*/ +func (a *APIClient) GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiGetNetworkAreaRouteRequest { + return ApiGetNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + routeId: routeId, + } +} + +func (a *APIClient) GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) (*Route, error) { + r := ApiGetNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + routeId: routeId, + } + return r.Execute() +} + +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 *Request + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + + 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.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + } + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 +} + +/* +GetOrganizationRequest: Lookup an organization request ID. + +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 organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest +*/ +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) 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 ApiGetProjectRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + requestId string +} + +func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + } + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 +} + +/* +GetProjectRequest: Lookup a project request ID. + +Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetProjectRequestRequest +*/ +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) 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 ApiGetPublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + publicIpId string +} + +func (r ApiGetPublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + 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.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{} + + // 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 +} + +/* +GetPublicIP: Get details about a public IP. + +Get details about a public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest +*/ +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) 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 ApiGetSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string +} + +func (r ApiGetSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // 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 +} + +/* +GetSecurityGroup: Get security group details. + +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 securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest +*/ +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) 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 ApiGetSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + securityGroupRuleId string +} + +func (r ApiGetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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 localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // 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 +} + +/* +GetSecurityGroupRule: Get security group rule details. + +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 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) 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) 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 ApiGetServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + details *bool +} + +// Show detailed information about server. + +func (r ApiGetServerRequest) Details(details bool) ApiGetServerRequest { + r.details = &details + return r +} + +func (r ApiGetServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 +} + +/* +GetServer: Get server details. + +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 serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest +*/ +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) 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 ApiGetServerConsoleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiGetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServerConsoleUrl + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/console" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + 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 +} + +/* +GetServerConsole: Get server console. + +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 serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest +*/ +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) 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 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 +} + +func (r ApiGetServerLogRequest) Execute() (*GetServerLog200Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetServerLog200Response + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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) + + 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{"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.getServerLogRequest + 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 +} + +/* +GetServerLog: Get server log. + +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 ApiGetServerLogRequest +*/ +func (a *APIClient) GetServerLog(ctx context.Context, projectId string, serverId string) ApiGetServerLogRequest { + return ApiGetServerLogRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, serverId string) (*GetServerLog200Response, error) { + r := ApiGetServerLogRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiGetVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string +} + +func (r ApiGetVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + 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.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 +} + +/* +GetVolume: Get details about a volume. + +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 volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest +*/ +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) GetVolumeExecute(ctx context.Context, projectId string, volumeId string) (*Volume, error) { + r := ApiGetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiListAttachedVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachmentListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAttachedVolumes: List all volume attachments of a server. + +Get 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 serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest +*/ +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) 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 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 +} + +func (r ApiListNICsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNICs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // 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 +} + +/* +ListNICs: List all network interfaces inside a network. + +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. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNICsRequest +*/ +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) ListNICsExecute(ctx context.Context, projectId string, networkId string) (*NICListResponse, error) { + r := ApiListNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } + return r.Execute() +} + +type ApiListNetworkAreaProjectsRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProjectListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaProjects") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // 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 +} + +/* +ListNetworkAreaProjects: List all projects using a network area. + +Get a list of all projects using a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaProjectsRequest +*/ +func (a *APIClient) ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest { + return ApiListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) { + r := ApiListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ApiListNetworkAreaRangesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRangeListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRanges") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // 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 +} + +/* +ListNetworkAreaRanges: List all network ranges in a network area. + +Get a list of all network ranges in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaRangesRequest +*/ +func (a *APIClient) ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRangesRequest { + return ApiListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { + r := ApiListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ApiListNetworkAreaRoutesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRoutes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // 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 +} + +/* +ListNetworkAreaRoutes: List all network routes in a network area. + +Get a list of all network routes defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaRoutesRequest +*/ +func (a *APIClient) ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRoutesRequest { + return ApiListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { + r := ApiListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ApiListNetworkAreasRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string +} + +func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkAreaListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + + 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") + } + + // 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 +} + +/* +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 + "/v1beta1/projects/{projectId}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.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 networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListNetworksRequest +*/ +func (a *APIClient) ListNetworks(ctx context.Context, projectId string) ApiListNetworksRequest { + return ApiListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string) (*NetworkListResponse, error) { + r := ApiListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiListPublicIPsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ApiListPublicIPsRequest) LabelSelector(labelSelector string) ApiListPublicIPsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListPublicIPsRequest) Execute() (*PublicIpListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIpListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + 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 +} + +/* +ListPublicIPs: List all public IPs inside a project. + +Get a list of all public IPs inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListPublicIPsRequest +*/ +func (a *APIClient) ListPublicIPs(ctx context.Context, projectId string) ApiListPublicIPsRequest { + return ApiListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string) (*PublicIpListResponse, error) { + r := ApiListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiListSecurityGroupRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string +} + +func (r ApiListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRuleListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroupRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // 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 +} + +/* +ListSecurityGroupRules: List all rules for a security group. + +Get a list of all rules inside a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiListSecurityGroupRulesRequest +*/ +func (a *APIClient) ListSecurityGroupRules(ctx context.Context, projectId string, securityGroupId string) ApiListSecurityGroupRulesRequest { + return ApiListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) ListSecurityGroupRulesExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroupRuleListResponse, error) { + r := ApiListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ApiListSecurityGroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ApiListSecurityGroupsRequest) LabelSelector(labelSelector string) ApiListSecurityGroupsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListSecurityGroupsRequest) Execute() (*SecurityGroupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + 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 +} + +/* +ListSecurityGroups: List all security groups inside a project. + +Get a list of all security groups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListSecurityGroupsRequest +*/ +func (a *APIClient) ListSecurityGroups(ctx context.Context, projectId string) ApiListSecurityGroupsRequest { + return ApiListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId string) (*SecurityGroupListResponse, error) { + r := ApiListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiListServerNICsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +func (r ApiListServerNICsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNICs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.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 +} + +/* +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 +*/ +func (a *APIClient) ListServerNICs(ctx context.Context, projectId string, serverId string) ApiListServerNICsRequest { + return ApiListServerNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) ListServerNICsExecute(ctx context.Context, projectId string, serverId string) (*NICListResponse, error) { + r := ApiListServerNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiListServerServiceAccountsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string +} + +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 + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + 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 *ServerListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.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.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } + 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 +} + +/* +ListServers: List all servers inside a project. + +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. + @return ApiListServersRequest +*/ +func (a *APIClient) ListServers(ctx context.Context, projectId string) ApiListServersRequest { + return ApiListServersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListServersExecute(ctx context.Context, projectId string) (*ServerListResponse, error) { + r := ApiListServersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiListVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ApiListVolumesRequest) LabelSelector(labelSelector string) ApiListVolumesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListVolumesRequest) Execute() (*VolumeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.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 +} + +/* +ListVolumes: List all volumes inside a project. + +Get a list of all volumes inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiListVolumesRequest +*/ +func (a *APIClient) ListVolumes(ctx context.Context, projectId string) ApiListVolumesRequest { + return ApiListVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListVolumesExecute(ctx context.Context, projectId string) (*VolumeListResponse, error) { + r := ApiListVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiPartialUpdateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + partialUpdateNetworkPayload *PartialUpdateNetworkPayload +} + +// Request an update of a network. + +func (r ApiPartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { + r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload + return r +} + +func (r ApiPartialUpdateNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if r.partialUpdateNetworkPayload == nil { + return fmt.Errorf("partialUpdateNetworkPayload 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.partialUpdateNetworkPayload + 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 +} + +/* +PartialUpdateNetwork: Update network settings. + +Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest +*/ +func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, networkId string) ApiPartialUpdateNetworkRequest { + return ApiPartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } +} + +func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, networkId string) error { + r := ApiPartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + } + return r.Execute() +} + +type ApiPartialUpdateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + partialUpdateNetworkAreaPayload *PartialUpdateNetworkAreaPayload +} + +// Request to update an Area. + +func (r ApiPartialUpdateNetworkAreaRequest) PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest { + r.partialUpdateNetworkAreaPayload = &partialUpdateNetworkAreaPayload + return r +} + +func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.partialUpdateNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("partialUpdateNetworkAreaPayload 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.partialUpdateNetworkAreaPayload + 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 +} + +/* +PartialUpdateNetworkArea: Update network area settings. + +Update the settings of a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiPartialUpdateNetworkAreaRequest +*/ +func (a *APIClient) PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest { + return ApiPartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := ApiPartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ApiRebootServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + action *string +} + +// Defines if it is a soft or a hard reboot. + +func (r ApiRebootServerRequest) Action(action string) ApiRebootServerRequest { + r.action = &action + return r +} + +func (r ApiRebootServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RebootServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/reboot" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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") + } + + if r.action != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "action", r.action, "") + } + // 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 +} + +/* +RebootServer: Reboot the server. + +Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRebootServerRequest +*/ +func (a *APIClient) RebootServer(ctx context.Context, projectId string, serverId string) ApiRebootServerRequest { + return ApiRebootServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) RebootServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiRebootServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiRemoveNICFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + nicId string +} + +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.RemoveNICFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveNICFromServer: Detach a network interface. + +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 nicId The identifier (ID) of a network interface. + @return ApiRemoveNICFromServerRequest +*/ +func (a *APIClient) RemoveNICFromServer(ctx context.Context, projectId string, serverId string, nicId string) ApiRemoveNICFromServerRequest { + return ApiRemoveNICFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + nicId: nicId, + } +} + +func (a *APIClient) RemoveNICFromServerExecute(ctx context.Context, projectId string, serverId string, nicId string) error { + r := ApiRemoveNICFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + nicId: nicId, + } + return r.Execute() +} + +type ApiRemoveNetworkFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + networkId string +} + +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.RemoveNetworkFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 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 +} + +/* +RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. + +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 networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest +*/ +func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { + return ApiRemoveNetworkFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + networkId: networkId, + } +} + +func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, serverId string, networkId string) error { + r := ApiRemoveNetworkFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + networkId: networkId, + } + return r.Execute() +} + +type ApiRemovePublicIpFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + publicIpId string +} + +func (r ApiRemovePublicIpFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemovePublicIpFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 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 +} + +/* +RemovePublicIpFromServer: Dissociate a public IP from a server. + +Dissociate a public IP on an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiRemovePublicIpFromServerRequest +*/ +func (a *APIClient) RemovePublicIpFromServer(ctx context.Context, projectId string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest { + return ApiRemovePublicIpFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) RemovePublicIpFromServerExecute(ctx context.Context, projectId string, serverId string, publicIpId string) error { + r := ApiRemovePublicIpFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type ApiRemoveSecurityGroupFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + securityGroupId string +} + +func (r ApiRemoveSecurityGroupFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveSecurityGroupFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.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") + } + 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 +} + +/* +RemoveSecurityGroupFromServer: Remove a server from a security group. + +Remove a server from a attached security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiRemoveSecurityGroupFromServerRequest +*/ +func (a *APIClient) RemoveSecurityGroupFromServer(ctx context.Context, projectId string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest { + return ApiRemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, serverId string, securityGroupId string) error { + r := ApiRemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ApiRemoveServiceAccountFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + serviceAccountMail string +} + +func (r ApiRemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveServiceAccountFromServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 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 == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 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 +} + +/* +RemoveServiceAccountFromServer: Detach a service account from a server. + +Detach an additional service account from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiRemoveServiceAccountFromServerRequest +*/ +func (a *APIClient) RemoveServiceAccountFromServer(ctx context.Context, projectId string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest { + return ApiRemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } +} + +func (a *APIClient) RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := ApiRemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } + return r.Execute() +} + +type ApiRemoveVolumeFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string +} + +func (r ApiRemoveVolumeFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveVolumeFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return 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") + } + 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 +} + +/* +RemoveVolumeFromServer: Detach a volume from a server. + +Detach an existing volume from an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiRemoveVolumeFromServerRequest +*/ +func (a *APIClient) RemoveVolumeFromServer(ctx context.Context, projectId string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest { + return ApiRemoveVolumeFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) RemoveVolumeFromServerExecute(ctx context.Context, projectId string, serverId string, volumeId string) error { + r := ApiRemoveVolumeFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type ApiRescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + rescueServerPayload *RescueServerPayload +} + +// Request a server rescue. + +func (r ApiRescueServerRequest) RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest { + r.rescueServerPayload = &rescueServerPayload + return r +} + +func (r ApiRescueServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RescueServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/rescue" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + 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") + } + if r.rescueServerPayload == nil { + return fmt.Errorf("rescueServerPayload 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.rescueServerPayload + 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 +} + +/* +RescueServer: Rescue an existing server. + +Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRescueServerRequest +*/ +func (a *APIClient) RescueServer(ctx context.Context, projectId string, serverId string) ApiRescueServerRequest { + return ApiRescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) RescueServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiRescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiResizeServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + resizeServerPayload *ResizeServerPayload +} + +// Request a resize of a server. + +func (r ApiResizeServerRequest) ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest { + r.resizeServerPayload = &resizeServerPayload + return r +} + +func (r ApiResizeServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/resize" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + 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") + } + if r.resizeServerPayload == nil { + return fmt.Errorf("resizeServerPayload 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.resizeServerPayload + 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 +} + +/* +ResizeServer: Resize a server. + +Resize the server to the given machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiResizeServerRequest +*/ +func (a *APIClient) ResizeServer(ctx context.Context, projectId string, serverId string) ApiResizeServerRequest { + return ApiResizeServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +func (a *APIClient) ResizeServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiResizeServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } + return r.Execute() +} + +type ApiResizeVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string + resizeVolumePayload *ResizeVolumePayload +} + +// Request a volume resize. + +func (r ApiResizeVolumeRequest) ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest { + r.resizeVolumePayload = &resizeVolumePayload + return r +} + +func (r ApiResizeVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}/resize" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) 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 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 fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.routeId) < 36 { - return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") } - if strlen(r.routeId) > 36 { - return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2244,9 +13080,11 @@ func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.resizeVolumePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -2260,14 +13098,14 @@ func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2281,141 +13119,138 @@ func (r ApiGetNetworkAreaRouteRequest) Execute() (*Route, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 500 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return newErr } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -GetNetworkAreaRoute: Get details about a network route. +ResizeVolume: Update the size of a volume. -Get details about a network route defined in a network area. +Update the size of a block device volume. The new volume size must be larger than the current size. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @param routeId The identifier (ID) of a STACKIT Route. - @return ApiGetNetworkAreaRouteRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest */ -func (a *APIClient) GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, routeId string) ApiGetNetworkAreaRouteRequest { - return ApiGetNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - routeId: routeId, +func (a *APIClient) ResizeVolume(ctx context.Context, projectId string, volumeId string) ApiResizeVolumeRequest { + return ApiResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } } -func (a *APIClient) GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, routeId string) (*Route, error) { - r := ApiGetNetworkAreaRouteRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, - routeId: routeId, +func (a *APIClient) ResizeVolumeExecute(ctx context.Context, projectId string, volumeId string) error { + r := ApiResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } return r.Execute() } -type ApiGetOrganizationRequestRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - requestId string +type ApiStartServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { +func (r ApiStartServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Request + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StartServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/requests/{requestId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/start" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.requestId) < 36 { - return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.requestId) > 36 { - return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -2437,7 +13272,7 @@ func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -2451,14 +13286,14 @@ func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2472,138 +13307,138 @@ func (r ApiGetOrganizationRequestRequest) Execute() (*Request, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 500 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return newErr } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -GetOrganizationRequest: Lookup an organization request ID. +StartServer: Boot up a server. -Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. +Start an existing server or allocates the server if deallocated. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param requestId The identifier (ID) of a STACKIT Request. - @return ApiGetOrganizationRequestRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStartServerRequest */ -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) StartServer(ctx context.Context, projectId string, serverId string) ApiStartServerRequest { + return ApiStartServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { - r := ApiGetOrganizationRequestRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - requestId: requestId, +func (a *APIClient) StartServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiStartServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } return r.Execute() } -type ApiGetProjectRequestRequest struct { +type ApiStopServerRequest struct { ctx context.Context apiService *DefaultApiService projectId string - requestId string + serverId string } -func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { +func (r ApiStopServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Request + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StopServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/requests/{requestId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/stop" 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, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.requestId) < 36 { - return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.requestId) > 36 { - return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -2625,7 +13460,7 @@ func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -2639,14 +13474,14 @@ func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2660,138 +13495,138 @@ func (r ApiGetProjectRequestRequest) Execute() (*Request, error) { err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return 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 localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -GetProjectRequest: Lookup a project request ID. +StopServer: Stop an existing server. -Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. +Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The identifier (ID) of a STACKIT Project. - @param requestId The identifier (ID) of a STACKIT Request. - @return ApiGetProjectRequestRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStopServerRequest */ -func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, requestId string) ApiGetProjectRequestRequest { - return ApiGetProjectRequestRequest{ +func (a *APIClient) StopServer(ctx context.Context, projectId string, serverId string) ApiStopServerRequest { + return ApiStopServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - requestId: requestId, + serverId: serverId, } } -func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, requestId string) (*Request, error) { - r := ApiGetProjectRequestRequest{ +func (a *APIClient) StopServerExecute(ctx context.Context, projectId string, serverId string) error { + r := ApiStopServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - requestId: requestId, + serverId: serverId, } return r.Execute() } -type ApiListNetworkAreaProjectsRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiUnrescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string } -func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, error) { +func (r ApiUnrescueServerRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ProjectListResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaProjects") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UnrescueServer") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}/unrescue" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") } // to determine the Content-Type header @@ -2813,7 +13648,7 @@ func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, erro } 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) @@ -2827,14 +13662,14 @@ func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, erro *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 { @@ -2848,142 +13683,162 @@ func (r ApiListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, erro err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 401 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 500 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return newErr } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v } - return localVarReturnValue, newErr + return newErr } - return localVarReturnValue, nil + return nil } /* -ListNetworkAreaProjects: List all projects using a network area. +UnrescueServer: Unrescue an existing server. -Get a list of all projects using a network area. +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 organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiListNetworkAreaProjectsRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest */ -func (a *APIClient) ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest { - return ApiListNetworkAreaProjectsRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, serverId string) ApiUnrescueServerRequest { + return ApiUnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, } } -func (a *APIClient) ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) { - r := ApiListNetworkAreaProjectsRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +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 ApiListNetworkAreaRangesRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiUpdateAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + volumeId string + updateAttachedVolumePayload *UpdateAttachedVolumePayload } -func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, error) { +// 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.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkRangeListResponse + localVarReturnValue *VolumeAttachment ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRanges") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/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.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 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{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2999,6 +13854,8 @@ func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, e 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 @@ -3102,76 +13959,98 @@ func (r ApiListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, e } /* -ListNetworkAreaRanges: List all network ranges in a network area. +UpdateAttachedVolume: Update Volume Attachment Parameters. -Get a list of all network ranges in a network area. +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 organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiListNetworkAreaRangesRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest */ -func (a *APIClient) ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRangesRequest { - return ApiListNetworkAreaRangesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) 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) ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string) (*NetworkRangeListResponse, error) { - r := ApiListNetworkAreaRangesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +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 ApiListNetworkAreaRoutesRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string +type ApiUpdateNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + networkId string + nicId string + updateNICPayload *UpdateNICPayload } -func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { +// Request an update of a network interface. + +func (r ApiUpdateNICRequest) UpdateNICPayload(updateNICPayload UpdateNICPayload) ApiUpdateNICRequest { + r.updateNICPayload = &updateNICPayload + return r +} + +func (r ApiUpdateNICRequest) Execute() (*NIC, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RouteListResponse + localVarReturnValue *NIC ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRoutes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNIC") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{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.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId 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.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + if r.updateNICPayload == nil { + return localVarReturnValue, fmt.Errorf("updateNICPayload 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) @@ -3187,6 +14066,8 @@ func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateNICPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3230,7 +14111,18 @@ func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { + 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 { @@ -3241,7 +14133,7 @@ func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 403 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3252,7 +14144,7 @@ func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3290,68 +14182,90 @@ func (r ApiListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { } /* -ListNetworkAreaRoutes: List all network routes in a network area. +UpdateNIC: Update a network interface. -Get a list of all network routes defined in a network area. +Update the properties of an existing network interface inside a network. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiListNetworkAreaRoutesRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiUpdateNICRequest */ -func (a *APIClient) ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRoutesRequest { - return ApiListNetworkAreaRoutesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) UpdateNIC(ctx context.Context, projectId string, networkId string, nicId string) ApiUpdateNICRequest { + return ApiUpdateNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, } } -func (a *APIClient) ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string) (*RouteListResponse, error) { - r := ApiListNetworkAreaRoutesRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) UpdateNICExecute(ctx context.Context, projectId string, networkId string, nicId string) (*NIC, error) { + r := ApiUpdateNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + networkId: networkId, + nicId: nicId, } return r.Execute() } -type ApiListNetworkAreasRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string +type ApiUpdatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + publicIpId string + updatePublicIPPayload *UpdatePublicIPPayload } -func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) { +// Request an update of a public IP. + +func (r ApiUpdatePublicIPRequest) UpdatePublicIPPayload(updatePublicIPPayload UpdatePublicIPPayload) ApiUpdatePublicIPRequest { + r.updatePublicIPPayload = &updatePublicIPPayload + return r +} + +func (r ApiUpdatePublicIPRequest) Execute() (*PublicIp, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkAreaListResponse + localVarReturnValue *PublicIp ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreas") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdatePublicIP") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.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.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + } + if r.updatePublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("updatePublicIPPayload 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) @@ -3367,6 +14281,8 @@ func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updatePublicIPPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3470,60 +14386,65 @@ func (r ApiListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) } /* -ListNetworkAreas: List all network areas in an organization. +UpdatePublicIP: Update a public IP. -Get a list of all visible network areas defined in an organization. +Update the properties of an existing public IP 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. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiUpdatePublicIPRequest */ -func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { - return ApiListNetworkAreasRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) UpdatePublicIP(ctx context.Context, projectId string, publicIpId string) ApiUpdatePublicIPRequest { + return ApiUpdatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, } } -func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { - r := ApiListNetworkAreasRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, +func (a *APIClient) UpdatePublicIPExecute(ctx context.Context, projectId string, publicIpId string) (*PublicIp, error) { + r := ApiUpdatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + publicIpId: publicIpId, } return r.Execute() } -type ApiListNetworksRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - labelSelector *string +type ApiUpdateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + securityGroupId string + updateSecurityGroupPayload *UpdateSecurityGroupPayload } -// Filter resources by labels. +// Request an update of a security group. -func (r ApiListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { - r.labelSelector = &labelSelector +func (r ApiUpdateSecurityGroupRequest) UpdateSecurityGroupPayload(updateSecurityGroupPayload UpdateSecurityGroupPayload) ApiUpdateSecurityGroupRequest { + r.updateSecurityGroupPayload = &updateSecurityGroupPayload return r } -func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { +func (r ApiUpdateSecurityGroupRequest) Execute() (*SecurityGroup, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkListResponse + localVarReturnValue *SecurityGroup ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateSecurityGroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3534,12 +14455,18 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + if strlen(r.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.updateSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("updateSecurityGroupPayload 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) @@ -3555,6 +14482,8 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateSecurityGroupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3658,79 +14587,83 @@ func (r ApiListNetworksRequest) Execute() (*NetworkListResponse, error) { } /* -ListNetworks: List all networks inside a project. +UpdateSecurityGroup: Update information of a security group. -Get a list of all networks inside a project. +Update labels of the 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. - @return ApiListNetworksRequest + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiUpdateSecurityGroupRequest */ -func (a *APIClient) ListNetworks(ctx context.Context, projectId string) ApiListNetworksRequest { - return ApiListNetworksRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) UpdateSecurityGroup(ctx context.Context, projectId string, securityGroupId string) ApiUpdateSecurityGroupRequest { + return ApiUpdateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } } -func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string) (*NetworkListResponse, error) { - r := ApiListNetworksRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) UpdateSecurityGroupExecute(ctx context.Context, projectId string, securityGroupId string) (*SecurityGroup, error) { + r := ApiUpdateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + securityGroupId: securityGroupId, } return r.Execute() } -type ApiPartialUpdateNetworkRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - networkId string - partialUpdateNetworkPayload *PartialUpdateNetworkPayload +type ApiUpdateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + updateServerPayload *UpdateServerPayload } -// Request an update of a network. +// Request an update of a server. -func (r ApiPartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { - r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload +func (r ApiUpdateServerRequest) UpdateServerPayload(updateServerPayload UpdateServerPayload) ApiUpdateServerRequest { + r.updateServerPayload = &updateServerPayload return r } -func (r ApiPartialUpdateNetworkRequest) Execute() error { +func (r ApiUpdateServerRequest) Execute() (*Server, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateServer") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/projects/{projectId}/networks/{networkId}" + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/servers/{serverId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.networkId) < 36 { - return fmt.Errorf("networkId must have at least 36 elements") + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") } - if strlen(r.networkId) > 36 { - return fmt.Errorf("networkId must have less than 36 elements") + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") } - if r.partialUpdateNetworkPayload == nil { - return fmt.Errorf("partialUpdateNetworkPayload is required and must be specified") + if r.updateServerPayload == nil { + return localVarReturnValue, fmt.Errorf("updateServerPayload is required and must be specified") } // to determine the Content-Type header @@ -3751,10 +14684,10 @@ func (r ApiPartialUpdateNetworkRequest) Execute() error { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.partialUpdateNetworkPayload + localVarPostBody = r.updateServerPayload 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) @@ -3768,14 +14701,14 @@ func (r ApiPartialUpdateNetworkRequest) 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 { @@ -3789,139 +14722,149 @@ func (r ApiPartialUpdateNetworkRequest) 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 } /* -PartialUpdateNetwork: Update network settings. +UpdateServer: Update information of a server. -Update the settings of a network inside a project. +Update name or labels 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 networkId The identifier (ID) of a STACKIT Network. - @return ApiPartialUpdateNetworkRequest + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUpdateServerRequest */ -func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, networkId string) ApiPartialUpdateNetworkRequest { - return ApiPartialUpdateNetworkRequest{ +func (a *APIClient) UpdateServer(ctx context.Context, projectId string, serverId string) ApiUpdateServerRequest { + return ApiUpdateServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, + serverId: serverId, } } -func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, networkId string) error { - r := ApiPartialUpdateNetworkRequest{ +func (a *APIClient) UpdateServerExecute(ctx context.Context, projectId string, serverId string) (*Server, error) { + r := ApiUpdateServerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, - networkId: networkId, + serverId: serverId, } return r.Execute() } -type ApiPartialUpdateNetworkAreaRequest struct { - ctx context.Context - apiService *DefaultApiService - organizationId string - areaId string - partialUpdateNetworkAreaPayload *PartialUpdateNetworkAreaPayload +type ApiUpdateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + volumeId string + updateVolumePayload *UpdateVolumePayload } -// Request to update an Area. +// Request an update of a volume. -func (r ApiPartialUpdateNetworkAreaRequest) PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest { - r.partialUpdateNetworkAreaPayload = &partialUpdateNetworkAreaPayload +func (r ApiUpdateVolumeRequest) UpdateVolumePayload(updateVolumePayload UpdateVolumePayload) ApiUpdateVolumeRequest { + r.updateVolumePayload = &updateVolumePayload return r } -func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { +func (r ApiUpdateVolumeRequest) Execute() (*Volume, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkArea + localVarReturnValue *Volume ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetworkArea") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateVolume") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if strlen(r.organizationId) < 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } - if strlen(r.organizationId) > 36 { - return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if strlen(r.areaId) < 36 { - return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") } - if strlen(r.areaId) > 36 { - return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") } - if r.partialUpdateNetworkAreaPayload == nil { - return localVarReturnValue, fmt.Errorf("partialUpdateNetworkAreaPayload is required and must be specified") + if r.updateVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateVolumePayload is required and must be specified") } // to determine the Content-Type header @@ -3942,7 +14885,7 @@ func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.partialUpdateNetworkAreaPayload + localVarPostBody = r.updateVolumePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -4046,30 +14989,30 @@ func (r ApiPartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { } /* -PartialUpdateNetworkArea: Update network area settings. +UpdateVolume: Update information of a volume. -Update the settings of a network area in an organization. +Update name, description or labels of the volume. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param organizationId The identifier (ID) of a STACKIT Organization. - @param areaId The identifier (ID) of a STACKIT Network Area. - @return ApiPartialUpdateNetworkAreaRequest + @param projectId The identifier (ID) of a STACKIT Project. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateVolumeRequest */ -func (a *APIClient) PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest { - return ApiPartialUpdateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) UpdateVolume(ctx context.Context, projectId string, volumeId string) ApiUpdateVolumeRequest { + return ApiUpdateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } } -func (a *APIClient) PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { - r := ApiPartialUpdateNetworkAreaRequest{ - apiService: a.defaultApi, - ctx: ctx, - organizationId: organizationId, - areaId: areaId, +func (a *APIClient) UpdateVolumeExecute(ctx context.Context, projectId string, volumeId string) (*Volume, error) { + r := ApiUpdateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + volumeId: volumeId, } return r.Execute() } diff --git a/services/iaas/api_default_test.go b/services/iaas/api_default_test.go index 67eca5a8..bcb5c72a 100644 --- a/services/iaas/api_default_test.go +++ b/services/iaas/api_default_test.go @@ -23,6 +23,386 @@ import ( func Test_iaas_DefaultApiService(t *testing.T) { + t.Run("Test DefaultApiService AddNICToServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + 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 AddNetworkToServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + networkId := "networkId" + + reqErr := apiClient.AddNetworkToServer(context.Background(), projectId, serverId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddPublicIpToServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + publicIpId := "publicIpId" + + reqErr := apiClient.AddPublicIpToServer(context.Background(), projectId, serverId, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddSecurityGroupToServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + securityGroupId := "securityGroupId" + + reqErr := apiClient.AddSecurityGroupToServer(context.Background(), projectId, serverId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddServiceAccountToServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + serviceAccountMailValue := "serviceAccountMail" + path = strings.Replace(path, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ServiceAccountMailListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + serviceAccountMail := "serviceAccountMail" + + resp, reqErr := apiClient.AddServiceAccountToServer(context.Background(), projectId, serverId, serviceAccountMail).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService AddVolumeToServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + volumeId := "volumeId" + + resp, reqErr := apiClient.AddVolumeToServer(context.Background(), projectId, serverId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNIC", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := 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 iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + createNICPayload := CreateNICPayload{} + + resp, reqErr := apiClient.CreateNIC(context.Background(), projectId, networkId).CreateNICPayload(createNICPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService CreateNetwork", func(t *testing.T) { path := "/v1beta1/projects/{projectId}/networks" projectIdValue := "projectId" @@ -30,7 +410,2424 @@ func Test_iaas_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Network{} + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + createNetworkPayload := CreateNetworkPayload{} + + resp, reqErr := apiClient.CreateNetwork(context.Background(), projectId).CreateNetworkPayload(createNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + createNetworkAreaPayload := CreateNetworkAreaPayload{} + + resp, reqErr := apiClient.CreateNetworkArea(context.Background(), organizationId).CreateNetworkAreaPayload(createNetworkAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetworkAreaRange", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRangeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + createNetworkAreaRangePayload := CreateNetworkAreaRangePayload{} + + resp, reqErr := apiClient.CreateNetworkAreaRange(context.Background(), organizationId, areaId).CreateNetworkAreaRangePayload(createNetworkAreaRangePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetworkAreaRoute", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + createNetworkAreaRoutePayload := CreateNetworkAreaRoutePayload{} + + resp, reqErr := apiClient.CreateNetworkAreaRoute(context.Background(), organizationId, areaId).CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreatePublicIP", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PublicIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + createPublicIPPayload := CreatePublicIPPayload{} + + resp, reqErr := apiClient.CreatePublicIP(context.Background(), projectId).CreatePublicIPPayload(createPublicIPPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateSecurityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + createSecurityGroupPayload := CreateSecurityGroupPayload{} + + resp, reqErr := apiClient.CreateSecurityGroup(context.Background(), projectId).CreateSecurityGroupPayload(createSecurityGroupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateSecurityGroupRule", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRule{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + securityGroupId := "securityGroupId" + createSecurityGroupRulePayload := CreateSecurityGroupRulePayload{} + + resp, reqErr := apiClient.CreateSecurityGroupRule(context.Background(), projectId, securityGroupId).CreateSecurityGroupRulePayload(createSecurityGroupRulePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers" + 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 := Server{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + createServerPayload := CreateServerPayload{} + + resp, reqErr := apiClient.CreateServer(context.Background(), projectId).CreateServerPayload(createServerPayload).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 := "/v1beta1/projects/{projectId}/volumes" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Volume{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + createVolumePayload := CreateVolumePayload{} + + resp, reqErr := apiClient.CreateVolume(context.Background(), projectId).CreateVolumePayload(createVolumePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeallocateServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/deallocate" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + reqErr := apiClient.DeallocateServer(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNIC", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + nicId := "nicId" + + reqErr := apiClient.DeleteNIC(context.Background(), projectId, networkId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + + reqErr := apiClient.DeleteNetwork(context.Background(), projectId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + + reqErr := apiClient.DeleteNetworkArea(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkAreaRange", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + networkRangeIdValue := "networkRangeId" + path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + networkRangeId := "networkRangeId" + + reqErr := apiClient.DeleteNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkAreaRoute", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + routeIdValue := "routeId" + path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + routeId := "routeId" + + reqErr := apiClient.DeleteNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeletePublicIP", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + publicIpId := "publicIpId" + + reqErr := apiClient.DeletePublicIP(context.Background(), projectId, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSecurityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + securityGroupId := "securityGroupId" + + reqErr := apiClient.DeleteSecurityGroup(context.Background(), projectId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSecurityGroupRule", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + securityGroupRuleIdValue := "securityGroupRuleId" + path = strings.Replace(path, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + securityGroupId := "securityGroupId" + securityGroupRuleId := "securityGroupRuleId" + + reqErr := apiClient.DeleteSecurityGroupRule(context.Background(), projectId, securityGroupId, securityGroupRuleId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + reqErr := apiClient.DeleteServer(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + volumeId := "volumeId" + + reqErr := apiClient.DeleteVolume(context.Background(), projectId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + volumeId := "volumeId" + + resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, serverId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNIC", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + nicId := "nicId" + + 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 GetNetwork", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + + resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + + resp, reqErr := apiClient.GetNetworkArea(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkAreaRange", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + networkRangeIdValue := "networkRangeId" + path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRange{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + networkRangeId := "networkRangeId" + + resp, reqErr := apiClient.GetNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkAreaRoute", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + routeIdValue := "routeId" + path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + routeId := "routeId" + + resp, reqErr := apiClient.GetNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetOrganizationRequest", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/requests/{requestId}" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + requestIdValue := "requestId" + path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Request{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + requestId := "requestId" + + resp, reqErr := apiClient.GetOrganizationRequest(context.Background(), organizationId, requestId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetProjectRequest", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/requests/{requestId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + requestIdValue := "requestId" + path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Request{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + requestId := "requestId" + + resp, reqErr := apiClient.GetProjectRequest(context.Background(), projectId, requestId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetPublicIP", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PublicIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + publicIpId := "publicIpId" + + resp, reqErr := apiClient.GetPublicIP(context.Background(), projectId, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetSecurityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + securityGroupId := "securityGroupId" + + resp, reqErr := apiClient.GetSecurityGroup(context.Background(), projectId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetSecurityGroupRule", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + securityGroupRuleIdValue := "securityGroupRuleId" + path = strings.Replace(path, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRule{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + securityGroupId := "securityGroupId" + securityGroupRuleId := "securityGroupRuleId" + + resp, reqErr := apiClient.GetSecurityGroupRule(context.Background(), projectId, securityGroupId, securityGroupRuleId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Server{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + resp, reqErr := apiClient.GetServer(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServerConsole", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/console" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ServerConsoleUrl{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + resp, reqErr := apiClient.GetServerConsole(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServerLog", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/log" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := GetServerLog200Response{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + resp, reqErr := apiClient.GetServerLog(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Volume{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + volumeId := "volumeId" + + resp, reqErr := apiClient.GetVolume(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 ListAttachedVolumes", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachmentListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + resp, reqErr := apiClient.ListAttachedVolumes(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNICs", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NICListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + + resp, reqErr := apiClient.ListNICs(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 ListNetworkAreaProjects", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ProjectListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + + resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreaRanges", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRangeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + + resp, reqErr := apiClient.ListNetworkAreaRanges(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreaRoutes", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := "areaId" + path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + areaId := "areaId" + + resp, reqErr := apiClient.ListNetworkAreaRoutes(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas" + organizationIdValue := "organizationId" + path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkAreaListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := "organizationId" + + resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NetworkListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListNetworks(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 ListPublicIPs", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PublicIpListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListPublicIPs(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 ListSecurityGroupRules", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}/rules" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRuleListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + securityGroupId := "securityGroupId" + + resp, reqErr := apiClient.ListSecurityGroupRules(context.Background(), projectId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListSecurityGroups", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListSecurityGroups(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 ListServerNICs", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := NICListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -64,9 +2861,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - createNetworkPayload := CreateNetworkPayload{} + serverId := "serverId" - resp, reqErr := apiClient.CreateNetwork(context.Background(), projectId).CreateNetworkPayload(createNetworkPayload).Execute() + resp, reqErr := apiClient.ListServerNICs(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -76,14 +2873,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService CreateNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + t.Run("Test DefaultApiService ListServerServiceAccounts", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkArea{} + data := ServiceAccountMailListResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -116,10 +2915,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - createNetworkAreaPayload := CreateNetworkAreaPayload{} + projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.CreateNetworkArea(context.Background(), organizationId).CreateNetworkAreaPayload(createNetworkAreaPayload).Execute() + resp, reqErr := apiClient.ListServerServiceAccounts(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -129,8 +2928,162 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService CreateNetworkAreaRange", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + t.Run("Test DefaultApiService ListServers", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ServerListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListServers(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 ListVolumes", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := VolumeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListVolumes(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 PartialUpdateNetwork", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + networkId := "networkId" + partialUpdateNetworkPayload := PartialUpdateNetworkPayload{} + + reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService PartialUpdateNetworkArea", func(t *testing.T) { + path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" organizationIdValue := "organizationId" path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) areaIdValue := "areaId" @@ -138,7 +3091,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkRangeListResponse{} + data := NetworkArea{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -173,9 +3126,9 @@ func Test_iaas_DefaultApiService(t *testing.T) { organizationId := "organizationId" areaId := "areaId" - createNetworkAreaRangePayload := CreateNetworkAreaRangePayload{} + partialUpdateNetworkAreaPayload := PartialUpdateNetworkAreaPayload{} - resp, reqErr := apiClient.CreateNetworkAreaRange(context.Background(), organizationId, areaId).CreateNetworkAreaRangePayload(createNetworkAreaRangePayload).Execute() + resp, reqErr := apiClient.PartialUpdateNetworkArea(context.Background(), organizationId, areaId).PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -185,18 +3138,66 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService CreateNetworkAreaRoute", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService RebootServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/reboot" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + serverId := "serverId" + + reqErr := apiClient.RebootServer(context.Background(), projectId, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RemoveNICFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := RouteListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -227,24 +3228,23 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - createNetworkAreaRoutePayload := CreateNetworkAreaRoutePayload{} + projectId := "projectId" + serverId := "serverId" + nicId := "nicId" - resp, reqErr := apiClient.CreateNetworkAreaRoute(context.Background(), organizationId, areaId).CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload).Execute() + reqErr := apiClient.RemoveNICFromServer(context.Background(), projectId, serverId, nicId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}" + t.Run("Test DefaultApiService RemoveNetworkFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/networks/{networkId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) networkIdValue := "networkId" path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) @@ -281,21 +3281,24 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" + serverId := "serverId" networkId := "networkId" - reqErr := apiClient.DeleteNetwork(context.Background(), projectId, networkId).Execute() + reqErr := apiClient.RemoveNetworkFromServer(context.Background(), projectId, serverId, networkId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService RemovePublicIpFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -329,24 +3332,25 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + serverId := "serverId" + publicIpId := "publicIpId" - reqErr := apiClient.DeleteNetworkArea(context.Background(), organizationId, areaId).Execute() + reqErr := apiClient.RemovePublicIpFromServer(context.Background(), projectId, serverId, publicIpId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetworkAreaRange", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - networkRangeIdValue := "networkRangeId" - path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + t.Run("Test DefaultApiService RemoveSecurityGroupFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { @@ -380,28 +3384,31 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - networkRangeId := "networkRangeId" + projectId := "projectId" + serverId := "serverId" + securityGroupId := "securityGroupId" - reqErr := apiClient.DeleteNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + reqErr := apiClient.RemoveSecurityGroupFromServer(context.Background(), projectId, serverId, securityGroupId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } }) - t.Run("Test DefaultApiService DeleteNetworkAreaRoute", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - routeIdValue := "routeId" - path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + t.Run("Test DefaultApiService RemoveServiceAccountFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + serviceAccountMailValue := "serviceAccountMail" + path = strings.Replace(path, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ServiceAccountMailListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -432,29 +3439,31 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - routeId := "routeId" + projectId := "projectId" + serverId := "serverId" + serviceAccountMail := "serviceAccountMail" - reqErr := apiClient.DeleteNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + resp, reqErr := apiClient.RemoveServiceAccountFromServer(context.Background(), projectId, serverId, serviceAccountMail).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}" + t.Run("Test DefaultApiService RemoveVolumeFromServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + 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 := Network{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -486,30 +3495,25 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" + serverId := "serverId" + volumeId := "volumeId" - resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, networkId).Execute() + reqErr := apiClient.RemoveVolumeFromServer(context.Background(), projectId, serverId, volumeId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService GetNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService RescueServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/rescue" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkArea{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -540,33 +3544,26 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + serverId := "serverId" + rescueServerPayload := RescueServerPayload{} - resp, reqErr := apiClient.GetNetworkArea(context.Background(), organizationId, areaId).Execute() + reqErr := apiClient.RescueServer(context.Background(), projectId, serverId).RescueServerPayload(rescueServerPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService GetNetworkAreaRange", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - networkRangeIdValue := "networkRangeId" - path = strings.Replace(path, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + t.Run("Test DefaultApiService ResizeServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/resize" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkRange{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -597,34 +3594,26 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - networkRangeId := "networkRangeId" + projectId := "projectId" + serverId := "serverId" + resizeServerPayload := ResizeServerPayload{} - resp, reqErr := apiClient.GetNetworkAreaRange(context.Background(), organizationId, areaId, networkRangeId).Execute() + reqErr := apiClient.ResizeServer(context.Background(), projectId, serverId).ResizeServerPayload(resizeServerPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService GetNetworkAreaRoute", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) - routeIdValue := "routeId" - path = strings.Replace(path, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + t.Run("Test DefaultApiService ResizeVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}/resize" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + 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 := Route{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -655,32 +3644,25 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - routeId := "routeId" + projectId := "projectId" + volumeId := "volumeId" - resp, reqErr := apiClient.GetNetworkAreaRoute(context.Background(), organizationId, areaId, routeId).Execute() + reqErr := apiClient.ResizeVolume(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 GetOrganizationRequest", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/requests/{requestId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - requestIdValue := "requestId" - path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + t.Run("Test DefaultApiService StartServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/start" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Request{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -711,31 +3693,25 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - requestId := "requestId" + projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.GetOrganizationRequest(context.Background(), organizationId, requestId).Execute() + reqErr := apiClient.StartServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService GetProjectRequest", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/requests/{requestId}" + t.Run("Test DefaultApiService StopServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/stop" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - requestIdValue := "requestId" - path = strings.Replace(path, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Request{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -767,30 +3743,24 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - requestId := "requestId" + serverId := "serverId" - resp, reqErr := apiClient.GetProjectRequest(context.Background(), projectId, requestId).Execute() + reqErr := apiClient.StopServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService ListNetworkAreaProjects", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/projects" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService UnrescueServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/unrescue" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ProjectListResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -821,29 +3791,28 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + serverId := "serverId" - resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() + reqErr := apiClient.UnrescueServer(context.Background(), projectId, serverId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } - if resp == nil { - t.Fatalf("response not present") - } }) - t.Run("Test DefaultApiService ListNetworkAreaRanges", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService UpdateAttachedVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkRangeListResponse{} + data := VolumeAttachment{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -876,10 +3845,12 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + serverId := "serverId" + volumeId := "volumeId" + updateAttachedVolumePayload := UpdateAttachedVolumePayload{} - resp, reqErr := apiClient.ListNetworkAreaRanges(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.UpdateAttachedVolume(context.Background(), projectId, serverId, volumeId).UpdateAttachedVolumePayload(updateAttachedVolumePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -889,16 +3860,18 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreaRoutes", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}/routes" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService UpdateNIC", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + networkIdValue := "networkId" + path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := "nicId" + path = strings.Replace(path, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := RouteListResponse{} + data := NIC{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -931,10 +3904,12 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" + projectId := "projectId" + networkId := "networkId" + nicId := "nicId" + updateNICPayload := UpdateNICPayload{} - resp, reqErr := apiClient.ListNetworkAreaRoutes(context.Background(), organizationId, areaId).Execute() + resp, reqErr := apiClient.UpdateNIC(context.Background(), projectId, networkId, nicId).UpdateNICPayload(updateNICPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -944,14 +3919,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + t.Run("Test DefaultApiService UpdatePublicIP", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/public-ips/{publicIpId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + publicIpIdValue := "publicIpId" + path = strings.Replace(path, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkAreaListResponse{} + data := PublicIp{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -984,9 +3961,11 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" + projectId := "projectId" + publicIpId := "publicIpId" + updatePublicIPPayload := UpdatePublicIPPayload{} - resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() + resp, reqErr := apiClient.UpdatePublicIP(context.Background(), projectId, publicIpId).UpdatePublicIPPayload(updatePublicIPPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -996,14 +3975,16 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks" + t.Run("Test DefaultApiService UpdateSecurityGroup", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/security-groups/{securityGroupId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + securityGroupIdValue := "securityGroupId" + path = strings.Replace(path, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkListResponse{} + data := SecurityGroup{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1037,8 +4018,10 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" + securityGroupId := "securityGroupId" + updateSecurityGroupPayload := UpdateSecurityGroupPayload{} - resp, reqErr := apiClient.ListNetworks(context.Background(), projectId).Execute() + resp, reqErr := apiClient.UpdateSecurityGroup(context.Background(), projectId, securityGroupId).UpdateSecurityGroupPayload(updateSecurityGroupPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1048,15 +4031,18 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService PartialUpdateNetwork", func(t *testing.T) { - path := "/v1beta1/projects/{projectId}/networks/{networkId}" + t.Run("Test DefaultApiService UpdateServer", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/servers/{serverId}" projectIdValue := "projectId" path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - networkIdValue := "networkId" - path = strings.Replace(path, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + serverIdValue := "serverId" + path = strings.Replace(path, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := Server{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1088,26 +4074,29 @@ func Test_iaas_DefaultApiService(t *testing.T) { } projectId := "projectId" - networkId := "networkId" - partialUpdateNetworkPayload := PartialUpdateNetworkPayload{} + serverId := "serverId" + updateServerPayload := UpdateServerPayload{} - reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute() + resp, reqErr := apiClient.UpdateServer(context.Background(), projectId, serverId).UpdateServerPayload(updateServerPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) } + if resp == nil { + t.Fatalf("response not present") + } }) - t.Run("Test DefaultApiService PartialUpdateNetworkArea", func(t *testing.T) { - path := "/v1beta1/organizations/{organizationId}/network-areas/{areaId}" - organizationIdValue := "organizationId" - path = strings.Replace(path, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - areaIdValue := "areaId" - path = strings.Replace(path, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + t.Run("Test DefaultApiService UpdateVolume", func(t *testing.T) { + path := "/v1beta1/projects/{projectId}/volumes/{volumeId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + volumeIdValue := "volumeId" + path = strings.Replace(path, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := NetworkArea{} + data := Volume{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1140,11 +4129,11 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - organizationId := "organizationId" - areaId := "areaId" - partialUpdateNetworkAreaPayload := PartialUpdateNetworkAreaPayload{} + projectId := "projectId" + volumeId := "volumeId" + updateVolumePayload := UpdateVolumePayload{} - resp, reqErr := apiClient.PartialUpdateNetworkArea(context.Background(), organizationId, areaId).PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload).Execute() + resp, reqErr := apiClient.UpdateVolume(context.Background(), projectId, volumeId).UpdateVolumePayload(updateVolumePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) diff --git a/services/iaas/model_add_volume_to_server_payload.go b/services/iaas/model_add_volume_to_server_payload.go new file mode 100644 index 00000000..2649cd96 --- /dev/null +++ b/services/iaas/model_add_volume_to_server_payload.go @@ -0,0 +1,195 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AddVolumeToServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddVolumeToServerPayload{} + +// AddVolumeToServerPayload Object that represents a Volume attachment to a server. +type AddVolumeToServerPayload struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId *string `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId *string `json:"volumeId,omitempty"` +} + +// NewAddVolumeToServerPayload instantiates a new AddVolumeToServerPayload 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 NewAddVolumeToServerPayload() *AddVolumeToServerPayload { + this := AddVolumeToServerPayload{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// NewAddVolumeToServerPayloadWithDefaults instantiates a new AddVolumeToServerPayload 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 NewAddVolumeToServerPayloadWithDefaults() *AddVolumeToServerPayload { + this := AddVolumeToServerPayload{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetDeleteOnTermination() *bool { + if o == nil || IsNil(o.DeleteOnTermination) { + var ret *bool + return ret + } + return o.DeleteOnTermination +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetDeleteOnTerminationOk() (*bool, bool) { + if o == nil || IsNil(o.DeleteOnTermination) { + return nil, false + } + return o.DeleteOnTermination, true +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasDeleteOnTermination() bool { + if o != nil && !IsNil(o.DeleteOnTermination) { + return true + } + + return false +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *AddVolumeToServerPayload) SetDeleteOnTermination(v *bool) { + o.DeleteOnTermination = v +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetServerId() *string { + if o == nil || IsNil(o.ServerId) { + var ret *string + return ret + } + return o.ServerId +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetServerIdOk() (*string, bool) { + if o == nil || IsNil(o.ServerId) { + return nil, false + } + return o.ServerId, true +} + +// HasServerId returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasServerId() bool { + if o != nil && !IsNil(o.ServerId) { + return true + } + + return false +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *AddVolumeToServerPayload) SetServerId(v *string) { + o.ServerId = v +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + return o.VolumeId +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetVolumeIdOk() (*string, bool) { + if o == nil || IsNil(o.VolumeId) { + return nil, false + } + return o.VolumeId, true +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasVolumeId() bool { + if o != nil && !IsNil(o.VolumeId) { + return true + } + + return false +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *AddVolumeToServerPayload) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o AddVolumeToServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeleteOnTermination) { + toSerialize["deleteOnTermination"] = o.DeleteOnTermination + } + if !IsNil(o.ServerId) { + toSerialize["serverId"] = o.ServerId + } + if !IsNil(o.VolumeId) { + toSerialize["volumeId"] = o.VolumeId + } + return toSerialize, nil +} + +type NullableAddVolumeToServerPayload struct { + value *AddVolumeToServerPayload + isSet bool +} + +func (v NullableAddVolumeToServerPayload) Get() *AddVolumeToServerPayload { + return v.value +} + +func (v *NullableAddVolumeToServerPayload) Set(val *AddVolumeToServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddVolumeToServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddVolumeToServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddVolumeToServerPayload(val *AddVolumeToServerPayload) *NullableAddVolumeToServerPayload { + return &NullableAddVolumeToServerPayload{value: val, isSet: true} +} + +func (v NullableAddVolumeToServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddVolumeToServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_allowed_addresses_inner.go b/services/iaas/model_allowed_addresses_inner.go new file mode 100644 index 00000000..e590b6eb --- /dev/null +++ b/services/iaas/model_allowed_addresses_inner.go @@ -0,0 +1,115 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// AllowedAddressesInner - struct for AllowedAddressesInner +type AllowedAddressesInner struct { + String *string +} + +// stringAsAllowedAddressesInner is a convenience function that returns string wrapped in AllowedAddressesInner +func StringAsAllowedAddressesInner(v *string) AllowedAddressesInner { + return AllowedAddressesInner{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *AllowedAddressesInner) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + match++ + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(AllowedAddressesInner)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(AllowedAddressesInner)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src AllowedAddressesInner) MarshalJSON() ([]byte, error) { + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *AllowedAddressesInner) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableAllowedAddressesInner struct { + value *AllowedAddressesInner + isSet bool +} + +func (v NullableAllowedAddressesInner) Get() *AllowedAddressesInner { + return v.value +} + +func (v *NullableAllowedAddressesInner) Set(val *AllowedAddressesInner) { + v.value = val + v.isSet = true +} + +func (v NullableAllowedAddressesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableAllowedAddressesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAllowedAddressesInner(val *AllowedAddressesInner) *NullableAllowedAddressesInner { + return &NullableAllowedAddressesInner{value: val, isSet: true} +} + +func (v NullableAllowedAddressesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAllowedAddressesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_base_security_group_rule.go b/services/iaas/model_base_security_group_rule.go new file mode 100644 index 00000000..9f3e03fe --- /dev/null +++ b/services/iaas/model_base_security_group_rule.go @@ -0,0 +1,409 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BaseSecurityGroupRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseSecurityGroupRule{} + +// BaseSecurityGroupRule The base schema for a security group rule. +type BaseSecurityGroupRule struct { + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // The direction of the traffic which the rule should match. + // REQUIRED + Direction *string `json:"direction"` + // The ethertype which the rule should match. + Ethertype *string `json:"ethertype,omitempty"` + IcmpParameters *ICMPParameters `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange *string `json:"ipRange,omitempty"` + PortRange *PortRange `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId *string `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId *string `json:"securityGroupId,omitempty"` +} + +type _BaseSecurityGroupRule BaseSecurityGroupRule + +// NewBaseSecurityGroupRule instantiates a new BaseSecurityGroupRule 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 NewBaseSecurityGroupRule(direction *string) *BaseSecurityGroupRule { + this := BaseSecurityGroupRule{} + this.Direction = direction + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// NewBaseSecurityGroupRuleWithDefaults instantiates a new BaseSecurityGroupRule 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 NewBaseSecurityGroupRuleWithDefaults() *BaseSecurityGroupRule { + this := BaseSecurityGroupRule{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) 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 *BaseSecurityGroupRule) 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 *BaseSecurityGroupRule) 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 *BaseSecurityGroupRule) SetDescription(v *string) { + o.Description = v +} + +// GetDirection returns the Direction field value +func (o *BaseSecurityGroupRule) GetDirection() *string { + if o == nil { + var ret *string + return ret + } + + return o.Direction +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetDirectionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Direction, true +} + +// SetDirection sets field value +func (o *BaseSecurityGroupRule) SetDirection(v *string) { + o.Direction = v +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetEthertype() *string { + if o == nil || IsNil(o.Ethertype) { + var ret *string + return ret + } + return o.Ethertype +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetEthertypeOk() (*string, bool) { + if o == nil || IsNil(o.Ethertype) { + return nil, false + } + return o.Ethertype, true +} + +// HasEthertype returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasEthertype() bool { + if o != nil && !IsNil(o.Ethertype) { + return true + } + + return false +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *BaseSecurityGroupRule) SetEthertype(v *string) { + o.Ethertype = v +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetIcmpParameters() *ICMPParameters { + if o == nil || IsNil(o.IcmpParameters) { + var ret *ICMPParameters + return ret + } + return o.IcmpParameters +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIcmpParametersOk() (*ICMPParameters, bool) { + if o == nil || IsNil(o.IcmpParameters) { + return nil, false + } + return o.IcmpParameters, true +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasIcmpParameters() bool { + if o != nil && !IsNil(o.IcmpParameters) { + return true + } + + return false +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *BaseSecurityGroupRule) SetIcmpParameters(v *ICMPParameters) { + o.IcmpParameters = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) 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 *BaseSecurityGroupRule) 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 *BaseSecurityGroupRule) 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 *BaseSecurityGroupRule) SetId(v *string) { + o.Id = v +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetIpRange() *string { + if o == nil || IsNil(o.IpRange) { + var ret *string + return ret + } + return o.IpRange +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIpRangeOk() (*string, bool) { + if o == nil || IsNil(o.IpRange) { + return nil, false + } + return o.IpRange, true +} + +// HasIpRange returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasIpRange() bool { + if o != nil && !IsNil(o.IpRange) { + return true + } + + return false +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *BaseSecurityGroupRule) SetIpRange(v *string) { + o.IpRange = v +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetPortRange() *PortRange { + if o == nil || IsNil(o.PortRange) { + var ret *PortRange + return ret + } + return o.PortRange +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetPortRangeOk() (*PortRange, bool) { + if o == nil || IsNil(o.PortRange) { + return nil, false + } + return o.PortRange, true +} + +// HasPortRange returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasPortRange() bool { + if o != nil && !IsNil(o.PortRange) { + return true + } + + return false +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *BaseSecurityGroupRule) SetPortRange(v *PortRange) { + o.PortRange = v +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetRemoteSecurityGroupId() *string { + if o == nil || IsNil(o.RemoteSecurityGroupId) { + var ret *string + return ret + } + return o.RemoteSecurityGroupId +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetRemoteSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.RemoteSecurityGroupId) { + return nil, false + } + return o.RemoteSecurityGroupId, true +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasRemoteSecurityGroupId() bool { + if o != nil && !IsNil(o.RemoteSecurityGroupId) { + return true + } + + return false +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *BaseSecurityGroupRule) SetRemoteSecurityGroupId(v *string) { + o.RemoteSecurityGroupId = v +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetSecurityGroupId() *string { + if o == nil || IsNil(o.SecurityGroupId) { + var ret *string + return ret + } + return o.SecurityGroupId +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.SecurityGroupId) { + return nil, false + } + return o.SecurityGroupId, true +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasSecurityGroupId() bool { + if o != nil && !IsNil(o.SecurityGroupId) { + return true + } + + return false +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *BaseSecurityGroupRule) SetSecurityGroupId(v *string) { + o.SecurityGroupId = v +} + +func (o BaseSecurityGroupRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["direction"] = o.Direction + if !IsNil(o.Ethertype) { + toSerialize["ethertype"] = o.Ethertype + } + if !IsNil(o.IcmpParameters) { + toSerialize["icmpParameters"] = o.IcmpParameters + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpRange) { + toSerialize["ipRange"] = o.IpRange + } + if !IsNil(o.PortRange) { + toSerialize["portRange"] = o.PortRange + } + if !IsNil(o.RemoteSecurityGroupId) { + toSerialize["remoteSecurityGroupId"] = o.RemoteSecurityGroupId + } + if !IsNil(o.SecurityGroupId) { + toSerialize["securityGroupId"] = o.SecurityGroupId + } + return toSerialize, nil +} + +type NullableBaseSecurityGroupRule struct { + value *BaseSecurityGroupRule + isSet bool +} + +func (v NullableBaseSecurityGroupRule) Get() *BaseSecurityGroupRule { + return v.value +} + +func (v *NullableBaseSecurityGroupRule) Set(val *BaseSecurityGroupRule) { + v.value = val + v.isSet = true +} + +func (v NullableBaseSecurityGroupRule) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseSecurityGroupRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseSecurityGroupRule(val *BaseSecurityGroupRule) *NullableBaseSecurityGroupRule { + return &NullableBaseSecurityGroupRule{value: val, isSet: true} +} + +func (v NullableBaseSecurityGroupRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseSecurityGroupRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_boot_volume.go b/services/iaas/model_boot_volume.go new file mode 100644 index 00000000..1fb2b1aa --- /dev/null +++ b/services/iaas/model_boot_volume.go @@ -0,0 +1,268 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootVolume{} + +// BootVolume The boot device for the server. +type BootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass *string `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + Source *BootVolumeSource `json:"source,omitempty"` +} + +// NewBootVolume instantiates a new BootVolume 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 NewBootVolume() *BootVolume { + this := BootVolume{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// NewBootVolumeWithDefaults instantiates a new BootVolume 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 NewBootVolumeWithDefaults() *BootVolume { + this := BootVolume{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *BootVolume) GetDeleteOnTermination() *bool { + if o == nil || IsNil(o.DeleteOnTermination) { + var ret *bool + return ret + } + return o.DeleteOnTermination +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetDeleteOnTerminationOk() (*bool, bool) { + if o == nil || IsNil(o.DeleteOnTermination) { + return nil, false + } + return o.DeleteOnTermination, true +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *BootVolume) HasDeleteOnTermination() bool { + if o != nil && !IsNil(o.DeleteOnTermination) { + return true + } + + return false +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *BootVolume) SetDeleteOnTermination(v *bool) { + o.DeleteOnTermination = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BootVolume) 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 *BootVolume) 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 *BootVolume) 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 *BootVolume) SetId(v *string) { + o.Id = v +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *BootVolume) GetPerformanceClass() *string { + if o == nil || IsNil(o.PerformanceClass) { + var ret *string + return ret + } + return o.PerformanceClass +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetPerformanceClassOk() (*string, bool) { + if o == nil || IsNil(o.PerformanceClass) { + return nil, false + } + return o.PerformanceClass, true +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *BootVolume) HasPerformanceClass() bool { + if o != nil && !IsNil(o.PerformanceClass) { + return true + } + + return false +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *BootVolume) SetPerformanceClass(v *string) { + o.PerformanceClass = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *BootVolume) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *BootVolume) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *BootVolume) SetSize(v *int64) { + o.Size = v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *BootVolume) GetSource() *BootVolumeSource { + if o == nil || IsNil(o.Source) { + var ret *BootVolumeSource + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetSourceOk() (*BootVolumeSource, bool) { + if o == nil || IsNil(o.Source) { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *BootVolume) HasSource() bool { + if o != nil && !IsNil(o.Source) { + return true + } + + return false +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *BootVolume) SetSource(v *BootVolumeSource) { + o.Source = v +} + +func (o BootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeleteOnTermination) { + toSerialize["deleteOnTermination"] = o.DeleteOnTermination + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.PerformanceClass) { + toSerialize["performanceClass"] = o.PerformanceClass + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Source) { + toSerialize["source"] = o.Source + } + return toSerialize, nil +} + +type NullableBootVolume struct { + value *BootVolume + isSet bool +} + +func (v NullableBootVolume) Get() *BootVolume { + return v.value +} + +func (v *NullableBootVolume) Set(val *BootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootVolume(val *BootVolume) *NullableBootVolume { + return &NullableBootVolume{value: val, isSet: true} +} + +func (v NullableBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_boot_volume_source.go b/services/iaas/model_boot_volume_source.go new file mode 100644 index 00000000..d89bad49 --- /dev/null +++ b/services/iaas/model_boot_volume_source.go @@ -0,0 +1,140 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BootVolumeSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootVolumeSource{} + +// BootVolumeSource struct for BootVolumeSource +type BootVolumeSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id *string `json:"id"` + // The source types of a boot volume. + // REQUIRED + Type *string `json:"type"` +} + +type _BootVolumeSource BootVolumeSource + +// NewBootVolumeSource instantiates a new BootVolumeSource 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 NewBootVolumeSource(id *string, type_ *string) *BootVolumeSource { + this := BootVolumeSource{} + this.Id = id + this.Type = type_ + return &this +} + +// NewBootVolumeSourceWithDefaults instantiates a new BootVolumeSource 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 NewBootVolumeSourceWithDefaults() *BootVolumeSource { + this := BootVolumeSource{} + return &this +} + +// GetId returns the Id field value +func (o *BootVolumeSource) 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 *BootVolumeSource) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *BootVolumeSource) SetId(v *string) { + o.Id = v +} + +// GetType returns the Type field value +func (o *BootVolumeSource) GetType() *string { + if o == nil { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BootVolumeSource) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *BootVolumeSource) SetType(v *string) { + o.Type = v +} + +func (o BootVolumeSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableBootVolumeSource struct { + value *BootVolumeSource + isSet bool +} + +func (v NullableBootVolumeSource) Get() *BootVolumeSource { + return v.value +} + +func (v *NullableBootVolumeSource) Set(val *BootVolumeSource) { + v.value = val + v.isSet = true +} + +func (v NullableBootVolumeSource) IsSet() bool { + return v.isSet +} + +func (v *NullableBootVolumeSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootVolumeSource(val *BootVolumeSource) *NullableBootVolumeSource { + return &NullableBootVolumeSource{value: val, isSet: true} +} + +func (v NullableBootVolumeSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootVolumeSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_network_ipv4_body.go b/services/iaas/model_create_network_ipv4_body.go index 20952737..77af598d 100644 --- a/services/iaas/model_create_network_ipv4_body.go +++ b/services/iaas/model_create_network_ipv4_body.go @@ -19,7 +19,8 @@ var _ MappedNullable = &CreateNetworkIPv4Body{} // CreateNetworkIPv4Body The config object for an IPv4 network. type CreateNetworkIPv4Body struct { - Gateway *NullableV1NetworkGateway `json:"gateway,omitempty"` + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway *NullableString `json:"gateway,omitempty"` // A list containing DNS Servers/Nameservers for IPv4. Nameservers *[]string `json:"nameservers,omitempty"` // Classless Inter-Domain Routing (CIDR). @@ -45,9 +46,9 @@ func NewCreateNetworkIPv4BodyWithDefaults() *CreateNetworkIPv4Body { } // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *CreateNetworkIPv4Body) GetGateway() *V1NetworkGateway { +func (o *CreateNetworkIPv4Body) GetGateway() *string { if o == nil || IsNil(o.Gateway.Get()) { - var ret *V1NetworkGateway + var ret *string return ret } return o.Gateway.Get() @@ -56,7 +57,7 @@ func (o *CreateNetworkIPv4Body) GetGateway() *V1NetworkGateway { // GetGatewayOk returns a tuple with the Gateway 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 *CreateNetworkIPv4Body) GetGatewayOk() (*V1NetworkGateway, bool) { +func (o *CreateNetworkIPv4Body) GetGatewayOk() (*string, bool) { if o == nil { return nil, false } @@ -72,8 +73,8 @@ func (o *CreateNetworkIPv4Body) HasGateway() bool { return false } -// SetGateway gets a reference to the given V1NetworkGateway and assigns it to the Gateway field. -func (o *CreateNetworkIPv4Body) SetGateway(v *V1NetworkGateway) { +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv4Body) SetGateway(v *string) { o.Gateway.Set(v) } diff --git a/services/iaas/model_create_network_ipv6_body.go b/services/iaas/model_create_network_ipv6_body.go index afc80c15..d3fd0b2a 100644 --- a/services/iaas/model_create_network_ipv6_body.go +++ b/services/iaas/model_create_network_ipv6_body.go @@ -19,7 +19,8 @@ var _ MappedNullable = &CreateNetworkIPv6Body{} // CreateNetworkIPv6Body The config object for an IPv6 network. type CreateNetworkIPv6Body struct { - Gateway *NullableV1NetworkGateway `json:"gateway,omitempty"` + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway *NullableString `json:"gateway,omitempty"` // A list containing DNS Servers/Nameservers for IPv6. Nameservers *[]string `json:"nameservers,omitempty"` // Classless Inter-Domain Routing (CIDR) for IPv6. @@ -45,9 +46,9 @@ func NewCreateNetworkIPv6BodyWithDefaults() *CreateNetworkIPv6Body { } // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *CreateNetworkIPv6Body) GetGateway() *V1NetworkGateway { +func (o *CreateNetworkIPv6Body) GetGateway() *string { if o == nil || IsNil(o.Gateway.Get()) { - var ret *V1NetworkGateway + var ret *string return ret } return o.Gateway.Get() @@ -56,7 +57,7 @@ func (o *CreateNetworkIPv6Body) GetGateway() *V1NetworkGateway { // GetGatewayOk returns a tuple with the Gateway 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 *CreateNetworkIPv6Body) GetGatewayOk() (*V1NetworkGateway, bool) { +func (o *CreateNetworkIPv6Body) GetGatewayOk() (*string, bool) { if o == nil { return nil, false } @@ -72,8 +73,8 @@ func (o *CreateNetworkIPv6Body) HasGateway() bool { return false } -// SetGateway gets a reference to the given V1NetworkGateway and assigns it to the Gateway field. -func (o *CreateNetworkIPv6Body) SetGateway(v *V1NetworkGateway) { +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv6Body) SetGateway(v *string) { o.Gateway.Set(v) } diff --git a/services/iaas/model_create_nic_payload.go b/services/iaas/model_create_nic_payload.go new file mode 100644 index 00000000..92d7a59b --- /dev/null +++ b/services/iaas/model_create_nic_payload.go @@ -0,0 +1,563 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNICPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNICPayload{} + +// 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). + Device *string `json:"device,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents an IP address. + Ipv4 *string `json:"ipv4,omitempty"` + // Object that represents an IPv6 address. + Ipv6 *string `json:"ipv6,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Object that represents an MAC address. + Mac *string `json:"mac,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + NetworkId *string `json:"networkId,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity *bool `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups *[]string `json:"securityGroups,omitempty"` + Status *string `json:"status,omitempty"` + Type *string `json:"type,omitempty"` +} + +// 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{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// 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{} + 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 { + if o == nil || IsNil(o.AllowedAddresses) { + var ret *[]AllowedAddressesInner + return ret + } + return o.AllowedAddresses +} + +// 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) { + if o == nil || IsNil(o.AllowedAddresses) { + return nil, false + } + return o.AllowedAddresses, true +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *CreateNICPayload) HasAllowedAddresses() bool { + if o != nil && !IsNil(o.AllowedAddresses) { + return true + } + + return false +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +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 { + if o == nil || IsNil(o.Device) { + var ret *string + return ret + } + return o.Device +} + +// 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) { + if o == nil || IsNil(o.Device) { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *CreateNICPayload) HasDevice() bool { + if o != nil && !IsNil(o.Device) { + return true + } + + return false +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +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 { + 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 *CreateNICPayload) 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 *CreateNICPayload) 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 *CreateNICPayload) SetId(v *string) { + o.Id = v +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNICPayload) GetIpv4() *string { + if o == nil || IsNil(o.Ipv4) { + var ret *string + return ret + } + return o.Ipv4 +} + +// 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) { + if o == nil || IsNil(o.Ipv4) { + return nil, false + } + return o.Ipv4, true +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNICPayload) HasIpv4() bool { + if o != nil && !IsNil(o.Ipv4) { + return true + } + + return false +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +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 { + if o == nil || IsNil(o.Ipv6) { + var ret *string + return ret + } + return o.Ipv6 +} + +// 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) { + if o == nil || IsNil(o.Ipv6) { + return nil, false + } + return o.Ipv6, true +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNICPayload) HasIpv6() bool { + if o != nil && !IsNil(o.Ipv6) { + return true + } + + return false +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +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{} { + 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 *CreateNICPayload) 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 *CreateNICPayload) 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 *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 { + if o == nil || IsNil(o.Mac) { + var ret *string + return ret + } + return o.Mac +} + +// 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) { + if o == nil || IsNil(o.Mac) { + return nil, false + } + return o.Mac, true +} + +// HasMac returns a boolean if a field has been set. +func (o *CreateNICPayload) HasMac() bool { + if o != nil && !IsNil(o.Mac) { + return true + } + + return false +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +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 { + 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 *CreateNICPayload) 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 *CreateNICPayload) 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 *CreateNICPayload) SetName(v *string) { + o.Name = v +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *CreateNICPayload) GetNetworkId() *string { + if o == nil || IsNil(o.NetworkId) { + var ret *string + return ret + } + return o.NetworkId +} + +// 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) { + if o == nil || IsNil(o.NetworkId) { + return nil, false + } + return o.NetworkId, true +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *CreateNICPayload) HasNetworkId() bool { + if o != nil && !IsNil(o.NetworkId) { + return true + } + + return false +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +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 { + if o == nil || IsNil(o.NicSecurity) { + var ret *bool + return ret + } + return o.NicSecurity +} + +// 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) { + if o == nil || IsNil(o.NicSecurity) { + return nil, false + } + return o.NicSecurity, true +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *CreateNICPayload) HasNicSecurity() bool { + if o != nil && !IsNil(o.NicSecurity) { + return true + } + + return false +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +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 { + if o == nil || IsNil(o.SecurityGroups) { + var ret *[]string + return ret + } + return o.SecurityGroups +} + +// 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) { + if o == nil || IsNil(o.SecurityGroups) { + return nil, false + } + return o.SecurityGroups, true +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *CreateNICPayload) HasSecurityGroups() bool { + if o != nil && !IsNil(o.SecurityGroups) { + return true + } + + return false +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +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 { + 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 *CreateNICPayload) 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 *CreateNICPayload) 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 *CreateNICPayload) SetStatus(v *string) { + o.Status = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CreateNICPayload) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNICPayload) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CreateNICPayload) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CreateNICPayload) SetType(v *string) { + o.Type = v +} + +func (o CreateNICPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AllowedAddresses) { + toSerialize["allowedAddresses"] = o.AllowedAddresses + } + if !IsNil(o.Device) { + toSerialize["device"] = o.Device + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Ipv4) { + toSerialize["ipv4"] = o.Ipv4 + } + if !IsNil(o.Ipv6) { + toSerialize["ipv6"] = o.Ipv6 + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Mac) { + toSerialize["mac"] = o.Mac + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NetworkId) { + toSerialize["networkId"] = o.NetworkId + } + if !IsNil(o.NicSecurity) { + toSerialize["nicSecurity"] = o.NicSecurity + } + if !IsNil(o.SecurityGroups) { + toSerialize["securityGroups"] = o.SecurityGroups + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + return toSerialize, nil +} + +type NullableCreateNICPayload struct { + value *CreateNICPayload + isSet bool +} + +func (v NullableCreateNICPayload) Get() *CreateNICPayload { + return v.value +} + +func (v *NullableCreateNICPayload) Set(val *CreateNICPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNICPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNICPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNICPayload(val *CreateNICPayload) *NullableCreateNICPayload { + return &NullableCreateNICPayload{value: val, isSet: true} +} + +func (v NullableCreateNICPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNICPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_protocol.go b/services/iaas/model_create_protocol.go new file mode 100644 index 00000000..4b0f5b47 --- /dev/null +++ b/services/iaas/model_create_protocol.go @@ -0,0 +1,145 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateProtocol - The schema for a protocol when creating a security group rule. +type CreateProtocol struct { + Int64 *int64 + String *string +} + +// int64AsCreateProtocol is a convenience function that returns int64 wrapped in CreateProtocol +func Int64AsCreateProtocol(v *int64) CreateProtocol { + return CreateProtocol{ + Int64: v, + } +} + +// stringAsCreateProtocol is a convenience function that returns string wrapped in CreateProtocol +func StringAsCreateProtocol(v *string) CreateProtocol { + return CreateProtocol{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateProtocol) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Int64 + err = newStrictDecoder(data).Decode(&dst.Int64) + if err == nil { + jsonInt64, _ := json.Marshal(dst.Int64) + if string(jsonInt64) == "{}" { // empty struct + dst.Int64 = nil + } else { + match++ + } + } else { + dst.Int64 = nil + } + + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + match++ + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Int64 = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateProtocol)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateProtocol)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateProtocol) MarshalJSON() ([]byte, error) { + if src.Int64 != nil { + return json.Marshal(&src.Int64) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateProtocol) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.Int64 != nil { + return obj.Int64 + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableCreateProtocol struct { + value *CreateProtocol + isSet bool +} + +func (v NullableCreateProtocol) Get() *CreateProtocol { + return v.value +} + +func (v *NullableCreateProtocol) Set(val *CreateProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableCreateProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateProtocol(val *CreateProtocol) *NullableCreateProtocol { + return &NullableCreateProtocol{value: val, isSet: true} +} + +func (v NullableCreateProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_public_ip_payload.go b/services/iaas/model_create_public_ip_payload.go new file mode 100644 index 00000000..c1d12ac7 --- /dev/null +++ b/services/iaas/model_create_public_ip_payload.go @@ -0,0 +1,239 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreatePublicIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatePublicIPPayload{} + +// CreatePublicIPPayload Object that represents a public IP. +type CreatePublicIPPayload 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"` + // Universally Unique Identifier (UUID). + NetworkInterface *NullableString `json:"networkInterface,omitempty"` +} + +// NewCreatePublicIPPayload instantiates a new CreatePublicIPPayload 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 NewCreatePublicIPPayload() *CreatePublicIPPayload { + this := CreatePublicIPPayload{} + return &this +} + +// NewCreatePublicIPPayloadWithDefaults instantiates a new CreatePublicIPPayload 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 NewCreatePublicIPPayloadWithDefaults() *CreatePublicIPPayload { + this := CreatePublicIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) 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 *CreatePublicIPPayload) 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 *CreatePublicIPPayload) 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 *CreatePublicIPPayload) SetId(v *string) { + o.Id = v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) 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 *CreatePublicIPPayload) 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 *CreatePublicIPPayload) 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 *CreatePublicIPPayload) SetIp(v *string) { + o.Ip = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) 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 *CreatePublicIPPayload) 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 *CreatePublicIPPayload) 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 *CreatePublicIPPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreatePublicIPPayload) GetNetworkInterface() *string { + if o == nil || IsNil(o.NetworkInterface.Get()) { + var ret *string + return ret + } + return o.NetworkInterface.Get() +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface 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 *CreatePublicIPPayload) GetNetworkInterfaceOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NetworkInterface.Get(), o.NetworkInterface.IsSet() +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasNetworkInterface() bool { + if o != nil && o.NetworkInterface.IsSet() { + return true + } + + return false +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *CreatePublicIPPayload) SetNetworkInterface(v *string) { + o.NetworkInterface.Set(v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *CreatePublicIPPayload) SetNetworkInterfaceNil() { + o.NetworkInterface.Set(nil) +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *CreatePublicIPPayload) UnsetNetworkInterface() { + o.NetworkInterface.Unset() +} + +func (o CreatePublicIPPayload) 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 o.NetworkInterface.IsSet() { + toSerialize["networkInterface"] = o.NetworkInterface.Get() + } + return toSerialize, nil +} + +type NullableCreatePublicIPPayload struct { + value *CreatePublicIPPayload + isSet bool +} + +func (v NullableCreatePublicIPPayload) Get() *CreatePublicIPPayload { + return v.value +} + +func (v *NullableCreatePublicIPPayload) Set(val *CreatePublicIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreatePublicIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatePublicIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatePublicIPPayload(val *CreatePublicIPPayload) *NullableCreatePublicIPPayload { + return &NullableCreatePublicIPPayload{value: val, isSet: true} +} + +func (v NullableCreatePublicIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatePublicIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_security_group_payload.go b/services/iaas/model_create_security_group_payload.go new file mode 100644 index 00000000..65cc2113 --- /dev/null +++ b/services/iaas/model_create_security_group_payload.go @@ -0,0 +1,375 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSecurityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupPayload{} + +// CreateSecurityGroupPayload Object that represents a security group. +type CreateSecurityGroupPayload struct { + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // A list containing security group rule objects. + Rules *[]SecurityGroupRule `json:"rules,omitempty"` + // Shows if a security group is stateful or stateless. You can only have one type of security groups per network interface/server. + Stateful *bool `json:"stateful,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _CreateSecurityGroupPayload CreateSecurityGroupPayload + +// NewCreateSecurityGroupPayload instantiates a new CreateSecurityGroupPayload 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 NewCreateSecurityGroupPayload(name *string) *CreateSecurityGroupPayload { + this := CreateSecurityGroupPayload{} + this.Name = name + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// NewCreateSecurityGroupPayloadWithDefaults instantiates a new CreateSecurityGroupPayload 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 NewCreateSecurityGroupPayloadWithDefaults() *CreateSecurityGroupPayload { + this := CreateSecurityGroupPayload{} + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) SetDescription(v *string) { + o.Description = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value +func (o *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CreateSecurityGroupPayload) SetName(v *string) { + o.Name = v +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetRules() *[]SecurityGroupRule { + if o == nil || IsNil(o.Rules) { + var ret *[]SecurityGroupRule + return ret + } + return o.Rules +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetRulesOk() (*[]SecurityGroupRule, bool) { + if o == nil || IsNil(o.Rules) { + return nil, false + } + return o.Rules, true +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasRules() bool { + if o != nil && !IsNil(o.Rules) { + return true + } + + return false +} + +// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field. +func (o *CreateSecurityGroupPayload) SetRules(v *[]SecurityGroupRule) { + o.Rules = v +} + +// GetStateful returns the Stateful field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetStateful() *bool { + if o == nil || IsNil(o.Stateful) { + var ret *bool + return ret + } + return o.Stateful +} + +// GetStatefulOk returns a tuple with the Stateful field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetStatefulOk() (*bool, bool) { + if o == nil || IsNil(o.Stateful) { + return nil, false + } + return o.Stateful, true +} + +// HasStateful returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasStateful() bool { + if o != nil && !IsNil(o.Stateful) { + return true + } + + return false +} + +// SetStateful gets a reference to the given bool and assigns it to the Stateful field. +func (o *CreateSecurityGroupPayload) SetStateful(v *bool) { + o.Stateful = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) 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 *CreateSecurityGroupPayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o CreateSecurityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.Rules) { + toSerialize["rules"] = o.Rules + } + if !IsNil(o.Stateful) { + toSerialize["stateful"] = o.Stateful + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupPayload struct { + value *CreateSecurityGroupPayload + isSet bool +} + +func (v NullableCreateSecurityGroupPayload) Get() *CreateSecurityGroupPayload { + return v.value +} + +func (v *NullableCreateSecurityGroupPayload) Set(val *CreateSecurityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupPayload(val *CreateSecurityGroupPayload) *NullableCreateSecurityGroupPayload { + return &NullableCreateSecurityGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_security_group_rule_payload.go b/services/iaas/model_create_security_group_rule_payload.go new file mode 100644 index 00000000..8038a45b --- /dev/null +++ b/services/iaas/model_create_security_group_rule_payload.go @@ -0,0 +1,445 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateSecurityGroupRulePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupRulePayload{} + +// CreateSecurityGroupRulePayload Object that represents a request body for security group rule creation. +type CreateSecurityGroupRulePayload struct { + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // The direction of the traffic which the rule should match. + // REQUIRED + Direction *string `json:"direction"` + // The ethertype which the rule should match. + Ethertype *string `json:"ethertype,omitempty"` + IcmpParameters *ICMPParameters `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange *string `json:"ipRange,omitempty"` + PortRange *PortRange `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId *string `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId *string `json:"securityGroupId,omitempty"` + Protocol *CreateProtocol `json:"protocol,omitempty"` +} + +type _CreateSecurityGroupRulePayload CreateSecurityGroupRulePayload + +// NewCreateSecurityGroupRulePayload instantiates a new CreateSecurityGroupRulePayload 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 NewCreateSecurityGroupRulePayload(direction *string) *CreateSecurityGroupRulePayload { + this := CreateSecurityGroupRulePayload{} + this.Direction = direction + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// NewCreateSecurityGroupRulePayloadWithDefaults instantiates a new CreateSecurityGroupRulePayload 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 NewCreateSecurityGroupRulePayloadWithDefaults() *CreateSecurityGroupRulePayload { + this := CreateSecurityGroupRulePayload{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) 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 *CreateSecurityGroupRulePayload) 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 *CreateSecurityGroupRulePayload) 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 *CreateSecurityGroupRulePayload) SetDescription(v *string) { + o.Description = v +} + +// GetDirection returns the Direction field value +func (o *CreateSecurityGroupRulePayload) GetDirection() *string { + if o == nil { + var ret *string + return ret + } + + return o.Direction +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetDirectionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Direction, true +} + +// SetDirection sets field value +func (o *CreateSecurityGroupRulePayload) SetDirection(v *string) { + o.Direction = v +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetEthertype() *string { + if o == nil || IsNil(o.Ethertype) { + var ret *string + return ret + } + return o.Ethertype +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetEthertypeOk() (*string, bool) { + if o == nil || IsNil(o.Ethertype) { + return nil, false + } + return o.Ethertype, true +} + +// HasEthertype returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasEthertype() bool { + if o != nil && !IsNil(o.Ethertype) { + return true + } + + return false +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *CreateSecurityGroupRulePayload) SetEthertype(v *string) { + o.Ethertype = v +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetIcmpParameters() *ICMPParameters { + if o == nil || IsNil(o.IcmpParameters) { + var ret *ICMPParameters + return ret + } + return o.IcmpParameters +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIcmpParametersOk() (*ICMPParameters, bool) { + if o == nil || IsNil(o.IcmpParameters) { + return nil, false + } + return o.IcmpParameters, true +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasIcmpParameters() bool { + if o != nil && !IsNil(o.IcmpParameters) { + return true + } + + return false +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *CreateSecurityGroupRulePayload) SetIcmpParameters(v *ICMPParameters) { + o.IcmpParameters = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) 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 *CreateSecurityGroupRulePayload) 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 *CreateSecurityGroupRulePayload) 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 *CreateSecurityGroupRulePayload) SetId(v *string) { + o.Id = v +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetIpRange() *string { + if o == nil || IsNil(o.IpRange) { + var ret *string + return ret + } + return o.IpRange +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIpRangeOk() (*string, bool) { + if o == nil || IsNil(o.IpRange) { + return nil, false + } + return o.IpRange, true +} + +// HasIpRange returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasIpRange() bool { + if o != nil && !IsNil(o.IpRange) { + return true + } + + return false +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *CreateSecurityGroupRulePayload) SetIpRange(v *string) { + o.IpRange = v +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetPortRange() *PortRange { + if o == nil || IsNil(o.PortRange) { + var ret *PortRange + return ret + } + return o.PortRange +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetPortRangeOk() (*PortRange, bool) { + if o == nil || IsNil(o.PortRange) { + return nil, false + } + return o.PortRange, true +} + +// HasPortRange returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasPortRange() bool { + if o != nil && !IsNil(o.PortRange) { + return true + } + + return false +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *CreateSecurityGroupRulePayload) SetPortRange(v *PortRange) { + o.PortRange = v +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetRemoteSecurityGroupId() *string { + if o == nil || IsNil(o.RemoteSecurityGroupId) { + var ret *string + return ret + } + return o.RemoteSecurityGroupId +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetRemoteSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.RemoteSecurityGroupId) { + return nil, false + } + return o.RemoteSecurityGroupId, true +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasRemoteSecurityGroupId() bool { + if o != nil && !IsNil(o.RemoteSecurityGroupId) { + return true + } + + return false +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *CreateSecurityGroupRulePayload) SetRemoteSecurityGroupId(v *string) { + o.RemoteSecurityGroupId = v +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetSecurityGroupId() *string { + if o == nil || IsNil(o.SecurityGroupId) { + var ret *string + return ret + } + return o.SecurityGroupId +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.SecurityGroupId) { + return nil, false + } + return o.SecurityGroupId, true +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasSecurityGroupId() bool { + if o != nil && !IsNil(o.SecurityGroupId) { + return true + } + + return false +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *CreateSecurityGroupRulePayload) SetSecurityGroupId(v *string) { + o.SecurityGroupId = v +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetProtocol() *CreateProtocol { + if o == nil || IsNil(o.Protocol) { + var ret *CreateProtocol + return ret + } + return o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetProtocolOk() (*CreateProtocol, bool) { + if o == nil || IsNil(o.Protocol) { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasProtocol() bool { + if o != nil && !IsNil(o.Protocol) { + return true + } + + return false +} + +// SetProtocol gets a reference to the given CreateProtocol and assigns it to the Protocol field. +func (o *CreateSecurityGroupRulePayload) SetProtocol(v *CreateProtocol) { + o.Protocol = v +} + +func (o CreateSecurityGroupRulePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["direction"] = o.Direction + if !IsNil(o.Ethertype) { + toSerialize["ethertype"] = o.Ethertype + } + if !IsNil(o.IcmpParameters) { + toSerialize["icmpParameters"] = o.IcmpParameters + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpRange) { + toSerialize["ipRange"] = o.IpRange + } + if !IsNil(o.PortRange) { + toSerialize["portRange"] = o.PortRange + } + if !IsNil(o.RemoteSecurityGroupId) { + toSerialize["remoteSecurityGroupId"] = o.RemoteSecurityGroupId + } + if !IsNil(o.SecurityGroupId) { + toSerialize["securityGroupId"] = o.SecurityGroupId + } + if !IsNil(o.Protocol) { + toSerialize["protocol"] = o.Protocol + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupRulePayload struct { + value *CreateSecurityGroupRulePayload + isSet bool +} + +func (v NullableCreateSecurityGroupRulePayload) Get() *CreateSecurityGroupRulePayload { + return v.value +} + +func (v *NullableCreateSecurityGroupRulePayload) Set(val *CreateSecurityGroupRulePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupRulePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupRulePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupRulePayload(val *CreateSecurityGroupRulePayload) *NullableCreateSecurityGroupRulePayload { + return &NullableCreateSecurityGroupRulePayload{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupRulePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupRulePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_security_group_rule_protocol.go b/services/iaas/model_create_security_group_rule_protocol.go new file mode 100644 index 00000000..ae955a53 --- /dev/null +++ b/services/iaas/model_create_security_group_rule_protocol.go @@ -0,0 +1,116 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateSecurityGroupRuleProtocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupRuleProtocol{} + +// CreateSecurityGroupRuleProtocol The internet protocol which the rule should match. +type CreateSecurityGroupRuleProtocol struct { + Protocol *CreateProtocol `json:"protocol,omitempty"` +} + +// NewCreateSecurityGroupRuleProtocol instantiates a new CreateSecurityGroupRuleProtocol 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 NewCreateSecurityGroupRuleProtocol() *CreateSecurityGroupRuleProtocol { + this := CreateSecurityGroupRuleProtocol{} + return &this +} + +// NewCreateSecurityGroupRuleProtocolWithDefaults instantiates a new CreateSecurityGroupRuleProtocol 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 NewCreateSecurityGroupRuleProtocolWithDefaults() *CreateSecurityGroupRuleProtocol { + this := CreateSecurityGroupRuleProtocol{} + return &this +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *CreateSecurityGroupRuleProtocol) GetProtocol() *CreateProtocol { + if o == nil || IsNil(o.Protocol) { + var ret *CreateProtocol + return ret + } + return o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRuleProtocol) GetProtocolOk() (*CreateProtocol, bool) { + if o == nil || IsNil(o.Protocol) { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *CreateSecurityGroupRuleProtocol) HasProtocol() bool { + if o != nil && !IsNil(o.Protocol) { + return true + } + + return false +} + +// SetProtocol gets a reference to the given CreateProtocol and assigns it to the Protocol field. +func (o *CreateSecurityGroupRuleProtocol) SetProtocol(v *CreateProtocol) { + o.Protocol = v +} + +func (o CreateSecurityGroupRuleProtocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Protocol) { + toSerialize["protocol"] = o.Protocol + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupRuleProtocol struct { + value *CreateSecurityGroupRuleProtocol + isSet bool +} + +func (v NullableCreateSecurityGroupRuleProtocol) Get() *CreateSecurityGroupRuleProtocol { + return v.value +} + +func (v *NullableCreateSecurityGroupRuleProtocol) Set(val *CreateSecurityGroupRuleProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupRuleProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupRuleProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupRuleProtocol(val *CreateSecurityGroupRuleProtocol) *NullableCreateSecurityGroupRuleProtocol { + return &NullableCreateSecurityGroupRuleProtocol{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupRuleProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_server_networking.go b/services/iaas/model_create_server_networking.go new file mode 100644 index 00000000..afbe456d --- /dev/null +++ b/services/iaas/model_create_server_networking.go @@ -0,0 +1,117 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerNetworking type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerNetworking{} + +// CreateServerNetworking The initial networking setup for the server creation with a network. +type CreateServerNetworking struct { + // Universally Unique Identifier (UUID). + NetworkId *string `json:"networkId,omitempty"` +} + +// NewCreateServerNetworking instantiates a new CreateServerNetworking 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 NewCreateServerNetworking() *CreateServerNetworking { + this := CreateServerNetworking{} + return &this +} + +// NewCreateServerNetworkingWithDefaults instantiates a new CreateServerNetworking 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 NewCreateServerNetworkingWithDefaults() *CreateServerNetworking { + this := CreateServerNetworking{} + return &this +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *CreateServerNetworking) GetNetworkId() *string { + if o == nil || IsNil(o.NetworkId) { + var ret *string + return ret + } + return o.NetworkId +} + +// 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 *CreateServerNetworking) GetNetworkIdOk() (*string, bool) { + if o == nil || IsNil(o.NetworkId) { + return nil, false + } + return o.NetworkId, true +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *CreateServerNetworking) HasNetworkId() bool { + if o != nil && !IsNil(o.NetworkId) { + return true + } + + return false +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *CreateServerNetworking) SetNetworkId(v *string) { + o.NetworkId = v +} + +func (o CreateServerNetworking) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NetworkId) { + toSerialize["networkId"] = o.NetworkId + } + return toSerialize, nil +} + +type NullableCreateServerNetworking struct { + value *CreateServerNetworking + isSet bool +} + +func (v NullableCreateServerNetworking) Get() *CreateServerNetworking { + return v.value +} + +func (v *NullableCreateServerNetworking) Set(val *CreateServerNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerNetworking(val *CreateServerNetworking) *NullableCreateServerNetworking { + return &NullableCreateServerNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_server_networking_with_nics.go b/services/iaas/model_create_server_networking_with_nics.go new file mode 100644 index 00000000..867a2fca --- /dev/null +++ b/services/iaas/model_create_server_networking_with_nics.go @@ -0,0 +1,117 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerNetworkingWithNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerNetworkingWithNics{} + +// CreateServerNetworkingWithNics The initial networking setup for the server creation with a network interface. +type CreateServerNetworkingWithNics struct { + // A list of UUIDs. + NicIds *[]string `json:"nicIds,omitempty"` +} + +// NewCreateServerNetworkingWithNics instantiates a new CreateServerNetworkingWithNics 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 NewCreateServerNetworkingWithNics() *CreateServerNetworkingWithNics { + this := CreateServerNetworkingWithNics{} + return &this +} + +// NewCreateServerNetworkingWithNicsWithDefaults instantiates a new CreateServerNetworkingWithNics 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 NewCreateServerNetworkingWithNicsWithDefaults() *CreateServerNetworkingWithNics { + this := CreateServerNetworkingWithNics{} + return &this +} + +// GetNicIds returns the NicIds field value if set, zero value otherwise. +func (o *CreateServerNetworkingWithNics) GetNicIds() *[]string { + if o == nil || IsNil(o.NicIds) { + var ret *[]string + return ret + } + return o.NicIds +} + +// GetNicIdsOk returns a tuple with the NicIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerNetworkingWithNics) GetNicIdsOk() (*[]string, bool) { + if o == nil || IsNil(o.NicIds) { + return nil, false + } + return o.NicIds, true +} + +// HasNicIds returns a boolean if a field has been set. +func (o *CreateServerNetworkingWithNics) HasNicIds() bool { + if o != nil && !IsNil(o.NicIds) { + return true + } + + return false +} + +// SetNicIds gets a reference to the given []string and assigns it to the NicIds field. +func (o *CreateServerNetworkingWithNics) SetNicIds(v *[]string) { + o.NicIds = v +} + +func (o CreateServerNetworkingWithNics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NicIds) { + toSerialize["nicIds"] = o.NicIds + } + return toSerialize, nil +} + +type NullableCreateServerNetworkingWithNics struct { + value *CreateServerNetworkingWithNics + isSet bool +} + +func (v NullableCreateServerNetworkingWithNics) Get() *CreateServerNetworkingWithNics { + return v.value +} + +func (v *NullableCreateServerNetworkingWithNics) Set(val *CreateServerNetworkingWithNics) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerNetworkingWithNics) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerNetworkingWithNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerNetworkingWithNics(val *CreateServerNetworkingWithNics) *NullableCreateServerNetworkingWithNics { + return &NullableCreateServerNetworkingWithNics{value: val, isSet: true} +} + +func (v NullableCreateServerNetworkingWithNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerNetworkingWithNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_server_payload.go b/services/iaas/model_create_server_payload.go new file mode 100644 index 00000000..a5e91a8d --- /dev/null +++ b/services/iaas/model_create_server_payload.go @@ -0,0 +1,878 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayload{} + +// CreateServerPayload Representation of a single server object. +type CreateServerPayload struct { + // Universally Unique Identifier (UUID). + AffinityGroup *string `json:"affinityGroup,omitempty"` + // Object that represents an availability zone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + BootVolume *CreateServerPayloadBootVolume `json:"bootVolume,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // An error message. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Universally Unique Identifier (UUID). + ImageId *string `json:"imageId,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + KeypairName *string `json:"keypairName,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Date-time when resource was launched. + LaunchedAt *time.Time `json:"launchedAt,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType *string `json:"machineType"` + MaintenanceWindow *ServerMaintenance `json:"maintenanceWindow,omitempty"` + // The name for a Server. + // REQUIRED + Name *string `json:"name"` + Networking *CreateServerPayloadNetworking `json:"networking,omitempty"` + // A list of networks attached to a server. + Nics *[]ServerNetwork `json:"nics,omitempty"` + // The power status of a server. + PowerStatus *string `json:"powerStatus,omitempty"` + // A list of General Objects. + SecurityGroups *[]string `json:"securityGroups,omitempty"` + // A list of service account mails. + ServiceAccountMails *[]string `json:"serviceAccountMails,omitempty"` + // The status of a server object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init to the server. + UserData *string `json:"userData,omitempty"` + // A list of UUIDs. + Volumes *[]string `json:"volumes,omitempty"` +} + +type _CreateServerPayload CreateServerPayload + +// NewCreateServerPayload instantiates a new CreateServerPayload 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 NewCreateServerPayload(machineType *string, name *string) *CreateServerPayload { + this := CreateServerPayload{} + this.MachineType = machineType + this.Name = name + return &this +} + +// NewCreateServerPayloadWithDefaults instantiates a new CreateServerPayload 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 NewCreateServerPayloadWithDefaults() *CreateServerPayload { + this := CreateServerPayload{} + return &this +} + +// GetAffinityGroup returns the AffinityGroup field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAffinityGroup() *string { + if o == nil || IsNil(o.AffinityGroup) { + var ret *string + return ret + } + return o.AffinityGroup +} + +// GetAffinityGroupOk returns a tuple with the AffinityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAffinityGroupOk() (*string, bool) { + if o == nil || IsNil(o.AffinityGroup) { + return nil, false + } + return o.AffinityGroup, true +} + +// HasAffinityGroup returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAffinityGroup() bool { + if o != nil && !IsNil(o.AffinityGroup) { + return true + } + + return false +} + +// SetAffinityGroup gets a reference to the given string and assigns it to the AffinityGroup field. +func (o *CreateServerPayload) SetAffinityGroup(v *string) { + o.AffinityGroup = v +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAvailabilityZone() *string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret *string + return ret + } + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAvailabilityZoneOk() (*string, bool) { + if o == nil || IsNil(o.AvailabilityZone) { + return nil, false + } + return o.AvailabilityZone, true +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAvailabilityZone() bool { + if o != nil && !IsNil(o.AvailabilityZone) { + return true + } + + return false +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *CreateServerPayload) SetAvailabilityZone(v *string) { + o.AvailabilityZone = v +} + +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *CreateServerPayload) GetBootVolume() *CreateServerPayloadBootVolume { + if o == nil || IsNil(o.BootVolume) { + var ret *CreateServerPayloadBootVolume + return ret + } + return o.BootVolume +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetBootVolumeOk() (*CreateServerPayloadBootVolume, bool) { + if o == nil || IsNil(o.BootVolume) { + return nil, false + } + return o.BootVolume, true +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *CreateServerPayload) HasBootVolume() bool { + if o != nil && !IsNil(o.BootVolume) { + return true + } + + return false +} + +// SetBootVolume gets a reference to the given CreateServerPayloadBootVolume and assigns it to the BootVolume field. +func (o *CreateServerPayload) SetBootVolume(v *CreateServerPayloadBootVolume) { + o.BootVolume = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *CreateServerPayload) GetErrorMessage() *string { + if o == nil || IsNil(o.ErrorMessage) { + var ret *string + return ret + } + return o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetErrorMessageOk() (*string, bool) { + if o == nil || IsNil(o.ErrorMessage) { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *CreateServerPayload) HasErrorMessage() bool { + if o != nil && !IsNil(o.ErrorMessage) { + return true + } + + return false +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *CreateServerPayload) SetErrorMessage(v *string) { + o.ErrorMessage = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) SetId(v *string) { + o.Id = v +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *CreateServerPayload) GetImageId() *string { + if o == nil || IsNil(o.ImageId) { + var ret *string + return ret + } + return o.ImageId +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetImageIdOk() (*string, bool) { + if o == nil || IsNil(o.ImageId) { + return nil, false + } + return o.ImageId, true +} + +// HasImageId returns a boolean if a field has been set. +func (o *CreateServerPayload) HasImageId() bool { + if o != nil && !IsNil(o.ImageId) { + return true + } + + return false +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *CreateServerPayload) SetImageId(v *string) { + o.ImageId = v +} + +// GetKeypairName returns the KeypairName field value if set, zero value otherwise. +func (o *CreateServerPayload) GetKeypairName() *string { + if o == nil || IsNil(o.KeypairName) { + var ret *string + return ret + } + return o.KeypairName +} + +// GetKeypairNameOk returns a tuple with the KeypairName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetKeypairNameOk() (*string, bool) { + if o == nil || IsNil(o.KeypairName) { + return nil, false + } + return o.KeypairName, true +} + +// HasKeypairName returns a boolean if a field has been set. +func (o *CreateServerPayload) HasKeypairName() bool { + if o != nil && !IsNil(o.KeypairName) { + return true + } + + return false +} + +// SetKeypairName gets a reference to the given string and assigns it to the KeypairName field. +func (o *CreateServerPayload) SetKeypairName(v *string) { + o.KeypairName = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetLaunchedAt returns the LaunchedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetLaunchedAt() *time.Time { + if o == nil || IsNil(o.LaunchedAt) { + var ret *time.Time + return ret + } + return o.LaunchedAt +} + +// GetLaunchedAtOk returns a tuple with the LaunchedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetLaunchedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.LaunchedAt) { + return nil, false + } + return o.LaunchedAt, true +} + +// HasLaunchedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasLaunchedAt() bool { + if o != nil && !IsNil(o.LaunchedAt) { + return true + } + + return false +} + +// SetLaunchedAt gets a reference to the given time.Time and assigns it to the LaunchedAt field. +func (o *CreateServerPayload) SetLaunchedAt(v *time.Time) { + o.LaunchedAt = v +} + +// GetMachineType returns the MachineType field value +func (o *CreateServerPayload) GetMachineType() *string { + if o == nil { + var ret *string + return ret + } + + return o.MachineType +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMachineTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.MachineType, true +} + +// SetMachineType sets field value +func (o *CreateServerPayload) SetMachineType(v *string) { + o.MachineType = v +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *CreateServerPayload) GetMaintenanceWindow() *ServerMaintenance { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret *ServerMaintenance + return ret + } + return o.MaintenanceWindow +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMaintenanceWindowOk() (*ServerMaintenance, bool) { + if o == nil || IsNil(o.MaintenanceWindow) { + return nil, false + } + return o.MaintenanceWindow, true +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *CreateServerPayload) HasMaintenanceWindow() bool { + if o != nil && !IsNil(o.MaintenanceWindow) { + return true + } + + return false +} + +// SetMaintenanceWindow gets a reference to the given ServerMaintenance and assigns it to the MaintenanceWindow field. +func (o *CreateServerPayload) SetMaintenanceWindow(v *ServerMaintenance) { + o.MaintenanceWindow = v +} + +// GetName returns the Name field value +func (o *CreateServerPayload) 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 *CreateServerPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CreateServerPayload) SetName(v *string) { + o.Name = v +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *CreateServerPayload) GetNetworking() *CreateServerPayloadNetworking { + if o == nil || IsNil(o.Networking) { + var ret *CreateServerPayloadNetworking + return ret + } + return o.Networking +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNetworkingOk() (*CreateServerPayloadNetworking, bool) { + if o == nil || IsNil(o.Networking) { + return nil, false + } + return o.Networking, true +} + +// HasNetworking returns a boolean if a field has been set. +func (o *CreateServerPayload) HasNetworking() bool { + if o != nil && !IsNil(o.Networking) { + return true + } + + return false +} + +// SetNetworking gets a reference to the given CreateServerPayloadNetworking and assigns it to the Networking field. +func (o *CreateServerPayload) SetNetworking(v *CreateServerPayloadNetworking) { + o.Networking = v +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *CreateServerPayload) GetNics() *[]ServerNetwork { + if o == nil || IsNil(o.Nics) { + var ret *[]ServerNetwork + return ret + } + return o.Nics +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNicsOk() (*[]ServerNetwork, bool) { + if o == nil || IsNil(o.Nics) { + return nil, false + } + return o.Nics, true +} + +// HasNics returns a boolean if a field has been set. +func (o *CreateServerPayload) HasNics() bool { + if o != nil && !IsNil(o.Nics) { + return true + } + + return false +} + +// SetNics gets a reference to the given []ServerNetwork and assigns it to the Nics field. +func (o *CreateServerPayload) SetNics(v *[]ServerNetwork) { + o.Nics = v +} + +// GetPowerStatus returns the PowerStatus field value if set, zero value otherwise. +func (o *CreateServerPayload) GetPowerStatus() *string { + if o == nil || IsNil(o.PowerStatus) { + var ret *string + return ret + } + return o.PowerStatus +} + +// GetPowerStatusOk returns a tuple with the PowerStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetPowerStatusOk() (*string, bool) { + if o == nil || IsNil(o.PowerStatus) { + return nil, false + } + return o.PowerStatus, true +} + +// HasPowerStatus returns a boolean if a field has been set. +func (o *CreateServerPayload) HasPowerStatus() bool { + if o != nil && !IsNil(o.PowerStatus) { + return true + } + + return false +} + +// SetPowerStatus gets a reference to the given string and assigns it to the PowerStatus field. +func (o *CreateServerPayload) SetPowerStatus(v *string) { + o.PowerStatus = v +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *CreateServerPayload) GetSecurityGroups() *[]string { + if o == nil || IsNil(o.SecurityGroups) { + var ret *[]string + return ret + } + return o.SecurityGroups +} + +// 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 *CreateServerPayload) GetSecurityGroupsOk() (*[]string, bool) { + if o == nil || IsNil(o.SecurityGroups) { + return nil, false + } + return o.SecurityGroups, true +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *CreateServerPayload) HasSecurityGroups() bool { + if o != nil && !IsNil(o.SecurityGroups) { + return true + } + + return false +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *CreateServerPayload) SetSecurityGroups(v *[]string) { + o.SecurityGroups = v +} + +// GetServiceAccountMails returns the ServiceAccountMails field value if set, zero value otherwise. +func (o *CreateServerPayload) GetServiceAccountMails() *[]string { + if o == nil || IsNil(o.ServiceAccountMails) { + var ret *[]string + return ret + } + return o.ServiceAccountMails +} + +// GetServiceAccountMailsOk returns a tuple with the ServiceAccountMails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetServiceAccountMailsOk() (*[]string, bool) { + if o == nil || IsNil(o.ServiceAccountMails) { + return nil, false + } + return o.ServiceAccountMails, true +} + +// HasServiceAccountMails returns a boolean if a field has been set. +func (o *CreateServerPayload) HasServiceAccountMails() bool { + if o != nil && !IsNil(o.ServiceAccountMails) { + return true + } + + return false +} + +// SetServiceAccountMails gets a reference to the given []string and assigns it to the ServiceAccountMails field. +func (o *CreateServerPayload) SetServiceAccountMails(v *[]string) { + o.ServiceAccountMails = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) 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 *CreateServerPayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *CreateServerPayload) GetUserData() *string { + if o == nil || IsNil(o.UserData) { + var ret *string + return ret + } + return o.UserData +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetUserDataOk() (*string, bool) { + if o == nil || IsNil(o.UserData) { + return nil, false + } + return o.UserData, true +} + +// HasUserData returns a boolean if a field has been set. +func (o *CreateServerPayload) HasUserData() bool { + if o != nil && !IsNil(o.UserData) { + return true + } + + return false +} + +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *CreateServerPayload) SetUserData(v *string) { + o.UserData = v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *CreateServerPayload) GetVolumes() *[]string { + if o == nil || IsNil(o.Volumes) { + var ret *[]string + return ret + } + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetVolumesOk() (*[]string, bool) { + if o == nil || IsNil(o.Volumes) { + return nil, false + } + return o.Volumes, true +} + +// HasVolumes returns a boolean if a field has been set. +func (o *CreateServerPayload) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *CreateServerPayload) SetVolumes(v *[]string) { + o.Volumes = v +} + +func (o CreateServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AffinityGroup) { + toSerialize["affinityGroup"] = o.AffinityGroup + } + if !IsNil(o.AvailabilityZone) { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + if !IsNil(o.BootVolume) { + toSerialize["bootVolume"] = o.BootVolume + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.ErrorMessage) { + toSerialize["errorMessage"] = o.ErrorMessage + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.ImageId) { + toSerialize["imageId"] = o.ImageId + } + if !IsNil(o.KeypairName) { + toSerialize["keypairName"] = o.KeypairName + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.LaunchedAt) { + toSerialize["launchedAt"] = o.LaunchedAt + } + toSerialize["machineType"] = o.MachineType + if !IsNil(o.MaintenanceWindow) { + toSerialize["maintenanceWindow"] = o.MaintenanceWindow + } + toSerialize["name"] = o.Name + if !IsNil(o.Networking) { + toSerialize["networking"] = o.Networking + } + if !IsNil(o.Nics) { + toSerialize["nics"] = o.Nics + } + if !IsNil(o.PowerStatus) { + toSerialize["powerStatus"] = o.PowerStatus + } + if !IsNil(o.SecurityGroups) { + toSerialize["securityGroups"] = o.SecurityGroups + } + if !IsNil(o.ServiceAccountMails) { + toSerialize["serviceAccountMails"] = o.ServiceAccountMails + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + if !IsNil(o.UserData) { + toSerialize["userData"] = o.UserData + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + return toSerialize, nil +} + +type NullableCreateServerPayload struct { + value *CreateServerPayload + isSet bool +} + +func (v NullableCreateServerPayload) Get() *CreateServerPayload { + return v.value +} + +func (v *NullableCreateServerPayload) Set(val *CreateServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayload(val *CreateServerPayload) *NullableCreateServerPayload { + return &NullableCreateServerPayload{value: val, isSet: true} +} + +func (v NullableCreateServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_server_payload_boot_volume.go b/services/iaas/model_create_server_payload_boot_volume.go new file mode 100644 index 00000000..26184c31 --- /dev/null +++ b/services/iaas/model_create_server_payload_boot_volume.go @@ -0,0 +1,268 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerPayloadBootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayloadBootVolume{} + +// CreateServerPayloadBootVolume struct for CreateServerPayloadBootVolume +type CreateServerPayloadBootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass *string `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + Source *BootVolumeSource `json:"source,omitempty"` +} + +// NewCreateServerPayloadBootVolume instantiates a new CreateServerPayloadBootVolume 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 NewCreateServerPayloadBootVolume() *CreateServerPayloadBootVolume { + this := CreateServerPayloadBootVolume{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// NewCreateServerPayloadBootVolumeWithDefaults instantiates a new CreateServerPayloadBootVolume 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 NewCreateServerPayloadBootVolumeWithDefaults() *CreateServerPayloadBootVolume { + this := CreateServerPayloadBootVolume{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetDeleteOnTermination() *bool { + if o == nil || IsNil(o.DeleteOnTermination) { + var ret *bool + return ret + } + return o.DeleteOnTermination +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetDeleteOnTerminationOk() (*bool, bool) { + if o == nil || IsNil(o.DeleteOnTermination) { + return nil, false + } + return o.DeleteOnTermination, true +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasDeleteOnTermination() bool { + if o != nil && !IsNil(o.DeleteOnTermination) { + return true + } + + return false +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *CreateServerPayloadBootVolume) SetDeleteOnTermination(v *bool) { + o.DeleteOnTermination = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) 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 *CreateServerPayloadBootVolume) 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 *CreateServerPayloadBootVolume) 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 *CreateServerPayloadBootVolume) SetId(v *string) { + o.Id = v +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetPerformanceClass() *string { + if o == nil || IsNil(o.PerformanceClass) { + var ret *string + return ret + } + return o.PerformanceClass +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetPerformanceClassOk() (*string, bool) { + if o == nil || IsNil(o.PerformanceClass) { + return nil, false + } + return o.PerformanceClass, true +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasPerformanceClass() bool { + if o != nil && !IsNil(o.PerformanceClass) { + return true + } + + return false +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *CreateServerPayloadBootVolume) SetPerformanceClass(v *string) { + o.PerformanceClass = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateServerPayloadBootVolume) SetSize(v *int64) { + o.Size = v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetSource() *BootVolumeSource { + if o == nil || IsNil(o.Source) { + var ret *BootVolumeSource + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetSourceOk() (*BootVolumeSource, bool) { + if o == nil || IsNil(o.Source) { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasSource() bool { + if o != nil && !IsNil(o.Source) { + return true + } + + return false +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *CreateServerPayloadBootVolume) SetSource(v *BootVolumeSource) { + o.Source = v +} + +func (o CreateServerPayloadBootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeleteOnTermination) { + toSerialize["deleteOnTermination"] = o.DeleteOnTermination + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.PerformanceClass) { + toSerialize["performanceClass"] = o.PerformanceClass + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Source) { + toSerialize["source"] = o.Source + } + return toSerialize, nil +} + +type NullableCreateServerPayloadBootVolume struct { + value *CreateServerPayloadBootVolume + isSet bool +} + +func (v NullableCreateServerPayloadBootVolume) Get() *CreateServerPayloadBootVolume { + return v.value +} + +func (v *NullableCreateServerPayloadBootVolume) Set(val *CreateServerPayloadBootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadBootVolume(val *CreateServerPayloadBootVolume) *NullableCreateServerPayloadBootVolume { + return &NullableCreateServerPayloadBootVolume{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_server_payload_networking.go b/services/iaas/model_create_server_payload_networking.go new file mode 100644 index 00000000..8bebe2e9 --- /dev/null +++ b/services/iaas/model_create_server_payload_networking.go @@ -0,0 +1,145 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateServerPayloadNetworking - The initial networking setup for the server creation. A network, a nic or nothing can be given. +type CreateServerPayloadNetworking struct { + CreateServerNetworking *CreateServerNetworking + CreateServerNetworkingWithNics *CreateServerNetworkingWithNics +} + +// CreateServerNetworkingAsCreateServerPayloadNetworking is a convenience function that returns CreateServerNetworking wrapped in CreateServerPayloadNetworking +func CreateServerNetworkingAsCreateServerPayloadNetworking(v *CreateServerNetworking) CreateServerPayloadNetworking { + return CreateServerPayloadNetworking{ + CreateServerNetworking: v, + } +} + +// CreateServerNetworkingWithNicsAsCreateServerPayloadNetworking is a convenience function that returns CreateServerNetworkingWithNics wrapped in CreateServerPayloadNetworking +func CreateServerNetworkingWithNicsAsCreateServerPayloadNetworking(v *CreateServerNetworkingWithNics) CreateServerPayloadNetworking { + return CreateServerPayloadNetworking{ + CreateServerNetworkingWithNics: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateServerPayloadNetworking) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into CreateServerNetworking + err = newStrictDecoder(data).Decode(&dst.CreateServerNetworking) + if err == nil { + jsonCreateServerNetworking, _ := json.Marshal(dst.CreateServerNetworking) + if string(jsonCreateServerNetworking) == "{}" { // empty struct + dst.CreateServerNetworking = nil + } else { + match++ + } + } else { + dst.CreateServerNetworking = nil + } + + // try to unmarshal data into CreateServerNetworkingWithNics + err = newStrictDecoder(data).Decode(&dst.CreateServerNetworkingWithNics) + if err == nil { + jsonCreateServerNetworkingWithNics, _ := json.Marshal(dst.CreateServerNetworkingWithNics) + if string(jsonCreateServerNetworkingWithNics) == "{}" { // empty struct + dst.CreateServerNetworkingWithNics = nil + } else { + match++ + } + } else { + dst.CreateServerNetworkingWithNics = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateServerNetworking = nil + dst.CreateServerNetworkingWithNics = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateServerPayloadNetworking)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateServerPayloadNetworking)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateServerPayloadNetworking) MarshalJSON() ([]byte, error) { + if src.CreateServerNetworking != nil { + return json.Marshal(&src.CreateServerNetworking) + } + + if src.CreateServerNetworkingWithNics != nil { + return json.Marshal(&src.CreateServerNetworkingWithNics) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateServerPayloadNetworking) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateServerNetworking != nil { + return obj.CreateServerNetworking + } + + if obj.CreateServerNetworkingWithNics != nil { + return obj.CreateServerNetworkingWithNics + } + + // all schemas are nil + return nil +} + +type NullableCreateServerPayloadNetworking struct { + value *CreateServerPayloadNetworking + isSet bool +} + +func (v NullableCreateServerPayloadNetworking) Get() *CreateServerPayloadNetworking { + return v.value +} + +func (v *NullableCreateServerPayloadNetworking) Set(val *CreateServerPayloadNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadNetworking(val *CreateServerPayloadNetworking) *NullableCreateServerPayloadNetworking { + return &NullableCreateServerPayloadNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_create_volume_payload.go b/services/iaas/model_create_volume_payload.go new file mode 100644 index 00000000..3bc86d84 --- /dev/null +++ b/services/iaas/model_create_volume_payload.go @@ -0,0 +1,518 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumePayload{} + +// CreateVolumePayload Object that represents a volume and its parameters. Used for Creating and returning (get/list). +type CreateVolumePayload struct { + // Object that represents an availability zone. + // REQUIRED + AvailabilityZone *string `json:"availabilityZone"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass *string `json:"performanceClass,omitempty"` + // Universally Unique Identifier (UUID). + ServerId *string `json:"serverId,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + Source *VolumeSource `json:"source,omitempty"` + // The status of a volume object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _CreateVolumePayload CreateVolumePayload + +// NewCreateVolumePayload instantiates a new CreateVolumePayload 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 NewCreateVolumePayload(availabilityZone *string) *CreateVolumePayload { + this := CreateVolumePayload{} + this.AvailabilityZone = availabilityZone + return &this +} + +// NewCreateVolumePayloadWithDefaults instantiates a new CreateVolumePayload 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 NewCreateVolumePayloadWithDefaults() *CreateVolumePayload { + this := CreateVolumePayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value +func (o *CreateVolumePayload) GetAvailabilityZone() *string { + if o == nil { + var ret *string + return ret + } + + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetAvailabilityZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AvailabilityZone, true +} + +// SetAvailabilityZone sets field value +func (o *CreateVolumePayload) SetAvailabilityZone(v *string) { + o.AvailabilityZone = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetDescription(v *string) { + o.Description = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetName(v *string) { + o.Name = v +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetPerformanceClass() *string { + if o == nil || IsNil(o.PerformanceClass) { + var ret *string + return ret + } + return o.PerformanceClass +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetPerformanceClassOk() (*string, bool) { + if o == nil || IsNil(o.PerformanceClass) { + return nil, false + } + return o.PerformanceClass, true +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasPerformanceClass() bool { + if o != nil && !IsNil(o.PerformanceClass) { + return true + } + + return false +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *CreateVolumePayload) SetPerformanceClass(v *string) { + o.PerformanceClass = v +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetServerId() *string { + if o == nil || IsNil(o.ServerId) { + var ret *string + return ret + } + return o.ServerId +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetServerIdOk() (*string, bool) { + if o == nil || IsNil(o.ServerId) { + return nil, false + } + return o.ServerId, true +} + +// HasServerId returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasServerId() bool { + if o != nil && !IsNil(o.ServerId) { + return true + } + + return false +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *CreateVolumePayload) SetServerId(v *string) { + o.ServerId = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateVolumePayload) SetSize(v *int64) { + o.Size = v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetSource() *VolumeSource { + if o == nil || IsNil(o.Source) { + var ret *VolumeSource + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetSourceOk() (*VolumeSource, bool) { + if o == nil || IsNil(o.Source) { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasSource() bool { + if o != nil && !IsNil(o.Source) { + return true + } + + return false +} + +// SetSource gets a reference to the given VolumeSource and assigns it to the Source field. +func (o *CreateVolumePayload) SetSource(v *VolumeSource) { + o.Source = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) 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 *CreateVolumePayload) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o CreateVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["availabilityZone"] = o.AvailabilityZone + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PerformanceClass) { + toSerialize["performanceClass"] = o.PerformanceClass + } + if !IsNil(o.ServerId) { + toSerialize["serverId"] = o.ServerId + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Source) { + toSerialize["source"] = o.Source + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableCreateVolumePayload struct { + value *CreateVolumePayload + isSet bool +} + +func (v NullableCreateVolumePayload) Get() *CreateVolumePayload { + return v.value +} + +func (v *NullableCreateVolumePayload) Set(val *CreateVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumePayload(val *CreateVolumePayload) *NullableCreateVolumePayload { + return &NullableCreateVolumePayload{value: val, isSet: true} +} + +func (v NullableCreateVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_get_server_log_200_response.go b/services/iaas/model_get_server_log_200_response.go new file mode 100644 index 00000000..bbabc0b8 --- /dev/null +++ b/services/iaas/model_get_server_log_200_response.go @@ -0,0 +1,116 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the GetServerLog200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetServerLog200Response{} + +// GetServerLog200Response struct for GetServerLog200Response +type GetServerLog200Response struct { + Output *string `json:"output,omitempty"` +} + +// NewGetServerLog200Response instantiates a new GetServerLog200Response 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 NewGetServerLog200Response() *GetServerLog200Response { + this := GetServerLog200Response{} + return &this +} + +// NewGetServerLog200ResponseWithDefaults instantiates a new GetServerLog200Response 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 NewGetServerLog200ResponseWithDefaults() *GetServerLog200Response { + this := GetServerLog200Response{} + return &this +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *GetServerLog200Response) GetOutput() *string { + if o == nil || IsNil(o.Output) { + var ret *string + return ret + } + return o.Output +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetServerLog200Response) GetOutputOk() (*string, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *GetServerLog200Response) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *GetServerLog200Response) SetOutput(v *string) { + o.Output = v +} + +func (o GetServerLog200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + return toSerialize, nil +} + +type NullableGetServerLog200Response struct { + value *GetServerLog200Response + isSet bool +} + +func (v NullableGetServerLog200Response) Get() *GetServerLog200Response { + return v.value +} + +func (v *NullableGetServerLog200Response) Set(val *GetServerLog200Response) { + v.value = val + v.isSet = true +} + +func (v NullableGetServerLog200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServerLog200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServerLog200Response(val *GetServerLog200Response) *NullableGetServerLog200Response { + return &NullableGetServerLog200Response{value: val, isSet: true} +} + +func (v NullableGetServerLog200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServerLog200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_get_server_log_request.go b/services/iaas/model_get_server_log_request.go new file mode 100644 index 00000000..aaf3ac84 --- /dev/null +++ b/services/iaas/model_get_server_log_request.go @@ -0,0 +1,121 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the GetServerLogRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetServerLogRequest{} + +// GetServerLogRequest struct for GetServerLogRequest +type GetServerLogRequest struct { + // Set to 0 to retrieve the complete log. + Length *int64 `json:"length,omitempty"` +} + +// NewGetServerLogRequest instantiates a new GetServerLogRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetServerLogRequest() *GetServerLogRequest { + this := GetServerLogRequest{} + var length int64 = 2000 + this.Length = &length + return &this +} + +// NewGetServerLogRequestWithDefaults instantiates a new GetServerLogRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetServerLogRequestWithDefaults() *GetServerLogRequest { + this := GetServerLogRequest{} + var length int64 = 2000 + this.Length = &length + return &this +} + +// GetLength returns the Length field value if set, zero value otherwise. +func (o *GetServerLogRequest) GetLength() *int64 { + if o == nil || IsNil(o.Length) { + var ret *int64 + return ret + } + return o.Length +} + +// GetLengthOk returns a tuple with the Length field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetServerLogRequest) GetLengthOk() (*int64, bool) { + if o == nil || IsNil(o.Length) { + return nil, false + } + return o.Length, true +} + +// HasLength returns a boolean if a field has been set. +func (o *GetServerLogRequest) HasLength() bool { + if o != nil && !IsNil(o.Length) { + return true + } + + return false +} + +// SetLength gets a reference to the given int64 and assigns it to the Length field. +func (o *GetServerLogRequest) SetLength(v *int64) { + o.Length = v +} + +func (o GetServerLogRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Length) { + toSerialize["length"] = o.Length + } + return toSerialize, nil +} + +type NullableGetServerLogRequest struct { + value *GetServerLogRequest + isSet bool +} + +func (v NullableGetServerLogRequest) Get() *GetServerLogRequest { + return v.value +} + +func (v *NullableGetServerLogRequest) Set(val *GetServerLogRequest) { + v.value = val + v.isSet = true +} + +func (v NullableGetServerLogRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServerLogRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServerLogRequest(val *GetServerLogRequest) *NullableGetServerLogRequest { + return &NullableGetServerLogRequest{value: val, isSet: true} +} + +func (v NullableGetServerLogRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServerLogRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_icmp_parameters.go b/services/iaas/model_icmp_parameters.go new file mode 100644 index 00000000..a36d4de8 --- /dev/null +++ b/services/iaas/model_icmp_parameters.go @@ -0,0 +1,140 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ICMPParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ICMPParameters{} + +// ICMPParameters Object that represents ICMP parameters. +type ICMPParameters struct { + // ICMP code. Can be set if the protocol is ICMP. + // REQUIRED + Code *int64 `json:"code"` + // ICMP type. Can be set if the protocol is ICMP. + // REQUIRED + Type *int64 `json:"type"` +} + +type _ICMPParameters ICMPParameters + +// NewICMPParameters instantiates a new ICMPParameters 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 NewICMPParameters(code *int64, type_ *int64) *ICMPParameters { + this := ICMPParameters{} + this.Code = code + this.Type = type_ + return &this +} + +// NewICMPParametersWithDefaults instantiates a new ICMPParameters 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 NewICMPParametersWithDefaults() *ICMPParameters { + this := ICMPParameters{} + return &this +} + +// GetCode returns the Code field value +func (o *ICMPParameters) GetCode() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *ICMPParameters) GetCodeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Code, true +} + +// SetCode sets field value +func (o *ICMPParameters) SetCode(v *int64) { + o.Code = v +} + +// GetType returns the Type field value +func (o *ICMPParameters) GetType() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ICMPParameters) GetTypeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *ICMPParameters) SetType(v *int64) { + o.Type = v +} + +func (o ICMPParameters) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableICMPParameters struct { + value *ICMPParameters + isSet bool +} + +func (v NullableICMPParameters) Get() *ICMPParameters { + return v.value +} + +func (v *NullableICMPParameters) Set(val *ICMPParameters) { + v.value = val + v.isSet = true +} + +func (v NullableICMPParameters) IsSet() bool { + return v.isSet +} + +func (v *NullableICMPParameters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableICMPParameters(val *ICMPParameters) *NullableICMPParameters { + return &NullableICMPParameters{value: val, isSet: true} +} + +func (v NullableICMPParameters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableICMPParameters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_network.go b/services/iaas/model_network.go index 5cb35d8d..0f8b0ba0 100644 --- a/services/iaas/model_network.go +++ b/services/iaas/model_network.go @@ -21,9 +21,11 @@ var _ MappedNullable = &Network{} // Network Object that represents a network. type Network struct { // Date-time when resource was created. - CreatedAt *time.Time `json:"createdAt,omitempty"` - Gateway *NullableV1NetworkGateway `json:"gateway,omitempty"` - Gatewayv6 *NullableV1NetworkGateway `json:"gatewayv6,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway *NullableString `json:"gateway,omitempty"` + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gatewayv6 *NullableString `json:"gatewayv6,omitempty"` // Object that represents the labels of an object. Labels *map[string]interface{} `json:"labels,omitempty"` // REQUIRED @@ -103,9 +105,9 @@ func (o *Network) SetCreatedAt(v *time.Time) { } // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Network) GetGateway() *V1NetworkGateway { +func (o *Network) GetGateway() *string { if o == nil || IsNil(o.Gateway.Get()) { - var ret *V1NetworkGateway + var ret *string return ret } return o.Gateway.Get() @@ -114,7 +116,7 @@ func (o *Network) GetGateway() *V1NetworkGateway { // GetGatewayOk returns a tuple with the Gateway 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 *Network) GetGatewayOk() (*V1NetworkGateway, bool) { +func (o *Network) GetGatewayOk() (*string, bool) { if o == nil { return nil, false } @@ -130,8 +132,8 @@ func (o *Network) HasGateway() bool { return false } -// SetGateway gets a reference to the given V1NetworkGateway and assigns it to the Gateway field. -func (o *Network) SetGateway(v *V1NetworkGateway) { +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *Network) SetGateway(v *string) { o.Gateway.Set(v) } @@ -146,9 +148,9 @@ func (o *Network) UnsetGateway() { } // GetGatewayv6 returns the Gatewayv6 field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *Network) GetGatewayv6() *V1NetworkGateway { +func (o *Network) GetGatewayv6() *string { if o == nil || IsNil(o.Gatewayv6.Get()) { - var ret *V1NetworkGateway + var ret *string return ret } return o.Gatewayv6.Get() @@ -157,7 +159,7 @@ func (o *Network) GetGatewayv6() *V1NetworkGateway { // GetGatewayv6Ok returns a tuple with the Gatewayv6 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 *Network) GetGatewayv6Ok() (*V1NetworkGateway, bool) { +func (o *Network) GetGatewayv6Ok() (*string, bool) { if o == nil { return nil, false } @@ -173,8 +175,8 @@ func (o *Network) HasGatewayv6() bool { return false } -// SetGatewayv6 gets a reference to the given V1NetworkGateway and assigns it to the Gatewayv6 field. -func (o *Network) SetGatewayv6(v *V1NetworkGateway) { +// SetGatewayv6 gets a reference to the given string and assigns it to the Gatewayv6 field. +func (o *Network) SetGatewayv6(v *string) { o.Gatewayv6.Set(v) } diff --git a/services/iaas/model_nic.go b/services/iaas/model_nic.go new file mode 100644 index 00000000..6587354d --- /dev/null +++ b/services/iaas/model_nic.go @@ -0,0 +1,563 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NIC type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NIC{} + +// NIC Object that represents a network interface. +type NIC struct { + // A list of IPs or CIDR notations. + AllowedAddresses *[]AllowedAddressesInner `json:"allowedAddresses,omitempty"` + // Universally Unique Identifier (UUID). + Device *string `json:"device,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents an IP address. + Ipv4 *string `json:"ipv4,omitempty"` + // Object that represents an IPv6 address. + Ipv6 *string `json:"ipv6,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Object that represents an MAC address. + Mac *string `json:"mac,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + NetworkId *string `json:"networkId,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity *bool `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups *[]string `json:"securityGroups,omitempty"` + Status *string `json:"status,omitempty"` + Type *string `json:"type,omitempty"` +} + +// NewNIC instantiates a new NIC 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 NewNIC() *NIC { + this := NIC{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// NewNICWithDefaults instantiates a new NIC 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 NewNICWithDefaults() *NIC { + this := NIC{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *NIC) GetAllowedAddresses() *[]AllowedAddressesInner { + if o == nil || IsNil(o.AllowedAddresses) { + var ret *[]AllowedAddressesInner + return ret + } + return o.AllowedAddresses +} + +// 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 *NIC) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bool) { + if o == nil || IsNil(o.AllowedAddresses) { + return nil, false + } + return o.AllowedAddresses, true +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *NIC) HasAllowedAddresses() bool { + if o != nil && !IsNil(o.AllowedAddresses) { + return true + } + + return false +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *NIC) SetAllowedAddresses(v *[]AllowedAddressesInner) { + o.AllowedAddresses = v +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *NIC) GetDevice() *string { + if o == nil || IsNil(o.Device) { + var ret *string + return ret + } + return o.Device +} + +// 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 *NIC) GetDeviceOk() (*string, bool) { + if o == nil || IsNil(o.Device) { + return nil, false + } + return o.Device, true +} + +// HasDevice returns a boolean if a field has been set. +func (o *NIC) HasDevice() bool { + if o != nil && !IsNil(o.Device) { + return true + } + + return false +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *NIC) SetDevice(v *string) { + o.Device = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NIC) 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 *NIC) 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 *NIC) 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 *NIC) SetId(v *string) { + o.Id = v +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *NIC) GetIpv4() *string { + if o == nil || IsNil(o.Ipv4) { + var ret *string + return ret + } + return o.Ipv4 +} + +// 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 *NIC) GetIpv4Ok() (*string, bool) { + if o == nil || IsNil(o.Ipv4) { + return nil, false + } + return o.Ipv4, true +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *NIC) HasIpv4() bool { + if o != nil && !IsNil(o.Ipv4) { + return true + } + + return false +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *NIC) SetIpv4(v *string) { + o.Ipv4 = v +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *NIC) GetIpv6() *string { + if o == nil || IsNil(o.Ipv6) { + var ret *string + return ret + } + return o.Ipv6 +} + +// 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 *NIC) GetIpv6Ok() (*string, bool) { + if o == nil || IsNil(o.Ipv6) { + return nil, false + } + return o.Ipv6, true +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *NIC) HasIpv6() bool { + if o != nil && !IsNil(o.Ipv6) { + return true + } + + return false +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *NIC) SetIpv6(v *string) { + o.Ipv6 = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *NIC) 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 *NIC) 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 *NIC) 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 *NIC) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *NIC) GetMac() *string { + if o == nil || IsNil(o.Mac) { + var ret *string + return ret + } + return o.Mac +} + +// 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 *NIC) GetMacOk() (*string, bool) { + if o == nil || IsNil(o.Mac) { + return nil, false + } + return o.Mac, true +} + +// HasMac returns a boolean if a field has been set. +func (o *NIC) HasMac() bool { + if o != nil && !IsNil(o.Mac) { + return true + } + + return false +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *NIC) SetMac(v *string) { + o.Mac = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *NIC) 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 *NIC) 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 *NIC) 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 *NIC) SetName(v *string) { + o.Name = v +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *NIC) GetNetworkId() *string { + if o == nil || IsNil(o.NetworkId) { + var ret *string + return ret + } + return o.NetworkId +} + +// 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 *NIC) GetNetworkIdOk() (*string, bool) { + if o == nil || IsNil(o.NetworkId) { + return nil, false + } + return o.NetworkId, true +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *NIC) HasNetworkId() bool { + if o != nil && !IsNil(o.NetworkId) { + return true + } + + return false +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *NIC) SetNetworkId(v *string) { + o.NetworkId = v +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *NIC) GetNicSecurity() *bool { + if o == nil || IsNil(o.NicSecurity) { + var ret *bool + return ret + } + return o.NicSecurity +} + +// 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 *NIC) GetNicSecurityOk() (*bool, bool) { + if o == nil || IsNil(o.NicSecurity) { + return nil, false + } + return o.NicSecurity, true +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *NIC) HasNicSecurity() bool { + if o != nil && !IsNil(o.NicSecurity) { + return true + } + + return false +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *NIC) SetNicSecurity(v *bool) { + o.NicSecurity = v +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *NIC) GetSecurityGroups() *[]string { + if o == nil || IsNil(o.SecurityGroups) { + var ret *[]string + return ret + } + return o.SecurityGroups +} + +// 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 *NIC) GetSecurityGroupsOk() (*[]string, bool) { + if o == nil || IsNil(o.SecurityGroups) { + return nil, false + } + return o.SecurityGroups, true +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *NIC) HasSecurityGroups() bool { + if o != nil && !IsNil(o.SecurityGroups) { + return true + } + + return false +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *NIC) SetSecurityGroups(v *[]string) { + o.SecurityGroups = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NIC) 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 *NIC) 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 *NIC) 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 *NIC) SetStatus(v *string) { + o.Status = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *NIC) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *NIC) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *NIC) SetType(v *string) { + o.Type = v +} + +func (o NIC) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AllowedAddresses) { + toSerialize["allowedAddresses"] = o.AllowedAddresses + } + if !IsNil(o.Device) { + toSerialize["device"] = o.Device + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Ipv4) { + toSerialize["ipv4"] = o.Ipv4 + } + if !IsNil(o.Ipv6) { + toSerialize["ipv6"] = o.Ipv6 + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Mac) { + toSerialize["mac"] = o.Mac + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NetworkId) { + toSerialize["networkId"] = o.NetworkId + } + if !IsNil(o.NicSecurity) { + toSerialize["nicSecurity"] = o.NicSecurity + } + if !IsNil(o.SecurityGroups) { + toSerialize["securityGroups"] = o.SecurityGroups + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + return toSerialize, nil +} + +type NullableNIC struct { + value *NIC + isSet bool +} + +func (v NullableNIC) Get() *NIC { + return v.value +} + +func (v *NullableNIC) Set(val *NIC) { + v.value = val + v.isSet = true +} + +func (v NullableNIC) IsSet() bool { + return v.isSet +} + +func (v *NullableNIC) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNIC(val *NIC) *NullableNIC { + return &NullableNIC{value: val, isSet: true} +} + +func (v NullableNIC) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNIC) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_nic_list_response.go b/services/iaas/model_nic_list_response.go new file mode 100644 index 00000000..e045780d --- /dev/null +++ b/services/iaas/model_nic_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NICListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NICListResponse{} + +// NICListResponse NIC list response. +type NICListResponse struct { + // A list of network interfaces. + // REQUIRED + Items *[]NIC `json:"items"` +} + +type _NICListResponse NICListResponse + +// NewNICListResponse instantiates a new NICListResponse 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 NewNICListResponse(items *[]NIC) *NICListResponse { + this := NICListResponse{} + this.Items = items + return &this +} + +// NewNICListResponseWithDefaults instantiates a new NICListResponse 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 NewNICListResponseWithDefaults() *NICListResponse { + this := NICListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NICListResponse) GetItems() *[]NIC { + if o == nil { + var ret *[]NIC + 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 *NICListResponse) GetItemsOk() (*[]NIC, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *NICListResponse) SetItems(v *[]NIC) { + o.Items = v +} + +func (o NICListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableNICListResponse struct { + value *NICListResponse + isSet bool +} + +func (v NullableNICListResponse) Get() *NICListResponse { + return v.value +} + +func (v *NullableNICListResponse) Set(val *NICListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNICListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNICListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNICListResponse(val *NICListResponse) *NullableNICListResponse { + return &NullableNICListResponse{value: val, isSet: true} +} + +func (v NullableNICListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNICListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_port_range.go b/services/iaas/model_port_range.go new file mode 100644 index 00000000..81eb71ca --- /dev/null +++ b/services/iaas/model_port_range.go @@ -0,0 +1,140 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PortRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortRange{} + +// PortRange Object that represents a range of ports. +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. + // REQUIRED + Min *int64 `json:"min"` +} + +type _PortRange PortRange + +// NewPortRange instantiates a new PortRange 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 NewPortRange(max *int64, min *int64) *PortRange { + this := PortRange{} + this.Max = max + this.Min = min + return &this +} + +// NewPortRangeWithDefaults instantiates a new PortRange 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 NewPortRangeWithDefaults() *PortRange { + this := PortRange{} + return &this +} + +// GetMax returns the Max field value +func (o *PortRange) GetMax() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Max +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *PortRange) GetMaxOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Max, true +} + +// SetMax sets field value +func (o *PortRange) SetMax(v *int64) { + o.Max = v +} + +// GetMin returns the Min field value +func (o *PortRange) GetMin() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Min +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *PortRange) GetMinOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Min, true +} + +// SetMin sets field value +func (o *PortRange) SetMin(v *int64) { + o.Min = v +} + +func (o PortRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["max"] = o.Max + toSerialize["min"] = o.Min + return toSerialize, nil +} + +type NullablePortRange struct { + value *PortRange + isSet bool +} + +func (v NullablePortRange) Get() *PortRange { + return v.value +} + +func (v *NullablePortRange) Set(val *PortRange) { + v.value = val + v.isSet = true +} + +func (v NullablePortRange) IsSet() bool { + return v.isSet +} + +func (v *NullablePortRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortRange(val *PortRange) *NullablePortRange { + return &NullablePortRange{value: val, isSet: true} +} + +func (v NullablePortRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_protocol.go b/services/iaas/model_protocol.go new file mode 100644 index 00000000..6451227a --- /dev/null +++ b/services/iaas/model_protocol.go @@ -0,0 +1,154 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the Protocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Protocol{} + +// Protocol The schema for a protocol of a security group rule. +type Protocol struct { + // The protocol name which the rule should match. + Name *string `json:"name,omitempty"` + // The protocol number which the rule should match. + Number *int64 `json:"number,omitempty"` +} + +// NewProtocol instantiates a new Protocol 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 NewProtocol() *Protocol { + this := Protocol{} + return &this +} + +// NewProtocolWithDefaults instantiates a new Protocol 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 NewProtocolWithDefaults() *Protocol { + this := Protocol{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Protocol) 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 *Protocol) 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 *Protocol) 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 *Protocol) SetName(v *string) { + o.Name = v +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *Protocol) GetNumber() *int64 { + if o == nil || IsNil(o.Number) { + var ret *int64 + return ret + } + return o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Protocol) GetNumberOk() (*int64, bool) { + if o == nil || IsNil(o.Number) { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *Protocol) HasNumber() bool { + if o != nil && !IsNil(o.Number) { + return true + } + + return false +} + +// SetNumber gets a reference to the given int64 and assigns it to the Number field. +func (o *Protocol) SetNumber(v *int64) { + o.Number = v +} + +func (o Protocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Number) { + toSerialize["number"] = o.Number + } + return toSerialize, nil +} + +type NullableProtocol struct { + value *Protocol + isSet bool +} + +func (v NullableProtocol) Get() *Protocol { + return v.value +} + +func (v *NullableProtocol) Set(val *Protocol) { + v.value = val + v.isSet = true +} + +func (v NullableProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocol(val *Protocol) *NullableProtocol { + return &NullableProtocol{value: val, isSet: true} +} + +func (v NullableProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_public_ip.go b/services/iaas/model_public_ip.go new file mode 100644 index 00000000..e41de322 --- /dev/null +++ b/services/iaas/model_public_ip.go @@ -0,0 +1,239 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicIp type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicIp{} + +// PublicIp Object that represents a public IP. +type PublicIp 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"` + // Universally Unique Identifier (UUID). + NetworkInterface *NullableString `json:"networkInterface,omitempty"` +} + +// NewPublicIp instantiates a new PublicIp 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 NewPublicIp() *PublicIp { + this := PublicIp{} + return &this +} + +// NewPublicIpWithDefaults instantiates a new PublicIp 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 NewPublicIpWithDefaults() *PublicIp { + this := PublicIp{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PublicIp) 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 *PublicIp) 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 *PublicIp) 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 *PublicIp) SetId(v *string) { + o.Id = v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *PublicIp) 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 *PublicIp) 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 *PublicIp) 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 *PublicIp) SetIp(v *string) { + o.Ip = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PublicIp) 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 *PublicIp) 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 *PublicIp) 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 *PublicIp) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PublicIp) GetNetworkInterface() *string { + if o == nil || IsNil(o.NetworkInterface.Get()) { + var ret *string + return ret + } + return o.NetworkInterface.Get() +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface 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 *PublicIp) GetNetworkInterfaceOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NetworkInterface.Get(), o.NetworkInterface.IsSet() +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *PublicIp) HasNetworkInterface() bool { + if o != nil && o.NetworkInterface.IsSet() { + return true + } + + return false +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *PublicIp) SetNetworkInterface(v *string) { + o.NetworkInterface.Set(v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *PublicIp) SetNetworkInterfaceNil() { + o.NetworkInterface.Set(nil) +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *PublicIp) UnsetNetworkInterface() { + o.NetworkInterface.Unset() +} + +func (o PublicIp) 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 o.NetworkInterface.IsSet() { + toSerialize["networkInterface"] = o.NetworkInterface.Get() + } + return toSerialize, nil +} + +type NullablePublicIp struct { + value *PublicIp + isSet bool +} + +func (v NullablePublicIp) Get() *PublicIp { + return v.value +} + +func (v *NullablePublicIp) Set(val *PublicIp) { + v.value = val + v.isSet = true +} + +func (v NullablePublicIp) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicIp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicIp(val *PublicIp) *NullablePublicIp { + return &NullablePublicIp{value: val, isSet: true} +} + +func (v NullablePublicIp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicIp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_public_ip_list_response.go b/services/iaas/model_public_ip_list_response.go new file mode 100644 index 00000000..6b8c2863 --- /dev/null +++ b/services/iaas/model_public_ip_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicIpListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicIpListResponse{} + +// PublicIpListResponse Public IP list response. +type PublicIpListResponse struct { + // A list of public IPs. + // REQUIRED + Items *[]PublicIp `json:"items"` +} + +type _PublicIpListResponse PublicIpListResponse + +// NewPublicIpListResponse instantiates a new PublicIpListResponse 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 NewPublicIpListResponse(items *[]PublicIp) *PublicIpListResponse { + this := PublicIpListResponse{} + this.Items = items + return &this +} + +// NewPublicIpListResponseWithDefaults instantiates a new PublicIpListResponse 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 NewPublicIpListResponseWithDefaults() *PublicIpListResponse { + this := PublicIpListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *PublicIpListResponse) GetItems() *[]PublicIp { + if o == nil { + var ret *[]PublicIp + 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 *PublicIpListResponse) GetItemsOk() (*[]PublicIp, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *PublicIpListResponse) SetItems(v *[]PublicIp) { + o.Items = v +} + +func (o PublicIpListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullablePublicIpListResponse struct { + value *PublicIpListResponse + isSet bool +} + +func (v NullablePublicIpListResponse) Get() *PublicIpListResponse { + return v.value +} + +func (v *NullablePublicIpListResponse) Set(val *PublicIpListResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePublicIpListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicIpListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicIpListResponse(val *PublicIpListResponse) *NullablePublicIpListResponse { + return &NullablePublicIpListResponse{value: val, isSet: true} +} + +func (v NullablePublicIpListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicIpListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_rescue_server_payload.go b/services/iaas/model_rescue_server_payload.go new file mode 100644 index 00000000..099ef282 --- /dev/null +++ b/services/iaas/model_rescue_server_payload.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RescueServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RescueServerPayload{} + +// RescueServerPayload struct for RescueServerPayload +type RescueServerPayload struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Image *string `json:"image"` +} + +type _RescueServerPayload RescueServerPayload + +// NewRescueServerPayload instantiates a new RescueServerPayload 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 NewRescueServerPayload(image *string) *RescueServerPayload { + this := RescueServerPayload{} + this.Image = image + return &this +} + +// NewRescueServerPayloadWithDefaults instantiates a new RescueServerPayload 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 NewRescueServerPayloadWithDefaults() *RescueServerPayload { + this := RescueServerPayload{} + return &this +} + +// GetImage returns the Image field value +func (o *RescueServerPayload) GetImage() *string { + if o == nil { + var ret *string + return ret + } + + return o.Image +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +func (o *RescueServerPayload) GetImageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Image, true +} + +// SetImage sets field value +func (o *RescueServerPayload) SetImage(v *string) { + o.Image = v +} + +func (o RescueServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["image"] = o.Image + return toSerialize, nil +} + +type NullableRescueServerPayload struct { + value *RescueServerPayload + isSet bool +} + +func (v NullableRescueServerPayload) Get() *RescueServerPayload { + return v.value +} + +func (v *NullableRescueServerPayload) Set(val *RescueServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRescueServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRescueServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRescueServerPayload(val *RescueServerPayload) *NullableRescueServerPayload { + return &NullableRescueServerPayload{value: val, isSet: true} +} + +func (v NullableRescueServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRescueServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_resize_server_payload.go b/services/iaas/model_resize_server_payload.go new file mode 100644 index 00000000..95f585ee --- /dev/null +++ b/services/iaas/model_resize_server_payload.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ResizeServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResizeServerPayload{} + +// ResizeServerPayload struct for ResizeServerPayload +type ResizeServerPayload struct { + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType *string `json:"machineType"` +} + +type _ResizeServerPayload ResizeServerPayload + +// NewResizeServerPayload instantiates a new ResizeServerPayload 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 NewResizeServerPayload(machineType *string) *ResizeServerPayload { + this := ResizeServerPayload{} + this.MachineType = machineType + return &this +} + +// NewResizeServerPayloadWithDefaults instantiates a new ResizeServerPayload 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 NewResizeServerPayloadWithDefaults() *ResizeServerPayload { + this := ResizeServerPayload{} + return &this +} + +// GetMachineType returns the MachineType field value +func (o *ResizeServerPayload) GetMachineType() *string { + if o == nil { + var ret *string + return ret + } + + return o.MachineType +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *ResizeServerPayload) GetMachineTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.MachineType, true +} + +// SetMachineType sets field value +func (o *ResizeServerPayload) SetMachineType(v *string) { + o.MachineType = v +} + +func (o ResizeServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["machineType"] = o.MachineType + return toSerialize, nil +} + +type NullableResizeServerPayload struct { + value *ResizeServerPayload + isSet bool +} + +func (v NullableResizeServerPayload) Get() *ResizeServerPayload { + return v.value +} + +func (v *NullableResizeServerPayload) Set(val *ResizeServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableResizeServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResizeServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResizeServerPayload(val *ResizeServerPayload) *NullableResizeServerPayload { + return &NullableResizeServerPayload{value: val, isSet: true} +} + +func (v NullableResizeServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResizeServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_resize_volume_payload.go b/services/iaas/model_resize_volume_payload.go new file mode 100644 index 00000000..7ba247a6 --- /dev/null +++ b/services/iaas/model_resize_volume_payload.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ResizeVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResizeVolumePayload{} + +// ResizeVolumePayload struct for ResizeVolumePayload +type ResizeVolumePayload struct { + // Size in Gigabyte. + // REQUIRED + Size *int64 `json:"size"` +} + +type _ResizeVolumePayload ResizeVolumePayload + +// NewResizeVolumePayload instantiates a new ResizeVolumePayload 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 NewResizeVolumePayload(size *int64) *ResizeVolumePayload { + this := ResizeVolumePayload{} + this.Size = size + return &this +} + +// NewResizeVolumePayloadWithDefaults instantiates a new ResizeVolumePayload 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 NewResizeVolumePayloadWithDefaults() *ResizeVolumePayload { + this := ResizeVolumePayload{} + return &this +} + +// GetSize returns the Size field value +func (o *ResizeVolumePayload) GetSize() *int64 { + if o == nil { + var ret *int64 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ResizeVolumePayload) GetSizeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.Size, true +} + +// SetSize sets field value +func (o *ResizeVolumePayload) SetSize(v *int64) { + o.Size = v +} + +func (o ResizeVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["size"] = o.Size + return toSerialize, nil +} + +type NullableResizeVolumePayload struct { + value *ResizeVolumePayload + isSet bool +} + +func (v NullableResizeVolumePayload) Get() *ResizeVolumePayload { + return v.value +} + +func (v *NullableResizeVolumePayload) Set(val *ResizeVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableResizeVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResizeVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResizeVolumePayload(val *ResizeVolumePayload) *NullableResizeVolumePayload { + return &NullableResizeVolumePayload{value: val, isSet: true} +} + +func (v NullableResizeVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResizeVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_security_group.go b/services/iaas/model_security_group.go new file mode 100644 index 00000000..e041b627 --- /dev/null +++ b/services/iaas/model_security_group.go @@ -0,0 +1,375 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the SecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroup{} + +// SecurityGroup Object that represents a security group. +type SecurityGroup struct { + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name *string `json:"name"` + // A list containing security group rule objects. + Rules *[]SecurityGroupRule `json:"rules,omitempty"` + // Shows if a security group is stateful or stateless. You can only have one type of security groups per network interface/server. + Stateful *bool `json:"stateful,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _SecurityGroup SecurityGroup + +// NewSecurityGroup instantiates a new SecurityGroup 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 NewSecurityGroup(name *string) *SecurityGroup { + this := SecurityGroup{} + this.Name = name + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// NewSecurityGroupWithDefaults instantiates a new SecurityGroup 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 NewSecurityGroupWithDefaults() *SecurityGroup { + this := SecurityGroup{} + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) SetDescription(v *string) { + o.Description = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value +func (o *SecurityGroup) 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 *SecurityGroup) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *SecurityGroup) SetName(v *string) { + o.Name = v +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *SecurityGroup) GetRules() *[]SecurityGroupRule { + if o == nil || IsNil(o.Rules) { + var ret *[]SecurityGroupRule + return ret + } + return o.Rules +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetRulesOk() (*[]SecurityGroupRule, bool) { + if o == nil || IsNil(o.Rules) { + return nil, false + } + return o.Rules, true +} + +// HasRules returns a boolean if a field has been set. +func (o *SecurityGroup) HasRules() bool { + if o != nil && !IsNil(o.Rules) { + return true + } + + return false +} + +// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field. +func (o *SecurityGroup) SetRules(v *[]SecurityGroupRule) { + o.Rules = v +} + +// GetStateful returns the Stateful field value if set, zero value otherwise. +func (o *SecurityGroup) GetStateful() *bool { + if o == nil || IsNil(o.Stateful) { + var ret *bool + return ret + } + return o.Stateful +} + +// GetStatefulOk returns a tuple with the Stateful field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetStatefulOk() (*bool, bool) { + if o == nil || IsNil(o.Stateful) { + return nil, false + } + return o.Stateful, true +} + +// HasStateful returns a boolean if a field has been set. +func (o *SecurityGroup) HasStateful() bool { + if o != nil && !IsNil(o.Stateful) { + return true + } + + return false +} + +// SetStateful gets a reference to the given bool and assigns it to the Stateful field. +func (o *SecurityGroup) SetStateful(v *bool) { + o.Stateful = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) 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 *SecurityGroup) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o SecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.Rules) { + toSerialize["rules"] = o.Rules + } + if !IsNil(o.Stateful) { + toSerialize["stateful"] = o.Stateful + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableSecurityGroup struct { + value *SecurityGroup + isSet bool +} + +func (v NullableSecurityGroup) Get() *SecurityGroup { + return v.value +} + +func (v *NullableSecurityGroup) Set(val *SecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroup(val *SecurityGroup) *NullableSecurityGroup { + return &NullableSecurityGroup{value: val, isSet: true} +} + +func (v NullableSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_security_group_list_response.go b/services/iaas/model_security_group_list_response.go new file mode 100644 index 00000000..c680b20b --- /dev/null +++ b/services/iaas/model_security_group_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupListResponse{} + +// SecurityGroupListResponse Security group list response. +type SecurityGroupListResponse struct { + // A list containing security group objects. + // REQUIRED + Items *[]SecurityGroup `json:"items"` +} + +type _SecurityGroupListResponse SecurityGroupListResponse + +// NewSecurityGroupListResponse instantiates a new SecurityGroupListResponse 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 NewSecurityGroupListResponse(items *[]SecurityGroup) *SecurityGroupListResponse { + this := SecurityGroupListResponse{} + this.Items = items + return &this +} + +// NewSecurityGroupListResponseWithDefaults instantiates a new SecurityGroupListResponse 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 NewSecurityGroupListResponseWithDefaults() *SecurityGroupListResponse { + this := SecurityGroupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SecurityGroupListResponse) GetItems() *[]SecurityGroup { + if o == nil { + var ret *[]SecurityGroup + 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 *SecurityGroupListResponse) GetItemsOk() (*[]SecurityGroup, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *SecurityGroupListResponse) SetItems(v *[]SecurityGroup) { + o.Items = v +} + +func (o SecurityGroupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableSecurityGroupListResponse struct { + value *SecurityGroupListResponse + isSet bool +} + +func (v NullableSecurityGroupListResponse) Get() *SecurityGroupListResponse { + return v.value +} + +func (v *NullableSecurityGroupListResponse) Set(val *SecurityGroupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupListResponse(val *SecurityGroupListResponse) *NullableSecurityGroupListResponse { + return &NullableSecurityGroupListResponse{value: val, isSet: true} +} + +func (v NullableSecurityGroupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_security_group_rule.go b/services/iaas/model_security_group_rule.go new file mode 100644 index 00000000..e66517d5 --- /dev/null +++ b/services/iaas/model_security_group_rule.go @@ -0,0 +1,445 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRule{} + +// SecurityGroupRule Object that represents a security group rule. +type SecurityGroupRule struct { + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // The direction of the traffic which the rule should match. + // REQUIRED + Direction *string `json:"direction"` + // The ethertype which the rule should match. + Ethertype *string `json:"ethertype,omitempty"` + IcmpParameters *ICMPParameters `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange *string `json:"ipRange,omitempty"` + PortRange *PortRange `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId *string `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId *string `json:"securityGroupId,omitempty"` + Protocol *Protocol `json:"protocol,omitempty"` +} + +type _SecurityGroupRule SecurityGroupRule + +// NewSecurityGroupRule instantiates a new SecurityGroupRule 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 NewSecurityGroupRule(direction *string) *SecurityGroupRule { + this := SecurityGroupRule{} + this.Direction = direction + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// NewSecurityGroupRuleWithDefaults instantiates a new SecurityGroupRule 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 NewSecurityGroupRuleWithDefaults() *SecurityGroupRule { + this := SecurityGroupRule{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroupRule) 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 *SecurityGroupRule) 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 *SecurityGroupRule) 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 *SecurityGroupRule) SetDescription(v *string) { + o.Description = v +} + +// GetDirection returns the Direction field value +func (o *SecurityGroupRule) GetDirection() *string { + if o == nil { + var ret *string + return ret + } + + return o.Direction +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetDirectionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Direction, true +} + +// SetDirection sets field value +func (o *SecurityGroupRule) SetDirection(v *string) { + o.Direction = v +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetEthertype() *string { + if o == nil || IsNil(o.Ethertype) { + var ret *string + return ret + } + return o.Ethertype +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetEthertypeOk() (*string, bool) { + if o == nil || IsNil(o.Ethertype) { + return nil, false + } + return o.Ethertype, true +} + +// HasEthertype returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasEthertype() bool { + if o != nil && !IsNil(o.Ethertype) { + return true + } + + return false +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *SecurityGroupRule) SetEthertype(v *string) { + o.Ethertype = v +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetIcmpParameters() *ICMPParameters { + if o == nil || IsNil(o.IcmpParameters) { + var ret *ICMPParameters + return ret + } + return o.IcmpParameters +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIcmpParametersOk() (*ICMPParameters, bool) { + if o == nil || IsNil(o.IcmpParameters) { + return nil, false + } + return o.IcmpParameters, true +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasIcmpParameters() bool { + if o != nil && !IsNil(o.IcmpParameters) { + return true + } + + return false +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *SecurityGroupRule) SetIcmpParameters(v *ICMPParameters) { + o.IcmpParameters = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroupRule) 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 *SecurityGroupRule) 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 *SecurityGroupRule) 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 *SecurityGroupRule) SetId(v *string) { + o.Id = v +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetIpRange() *string { + if o == nil || IsNil(o.IpRange) { + var ret *string + return ret + } + return o.IpRange +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIpRangeOk() (*string, bool) { + if o == nil || IsNil(o.IpRange) { + return nil, false + } + return o.IpRange, true +} + +// HasIpRange returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasIpRange() bool { + if o != nil && !IsNil(o.IpRange) { + return true + } + + return false +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *SecurityGroupRule) SetIpRange(v *string) { + o.IpRange = v +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetPortRange() *PortRange { + if o == nil || IsNil(o.PortRange) { + var ret *PortRange + return ret + } + return o.PortRange +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetPortRangeOk() (*PortRange, bool) { + if o == nil || IsNil(o.PortRange) { + return nil, false + } + return o.PortRange, true +} + +// HasPortRange returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasPortRange() bool { + if o != nil && !IsNil(o.PortRange) { + return true + } + + return false +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *SecurityGroupRule) SetPortRange(v *PortRange) { + o.PortRange = v +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetRemoteSecurityGroupId() *string { + if o == nil || IsNil(o.RemoteSecurityGroupId) { + var ret *string + return ret + } + return o.RemoteSecurityGroupId +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetRemoteSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.RemoteSecurityGroupId) { + return nil, false + } + return o.RemoteSecurityGroupId, true +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasRemoteSecurityGroupId() bool { + if o != nil && !IsNil(o.RemoteSecurityGroupId) { + return true + } + + return false +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *SecurityGroupRule) SetRemoteSecurityGroupId(v *string) { + o.RemoteSecurityGroupId = v +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetSecurityGroupId() *string { + if o == nil || IsNil(o.SecurityGroupId) { + var ret *string + return ret + } + return o.SecurityGroupId +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.SecurityGroupId) { + return nil, false + } + return o.SecurityGroupId, true +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasSecurityGroupId() bool { + if o != nil && !IsNil(o.SecurityGroupId) { + return true + } + + return false +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *SecurityGroupRule) SetSecurityGroupId(v *string) { + o.SecurityGroupId = v +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetProtocol() *Protocol { + if o == nil || IsNil(o.Protocol) { + var ret *Protocol + return ret + } + return o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetProtocolOk() (*Protocol, bool) { + if o == nil || IsNil(o.Protocol) { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasProtocol() bool { + if o != nil && !IsNil(o.Protocol) { + return true + } + + return false +} + +// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field. +func (o *SecurityGroupRule) SetProtocol(v *Protocol) { + o.Protocol = v +} + +func (o SecurityGroupRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["direction"] = o.Direction + if !IsNil(o.Ethertype) { + toSerialize["ethertype"] = o.Ethertype + } + if !IsNil(o.IcmpParameters) { + toSerialize["icmpParameters"] = o.IcmpParameters + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IpRange) { + toSerialize["ipRange"] = o.IpRange + } + if !IsNil(o.PortRange) { + toSerialize["portRange"] = o.PortRange + } + if !IsNil(o.RemoteSecurityGroupId) { + toSerialize["remoteSecurityGroupId"] = o.RemoteSecurityGroupId + } + if !IsNil(o.SecurityGroupId) { + toSerialize["securityGroupId"] = o.SecurityGroupId + } + if !IsNil(o.Protocol) { + toSerialize["protocol"] = o.Protocol + } + return toSerialize, nil +} + +type NullableSecurityGroupRule struct { + value *SecurityGroupRule + isSet bool +} + +func (v NullableSecurityGroupRule) Get() *SecurityGroupRule { + return v.value +} + +func (v *NullableSecurityGroupRule) Set(val *SecurityGroupRule) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRule) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRule(val *SecurityGroupRule) *NullableSecurityGroupRule { + return &NullableSecurityGroupRule{value: val, isSet: true} +} + +func (v NullableSecurityGroupRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_security_group_rule_list_response.go b/services/iaas/model_security_group_rule_list_response.go new file mode 100644 index 00000000..161d325d --- /dev/null +++ b/services/iaas/model_security_group_rule_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRuleListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRuleListResponse{} + +// SecurityGroupRuleListResponse Security group rule list response. +type SecurityGroupRuleListResponse struct { + // A list containing security group rule objects. + // REQUIRED + Items *[]SecurityGroupRule `json:"items"` +} + +type _SecurityGroupRuleListResponse SecurityGroupRuleListResponse + +// NewSecurityGroupRuleListResponse instantiates a new SecurityGroupRuleListResponse 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 NewSecurityGroupRuleListResponse(items *[]SecurityGroupRule) *SecurityGroupRuleListResponse { + this := SecurityGroupRuleListResponse{} + this.Items = items + return &this +} + +// NewSecurityGroupRuleListResponseWithDefaults instantiates a new SecurityGroupRuleListResponse 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 NewSecurityGroupRuleListResponseWithDefaults() *SecurityGroupRuleListResponse { + this := SecurityGroupRuleListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SecurityGroupRuleListResponse) GetItems() *[]SecurityGroupRule { + if o == nil { + var ret *[]SecurityGroupRule + 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 *SecurityGroupRuleListResponse) GetItemsOk() (*[]SecurityGroupRule, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *SecurityGroupRuleListResponse) SetItems(v *[]SecurityGroupRule) { + o.Items = v +} + +func (o SecurityGroupRuleListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableSecurityGroupRuleListResponse struct { + value *SecurityGroupRuleListResponse + isSet bool +} + +func (v NullableSecurityGroupRuleListResponse) Get() *SecurityGroupRuleListResponse { + return v.value +} + +func (v *NullableSecurityGroupRuleListResponse) Set(val *SecurityGroupRuleListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRuleListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRuleListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRuleListResponse(val *SecurityGroupRuleListResponse) *NullableSecurityGroupRuleListResponse { + return &NullableSecurityGroupRuleListResponse{value: val, isSet: true} +} + +func (v NullableSecurityGroupRuleListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRuleListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_security_group_rule_protocol.go b/services/iaas/model_security_group_rule_protocol.go new file mode 100644 index 00000000..2778627d --- /dev/null +++ b/services/iaas/model_security_group_rule_protocol.go @@ -0,0 +1,116 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRuleProtocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRuleProtocol{} + +// SecurityGroupRuleProtocol The internet protocol which the rule matches. +type SecurityGroupRuleProtocol struct { + Protocol *Protocol `json:"protocol,omitempty"` +} + +// NewSecurityGroupRuleProtocol instantiates a new SecurityGroupRuleProtocol 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 NewSecurityGroupRuleProtocol() *SecurityGroupRuleProtocol { + this := SecurityGroupRuleProtocol{} + return &this +} + +// NewSecurityGroupRuleProtocolWithDefaults instantiates a new SecurityGroupRuleProtocol 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 NewSecurityGroupRuleProtocolWithDefaults() *SecurityGroupRuleProtocol { + this := SecurityGroupRuleProtocol{} + return &this +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SecurityGroupRuleProtocol) GetProtocol() *Protocol { + if o == nil || IsNil(o.Protocol) { + var ret *Protocol + return ret + } + return o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRuleProtocol) GetProtocolOk() (*Protocol, bool) { + if o == nil || IsNil(o.Protocol) { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SecurityGroupRuleProtocol) HasProtocol() bool { + if o != nil && !IsNil(o.Protocol) { + return true + } + + return false +} + +// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field. +func (o *SecurityGroupRuleProtocol) SetProtocol(v *Protocol) { + o.Protocol = v +} + +func (o SecurityGroupRuleProtocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Protocol) { + toSerialize["protocol"] = o.Protocol + } + return toSerialize, nil +} + +type NullableSecurityGroupRuleProtocol struct { + value *SecurityGroupRuleProtocol + isSet bool +} + +func (v NullableSecurityGroupRuleProtocol) Get() *SecurityGroupRuleProtocol { + return v.value +} + +func (v *NullableSecurityGroupRuleProtocol) Set(val *SecurityGroupRuleProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRuleProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRuleProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRuleProtocol(val *SecurityGroupRuleProtocol) *NullableSecurityGroupRuleProtocol { + return &NullableSecurityGroupRuleProtocol{value: val, isSet: true} +} + +func (v NullableSecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRuleProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_server.go b/services/iaas/model_server.go new file mode 100644 index 00000000..935bc509 --- /dev/null +++ b/services/iaas/model_server.go @@ -0,0 +1,878 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Server type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Server{} + +// Server Representation of a single server object. +type Server struct { + // Universally Unique Identifier (UUID). + AffinityGroup *string `json:"affinityGroup,omitempty"` + // Object that represents an availability zone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + BootVolume *CreateServerPayloadBootVolume `json:"bootVolume,omitempty"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // An error message. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Universally Unique Identifier (UUID). + ImageId *string `json:"imageId,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + KeypairName *string `json:"keypairName,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // Date-time when resource was launched. + LaunchedAt *time.Time `json:"launchedAt,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType *string `json:"machineType"` + MaintenanceWindow *ServerMaintenance `json:"maintenanceWindow,omitempty"` + // The name for a Server. + // REQUIRED + Name *string `json:"name"` + Networking *CreateServerPayloadNetworking `json:"networking,omitempty"` + // A list of networks attached to a server. + Nics *[]ServerNetwork `json:"nics,omitempty"` + // The power status of a server. + PowerStatus *string `json:"powerStatus,omitempty"` + // A list of General Objects. + SecurityGroups *[]string `json:"securityGroups,omitempty"` + // A list of service account mails. + ServiceAccountMails *[]string `json:"serviceAccountMails,omitempty"` + // The status of a server object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init to the server. + UserData *string `json:"userData,omitempty"` + // A list of UUIDs. + Volumes *[]string `json:"volumes,omitempty"` +} + +type _Server Server + +// NewServer instantiates a new Server 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 NewServer(machineType *string, name *string) *Server { + this := Server{} + this.MachineType = machineType + this.Name = name + return &this +} + +// NewServerWithDefaults instantiates a new Server 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 NewServerWithDefaults() *Server { + this := Server{} + return &this +} + +// GetAffinityGroup returns the AffinityGroup field value if set, zero value otherwise. +func (o *Server) GetAffinityGroup() *string { + if o == nil || IsNil(o.AffinityGroup) { + var ret *string + return ret + } + return o.AffinityGroup +} + +// GetAffinityGroupOk returns a tuple with the AffinityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAffinityGroupOk() (*string, bool) { + if o == nil || IsNil(o.AffinityGroup) { + return nil, false + } + return o.AffinityGroup, true +} + +// HasAffinityGroup returns a boolean if a field has been set. +func (o *Server) HasAffinityGroup() bool { + if o != nil && !IsNil(o.AffinityGroup) { + return true + } + + return false +} + +// SetAffinityGroup gets a reference to the given string and assigns it to the AffinityGroup field. +func (o *Server) SetAffinityGroup(v *string) { + o.AffinityGroup = v +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *Server) GetAvailabilityZone() *string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret *string + return ret + } + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAvailabilityZoneOk() (*string, bool) { + if o == nil || IsNil(o.AvailabilityZone) { + return nil, false + } + return o.AvailabilityZone, true +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *Server) HasAvailabilityZone() bool { + if o != nil && !IsNil(o.AvailabilityZone) { + return true + } + + return false +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *Server) SetAvailabilityZone(v *string) { + o.AvailabilityZone = v +} + +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *Server) GetBootVolume() *CreateServerPayloadBootVolume { + if o == nil || IsNil(o.BootVolume) { + var ret *CreateServerPayloadBootVolume + return ret + } + return o.BootVolume +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetBootVolumeOk() (*CreateServerPayloadBootVolume, bool) { + if o == nil || IsNil(o.BootVolume) { + return nil, false + } + return o.BootVolume, true +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *Server) HasBootVolume() bool { + if o != nil && !IsNil(o.BootVolume) { + return true + } + + return false +} + +// SetBootVolume gets a reference to the given CreateServerPayloadBootVolume and assigns it to the BootVolume field. +func (o *Server) SetBootVolume(v *CreateServerPayloadBootVolume) { + o.BootVolume = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Server) 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 *Server) 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 *Server) 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 *Server) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *Server) GetErrorMessage() *string { + if o == nil || IsNil(o.ErrorMessage) { + var ret *string + return ret + } + return o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetErrorMessageOk() (*string, bool) { + if o == nil || IsNil(o.ErrorMessage) { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *Server) HasErrorMessage() bool { + if o != nil && !IsNil(o.ErrorMessage) { + return true + } + + return false +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *Server) SetErrorMessage(v *string) { + o.ErrorMessage = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Server) 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 *Server) 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 *Server) 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 *Server) SetId(v *string) { + o.Id = v +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *Server) GetImageId() *string { + if o == nil || IsNil(o.ImageId) { + var ret *string + return ret + } + return o.ImageId +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetImageIdOk() (*string, bool) { + if o == nil || IsNil(o.ImageId) { + return nil, false + } + return o.ImageId, true +} + +// HasImageId returns a boolean if a field has been set. +func (o *Server) HasImageId() bool { + if o != nil && !IsNil(o.ImageId) { + return true + } + + return false +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *Server) SetImageId(v *string) { + o.ImageId = v +} + +// GetKeypairName returns the KeypairName field value if set, zero value otherwise. +func (o *Server) GetKeypairName() *string { + if o == nil || IsNil(o.KeypairName) { + var ret *string + return ret + } + return o.KeypairName +} + +// GetKeypairNameOk returns a tuple with the KeypairName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetKeypairNameOk() (*string, bool) { + if o == nil || IsNil(o.KeypairName) { + return nil, false + } + return o.KeypairName, true +} + +// HasKeypairName returns a boolean if a field has been set. +func (o *Server) HasKeypairName() bool { + if o != nil && !IsNil(o.KeypairName) { + return true + } + + return false +} + +// SetKeypairName gets a reference to the given string and assigns it to the KeypairName field. +func (o *Server) SetKeypairName(v *string) { + o.KeypairName = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Server) 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 *Server) 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 *Server) 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 *Server) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetLaunchedAt returns the LaunchedAt field value if set, zero value otherwise. +func (o *Server) GetLaunchedAt() *time.Time { + if o == nil || IsNil(o.LaunchedAt) { + var ret *time.Time + return ret + } + return o.LaunchedAt +} + +// GetLaunchedAtOk returns a tuple with the LaunchedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetLaunchedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.LaunchedAt) { + return nil, false + } + return o.LaunchedAt, true +} + +// HasLaunchedAt returns a boolean if a field has been set. +func (o *Server) HasLaunchedAt() bool { + if o != nil && !IsNil(o.LaunchedAt) { + return true + } + + return false +} + +// SetLaunchedAt gets a reference to the given time.Time and assigns it to the LaunchedAt field. +func (o *Server) SetLaunchedAt(v *time.Time) { + o.LaunchedAt = v +} + +// GetMachineType returns the MachineType field value +func (o *Server) GetMachineType() *string { + if o == nil { + var ret *string + return ret + } + + return o.MachineType +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *Server) GetMachineTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.MachineType, true +} + +// SetMachineType sets field value +func (o *Server) SetMachineType(v *string) { + o.MachineType = v +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *Server) GetMaintenanceWindow() *ServerMaintenance { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret *ServerMaintenance + return ret + } + return o.MaintenanceWindow +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetMaintenanceWindowOk() (*ServerMaintenance, bool) { + if o == nil || IsNil(o.MaintenanceWindow) { + return nil, false + } + return o.MaintenanceWindow, true +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *Server) HasMaintenanceWindow() bool { + if o != nil && !IsNil(o.MaintenanceWindow) { + return true + } + + return false +} + +// SetMaintenanceWindow gets a reference to the given ServerMaintenance and assigns it to the MaintenanceWindow field. +func (o *Server) SetMaintenanceWindow(v *ServerMaintenance) { + o.MaintenanceWindow = v +} + +// GetName returns the Name field value +func (o *Server) 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 *Server) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *Server) SetName(v *string) { + o.Name = v +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *Server) GetNetworking() *CreateServerPayloadNetworking { + if o == nil || IsNil(o.Networking) { + var ret *CreateServerPayloadNetworking + return ret + } + return o.Networking +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetNetworkingOk() (*CreateServerPayloadNetworking, bool) { + if o == nil || IsNil(o.Networking) { + return nil, false + } + return o.Networking, true +} + +// HasNetworking returns a boolean if a field has been set. +func (o *Server) HasNetworking() bool { + if o != nil && !IsNil(o.Networking) { + return true + } + + return false +} + +// SetNetworking gets a reference to the given CreateServerPayloadNetworking and assigns it to the Networking field. +func (o *Server) SetNetworking(v *CreateServerPayloadNetworking) { + o.Networking = v +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *Server) GetNics() *[]ServerNetwork { + if o == nil || IsNil(o.Nics) { + var ret *[]ServerNetwork + return ret + } + return o.Nics +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetNicsOk() (*[]ServerNetwork, bool) { + if o == nil || IsNil(o.Nics) { + return nil, false + } + return o.Nics, true +} + +// HasNics returns a boolean if a field has been set. +func (o *Server) HasNics() bool { + if o != nil && !IsNil(o.Nics) { + return true + } + + return false +} + +// SetNics gets a reference to the given []ServerNetwork and assigns it to the Nics field. +func (o *Server) SetNics(v *[]ServerNetwork) { + o.Nics = v +} + +// GetPowerStatus returns the PowerStatus field value if set, zero value otherwise. +func (o *Server) GetPowerStatus() *string { + if o == nil || IsNil(o.PowerStatus) { + var ret *string + return ret + } + return o.PowerStatus +} + +// GetPowerStatusOk returns a tuple with the PowerStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetPowerStatusOk() (*string, bool) { + if o == nil || IsNil(o.PowerStatus) { + return nil, false + } + return o.PowerStatus, true +} + +// HasPowerStatus returns a boolean if a field has been set. +func (o *Server) HasPowerStatus() bool { + if o != nil && !IsNil(o.PowerStatus) { + return true + } + + return false +} + +// SetPowerStatus gets a reference to the given string and assigns it to the PowerStatus field. +func (o *Server) SetPowerStatus(v *string) { + o.PowerStatus = v +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *Server) GetSecurityGroups() *[]string { + if o == nil || IsNil(o.SecurityGroups) { + var ret *[]string + return ret + } + return o.SecurityGroups +} + +// 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 *Server) GetSecurityGroupsOk() (*[]string, bool) { + if o == nil || IsNil(o.SecurityGroups) { + return nil, false + } + return o.SecurityGroups, true +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *Server) HasSecurityGroups() bool { + if o != nil && !IsNil(o.SecurityGroups) { + return true + } + + return false +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *Server) SetSecurityGroups(v *[]string) { + o.SecurityGroups = v +} + +// GetServiceAccountMails returns the ServiceAccountMails field value if set, zero value otherwise. +func (o *Server) GetServiceAccountMails() *[]string { + if o == nil || IsNil(o.ServiceAccountMails) { + var ret *[]string + return ret + } + return o.ServiceAccountMails +} + +// GetServiceAccountMailsOk returns a tuple with the ServiceAccountMails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetServiceAccountMailsOk() (*[]string, bool) { + if o == nil || IsNil(o.ServiceAccountMails) { + return nil, false + } + return o.ServiceAccountMails, true +} + +// HasServiceAccountMails returns a boolean if a field has been set. +func (o *Server) HasServiceAccountMails() bool { + if o != nil && !IsNil(o.ServiceAccountMails) { + return true + } + + return false +} + +// SetServiceAccountMails gets a reference to the given []string and assigns it to the ServiceAccountMails field. +func (o *Server) SetServiceAccountMails(v *[]string) { + o.ServiceAccountMails = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Server) 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 *Server) 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 *Server) 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 *Server) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Server) 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 *Server) 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 *Server) 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 *Server) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *Server) GetUserData() *string { + if o == nil || IsNil(o.UserData) { + var ret *string + return ret + } + return o.UserData +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetUserDataOk() (*string, bool) { + if o == nil || IsNil(o.UserData) { + return nil, false + } + return o.UserData, true +} + +// HasUserData returns a boolean if a field has been set. +func (o *Server) HasUserData() bool { + if o != nil && !IsNil(o.UserData) { + return true + } + + return false +} + +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *Server) SetUserData(v *string) { + o.UserData = v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *Server) GetVolumes() *[]string { + if o == nil || IsNil(o.Volumes) { + var ret *[]string + return ret + } + return o.Volumes +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetVolumesOk() (*[]string, bool) { + if o == nil || IsNil(o.Volumes) { + return nil, false + } + return o.Volumes, true +} + +// HasVolumes returns a boolean if a field has been set. +func (o *Server) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *Server) SetVolumes(v *[]string) { + o.Volumes = v +} + +func (o Server) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AffinityGroup) { + toSerialize["affinityGroup"] = o.AffinityGroup + } + if !IsNil(o.AvailabilityZone) { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + if !IsNil(o.BootVolume) { + toSerialize["bootVolume"] = o.BootVolume + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.ErrorMessage) { + toSerialize["errorMessage"] = o.ErrorMessage + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.ImageId) { + toSerialize["imageId"] = o.ImageId + } + if !IsNil(o.KeypairName) { + toSerialize["keypairName"] = o.KeypairName + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.LaunchedAt) { + toSerialize["launchedAt"] = o.LaunchedAt + } + toSerialize["machineType"] = o.MachineType + if !IsNil(o.MaintenanceWindow) { + toSerialize["maintenanceWindow"] = o.MaintenanceWindow + } + toSerialize["name"] = o.Name + if !IsNil(o.Networking) { + toSerialize["networking"] = o.Networking + } + if !IsNil(o.Nics) { + toSerialize["nics"] = o.Nics + } + if !IsNil(o.PowerStatus) { + toSerialize["powerStatus"] = o.PowerStatus + } + if !IsNil(o.SecurityGroups) { + toSerialize["securityGroups"] = o.SecurityGroups + } + if !IsNil(o.ServiceAccountMails) { + toSerialize["serviceAccountMails"] = o.ServiceAccountMails + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + if !IsNil(o.UserData) { + toSerialize["userData"] = o.UserData + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + return toSerialize, nil +} + +type NullableServer struct { + value *Server + isSet bool +} + +func (v NullableServer) Get() *Server { + return v.value +} + +func (v *NullableServer) Set(val *Server) { + v.value = val + v.isSet = true +} + +func (v NullableServer) IsSet() bool { + return v.isSet +} + +func (v *NullableServer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServer(val *Server) *NullableServer { + return &NullableServer{value: val, isSet: true} +} + +func (v NullableServer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_server_console_url.go b/services/iaas/model_server_console_url.go new file mode 100644 index 00000000..d583eb1f --- /dev/null +++ b/services/iaas/model_server_console_url.go @@ -0,0 +1,110 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerConsoleUrl type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerConsoleUrl{} + +// ServerConsoleUrl Object that represents a server console URL. +type ServerConsoleUrl struct { + // REQUIRED + Url *string `json:"url"` +} + +type _ServerConsoleUrl ServerConsoleUrl + +// NewServerConsoleUrl instantiates a new ServerConsoleUrl 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 NewServerConsoleUrl(url *string) *ServerConsoleUrl { + this := ServerConsoleUrl{} + this.Url = url + return &this +} + +// NewServerConsoleUrlWithDefaults instantiates a new ServerConsoleUrl 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 NewServerConsoleUrlWithDefaults() *ServerConsoleUrl { + this := ServerConsoleUrl{} + return &this +} + +// GetUrl returns the Url field value +func (o *ServerConsoleUrl) GetUrl() *string { + if o == nil { + var ret *string + return ret + } + + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServerConsoleUrl) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Url, true +} + +// SetUrl sets field value +func (o *ServerConsoleUrl) SetUrl(v *string) { + o.Url = v +} + +func (o ServerConsoleUrl) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["url"] = o.Url + return toSerialize, nil +} + +type NullableServerConsoleUrl struct { + value *ServerConsoleUrl + isSet bool +} + +func (v NullableServerConsoleUrl) Get() *ServerConsoleUrl { + return v.value +} + +func (v *NullableServerConsoleUrl) Set(val *ServerConsoleUrl) { + v.value = val + v.isSet = true +} + +func (v NullableServerConsoleUrl) IsSet() bool { + return v.isSet +} + +func (v *NullableServerConsoleUrl) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerConsoleUrl(val *ServerConsoleUrl) *NullableServerConsoleUrl { + return &NullableServerConsoleUrl{value: val, isSet: true} +} + +func (v NullableServerConsoleUrl) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerConsoleUrl) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_server_list_response.go b/services/iaas/model_server_list_response.go new file mode 100644 index 00000000..d0eb3787 --- /dev/null +++ b/services/iaas/model_server_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerListResponse{} + +// ServerListResponse Response object for server list request. +type ServerListResponse struct { + // A list of servers. + // REQUIRED + Items *[]Server `json:"items"` +} + +type _ServerListResponse ServerListResponse + +// NewServerListResponse instantiates a new ServerListResponse 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 NewServerListResponse(items *[]Server) *ServerListResponse { + this := ServerListResponse{} + this.Items = items + return &this +} + +// NewServerListResponseWithDefaults instantiates a new ServerListResponse 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 NewServerListResponseWithDefaults() *ServerListResponse { + this := ServerListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServerListResponse) GetItems() *[]Server { + if o == nil { + var ret *[]Server + 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 *ServerListResponse) GetItemsOk() (*[]Server, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ServerListResponse) SetItems(v *[]Server) { + o.Items = v +} + +func (o ServerListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableServerListResponse struct { + value *ServerListResponse + isSet bool +} + +func (v NullableServerListResponse) Get() *ServerListResponse { + return v.value +} + +func (v *NullableServerListResponse) Set(val *ServerListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServerListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServerListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerListResponse(val *ServerListResponse) *NullableServerListResponse { + return &NullableServerListResponse{value: val, isSet: true} +} + +func (v NullableServerListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_server_maintenance.go b/services/iaas/model_server_maintenance.go new file mode 100644 index 00000000..2b007e48 --- /dev/null +++ b/services/iaas/model_server_maintenance.go @@ -0,0 +1,205 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the ServerMaintenance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerMaintenance{} + +// ServerMaintenance Object that represents the information about the next planned server maintenance window. +type ServerMaintenance struct { + Details *string `json:"details,omitempty"` + // End of the maintenance window. + // REQUIRED + EndsAt *time.Time `json:"endsAt"` + // Start of the maintenance window. + // REQUIRED + StartsAt *time.Time `json:"startsAt"` + // REQUIRED + Status *string `json:"status"` +} + +type _ServerMaintenance ServerMaintenance + +// NewServerMaintenance instantiates a new ServerMaintenance 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 NewServerMaintenance(endsAt *time.Time, startsAt *time.Time, status *string) *ServerMaintenance { + this := ServerMaintenance{} + this.EndsAt = endsAt + this.StartsAt = startsAt + this.Status = status + return &this +} + +// NewServerMaintenanceWithDefaults instantiates a new ServerMaintenance 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 NewServerMaintenanceWithDefaults() *ServerMaintenance { + this := ServerMaintenance{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *ServerMaintenance) GetDetails() *string { + if o == nil || IsNil(o.Details) { + var ret *string + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *ServerMaintenance) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *ServerMaintenance) SetDetails(v *string) { + o.Details = v +} + +// GetEndsAt returns the EndsAt field value +func (o *ServerMaintenance) GetEndsAt() *time.Time { + if o == nil { + var ret *time.Time + return ret + } + + return o.EndsAt +} + +// GetEndsAtOk returns a tuple with the EndsAt field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetEndsAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.EndsAt, true +} + +// SetEndsAt sets field value +func (o *ServerMaintenance) SetEndsAt(v *time.Time) { + o.EndsAt = v +} + +// GetStartsAt returns the StartsAt field value +func (o *ServerMaintenance) GetStartsAt() *time.Time { + if o == nil { + var ret *time.Time + return ret + } + + return o.StartsAt +} + +// GetStartsAtOk returns a tuple with the StartsAt field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetStartsAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.StartsAt, true +} + +// SetStartsAt sets field value +func (o *ServerMaintenance) SetStartsAt(v *time.Time) { + o.StartsAt = v +} + +// GetStatus returns the Status field value +func (o *ServerMaintenance) GetStatus() *string { + if o == nil { + var ret *string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *ServerMaintenance) SetStatus(v *string) { + o.Status = v +} + +func (o ServerMaintenance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + toSerialize["endsAt"] = o.EndsAt + toSerialize["startsAt"] = o.StartsAt + toSerialize["status"] = o.Status + return toSerialize, nil +} + +type NullableServerMaintenance struct { + value *ServerMaintenance + isSet bool +} + +func (v NullableServerMaintenance) Get() *ServerMaintenance { + return v.value +} + +func (v *NullableServerMaintenance) Set(val *ServerMaintenance) { + v.value = val + v.isSet = true +} + +func (v NullableServerMaintenance) IsSet() bool { + return v.isSet +} + +func (v *NullableServerMaintenance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerMaintenance(val *ServerMaintenance) *NullableServerMaintenance { + return &NullableServerMaintenance{value: val, isSet: true} +} + +func (v NullableServerMaintenance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerMaintenance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_server_network.go b/services/iaas/model_server_network.go new file mode 100644 index 00000000..b4de0ec3 --- /dev/null +++ b/services/iaas/model_server_network.go @@ -0,0 +1,414 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerNetwork{} + +// ServerNetwork Describes the object that matches servers to its networks. +type ServerNetwork struct { + // A list of IPs or CIDR notations. + AllowedAddresses *[]AllowedAddressesInner `json:"allowedAddresses,omitempty"` + // Object that represents an IP address. + Ipv4 *string `json:"ipv4,omitempty"` + // Object that represents an IPv6 address. + Ipv6 *string `json:"ipv6,omitempty"` + // Object that represents an MAC address. + // REQUIRED + Mac *string `json:"mac"` + // Universally Unique Identifier (UUID). + // REQUIRED + NetworkId *string `json:"networkId"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + NetworkName *string `json:"networkName"` + // Universally Unique Identifier (UUID). + // REQUIRED + NicId *string `json:"nicId"` + // If this is set to false, then no security groups will apply to this server network interface. + // REQUIRED + NicSecurity *bool `json:"nicSecurity"` + // Object that represents an IP address. + PublicIp *string `json:"publicIp,omitempty"` + // A list of UUIDs. + SecurityGroups *[]string `json:"securityGroups,omitempty"` +} + +type _ServerNetwork ServerNetwork + +// NewServerNetwork instantiates a new ServerNetwork 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 NewServerNetwork(mac *string, networkId *string, networkName *string, nicId *string, nicSecurity *bool) *ServerNetwork { + this := ServerNetwork{} + this.Mac = mac + this.NetworkId = networkId + this.NetworkName = networkName + this.NicId = nicId + this.NicSecurity = nicSecurity + return &this +} + +// NewServerNetworkWithDefaults instantiates a new ServerNetwork 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 NewServerNetworkWithDefaults() *ServerNetwork { + this := ServerNetwork{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *ServerNetwork) GetAllowedAddresses() *[]AllowedAddressesInner { + if o == nil || IsNil(o.AllowedAddresses) { + var ret *[]AllowedAddressesInner + return ret + } + return o.AllowedAddresses +} + +// 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 *ServerNetwork) GetAllowedAddressesOk() (*[]AllowedAddressesInner, bool) { + if o == nil || IsNil(o.AllowedAddresses) { + return nil, false + } + return o.AllowedAddresses, true +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *ServerNetwork) HasAllowedAddresses() bool { + if o != nil && !IsNil(o.AllowedAddresses) { + return true + } + + return false +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *ServerNetwork) SetAllowedAddresses(v *[]AllowedAddressesInner) { + o.AllowedAddresses = v +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *ServerNetwork) GetIpv4() *string { + if o == nil || IsNil(o.Ipv4) { + var ret *string + return ret + } + return o.Ipv4 +} + +// 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 *ServerNetwork) GetIpv4Ok() (*string, bool) { + if o == nil || IsNil(o.Ipv4) { + return nil, false + } + return o.Ipv4, true +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *ServerNetwork) HasIpv4() bool { + if o != nil && !IsNil(o.Ipv4) { + return true + } + + return false +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *ServerNetwork) SetIpv4(v *string) { + o.Ipv4 = v +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *ServerNetwork) GetIpv6() *string { + if o == nil || IsNil(o.Ipv6) { + var ret *string + return ret + } + return o.Ipv6 +} + +// 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 *ServerNetwork) GetIpv6Ok() (*string, bool) { + if o == nil || IsNil(o.Ipv6) { + return nil, false + } + return o.Ipv6, true +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *ServerNetwork) HasIpv6() bool { + if o != nil && !IsNil(o.Ipv6) { + return true + } + + return false +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *ServerNetwork) SetIpv6(v *string) { + o.Ipv6 = v +} + +// GetMac returns the Mac field value +func (o *ServerNetwork) GetMac() *string { + if o == nil { + var ret *string + return ret + } + + return o.Mac +} + +// GetMacOk returns a tuple with the Mac field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetMacOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Mac, true +} + +// SetMac sets field value +func (o *ServerNetwork) SetMac(v *string) { + o.Mac = v +} + +// GetNetworkId returns the NetworkId field value +func (o *ServerNetwork) GetNetworkId() *string { + if o == nil { + var ret *string + return ret + } + + return o.NetworkId +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NetworkId, true +} + +// SetNetworkId sets field value +func (o *ServerNetwork) SetNetworkId(v *string) { + o.NetworkId = v +} + +// GetNetworkName returns the NetworkName field value +func (o *ServerNetwork) GetNetworkName() *string { + if o == nil { + var ret *string + return ret + } + + return o.NetworkName +} + +// GetNetworkNameOk returns a tuple with the NetworkName field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNetworkNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NetworkName, true +} + +// SetNetworkName sets field value +func (o *ServerNetwork) SetNetworkName(v *string) { + o.NetworkName = v +} + +// GetNicId returns the NicId field value +func (o *ServerNetwork) GetNicId() *string { + if o == nil { + var ret *string + return ret + } + + return o.NicId +} + +// GetNicIdOk returns a tuple with the NicId field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNicIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NicId, true +} + +// SetNicId sets field value +func (o *ServerNetwork) SetNicId(v *string) { + o.NicId = v +} + +// GetNicSecurity returns the NicSecurity field value +func (o *ServerNetwork) GetNicSecurity() *bool { + if o == nil { + var ret *bool + return ret + } + + return o.NicSecurity +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNicSecurityOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.NicSecurity, true +} + +// SetNicSecurity sets field value +func (o *ServerNetwork) SetNicSecurity(v *bool) { + o.NicSecurity = v +} + +// GetPublicIp returns the PublicIp field value if set, zero value otherwise. +func (o *ServerNetwork) GetPublicIp() *string { + if o == nil || IsNil(o.PublicIp) { + var ret *string + return ret + } + return o.PublicIp +} + +// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetPublicIpOk() (*string, bool) { + if o == nil || IsNil(o.PublicIp) { + return nil, false + } + return o.PublicIp, true +} + +// HasPublicIp returns a boolean if a field has been set. +func (o *ServerNetwork) HasPublicIp() bool { + if o != nil && !IsNil(o.PublicIp) { + return true + } + + return false +} + +// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field. +func (o *ServerNetwork) SetPublicIp(v *string) { + o.PublicIp = v +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *ServerNetwork) GetSecurityGroups() *[]string { + if o == nil || IsNil(o.SecurityGroups) { + var ret *[]string + return ret + } + return o.SecurityGroups +} + +// 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 *ServerNetwork) GetSecurityGroupsOk() (*[]string, bool) { + if o == nil || IsNil(o.SecurityGroups) { + return nil, false + } + return o.SecurityGroups, true +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *ServerNetwork) HasSecurityGroups() bool { + if o != nil && !IsNil(o.SecurityGroups) { + return true + } + + return false +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *ServerNetwork) SetSecurityGroups(v *[]string) { + o.SecurityGroups = v +} + +func (o ServerNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AllowedAddresses) { + toSerialize["allowedAddresses"] = o.AllowedAddresses + } + if !IsNil(o.Ipv4) { + toSerialize["ipv4"] = o.Ipv4 + } + if !IsNil(o.Ipv6) { + toSerialize["ipv6"] = o.Ipv6 + } + toSerialize["mac"] = o.Mac + toSerialize["networkId"] = o.NetworkId + toSerialize["networkName"] = o.NetworkName + toSerialize["nicId"] = o.NicId + toSerialize["nicSecurity"] = o.NicSecurity + if !IsNil(o.PublicIp) { + toSerialize["publicIp"] = o.PublicIp + } + if !IsNil(o.SecurityGroups) { + toSerialize["securityGroups"] = o.SecurityGroups + } + return toSerialize, nil +} + +type NullableServerNetwork struct { + value *ServerNetwork + isSet bool +} + +func (v NullableServerNetwork) Get() *ServerNetwork { + return v.value +} + +func (v *NullableServerNetwork) Set(val *ServerNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableServerNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableServerNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerNetwork(val *ServerNetwork) *NullableServerNetwork { + return &NullableServerNetwork{value: val, isSet: true} +} + +func (v NullableServerNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_service_account_mail_list_response.go b/services/iaas/model_service_account_mail_list_response.go new file mode 100644 index 00000000..3698d9c6 --- /dev/null +++ b/services/iaas/model_service_account_mail_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServiceAccountMailListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServiceAccountMailListResponse{} + +// ServiceAccountMailListResponse Service account mail list response. +type ServiceAccountMailListResponse struct { + // A list of service account mails. + // REQUIRED + Items *[]string `json:"items"` +} + +type _ServiceAccountMailListResponse ServiceAccountMailListResponse + +// NewServiceAccountMailListResponse instantiates a new ServiceAccountMailListResponse 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 NewServiceAccountMailListResponse(items *[]string) *ServiceAccountMailListResponse { + this := ServiceAccountMailListResponse{} + this.Items = items + return &this +} + +// NewServiceAccountMailListResponseWithDefaults instantiates a new ServiceAccountMailListResponse 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 NewServiceAccountMailListResponseWithDefaults() *ServiceAccountMailListResponse { + this := ServiceAccountMailListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServiceAccountMailListResponse) GetItems() *[]string { + if o == nil { + var ret *[]string + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ServiceAccountMailListResponse) GetItemsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ServiceAccountMailListResponse) SetItems(v *[]string) { + o.Items = v +} + +func (o ServiceAccountMailListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableServiceAccountMailListResponse struct { + value *ServiceAccountMailListResponse + isSet bool +} + +func (v NullableServiceAccountMailListResponse) Get() *ServiceAccountMailListResponse { + return v.value +} + +func (v *NullableServiceAccountMailListResponse) Set(val *ServiceAccountMailListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountMailListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountMailListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountMailListResponse(val *ServiceAccountMailListResponse) *NullableServiceAccountMailListResponse { + return &NullableServiceAccountMailListResponse{value: val, isSet: true} +} + +func (v NullableServiceAccountMailListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountMailListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_attached_volume_payload.go b/services/iaas/model_update_attached_volume_payload.go new file mode 100644 index 00000000..921410df --- /dev/null +++ b/services/iaas/model_update_attached_volume_payload.go @@ -0,0 +1,195 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateAttachedVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAttachedVolumePayload{} + +// UpdateAttachedVolumePayload Object that represents a Volume attachment to a server. +type UpdateAttachedVolumePayload struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId *string `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId *string `json:"volumeId,omitempty"` +} + +// NewUpdateAttachedVolumePayload instantiates a new UpdateAttachedVolumePayload 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 NewUpdateAttachedVolumePayload() *UpdateAttachedVolumePayload { + this := UpdateAttachedVolumePayload{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// NewUpdateAttachedVolumePayloadWithDefaults instantiates a new UpdateAttachedVolumePayload 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 NewUpdateAttachedVolumePayloadWithDefaults() *UpdateAttachedVolumePayload { + this := UpdateAttachedVolumePayload{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetDeleteOnTermination() *bool { + if o == nil || IsNil(o.DeleteOnTermination) { + var ret *bool + return ret + } + return o.DeleteOnTermination +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetDeleteOnTerminationOk() (*bool, bool) { + if o == nil || IsNil(o.DeleteOnTermination) { + return nil, false + } + return o.DeleteOnTermination, true +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasDeleteOnTermination() bool { + if o != nil && !IsNil(o.DeleteOnTermination) { + return true + } + + return false +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *UpdateAttachedVolumePayload) SetDeleteOnTermination(v *bool) { + o.DeleteOnTermination = v +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetServerId() *string { + if o == nil || IsNil(o.ServerId) { + var ret *string + return ret + } + return o.ServerId +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetServerIdOk() (*string, bool) { + if o == nil || IsNil(o.ServerId) { + return nil, false + } + return o.ServerId, true +} + +// HasServerId returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasServerId() bool { + if o != nil && !IsNil(o.ServerId) { + return true + } + + return false +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *UpdateAttachedVolumePayload) SetServerId(v *string) { + o.ServerId = v +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + return o.VolumeId +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetVolumeIdOk() (*string, bool) { + if o == nil || IsNil(o.VolumeId) { + return nil, false + } + return o.VolumeId, true +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasVolumeId() bool { + if o != nil && !IsNil(o.VolumeId) { + return true + } + + return false +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *UpdateAttachedVolumePayload) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o UpdateAttachedVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeleteOnTermination) { + toSerialize["deleteOnTermination"] = o.DeleteOnTermination + } + if !IsNil(o.ServerId) { + toSerialize["serverId"] = o.ServerId + } + if !IsNil(o.VolumeId) { + toSerialize["volumeId"] = o.VolumeId + } + return toSerialize, nil +} + +type NullableUpdateAttachedVolumePayload struct { + value *UpdateAttachedVolumePayload + isSet bool +} + +func (v NullableUpdateAttachedVolumePayload) Get() *UpdateAttachedVolumePayload { + return v.value +} + +func (v *NullableUpdateAttachedVolumePayload) Set(val *UpdateAttachedVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAttachedVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAttachedVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAttachedVolumePayload(val *UpdateAttachedVolumePayload) *NullableUpdateAttachedVolumePayload { + return &NullableUpdateAttachedVolumePayload{value: val, isSet: true} +} + +func (v NullableUpdateAttachedVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAttachedVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_network_ipv4_body.go b/services/iaas/model_update_network_ipv4_body.go index d7eeb30c..84d636b4 100644 --- a/services/iaas/model_update_network_ipv4_body.go +++ b/services/iaas/model_update_network_ipv4_body.go @@ -19,7 +19,8 @@ var _ MappedNullable = &UpdateNetworkIPv4Body{} // UpdateNetworkIPv4Body The config object for a IPv4 network update. type UpdateNetworkIPv4Body struct { - Gateway *NullableV1NetworkGateway `json:"gateway,omitempty"` + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway *NullableString `json:"gateway,omitempty"` // A list containing DNS Servers/Nameservers for IPv4. Nameservers *[]string `json:"nameservers,omitempty"` } @@ -42,9 +43,9 @@ func NewUpdateNetworkIPv4BodyWithDefaults() *UpdateNetworkIPv4Body { } // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UpdateNetworkIPv4Body) GetGateway() *V1NetworkGateway { +func (o *UpdateNetworkIPv4Body) GetGateway() *string { if o == nil || IsNil(o.Gateway.Get()) { - var ret *V1NetworkGateway + var ret *string return ret } return o.Gateway.Get() @@ -53,7 +54,7 @@ func (o *UpdateNetworkIPv4Body) GetGateway() *V1NetworkGateway { // GetGatewayOk returns a tuple with the Gateway 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 *UpdateNetworkIPv4Body) GetGatewayOk() (*V1NetworkGateway, bool) { +func (o *UpdateNetworkIPv4Body) GetGatewayOk() (*string, bool) { if o == nil { return nil, false } @@ -69,8 +70,8 @@ func (o *UpdateNetworkIPv4Body) HasGateway() bool { return false } -// SetGateway gets a reference to the given V1NetworkGateway and assigns it to the Gateway field. -func (o *UpdateNetworkIPv4Body) SetGateway(v *V1NetworkGateway) { +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv4Body) SetGateway(v *string) { o.Gateway.Set(v) } diff --git a/services/iaas/model_update_network_ipv6_body.go b/services/iaas/model_update_network_ipv6_body.go index 42ec0fec..9a67fb1f 100644 --- a/services/iaas/model_update_network_ipv6_body.go +++ b/services/iaas/model_update_network_ipv6_body.go @@ -19,7 +19,8 @@ var _ MappedNullable = &UpdateNetworkIPv6Body{} // UpdateNetworkIPv6Body The config object for a IPv6 network update. type UpdateNetworkIPv6Body struct { - Gateway *NullableV1NetworkGateway `json:"gateway,omitempty"` + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway *NullableString `json:"gateway,omitempty"` // A list containing DNS Servers/Nameservers for IPv6. Nameservers *[]string `json:"nameservers,omitempty"` } @@ -42,9 +43,9 @@ func NewUpdateNetworkIPv6BodyWithDefaults() *UpdateNetworkIPv6Body { } // GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *UpdateNetworkIPv6Body) GetGateway() *V1NetworkGateway { +func (o *UpdateNetworkIPv6Body) GetGateway() *string { if o == nil || IsNil(o.Gateway.Get()) { - var ret *V1NetworkGateway + var ret *string return ret } return o.Gateway.Get() @@ -53,7 +54,7 @@ func (o *UpdateNetworkIPv6Body) GetGateway() *V1NetworkGateway { // GetGatewayOk returns a tuple with the Gateway 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 *UpdateNetworkIPv6Body) GetGatewayOk() (*V1NetworkGateway, bool) { +func (o *UpdateNetworkIPv6Body) GetGatewayOk() (*string, bool) { if o == nil { return nil, false } @@ -69,8 +70,8 @@ func (o *UpdateNetworkIPv6Body) HasGateway() bool { return false } -// SetGateway gets a reference to the given V1NetworkGateway and assigns it to the Gateway field. -func (o *UpdateNetworkIPv6Body) SetGateway(v *V1NetworkGateway) { +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv6Body) SetGateway(v *string) { o.Gateway.Set(v) } diff --git a/services/iaas/model_update_nic_payload.go b/services/iaas/model_update_nic_payload.go new file mode 100644 index 00000000..3bb12748 --- /dev/null +++ b/services/iaas/model_update_nic_payload.go @@ -0,0 +1,265 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNICPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNICPayload{} + +// 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. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity *bool `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups *[]string `json:"securityGroups,omitempty"` +} + +// 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{} + return &this +} + +// 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{} + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *UpdateNICPayload) GetAllowedAddresses() *[]AllowedAddressesInner { + if o == nil || IsNil(o.AllowedAddresses) { + var ret *[]AllowedAddressesInner + return ret + } + return o.AllowedAddresses +} + +// 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) { + if o == nil || IsNil(o.AllowedAddresses) { + return nil, false + } + return o.AllowedAddresses, true +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *UpdateNICPayload) HasAllowedAddresses() bool { + if o != nil && !IsNil(o.AllowedAddresses) { + return true + } + + return false +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +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{} { + 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 *UpdateNICPayload) 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 *UpdateNICPayload) 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 *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 { + 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 *UpdateNICPayload) 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 *UpdateNICPayload) 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 *UpdateNICPayload) SetName(v *string) { + o.Name = v +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *UpdateNICPayload) GetNicSecurity() *bool { + if o == nil || IsNil(o.NicSecurity) { + var ret *bool + return ret + } + return o.NicSecurity +} + +// 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) { + if o == nil || IsNil(o.NicSecurity) { + return nil, false + } + return o.NicSecurity, true +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *UpdateNICPayload) HasNicSecurity() bool { + if o != nil && !IsNil(o.NicSecurity) { + return true + } + + return false +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +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 { + if o == nil || IsNil(o.SecurityGroups) { + var ret *[]string + return ret + } + return o.SecurityGroups +} + +// 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) { + if o == nil || IsNil(o.SecurityGroups) { + return nil, false + } + return o.SecurityGroups, true +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *UpdateNICPayload) HasSecurityGroups() bool { + if o != nil && !IsNil(o.SecurityGroups) { + return true + } + + return false +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *UpdateNICPayload) SetSecurityGroups(v *[]string) { + o.SecurityGroups = v +} + +func (o UpdateNICPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AllowedAddresses) { + toSerialize["allowedAddresses"] = o.AllowedAddresses + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NicSecurity) { + toSerialize["nicSecurity"] = o.NicSecurity + } + if !IsNil(o.SecurityGroups) { + toSerialize["securityGroups"] = o.SecurityGroups + } + return toSerialize, nil +} + +type NullableUpdateNICPayload struct { + value *UpdateNICPayload + isSet bool +} + +func (v NullableUpdateNICPayload) Get() *UpdateNICPayload { + return v.value +} + +func (v *NullableUpdateNICPayload) Set(val *UpdateNICPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNICPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNICPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNICPayload(val *UpdateNICPayload) *NullableUpdateNICPayload { + return &NullableUpdateNICPayload{value: val, isSet: true} +} + +func (v NullableUpdateNICPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNICPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_public_ip_payload.go b/services/iaas/model_update_public_ip_payload.go new file mode 100644 index 00000000..1c0f9743 --- /dev/null +++ b/services/iaas/model_update_public_ip_payload.go @@ -0,0 +1,239 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdatePublicIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdatePublicIPPayload{} + +// UpdatePublicIPPayload Object that represents a public IP. +type UpdatePublicIPPayload 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"` + // Universally Unique Identifier (UUID). + NetworkInterface *NullableString `json:"networkInterface,omitempty"` +} + +// NewUpdatePublicIPPayload instantiates a new UpdatePublicIPPayload 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 NewUpdatePublicIPPayload() *UpdatePublicIPPayload { + this := UpdatePublicIPPayload{} + return &this +} + +// NewUpdatePublicIPPayloadWithDefaults instantiates a new UpdatePublicIPPayload 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 NewUpdatePublicIPPayloadWithDefaults() *UpdatePublicIPPayload { + this := UpdatePublicIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) SetId(v *string) { + o.Id = v +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) SetIp(v *string) { + o.Ip = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) 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 *UpdatePublicIPPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdatePublicIPPayload) GetNetworkInterface() *string { + if o == nil || IsNil(o.NetworkInterface.Get()) { + var ret *string + return ret + } + return o.NetworkInterface.Get() +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface 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 *UpdatePublicIPPayload) GetNetworkInterfaceOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NetworkInterface.Get(), o.NetworkInterface.IsSet() +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasNetworkInterface() bool { + if o != nil && o.NetworkInterface.IsSet() { + return true + } + + return false +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *UpdatePublicIPPayload) SetNetworkInterface(v *string) { + o.NetworkInterface.Set(v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *UpdatePublicIPPayload) SetNetworkInterfaceNil() { + o.NetworkInterface.Set(nil) +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *UpdatePublicIPPayload) UnsetNetworkInterface() { + o.NetworkInterface.Unset() +} + +func (o UpdatePublicIPPayload) 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 o.NetworkInterface.IsSet() { + toSerialize["networkInterface"] = o.NetworkInterface.Get() + } + return toSerialize, nil +} + +type NullableUpdatePublicIPPayload struct { + value *UpdatePublicIPPayload + isSet bool +} + +func (v NullableUpdatePublicIPPayload) Get() *UpdatePublicIPPayload { + return v.value +} + +func (v *NullableUpdatePublicIPPayload) Set(val *UpdatePublicIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdatePublicIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdatePublicIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdatePublicIPPayload(val *UpdatePublicIPPayload) *NullableUpdatePublicIPPayload { + return &NullableUpdatePublicIPPayload{value: val, isSet: true} +} + +func (v NullableUpdatePublicIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdatePublicIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_security_group_payload.go b/services/iaas/model_update_security_group_payload.go new file mode 100644 index 00000000..5d6d7a9e --- /dev/null +++ b/services/iaas/model_update_security_group_payload.go @@ -0,0 +1,191 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateSecurityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSecurityGroupPayload{} + +// UpdateSecurityGroupPayload Object that represents an update request body of a security group. +type UpdateSecurityGroupPayload struct { + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` +} + +// NewUpdateSecurityGroupPayload instantiates a new UpdateSecurityGroupPayload 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 NewUpdateSecurityGroupPayload() *UpdateSecurityGroupPayload { + this := UpdateSecurityGroupPayload{} + return &this +} + +// NewUpdateSecurityGroupPayloadWithDefaults instantiates a new UpdateSecurityGroupPayload 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 NewUpdateSecurityGroupPayloadWithDefaults() *UpdateSecurityGroupPayload { + this := UpdateSecurityGroupPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) SetDescription(v *string) { + o.Description = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) 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 *UpdateSecurityGroupPayload) SetName(v *string) { + o.Name = v +} + +func (o UpdateSecurityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableUpdateSecurityGroupPayload struct { + value *UpdateSecurityGroupPayload + isSet bool +} + +func (v NullableUpdateSecurityGroupPayload) Get() *UpdateSecurityGroupPayload { + return v.value +} + +func (v *NullableUpdateSecurityGroupPayload) Set(val *UpdateSecurityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateSecurityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateSecurityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateSecurityGroupPayload(val *UpdateSecurityGroupPayload) *NullableUpdateSecurityGroupPayload { + return &NullableUpdateSecurityGroupPayload{value: val, isSet: true} +} + +func (v NullableUpdateSecurityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateSecurityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_server_payload.go b/services/iaas/model_update_server_payload.go new file mode 100644 index 00000000..cb1f5195 --- /dev/null +++ b/services/iaas/model_update_server_payload.go @@ -0,0 +1,154 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateServerPayload{} + +// UpdateServerPayload Object that represents an update request body of a server. +type UpdateServerPayload struct { + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` +} + +// NewUpdateServerPayload instantiates a new UpdateServerPayload 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 NewUpdateServerPayload() *UpdateServerPayload { + this := UpdateServerPayload{} + return &this +} + +// NewUpdateServerPayloadWithDefaults instantiates a new UpdateServerPayload 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 NewUpdateServerPayloadWithDefaults() *UpdateServerPayload { + this := UpdateServerPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateServerPayload) 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 *UpdateServerPayload) 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 *UpdateServerPayload) 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 *UpdateServerPayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateServerPayload) 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 *UpdateServerPayload) 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 *UpdateServerPayload) 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 *UpdateServerPayload) SetName(v *string) { + o.Name = v +} + +func (o UpdateServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableUpdateServerPayload struct { + value *UpdateServerPayload + isSet bool +} + +func (v NullableUpdateServerPayload) Get() *UpdateServerPayload { + return v.value +} + +func (v *NullableUpdateServerPayload) Set(val *UpdateServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateServerPayload(val *UpdateServerPayload) *NullableUpdateServerPayload { + return &NullableUpdateServerPayload{value: val, isSet: true} +} + +func (v NullableUpdateServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_update_volume_payload.go b/services/iaas/model_update_volume_payload.go new file mode 100644 index 00000000..9d7420d0 --- /dev/null +++ b/services/iaas/model_update_volume_payload.go @@ -0,0 +1,191 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVolumePayload{} + +// UpdateVolumePayload Object that represents an update request body of a volume. +type UpdateVolumePayload struct { + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` +} + +// NewUpdateVolumePayload instantiates a new UpdateVolumePayload 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 NewUpdateVolumePayload() *UpdateVolumePayload { + this := UpdateVolumePayload{} + return &this +} + +// NewUpdateVolumePayloadWithDefaults instantiates a new UpdateVolumePayload 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 NewUpdateVolumePayloadWithDefaults() *UpdateVolumePayload { + this := UpdateVolumePayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateVolumePayload) 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 *UpdateVolumePayload) 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 *UpdateVolumePayload) 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 *UpdateVolumePayload) SetDescription(v *string) { + o.Description = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + 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 *UpdateVolumePayload) 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 *UpdateVolumePayload) 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 *UpdateVolumePayload) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateVolumePayload) 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 *UpdateVolumePayload) 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 *UpdateVolumePayload) 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 *UpdateVolumePayload) SetName(v *string) { + o.Name = v +} + +func (o UpdateVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableUpdateVolumePayload struct { + value *UpdateVolumePayload + isSet bool +} + +func (v NullableUpdateVolumePayload) Get() *UpdateVolumePayload { + return v.value +} + +func (v *NullableUpdateVolumePayload) Set(val *UpdateVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVolumePayload(val *UpdateVolumePayload) *NullableUpdateVolumePayload { + return &NullableUpdateVolumePayload{value: val, isSet: true} +} + +func (v NullableUpdateVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_v1_network_gateway.go b/services/iaas/model_v1_network_gateway.go deleted file mode 100644 index 29ca461b..00000000 --- a/services/iaas/model_v1_network_gateway.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -IaaS-API - -This API allows you to create and modify IaaS resources. - -API version: 1beta1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package iaas - -import ( - "encoding/json" -) - -// checks if the V1NetworkGateway type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &V1NetworkGateway{} - -// V1NetworkGateway The gateway of a network. If not specified the first ip of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. -type V1NetworkGateway struct { -} - -// NewV1NetworkGateway instantiates a new V1NetworkGateway 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 NewV1NetworkGateway() *V1NetworkGateway { - this := V1NetworkGateway{} - return &this -} - -// NewV1NetworkGatewayWithDefaults instantiates a new V1NetworkGateway 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 NewV1NetworkGatewayWithDefaults() *V1NetworkGateway { - this := V1NetworkGateway{} - return &this -} - -func (o V1NetworkGateway) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - return toSerialize, nil -} - -type NullableV1NetworkGateway struct { - value *V1NetworkGateway - isSet bool -} - -func (v NullableV1NetworkGateway) Get() *V1NetworkGateway { - return v.value -} - -func (v *NullableV1NetworkGateway) Set(val *V1NetworkGateway) { - v.value = val - v.isSet = true -} - -func (v NullableV1NetworkGateway) IsSet() bool { - return v.isSet -} - -func (v *NullableV1NetworkGateway) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableV1NetworkGateway(val *V1NetworkGateway) *NullableV1NetworkGateway { - return &NullableV1NetworkGateway{value: val, isSet: true} -} - -func (v NullableV1NetworkGateway) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableV1NetworkGateway) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/iaas/model_volume.go b/services/iaas/model_volume.go new file mode 100644 index 00000000..39fae565 --- /dev/null +++ b/services/iaas/model_volume.go @@ -0,0 +1,518 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + +// Volume Object that represents a volume and its parameters. Used for Creating and returning (get/list). +type Volume struct { + // Object that represents an availability zone. + // REQUIRED + AvailabilityZone *string `json:"availabilityZone"` + // Date-time when resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Description Object. Allows string up to 127 Characters. + Description *string `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id *string `json:"id,omitempty"` + // Object that represents the labels of an object. + Labels *map[string]interface{} `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name *string `json:"name,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass *string `json:"performanceClass,omitempty"` + // Universally Unique Identifier (UUID). + ServerId *string `json:"serverId,omitempty"` + // Size in Gigabyte. + Size *int64 `json:"size,omitempty"` + Source *VolumeSource `json:"source,omitempty"` + // The status of a volume object. + Status *string `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +type _Volume Volume + +// NewVolume instantiates a new Volume 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 NewVolume(availabilityZone *string) *Volume { + this := Volume{} + this.AvailabilityZone = availabilityZone + return &this +} + +// NewVolumeWithDefaults instantiates a new Volume 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 NewVolumeWithDefaults() *Volume { + this := Volume{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value +func (o *Volume) GetAvailabilityZone() *string { + if o == nil { + var ret *string + return ret + } + + return o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +func (o *Volume) GetAvailabilityZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AvailabilityZone, true +} + +// SetAvailabilityZone sets field value +func (o *Volume) SetAvailabilityZone(v *string) { + o.AvailabilityZone = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Volume) 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 *Volume) 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 *Volume) 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 *Volume) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Volume) 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 *Volume) 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 *Volume) 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 *Volume) SetDescription(v *string) { + o.Description = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Volume) 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 *Volume) 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 *Volume) 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 *Volume) SetId(v *string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Volume) GetLabels() *map[string]interface{} { + if o == nil || IsNil(o.Labels) { + 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 *Volume) 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 *Volume) 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 *Volume) SetLabels(v *map[string]interface{}) { + o.Labels = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Volume) 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 *Volume) 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 *Volume) 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 *Volume) SetName(v *string) { + o.Name = v +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *Volume) GetPerformanceClass() *string { + if o == nil || IsNil(o.PerformanceClass) { + var ret *string + return ret + } + return o.PerformanceClass +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetPerformanceClassOk() (*string, bool) { + if o == nil || IsNil(o.PerformanceClass) { + return nil, false + } + return o.PerformanceClass, true +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *Volume) HasPerformanceClass() bool { + if o != nil && !IsNil(o.PerformanceClass) { + return true + } + + return false +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *Volume) SetPerformanceClass(v *string) { + o.PerformanceClass = v +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *Volume) GetServerId() *string { + if o == nil || IsNil(o.ServerId) { + var ret *string + return ret + } + return o.ServerId +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetServerIdOk() (*string, bool) { + if o == nil || IsNil(o.ServerId) { + return nil, false + } + return o.ServerId, true +} + +// HasServerId returns a boolean if a field has been set. +func (o *Volume) HasServerId() bool { + if o != nil && !IsNil(o.ServerId) { + return true + } + + return false +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *Volume) SetServerId(v *string) { + o.ServerId = v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Volume) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Volume) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Volume) SetSize(v *int64) { + o.Size = v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *Volume) GetSource() *VolumeSource { + if o == nil || IsNil(o.Source) { + var ret *VolumeSource + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetSourceOk() (*VolumeSource, bool) { + if o == nil || IsNil(o.Source) { + return nil, false + } + return o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *Volume) HasSource() bool { + if o != nil && !IsNil(o.Source) { + return true + } + + return false +} + +// SetSource gets a reference to the given VolumeSource and assigns it to the Source field. +func (o *Volume) SetSource(v *VolumeSource) { + o.Source = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Volume) 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 *Volume) 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 *Volume) 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 *Volume) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Volume) 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 *Volume) 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 *Volume) 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 *Volume) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o Volume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["availabilityZone"] = o.AvailabilityZone + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PerformanceClass) { + toSerialize["performanceClass"] = o.PerformanceClass + } + if !IsNil(o.ServerId) { + toSerialize["serverId"] = o.ServerId + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Source) { + toSerialize["source"] = o.Source + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableVolume struct { + value *Volume + isSet bool +} + +func (v NullableVolume) Get() *Volume { + return v.value +} + +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_volume_attachment.go b/services/iaas/model_volume_attachment.go new file mode 100644 index 00000000..b75f6796 --- /dev/null +++ b/services/iaas/model_volume_attachment.go @@ -0,0 +1,195 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeAttachment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAttachment{} + +// VolumeAttachment Object that represents a Volume attachment to a server. +type VolumeAttachment struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId *string `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId *string `json:"volumeId,omitempty"` +} + +// NewVolumeAttachment instantiates a new VolumeAttachment 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 NewVolumeAttachment() *VolumeAttachment { + this := VolumeAttachment{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// NewVolumeAttachmentWithDefaults instantiates a new VolumeAttachment 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 NewVolumeAttachmentWithDefaults() *VolumeAttachment { + this := VolumeAttachment{} + var deleteOnTermination bool = false + this.DeleteOnTermination = &deleteOnTermination + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *VolumeAttachment) GetDeleteOnTermination() *bool { + if o == nil || IsNil(o.DeleteOnTermination) { + var ret *bool + return ret + } + return o.DeleteOnTermination +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetDeleteOnTerminationOk() (*bool, bool) { + if o == nil || IsNil(o.DeleteOnTermination) { + return nil, false + } + return o.DeleteOnTermination, true +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *VolumeAttachment) HasDeleteOnTermination() bool { + if o != nil && !IsNil(o.DeleteOnTermination) { + return true + } + + return false +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *VolumeAttachment) SetDeleteOnTermination(v *bool) { + o.DeleteOnTermination = v +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *VolumeAttachment) GetServerId() *string { + if o == nil || IsNil(o.ServerId) { + var ret *string + return ret + } + return o.ServerId +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetServerIdOk() (*string, bool) { + if o == nil || IsNil(o.ServerId) { + return nil, false + } + return o.ServerId, true +} + +// HasServerId returns a boolean if a field has been set. +func (o *VolumeAttachment) HasServerId() bool { + if o != nil && !IsNil(o.ServerId) { + return true + } + + return false +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *VolumeAttachment) SetServerId(v *string) { + o.ServerId = v +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *VolumeAttachment) GetVolumeId() *string { + if o == nil || IsNil(o.VolumeId) { + var ret *string + return ret + } + return o.VolumeId +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetVolumeIdOk() (*string, bool) { + if o == nil || IsNil(o.VolumeId) { + return nil, false + } + return o.VolumeId, true +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *VolumeAttachment) HasVolumeId() bool { + if o != nil && !IsNil(o.VolumeId) { + return true + } + + return false +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *VolumeAttachment) SetVolumeId(v *string) { + o.VolumeId = v +} + +func (o VolumeAttachment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeleteOnTermination) { + toSerialize["deleteOnTermination"] = o.DeleteOnTermination + } + if !IsNil(o.ServerId) { + toSerialize["serverId"] = o.ServerId + } + if !IsNil(o.VolumeId) { + toSerialize["volumeId"] = o.VolumeId + } + return toSerialize, nil +} + +type NullableVolumeAttachment struct { + value *VolumeAttachment + isSet bool +} + +func (v NullableVolumeAttachment) Get() *VolumeAttachment { + return v.value +} + +func (v *NullableVolumeAttachment) Set(val *VolumeAttachment) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAttachment) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAttachment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAttachment(val *VolumeAttachment) *NullableVolumeAttachment { + return &NullableVolumeAttachment{value: val, isSet: true} +} + +func (v NullableVolumeAttachment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAttachment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_volume_attachment_list_response.go b/services/iaas/model_volume_attachment_list_response.go new file mode 100644 index 00000000..75da5621 --- /dev/null +++ b/services/iaas/model_volume_attachment_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeAttachmentListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAttachmentListResponse{} + +// VolumeAttachmentListResponse Volume attachment list response. +type VolumeAttachmentListResponse struct { + // A list containing Volume attachments of a server. + // REQUIRED + Items *[]VolumeAttachment `json:"items"` +} + +type _VolumeAttachmentListResponse VolumeAttachmentListResponse + +// NewVolumeAttachmentListResponse instantiates a new VolumeAttachmentListResponse 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 NewVolumeAttachmentListResponse(items *[]VolumeAttachment) *VolumeAttachmentListResponse { + this := VolumeAttachmentListResponse{} + this.Items = items + return &this +} + +// NewVolumeAttachmentListResponseWithDefaults instantiates a new VolumeAttachmentListResponse 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 NewVolumeAttachmentListResponseWithDefaults() *VolumeAttachmentListResponse { + this := VolumeAttachmentListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumeAttachmentListResponse) GetItems() *[]VolumeAttachment { + if o == nil { + var ret *[]VolumeAttachment + 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 *VolumeAttachmentListResponse) GetItemsOk() (*[]VolumeAttachment, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *VolumeAttachmentListResponse) SetItems(v *[]VolumeAttachment) { + o.Items = v +} + +func (o VolumeAttachmentListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableVolumeAttachmentListResponse struct { + value *VolumeAttachmentListResponse + isSet bool +} + +func (v NullableVolumeAttachmentListResponse) Get() *VolumeAttachmentListResponse { + return v.value +} + +func (v *NullableVolumeAttachmentListResponse) Set(val *VolumeAttachmentListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAttachmentListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAttachmentListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAttachmentListResponse(val *VolumeAttachmentListResponse) *NullableVolumeAttachmentListResponse { + return &NullableVolumeAttachmentListResponse{value: val, isSet: true} +} + +func (v NullableVolumeAttachmentListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAttachmentListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_volume_list_response.go b/services/iaas/model_volume_list_response.go new file mode 100644 index 00000000..d8ea37c3 --- /dev/null +++ b/services/iaas/model_volume_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeListResponse{} + +// VolumeListResponse Volume list response. +type VolumeListResponse struct { + // A list containing volume objects. + // REQUIRED + Items *[]Volume `json:"items"` +} + +type _VolumeListResponse VolumeListResponse + +// NewVolumeListResponse instantiates a new VolumeListResponse 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 NewVolumeListResponse(items *[]Volume) *VolumeListResponse { + this := VolumeListResponse{} + this.Items = items + return &this +} + +// NewVolumeListResponseWithDefaults instantiates a new VolumeListResponse 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 NewVolumeListResponseWithDefaults() *VolumeListResponse { + this := VolumeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumeListResponse) GetItems() *[]Volume { + if o == nil { + var ret *[]Volume + 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 *VolumeListResponse) GetItemsOk() (*[]Volume, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *VolumeListResponse) SetItems(v *[]Volume) { + o.Items = v +} + +func (o VolumeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullableVolumeListResponse struct { + value *VolumeListResponse + isSet bool +} + +func (v NullableVolumeListResponse) Get() *VolumeListResponse { + return v.value +} + +func (v *NullableVolumeListResponse) Set(val *VolumeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeListResponse(val *VolumeListResponse) *NullableVolumeListResponse { + return &NullableVolumeListResponse{value: val, isSet: true} +} + +func (v NullableVolumeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_volume_source.go b/services/iaas/model_volume_source.go new file mode 100644 index 00000000..a18f1349 --- /dev/null +++ b/services/iaas/model_volume_source.go @@ -0,0 +1,140 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeSource{} + +// VolumeSource The source object of a volume. +type VolumeSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id *string `json:"id"` + // The source types of a volume. + // REQUIRED + Type *string `json:"type"` +} + +type _VolumeSource VolumeSource + +// NewVolumeSource instantiates a new VolumeSource 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 NewVolumeSource(id *string, type_ *string) *VolumeSource { + this := VolumeSource{} + this.Id = id + this.Type = type_ + return &this +} + +// NewVolumeSourceWithDefaults instantiates a new VolumeSource 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 NewVolumeSourceWithDefaults() *VolumeSource { + this := VolumeSource{} + return &this +} + +// GetId returns the Id field value +func (o *VolumeSource) 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 *VolumeSource) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *VolumeSource) SetId(v *string) { + o.Id = v +} + +// GetType returns the Type field value +func (o *VolumeSource) GetType() *string { + if o == nil { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VolumeSource) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *VolumeSource) SetType(v *string) { + o.Type = v +} + +func (o VolumeSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableVolumeSource struct { + value *VolumeSource + isSet bool +} + +func (v NullableVolumeSource) Get() *VolumeSource { + return v.value +} + +func (v *NullableVolumeSource) Set(val *VolumeSource) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeSource) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeSource(val *VolumeSource) *NullableVolumeSource { + return &NullableVolumeSource{value: val, isSet: true} +} + +func (v NullableVolumeSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}