diff --git a/services/sca/oas_commit b/services/sca/oas_commit index bdcef991aa..8f13d92941 100644 --- a/services/sca/oas_commit +++ b/services/sca/oas_commit @@ -1 +1 @@ -bead0331c9760ab4d2ff87614ae3ad156bc46758 +6a64c31e5d4c6aaf2d5a11af086a4941eb5bdc19 diff --git a/services/sca/v1betaapi/api_default.go b/services/sca/v1betaapi/api_default.go index 1ed6aebe31..5814b08885 100644 --- a/services/sca/v1betaapi/api_default.go +++ b/services/sca/v1betaapi/api_default.go @@ -218,6 +218,38 @@ type DefaultAPI interface { // @return ListApplicationsResponse ListProjectApplicationsExecute(r ApiListProjectApplicationsRequest) (*ListApplicationsResponse, error) + /* + StartApplication Starts an existing application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project where the application resides. + @param region Region where the application resides. + @param environmentId Environment where the application resides. + @param applicationId Application id to start. + @return ApiStartApplicationRequest + */ + StartApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiStartApplicationRequest + + // StartApplicationExecute executes the request + // @return map[string]interface{} + StartApplicationExecute(r ApiStartApplicationRequest) (map[string]interface{}, error) + + /* + StopApplication Stops an existing application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project where the application resides. + @param region Region where the application resides. + @param environmentId Environment where the application resides. + @param applicationId Application id to stop. + @return ApiStopApplicationRequest + */ + StopApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiStopApplicationRequest + + // StopApplicationExecute executes the request + // @return map[string]interface{} + StopApplicationExecute(r ApiStopApplicationRequest) (map[string]interface{}, error) + /* UpdateApplication Updates an existing application. @@ -2335,6 +2367,320 @@ func (a *DefaultAPIService) ListProjectApplicationsExecute(r ApiListProjectAppli return localVarReturnValue, nil } +type ApiStartApplicationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + environmentId string + applicationId string +} + +func (r ApiStartApplicationRequest) Execute() (map[string]interface{}, error) { + return r.ApiService.StartApplicationExecute(r) +} + +/* +StartApplication Starts an existing application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project where the application resides. + @param region Region where the application resides. + @param environmentId Environment where the application resides. + @param applicationId Application id to start. + @return ApiStartApplicationRequest +*/ +func (a *DefaultAPIService) StartApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiStartApplicationRequest { + return ApiStartApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *DefaultAPIService) StartApplicationExecute(r ApiStartApplicationRequest) (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.StartApplication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/environments/{environmentId}/applications/{applicationId}/start" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"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{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-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 ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-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 >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-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 +} + +type ApiStopApplicationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + environmentId string + applicationId string +} + +func (r ApiStopApplicationRequest) Execute() (map[string]interface{}, error) { + return r.ApiService.StopApplicationExecute(r) +} + +/* +StopApplication Stops an existing application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project where the application resides. + @param region Region where the application resides. + @param environmentId Environment where the application resides. + @param applicationId Application id to stop. + @return ApiStopApplicationRequest +*/ +func (a *DefaultAPIService) StopApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiStopApplicationRequest { + return ApiStopApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *DefaultAPIService) StopApplicationExecute(r ApiStopApplicationRequest) (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.StopApplication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/environments/{environmentId}/applications/{applicationId}/stop" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"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{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-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 ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-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 >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-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 +} + type ApiUpdateApplicationRequest struct { ctx context.Context ApiService DefaultAPI diff --git a/services/sca/v1betaapi/api_default_mock.go b/services/sca/v1betaapi/api_default_mock.go index d568cf771b..eae3738a77 100644 --- a/services/sca/v1betaapi/api_default_mock.go +++ b/services/sca/v1betaapi/api_default_mock.go @@ -46,6 +46,10 @@ type DefaultAPIServiceMock struct { ListEnvironmentsExecuteMock *func(r ApiListEnvironmentsRequest) (*ListEnvironmentsResponse, error) // ListProjectApplicationsExecuteMock can be populated to implement the behavior of the ListProjectApplicationsExecute function of this mock ListProjectApplicationsExecuteMock *func(r ApiListProjectApplicationsRequest) (*ListApplicationsResponse, error) + // StartApplicationExecuteMock can be populated to implement the behavior of the StartApplicationExecute function of this mock + StartApplicationExecuteMock *func(r ApiStartApplicationRequest) (map[string]interface{}, error) + // StopApplicationExecuteMock can be populated to implement the behavior of the StopApplicationExecute function of this mock + StopApplicationExecuteMock *func(r ApiStopApplicationRequest) (map[string]interface{}, error) // UpdateApplicationExecuteMock can be populated to implement the behavior of the UpdateApplicationExecute function of this mock UpdateApplicationExecuteMock *func(r ApiUpdateApplicationRequest) (*Application, error) // UpdateEnvironmentRegistriesExecuteMock can be populated to implement the behavior of the UpdateEnvironmentRegistriesExecute function of this mock @@ -314,6 +318,48 @@ func (a DefaultAPIServiceMock) ListProjectApplicationsExecute(r ApiListProjectAp return (*a.ListProjectApplicationsExecuteMock)(r) } +func (a DefaultAPIServiceMock) StartApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiStartApplicationRequest { + return ApiStartApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// StartApplicationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the StartApplicationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) StartApplicationExecute(r ApiStartApplicationRequest) (map[string]interface{}, error) { + if a.StartApplicationExecuteMock == nil { + var localVarReturnValue map[string]interface{} + return localVarReturnValue, nil + } + + return (*a.StartApplicationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) StopApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiStopApplicationRequest { + return ApiStopApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// StopApplicationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the StopApplicationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) StopApplicationExecute(r ApiStopApplicationRequest) (map[string]interface{}, error) { + if a.StopApplicationExecuteMock == nil { + var localVarReturnValue map[string]interface{} + return localVarReturnValue, nil + } + + return (*a.StopApplicationExecuteMock)(r) +} + func (a DefaultAPIServiceMock) UpdateApplication(ctx context.Context, projectId string, region string, environmentId string, applicationId string) ApiUpdateApplicationRequest { return ApiUpdateApplicationRequest{ ApiService: a, diff --git a/services/sca/v1betaapi/model_environment_current_status.go b/services/sca/v1betaapi/model_environment_current_status.go index 6f22baada5..33dcb3dfc7 100644 --- a/services/sca/v1betaapi/model_environment_current_status.go +++ b/services/sca/v1betaapi/model_environment_current_status.go @@ -15,7 +15,7 @@ import ( "fmt" ) -// EnvironmentCurrentStatus - CURRENT_STATUS_UNSPECIFIED: Used as zero value. - CURRENT_STATUS_PROGRESSING: Environment is being created. - CURRENT_STATUS_CREATED: Environment is successfully created. +// EnvironmentCurrentStatus - CURRENT_STATUS_UNSPECIFIED: Used as zero value. - CURRENT_STATUS_PROGRESSING: Environment is being created. - CURRENT_STATUS_CREATED: Environment is successfully created. - CURRENT_STATUS_FAILED: Environment is failed status. type EnvironmentCurrentStatus string // List of EnvironmentCurrentStatus @@ -23,6 +23,7 @@ const ( ENVIRONMENTCURRENTSTATUS_CURRENT_STATUS_UNSPECIFIED EnvironmentCurrentStatus = "CURRENT_STATUS_UNSPECIFIED" ENVIRONMENTCURRENTSTATUS_CURRENT_STATUS_PROGRESSING EnvironmentCurrentStatus = "CURRENT_STATUS_PROGRESSING" ENVIRONMENTCURRENTSTATUS_CURRENT_STATUS_CREATED EnvironmentCurrentStatus = "CURRENT_STATUS_CREATED" + ENVIRONMENTCURRENTSTATUS_CURRENT_STATUS_FAILED EnvironmentCurrentStatus = "CURRENT_STATUS_FAILED" ENVIRONMENTCURRENTSTATUS_UNKNOWN_DEFAULT_OPEN_API EnvironmentCurrentStatus = "unknown_default_open_api" ) @@ -31,6 +32,7 @@ var AllowedEnvironmentCurrentStatusEnumValues = []EnvironmentCurrentStatus{ "CURRENT_STATUS_UNSPECIFIED", "CURRENT_STATUS_PROGRESSING", "CURRENT_STATUS_CREATED", + "CURRENT_STATUS_FAILED", "unknown_default_open_api", } diff --git a/services/sca/v1betaapi/model_update_application_payload.go b/services/sca/v1betaapi/model_update_application_payload.go index 25dc94eee0..a277f0c0e5 100644 --- a/services/sca/v1betaapi/model_update_application_payload.go +++ b/services/sca/v1betaapi/model_update_application_payload.go @@ -12,36 +12,19 @@ package v1betaapi import ( "encoding/json" - "fmt" - "time" ) // checks if the UpdateApplicationPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &UpdateApplicationPayload{} -// UpdateApplicationPayload Application describes a deployable multi-container workload instance. +// UpdateApplicationPayload ApplicationPatch describes the fields to update in an existing application. type UpdateApplicationPayload struct { // Containers to deploy for the application. - Containers []Container `json:"containers"` - // Creation date in RFC3339 format. - CreatedAt *time.Time `json:"createdAt,omitempty"` - // Human-readable display name. - DisplayName string `json:"displayName"` - // Environment identifier where the application belongs. - EnvironmentId *string `json:"environmentId,omitempty"` - // Environment human-readable display name. - EnvironmentName *string `json:"environmentName,omitempty"` - // Application identifier. - Id *string `json:"id,omitempty"` - Network *ApplicationNetwork `json:"network,omitempty"` - // Region of the environment. - Region *string `json:"region,omitempty"` - Scaling ApplicationScaling `json:"scaling"` - Status *ApplicationStatus `json:"status,omitempty"` + Containers []Container `json:"containers,omitempty"` + Network *ApplicationNetwork `json:"network,omitempty"` + Scaling *ApplicationScaling `json:"scaling,omitempty"` // Indicates if the application resources are stopped. - Stopped *bool `json:"stopped,omitempty"` - // Last update date in RFC3339 format. - UpdatedAt *time.Time `json:"updatedAt,omitempty"` + Stopped *bool `json:"stopped,omitempty"` AdditionalProperties map[string]interface{} } @@ -51,11 +34,8 @@ type _UpdateApplicationPayload UpdateApplicationPayload // 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 NewUpdateApplicationPayload(containers []Container, displayName string, scaling ApplicationScaling) *UpdateApplicationPayload { +func NewUpdateApplicationPayload() *UpdateApplicationPayload { this := UpdateApplicationPayload{} - this.Containers = containers - this.DisplayName = displayName - this.Scaling = scaling return &this } @@ -67,180 +47,36 @@ func NewUpdateApplicationPayloadWithDefaults() *UpdateApplicationPayload { return &this } -// GetContainers returns the Containers field value +// GetContainers returns the Containers field value if set, zero value otherwise. func (o *UpdateApplicationPayload) GetContainers() []Container { - if o == nil { + if o == nil || IsNil(o.Containers) { var ret []Container return ret } - return o.Containers } -// GetContainersOk returns a tuple with the Containers field value +// GetContainersOk returns a tuple with the Containers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateApplicationPayload) GetContainersOk() ([]Container, bool) { - if o == nil { + if o == nil || IsNil(o.Containers) { return nil, false } return o.Containers, true } -// SetContainers sets field value -func (o *UpdateApplicationPayload) SetContainers(v []Container) { - o.Containers = v -} - -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) SetCreatedAt(v time.Time) { - o.CreatedAt = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *UpdateApplicationPayload) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *UpdateApplicationPayload) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *UpdateApplicationPayload) SetDisplayName(v string) { - o.DisplayName = v -} - -// GetEnvironmentId returns the EnvironmentId field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) GetEnvironmentId() string { - if o == nil || IsNil(o.EnvironmentId) { - var ret string - return ret - } - return *o.EnvironmentId -} - -// GetEnvironmentIdOk returns a tuple with the EnvironmentId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UpdateApplicationPayload) GetEnvironmentIdOk() (*string, bool) { - if o == nil || IsNil(o.EnvironmentId) { - return nil, false - } - return o.EnvironmentId, true -} - -// HasEnvironmentId returns a boolean if a field has been set. -func (o *UpdateApplicationPayload) HasEnvironmentId() bool { - if o != nil && !IsNil(o.EnvironmentId) { - return true - } - - return false -} - -// SetEnvironmentId gets a reference to the given string and assigns it to the EnvironmentId field. -func (o *UpdateApplicationPayload) SetEnvironmentId(v string) { - o.EnvironmentId = &v -} - -// GetEnvironmentName returns the EnvironmentName field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) GetEnvironmentName() string { - if o == nil || IsNil(o.EnvironmentName) { - var ret string - return ret - } - return *o.EnvironmentName -} - -// GetEnvironmentNameOk returns a tuple with the EnvironmentName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UpdateApplicationPayload) GetEnvironmentNameOk() (*string, bool) { - if o == nil || IsNil(o.EnvironmentName) { - return nil, false - } - return o.EnvironmentName, true -} - -// HasEnvironmentName returns a boolean if a field has been set. -func (o *UpdateApplicationPayload) HasEnvironmentName() bool { - if o != nil && !IsNil(o.EnvironmentName) { - return true - } - - return false -} - -// SetEnvironmentName gets a reference to the given string and assigns it to the EnvironmentName field. -func (o *UpdateApplicationPayload) SetEnvironmentName(v string) { - o.EnvironmentName = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) HasId() bool { - if o != nil && !IsNil(o.Id) { +// HasContainers returns a boolean if a field has been set. +func (o *UpdateApplicationPayload) HasContainers() bool { + if o != nil && !IsNil(o.Containers) { return true } return false } -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *UpdateApplicationPayload) SetId(v string) { - o.Id = &v +// SetContainers gets a reference to the given []Container and assigns it to the Containers field. +func (o *UpdateApplicationPayload) SetContainers(v []Container) { + o.Containers = v } // GetNetwork returns the Network field value if set, zero value otherwise. @@ -275,92 +111,36 @@ func (o *UpdateApplicationPayload) SetNetwork(v ApplicationNetwork) { o.Network = &v } -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) GetRegion() string { - if o == nil || IsNil(o.Region) { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UpdateApplicationPayload) GetRegionOk() (*string, bool) { - if o == nil || IsNil(o.Region) { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *UpdateApplicationPayload) HasRegion() bool { - if o != nil && !IsNil(o.Region) { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *UpdateApplicationPayload) SetRegion(v string) { - o.Region = &v -} - -// GetScaling returns the Scaling field value +// GetScaling returns the Scaling field value if set, zero value otherwise. func (o *UpdateApplicationPayload) GetScaling() ApplicationScaling { - if o == nil { + if o == nil || IsNil(o.Scaling) { var ret ApplicationScaling return ret } - - return o.Scaling + return *o.Scaling } -// GetScalingOk returns a tuple with the Scaling field value +// GetScalingOk returns a tuple with the Scaling field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateApplicationPayload) GetScalingOk() (*ApplicationScaling, bool) { - if o == nil { + if o == nil || IsNil(o.Scaling) { return nil, false } - return &o.Scaling, true -} - -// SetScaling sets field value -func (o *UpdateApplicationPayload) SetScaling(v ApplicationScaling) { - o.Scaling = v -} - -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) GetStatus() ApplicationStatus { - if o == nil || IsNil(o.Status) { - var ret ApplicationStatus - return ret - } - return *o.Status + return o.Scaling, true } -// 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 *UpdateApplicationPayload) GetStatusOk() (*ApplicationStatus, 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 *UpdateApplicationPayload) HasStatus() bool { - if o != nil && !IsNil(o.Status) { +// HasScaling returns a boolean if a field has been set. +func (o *UpdateApplicationPayload) HasScaling() bool { + if o != nil && !IsNil(o.Scaling) { return true } return false } -// SetStatus gets a reference to the given ApplicationStatus and assigns it to the Status field. -func (o *UpdateApplicationPayload) SetStatus(v ApplicationStatus) { - o.Status = &v +// SetScaling gets a reference to the given ApplicationScaling and assigns it to the Scaling field. +func (o *UpdateApplicationPayload) SetScaling(v ApplicationScaling) { + o.Scaling = &v } // GetStopped returns the Stopped field value if set, zero value otherwise. @@ -395,38 +175,6 @@ func (o *UpdateApplicationPayload) SetStopped(v bool) { o.Stopped = &v } -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. -func (o *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) SetUpdatedAt(v time.Time) { - o.UpdatedAt = &v -} - func (o UpdateApplicationPayload) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -437,36 +185,18 @@ func (o UpdateApplicationPayload) MarshalJSON() ([]byte, error) { func (o UpdateApplicationPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["containers"] = o.Containers - if !IsNil(o.CreatedAt) { - toSerialize["createdAt"] = o.CreatedAt - } - toSerialize["displayName"] = o.DisplayName - if !IsNil(o.EnvironmentId) { - toSerialize["environmentId"] = o.EnvironmentId - } - if !IsNil(o.EnvironmentName) { - toSerialize["environmentName"] = o.EnvironmentName - } - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if !IsNil(o.Containers) { + toSerialize["containers"] = o.Containers } if !IsNil(o.Network) { toSerialize["network"] = o.Network } - if !IsNil(o.Region) { - toSerialize["region"] = o.Region - } - toSerialize["scaling"] = o.Scaling - if !IsNil(o.Status) { - toSerialize["status"] = o.Status + if !IsNil(o.Scaling) { + toSerialize["scaling"] = o.Scaling } if !IsNil(o.Stopped) { toSerialize["stopped"] = o.Stopped } - if !IsNil(o.UpdatedAt) { - toSerialize["updatedAt"] = o.UpdatedAt - } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -476,29 +206,6 @@ func (o UpdateApplicationPayload) ToMap() (map[string]interface{}, error) { } func (o *UpdateApplicationPayload) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "containers", - "displayName", - "scaling", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - varUpdateApplicationPayload := _UpdateApplicationPayload{} err = json.Unmarshal(data, &varUpdateApplicationPayload) @@ -513,17 +220,9 @@ func (o *UpdateApplicationPayload) UnmarshalJSON(data []byte) (err error) { if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "containers") - delete(additionalProperties, "createdAt") - delete(additionalProperties, "displayName") - delete(additionalProperties, "environmentId") - delete(additionalProperties, "environmentName") - delete(additionalProperties, "id") delete(additionalProperties, "network") - delete(additionalProperties, "region") delete(additionalProperties, "scaling") - delete(additionalProperties, "status") delete(additionalProperties, "stopped") - delete(additionalProperties, "updatedAt") o.AdditionalProperties = additionalProperties }