diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b7f702dfd..efbc849a72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -259,6 +259,10 @@ - `v2api`: **Feature:** Add `RunCommandWaitHandler` wait handler for polling a command until it reaches a terminal state. `failed` is an error state; the handler returns a non-nil error along with the `CommandDetails`. - **Dependencies:** Add `github.com/google/go-cmp v0.7.0` - `sca`: + - [v0.1.1](services/sca/CHANGELOG.md#v011) + - `v1alphaapi`: + - **Bugfix:** Handle application failed status in create and update waiters. + - **Bugfix:** Handle application none status in create and updated waiters. - [v0.1.0](services/sca/CHANGELOG.md#v010) - **New:** SDK module for STACKIT Container Applications (SCA) service. - `v1alphaapi`: New package which can be used for communication with the sca v1 alpha API diff --git a/examples/sca/sca.go b/examples/sca/sca.go index 8684d7cdab..f53a7dea01 100644 --- a/examples/sca/sca.go +++ b/examples/sca/sca.go @@ -71,8 +71,8 @@ func main() { Memory: sca.PtrInt32(1000), Cpu: sca.PtrInt32(1000), }}, - Network: sca.Network{ - PublicIngress: true, + Network: &sca.Network{ + PublicIngress: sca.PtrBool(true), Port: sca.PtrInt32(8080), }, Scaling: sca.Scaling{ diff --git a/services/sca/CHANGELOG.md b/services/sca/CHANGELOG.md index 07d1f40bee..38056a7033 100644 --- a/services/sca/CHANGELOG.md +++ b/services/sca/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.1.1 +- **Bugfix:** Handle application failed status in create and update waiters. +- **Bugfix:** Handle application none status in create and updated waiters. + ## v0.1.0 - **New:** SDK module for STACKIT Container Applications (SCA) service. - `v1alphaapi`: New package which can be used for communication with the sca v1 alpha API diff --git a/services/sca/VERSION b/services/sca/VERSION index b82608c0bb..8308b63aea 100644 --- a/services/sca/VERSION +++ b/services/sca/VERSION @@ -1 +1 @@ -v0.1.0 +v0.1.1 diff --git a/services/sca/go.mod b/services/sca/go.mod index 10f1f03be5..f015219b16 100644 --- a/services/sca/go.mod +++ b/services/sca/go.mod @@ -2,7 +2,7 @@ module github.com/stackitcloud/stackit-sdk-go/services/sca go 1.25 -require github.com/stackitcloud/stackit-sdk-go/core v0.27.0 +require github.com/stackitcloud/stackit-sdk-go/core v0.27.1 require ( github.com/golang-jwt/jwt/v5 v5.3.1 // indirect diff --git a/services/sca/go.sum b/services/sca/go.sum index 042f4a71a5..5bae1d1250 100644 --- a/services/sca/go.sum +++ b/services/sca/go.sum @@ -4,5 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/stackitcloud/stackit-sdk-go/core v0.27.0 h1:7lc6qStcFDFf8zHP4ORPa9joybw+Sa2LtB6BVjKQ+ek= -github.com/stackitcloud/stackit-sdk-go/core v0.27.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= +github.com/stackitcloud/stackit-sdk-go/core v0.27.1 h1:k7SrqqMoHjkvHbx6n6nV3Lt51itp8nNplht6vGHkPhw= +github.com/stackitcloud/stackit-sdk-go/core v0.27.1/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/sca/oas_commit b/services/sca/oas_commit index b2db84d556..58cc8c279b 100644 --- a/services/sca/oas_commit +++ b/services/sca/oas_commit @@ -1 +1 @@ -9b983fefc1a52d2b7fdc9df6376424c944a044bb +297e51f3e00dd65ea87c68215459d6dc484a613f diff --git a/services/sca/v1alphaapi/api_default.go b/services/sca/v1alphaapi/api_default.go index 726f075ed1..6e4397dc06 100644 --- a/services/sca/v1alphaapi/api_default.go +++ b/services/sca/v1alphaapi/api_default.go @@ -81,7 +81,7 @@ type DefaultAPI interface { GetApplicationExecute(r ApiGetApplicationRequest) (*Application, error) /* - GetApplicationEvents GetApplicationEvents retrieves events of an application. + GetApplicationEvents Retrieves events of an application. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project to fetch the application from. @@ -96,7 +96,7 @@ type DefaultAPI interface { GetApplicationEventsExecute(r ApiGetApplicationEventsRequest) (*GetApplicationEventsResponse, error) /* - GetApplicationLogs GetApplicationLogs retrieves logs of an application. + GetApplicationLogs Retrieves logs of an application. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project to fetch the application from. @@ -125,7 +125,7 @@ type DefaultAPI interface { GetEnvironmentExecute(r ApiGetEnvironmentRequest) (*Environment, error) /* - GetOverview Method for GetOverview + GetOverview Retrieves the overview for an environment. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Parent project resource name to list under. @@ -855,7 +855,7 @@ func (r ApiGetApplicationEventsRequest) Execute() (*GetApplicationEventsResponse } /* -GetApplicationEvents GetApplicationEvents retrieves events of an application. +GetApplicationEvents Retrieves events of an application. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project to fetch the application from. @@ -1029,7 +1029,7 @@ func (r ApiGetApplicationLogsRequest) Execute() (*GetApplicationLogsResponse, er } /* -GetApplicationLogs GetApplicationLogs retrieves logs of an application. +GetApplicationLogs Retrieves logs of an application. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project to fetch the application from. @@ -1351,7 +1351,7 @@ func (r ApiGetOverviewRequest) Execute() (*GetOverviewResponse, error) { } /* -GetOverview Method for GetOverview +GetOverview Retrieves the overview for an environment. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Parent project resource name to list under. diff --git a/services/sca/v1alphaapi/model_application.go b/services/sca/v1alphaapi/model_application.go index 0910da27d6..3904cf2e82 100644 --- a/services/sca/v1alphaapi/model_application.go +++ b/services/sca/v1alphaapi/model_application.go @@ -29,8 +29,8 @@ type Application struct { // Application human-readable display name. EnvironmentName *string `json:"environmentName,omitempty"` // Application identifier, for example: 00000000-0000-0000-0000-000000000000. - Id *string `json:"id,omitempty"` - Network Network `json:"network"` + Id *string `json:"id,omitempty"` + Network *Network `json:"network,omitempty"` // Image registry configuration for the application. Registry []ApplicationRegistry `json:"registry,omitempty"` RuntimeStatus *RuntimeStatus `json:"runtimeStatus,omitempty"` @@ -48,11 +48,10 @@ type _Application Application // 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 NewApplication(containers []Container, displayName string, network Network, scaling Scaling) *Application { +func NewApplication(containers []Container, displayName string, scaling Scaling) *Application { this := Application{} this.Containers = containers this.DisplayName = displayName - this.Network = network this.Scaling = scaling return &this } @@ -209,28 +208,36 @@ func (o *Application) SetId(v string) { o.Id = &v } -// GetNetwork returns the Network field value +// GetNetwork returns the Network field value if set, zero value otherwise. func (o *Application) GetNetwork() Network { - if o == nil { + if o == nil || IsNil(o.Network) { var ret Network return ret } - - return o.Network + return *o.Network } -// GetNetworkOk returns a tuple with the Network field value +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Application) GetNetworkOk() (*Network, bool) { - if o == nil { + if o == nil || IsNil(o.Network) { return nil, false } - return &o.Network, true + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *Application) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false } -// SetNetwork sets field value +// SetNetwork gets a reference to the given Network and assigns it to the Network field. func (o *Application) SetNetwork(v Network) { - o.Network = v + o.Network = &v } // GetRegistry returns the Registry field value if set, zero value otherwise. @@ -406,7 +413,9 @@ func (o Application) ToMap() (map[string]interface{}, error) { if !IsNil(o.Id) { toSerialize["id"] = o.Id } - toSerialize["network"] = o.Network + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } if !IsNil(o.Registry) { toSerialize["registry"] = o.Registry } @@ -435,7 +444,6 @@ func (o *Application) UnmarshalJSON(data []byte) (err error) { requiredProperties := []string{ "containers", "displayName", - "network", "scaling", } diff --git a/services/sca/v1alphaapi/model_application_summary.go b/services/sca/v1alphaapi/model_application_summary.go index 1bb8fed005..0bd18df458 100644 --- a/services/sca/v1alphaapi/model_application_summary.go +++ b/services/sca/v1alphaapi/model_application_summary.go @@ -34,6 +34,8 @@ type ApplicationSummary struct { Id *string `json:"id,omitempty"` // Application's running instances. Instances *int32 `json:"instances,omitempty"` + // Application's internal URL. + InternalUrl *string `json:"internalUrl,omitempty"` // Date of the last moment the application got the running status in RFC3339 format. LastDeployment *time.Time `json:"lastDeployment,omitempty"` Status *CurrentStatus `json:"status,omitempty"` @@ -291,6 +293,38 @@ func (o *ApplicationSummary) SetInstances(v int32) { o.Instances = &v } +// GetInternalUrl returns the InternalUrl field value if set, zero value otherwise. +func (o *ApplicationSummary) GetInternalUrl() string { + if o == nil || IsNil(o.InternalUrl) { + var ret string + return ret + } + return *o.InternalUrl +} + +// GetInternalUrlOk returns a tuple with the InternalUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetInternalUrlOk() (*string, bool) { + if o == nil || IsNil(o.InternalUrl) { + return nil, false + } + return o.InternalUrl, true +} + +// HasInternalUrl returns a boolean if a field has been set. +func (o *ApplicationSummary) HasInternalUrl() bool { + if o != nil && !IsNil(o.InternalUrl) { + return true + } + + return false +} + +// SetInternalUrl gets a reference to the given string and assigns it to the InternalUrl field. +func (o *ApplicationSummary) SetInternalUrl(v string) { + o.InternalUrl = &v +} + // GetLastDeployment returns the LastDeployment field value if set, zero value otherwise. func (o *ApplicationSummary) GetLastDeployment() time.Time { if o == nil || IsNil(o.LastDeployment) { @@ -450,6 +484,9 @@ func (o ApplicationSummary) ToMap() (map[string]interface{}, error) { if !IsNil(o.Instances) { toSerialize["instances"] = o.Instances } + if !IsNil(o.InternalUrl) { + toSerialize["internalUrl"] = o.InternalUrl + } if !IsNil(o.LastDeployment) { toSerialize["lastDeployment"] = o.LastDeployment } @@ -491,6 +528,7 @@ func (o *ApplicationSummary) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "environmentName") delete(additionalProperties, "id") delete(additionalProperties, "instances") + delete(additionalProperties, "internalUrl") delete(additionalProperties, "lastDeployment") delete(additionalProperties, "status") delete(additionalProperties, "stopped") diff --git a/services/sca/v1alphaapi/model_create_application_payload.go b/services/sca/v1alphaapi/model_create_application_payload.go index 7aa61932a1..5b8da9b51e 100644 --- a/services/sca/v1alphaapi/model_create_application_payload.go +++ b/services/sca/v1alphaapi/model_create_application_payload.go @@ -29,8 +29,8 @@ type CreateApplicationPayload struct { // Application human-readable display name. EnvironmentName *string `json:"environmentName,omitempty"` // Application identifier, for example: 00000000-0000-0000-0000-000000000000. - Id *string `json:"id,omitempty"` - Network Network `json:"network"` + Id *string `json:"id,omitempty"` + Network *Network `json:"network,omitempty"` // Image registry configuration for the application. Registry []ApplicationRegistry `json:"registry,omitempty"` RuntimeStatus *RuntimeStatus `json:"runtimeStatus,omitempty"` @@ -48,11 +48,10 @@ type _CreateApplicationPayload CreateApplicationPayload // 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 NewCreateApplicationPayload(containers []Container, displayName string, network Network, scaling Scaling) *CreateApplicationPayload { +func NewCreateApplicationPayload(containers []Container, displayName string, scaling Scaling) *CreateApplicationPayload { this := CreateApplicationPayload{} this.Containers = containers this.DisplayName = displayName - this.Network = network this.Scaling = scaling return &this } @@ -209,28 +208,36 @@ func (o *CreateApplicationPayload) SetId(v string) { o.Id = &v } -// GetNetwork returns the Network field value +// GetNetwork returns the Network field value if set, zero value otherwise. func (o *CreateApplicationPayload) GetNetwork() Network { - if o == nil { + if o == nil || IsNil(o.Network) { var ret Network return ret } - - return o.Network + return *o.Network } -// GetNetworkOk returns a tuple with the Network field value +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateApplicationPayload) GetNetworkOk() (*Network, bool) { - if o == nil { + if o == nil || IsNil(o.Network) { return nil, false } - return &o.Network, true + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *CreateApplicationPayload) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false } -// SetNetwork sets field value +// SetNetwork gets a reference to the given Network and assigns it to the Network field. func (o *CreateApplicationPayload) SetNetwork(v Network) { - o.Network = v + o.Network = &v } // GetRegistry returns the Registry field value if set, zero value otherwise. @@ -406,7 +413,9 @@ func (o CreateApplicationPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Id) { toSerialize["id"] = o.Id } - toSerialize["network"] = o.Network + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } if !IsNil(o.Registry) { toSerialize["registry"] = o.Registry } @@ -435,7 +444,6 @@ func (o *CreateApplicationPayload) UnmarshalJSON(data []byte) (err error) { requiredProperties := []string{ "containers", "displayName", - "network", "scaling", } diff --git a/services/sca/v1alphaapi/model_create_environment_payload.go b/services/sca/v1alphaapi/model_create_environment_payload.go index 57d17f2ef1..5d4794ea9b 100644 --- a/services/sca/v1alphaapi/model_create_environment_payload.go +++ b/services/sca/v1alphaapi/model_create_environment_payload.go @@ -28,7 +28,8 @@ type CreateEnvironmentPayload struct { // Human-readable display name. DisplayName string `json:"displayName"` // Environment identifier, for example: default. - Id *string `json:"id,omitempty"` + Id *string `json:"id,omitempty"` + Status *EnvironmentStatus `json:"status,omitempty"` AdditionalProperties map[string]interface{} } @@ -41,6 +42,8 @@ type _CreateEnvironmentPayload CreateEnvironmentPayload func NewCreateEnvironmentPayload(displayName string) *CreateEnvironmentPayload { this := CreateEnvironmentPayload{} this.DisplayName = displayName + var status EnvironmentStatus = ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_UNSPECIFIED + this.Status = &status return &this } @@ -49,6 +52,8 @@ func NewCreateEnvironmentPayload(displayName string) *CreateEnvironmentPayload { // but it doesn't guarantee that properties required by API are set func NewCreateEnvironmentPayloadWithDefaults() *CreateEnvironmentPayload { this := CreateEnvironmentPayload{} + var status EnvironmentStatus = ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_UNSPECIFIED + this.Status = &status return &this } @@ -172,6 +177,38 @@ func (o *CreateEnvironmentPayload) SetId(v string) { o.Id = &v } +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateEnvironmentPayload) GetStatus() EnvironmentStatus { + if o == nil || IsNil(o.Status) { + var ret EnvironmentStatus + 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 *CreateEnvironmentPayload) GetStatusOk() (*EnvironmentStatus, 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 *CreateEnvironmentPayload) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given EnvironmentStatus and assigns it to the Status field. +func (o *CreateEnvironmentPayload) SetStatus(v EnvironmentStatus) { + o.Status = &v +} + func (o CreateEnvironmentPayload) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -192,6 +229,9 @@ func (o CreateEnvironmentPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Id) { toSerialize["id"] = o.Id } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -239,6 +279,7 @@ func (o *CreateEnvironmentPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "default") delete(additionalProperties, "displayName") delete(additionalProperties, "id") + delete(additionalProperties, "status") o.AdditionalProperties = additionalProperties } diff --git a/services/sca/v1alphaapi/model_environment.go b/services/sca/v1alphaapi/model_environment.go index b6638199a8..b8d41c2d56 100644 --- a/services/sca/v1alphaapi/model_environment.go +++ b/services/sca/v1alphaapi/model_environment.go @@ -28,7 +28,8 @@ type Environment struct { // Human-readable display name. DisplayName string `json:"displayName"` // Environment identifier, for example: default. - Id *string `json:"id,omitempty"` + Id *string `json:"id,omitempty"` + Status *EnvironmentStatus `json:"status,omitempty"` AdditionalProperties map[string]interface{} } @@ -41,6 +42,8 @@ type _Environment Environment func NewEnvironment(displayName string) *Environment { this := Environment{} this.DisplayName = displayName + var status EnvironmentStatus = ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_UNSPECIFIED + this.Status = &status return &this } @@ -49,6 +52,8 @@ func NewEnvironment(displayName string) *Environment { // but it doesn't guarantee that properties required by API are set func NewEnvironmentWithDefaults() *Environment { this := Environment{} + var status EnvironmentStatus = ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_UNSPECIFIED + this.Status = &status return &this } @@ -172,6 +177,38 @@ func (o *Environment) SetId(v string) { o.Id = &v } +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Environment) GetStatus() EnvironmentStatus { + if o == nil || IsNil(o.Status) { + var ret EnvironmentStatus + 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 *Environment) GetStatusOk() (*EnvironmentStatus, 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 *Environment) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given EnvironmentStatus and assigns it to the Status field. +func (o *Environment) SetStatus(v EnvironmentStatus) { + o.Status = &v +} + func (o Environment) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -192,6 +229,9 @@ func (o Environment) ToMap() (map[string]interface{}, error) { if !IsNil(o.Id) { toSerialize["id"] = o.Id } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -239,6 +279,7 @@ func (o *Environment) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "default") delete(additionalProperties, "displayName") delete(additionalProperties, "id") + delete(additionalProperties, "status") o.AdditionalProperties = additionalProperties } diff --git a/services/sca/v1alphaapi/model_environment_status.go b/services/sca/v1alphaapi/model_environment_status.go new file mode 100644 index 0000000000..286eab1bd9 --- /dev/null +++ b/services/sca/v1alphaapi/model_environment_status.go @@ -0,0 +1,115 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// EnvironmentStatus - ENVIRONMENT_STATUS_UNSPECIFIED: Used as zero value. - ENVIRONMENT_STATUS_PROGRESSING: Environment is being created. - ENVIRONMENT_STATUS_CREATED: Environment is successfully created. +type EnvironmentStatus string + +// List of EnvironmentStatus +const ( + ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_UNSPECIFIED EnvironmentStatus = "ENVIRONMENT_STATUS_UNSPECIFIED" + ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_PROGRESSING EnvironmentStatus = "ENVIRONMENT_STATUS_PROGRESSING" + ENVIRONMENTSTATUS_ENVIRONMENT_STATUS_CREATED EnvironmentStatus = "ENVIRONMENT_STATUS_CREATED" + ENVIRONMENTSTATUS_UNKNOWN_DEFAULT_OPEN_API EnvironmentStatus = "unknown_default_open_api" +) + +// All allowed values of EnvironmentStatus enum +var AllowedEnvironmentStatusEnumValues = []EnvironmentStatus{ + "ENVIRONMENT_STATUS_UNSPECIFIED", + "ENVIRONMENT_STATUS_PROGRESSING", + "ENVIRONMENT_STATUS_CREATED", + "unknown_default_open_api", +} + +func (v *EnvironmentStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EnvironmentStatus(value) + for _, existing := range AllowedEnvironmentStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = ENVIRONMENTSTATUS_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewEnvironmentStatusFromValue returns a pointer to a valid EnvironmentStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEnvironmentStatusFromValue(v string) (*EnvironmentStatus, error) { + ev := EnvironmentStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EnvironmentStatus: valid values are %v", v, AllowedEnvironmentStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EnvironmentStatus) IsValid() bool { + for _, existing := range AllowedEnvironmentStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EnvironmentStatus value +func (v EnvironmentStatus) Ptr() *EnvironmentStatus { + return &v +} + +type NullableEnvironmentStatus struct { + value *EnvironmentStatus + isSet bool +} + +func (v NullableEnvironmentStatus) Get() *EnvironmentStatus { + return v.value +} + +func (v *NullableEnvironmentStatus) Set(val *EnvironmentStatus) { + v.value = val + v.isSet = true +} + +func (v NullableEnvironmentStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableEnvironmentStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnvironmentStatus(val *EnvironmentStatus) *NullableEnvironmentStatus { + return &NullableEnvironmentStatus{value: val, isSet: true} +} + +func (v NullableEnvironmentStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnvironmentStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_network.go b/services/sca/v1alphaapi/model_network.go index cd7d8ad251..47443bd422 100644 --- a/services/sca/v1alphaapi/model_network.go +++ b/services/sca/v1alphaapi/model_network.go @@ -12,7 +12,6 @@ package v1alphaapi import ( "encoding/json" - "fmt" ) // checks if the Network type satisfies the MappedNullable interface at compile time @@ -22,10 +21,12 @@ var _ MappedNullable = &Network{} type Network struct { // Allowed destination CIDRs for Ingress traffic. IngressAcl []string `json:"ingressAcl,omitempty"` + // Internal port number for inter application communication. + InternalPort *int32 `json:"internalPort,omitempty"` // Port number. Port *int32 `json:"port,omitempty"` // Whether the application should be accessible from the internet. - PublicIngress bool `json:"publicIngress"` + PublicIngress *bool `json:"publicIngress,omitempty"` AdditionalProperties map[string]interface{} } @@ -35,9 +36,8 @@ type _Network Network // 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 NewNetwork(publicIngress bool) *Network { +func NewNetwork() *Network { this := Network{} - this.PublicIngress = publicIngress return &this } @@ -81,6 +81,38 @@ func (o *Network) SetIngressAcl(v []string) { o.IngressAcl = v } +// GetInternalPort returns the InternalPort field value if set, zero value otherwise. +func (o *Network) GetInternalPort() int32 { + if o == nil || IsNil(o.InternalPort) { + var ret int32 + return ret + } + return *o.InternalPort +} + +// GetInternalPortOk returns a tuple with the InternalPort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetInternalPortOk() (*int32, bool) { + if o == nil || IsNil(o.InternalPort) { + return nil, false + } + return o.InternalPort, true +} + +// HasInternalPort returns a boolean if a field has been set. +func (o *Network) HasInternalPort() bool { + if o != nil && !IsNil(o.InternalPort) { + return true + } + + return false +} + +// SetInternalPort gets a reference to the given int32 and assigns it to the InternalPort field. +func (o *Network) SetInternalPort(v int32) { + o.InternalPort = &v +} + // GetPort returns the Port field value if set, zero value otherwise. func (o *Network) GetPort() int32 { if o == nil || IsNil(o.Port) { @@ -113,28 +145,36 @@ func (o *Network) SetPort(v int32) { o.Port = &v } -// GetPublicIngress returns the PublicIngress field value +// GetPublicIngress returns the PublicIngress field value if set, zero value otherwise. func (o *Network) GetPublicIngress() bool { - if o == nil { + if o == nil || IsNil(o.PublicIngress) { var ret bool return ret } - - return o.PublicIngress + return *o.PublicIngress } -// GetPublicIngressOk returns a tuple with the PublicIngress field value +// GetPublicIngressOk returns a tuple with the PublicIngress field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Network) GetPublicIngressOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.PublicIngress) { return nil, false } - return &o.PublicIngress, true + return o.PublicIngress, true } -// SetPublicIngress sets field value +// HasPublicIngress returns a boolean if a field has been set. +func (o *Network) HasPublicIngress() bool { + if o != nil && !IsNil(o.PublicIngress) { + return true + } + + return false +} + +// SetPublicIngress gets a reference to the given bool and assigns it to the PublicIngress field. func (o *Network) SetPublicIngress(v bool) { - o.PublicIngress = v + o.PublicIngress = &v } func (o Network) MarshalJSON() ([]byte, error) { @@ -150,10 +190,15 @@ func (o Network) ToMap() (map[string]interface{}, error) { if !IsNil(o.IngressAcl) { toSerialize["ingressAcl"] = o.IngressAcl } + if !IsNil(o.InternalPort) { + toSerialize["internalPort"] = o.InternalPort + } if !IsNil(o.Port) { toSerialize["port"] = o.Port } - toSerialize["publicIngress"] = o.PublicIngress + if !IsNil(o.PublicIngress) { + toSerialize["publicIngress"] = o.PublicIngress + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -163,27 +208,6 @@ func (o Network) ToMap() (map[string]interface{}, error) { } func (o *Network) 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{ - "publicIngress", - } - - 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) - } - } - varNetwork := _Network{} err = json.Unmarshal(data, &varNetwork) @@ -198,6 +222,7 @@ func (o *Network) UnmarshalJSON(data []byte) (err error) { if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "ingressAcl") + delete(additionalProperties, "internalPort") delete(additionalProperties, "port") delete(additionalProperties, "publicIngress") o.AdditionalProperties = additionalProperties diff --git a/services/sca/v1alphaapi/model_runtime_status.go b/services/sca/v1alphaapi/model_runtime_status.go index 94be423d95..231c18b800 100644 --- a/services/sca/v1alphaapi/model_runtime_status.go +++ b/services/sca/v1alphaapi/model_runtime_status.go @@ -24,6 +24,8 @@ type RuntimeStatus struct { // Failure reasons collected from workload conditions. FailureReasons []string `json:"failureReasons,omitempty"` Instances []Instance `json:"instances,omitempty"` + // Internal URL for the running application. + InternalUrl *string `json:"internalUrl,omitempty"` // Last time the application was deployed. LastDeployment *time.Time `json:"lastDeployment,omitempty"` // Known URLs for the running application. @@ -150,6 +152,38 @@ func (o *RuntimeStatus) SetInstances(v []Instance) { o.Instances = v } +// GetInternalUrl returns the InternalUrl field value if set, zero value otherwise. +func (o *RuntimeStatus) GetInternalUrl() string { + if o == nil || IsNil(o.InternalUrl) { + var ret string + return ret + } + return *o.InternalUrl +} + +// GetInternalUrlOk returns a tuple with the InternalUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuntimeStatus) GetInternalUrlOk() (*string, bool) { + if o == nil || IsNil(o.InternalUrl) { + return nil, false + } + return o.InternalUrl, true +} + +// HasInternalUrl returns a boolean if a field has been set. +func (o *RuntimeStatus) HasInternalUrl() bool { + if o != nil && !IsNil(o.InternalUrl) { + return true + } + + return false +} + +// SetInternalUrl gets a reference to the given string and assigns it to the InternalUrl field. +func (o *RuntimeStatus) SetInternalUrl(v string) { + o.InternalUrl = &v +} + // GetLastDeployment returns the LastDeployment field value if set, zero value otherwise. func (o *RuntimeStatus) GetLastDeployment() time.Time { if o == nil || IsNil(o.LastDeployment) { @@ -233,6 +267,9 @@ func (o RuntimeStatus) ToMap() (map[string]interface{}, error) { if !IsNil(o.Instances) { toSerialize["instances"] = o.Instances } + if !IsNil(o.InternalUrl) { + toSerialize["internalUrl"] = o.InternalUrl + } if !IsNil(o.LastDeployment) { toSerialize["lastDeployment"] = o.LastDeployment } @@ -264,6 +301,7 @@ func (o *RuntimeStatus) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "currentStatus") delete(additionalProperties, "failureReasons") delete(additionalProperties, "instances") + delete(additionalProperties, "internalUrl") delete(additionalProperties, "lastDeployment") delete(additionalProperties, "urls") o.AdditionalProperties = additionalProperties diff --git a/services/sca/v1alphaapi/wait/wait.go b/services/sca/v1alphaapi/wait/wait.go index 93743139dd..18f1021d11 100644 --- a/services/sca/v1alphaapi/wait/wait.go +++ b/services/sca/v1alphaapi/wait/wait.go @@ -24,10 +24,9 @@ func createOrUpdateApplicationWaitHandler(ctx context.Context, a sca.DefaultAPI, waitConfig := wait.WaiterHelper[sca.Application, sca.CurrentStatus]{ FetchInstance: a.GetApplication(ctx, projectID, environmentID, applicationID).Execute, GetState: getApplicationState, - ActiveState: []sca.CurrentStatus{sca.CURRENTSTATUS_CURRENT_STATUS_RUNNING, sca.CURRENTSTATUS_CURRENT_STATUS_IDLE}, - // There is an issue where the API reports a transient FAILED status during the startup of applications. - // It will be solved before the beta. - // ErrorState: []sca.CurrentStatus{sca.CURRENTSTATUS_CURRENT_STATUS_FAILED}, + // CURRENT_STATUS_NONE implies that the applicaiton is stopped, so its active without instances + ActiveState: []sca.CurrentStatus{sca.CURRENTSTATUS_CURRENT_STATUS_RUNNING, sca.CURRENTSTATUS_CURRENT_STATUS_IDLE, sca.CURRENTSTATUS_CURRENT_STATUS_NONE}, + ErrorState: []sca.CurrentStatus{sca.CURRENTSTATUS_CURRENT_STATUS_FAILED}, } handler := wait.New(waitConfig.Wait()) handler.SetTimeout(45 * time.Minute) diff --git a/services/sca/v1alphaapi/wait/wait_test.go b/services/sca/v1alphaapi/wait/wait_test.go index 9e05a4d2ef..d928d18dc8 100644 --- a/services/sca/v1alphaapi/wait/wait_test.go +++ b/services/sca/v1alphaapi/wait/wait_test.go @@ -61,6 +61,13 @@ func TestCreateOrUpdateApplicationWaitHandler(t *testing.T) { getFails: false, }, }, + { + desc: "application_stopped_succeeded", + mockSettings: mockSettings{ + resourceState: sca.CURRENTSTATUS_CURRENT_STATUS_NONE, + getFails: false, + }, + }, { desc: "get_fails", mockSettings: mockSettings{