diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b4d5c8e2..36466b3c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,54 @@ -## Release (2025-XX-XX) -- `stackitmarketplace`: [v1.1.0](services/stackitmarketplace/CHANGELOG.md#v110-2025-05-13) - - **Breaking Change:** Added organization id to `VendorSubscription` -- `ske`: [v0.22.4](services/ske/CHANGELOG.md#v0224-2025-05-13) - - **Feature:** Added `ClusterError` - +## Release (2025-xx-xx) +- `alb`: [v0.3.0](services/alb/CHANGELOG.md#v030-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `cdn`: [v1.1.0](services/cdn/CHANGELOG.md#v110-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `dns`: [v0.14.0](services/dns/CHANGELOG.md#v0140-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `git`: [v0.4.0](services/git/CHANGELOG.md#v040-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `kms`: [v0.1.0](services/kms/CHANGELOG.md#v010-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `lbapplication`: [v0.4.0](services/lbapplication/CHANGELOG.md#v040-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `loadbalancer`: [v1.1.0](services/loadbalancer/CHANGELOG.md#v110-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `logme`: [v0.23.0](services/logme/CHANGELOG.md#v0230-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `mariadb`: [v0.23.0](services/mariadb/CHANGELOG.md#v0230-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `modelserving`: [v0.3.0](services/modelserving/CHANGELOG.md#v030-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `mongodbflex`: [v1.1.0](services/mongodbflex/CHANGELOG.md#v110-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `observability`: [v0.6.0](services/observability/CHANGELOG.md#v060-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `opensearch`: [v0.22.0](services/opensearch/CHANGELOG.md#v0220-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `rabbitmq`: [v0.23.0](services/rabbitmq/CHANGELOG.md#v0230-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `redis`: [v0.23.0](services/redis/CHANGELOG.md#v0230-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `resourcemanager`: [v0.14.0](services/resourcemanager/CHANGELOG.md#v0140-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `runcommand`: [v1.1.0](services/runcommand/CHANGELOG.md#v110-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `serverbackup`: [v1.1.0](services/serverbackup/CHANGELOG.md#v110-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `serviceaccount`: [v0.7.0](services/serviceaccount/CHANGELOG.md#v070-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `serviceenablement`: [v1.1.0](services/serviceenablement/CHANGELOG.md#v110-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes +- `ske`: + - [v0.23.0](services/ske/CHANGELOG.md#v0230-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes + - [v0.22.4](services/ske/CHANGELOG.md#v0224-2025-05-13) + - **Feature:** Added `ClusterError` +- `stackitmarketplace`: + - [v1.2.0](services/stackitmarketplace/CHANGELOG.md#v120-2025-05-14) + - **Breaking change:** Introduce typed enum constants for status attributes + - [v1.1.0](services/stackitmarketplace/CHANGELOG.md#v110-2025-05-13) + - **Breaking Change:** Added organization id to `VendorSubscription` ## Release (2025-05-09) - `resourcemanager`: diff --git a/examples/loadbalancer/loadbalancer.go b/examples/loadbalancer/loadbalancer.go index 1b4bcc221..4828d5bf9 100644 --- a/examples/loadbalancer/loadbalancer.go +++ b/examples/loadbalancer/loadbalancer.go @@ -45,14 +45,14 @@ func main() { Networks: &[]loadbalancer.Network{ { NetworkId: utils.Ptr("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), - Role: utils.Ptr("1"), + Role: utils.Ptr(loadbalancer.NETWORKROLE_LISTENERS_AND_TARGETS), }, }, Listeners: &[]loadbalancer.Listener{ { DisplayName: utils.Ptr("example-listener"), Port: utils.Ptr(int64(1)), - Protocol: utils.Ptr("1"), + Protocol: utils.Ptr(loadbalancer.LISTENERPROTOCOL_TCP), TargetPool: utils.Ptr("example-target-pool"), }, }, diff --git a/services/alb/CHANGELOG.md b/services/alb/CHANGELOG.md index 80047ed82..4dae0fa11 100644 --- a/services/alb/CHANGELOG.md +++ b/services/alb/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.3.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.2.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/alb/model_create_load_balancer_payload.go b/services/alb/model_create_load_balancer_payload.go index 62c1482cb..d44074e7d 100644 --- a/services/alb/model_create_load_balancer_payload.go +++ b/services/alb/model_create_load_balancer_payload.go @@ -12,6 +12,7 @@ package alb import ( "encoding/json" + "fmt" ) // checks if the CreateLoadBalancerPayload type satisfies the MappedNullable interface at compile time @@ -206,10 +207,116 @@ type CreateLoadBalancerPayloadGetRegionRetType = string types and functions for status */ -// isEnumRef -type CreateLoadBalancerPayloadGetStatusAttributeType = *string -type CreateLoadBalancerPayloadGetStatusArgType = string -type CreateLoadBalancerPayloadGetStatusRetType = string +//isEnum + +// CreateLoadBalancerPayloadStatus the model 'CreateLoadBalancerPayload' +type CreateLoadBalancerPayloadStatus string + +// List of Status +const ( + CREATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED CreateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + CREATELOADBALANCERPAYLOADSTATUS_PENDING CreateLoadBalancerPayloadStatus = "STATUS_PENDING" + CREATELOADBALANCERPAYLOADSTATUS_READY CreateLoadBalancerPayloadStatus = "STATUS_READY" + CREATELOADBALANCERPAYLOADSTATUS_ERROR CreateLoadBalancerPayloadStatus = "STATUS_ERROR" + CREATELOADBALANCERPAYLOADSTATUS_TERMINATING CreateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of CreateLoadBalancerPayload enum +var AllowedCreateLoadBalancerPayloadStatusEnumValues = []CreateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *CreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateLoadBalancerPayload", value) +} + +// NewCreateLoadBalancerPayloadStatusFromValue returns a pointer to a valid CreateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateLoadBalancerPayloadStatusFromValue(v string) (*CreateLoadBalancerPayloadStatus, error) { + ev := CreateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateLoadBalancerPayloadStatus: valid values are %v", v, AllowedCreateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CreateLoadBalancerPayloadStatus) Ptr() *CreateLoadBalancerPayloadStatus { + return &v +} + +type NullableCreateLoadBalancerPayloadStatus struct { + value *CreateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadStatus) Get() *CreateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Set(val *CreateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadStatus(val *CreateLoadBalancerPayloadStatus) *NullableCreateLoadBalancerPayloadStatus { + return &NullableCreateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateLoadBalancerPayloadGetStatusAttributeType = *CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusArgType = CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusRetType = CreateLoadBalancerPayloadStatus func getCreateLoadBalancerPayloadGetStatusAttributeTypeOk(arg CreateLoadBalancerPayloadGetStatusAttributeType) (ret CreateLoadBalancerPayloadGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/alb/model_listener.go b/services/alb/model_listener.go index 7eabe037d..386d633a3 100644 --- a/services/alb/model_listener.go +++ b/services/alb/model_listener.go @@ -12,6 +12,7 @@ package alb import ( "encoding/json" + "fmt" ) // checks if the Listener type satisfies the MappedNullable interface at compile time @@ -102,10 +103,112 @@ func setListenerGetPortAttributeType(arg *ListenerGetPortAttributeType, val List types and functions for protocol */ -// isEnumRef -type ListenerGetProtocolAttributeType = *string -type ListenerGetProtocolArgType = string -type ListenerGetProtocolRetType = string +//isEnum + +// ListenerProtocol Protocol is the highest network protocol we understand to load balance. Currently PROTOCOL_HTTP and PROTOCOL_HTTPS are supported. +type ListenerProtocol string + +// List of Protocol +const ( + LISTENERPROTOCOL_UNSPECIFIED ListenerProtocol = "PROTOCOL_UNSPECIFIED" + LISTENERPROTOCOL_HTTP ListenerProtocol = "PROTOCOL_HTTP" + LISTENERPROTOCOL_HTTPS ListenerProtocol = "PROTOCOL_HTTPS" +) + +// All allowed values of Listener enum +var AllowedListenerProtocolEnumValues = []ListenerProtocol{ + "PROTOCOL_UNSPECIFIED", + "PROTOCOL_HTTP", + "PROTOCOL_HTTPS", +} + +func (v *ListenerProtocol) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ListenerProtocol(value) + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Listener", value) +} + +// NewListenerProtocolFromValue returns a pointer to a valid ListenerProtocol +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListenerProtocolFromValue(v string) (*ListenerProtocol, error) { + ev := ListenerProtocol(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListenerProtocol: valid values are %v", v, AllowedListenerProtocolEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListenerProtocol) IsValid() bool { + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProtocolProtocol value +func (v ListenerProtocol) Ptr() *ListenerProtocol { + return &v +} + +type NullableListenerProtocol struct { + value *ListenerProtocol + isSet bool +} + +func (v NullableListenerProtocol) Get() *ListenerProtocol { + return v.value +} + +func (v *NullableListenerProtocol) Set(val *ListenerProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableListenerProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableListenerProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListenerProtocol(val *ListenerProtocol) *NullableListenerProtocol { + return &NullableListenerProtocol{value: val, isSet: true} +} + +func (v NullableListenerProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListenerProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ListenerGetProtocolAttributeType = *ListenerProtocol +type ListenerGetProtocolArgType = ListenerProtocol +type ListenerGetProtocolRetType = ListenerProtocol func getListenerGetProtocolAttributeTypeOk(arg ListenerGetProtocolAttributeType) (ret ListenerGetProtocolRetType, ok bool) { if arg == nil { diff --git a/services/alb/model_load_balancer.go b/services/alb/model_load_balancer.go index 555460bc4..c0fdd77c5 100644 --- a/services/alb/model_load_balancer.go +++ b/services/alb/model_load_balancer.go @@ -12,6 +12,7 @@ package alb import ( "encoding/json" + "fmt" ) // checks if the LoadBalancer type satisfies the MappedNullable interface at compile time @@ -206,10 +207,116 @@ type LoadBalancerGetRegionRetType = string types and functions for status */ -// isEnumRef -type LoadBalancerGetStatusAttributeType = *string -type LoadBalancerGetStatusArgType = string -type LoadBalancerGetStatusRetType = string +//isEnum + +// LoadBalancerStatus the model 'LoadBalancer' +type LoadBalancerStatus string + +// List of Status +const ( + LOADBALANCERSTATUS_UNSPECIFIED LoadBalancerStatus = "STATUS_UNSPECIFIED" + LOADBALANCERSTATUS_PENDING LoadBalancerStatus = "STATUS_PENDING" + LOADBALANCERSTATUS_READY LoadBalancerStatus = "STATUS_READY" + LOADBALANCERSTATUS_ERROR LoadBalancerStatus = "STATUS_ERROR" + LOADBALANCERSTATUS_TERMINATING LoadBalancerStatus = "STATUS_TERMINATING" +) + +// All allowed values of LoadBalancer enum +var AllowedLoadBalancerStatusEnumValues = []LoadBalancerStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *LoadBalancerStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerStatus(value) + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancer", value) +} + +// NewLoadBalancerStatusFromValue returns a pointer to a valid LoadBalancerStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerStatusFromValue(v string) (*LoadBalancerStatus, error) { + ev := LoadBalancerStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerStatus: valid values are %v", v, AllowedLoadBalancerStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerStatus) IsValid() bool { + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v LoadBalancerStatus) Ptr() *LoadBalancerStatus { + return &v +} + +type NullableLoadBalancerStatus struct { + value *LoadBalancerStatus + isSet bool +} + +func (v NullableLoadBalancerStatus) Get() *LoadBalancerStatus { + return v.value +} + +func (v *NullableLoadBalancerStatus) Set(val *LoadBalancerStatus) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerStatus(val *LoadBalancerStatus) *NullableLoadBalancerStatus { + return &NullableLoadBalancerStatus{value: val, isSet: true} +} + +func (v NullableLoadBalancerStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerGetStatusAttributeType = *LoadBalancerStatus +type LoadBalancerGetStatusArgType = LoadBalancerStatus +type LoadBalancerGetStatusRetType = LoadBalancerStatus func getLoadBalancerGetStatusAttributeTypeOk(arg LoadBalancerGetStatusAttributeType) (ret LoadBalancerGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/alb/model_load_balancer_error.go b/services/alb/model_load_balancer_error.go index 290a5bb1b..bbad76227 100644 --- a/services/alb/model_load_balancer_error.go +++ b/services/alb/model_load_balancer_error.go @@ -12,6 +12,7 @@ package alb import ( "encoding/json" + "fmt" ) // checks if the LoadBalancerError type satisfies the MappedNullable interface at compile time @@ -42,10 +43,124 @@ type LoadBalancerErrorGetDescriptionRetType = string types and functions for type */ -// isEnumRef -type LoadBalancerErrorGetTypeAttributeType = *string -type LoadBalancerErrorGetTypeArgType = string -type LoadBalancerErrorGetTypeRetType = string +//isEnum + +// LoadBalancerErrorTypes The error type specifies which part of the application load balancer encountered the error. I.e. the API will not check if a provided public IP is actually available in the project. Instead the application load balancer with try to use the provided IP and if not available reports TYPE_FIP_NOT_CONFIGURED error. +type LoadBalancerErrorTypes string + +// List of Type +const ( + LOADBALANCERERRORTYPE_UNSPECIFIED LoadBalancerErrorTypes = "TYPE_UNSPECIFIED" + LOADBALANCERERRORTYPE_INTERNAL LoadBalancerErrorTypes = "TYPE_INTERNAL" + LOADBALANCERERRORTYPE_QUOTA_SECGROUP_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUP_EXCEEDED" + LOADBALANCERERRORTYPE_QUOTA_SECGROUPRULE_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUPRULE_EXCEEDED" + LOADBALANCERERRORTYPE_PORT_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_PORT_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_FIP_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_FIP_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_TARGET_NOT_ACTIVE LoadBalancerErrorTypes = "TYPE_TARGET_NOT_ACTIVE" + LOADBALANCERERRORTYPE_METRICS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_METRICS_MISCONFIGURED" + LOADBALANCERERRORTYPE_LOGS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_LOGS_MISCONFIGURED" +) + +// All allowed values of LoadBalancerError enum +var AllowedLoadBalancerErrorTypesEnumValues = []LoadBalancerErrorTypes{ + "TYPE_UNSPECIFIED", + "TYPE_INTERNAL", + "TYPE_QUOTA_SECGROUP_EXCEEDED", + "TYPE_QUOTA_SECGROUPRULE_EXCEEDED", + "TYPE_PORT_NOT_CONFIGURED", + "TYPE_FIP_NOT_CONFIGURED", + "TYPE_TARGET_NOT_ACTIVE", + "TYPE_METRICS_MISCONFIGURED", + "TYPE_LOGS_MISCONFIGURED", +} + +func (v *LoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerErrorTypes(value) + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancerError", value) +} + +// NewLoadBalancerErrorTypesFromValue returns a pointer to a valid LoadBalancerErrorTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerErrorTypesFromValue(v string) (*LoadBalancerErrorTypes, error) { + ev := LoadBalancerErrorTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerErrorTypes: valid values are %v", v, AllowedLoadBalancerErrorTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerErrorTypes) IsValid() bool { + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v LoadBalancerErrorTypes) Ptr() *LoadBalancerErrorTypes { + return &v +} + +type NullableLoadBalancerErrorTypes struct { + value *LoadBalancerErrorTypes + isSet bool +} + +func (v NullableLoadBalancerErrorTypes) Get() *LoadBalancerErrorTypes { + return v.value +} + +func (v *NullableLoadBalancerErrorTypes) Set(val *LoadBalancerErrorTypes) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerErrorTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerErrorTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerErrorTypes(val *LoadBalancerErrorTypes) *NullableLoadBalancerErrorTypes { + return &NullableLoadBalancerErrorTypes{value: val, isSet: true} +} + +func (v NullableLoadBalancerErrorTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerErrorGetTypeAttributeType = *LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeArgType = LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeRetType = LoadBalancerErrorTypes func getLoadBalancerErrorGetTypeAttributeTypeOk(arg LoadBalancerErrorGetTypeAttributeType) (ret LoadBalancerErrorGetTypeRetType, ok bool) { if arg == nil { diff --git a/services/alb/model_network.go b/services/alb/model_network.go index c65c5e474..20a841532 100644 --- a/services/alb/model_network.go +++ b/services/alb/model_network.go @@ -12,6 +12,7 @@ package alb import ( "encoding/json" + "fmt" ) // checks if the Network type satisfies the MappedNullable interface at compile time @@ -42,10 +43,114 @@ type NetworkGetNetworkIdRetType = string types and functions for role */ -// isEnumRef -type NetworkGetRoleAttributeType = *string -type NetworkGetRoleArgType = string -type NetworkGetRoleRetType = string +//isEnum + +// NetworkRole The role defines how the Application Load Balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported. +type NetworkRole string + +// List of Role +const ( + NETWORKROLE_UNSPECIFIED NetworkRole = "ROLE_UNSPECIFIED" + NETWORKROLE_LISTENERS_AND_TARGETS NetworkRole = "ROLE_LISTENERS_AND_TARGETS" + NETWORKROLE_LISTENERS NetworkRole = "ROLE_LISTENERS" + NETWORKROLE_TARGETS NetworkRole = "ROLE_TARGETS" +) + +// All allowed values of Network enum +var AllowedNetworkRoleEnumValues = []NetworkRole{ + "ROLE_UNSPECIFIED", + "ROLE_LISTENERS_AND_TARGETS", + "ROLE_LISTENERS", + "ROLE_TARGETS", +} + +func (v *NetworkRole) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := NetworkRole(value) + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Network", value) +} + +// NewNetworkRoleFromValue returns a pointer to a valid NetworkRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewNetworkRoleFromValue(v string) (*NetworkRole, error) { + ev := NetworkRole(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for NetworkRole: valid values are %v", v, AllowedNetworkRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v NetworkRole) IsValid() bool { + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RoleRole value +func (v NetworkRole) Ptr() *NetworkRole { + return &v +} + +type NullableNetworkRole struct { + value *NetworkRole + isSet bool +} + +func (v NullableNetworkRole) Get() *NetworkRole { + return v.value +} + +func (v *NullableNetworkRole) Set(val *NetworkRole) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRole) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRole(val *NetworkRole) *NullableNetworkRole { + return &NullableNetworkRole{value: val, isSet: true} +} + +func (v NullableNetworkRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NetworkGetRoleAttributeType = *NetworkRole +type NetworkGetRoleArgType = NetworkRole +type NetworkGetRoleRetType = NetworkRole func getNetworkGetRoleAttributeTypeOk(arg NetworkGetRoleAttributeType) (ret NetworkGetRoleRetType, ok bool) { if arg == nil { diff --git a/services/alb/model_update_load_balancer_payload.go b/services/alb/model_update_load_balancer_payload.go index 6fe7df7d4..3ca3af625 100644 --- a/services/alb/model_update_load_balancer_payload.go +++ b/services/alb/model_update_load_balancer_payload.go @@ -12,6 +12,7 @@ package alb import ( "encoding/json" + "fmt" ) // checks if the UpdateLoadBalancerPayload type satisfies the MappedNullable interface at compile time @@ -206,10 +207,116 @@ type UpdateLoadBalancerPayloadGetRegionRetType = string types and functions for status */ -// isEnumRef -type UpdateLoadBalancerPayloadGetStatusAttributeType = *string -type UpdateLoadBalancerPayloadGetStatusArgType = string -type UpdateLoadBalancerPayloadGetStatusRetType = string +//isEnum + +// UpdateLoadBalancerPayloadStatus the model 'UpdateLoadBalancerPayload' +type UpdateLoadBalancerPayloadStatus string + +// List of Status +const ( + UPDATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED UpdateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + UPDATELOADBALANCERPAYLOADSTATUS_PENDING UpdateLoadBalancerPayloadStatus = "STATUS_PENDING" + UPDATELOADBALANCERPAYLOADSTATUS_READY UpdateLoadBalancerPayloadStatus = "STATUS_READY" + UPDATELOADBALANCERPAYLOADSTATUS_ERROR UpdateLoadBalancerPayloadStatus = "STATUS_ERROR" + UPDATELOADBALANCERPAYLOADSTATUS_TERMINATING UpdateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of UpdateLoadBalancerPayload enum +var AllowedUpdateLoadBalancerPayloadStatusEnumValues = []UpdateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *UpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := UpdateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UpdateLoadBalancerPayload", value) +} + +// NewUpdateLoadBalancerPayloadStatusFromValue returns a pointer to a valid UpdateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateLoadBalancerPayloadStatusFromValue(v string) (*UpdateLoadBalancerPayloadStatus, error) { + ev := UpdateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateLoadBalancerPayloadStatus: valid values are %v", v, AllowedUpdateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v UpdateLoadBalancerPayloadStatus) Ptr() *UpdateLoadBalancerPayloadStatus { + return &v +} + +type NullableUpdateLoadBalancerPayloadStatus struct { + value *UpdateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableUpdateLoadBalancerPayloadStatus) Get() *UpdateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Set(val *UpdateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLoadBalancerPayloadStatus(val *UpdateLoadBalancerPayloadStatus) *NullableUpdateLoadBalancerPayloadStatus { + return &NullableUpdateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableUpdateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type UpdateLoadBalancerPayloadGetStatusAttributeType = *UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusArgType = UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusRetType = UpdateLoadBalancerPayloadStatus func getUpdateLoadBalancerPayloadGetStatusAttributeTypeOk(arg UpdateLoadBalancerPayloadGetStatusAttributeType) (ret UpdateLoadBalancerPayloadGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/alb/wait/wait.go b/services/alb/wait/wait.go index f46162d0d..79a67c69a 100644 --- a/services/alb/wait/wait.go +++ b/services/alb/wait/wait.go @@ -13,10 +13,15 @@ import ( ) const ( + // Deprecated: StatusUnspecified is deprecated and will be removed after 14th November 2025. Use [alb.LOADBALANCERSTATUS_UNSPECIFIED] instead. StatusUnspecified = "STATUS_UNSPECIFIED" - StatusPending = "STATUS_PENDING" - StatusReady = "STATUS_READY" - StatusError = "STATUS_ERROR" + // Deprecated: StatusPending is deprecated and will be removed after 14th November 2025. Use [alb.LOADBALANCERSTATUS_PENDING] instead. + StatusPending = "STATUS_PENDING" + // Deprecated: StatusReady is deprecated and will be removed after 14th November 2025. Use [alb.LOADBALANCERSTATUS_READY] instead. + StatusReady = "STATUS_READY" + // Deprecated: StatusError is deprecated and will be removed after 14th November 2025. Use [alb.LOADBALANCERSTATUS_ERROR] instead. + StatusError = "STATUS_ERROR" + // Deprecated: StatusTerminating is deprecated and will be removed after 14th November 2025. Use [alb.LOADBALANCERSTATUS_TERMINATING] instead. StatusTerminating = "STATUS_TERMINATING" ) @@ -32,11 +37,11 @@ func CreateOrUpdateLoadbalancerWaitHandler(ctx context.Context, client APIClient } if response.HasStatus() { switch *response.Status { - case StatusPending: + case alb.LOADBALANCERSTATUS_PENDING: return false, nil, nil - case StatusUnspecified: + case alb.LOADBALANCERSTATUS_UNSPECIFIED: return false, nil, nil - case StatusError: + case alb.LOADBALANCERSTATUS_ERROR: return true, response, fmt.Errorf("loadbalancer in error: %s", *response.Status) default: return true, response, nil diff --git a/services/alb/wait/wait_test.go b/services/alb/wait/wait_test.go index ae918aa35..bc2e12f90 100644 --- a/services/alb/wait/wait_test.go +++ b/services/alb/wait/wait_test.go @@ -50,37 +50,37 @@ func TestCreateOrUpdateLoadbalancerWaitHandler(t *testing.T) { { "create succeeded immediately", []response{ - {&alb.LoadBalancer{Status: alb.PtrString(StatusReady)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_READY)}, nil}, }, - &alb.LoadBalancer{Status: utils.Ptr(StatusReady)}, + &alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_READY)}, false, }, { "create succeeded delayed", []response{ - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: alb.PtrString(StatusReady)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_READY)}, nil}, }, - &alb.LoadBalancer{Status: utils.Ptr(StatusReady)}, + &alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_READY)}, false, }, { "create failed delayed", []response{ - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: alb.PtrString(StatusError)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_ERROR)}, nil}, }, - &alb.LoadBalancer{Status: utils.Ptr(StatusError)}, + &alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_ERROR)}, true, }, { "timeout", []response{ - {&alb.LoadBalancer{Status: alb.PtrString(StatusPending)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, }, nil, true, @@ -88,9 +88,9 @@ func TestCreateOrUpdateLoadbalancerWaitHandler(t *testing.T) { { "broken state", []response{ - {&alb.LoadBalancer{Status: alb.PtrString("bogus")}, nil}, + {&alb.LoadBalancer{Status: alb.LoadBalancerGetStatusAttributeType(utils.Ptr("bogus"))}, nil}, }, - &alb.LoadBalancer{Status: alb.PtrString("bogus")}, + &alb.LoadBalancer{Status: alb.LoadBalancerGetStatusAttributeType(utils.Ptr("bogus"))}, false, }, // no special update tests needed as the states are the same @@ -133,9 +133,9 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) { { "Delete with '404' delayed", []response{ - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, {nil, oapierror.NewError(http.StatusNotFound, "not found")}, }, false, @@ -150,9 +150,9 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) { { "Delete with 'gone' delayed", []response{ - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, {nil, oapierror.NewError(http.StatusGone, "not found")}, }, false, @@ -160,20 +160,20 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) { { "Delete with error delayed", []response{ - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(string(StatusError))}, oapierror.NewError(http.StatusInternalServerError, "kapow")}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_ERROR)}, oapierror.NewError(http.StatusInternalServerError, "kapow")}, }, true, }, { "Cannot delete", []response{ - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(StatusPending)}, nil}, - {&alb.LoadBalancer{Status: utils.Ptr(string(StatusError))}, oapierror.NewError(http.StatusOK, "ok")}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_PENDING)}, nil}, + {&alb.LoadBalancer{Status: utils.Ptr(alb.LOADBALANCERSTATUS_ERROR)}, oapierror.NewError(http.StatusOK, "ok")}, }, true, }, diff --git a/services/cdn/CHANGELOG.md b/services/cdn/CHANGELOG.md index 6622ef9b0..a5148a447 100644 --- a/services/cdn/CHANGELOG.md +++ b/services/cdn/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.0.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/cdn/model_distribution.go b/services/cdn/model_distribution.go index dab9fb9d4..c91b9b881 100644 --- a/services/cdn/model_distribution.go +++ b/services/cdn/model_distribution.go @@ -12,6 +12,7 @@ package cdn import ( "encoding/json" + "fmt" "time" ) @@ -144,10 +145,116 @@ type DistributionGetProjectIdRetType = string types and functions for status */ -// isEnumRef -type DistributionGetStatusAttributeType = *string -type DistributionGetStatusArgType = string -type DistributionGetStatusRetType = string +//isEnum + +// DistributionStatus - `CREATING`: The distribution was just created. All the relevant resources are created in the background. Once fully reconciled, this switches to `ACTIVE`. If there are any issues, the status changes to `ERROR`. You can look at the `errors` array to get more infos. - `ACTIVE`: The usual state. The desired configuration is synced, there are no errors - `UPDATING`: The state when there is a discrepancy between the desired and actual configuration state. This occurs right after an update. Will switch to `ACTIVE` or `ERROR`, depending on if synchronizing succeeds or not. - `DELETING`: The state right after a delete request was received. The distribution will stay in this status until all resources have been successfully removed, or until we encounter an `ERROR` state. **NOTE:** You can keep fetching the distribution while it is deleting. After successful deletion, trying to get a distribution will return a 404 Not Found response - `ERROR`: The error state. Look at the `errors` array for more info. +type DistributionStatus string + +// List of Status +const ( + DISTRIBUTIONSTATUS_CREATING DistributionStatus = "CREATING" + DISTRIBUTIONSTATUS_ACTIVE DistributionStatus = "ACTIVE" + DISTRIBUTIONSTATUS_UPDATING DistributionStatus = "UPDATING" + DISTRIBUTIONSTATUS_DELETING DistributionStatus = "DELETING" + DISTRIBUTIONSTATUS_ERROR DistributionStatus = "ERROR" +) + +// All allowed values of Distribution enum +var AllowedDistributionStatusEnumValues = []DistributionStatus{ + "CREATING", + "ACTIVE", + "UPDATING", + "DELETING", + "ERROR", +} + +func (v *DistributionStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := DistributionStatus(value) + for _, existing := range AllowedDistributionStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Distribution", value) +} + +// NewDistributionStatusFromValue returns a pointer to a valid DistributionStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDistributionStatusFromValue(v string) (*DistributionStatus, error) { + ev := DistributionStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DistributionStatus: valid values are %v", v, AllowedDistributionStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DistributionStatus) IsValid() bool { + for _, existing := range AllowedDistributionStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v DistributionStatus) Ptr() *DistributionStatus { + return &v +} + +type NullableDistributionStatus struct { + value *DistributionStatus + isSet bool +} + +func (v NullableDistributionStatus) Get() *DistributionStatus { + return v.value +} + +func (v *NullableDistributionStatus) Set(val *DistributionStatus) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatus(val *DistributionStatus) *NullableDistributionStatus { + return &NullableDistributionStatus{value: val, isSet: true} +} + +func (v NullableDistributionStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type DistributionGetStatusAttributeType = *DistributionStatus +type DistributionGetStatusArgType = DistributionStatus +type DistributionGetStatusRetType = DistributionStatus func getDistributionGetStatusAttributeTypeOk(arg DistributionGetStatusAttributeType) (ret DistributionGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/cdn/model_domain.go b/services/cdn/model_domain.go index 12db9fc7b..f29745537 100644 --- a/services/cdn/model_domain.go +++ b/services/cdn/model_domain.go @@ -12,6 +12,7 @@ package cdn import ( "encoding/json" + "fmt" ) // checks if the Domain type satisfies the MappedNullable interface at compile time @@ -82,10 +83,110 @@ func setDomainGetStatusAttributeType(arg *DomainGetStatusAttributeType, val Doma types and functions for type */ -// isEnumRef -type DomainGetTypeAttributeType = *string -type DomainGetTypeArgType = string -type DomainGetTypeRetType = string +//isEnum + +// DomainTypes Specifies the type of this Domain. Custom Domain can be further queries using the GetCustomDomain Endpoint +type DomainTypes string + +// List of Type +const ( + DOMAINTYPE_MANAGED DomainTypes = "managed" + DOMAINTYPE_CUSTOM DomainTypes = "custom" +) + +// All allowed values of Domain enum +var AllowedDomainTypesEnumValues = []DomainTypes{ + "managed", + "custom", +} + +func (v *DomainTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := DomainTypes(value) + for _, existing := range AllowedDomainTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Domain", value) +} + +// NewDomainTypesFromValue returns a pointer to a valid DomainTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDomainTypesFromValue(v string) (*DomainTypes, error) { + ev := DomainTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DomainTypes: valid values are %v", v, AllowedDomainTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DomainTypes) IsValid() bool { + for _, existing := range AllowedDomainTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v DomainTypes) Ptr() *DomainTypes { + return &v +} + +type NullableDomainTypes struct { + value *DomainTypes + isSet bool +} + +func (v NullableDomainTypes) Get() *DomainTypes { + return v.value +} + +func (v *NullableDomainTypes) Set(val *DomainTypes) { + v.value = val + v.isSet = true +} + +func (v NullableDomainTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableDomainTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDomainTypes(val *DomainTypes) *NullableDomainTypes { + return &NullableDomainTypes{value: val, isSet: true} +} + +func (v NullableDomainTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDomainTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type DomainGetTypeAttributeType = *DomainTypes +type DomainGetTypeArgType = DomainTypes +type DomainGetTypeRetType = DomainTypes func getDomainGetTypeAttributeTypeOk(arg DomainGetTypeAttributeType) (ret DomainGetTypeRetType, ok bool) { if arg == nil { @@ -118,11 +219,11 @@ type _Domain Domain // 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 NewDomain(name DomainGetNameArgType, status DomainGetStatusArgType, type_ DomainGetTypeArgType) *Domain { +func NewDomain(name DomainGetNameArgType, status DomainGetStatusArgType, types DomainGetTypeArgType) *Domain { this := Domain{} setDomainGetNameAttributeType(&this.Name, name) setDomainGetStatusAttributeType(&this.Status, status) - setDomainGetTypeAttributeType(&this.Type, type_) + setDomainGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/cdn/model_error_details.go b/services/cdn/model_error_details.go index 1fcfb8dea..453595810 100644 --- a/services/cdn/model_error_details.go +++ b/services/cdn/model_error_details.go @@ -12,6 +12,7 @@ package cdn import ( "encoding/json" + "fmt" ) // checks if the ErrorDetails type satisfies the MappedNullable interface at compile time @@ -105,10 +106,112 @@ type ErrorDetailsGetFieldRetType = string types and functions for key */ -// isEnumRef -type ErrorDetailsGetKeyAttributeType = *string -type ErrorDetailsGetKeyArgType = string -type ErrorDetailsGetKeyRetType = string +//isEnum + +// ErrorDetailsKey the model 'ErrorDetails' +type ErrorDetailsKey string + +// List of Key +const ( + ERRORDETAILSKEY_UNKNOWN ErrorDetailsKey = "UNKNOWN" + ERRORDETAILSKEY_CUSTOM_DOMAIN_CNAME_MISSING ErrorDetailsKey = "CUSTOM_DOMAIN_CNAME_MISSING" + ERRORDETAILSKEY_INVALID_ARGUMENT ErrorDetailsKey = "INVALID_ARGUMENT" +) + +// All allowed values of ErrorDetails enum +var AllowedErrorDetailsKeyEnumValues = []ErrorDetailsKey{ + "UNKNOWN", + "CUSTOM_DOMAIN_CNAME_MISSING", + "INVALID_ARGUMENT", +} + +func (v *ErrorDetailsKey) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ErrorDetailsKey(value) + for _, existing := range AllowedErrorDetailsKeyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ErrorDetails", value) +} + +// NewErrorDetailsKeyFromValue returns a pointer to a valid ErrorDetailsKey +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewErrorDetailsKeyFromValue(v string) (*ErrorDetailsKey, error) { + ev := ErrorDetailsKey(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ErrorDetailsKey: valid values are %v", v, AllowedErrorDetailsKeyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ErrorDetailsKey) IsValid() bool { + for _, existing := range AllowedErrorDetailsKeyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyKey value +func (v ErrorDetailsKey) Ptr() *ErrorDetailsKey { + return &v +} + +type NullableErrorDetailsKey struct { + value *ErrorDetailsKey + isSet bool +} + +func (v NullableErrorDetailsKey) Get() *ErrorDetailsKey { + return v.value +} + +func (v *NullableErrorDetailsKey) Set(val *ErrorDetailsKey) { + v.value = val + v.isSet = true +} + +func (v NullableErrorDetailsKey) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorDetailsKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorDetailsKey(val *ErrorDetailsKey) *NullableErrorDetailsKey { + return &NullableErrorDetailsKey{value: val, isSet: true} +} + +func (v NullableErrorDetailsKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorDetailsKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ErrorDetailsGetKeyAttributeType = *ErrorDetailsKey +type ErrorDetailsGetKeyArgType = ErrorDetailsKey +type ErrorDetailsGetKeyRetType = ErrorDetailsKey func getErrorDetailsGetKeyAttributeTypeOk(arg ErrorDetailsGetKeyAttributeType) (ret ErrorDetailsGetKeyRetType, ok bool) { if arg == nil { diff --git a/services/cdn/model_get_cache_info_response_history_entry.go b/services/cdn/model_get_cache_info_response_history_entry.go index f3782c424..423b3debe 100644 --- a/services/cdn/model_get_cache_info_response_history_entry.go +++ b/services/cdn/model_get_cache_info_response_history_entry.go @@ -12,6 +12,7 @@ package cdn import ( "encoding/json" + "fmt" "time" ) @@ -62,10 +63,110 @@ func setGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType(arg *GetCache types and functions for type */ -// isEnumRef -type GetCacheInfoResponseHistoryEntryGetTypeAttributeType = *string -type GetCacheInfoResponseHistoryEntryGetTypeArgType = string -type GetCacheInfoResponseHistoryEntryGetTypeRetType = string +//isEnum + +// GetCacheInfoResponseHistoryEntryTypes the model 'GetCacheInfoResponseHistoryEntry' +type GetCacheInfoResponseHistoryEntryTypes string + +// List of Type +const ( + GETCACHEINFORESPONSEHISTORYENTRYTYPE_FULL GetCacheInfoResponseHistoryEntryTypes = "full" + GETCACHEINFORESPONSEHISTORYENTRYTYPE_GRANULAR GetCacheInfoResponseHistoryEntryTypes = "granular" +) + +// All allowed values of GetCacheInfoResponseHistoryEntry enum +var AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues = []GetCacheInfoResponseHistoryEntryTypes{ + "full", + "granular", +} + +func (v *GetCacheInfoResponseHistoryEntryTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetCacheInfoResponseHistoryEntryTypes(value) + for _, existing := range AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetCacheInfoResponseHistoryEntry", value) +} + +// NewGetCacheInfoResponseHistoryEntryTypesFromValue returns a pointer to a valid GetCacheInfoResponseHistoryEntryTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetCacheInfoResponseHistoryEntryTypesFromValue(v string) (*GetCacheInfoResponseHistoryEntryTypes, error) { + ev := GetCacheInfoResponseHistoryEntryTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetCacheInfoResponseHistoryEntryTypes: valid values are %v", v, AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetCacheInfoResponseHistoryEntryTypes) IsValid() bool { + for _, existing := range AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v GetCacheInfoResponseHistoryEntryTypes) Ptr() *GetCacheInfoResponseHistoryEntryTypes { + return &v +} + +type NullableGetCacheInfoResponseHistoryEntryTypes struct { + value *GetCacheInfoResponseHistoryEntryTypes + isSet bool +} + +func (v NullableGetCacheInfoResponseHistoryEntryTypes) Get() *GetCacheInfoResponseHistoryEntryTypes { + return v.value +} + +func (v *NullableGetCacheInfoResponseHistoryEntryTypes) Set(val *GetCacheInfoResponseHistoryEntryTypes) { + v.value = val + v.isSet = true +} + +func (v NullableGetCacheInfoResponseHistoryEntryTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCacheInfoResponseHistoryEntryTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCacheInfoResponseHistoryEntryTypes(val *GetCacheInfoResponseHistoryEntryTypes) *NullableGetCacheInfoResponseHistoryEntryTypes { + return &NullableGetCacheInfoResponseHistoryEntryTypes{value: val, isSet: true} +} + +func (v NullableGetCacheInfoResponseHistoryEntryTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCacheInfoResponseHistoryEntryTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetCacheInfoResponseHistoryEntryGetTypeAttributeType = *GetCacheInfoResponseHistoryEntryTypes +type GetCacheInfoResponseHistoryEntryGetTypeArgType = GetCacheInfoResponseHistoryEntryTypes +type GetCacheInfoResponseHistoryEntryGetTypeRetType = GetCacheInfoResponseHistoryEntryTypes func getGetCacheInfoResponseHistoryEntryGetTypeAttributeTypeOk(arg GetCacheInfoResponseHistoryEntryGetTypeAttributeType) (ret GetCacheInfoResponseHistoryEntryGetTypeRetType, ok bool) { if arg == nil { @@ -95,11 +196,11 @@ type _GetCacheInfoResponseHistoryEntry GetCacheInfoResponseHistoryEntry // 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 NewGetCacheInfoResponseHistoryEntry(occuredAt GetCacheInfoResponseHistoryEntryGetOccuredAtArgType, occurredAt GetCacheInfoResponseHistoryEntryGetOccurredAtArgType, type_ GetCacheInfoResponseHistoryEntryGetTypeArgType) *GetCacheInfoResponseHistoryEntry { +func NewGetCacheInfoResponseHistoryEntry(occuredAt GetCacheInfoResponseHistoryEntryGetOccuredAtArgType, occurredAt GetCacheInfoResponseHistoryEntryGetOccurredAtArgType, types GetCacheInfoResponseHistoryEntryGetTypeArgType) *GetCacheInfoResponseHistoryEntry { this := GetCacheInfoResponseHistoryEntry{} setGetCacheInfoResponseHistoryEntryGetOccuredAtAttributeType(&this.OccuredAt, occuredAt) setGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType(&this.OccurredAt, occurredAt) - setGetCacheInfoResponseHistoryEntryGetTypeAttributeType(&this.Type, type_) + setGetCacheInfoResponseHistoryEntryGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/cdn/model_http_backend.go b/services/cdn/model_http_backend.go index 1df8aec85..b94cbfeac 100644 --- a/services/cdn/model_http_backend.go +++ b/services/cdn/model_http_backend.go @@ -96,11 +96,11 @@ type _HttpBackend HttpBackend // 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 NewHttpBackend(originRequestHeaders HttpBackendGetOriginRequestHeadersArgType, originUrl HttpBackendGetOriginUrlArgType, type_ HttpBackendGetTypeArgType) *HttpBackend { +func NewHttpBackend(originRequestHeaders HttpBackendGetOriginRequestHeadersArgType, originUrl HttpBackendGetOriginUrlArgType, types HttpBackendGetTypeArgType) *HttpBackend { this := HttpBackend{} setHttpBackendGetOriginRequestHeadersAttributeType(&this.OriginRequestHeaders, originRequestHeaders) setHttpBackendGetOriginUrlAttributeType(&this.OriginUrl, originUrl) - setHttpBackendGetTypeAttributeType(&this.Type, type_) + setHttpBackendGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/cdn/model_http_backend_patch.go b/services/cdn/model_http_backend_patch.go index 82fd341bd..4302f8e5e 100644 --- a/services/cdn/model_http_backend_patch.go +++ b/services/cdn/model_http_backend_patch.go @@ -95,9 +95,9 @@ type _HttpBackendPatch HttpBackendPatch // 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 NewHttpBackendPatch(type_ HttpBackendPatchGetTypeArgType) *HttpBackendPatch { +func NewHttpBackendPatch(types HttpBackendPatchGetTypeArgType) *HttpBackendPatch { this := HttpBackendPatch{} - setHttpBackendPatchGetTypeAttributeType(&this.Type, type_) + setHttpBackendPatchGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/cdn/model_status_error.go b/services/cdn/model_status_error.go index fa013e13d..7caf276e6 100644 --- a/services/cdn/model_status_error.go +++ b/services/cdn/model_status_error.go @@ -12,6 +12,7 @@ package cdn import ( "encoding/json" + "fmt" ) // checks if the StatusError type satisfies the MappedNullable interface at compile time @@ -63,10 +64,114 @@ type StatusErrorGetEnRetType = string types and functions for key */ -// isEnumRef -type StatusErrorGetKeyAttributeType = *string -type StatusErrorGetKeyArgType = string -type StatusErrorGetKeyRetType = string +//isEnum + +// StatusErrorKey An enum value that describes a Status Error. +type StatusErrorKey string + +// List of Key +const ( + STATUSERRORKEY_UNKNOWN StatusErrorKey = "UNKNOWN" + STATUSERRORKEY_CUSTOM_DOMAIN_CNAME_MISSING StatusErrorKey = "CUSTOM_DOMAIN_CNAME_MISSING" + STATUSERRORKEY_CUSTOM_DOMAIN_ALREADY_IN_USE StatusErrorKey = "CUSTOM_DOMAIN_ALREADY_IN_USE" + STATUSERRORKEY_PUBLIC_BETA_QUOTA_REACHED StatusErrorKey = "PUBLIC_BETA_QUOTA_REACHED" +) + +// All allowed values of StatusError enum +var AllowedStatusErrorKeyEnumValues = []StatusErrorKey{ + "UNKNOWN", + "CUSTOM_DOMAIN_CNAME_MISSING", + "CUSTOM_DOMAIN_ALREADY_IN_USE", + "PUBLIC_BETA_QUOTA_REACHED", +} + +func (v *StatusErrorKey) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := StatusErrorKey(value) + for _, existing := range AllowedStatusErrorKeyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid StatusError", value) +} + +// NewStatusErrorKeyFromValue returns a pointer to a valid StatusErrorKey +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStatusErrorKeyFromValue(v string) (*StatusErrorKey, error) { + ev := StatusErrorKey(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for StatusErrorKey: valid values are %v", v, AllowedStatusErrorKeyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v StatusErrorKey) IsValid() bool { + for _, existing := range AllowedStatusErrorKeyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyKey value +func (v StatusErrorKey) Ptr() *StatusErrorKey { + return &v +} + +type NullableStatusErrorKey struct { + value *StatusErrorKey + isSet bool +} + +func (v NullableStatusErrorKey) Get() *StatusErrorKey { + return v.value +} + +func (v *NullableStatusErrorKey) Set(val *StatusErrorKey) { + v.value = val + v.isSet = true +} + +func (v NullableStatusErrorKey) IsSet() bool { + return v.isSet +} + +func (v *NullableStatusErrorKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatusErrorKey(val *StatusErrorKey) *NullableStatusErrorKey { + return &NullableStatusErrorKey{value: val, isSet: true} +} + +func (v NullableStatusErrorKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatusErrorKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type StatusErrorGetKeyAttributeType = *StatusErrorKey +type StatusErrorGetKeyArgType = StatusErrorKey +type StatusErrorGetKeyRetType = StatusErrorKey func getStatusErrorGetKeyAttributeTypeOk(arg StatusErrorGetKeyAttributeType) (ret StatusErrorGetKeyRetType, ok bool) { if arg == nil { diff --git a/services/cdn/wait/wait.go b/services/cdn/wait/wait.go index 89b507c67..c79cbd1d9 100644 --- a/services/cdn/wait/wait.go +++ b/services/cdn/wait/wait.go @@ -13,11 +13,16 @@ import ( ) const ( + // Deprecated: DistributionStatusCreating is deprecated and will be removed after 14th November 2025. Use [cdn.DISTRIBUTIONSTATUS_CREATING] instead. DistributionStatusCreating = "CREATING" - DistributionStatusActive = "ACTIVE" + // Deprecated: DistributionStatusActive is deprecated and will be removed after 14th November 2025. Use [cdn.DISTRIBUTIONSTATUS_ACTIVE] instead. + DistributionStatusActive = "ACTIVE" + // Deprecated: DistributionStatusUpdating is deprecated and will be removed after 14th November 2025. Use [cdn.DISTRIBUTIONSTATUS_UPDATING] instead. DistributionStatusUpdating = "UPDATING" + // Deprecated: DistributionStatusDeleting is deprecated and will be removed after 14th November 2025. Use [cdn.DISTRIBUTIONSTATUS_DELETING] instead. DistributionStatusDeleting = "DELETING" - DistributionStatusError = "ERROR" + // Deprecated: DistributionStatusError is deprecated and will be removed after 14th November 2025. Use [cdn.DISTRIBUTIONSTATUS_ERROR] instead. + DistributionStatusError = "ERROR" ) // Interfaces needed for tests @@ -40,13 +45,13 @@ func CreateDistributionPoolWaitHandler(ctx context.Context, api APIClientInterfa } if *distribution.Distribution.Id == distributionId { switch *distribution.Distribution.Status { - case DistributionStatusActive: + case cdn.DISTRIBUTIONSTATUS_ACTIVE: return true, distribution, nil - case DistributionStatusCreating, DistributionStatusUpdating: + case cdn.DISTRIBUTIONSTATUS_CREATING, cdn.DISTRIBUTIONSTATUS_UPDATING: return false, nil, nil - case DistributionStatusDeleting: + case cdn.DISTRIBUTIONSTATUS_DELETING: return true, nil, fmt.Errorf("creating CDN distribution failed") - case DistributionStatusError: + case cdn.DISTRIBUTIONSTATUS_ERROR: return true, nil, fmt.Errorf("creating CDN distribution failed") default: return true, nil, fmt.Errorf("CDNDistributionWaitHandler: unexpected status %s", *distribution.Distribution.Status) @@ -72,13 +77,13 @@ func UpdateDistributionWaitHandler(ctx context.Context, api APIClientInterface, } if *distribution.Distribution.Id == distributionId { switch *distribution.Distribution.Status { - case DistributionStatusActive: + case cdn.DISTRIBUTIONSTATUS_ACTIVE: return true, distribution, err - case DistributionStatusUpdating: + case cdn.DISTRIBUTIONSTATUS_UPDATING: return false, nil, nil - case DistributionStatusDeleting: + case cdn.DISTRIBUTIONSTATUS_DELETING: return true, nil, fmt.Errorf("updating CDN distribution failed") - case DistributionStatusError: + case cdn.DISTRIBUTIONSTATUS_ERROR: return true, nil, fmt.Errorf("updating CDN distribution failed") default: return true, nil, fmt.Errorf("UpdateDistributionWaitHandler: unexpected status %s", *distribution.Distribution.Status) diff --git a/services/cdn/wait/wait_test.go b/services/cdn/wait/wait_test.go index 3ad67f78a..2b51c7b24 100644 --- a/services/cdn/wait/wait_test.go +++ b/services/cdn/wait/wait_test.go @@ -65,11 +65,11 @@ func (m *mockApiClient) GetCustomDomainExecute(_ context.Context, projectId, dis func TestCreateDistributionWaitHandler(t *testing.T) { projectId := "test-project-id" distributionId := "test-distribution-id" - statusActive := DistributionStatusActive - statusUpdating := DistributionStatusUpdating - statusCreating := DistributionStatusCreating - statusError := DistributionStatusError - statusDeleting := DistributionStatusDeleting + statusActive := cdn.DISTRIBUTIONSTATUS_ACTIVE + statusUpdating := cdn.DISTRIBUTIONSTATUS_UPDATING + statusCreating := cdn.DISTRIBUTIONSTATUS_CREATING + statusError := cdn.DISTRIBUTIONSTATUS_ERROR + statusDeleting := cdn.DISTRIBUTIONSTATUS_DELETING mockClientFixture := func(patches ...func(tc *mockApiClient)) *mockApiClient { client := &mockApiClient{ @@ -180,11 +180,11 @@ func TestCreateDistributionWaitHandler(t *testing.T) { func TestDeleteDistributionWaitHandler(t *testing.T) { projectId := "test-project-id" distributionId := "test-distribution-id" - statusActive := DistributionStatusActive - statusUpdating := DistributionStatusUpdating - statusCreating := DistributionStatusCreating - statusError := DistributionStatusError - statusDeleting := DistributionStatusDeleting + statusActive := cdn.DISTRIBUTIONSTATUS_ACTIVE + statusUpdating := cdn.DISTRIBUTIONSTATUS_UPDATING + statusCreating := cdn.DISTRIBUTIONSTATUS_CREATING + statusError := cdn.DISTRIBUTIONSTATUS_ERROR + statusDeleting := cdn.DISTRIBUTIONSTATUS_DELETING mockClientFixture := func(patches ...func(tc *mockApiClient)) *mockApiClient { client := &mockApiClient{ @@ -310,11 +310,11 @@ func TestDeleteDistributionWaitHandler(t *testing.T) { func TestUpdateDistributionWaitHandler(t *testing.T) { projectId := "test-project-id" distributionId := "test-distribution-id" - statusActive := DistributionStatusActive - statusUpdating := DistributionStatusUpdating - statusCreating := DistributionStatusCreating - statusError := DistributionStatusError - statusDeleting := DistributionStatusDeleting + statusActive := cdn.DISTRIBUTIONSTATUS_ACTIVE + statusUpdating := cdn.DISTRIBUTIONSTATUS_UPDATING + statusCreating := cdn.DISTRIBUTIONSTATUS_CREATING + statusError := cdn.DISTRIBUTIONSTATUS_ERROR + statusDeleting := cdn.DISTRIBUTIONSTATUS_DELETING mockClientFixture := func(patches ...func(tc *mockApiClient)) *mockApiClient { client := &mockApiClient{ diff --git a/services/dns/CHANGELOG.md b/services/dns/CHANGELOG.md index 8cbdc6bf0..ba0d4714f 100644 --- a/services/dns/CHANGELOG.md +++ b/services/dns/CHANGELOG.md @@ -1,4 +1,7 @@ -## v0.13.3 (2025-05-09) +## v0.14.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + +- ## v0.13.3 (2025-05-09) - **Feature:** Update user-agent header ## v0.13.2 (2025-04-29) diff --git a/services/dns/model_create_record_set_payload.go b/services/dns/model_create_record_set_payload.go index d4b7b74a7..f2038fed7 100644 --- a/services/dns/model_create_record_set_payload.go +++ b/services/dns/model_create_record_set_payload.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the CreateRecordSetPayload type satisfies the MappedNullable interface at compile time @@ -103,10 +104,148 @@ func setCreateRecordSetPayloadGetTtlAttributeType(arg *CreateRecordSetPayloadGet types and functions for type */ -// isEnumRef -type CreateRecordSetPayloadGetTypeAttributeType = *string -type CreateRecordSetPayloadGetTypeArgType = string -type CreateRecordSetPayloadGetTypeRetType = string +//isEnum + +// CreateRecordSetPayloadTypes record set type +type CreateRecordSetPayloadTypes string + +// List of Type +const ( + CREATERECORDSETPAYLOADTYPE_A CreateRecordSetPayloadTypes = "A" + CREATERECORDSETPAYLOADTYPE_AAAA CreateRecordSetPayloadTypes = "AAAA" + CREATERECORDSETPAYLOADTYPE_SOA CreateRecordSetPayloadTypes = "SOA" + CREATERECORDSETPAYLOADTYPE_CNAME CreateRecordSetPayloadTypes = "CNAME" + CREATERECORDSETPAYLOADTYPE_NS CreateRecordSetPayloadTypes = "NS" + CREATERECORDSETPAYLOADTYPE_MX CreateRecordSetPayloadTypes = "MX" + CREATERECORDSETPAYLOADTYPE_TXT CreateRecordSetPayloadTypes = "TXT" + CREATERECORDSETPAYLOADTYPE_SRV CreateRecordSetPayloadTypes = "SRV" + CREATERECORDSETPAYLOADTYPE_PTR CreateRecordSetPayloadTypes = "PTR" + CREATERECORDSETPAYLOADTYPE_ALIAS CreateRecordSetPayloadTypes = "ALIAS" + CREATERECORDSETPAYLOADTYPE_DNAME CreateRecordSetPayloadTypes = "DNAME" + CREATERECORDSETPAYLOADTYPE_CAA CreateRecordSetPayloadTypes = "CAA" + CREATERECORDSETPAYLOADTYPE_DNSKEY CreateRecordSetPayloadTypes = "DNSKEY" + CREATERECORDSETPAYLOADTYPE_DS CreateRecordSetPayloadTypes = "DS" + CREATERECORDSETPAYLOADTYPE_LOC CreateRecordSetPayloadTypes = "LOC" + CREATERECORDSETPAYLOADTYPE_NAPTR CreateRecordSetPayloadTypes = "NAPTR" + CREATERECORDSETPAYLOADTYPE_SSHFP CreateRecordSetPayloadTypes = "SSHFP" + CREATERECORDSETPAYLOADTYPE_TLSA CreateRecordSetPayloadTypes = "TLSA" + CREATERECORDSETPAYLOADTYPE_URI CreateRecordSetPayloadTypes = "URI" + CREATERECORDSETPAYLOADTYPE_CERT CreateRecordSetPayloadTypes = "CERT" + CREATERECORDSETPAYLOADTYPE_SVCB CreateRecordSetPayloadTypes = "SVCB" +) + +// All allowed values of CreateRecordSetPayload enum +var AllowedCreateRecordSetPayloadTypesEnumValues = []CreateRecordSetPayloadTypes{ + "A", + "AAAA", + "SOA", + "CNAME", + "NS", + "MX", + "TXT", + "SRV", + "PTR", + "ALIAS", + "DNAME", + "CAA", + "DNSKEY", + "DS", + "LOC", + "NAPTR", + "SSHFP", + "TLSA", + "URI", + "CERT", + "SVCB", +} + +func (v *CreateRecordSetPayloadTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateRecordSetPayloadTypes(value) + for _, existing := range AllowedCreateRecordSetPayloadTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateRecordSetPayload", value) +} + +// NewCreateRecordSetPayloadTypesFromValue returns a pointer to a valid CreateRecordSetPayloadTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateRecordSetPayloadTypesFromValue(v string) (*CreateRecordSetPayloadTypes, error) { + ev := CreateRecordSetPayloadTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateRecordSetPayloadTypes: valid values are %v", v, AllowedCreateRecordSetPayloadTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateRecordSetPayloadTypes) IsValid() bool { + for _, existing := range AllowedCreateRecordSetPayloadTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v CreateRecordSetPayloadTypes) Ptr() *CreateRecordSetPayloadTypes { + return &v +} + +type NullableCreateRecordSetPayloadTypes struct { + value *CreateRecordSetPayloadTypes + isSet bool +} + +func (v NullableCreateRecordSetPayloadTypes) Get() *CreateRecordSetPayloadTypes { + return v.value +} + +func (v *NullableCreateRecordSetPayloadTypes) Set(val *CreateRecordSetPayloadTypes) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRecordSetPayloadTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRecordSetPayloadTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRecordSetPayloadTypes(val *CreateRecordSetPayloadTypes) *NullableCreateRecordSetPayloadTypes { + return &NullableCreateRecordSetPayloadTypes{value: val, isSet: true} +} + +func (v NullableCreateRecordSetPayloadTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRecordSetPayloadTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateRecordSetPayloadGetTypeAttributeType = *CreateRecordSetPayloadTypes +type CreateRecordSetPayloadGetTypeArgType = CreateRecordSetPayloadTypes +type CreateRecordSetPayloadGetTypeRetType = CreateRecordSetPayloadTypes func getCreateRecordSetPayloadGetTypeAttributeTypeOk(arg CreateRecordSetPayloadGetTypeAttributeType) (ret CreateRecordSetPayloadGetTypeRetType, ok bool) { if arg == nil { @@ -143,11 +282,11 @@ type _CreateRecordSetPayload CreateRecordSetPayload // 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 NewCreateRecordSetPayload(name CreateRecordSetPayloadGetNameArgType, records CreateRecordSetPayloadGetRecordsArgType, type_ CreateRecordSetPayloadGetTypeArgType) *CreateRecordSetPayload { +func NewCreateRecordSetPayload(name CreateRecordSetPayloadGetNameArgType, records CreateRecordSetPayloadGetRecordsArgType, types CreateRecordSetPayloadGetTypeArgType) *CreateRecordSetPayload { this := CreateRecordSetPayload{} setCreateRecordSetPayloadGetNameAttributeType(&this.Name, name) setCreateRecordSetPayloadGetRecordsAttributeType(&this.Records, records) - setCreateRecordSetPayloadGetTypeAttributeType(&this.Type, type_) + setCreateRecordSetPayloadGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/dns/model_create_zone_payload.go b/services/dns/model_create_zone_payload.go index 12c17bc22..af78be045 100644 --- a/services/dns/model_create_zone_payload.go +++ b/services/dns/model_create_zone_payload.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the CreateZonePayload type satisfies the MappedNullable interface at compile time @@ -286,10 +287,110 @@ func setCreateZonePayloadGetRetryTimeAttributeType(arg *CreateZonePayloadGetRetr types and functions for type */ -// isEnumRef -type CreateZonePayloadGetTypeAttributeType = *string -type CreateZonePayloadGetTypeArgType = string -type CreateZonePayloadGetTypeRetType = string +//isEnum + +// CreateZonePayloadTypes zone type +type CreateZonePayloadTypes string + +// List of Type +const ( + CREATEZONEPAYLOADTYPE_PRIMARY CreateZonePayloadTypes = "primary" + CREATEZONEPAYLOADTYPE_SECONDARY CreateZonePayloadTypes = "secondary" +) + +// All allowed values of CreateZonePayload enum +var AllowedCreateZonePayloadTypesEnumValues = []CreateZonePayloadTypes{ + "primary", + "secondary", +} + +func (v *CreateZonePayloadTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateZonePayloadTypes(value) + for _, existing := range AllowedCreateZonePayloadTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateZonePayload", value) +} + +// NewCreateZonePayloadTypesFromValue returns a pointer to a valid CreateZonePayloadTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateZonePayloadTypesFromValue(v string) (*CreateZonePayloadTypes, error) { + ev := CreateZonePayloadTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateZonePayloadTypes: valid values are %v", v, AllowedCreateZonePayloadTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateZonePayloadTypes) IsValid() bool { + for _, existing := range AllowedCreateZonePayloadTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v CreateZonePayloadTypes) Ptr() *CreateZonePayloadTypes { + return &v +} + +type NullableCreateZonePayloadTypes struct { + value *CreateZonePayloadTypes + isSet bool +} + +func (v NullableCreateZonePayloadTypes) Get() *CreateZonePayloadTypes { + return v.value +} + +func (v *NullableCreateZonePayloadTypes) Set(val *CreateZonePayloadTypes) { + v.value = val + v.isSet = true +} + +func (v NullableCreateZonePayloadTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateZonePayloadTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateZonePayloadTypes(val *CreateZonePayloadTypes) *NullableCreateZonePayloadTypes { + return &NullableCreateZonePayloadTypes{value: val, isSet: true} +} + +func (v NullableCreateZonePayloadTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateZonePayloadTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateZonePayloadGetTypeAttributeType = *CreateZonePayloadTypes +type CreateZonePayloadGetTypeArgType = CreateZonePayloadTypes +type CreateZonePayloadGetTypeRetType = CreateZonePayloadTypes func getCreateZonePayloadGetTypeAttributeTypeOk(arg CreateZonePayloadGetTypeAttributeType) (ret CreateZonePayloadGetTypeRetType, ok bool) { if arg == nil { @@ -372,8 +473,8 @@ func NewCreateZonePayloadWithDefaults() *CreateZonePayload { this.RefreshTime = &refreshTime var retryTime int64 = 600 this.RetryTime = &retryTime - var type_ string = "primary" - this.Type = &type_ + var types CreateZonePayloadTypes = "primary" + this.Type = &types return &this } diff --git a/services/dns/model_export_record_sets_payload.go b/services/dns/model_export_record_sets_payload.go index 730dec4ab..32901d68d 100644 --- a/services/dns/model_export_record_sets_payload.go +++ b/services/dns/model_export_record_sets_payload.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the ExportRecordSetsPayload type satisfies the MappedNullable interface at compile time @@ -41,10 +42,112 @@ func setExportRecordSetsPayloadgetExportAsFQDNAttributeType(arg *ExportRecordSet types and functions for format */ -// isEnumRef -type ExportRecordSetsPayloadGetFormatAttributeType = *string -type ExportRecordSetsPayloadGetFormatArgType = string -type ExportRecordSetsPayloadGetFormatRetType = string +//isEnum + +// ExportRecordSetsPayloadFormat the model 'ExportRecordSetsPayload' +type ExportRecordSetsPayloadFormat string + +// List of Format +const ( + EXPORTRECORDSETSPAYLOADFORMAT_CSV ExportRecordSetsPayloadFormat = "csv" + EXPORTRECORDSETSPAYLOADFORMAT_JSON ExportRecordSetsPayloadFormat = "json" + EXPORTRECORDSETSPAYLOADFORMAT_BIND ExportRecordSetsPayloadFormat = "bind" +) + +// All allowed values of ExportRecordSetsPayload enum +var AllowedExportRecordSetsPayloadFormatEnumValues = []ExportRecordSetsPayloadFormat{ + "csv", + "json", + "bind", +} + +func (v *ExportRecordSetsPayloadFormat) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ExportRecordSetsPayloadFormat(value) + for _, existing := range AllowedExportRecordSetsPayloadFormatEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ExportRecordSetsPayload", value) +} + +// NewExportRecordSetsPayloadFormatFromValue returns a pointer to a valid ExportRecordSetsPayloadFormat +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewExportRecordSetsPayloadFormatFromValue(v string) (*ExportRecordSetsPayloadFormat, error) { + ev := ExportRecordSetsPayloadFormat(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ExportRecordSetsPayloadFormat: valid values are %v", v, AllowedExportRecordSetsPayloadFormatEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ExportRecordSetsPayloadFormat) IsValid() bool { + for _, existing := range AllowedExportRecordSetsPayloadFormatEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FormatFormat value +func (v ExportRecordSetsPayloadFormat) Ptr() *ExportRecordSetsPayloadFormat { + return &v +} + +type NullableExportRecordSetsPayloadFormat struct { + value *ExportRecordSetsPayloadFormat + isSet bool +} + +func (v NullableExportRecordSetsPayloadFormat) Get() *ExportRecordSetsPayloadFormat { + return v.value +} + +func (v *NullableExportRecordSetsPayloadFormat) Set(val *ExportRecordSetsPayloadFormat) { + v.value = val + v.isSet = true +} + +func (v NullableExportRecordSetsPayloadFormat) IsSet() bool { + return v.isSet +} + +func (v *NullableExportRecordSetsPayloadFormat) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExportRecordSetsPayloadFormat(val *ExportRecordSetsPayloadFormat) *NullableExportRecordSetsPayloadFormat { + return &NullableExportRecordSetsPayloadFormat{value: val, isSet: true} +} + +func (v NullableExportRecordSetsPayloadFormat) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExportRecordSetsPayloadFormat) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ExportRecordSetsPayloadGetFormatAttributeType = *ExportRecordSetsPayloadFormat +type ExportRecordSetsPayloadGetFormatArgType = ExportRecordSetsPayloadFormat +type ExportRecordSetsPayloadGetFormatRetType = ExportRecordSetsPayloadFormat func getExportRecordSetsPayloadGetFormatAttributeTypeOk(arg ExportRecordSetsPayloadGetFormatAttributeType) (ret ExportRecordSetsPayloadGetFormatRetType, ok bool) { if arg == nil { @@ -79,7 +182,7 @@ func NewExportRecordSetsPayloadWithDefaults() *ExportRecordSetsPayload { this := ExportRecordSetsPayload{} var exportAsFQDN bool = true this.ExportAsFQDN = &exportAsFQDN - var format string = "csv" + var format ExportRecordSetsPayloadFormat = "csv" this.Format = &format return &this } diff --git a/services/dns/model_partial_update_record_payload.go b/services/dns/model_partial_update_record_payload.go index 69841d311..0fd2cfc32 100644 --- a/services/dns/model_partial_update_record_payload.go +++ b/services/dns/model_partial_update_record_payload.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the PartialUpdateRecordPayload type satisfies the MappedNullable interface at compile time @@ -21,10 +22,110 @@ var _ MappedNullable = &PartialUpdateRecordPayload{} types and functions for action */ -// isEnumRef -type PartialUpdateRecordPayloadGetActionAttributeType = *string -type PartialUpdateRecordPayloadGetActionArgType = string -type PartialUpdateRecordPayloadGetActionRetType = string +//isEnum + +// PartialUpdateRecordPayloadAction the model 'PartialUpdateRecordPayload' +type PartialUpdateRecordPayloadAction string + +// List of Action +const ( + PARTIALUPDATERECORDPAYLOADACTION_ADD PartialUpdateRecordPayloadAction = "add" + PARTIALUPDATERECORDPAYLOADACTION_DELETE PartialUpdateRecordPayloadAction = "delete" +) + +// All allowed values of PartialUpdateRecordPayload enum +var AllowedPartialUpdateRecordPayloadActionEnumValues = []PartialUpdateRecordPayloadAction{ + "add", + "delete", +} + +func (v *PartialUpdateRecordPayloadAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := PartialUpdateRecordPayloadAction(value) + for _, existing := range AllowedPartialUpdateRecordPayloadActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PartialUpdateRecordPayload", value) +} + +// NewPartialUpdateRecordPayloadActionFromValue returns a pointer to a valid PartialUpdateRecordPayloadAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPartialUpdateRecordPayloadActionFromValue(v string) (*PartialUpdateRecordPayloadAction, error) { + ev := PartialUpdateRecordPayloadAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PartialUpdateRecordPayloadAction: valid values are %v", v, AllowedPartialUpdateRecordPayloadActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PartialUpdateRecordPayloadAction) IsValid() bool { + for _, existing := range AllowedPartialUpdateRecordPayloadActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ActionAction value +func (v PartialUpdateRecordPayloadAction) Ptr() *PartialUpdateRecordPayloadAction { + return &v +} + +type NullablePartialUpdateRecordPayloadAction struct { + value *PartialUpdateRecordPayloadAction + isSet bool +} + +func (v NullablePartialUpdateRecordPayloadAction) Get() *PartialUpdateRecordPayloadAction { + return v.value +} + +func (v *NullablePartialUpdateRecordPayloadAction) Set(val *PartialUpdateRecordPayloadAction) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateRecordPayloadAction) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateRecordPayloadAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateRecordPayloadAction(val *PartialUpdateRecordPayloadAction) *NullablePartialUpdateRecordPayloadAction { + return &NullablePartialUpdateRecordPayloadAction{value: val, isSet: true} +} + +func (v NullablePartialUpdateRecordPayloadAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateRecordPayloadAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type PartialUpdateRecordPayloadGetActionAttributeType = *PartialUpdateRecordPayloadAction +type PartialUpdateRecordPayloadGetActionArgType = PartialUpdateRecordPayloadAction +type PartialUpdateRecordPayloadGetActionRetType = PartialUpdateRecordPayloadAction func getPartialUpdateRecordPayloadGetActionAttributeTypeOk(arg PartialUpdateRecordPayloadGetActionAttributeType) (ret PartialUpdateRecordPayloadGetActionRetType, ok bool) { if arg == nil { diff --git a/services/dns/model_record_set.go b/services/dns/model_record_set.go index 356698a72..158af0a61 100644 --- a/services/dns/model_record_set.go +++ b/services/dns/model_record_set.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the RecordSet type satisfies the MappedNullable interface at compile time @@ -187,10 +188,124 @@ func setRecordSetGetRecordsAttributeType(arg *RecordSetGetRecordsAttributeType, types and functions for state */ -// isEnumRef -type RecordSetGetStateAttributeType = *string -type RecordSetGetStateArgType = string -type RecordSetGetStateRetType = string +//isEnum + +// RecordSetState record set state +type RecordSetState string + +// List of State +const ( + RECORDSETSTATE_CREATING RecordSetState = "CREATING" + RECORDSETSTATE_CREATE_SUCCEEDED RecordSetState = "CREATE_SUCCEEDED" + RECORDSETSTATE_CREATE_FAILED RecordSetState = "CREATE_FAILED" + RECORDSETSTATE_DELETING RecordSetState = "DELETING" + RECORDSETSTATE_DELETE_SUCCEEDED RecordSetState = "DELETE_SUCCEEDED" + RECORDSETSTATE_DELETE_FAILED RecordSetState = "DELETE_FAILED" + RECORDSETSTATE_UPDATING RecordSetState = "UPDATING" + RECORDSETSTATE_UPDATE_SUCCEEDED RecordSetState = "UPDATE_SUCCEEDED" + RECORDSETSTATE_UPDATE_FAILED RecordSetState = "UPDATE_FAILED" +) + +// All allowed values of RecordSet enum +var AllowedRecordSetStateEnumValues = []RecordSetState{ + "CREATING", + "CREATE_SUCCEEDED", + "CREATE_FAILED", + "DELETING", + "DELETE_SUCCEEDED", + "DELETE_FAILED", + "UPDATING", + "UPDATE_SUCCEEDED", + "UPDATE_FAILED", +} + +func (v *RecordSetState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := RecordSetState(value) + for _, existing := range AllowedRecordSetStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RecordSet", value) +} + +// NewRecordSetStateFromValue returns a pointer to a valid RecordSetState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRecordSetStateFromValue(v string) (*RecordSetState, error) { + ev := RecordSetState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RecordSetState: valid values are %v", v, AllowedRecordSetStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RecordSetState) IsValid() bool { + for _, existing := range AllowedRecordSetStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v RecordSetState) Ptr() *RecordSetState { + return &v +} + +type NullableRecordSetState struct { + value *RecordSetState + isSet bool +} + +func (v NullableRecordSetState) Get() *RecordSetState { + return v.value +} + +func (v *NullableRecordSetState) Set(val *RecordSetState) { + v.value = val + v.isSet = true +} + +func (v NullableRecordSetState) IsSet() bool { + return v.isSet +} + +func (v *NullableRecordSetState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecordSetState(val *RecordSetState) *NullableRecordSetState { + return &NullableRecordSetState{value: val, isSet: true} +} + +func (v NullableRecordSetState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecordSetState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type RecordSetGetStateAttributeType = *RecordSetState +type RecordSetGetStateArgType = RecordSetState +type RecordSetGetStateRetType = RecordSetState func getRecordSetGetStateAttributeTypeOk(arg RecordSetGetStateAttributeType) (ret RecordSetGetStateRetType, ok bool) { if arg == nil { @@ -227,10 +342,130 @@ func setRecordSetGetTtlAttributeType(arg *RecordSetGetTtlAttributeType, val Reco types and functions for type */ -// isEnumRef -type RecordSetGetTypeAttributeType = *string -type RecordSetGetTypeArgType = string -type RecordSetGetTypeRetType = string +//isEnum + +// RecordSetTypes record set type +type RecordSetTypes string + +// List of Type +const ( + RECORDSETTYPE_A RecordSetTypes = "A" + RECORDSETTYPE_AAAA RecordSetTypes = "AAAA" + RECORDSETTYPE_SOA RecordSetTypes = "SOA" + RECORDSETTYPE_CNAME RecordSetTypes = "CNAME" + RECORDSETTYPE_NS RecordSetTypes = "NS" + RECORDSETTYPE_MX RecordSetTypes = "MX" + RECORDSETTYPE_TXT RecordSetTypes = "TXT" + RECORDSETTYPE_SRV RecordSetTypes = "SRV" + RECORDSETTYPE_PTR RecordSetTypes = "PTR" + RECORDSETTYPE_ALIAS RecordSetTypes = "ALIAS" + RECORDSETTYPE_DNAME RecordSetTypes = "DNAME" + RECORDSETTYPE_CAA RecordSetTypes = "CAA" +) + +// All allowed values of RecordSet enum +var AllowedRecordSetTypesEnumValues = []RecordSetTypes{ + "A", + "AAAA", + "SOA", + "CNAME", + "NS", + "MX", + "TXT", + "SRV", + "PTR", + "ALIAS", + "DNAME", + "CAA", +} + +func (v *RecordSetTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := RecordSetTypes(value) + for _, existing := range AllowedRecordSetTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RecordSet", value) +} + +// NewRecordSetTypesFromValue returns a pointer to a valid RecordSetTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRecordSetTypesFromValue(v string) (*RecordSetTypes, error) { + ev := RecordSetTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RecordSetTypes: valid values are %v", v, AllowedRecordSetTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RecordSetTypes) IsValid() bool { + for _, existing := range AllowedRecordSetTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v RecordSetTypes) Ptr() *RecordSetTypes { + return &v +} + +type NullableRecordSetTypes struct { + value *RecordSetTypes + isSet bool +} + +func (v NullableRecordSetTypes) Get() *RecordSetTypes { + return v.value +} + +func (v *NullableRecordSetTypes) Set(val *RecordSetTypes) { + v.value = val + v.isSet = true +} + +func (v NullableRecordSetTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableRecordSetTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecordSetTypes(val *RecordSetTypes) *NullableRecordSetTypes { + return &NullableRecordSetTypes{value: val, isSet: true} +} + +func (v NullableRecordSetTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecordSetTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type RecordSetGetTypeAttributeType = *RecordSetTypes +type RecordSetGetTypeArgType = RecordSetTypes +type RecordSetGetTypeRetType = RecordSetTypes func getRecordSetGetTypeAttributeTypeOk(arg RecordSetGetTypeAttributeType) (ret RecordSetGetTypeRetType, ok bool) { if arg == nil { @@ -332,7 +567,7 @@ type _RecordSet RecordSet // 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 NewRecordSet(creationFinished RecordSetGetCreationFinishedArgType, creationStarted RecordSetGetCreationStartedArgType, id RecordSetGetIdArgType, name RecordSetGetNameArgType, records RecordSetGetRecordsArgType, state RecordSetGetStateArgType, ttl RecordSetGetTtlArgType, type_ RecordSetGetTypeArgType, updateFinished RecordSetGetUpdateFinishedArgType, updateStarted RecordSetGetUpdateStartedArgType) *RecordSet { +func NewRecordSet(creationFinished RecordSetGetCreationFinishedArgType, creationStarted RecordSetGetCreationStartedArgType, id RecordSetGetIdArgType, name RecordSetGetNameArgType, records RecordSetGetRecordsArgType, state RecordSetGetStateArgType, ttl RecordSetGetTtlArgType, types RecordSetGetTypeArgType, updateFinished RecordSetGetUpdateFinishedArgType, updateStarted RecordSetGetUpdateStartedArgType) *RecordSet { this := RecordSet{} setRecordSetGetCreationFinishedAttributeType(&this.CreationFinished, creationFinished) setRecordSetGetCreationStartedAttributeType(&this.CreationStarted, creationStarted) @@ -341,7 +576,7 @@ func NewRecordSet(creationFinished RecordSetGetCreationFinishedArgType, creation setRecordSetGetRecordsAttributeType(&this.Records, records) setRecordSetGetStateAttributeType(&this.State, state) setRecordSetGetTtlAttributeType(&this.Ttl, ttl) - setRecordSetGetTypeAttributeType(&this.Type, type_) + setRecordSetGetTypeAttributeType(&this.Type, types) setRecordSetGetUpdateFinishedAttributeType(&this.UpdateFinished, updateFinished) setRecordSetGetUpdateStartedAttributeType(&this.UpdateStarted, updateStarted) return &this diff --git a/services/dns/model_zone.go b/services/dns/model_zone.go index 0d35c1d31..5fa75527f 100644 --- a/services/dns/model_zone.go +++ b/services/dns/model_zone.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the Zone type satisfies the MappedNullable interface at compile time @@ -471,10 +472,124 @@ func setZoneGetSerialNumberAttributeType(arg *ZoneGetSerialNumberAttributeType, types and functions for state */ -// isEnumRef -type ZoneGetStateAttributeType = *string -type ZoneGetStateArgType = string -type ZoneGetStateRetType = string +//isEnum + +// ZoneState zone state +type ZoneState string + +// List of State +const ( + ZONESTATE_CREATING ZoneState = "CREATING" + ZONESTATE_CREATE_SUCCEEDED ZoneState = "CREATE_SUCCEEDED" + ZONESTATE_CREATE_FAILED ZoneState = "CREATE_FAILED" + ZONESTATE_DELETING ZoneState = "DELETING" + ZONESTATE_DELETE_SUCCEEDED ZoneState = "DELETE_SUCCEEDED" + ZONESTATE_DELETE_FAILED ZoneState = "DELETE_FAILED" + ZONESTATE_UPDATING ZoneState = "UPDATING" + ZONESTATE_UPDATE_SUCCEEDED ZoneState = "UPDATE_SUCCEEDED" + ZONESTATE_UPDATE_FAILED ZoneState = "UPDATE_FAILED" +) + +// All allowed values of Zone enum +var AllowedZoneStateEnumValues = []ZoneState{ + "CREATING", + "CREATE_SUCCEEDED", + "CREATE_FAILED", + "DELETING", + "DELETE_SUCCEEDED", + "DELETE_FAILED", + "UPDATING", + "UPDATE_SUCCEEDED", + "UPDATE_FAILED", +} + +func (v *ZoneState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ZoneState(value) + for _, existing := range AllowedZoneStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Zone", value) +} + +// NewZoneStateFromValue returns a pointer to a valid ZoneState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewZoneStateFromValue(v string) (*ZoneState, error) { + ev := ZoneState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ZoneState: valid values are %v", v, AllowedZoneStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ZoneState) IsValid() bool { + for _, existing := range AllowedZoneStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v ZoneState) Ptr() *ZoneState { + return &v +} + +type NullableZoneState struct { + value *ZoneState + isSet bool +} + +func (v NullableZoneState) Get() *ZoneState { + return v.value +} + +func (v *NullableZoneState) Set(val *ZoneState) { + v.value = val + v.isSet = true +} + +func (v NullableZoneState) IsSet() bool { + return v.isSet +} + +func (v *NullableZoneState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableZoneState(val *ZoneState) *NullableZoneState { + return &NullableZoneState{value: val, isSet: true} +} + +func (v NullableZoneState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableZoneState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ZoneGetStateAttributeType = *ZoneState +type ZoneGetStateArgType = ZoneState +type ZoneGetStateRetType = ZoneState func getZoneGetStateAttributeTypeOk(arg ZoneGetStateAttributeType) (ret ZoneGetStateRetType, ok bool) { if arg == nil { @@ -491,10 +606,110 @@ func setZoneGetStateAttributeType(arg *ZoneGetStateAttributeType, val ZoneGetSta types and functions for type */ -// isEnumRef -type ZoneGetTypeAttributeType = *string -type ZoneGetTypeArgType = string -type ZoneGetTypeRetType = string +//isEnum + +// ZoneTypes zone type +type ZoneTypes string + +// List of Type +const ( + ZONETYPE_PRIMARY ZoneTypes = "primary" + ZONETYPE_SECONDARY ZoneTypes = "secondary" +) + +// All allowed values of Zone enum +var AllowedZoneTypesEnumValues = []ZoneTypes{ + "primary", + "secondary", +} + +func (v *ZoneTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ZoneTypes(value) + for _, existing := range AllowedZoneTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Zone", value) +} + +// NewZoneTypesFromValue returns a pointer to a valid ZoneTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewZoneTypesFromValue(v string) (*ZoneTypes, error) { + ev := ZoneTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ZoneTypes: valid values are %v", v, AllowedZoneTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ZoneTypes) IsValid() bool { + for _, existing := range AllowedZoneTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v ZoneTypes) Ptr() *ZoneTypes { + return &v +} + +type NullableZoneTypes struct { + value *ZoneTypes + isSet bool +} + +func (v NullableZoneTypes) Get() *ZoneTypes { + return v.value +} + +func (v *NullableZoneTypes) Set(val *ZoneTypes) { + v.value = val + v.isSet = true +} + +func (v NullableZoneTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableZoneTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableZoneTypes(val *ZoneTypes) *NullableZoneTypes { + return &NullableZoneTypes{value: val, isSet: true} +} + +func (v NullableZoneTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableZoneTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ZoneGetTypeAttributeType = *ZoneTypes +type ZoneGetTypeArgType = ZoneTypes +type ZoneGetTypeRetType = ZoneTypes func getZoneGetTypeAttributeTypeOk(arg ZoneGetTypeAttributeType) (ret ZoneGetTypeRetType, ok bool) { if arg == nil { @@ -553,10 +768,108 @@ type ZoneGetUpdateStartedRetType = string types and functions for visibility */ -// isEnumRef -type ZoneGetVisibilityAttributeType = *string -type ZoneGetVisibilityArgType = string -type ZoneGetVisibilityRetType = string +//isEnum + +// ZoneVisibility visibility of the zone +type ZoneVisibility string + +// List of Visibility +const ( + ZONEVISIBILITY_PUBLIC ZoneVisibility = "public" +) + +// All allowed values of Zone enum +var AllowedZoneVisibilityEnumValues = []ZoneVisibility{ + "public", +} + +func (v *ZoneVisibility) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ZoneVisibility(value) + for _, existing := range AllowedZoneVisibilityEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Zone", value) +} + +// NewZoneVisibilityFromValue returns a pointer to a valid ZoneVisibility +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewZoneVisibilityFromValue(v string) (*ZoneVisibility, error) { + ev := ZoneVisibility(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ZoneVisibility: valid values are %v", v, AllowedZoneVisibilityEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ZoneVisibility) IsValid() bool { + for _, existing := range AllowedZoneVisibilityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VisibilityVisibility value +func (v ZoneVisibility) Ptr() *ZoneVisibility { + return &v +} + +type NullableZoneVisibility struct { + value *ZoneVisibility + isSet bool +} + +func (v NullableZoneVisibility) Get() *ZoneVisibility { + return v.value +} + +func (v *NullableZoneVisibility) Set(val *ZoneVisibility) { + v.value = val + v.isSet = true +} + +func (v NullableZoneVisibility) IsSet() bool { + return v.isSet +} + +func (v *NullableZoneVisibility) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableZoneVisibility(val *ZoneVisibility) *NullableZoneVisibility { + return &NullableZoneVisibility{value: val, isSet: true} +} + +func (v NullableZoneVisibility) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableZoneVisibility) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ZoneGetVisibilityAttributeType = *ZoneVisibility +type ZoneGetVisibilityArgType = ZoneVisibility +type ZoneGetVisibilityRetType = ZoneVisibility func getZoneGetVisibilityAttributeTypeOk(arg ZoneGetVisibilityAttributeType) (ret ZoneGetVisibilityRetType, ok bool) { if arg == nil { @@ -655,7 +968,7 @@ type _Zone Zone // 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 NewZone(acl ZoneGetAclArgType, creationFinished ZoneGetCreationFinishedArgType, creationStarted ZoneGetCreationStartedArgType, defaultTTL ZoneGetDefaultTTLArgType, dnsName ZoneGetDnsNameArgType, expireTime ZoneGetExpireTimeArgType, id ZoneGetIdArgType, name ZoneGetNameArgType, negativeCache ZoneGetNegativeCacheArgType, primaryNameServer ZoneGetPrimaryNameServerArgType, refreshTime ZoneGetRefreshTimeArgType, retryTime ZoneGetRetryTimeArgType, serialNumber ZoneGetSerialNumberArgType, state ZoneGetStateArgType, type_ ZoneGetTypeArgType, updateFinished ZoneGetUpdateFinishedArgType, updateStarted ZoneGetUpdateStartedArgType, visibility ZoneGetVisibilityArgType) *Zone { +func NewZone(acl ZoneGetAclArgType, creationFinished ZoneGetCreationFinishedArgType, creationStarted ZoneGetCreationStartedArgType, defaultTTL ZoneGetDefaultTTLArgType, dnsName ZoneGetDnsNameArgType, expireTime ZoneGetExpireTimeArgType, id ZoneGetIdArgType, name ZoneGetNameArgType, negativeCache ZoneGetNegativeCacheArgType, primaryNameServer ZoneGetPrimaryNameServerArgType, refreshTime ZoneGetRefreshTimeArgType, retryTime ZoneGetRetryTimeArgType, serialNumber ZoneGetSerialNumberArgType, state ZoneGetStateArgType, types ZoneGetTypeArgType, updateFinished ZoneGetUpdateFinishedArgType, updateStarted ZoneGetUpdateStartedArgType, visibility ZoneGetVisibilityArgType) *Zone { this := Zone{} setZoneGetAclAttributeType(&this.Acl, acl) setZoneGetCreationFinishedAttributeType(&this.CreationFinished, creationFinished) @@ -671,7 +984,7 @@ func NewZone(acl ZoneGetAclArgType, creationFinished ZoneGetCreationFinishedArgT setZoneGetRetryTimeAttributeType(&this.RetryTime, retryTime) setZoneGetSerialNumberAttributeType(&this.SerialNumber, serialNumber) setZoneGetStateAttributeType(&this.State, state) - setZoneGetTypeAttributeType(&this.Type, type_) + setZoneGetTypeAttributeType(&this.Type, types) setZoneGetUpdateFinishedAttributeType(&this.UpdateFinished, updateFinished) setZoneGetUpdateStartedAttributeType(&this.UpdateStarted, updateStarted) setZoneGetVisibilityAttributeType(&this.Visibility, visibility) diff --git a/services/dns/wait/wait.go b/services/dns/wait/wait.go index d39f2e648..486196a2c 100644 --- a/services/dns/wait/wait.go +++ b/services/dns/wait/wait.go @@ -10,12 +10,18 @@ import ( ) const ( + // Deprecated: CreateSuccess is deprecated and will be removed after 14th November 2025. Use [dns.ZONESTATE_CREATE_SUCCEEDED] or [dns.RECORDSETSTATE_CREATE_SUCCEEDED] instead. CreateSuccess = "CREATE_SUCCEEDED" - CreateFail = "CREATE_FAILED" + // Deprecated: CreateFail is deprecated and will be removed after 14th November 2025. Use [dns.ZONESTATE_CREATE_FAILED] or [dns.RECORDSETSTATE_CREATE_FAILED] instead. + CreateFail = "CREATE_FAILED" + // Deprecated: UpdateSuccess is deprecated and will be removed after 14th November 2025. Use [dns.ZONESTATE_UPDATE_SUCCEEDED] or [dns.RECORDSETSTATE_UPDATE_SUCCEEDED] instead. UpdateSuccess = "UPDATE_SUCCEEDED" - UpdateFail = "UPDATE_FAILED" + // Deprecated: UpdateSuccess is deprecated and will be removed after 14th November 2025. Use [dns.ZONESTATE_UPDATE_FAILED] or [dns.RECORDSETSTATE_UPDATE_FAILED] instead. + UpdateFail = "UPDATE_FAILED" + // Deprecated: UpdateSuccess is deprecated and will be removed after 14th November 2025. Use [dns.ZONESTATE_DELETE_SUCCEEDED] or [dns.RECORDSETSTATE_DELETE_SUCCEEDED] instead. DeleteSuccess = "DELETE_SUCCEEDED" - DeleteFail = "DELETE_FAILED" + // Deprecated: UpdateSuccess is deprecated and will be removed after 14th November 2025. Use [dns.ZONESTATE_DELETE_FAILED] or [dns.RECORDSETSTATE_DELETE_FAILED] instead. + DeleteFail = "DELETE_FAILED" ) // Interfaces needed for tests @@ -34,10 +40,10 @@ func CreateZoneWaitHandler(ctx context.Context, a APIClientInterface, projectId, if s.Zone.Id == nil || s.Zone.State == nil { return false, nil, fmt.Errorf("create failed for instance with id %s. The response is not valid: the id or the state are missing", instanceId) } - if *s.Zone.Id == instanceId && *s.Zone.State == CreateSuccess { + if *s.Zone.Id == instanceId && *s.Zone.State == dns.ZONESTATE_CREATE_SUCCEEDED { return true, s, nil } - if *s.Zone.Id == instanceId && *s.Zone.State == CreateFail { + if *s.Zone.Id == instanceId && *s.Zone.State == dns.ZONESTATE_CREATE_FAILED { return true, s, fmt.Errorf("create failed for zone with id %s", instanceId) } return false, nil, nil @@ -56,10 +62,10 @@ func PartialUpdateZoneWaitHandler(ctx context.Context, a APIClientInterface, pro if s.Zone.Id == nil || s.Zone.State == nil { return false, nil, fmt.Errorf("update failed for instance with id %s. The response is not valid: the id or the state are missing", instanceId) } - if *s.Zone.Id == instanceId && *s.Zone.State == UpdateSuccess { + if *s.Zone.Id == instanceId && *s.Zone.State == dns.ZONESTATE_UPDATE_SUCCEEDED { return true, s, nil } - if *s.Zone.Id == instanceId && *s.Zone.State == UpdateFail { + if *s.Zone.Id == instanceId && *s.Zone.State == dns.ZONESTATE_UPDATE_FAILED { return true, s, fmt.Errorf("update failed for zone with id %s", instanceId) } return false, nil, nil @@ -79,10 +85,10 @@ func DeleteZoneWaitHandler(ctx context.Context, a APIClientInterface, projectId, if s.Zone.Id == nil || s.Zone.State == nil { return false, nil, fmt.Errorf("delete failed for instance with id %s. The response is not valid: the id or the state are missing", instanceId) } - if *s.Zone.Id == instanceId && *s.Zone.State == DeleteSuccess { + if *s.Zone.Id == instanceId && *s.Zone.State == dns.ZONESTATE_DELETE_SUCCEEDED { return true, s, nil } - if *s.Zone.Id == instanceId && *s.Zone.State == DeleteFail { + if *s.Zone.Id == instanceId && *s.Zone.State == dns.ZONESTATE_DELETE_FAILED { return true, s, fmt.Errorf("delete failed for zone with id %s", instanceId) } return false, nil, nil @@ -101,10 +107,10 @@ func CreateRecordSetWaitHandler(ctx context.Context, a APIClientInterface, proje if s.Rrset.Id == nil || s.Rrset.State == nil { return false, nil, fmt.Errorf("create failed for record set with id %s. The response is not valid: the id or the state are missing", instanceId) } - if *s.Rrset.Id == rrSetId && *s.Rrset.State == CreateSuccess { + if *s.Rrset.Id == rrSetId && *s.Rrset.State == dns.RECORDSETSTATE_CREATE_SUCCEEDED { return true, s, nil } - if *s.Rrset.Id == rrSetId && *s.Rrset.State == CreateFail { + if *s.Rrset.Id == rrSetId && *s.Rrset.State == dns.RECORDSETSTATE_CREATE_FAILED { return true, s, fmt.Errorf("create failed for record with id %s", rrSetId) } return false, nil, nil @@ -123,10 +129,10 @@ func PartialUpdateRecordSetWaitHandler(ctx context.Context, a APIClientInterface if s.Rrset.Id == nil || s.Rrset.State == nil { return false, nil, fmt.Errorf("update failed for record set with id %s. The response is not valid: the id or the state are missing", rrSetId) } - if *s.Rrset.Id == rrSetId && *s.Rrset.State == UpdateSuccess { + if *s.Rrset.Id == rrSetId && *s.Rrset.State == dns.RECORDSETSTATE_UPDATE_SUCCEEDED { return true, s, nil } - if *s.Rrset.Id == rrSetId && *s.Rrset.State == UpdateFail { + if *s.Rrset.Id == rrSetId && *s.Rrset.State == dns.RECORDSETSTATE_UPDATE_FAILED { return true, s, fmt.Errorf("update failed for record with id %s", rrSetId) } return false, nil, nil @@ -146,10 +152,10 @@ func DeleteRecordSetWaitHandler(ctx context.Context, a APIClientInterface, proje if s.Rrset.Id == nil || s.Rrset.State == nil { return false, nil, fmt.Errorf("delete failed for record set with id %s. The response is not valid: the id or the state are missing", rrSetId) } - if *s.Rrset.Id == rrSetId && *s.Rrset.State == DeleteSuccess { + if *s.Rrset.Id == rrSetId && *s.Rrset.State == dns.RECORDSETSTATE_DELETE_SUCCEEDED { return true, s, nil } - if *s.Rrset.Id == rrSetId && *s.Rrset.State == DeleteFail { + if *s.Rrset.Id == rrSetId && *s.Rrset.State == dns.RECORDSETSTATE_DELETE_FAILED { return true, s, fmt.Errorf("delete failed for record with id %s", rrSetId) } return false, nil, nil diff --git a/services/dns/wait/wait_test.go b/services/dns/wait/wait_test.go index 84e8eb577..3fb91462f 100644 --- a/services/dns/wait/wait_test.go +++ b/services/dns/wait/wait_test.go @@ -25,7 +25,7 @@ func (a *apiClientMocked) GetZoneExecute(_ context.Context, _, _ string) (*dns.Z return &dns.ZoneResponse{ Zone: &dns.Zone{ - State: &a.resourceState, + State: dns.ZoneGetStateAttributeType(&a.resourceState), Id: utils.Ptr("zid"), }, }, nil @@ -40,7 +40,7 @@ func (a *apiClientMocked) GetRecordSetExecute(_ context.Context, _, _, _ string) return &dns.RecordSetResponse{ Rrset: &dns.RecordSet{ - State: &a.resourceState, + State: dns.RecordSetGetStateAttributeType(&a.resourceState), Id: utils.Ptr("rid"), }, }, nil @@ -50,21 +50,21 @@ func TestCreateZoneWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState dns.ZoneState wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: CreateSuccess, + resourceState: dns.ZONESTATE_CREATE_SUCCEEDED, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: CreateFail, + resourceState: dns.ZONESTATE_CREATE_FAILED, wantErr: true, wantResp: true, }, @@ -87,7 +87,7 @@ func TestCreateZoneWaitHandler(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { apiClient := &apiClientMocked{ getFails: tt.getFails, - resourceState: tt.resourceState, + resourceState: string(tt.resourceState), } var wantRes *dns.ZoneResponse @@ -118,21 +118,21 @@ func TestUpdateZoneWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState dns.ZoneState wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: UpdateSuccess, + resourceState: dns.ZONESTATE_UPDATE_SUCCEEDED, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: UpdateFail, + resourceState: dns.ZONESTATE_UPDATE_FAILED, wantErr: true, wantResp: true, }, @@ -155,7 +155,7 @@ func TestUpdateZoneWaitHandler(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { apiClient := &apiClientMocked{ getFails: tt.getFails, - resourceState: tt.resourceState, + resourceState: string(tt.resourceState), } var wantRes *dns.ZoneResponse @@ -186,21 +186,21 @@ func TestDeleteZoneWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState dns.ZoneState wantErr bool wantResp bool }{ { desc: "delete_succeeded", getFails: false, - resourceState: DeleteSuccess, + resourceState: dns.ZONESTATE_DELETE_SUCCEEDED, wantErr: false, wantResp: true, }, { desc: "delete_failed", getFails: false, - resourceState: DeleteFail, + resourceState: dns.ZONESTATE_DELETE_FAILED, wantErr: true, wantResp: true, }, @@ -223,7 +223,7 @@ func TestDeleteZoneWaitHandler(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { apiClient := &apiClientMocked{ getFails: tt.getFails, - resourceState: tt.resourceState, + resourceState: string(tt.resourceState), } var wantRes *dns.ZoneResponse @@ -256,21 +256,21 @@ func TestCreateRecordSetWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState dns.RecordSetState wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: CreateSuccess, + resourceState: dns.RECORDSETSTATE_CREATE_SUCCEEDED, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: CreateFail, + resourceState: dns.RECORDSETSTATE_CREATE_FAILED, wantErr: true, wantResp: true, }, @@ -293,7 +293,7 @@ func TestCreateRecordSetWaitHandler(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { apiClient := &apiClientMocked{ getFails: tt.getFails, - resourceState: tt.resourceState, + resourceState: string(tt.resourceState), } var wantRes *dns.RecordSetResponse @@ -324,21 +324,21 @@ func TestUpdateRecordSetWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState dns.RecordSetState wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: UpdateSuccess, + resourceState: dns.RECORDSETSTATE_UPDATE_SUCCEEDED, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: UpdateFail, + resourceState: dns.RECORDSETSTATE_UPDATE_FAILED, wantErr: true, wantResp: true, }, @@ -361,7 +361,7 @@ func TestUpdateRecordSetWaitHandler(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { apiClient := &apiClientMocked{ getFails: tt.getFails, - resourceState: tt.resourceState, + resourceState: string(tt.resourceState), } var wantRes *dns.RecordSetResponse @@ -392,21 +392,21 @@ func TestDeleteRecordSetWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState dns.RecordSetState wantErr bool wantResp bool }{ { desc: "delete_succeeded", getFails: false, - resourceState: DeleteSuccess, + resourceState: dns.RECORDSETSTATE_DELETE_SUCCEEDED, wantErr: false, wantResp: true, }, { desc: "delete_failed", getFails: false, - resourceState: DeleteFail, + resourceState: dns.RECORDSETSTATE_DELETE_FAILED, wantErr: true, wantResp: true, }, @@ -429,7 +429,7 @@ func TestDeleteRecordSetWaitHandler(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { apiClient := &apiClientMocked{ getFails: tt.getFails, - resourceState: tt.resourceState, + resourceState: string(tt.resourceState), } var wantRes *dns.RecordSetResponse diff --git a/services/git/CHANGELOG.md b/services/git/CHANGELOG.md index 9bb3fcf4b..03715f54d 100644 --- a/services/git/CHANGELOG.md +++ b/services/git/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.4.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.3.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/git/model_instance.go b/services/git/model_instance.go index 3886646c6..0e52184a5 100644 --- a/services/git/model_instance.go +++ b/services/git/model_instance.go @@ -12,6 +12,7 @@ package git import ( "encoding/json" + "fmt" "time" ) @@ -84,10 +85,118 @@ type InstanceGetNameRetType = string types and functions for state */ -// isEnumRef -type InstanceGetStateAttributeType = *string -type InstanceGetStateArgType = string -type InstanceGetStateRetType = string +//isEnum + +// InstanceState The current state of the STACKIT Git instance. +type InstanceState string + +// List of State +const ( + INSTANCESTATE_CREATING InstanceState = "Creating" + INSTANCESTATE_WAITING_FOR_RESOURCES InstanceState = "WaitingForResources" + INSTANCESTATE_UPDATING InstanceState = "Updating" + INSTANCESTATE_DELETING InstanceState = "Deleting" + INSTANCESTATE_READY InstanceState = "Ready" + INSTANCESTATE_ERROR InstanceState = "Error" +) + +// All allowed values of Instance enum +var AllowedInstanceStateEnumValues = []InstanceState{ + "Creating", + "WaitingForResources", + "Updating", + "Deleting", + "Ready", + "Error", +} + +func (v *InstanceState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceState(value) + for _, existing := range AllowedInstanceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStateFromValue returns a pointer to a valid InstanceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStateFromValue(v string) (*InstanceState, error) { + ev := InstanceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceState: valid values are %v", v, AllowedInstanceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceState) IsValid() bool { + for _, existing := range AllowedInstanceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceState) Ptr() *InstanceState { + return &v +} + +type NullableInstanceState struct { + value *InstanceState + isSet bool +} + +func (v NullableInstanceState) Get() *InstanceState { + return v.value +} + +func (v *NullableInstanceState) Set(val *InstanceState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceState(val *InstanceState) *NullableInstanceState { + return &NullableInstanceState{value: val, isSet: true} +} + +func (v NullableInstanceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStateAttributeType = *InstanceState +type InstanceGetStateArgType = InstanceState +type InstanceGetStateRetType = InstanceState func getInstanceGetStateAttributeTypeOk(arg InstanceGetStateAttributeType) (ret InstanceGetStateRetType, ok bool) { if arg == nil { diff --git a/services/git/wait/wait.go b/services/git/wait/wait.go index bef8246ed..087b2789e 100644 --- a/services/git/wait/wait.go +++ b/services/git/wait/wait.go @@ -13,9 +13,12 @@ import ( ) const ( - InstanceStateReady = "Ready" + // Deprecated: InstanceStateReady is deprecated and will be removed after 14th November 2025. Use [git.INSTANCESTATE_READY] instead. + InstanceStateReady = "Ready" + // Deprecated: InstanceStateCreating is deprecated and will be removed after 14th November 2025. Use [git.INSTANCESTATE_CREATING] instead. InstanceStateCreating = "Creating" - InstanceStateError = "Error" + // Deprecated: InstanceStateError is deprecated and will be removed after 14th November 2025. Use [git.INSTANCESTATE_ERROR] instead. + InstanceStateError = "Error" ) // APIClientInterface Interfaces needed for tests @@ -32,10 +35,10 @@ func CreateGitInstanceWaitHandler(ctx context.Context, a APIClientInterface, pro if instance.Id == nil || instance.State == nil { return false, nil, fmt.Errorf("could not get Instance id or State from response for project %s and instanceId %s", projectId, instanceId) } - if *instance.Id == instanceId && *instance.State == InstanceStateReady { + if *instance.Id == instanceId && *instance.State == git.INSTANCESTATE_READY { return true, instance, nil } - if *instance.Id == instanceId && *instance.State == InstanceStateError { + if *instance.Id == instanceId && *instance.State == git.INSTANCESTATE_ERROR { return true, instance, fmt.Errorf("create failed for Instance with id %s", instanceId) } return false, nil, nil diff --git a/services/git/wait/wait_test.go b/services/git/wait/wait_test.go index 151798e5c..2da511556 100644 --- a/services/git/wait/wait_test.go +++ b/services/git/wait/wait_test.go @@ -60,7 +60,7 @@ func TestCreateGitInstanceWaitHandler(t *testing.T) { Created: utils.Ptr(time.Now()), Id: utils.Ptr(INSTANCE_ID), Name: utils.Ptr("instance-test"), - State: utils.Ptr(InstanceStateReady), + State: utils.Ptr(git.INSTANCESTATE_READY), Url: utils.Ptr("https://testing.git.onstackit.cloud"), Version: utils.Ptr("v1.6.0"), }, @@ -77,7 +77,7 @@ func TestCreateGitInstanceWaitHandler(t *testing.T) { Created: utils.Ptr(time.Now()), Id: utils.Ptr(INSTANCE_ID), Name: utils.Ptr("instance-test"), - State: utils.Ptr(InstanceStateReady), + State: utils.Ptr(git.INSTANCESTATE_READY), Url: utils.Ptr("https://testing.git.onstackit.cloud"), Version: utils.Ptr("v1.6.0"), }, @@ -94,7 +94,7 @@ func TestCreateGitInstanceWaitHandler(t *testing.T) { Created: utils.Ptr(time.Now()), Id: utils.Ptr(INSTANCE_ID), Name: utils.Ptr("instance-test"), - State: utils.Ptr(InstanceStateError), + State: utils.Ptr(git.INSTANCESTATE_ERROR), Url: utils.Ptr("https://testing.git.onstackit.cloud"), Version: utils.Ptr("v1.6.0"), }, @@ -110,7 +110,7 @@ func TestCreateGitInstanceWaitHandler(t *testing.T) { getGitResponse: &git.Instance{ Created: utils.Ptr(time.Now()), Name: utils.Ptr("instance-test"), - State: utils.Ptr(InstanceStateError), + State: utils.Ptr(git.INSTANCESTATE_ERROR), Url: utils.Ptr("https://testing.git.onstackit.cloud"), Version: utils.Ptr("v1.6.0"), }, @@ -187,7 +187,7 @@ func TestDeleteGitInstanceWaitHandler(t *testing.T) { Created: utils.Ptr(time.Now()), Id: utils.Ptr(INSTANCE_ID), Name: utils.Ptr("instance-test"), - State: utils.Ptr(InstanceStateReady), + State: utils.Ptr(git.INSTANCESTATE_READY), Url: utils.Ptr("https://testing.git.onstackit.cloud"), Version: utils.Ptr("v1.6.0"), }, diff --git a/services/iaas/model_backup_source.go b/services/iaas/model_backup_source.go index d46d97b05..a45617731 100644 --- a/services/iaas/model_backup_source.go +++ b/services/iaas/model_backup_source.go @@ -75,10 +75,10 @@ type _BackupSource BackupSource // 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 NewBackupSource(id BackupSourceGetIdArgType, type_ BackupSourceGetTypeArgType) *BackupSource { +func NewBackupSource(id BackupSourceGetIdArgType, types BackupSourceGetTypeArgType) *BackupSource { this := BackupSource{} setBackupSourceGetIdAttributeType(&this.Id, id) - setBackupSourceGetTypeAttributeType(&this.Type, type_) + setBackupSourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaas/model_boot_volume_source.go b/services/iaas/model_boot_volume_source.go index d1532a0cc..e7d53a707 100644 --- a/services/iaas/model_boot_volume_source.go +++ b/services/iaas/model_boot_volume_source.go @@ -75,10 +75,10 @@ type _BootVolumeSource BootVolumeSource // 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 BootVolumeSourceGetIdArgType, type_ BootVolumeSourceGetTypeArgType) *BootVolumeSource { +func NewBootVolumeSource(id BootVolumeSourceGetIdArgType, types BootVolumeSourceGetTypeArgType) *BootVolumeSource { this := BootVolumeSource{} setBootVolumeSourceGetIdAttributeType(&this.Id, id) - setBootVolumeSourceGetTypeAttributeType(&this.Type, type_) + setBootVolumeSourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaas/model_icmp_parameters.go b/services/iaas/model_icmp_parameters.go index 723b1e890..1f3fc7a02 100644 --- a/services/iaas/model_icmp_parameters.go +++ b/services/iaas/model_icmp_parameters.go @@ -73,10 +73,10 @@ type _ICMPParameters ICMPParameters // 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 ICMPParametersGetCodeArgType, type_ ICMPParametersGetTypeArgType) *ICMPParameters { +func NewICMPParameters(code ICMPParametersGetCodeArgType, types ICMPParametersGetTypeArgType) *ICMPParameters { this := ICMPParameters{} setICMPParametersGetCodeAttributeType(&this.Code, code) - setICMPParametersGetTypeAttributeType(&this.Type, type_) + setICMPParametersGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaas/model_request_resource.go b/services/iaas/model_request_resource.go index ab69eba29..9042e582c 100644 --- a/services/iaas/model_request_resource.go +++ b/services/iaas/model_request_resource.go @@ -99,11 +99,11 @@ type _RequestResource RequestResource // 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 NewRequestResource(id RequestResourceGetIdArgType, status RequestResourceGetStatusArgType, type_ RequestResourceGetTypeArgType) *RequestResource { +func NewRequestResource(id RequestResourceGetIdArgType, status RequestResourceGetStatusArgType, types RequestResourceGetTypeArgType) *RequestResource { this := RequestResource{} setRequestResourceGetIdAttributeType(&this.Id, id) setRequestResourceGetStatusAttributeType(&this.Status, status) - setRequestResourceGetTypeAttributeType(&this.Type, type_) + setRequestResourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaas/model_volume_source.go b/services/iaas/model_volume_source.go index f73579b3a..5103b2ed1 100644 --- a/services/iaas/model_volume_source.go +++ b/services/iaas/model_volume_source.go @@ -75,10 +75,10 @@ type _VolumeSource VolumeSource // 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 VolumeSourceGetIdArgType, type_ VolumeSourceGetTypeArgType) *VolumeSource { +func NewVolumeSource(id VolumeSourceGetIdArgType, types VolumeSourceGetTypeArgType) *VolumeSource { this := VolumeSource{} setVolumeSourceGetIdAttributeType(&this.Id, id) - setVolumeSourceGetTypeAttributeType(&this.Type, type_) + setVolumeSourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaasalpha/model_backup_source.go b/services/iaasalpha/model_backup_source.go index 87edacb13..892a1e2c4 100644 --- a/services/iaasalpha/model_backup_source.go +++ b/services/iaasalpha/model_backup_source.go @@ -75,10 +75,10 @@ type _BackupSource BackupSource // 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 NewBackupSource(id BackupSourceGetIdArgType, type_ BackupSourceGetTypeArgType) *BackupSource { +func NewBackupSource(id BackupSourceGetIdArgType, types BackupSourceGetTypeArgType) *BackupSource { this := BackupSource{} setBackupSourceGetIdAttributeType(&this.Id, id) - setBackupSourceGetTypeAttributeType(&this.Type, type_) + setBackupSourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaasalpha/model_boot_volume_source.go b/services/iaasalpha/model_boot_volume_source.go index 9b2f9019d..a2905891c 100644 --- a/services/iaasalpha/model_boot_volume_source.go +++ b/services/iaasalpha/model_boot_volume_source.go @@ -75,10 +75,10 @@ type _BootVolumeSource BootVolumeSource // 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 BootVolumeSourceGetIdArgType, type_ BootVolumeSourceGetTypeArgType) *BootVolumeSource { +func NewBootVolumeSource(id BootVolumeSourceGetIdArgType, types BootVolumeSourceGetTypeArgType) *BootVolumeSource { this := BootVolumeSource{} setBootVolumeSourceGetIdAttributeType(&this.Id, id) - setBootVolumeSourceGetTypeAttributeType(&this.Type, type_) + setBootVolumeSourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaasalpha/model_icmp_parameters.go b/services/iaasalpha/model_icmp_parameters.go index 7dcd3d126..a3158eaf9 100644 --- a/services/iaasalpha/model_icmp_parameters.go +++ b/services/iaasalpha/model_icmp_parameters.go @@ -73,10 +73,10 @@ type _ICMPParameters ICMPParameters // 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 ICMPParametersGetCodeArgType, type_ ICMPParametersGetTypeArgType) *ICMPParameters { +func NewICMPParameters(code ICMPParametersGetCodeArgType, types ICMPParametersGetTypeArgType) *ICMPParameters { this := ICMPParameters{} setICMPParametersGetCodeAttributeType(&this.Code, code) - setICMPParametersGetTypeAttributeType(&this.Type, type_) + setICMPParametersGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaasalpha/model_request_resource.go b/services/iaasalpha/model_request_resource.go index 74f331be0..bf9b18dff 100644 --- a/services/iaasalpha/model_request_resource.go +++ b/services/iaasalpha/model_request_resource.go @@ -99,11 +99,11 @@ type _RequestResource RequestResource // 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 NewRequestResource(id RequestResourceGetIdArgType, status RequestResourceGetStatusArgType, type_ RequestResourceGetTypeArgType) *RequestResource { +func NewRequestResource(id RequestResourceGetIdArgType, status RequestResourceGetStatusArgType, types RequestResourceGetTypeArgType) *RequestResource { this := RequestResource{} setRequestResourceGetIdAttributeType(&this.Id, id) setRequestResourceGetStatusAttributeType(&this.Status, status) - setRequestResourceGetTypeAttributeType(&this.Type, type_) + setRequestResourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/iaasalpha/model_volume_source.go b/services/iaasalpha/model_volume_source.go index 18a058c5d..e1d1e569a 100644 --- a/services/iaasalpha/model_volume_source.go +++ b/services/iaasalpha/model_volume_source.go @@ -75,10 +75,10 @@ type _VolumeSource VolumeSource // 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 VolumeSourceGetIdArgType, type_ VolumeSourceGetTypeArgType) *VolumeSource { +func NewVolumeSource(id VolumeSourceGetIdArgType, types VolumeSourceGetTypeArgType) *VolumeSource { this := VolumeSource{} setVolumeSourceGetIdAttributeType(&this.Id, id) - setVolumeSourceGetTypeAttributeType(&this.Type, type_) + setVolumeSourceGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/kms/CHANGELOG.md b/services/kms/CHANGELOG.md index 1e7952fe7..b90d5b282 100644 --- a/services/kms/CHANGELOG.md +++ b/services/kms/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.0.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/kms/model_key.go b/services/kms/model_key.go index bfc09e481..12bb20f0a 100644 --- a/services/kms/model_key.go +++ b/services/kms/model_key.go @@ -12,6 +12,7 @@ package kms import ( "encoding/json" + "fmt" "time" ) @@ -226,10 +227,112 @@ func setKeyGetPurposeAttributeType(arg *KeyGetPurposeAttributeType, val KeyGetPu types and functions for state */ -// isEnumRef -type KeyGetStateAttributeType = *string -type KeyGetStateArgType = string -type KeyGetStateRetType = string +//isEnum + +// KeyState The current state of the key. +type KeyState string + +// List of State +const ( + KEYSTATE_ACTIVE KeyState = "active" + KEYSTATE_VERSION_NOT_READY KeyState = "version_not_ready" + KEYSTATE_DELETED KeyState = "deleted" +) + +// All allowed values of Key enum +var AllowedKeyStateEnumValues = []KeyState{ + "active", + "version_not_ready", + "deleted", +} + +func (v *KeyState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := KeyState(value) + for _, existing := range AllowedKeyStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Key", value) +} + +// NewKeyStateFromValue returns a pointer to a valid KeyState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewKeyStateFromValue(v string) (*KeyState, error) { + ev := KeyState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for KeyState: valid values are %v", v, AllowedKeyStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v KeyState) IsValid() bool { + for _, existing := range AllowedKeyStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v KeyState) Ptr() *KeyState { + return &v +} + +type NullableKeyState struct { + value *KeyState + isSet bool +} + +func (v NullableKeyState) Get() *KeyState { + return v.value +} + +func (v *NullableKeyState) Set(val *KeyState) { + v.value = val + v.isSet = true +} + +func (v NullableKeyState) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyState(val *KeyState) *NullableKeyState { + return &NullableKeyState{value: val, isSet: true} +} + +func (v NullableKeyState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type KeyGetStateAttributeType = *KeyState +type KeyGetStateArgType = KeyState +type KeyGetStateRetType = KeyState func getKeyGetStateAttributeTypeOk(arg KeyGetStateAttributeType) (ret KeyGetStateRetType, ok bool) { if arg == nil { diff --git a/services/kms/model_key_ring.go b/services/kms/model_key_ring.go index aaf10ac55..0a2d60e9b 100644 --- a/services/kms/model_key_ring.go +++ b/services/kms/model_key_ring.go @@ -12,6 +12,7 @@ package kms import ( "encoding/json" + "fmt" "time" ) @@ -105,10 +106,110 @@ type KeyRingGetIdRetType = string types and functions for state */ -// isEnumRef -type KeyRingGetStateAttributeType = *string -type KeyRingGetStateArgType = string -type KeyRingGetStateRetType = string +//isEnum + +// KeyRingState The current state of the key ring. +type KeyRingState string + +// List of State +const ( + KEYRINGSTATE_ACTIVE KeyRingState = "active" + KEYRINGSTATE_DELETED KeyRingState = "deleted" +) + +// All allowed values of KeyRing enum +var AllowedKeyRingStateEnumValues = []KeyRingState{ + "active", + "deleted", +} + +func (v *KeyRingState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := KeyRingState(value) + for _, existing := range AllowedKeyRingStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid KeyRing", value) +} + +// NewKeyRingStateFromValue returns a pointer to a valid KeyRingState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewKeyRingStateFromValue(v string) (*KeyRingState, error) { + ev := KeyRingState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for KeyRingState: valid values are %v", v, AllowedKeyRingStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v KeyRingState) IsValid() bool { + for _, existing := range AllowedKeyRingStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v KeyRingState) Ptr() *KeyRingState { + return &v +} + +type NullableKeyRingState struct { + value *KeyRingState + isSet bool +} + +func (v NullableKeyRingState) Get() *KeyRingState { + return v.value +} + +func (v *NullableKeyRingState) Set(val *KeyRingState) { + v.value = val + v.isSet = true +} + +func (v NullableKeyRingState) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyRingState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyRingState(val *KeyRingState) *NullableKeyRingState { + return &NullableKeyRingState{value: val, isSet: true} +} + +func (v NullableKeyRingState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyRingState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type KeyRingGetStateAttributeType = *KeyRingState +type KeyRingGetStateArgType = KeyRingState +type KeyRingGetStateRetType = KeyRingState func getKeyRingGetStateAttributeTypeOk(arg KeyRingGetStateAttributeType) (ret KeyRingGetStateRetType, ok bool) { if arg == nil { diff --git a/services/kms/model_version.go b/services/kms/model_version.go index 64dd596f1..446bd84ef 100644 --- a/services/kms/model_version.go +++ b/services/kms/model_version.go @@ -12,6 +12,7 @@ package kms import ( "encoding/json" + "fmt" "time" ) @@ -165,10 +166,116 @@ type VersionGetPublicKeyRetType = string types and functions for state */ -// isEnumRef -type VersionGetStateAttributeType = *string -type VersionGetStateArgType = string -type VersionGetStateRetType = string +//isEnum + +// VersionState The current state of the key. +type VersionState string + +// List of State +const ( + VERSIONSTATE_ACTIVE VersionState = "active" + VERSIONSTATE_KEY_MATERIAL_NOT_READY VersionState = "key_material_not_ready" + VERSIONSTATE_KEY_MATERIAL_INVALID VersionState = "key_material_invalid" + VERSIONSTATE_DISABLED VersionState = "disabled" + VERSIONSTATE_DESTROYED VersionState = "destroyed" +) + +// All allowed values of Version enum +var AllowedVersionStateEnumValues = []VersionState{ + "active", + "key_material_not_ready", + "key_material_invalid", + "disabled", + "destroyed", +} + +func (v *VersionState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := VersionState(value) + for _, existing := range AllowedVersionStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Version", value) +} + +// NewVersionStateFromValue returns a pointer to a valid VersionState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVersionStateFromValue(v string) (*VersionState, error) { + ev := VersionState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VersionState: valid values are %v", v, AllowedVersionStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VersionState) IsValid() bool { + for _, existing := range AllowedVersionStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v VersionState) Ptr() *VersionState { + return &v +} + +type NullableVersionState struct { + value *VersionState + isSet bool +} + +func (v NullableVersionState) Get() *VersionState { + return v.value +} + +func (v *NullableVersionState) Set(val *VersionState) { + v.value = val + v.isSet = true +} + +func (v NullableVersionState) IsSet() bool { + return v.isSet +} + +func (v *NullableVersionState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersionState(val *VersionState) *NullableVersionState { + return &NullableVersionState{value: val, isSet: true} +} + +func (v NullableVersionState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersionState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type VersionGetStateAttributeType = *VersionState +type VersionGetStateArgType = VersionState +type VersionGetStateRetType = VersionState func getVersionGetStateAttributeTypeOk(arg VersionGetStateAttributeType) (ret VersionGetStateRetType, ok bool) { if arg == nil { diff --git a/services/kms/model_wrapping_key.go b/services/kms/model_wrapping_key.go index df845ac16..aa60b59cd 100644 --- a/services/kms/model_wrapping_key.go +++ b/services/kms/model_wrapping_key.go @@ -12,6 +12,7 @@ package kms import ( "encoding/json" + "fmt" "time" ) @@ -227,10 +228,114 @@ func setWrappingKeyGetPurposeAttributeType(arg *WrappingKeyGetPurposeAttributeTy types and functions for state */ -// isEnumRef -type WrappingKeyGetStateAttributeType = *string -type WrappingKeyGetStateArgType = string -type WrappingKeyGetStateRetType = string +//isEnum + +// WrappingKeyState The current state of the wrapping key. +type WrappingKeyState string + +// List of State +const ( + WRAPPINGKEYSTATE_ACTIVE WrappingKeyState = "active" + WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY WrappingKeyState = "key_material_not_ready" + WRAPPINGKEYSTATE_EXPIRED WrappingKeyState = "expired" + WRAPPINGKEYSTATE_DELETING WrappingKeyState = "deleting" +) + +// All allowed values of WrappingKey enum +var AllowedWrappingKeyStateEnumValues = []WrappingKeyState{ + "active", + "key_material_not_ready", + "expired", + "deleting", +} + +func (v *WrappingKeyState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := WrappingKeyState(value) + for _, existing := range AllowedWrappingKeyStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WrappingKey", value) +} + +// NewWrappingKeyStateFromValue returns a pointer to a valid WrappingKeyState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWrappingKeyStateFromValue(v string) (*WrappingKeyState, error) { + ev := WrappingKeyState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WrappingKeyState: valid values are %v", v, AllowedWrappingKeyStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WrappingKeyState) IsValid() bool { + for _, existing := range AllowedWrappingKeyStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v WrappingKeyState) Ptr() *WrappingKeyState { + return &v +} + +type NullableWrappingKeyState struct { + value *WrappingKeyState + isSet bool +} + +func (v NullableWrappingKeyState) Get() *WrappingKeyState { + return v.value +} + +func (v *NullableWrappingKeyState) Set(val *WrappingKeyState) { + v.value = val + v.isSet = true +} + +func (v NullableWrappingKeyState) IsSet() bool { + return v.isSet +} + +func (v *NullableWrappingKeyState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWrappingKeyState(val *WrappingKeyState) *NullableWrappingKeyState { + return &NullableWrappingKeyState{value: val, isSet: true} +} + +func (v NullableWrappingKeyState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWrappingKeyState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type WrappingKeyGetStateAttributeType = *WrappingKeyState +type WrappingKeyGetStateArgType = WrappingKeyState +type WrappingKeyGetStateRetType = WrappingKeyState func getWrappingKeyGetStateAttributeTypeOk(arg WrappingKeyGetStateAttributeType) (ret WrappingKeyGetStateRetType, ok bool) { if arg == nil { diff --git a/services/kms/wait/wait.go b/services/kms/wait/wait.go index c8cf02e08..046cfc8c4 100644 --- a/services/kms/wait/wait.go +++ b/services/kms/wait/wait.go @@ -12,24 +12,36 @@ import ( ) const ( - StatusKeyActive = "active" + // Deprecated: StatusKeyActive is deprecated and will be removed after 14th November 2025. Use [kms.KEYSTATE_ACTIVE] instead. + StatusKeyActive = "active" + // Deprecated: StatusKeyNotReady is deprecated and will be removed after 14th November 2025. Use [kms.KEYSTATE_VERSION_NOT_READY] instead. StatusKeyNotReady = "version_not_ready" - StatusKeyDeleted = "deleted" + // Deprecated: StatusKeyDeleted is deprecated and will be removed after 14th November 2025. Use [kms.KEYSTATE_DELETED] instead. + StatusKeyDeleted = "deleted" ) const ( - StatusKeyVersionActive = "active" + // Deprecated: StatusKeyVersionActive is deprecated and will be removed after 14th November 2025. Use [kms.VERSIONSTATE_ACTIVE] instead. + StatusKeyVersionActive = "active" + // Deprecated: StatusKeyVersionKeyMaterialNotReady is deprecated and will be removed after 14th November 2025. Use [kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY] instead. StatusKeyVersionKeyMaterialNotReady = "key_material_not_ready" - StatusKeyVersionKeyMaterialInvalid = "key_material_invalid" - StatusKeyVersionDisabled = "disabled" - StatusKeyVersionDestroyed = "destroyed" + // Deprecated: StatusKeyVersionKeyMaterialInvalid is deprecated and will be removed after 14th November 2025. Use [kms.VERSIONSTATE_KEY_MATERIAL_INVALID] instead. + StatusKeyVersionKeyMaterialInvalid = "key_material_invalid" + // Deprecated: StatusKeyVersionDisabled is deprecated and will be removed after 14th November 2025. Use [kms.VERSIONSTATE_DISABLED] instead. + StatusKeyVersionDisabled = "disabled" + // Deprecated: StatusKeyVersionDestroyed is deprecated and will be removed after 14th November 2025. Use [kms.VERSIONSTATE_DESTROYED] instead. + StatusKeyVersionDestroyed = "destroyed" ) const ( - StatusWrappingKeyActive = "active" + // Deprecated: StatusWrappingKeyActive is deprecated and will be removed after 12th November 2025. Use [kms.WRAPPINGKEYSTATE_ACTIVE] instead. + StatusWrappingKeyActive = "active" + // Deprecated: StatusWrappingKeyKeyMaterialNotReady is deprecated and will be removed after 12th November 2025. Use [kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY] instead. StatusWrappingKeyKeyMaterialNotReady = "key_material_not_ready" - StatusWrappingKeyExpired = "expired" - StatusWrappingKeyDeleting = "deleting" + // Deprecated: StatusWrappingKeyExpired is deprecated and will be removed after 12th November 2025. Use [kms.WRAPPINGKEYSTATE_EXPIRED] instead. + StatusWrappingKeyExpired = "expired" + // Deprecated: StatusWrappingKeyDeleting is deprecated and will be removed after 12th November 2025. Use [kms.WRAPPINGKEYSTATE_DELETING] instead. + StatusWrappingKeyDeleting = "deleting" ) type ApiKmsClient interface { @@ -47,7 +59,7 @@ func CreateOrUpdateKeyWaitHandler(ctx context.Context, client ApiKmsClient, proj if response.State != nil { switch *response.State { - case StatusKeyNotReady: + case kms.KEYSTATE_VERSION_NOT_READY: return false, nil, nil default: return true, response, nil @@ -87,13 +99,13 @@ func EnableKeyVersionWaitHandler(ctx context.Context, client ApiKmsClient, proje if response.State != nil { switch *response.State { - case StatusKeyVersionDestroyed: + case kms.VERSIONSTATE_DESTROYED: return true, response, nil - case StatusKeyVersionKeyMaterialInvalid: + case kms.VERSIONSTATE_KEY_MATERIAL_INVALID: return true, response, nil - case StatusKeyVersionDisabled: + case kms.VERSIONSTATE_DISABLED: return true, response, nil - case StatusKeyVersionKeyMaterialNotReady: + case kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY: return false, nil, nil default: return true, response, nil @@ -133,7 +145,7 @@ func CreateWrappingKeyWaitHandler(ctx context.Context, client ApiKmsClient, proj if state := response.State; state != nil { switch *state { - case StatusWrappingKeyKeyMaterialNotReady: + case kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY: return false, nil, nil default: return true, response, nil diff --git a/services/kms/wait/wait_test.go b/services/kms/wait/wait_test.go index d4bf5feca..2787bcc48 100644 --- a/services/kms/wait/wait_test.go +++ b/services/kms/wait/wait_test.go @@ -73,7 +73,7 @@ func (a *apiKmsMocked) GetKeyExecute(_ context.Context, _, _, _, _ string) (*kms return resp.key, resp.err } -func fixtureKey(state string) *kms.Key { +func fixtureKey(state kms.KeyState) *kms.Key { return &kms.Key{ Algorithm: kms.ALGORITHM_AES_256_GCM.Ptr(), Backend: kms.BACKEND_SOFTWARE.Ptr(), @@ -89,7 +89,7 @@ func fixtureKey(state string) *kms.Key { } } -func fixtureWrappingKey(state string) *kms.WrappingKey { +func fixtureWrappingKey(state kms.WrappingKeyState) *kms.WrappingKey { return &kms.WrappingKey{ Algorithm: kms.WRAPPINGALGORITHM__2048_OAEP_SHA256.Ptr(), Backend: kms.BACKEND_SOFTWARE.Ptr(), @@ -105,7 +105,7 @@ func fixtureWrappingKey(state string) *kms.WrappingKey { } } -func fixtureVersion(version int, disabled bool, state string) *kms.Version { +func fixtureVersion(version int, disabled bool, state kms.VersionState) *kms.Version { return &kms.Version{ CreatedAt: &testDate, DestroyDate: &testDate, @@ -128,37 +128,37 @@ func TestCreateOrUpdateKeyWaitHandler(t *testing.T) { { "create succeeded immediately", []keyResponse{ - {fixtureKey(StatusKeyActive), nil}, + {fixtureKey(kms.KEYSTATE_ACTIVE), nil}, }, - fixtureKey(StatusKeyActive), + fixtureKey(kms.KEYSTATE_ACTIVE), false, }, { "create succeeded delayed", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyActive), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_ACTIVE), nil}, }, - fixtureKey(StatusKeyActive), + fixtureKey(kms.KEYSTATE_ACTIVE), false, }, { "create failed delayed", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyDeleted), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_DELETED), nil}, }, - fixtureKey(StatusKeyDeleted), + fixtureKey(kms.KEYSTATE_DELETED), false, }, { "timeout", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, }, nil, true, @@ -212,9 +212,9 @@ func TestDeleteKeyWaitHandler(t *testing.T) { { "Delete with '404' delayed", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, {nil, oapierror.NewError(http.StatusNotFound, "not found")}, }, false, @@ -229,9 +229,9 @@ func TestDeleteKeyWaitHandler(t *testing.T) { { "Delete with 'gone' delayed", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, {nil, oapierror.NewError(http.StatusGone, "not found")}, }, false, @@ -239,21 +239,21 @@ func TestDeleteKeyWaitHandler(t *testing.T) { { "Delete with error delayed", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyDeleted), oapierror.NewError(http.StatusInternalServerError, "kapow")}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_DELETED), oapierror.NewError(http.StatusInternalServerError, "kapow")}, }, true, }, { "Cannot delete", []keyResponse{ - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyNotReady), nil}, - {fixtureKey(StatusKeyDeleted), oapierror.NewError(http.StatusOK, "ok")}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_VERSION_NOT_READY), nil}, + {fixtureKey(kms.KEYSTATE_DELETED), oapierror.NewError(http.StatusOK, "ok")}, }, true, }, @@ -292,37 +292,37 @@ func TestEnableKeyVersionWaitHandler(t *testing.T) { { "create succeeded immediately", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionActive), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_ACTIVE), nil}, }, - fixtureVersion(1, false, StatusKeyVersionActive), + fixtureVersion(1, false, kms.VERSIONSTATE_ACTIVE), false, }, { "create succeeded delayed", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionActive), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_ACTIVE), nil}, }, - fixtureVersion(1, false, StatusKeyVersionActive), + fixtureVersion(1, false, kms.VERSIONSTATE_ACTIVE), false, }, { "create failed delayed", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialInvalid), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_INVALID), nil}, }, - fixtureVersion(1, false, StatusKeyVersionKeyMaterialInvalid), + fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_INVALID), false, }, { "timeout", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, }, nil, true, @@ -376,9 +376,9 @@ func TestDisableKeyVersionWaitHandler(t *testing.T) { { "Delete with '404' delayed", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, {nil, oapierror.NewError(http.StatusNotFound, "not found")}, }, false, @@ -393,9 +393,9 @@ func TestDisableKeyVersionWaitHandler(t *testing.T) { { "Delete with 'gone' delayed", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, {nil, oapierror.NewError(http.StatusGone, "not found")}, }, false, @@ -403,21 +403,21 @@ func TestDisableKeyVersionWaitHandler(t *testing.T) { { "Delete with error delayed", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionDestroyed), oapierror.NewError(http.StatusInternalServerError, "kapow")}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_DESTROYED), oapierror.NewError(http.StatusInternalServerError, "kapow")}, }, true, }, { "Cannot delete", []versionResponse{ - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionKeyMaterialNotReady), nil}, - {fixtureVersion(1, false, StatusKeyVersionDestroyed), oapierror.NewError(http.StatusOK, "ok")}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureVersion(1, false, kms.VERSIONSTATE_DESTROYED), oapierror.NewError(http.StatusOK, "ok")}, }, true, }, @@ -456,37 +456,37 @@ func TestCreateWrappingWaitHandler(t *testing.T) { { "create succeeded immediately", []wrappingKeyResponse{ - {fixtureWrappingKey(StatusWrappingKeyActive), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_ACTIVE), nil}, }, - fixtureWrappingKey(StatusWrappingKeyActive), + fixtureWrappingKey(kms.WRAPPINGKEYSTATE_ACTIVE), false, }, { "create succeeded delayed", []wrappingKeyResponse{ - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, - {fixtureWrappingKey(StatusWrappingKeyActive), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_ACTIVE), nil}, }, - fixtureWrappingKey(StatusWrappingKeyActive), + fixtureWrappingKey(kms.WRAPPINGKEYSTATE_ACTIVE), false, }, { "create failed delayed", []wrappingKeyResponse{ - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, - {fixtureWrappingKey(StatusWrappingKeyDeleting), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_DELETING), nil}, }, - fixtureWrappingKey(StatusWrappingKeyDeleting), + fixtureWrappingKey(kms.WRAPPINGKEYSTATE_DELETING), false, }, { "timeout", []wrappingKeyResponse{ - {fixtureWrappingKey(StatusWrappingKeyKeyMaterialNotReady), nil}, + {fixtureWrappingKey(kms.WRAPPINGKEYSTATE_KEY_MATERIAL_NOT_READY), nil}, }, nil, true, diff --git a/services/lbapplication/CHANGELOG.md b/services/lbapplication/CHANGELOG.md index 099fa3b4b..054ba27a4 100644 --- a/services/lbapplication/CHANGELOG.md +++ b/services/lbapplication/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.4.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.3.0 (2025-02-21) - **New:** Minimal go version is now Go 1.21 diff --git a/services/lbapplication/api_default.go b/services/lbapplication/api_default.go index 8236caefc..a775a2b58 100644 --- a/services/lbapplication/api_default.go +++ b/services/lbapplication/api_default.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -159,7 +159,7 @@ func (r ApiCreateCredentialsRequest) Execute() (*CreateCredentialsResponse, erro /* CreateCredentials: Create credentials for observability of the application load balancer -Creates and stores credentials for use with Application Load Balancer Observability. +Deprecated: Creates and stores credentials for use with Application Load Balancer Observability. For example, when using ARGUS, credentials must first be created via the ARGUS API and then stored with this endpoint to be used by the Application Load Balancer. @@ -176,6 +176,12 @@ func (a *APIClient) CreateCredentials(ctx context.Context, projectId string) Api } } +/* +Deprecated: Creates and stores credentials for use with Application Load Balancer Observability. + + For example, when using ARGUS, credentials must first be created via the ARGUS API + and then stored with this endpoint to be used by the Application Load Balancer. +*/ func (a *APIClient) CreateCredentialsExecute(ctx context.Context, projectId string) (*CreateCredentialsResponse, error) { r := ApiCreateCredentialsRequest{ apiService: a.defaultApi, @@ -318,7 +324,7 @@ func (r ApiCreateLoadBalancerRequest) Execute() (*LoadBalancer, error) { /* CreateLoadBalancer: Create an application load balancer in a project -Creates an Application Load Balancer. +Deprecated: Creates an Application Load Balancer. The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. @@ -334,6 +340,11 @@ func (a *APIClient) CreateLoadBalancer(ctx context.Context, projectId string) Ap } } +/* +Deprecated: Creates an Application Load Balancer. + + The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. +*/ func (a *APIClient) CreateLoadBalancerExecute(ctx context.Context, projectId string) (*LoadBalancer, error) { r := ApiCreateLoadBalancerRequest{ apiService: a.defaultApi, @@ -458,7 +469,7 @@ func (r ApiDeleteCredentialsRequest) Execute() (map[string]interface{}, error) { /* DeleteCredentials: Delete a single credential in a project. -Deletes the stored Observability credentials. +Deprecated: Deletes the stored Observability credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -474,6 +485,9 @@ func (a *APIClient) DeleteCredentials(ctx context.Context, projectId string, cre } } +/* +Deprecated: Deletes the stored Observability credentials. +*/ func (a *APIClient) DeleteCredentialsExecute(ctx context.Context, projectId string, credentialsRef string) (map[string]interface{}, error) { r := ApiDeleteCredentialsRequest{ apiService: a.defaultApi, @@ -599,7 +613,7 @@ func (r ApiDeleteLoadBalancerRequest) Execute() (map[string]interface{}, error) /* DeleteLoadBalancer: Delete a given load balancer in a project. -Deletes the specified Application Load Balancer. +Deprecated: Deletes the specified Application Load Balancer. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -615,6 +629,9 @@ func (a *APIClient) DeleteLoadBalancer(ctx context.Context, projectId string, na } } +/* +Deprecated: Deletes the specified Application Load Balancer. +*/ func (a *APIClient) DeleteLoadBalancerExecute(ctx context.Context, projectId string, name string) (map[string]interface{}, error) { r := ApiDeleteLoadBalancerRequest{ apiService: a.defaultApi, @@ -1037,7 +1054,7 @@ func (r ApiGetCredentialsRequest) Execute() (*GetCredentialsResponse, error) { /* GetCredentials: Get a single credential reference in a project. -Gets the stored Observability credentials. +Deprecated: Gets the stored Observability credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -1053,6 +1070,9 @@ func (a *APIClient) GetCredentials(ctx context.Context, projectId string, creden } } +/* +Deprecated: Gets the stored Observability credentials. +*/ func (a *APIClient) GetCredentialsExecute(ctx context.Context, projectId string, credentialsRef string) (*GetCredentialsResponse, error) { r := ApiGetCredentialsRequest{ apiService: a.defaultApi, @@ -1178,7 +1198,7 @@ func (r ApiGetLoadBalancerRequest) Execute() (*LoadBalancer, error) { /* GetLoadBalancer: Get a single application load balancer in a project. -Retrieves details of a specific Application Load Balancer in a project. +Deprecated: Retrieves details of a specific Application Load Balancer in a project. Includes creation and update information, current status, and any error descriptions. @@ -1196,6 +1216,11 @@ func (a *APIClient) GetLoadBalancer(ctx context.Context, projectId string, name } } +/* +Deprecated: Retrieves details of a specific Application Load Balancer in a project. + + Includes creation and update information, current status, and any error descriptions. +*/ func (a *APIClient) GetLoadBalancerExecute(ctx context.Context, projectId string, name string) (*LoadBalancer, error) { r := ApiGetLoadBalancerRequest{ apiService: a.defaultApi, @@ -1319,7 +1344,7 @@ func (r ApiGetQuotaRequest) Execute() (*GetQuotaResponse, error) { /* GetQuota: Get the quota of application load balancers and target pools in a project. -Retrieves the configured Application Load Balancer quota for the project. +Deprecated: Retrieves the configured Application Load Balancer quota for the project. The default quota is 3. @@ -1335,6 +1360,11 @@ func (a *APIClient) GetQuota(ctx context.Context, projectId string) ApiGetQuotaR } } +/* +Deprecated: Retrieves the configured Application Load Balancer quota for the project. + + The default quota is 3. +*/ func (a *APIClient) GetQuotaExecute(ctx context.Context, projectId string) (*GetQuotaResponse, error) { r := ApiGetQuotaRequest{ apiService: a.defaultApi, @@ -1600,7 +1630,7 @@ func (r ApiListCredentialsRequest) Execute() (*ListCredentialsResponse, error) { /* ListCredentials: List all credentials in a project. -Lists the stored Observability credentials. +Deprecated: Lists the stored Observability credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -1614,6 +1644,9 @@ func (a *APIClient) ListCredentials(ctx context.Context, projectId string) ApiLi } } +/* +Deprecated: Lists the stored Observability credentials. +*/ func (a *APIClient) ListCredentialsExecute(ctx context.Context, projectId string) (*ListCredentialsResponse, error) { r := ApiListCredentialsRequest{ apiService: a.defaultApi, @@ -1758,7 +1791,7 @@ func (r ApiListLoadBalancersRequest) Execute() (*ListLoadBalancersResponse, erro /* ListLoadBalancers: List load balancers in a project. -Lists all Application Load Balancers in a project. +Deprecated: Lists all Application Load Balancers in a project. Includes details from creation or updates, along with their status and any error descriptions. @@ -1774,6 +1807,11 @@ func (a *APIClient) ListLoadBalancers(ctx context.Context, projectId string) Api } } +/* +Deprecated: Lists all Application Load Balancers in a project. + + Includes details from creation or updates, along with their status and any error descriptions. +*/ func (a *APIClient) ListLoadBalancersExecute(ctx context.Context, projectId string) (*ListLoadBalancersResponse, error) { r := ApiListLoadBalancersRequest{ apiService: a.defaultApi, @@ -1894,7 +1932,7 @@ func (r ApiListPlansRequest) Execute() (*ListPlansResponse, error) { /* ListPlans: List available service plans. -Lists the configured service plans for a project. +Deprecated: Lists the configured service plans for a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiListPlansRequest @@ -1906,6 +1944,9 @@ func (a *APIClient) ListPlans(ctx context.Context) ApiListPlansRequest { } } +/* +Deprecated: Lists the configured service plans for a project. +*/ func (a *APIClient) ListPlansExecute(ctx context.Context) (*ListPlansResponse, error) { r := ApiListPlansRequest{ apiService: a.defaultApi, @@ -2040,7 +2081,7 @@ func (r ApiUpdateCredentialsRequest) Execute() (*UpdateCredentialsResponse, erro /* UpdateCredentials: Update credentials for observability in a project. -Updates the stored Observability credentials. +Deprecated: Updates the stored Observability credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -2056,6 +2097,9 @@ func (a *APIClient) UpdateCredentials(ctx context.Context, projectId string, cre } } +/* +Deprecated: Updates the stored Observability credentials. +*/ func (a *APIClient) UpdateCredentialsExecute(ctx context.Context, projectId string, credentialsRef string) (*UpdateCredentialsResponse, error) { r := ApiUpdateCredentialsRequest{ apiService: a.defaultApi, @@ -2192,7 +2236,7 @@ func (r ApiUpdateLoadBalancerRequest) Execute() (*LoadBalancer, error) { /* UpdateLoadBalancer: Update a load balancer in a project. -Updates an existing Application Load Balancer by modifying its listeners and target pools. +Deprecated: Updates an existing Application Load Balancer by modifying its listeners and target pools. Ensure the resource version is current to maintain concurrency safety. The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. @@ -2211,6 +2255,12 @@ func (a *APIClient) UpdateLoadBalancer(ctx context.Context, projectId string, na } } +/* +Deprecated: Updates an existing Application Load Balancer by modifying its listeners and target pools. + + Ensure the resource version is current to maintain concurrency safety. + The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. +*/ func (a *APIClient) UpdateLoadBalancerExecute(ctx context.Context, projectId string, name string) (*LoadBalancer, error) { r := ApiUpdateLoadBalancerRequest{ apiService: a.defaultApi, @@ -2349,7 +2399,7 @@ func (r ApiUpdateTargetPoolRequest) Execute() (*TargetPool, error) { /* UpdateTargetPool: Update a single target pool of a load balancer in a project. -Replaces the content of a specific target pool in the Application Load Balancer (useful for adding or removing target servers). +Deprecated: Replaces the content of a specific target pool in the Application Load Balancer (useful for adding or removing target servers). Only updates the specified target pool, leaving others unchanged. Cannot be used to create or rename target pools. @@ -2370,6 +2420,12 @@ func (a *APIClient) UpdateTargetPool(ctx context.Context, projectId string, name } } +/* +Deprecated: Replaces the content of a specific target pool in the Application Load Balancer (useful for adding or removing target servers). + + Only updates the specified target pool, leaving others unchanged. + Cannot be used to create or rename target pools. +*/ func (a *APIClient) UpdateTargetPoolExecute(ctx context.Context, projectId string, name string, targetPoolName string) (*TargetPool, error) { r := ApiUpdateTargetPoolRequest{ apiService: a.defaultApi, diff --git a/services/lbapplication/api_default_test.go b/services/lbapplication/api_default_test.go index 375b523ef..be03bebde 100644 --- a/services/lbapplication/api_default_test.go +++ b/services/lbapplication/api_default_test.go @@ -25,7 +25,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -78,7 +78,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/load-balancers" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -131,9 +131,9 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/credentials/{credentialsRef}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - credentialsRefValue := "credentialsRef" + credentialsRefValue := "credentialsRef-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -186,9 +186,9 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/load-balancers/{name}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -241,7 +241,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DisableService", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -293,7 +293,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService EnableService", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -345,9 +345,9 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/credentials/{credentialsRef}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - credentialsRefValue := "credentialsRef" + credentialsRefValue := "credentialsRef-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -400,9 +400,9 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/load-balancers/{name}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -455,7 +455,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetQuota", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/quota" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -507,7 +507,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetServiceStatus", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -559,7 +559,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -611,7 +611,7 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListLoadBalancers", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/load-balancers" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -711,9 +711,9 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateCredentials", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/credentials/{credentialsRef}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - credentialsRefValue := "credentialsRef" + credentialsRefValue := "credentialsRef-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -767,9 +767,9 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/load-balancers/{name}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -823,11 +823,11 @@ func Test_lbapplication_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateTargetPool", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/load-balancers/{name}/target-pools/{targetPoolName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) - targetPoolNameValue := "targetPoolName" + targetPoolNameValue := "targetPoolName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"targetPoolName"+"}", url.PathEscape(ParameterValueToString(targetPoolNameValue, "targetPoolName")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/lbapplication/client.go b/services/lbapplication/client.go index 79406adb6..1fe66a02f 100644 --- a/services/lbapplication/client.go +++ b/services/lbapplication/client.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/lbapplication/configuration.go b/services/lbapplication/configuration.go index 23ba6d090..697bcaaef 100644 --- a/services/lbapplication/configuration.go +++ b/services/lbapplication/configuration.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -18,7 +18,7 @@ import ( func NewConfiguration() *config.Configuration { cfg := &config.Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", + UserAgent: "stackit-sdk-go/lbapplication", Debug: false, Servers: config.ServerConfigurations{ { diff --git a/services/lbapplication/model_active_health_check.go b/services/lbapplication/model_active_health_check.go index 3409a88fc..30ec1732e 100644 --- a/services/lbapplication/model_active_health_check.go +++ b/services/lbapplication/model_active_health_check.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_certificate_config.go b/services/lbapplication/model_certificate_config.go index b1ae159a3..fa1794bfc 100644 --- a/services/lbapplication/model_certificate_config.go +++ b/services/lbapplication/model_certificate_config.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_cookie_persistence.go b/services/lbapplication/model_cookie_persistence.go index f0d511aec..860a8dbd9 100644 --- a/services/lbapplication/model_cookie_persistence.go +++ b/services/lbapplication/model_cookie_persistence.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_create_credentials_payload.go b/services/lbapplication/model_create_credentials_payload.go index e78fd80c1..2f72fad02 100644 --- a/services/lbapplication/model_create_credentials_payload.go +++ b/services/lbapplication/model_create_credentials_payload.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_create_credentials_response.go b/services/lbapplication/model_create_credentials_response.go index 864519caa..330180a68 100644 --- a/services/lbapplication/model_create_credentials_response.go +++ b/services/lbapplication/model_create_credentials_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_create_load_balancer_payload.go b/services/lbapplication/model_create_load_balancer_payload.go index facc96954..d7e39c7de 100644 --- a/services/lbapplication/model_create_load_balancer_payload.go +++ b/services/lbapplication/model_create_load_balancer_payload.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the CreateLoadBalancerPayload type satisfies the MappedNullable interface at compile time @@ -185,10 +186,116 @@ type CreateLoadBalancerPayloadGetPrivateAddressRetType = string types and functions for status */ -// isEnumRef -type CreateLoadBalancerPayloadGetStatusAttributeType = *string -type CreateLoadBalancerPayloadGetStatusArgType = string -type CreateLoadBalancerPayloadGetStatusRetType = string +//isEnum + +// CreateLoadBalancerPayloadStatus the model 'CreateLoadBalancerPayload' +type CreateLoadBalancerPayloadStatus string + +// List of Status +const ( + CREATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED CreateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + CREATELOADBALANCERPAYLOADSTATUS_PENDING CreateLoadBalancerPayloadStatus = "STATUS_PENDING" + CREATELOADBALANCERPAYLOADSTATUS_READY CreateLoadBalancerPayloadStatus = "STATUS_READY" + CREATELOADBALANCERPAYLOADSTATUS_ERROR CreateLoadBalancerPayloadStatus = "STATUS_ERROR" + CREATELOADBALANCERPAYLOADSTATUS_TERMINATING CreateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of CreateLoadBalancerPayload enum +var AllowedCreateLoadBalancerPayloadStatusEnumValues = []CreateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *CreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateLoadBalancerPayload", value) +} + +// NewCreateLoadBalancerPayloadStatusFromValue returns a pointer to a valid CreateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateLoadBalancerPayloadStatusFromValue(v string) (*CreateLoadBalancerPayloadStatus, error) { + ev := CreateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateLoadBalancerPayloadStatus: valid values are %v", v, AllowedCreateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CreateLoadBalancerPayloadStatus) Ptr() *CreateLoadBalancerPayloadStatus { + return &v +} + +type NullableCreateLoadBalancerPayloadStatus struct { + value *CreateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadStatus) Get() *CreateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Set(val *CreateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadStatus(val *CreateLoadBalancerPayloadStatus) *NullableCreateLoadBalancerPayloadStatus { + return &NullableCreateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateLoadBalancerPayloadGetStatusAttributeType = *CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusArgType = CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusRetType = CreateLoadBalancerPayloadStatus func getCreateLoadBalancerPayloadGetStatusAttributeTypeOk(arg CreateLoadBalancerPayloadGetStatusAttributeType) (ret CreateLoadBalancerPayloadGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_credentials_response.go b/services/lbapplication/model_credentials_response.go index 520cf5748..2b72d0295 100644 --- a/services/lbapplication/model_credentials_response.go +++ b/services/lbapplication/model_credentials_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_get_credentials_response.go b/services/lbapplication/model_get_credentials_response.go index 354b235cc..1dd649319 100644 --- a/services/lbapplication/model_get_credentials_response.go +++ b/services/lbapplication/model_get_credentials_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_get_quota_response.go b/services/lbapplication/model_get_quota_response.go index 91b0a48c7..0bc438008 100644 --- a/services/lbapplication/model_get_quota_response.go +++ b/services/lbapplication/model_get_quota_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_get_service_status_response.go b/services/lbapplication/model_get_service_status_response.go index ef55edb39..7f1d45a6c 100644 --- a/services/lbapplication/model_get_service_status_response.go +++ b/services/lbapplication/model_get_service_status_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the GetServiceStatusResponse type satisfies the MappedNullable interface at compile time @@ -21,10 +22,120 @@ var _ MappedNullable = &GetServiceStatusResponse{} types and functions for status */ -// isEnumRef -type GetServiceStatusResponseGetStatusAttributeType = *string -type GetServiceStatusResponseGetStatusArgType = string -type GetServiceStatusResponseGetStatusRetType = string +//isEnum + +// GetServiceStatusResponseStatus status of the project +type GetServiceStatusResponseStatus string + +// List of Status +const ( + GETSERVICESTATUSRESPONSESTATUS_UNSPECIFIED GetServiceStatusResponseStatus = "STATUS_UNSPECIFIED" + GETSERVICESTATUSRESPONSESTATUS_READY GetServiceStatusResponseStatus = "STATUS_READY" + GETSERVICESTATUSRESPONSESTATUS_FAILED GetServiceStatusResponseStatus = "STATUS_FAILED" + GETSERVICESTATUSRESPONSESTATUS_UPDATING GetServiceStatusResponseStatus = "STATUS_UPDATING" + GETSERVICESTATUSRESPONSESTATUS_DELETING GetServiceStatusResponseStatus = "STATUS_DELETING" + GETSERVICESTATUSRESPONSESTATUS_DISABLED GetServiceStatusResponseStatus = "STATUS_DISABLED" + GETSERVICESTATUSRESPONSESTATUS_PROJECT_UNKNOWN GetServiceStatusResponseStatus = "STATUS_PROJECT_UNKNOWN" +) + +// All allowed values of GetServiceStatusResponse enum +var AllowedGetServiceStatusResponseStatusEnumValues = []GetServiceStatusResponseStatus{ + "STATUS_UNSPECIFIED", + "STATUS_READY", + "STATUS_FAILED", + "STATUS_UPDATING", + "STATUS_DELETING", + "STATUS_DISABLED", + "STATUS_PROJECT_UNKNOWN", +} + +func (v *GetServiceStatusResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetServiceStatusResponseStatus(value) + for _, existing := range AllowedGetServiceStatusResponseStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetServiceStatusResponse", value) +} + +// NewGetServiceStatusResponseStatusFromValue returns a pointer to a valid GetServiceStatusResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetServiceStatusResponseStatusFromValue(v string) (*GetServiceStatusResponseStatus, error) { + ev := GetServiceStatusResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetServiceStatusResponseStatus: valid values are %v", v, AllowedGetServiceStatusResponseStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetServiceStatusResponseStatus) IsValid() bool { + for _, existing := range AllowedGetServiceStatusResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v GetServiceStatusResponseStatus) Ptr() *GetServiceStatusResponseStatus { + return &v +} + +type NullableGetServiceStatusResponseStatus struct { + value *GetServiceStatusResponseStatus + isSet bool +} + +func (v NullableGetServiceStatusResponseStatus) Get() *GetServiceStatusResponseStatus { + return v.value +} + +func (v *NullableGetServiceStatusResponseStatus) Set(val *GetServiceStatusResponseStatus) { + v.value = val + v.isSet = true +} + +func (v NullableGetServiceStatusResponseStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServiceStatusResponseStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServiceStatusResponseStatus(val *GetServiceStatusResponseStatus) *NullableGetServiceStatusResponseStatus { + return &NullableGetServiceStatusResponseStatus{value: val, isSet: true} +} + +func (v NullableGetServiceStatusResponseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServiceStatusResponseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetServiceStatusResponseGetStatusAttributeType = *GetServiceStatusResponseStatus +type GetServiceStatusResponseGetStatusArgType = GetServiceStatusResponseStatus +type GetServiceStatusResponseGetStatusRetType = GetServiceStatusResponseStatus func getGetServiceStatusResponseGetStatusAttributeTypeOk(arg GetServiceStatusResponseGetStatusAttributeType) (ret GetServiceStatusResponseGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_google_protobuf_any.go b/services/lbapplication/model_google_protobuf_any.go index b12eb82c1..1499863b5 100644 --- a/services/lbapplication/model_google_protobuf_any.go +++ b/services/lbapplication/model_google_protobuf_any.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_header.go b/services/lbapplication/model_header.go index 34a076b57..857c2f26c 100644 --- a/services/lbapplication/model_header.go +++ b/services/lbapplication/model_header.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_http_config.go b/services/lbapplication/model_http_config.go index ac5348237..976e19091 100644 --- a/services/lbapplication/model_http_config.go +++ b/services/lbapplication/model_http_config.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_http_health_checks.go b/services/lbapplication/model_http_health_checks.go index 3eecfd884..8efdf3fa7 100644 --- a/services/lbapplication/model_http_health_checks.go +++ b/services/lbapplication/model_http_health_checks.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_list_credentials_response.go b/services/lbapplication/model_list_credentials_response.go index 2b6a06e19..91c40df57 100644 --- a/services/lbapplication/model_list_credentials_response.go +++ b/services/lbapplication/model_list_credentials_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_list_load_balancers_response.go b/services/lbapplication/model_list_load_balancers_response.go index f6084c135..ef4bfcf96 100644 --- a/services/lbapplication/model_list_load_balancers_response.go +++ b/services/lbapplication/model_list_load_balancers_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_list_plans_response.go b/services/lbapplication/model_list_plans_response.go index 1baf5d189..f9663c31d 100644 --- a/services/lbapplication/model_list_plans_response.go +++ b/services/lbapplication/model_list_plans_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_listener.go b/services/lbapplication/model_listener.go index 07456a62f..c2633089e 100644 --- a/services/lbapplication/model_listener.go +++ b/services/lbapplication/model_listener.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the Listener type satisfies the MappedNullable interface at compile time @@ -123,10 +124,112 @@ func setListenerGetPortAttributeType(arg *ListenerGetPortAttributeType, val List types and functions for protocol */ -// isEnumRef -type ListenerGetProtocolAttributeType = *string -type ListenerGetProtocolArgType = string -type ListenerGetProtocolRetType = string +//isEnum + +// ListenerProtocol Protocol is the highest network protocol we understand to load balance. Currently PROTOCOL_HTTP and PROTOCOL_HTTPS are supported. +type ListenerProtocol string + +// List of Protocol +const ( + LISTENERPROTOCOL_UNSPECIFIED ListenerProtocol = "PROTOCOL_UNSPECIFIED" + LISTENERPROTOCOL_HTTP ListenerProtocol = "PROTOCOL_HTTP" + LISTENERPROTOCOL_HTTPS ListenerProtocol = "PROTOCOL_HTTPS" +) + +// All allowed values of Listener enum +var AllowedListenerProtocolEnumValues = []ListenerProtocol{ + "PROTOCOL_UNSPECIFIED", + "PROTOCOL_HTTP", + "PROTOCOL_HTTPS", +} + +func (v *ListenerProtocol) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ListenerProtocol(value) + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Listener", value) +} + +// NewListenerProtocolFromValue returns a pointer to a valid ListenerProtocol +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListenerProtocolFromValue(v string) (*ListenerProtocol, error) { + ev := ListenerProtocol(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListenerProtocol: valid values are %v", v, AllowedListenerProtocolEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListenerProtocol) IsValid() bool { + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProtocolProtocol value +func (v ListenerProtocol) Ptr() *ListenerProtocol { + return &v +} + +type NullableListenerProtocol struct { + value *ListenerProtocol + isSet bool +} + +func (v NullableListenerProtocol) Get() *ListenerProtocol { + return v.value +} + +func (v *NullableListenerProtocol) Set(val *ListenerProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableListenerProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableListenerProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListenerProtocol(val *ListenerProtocol) *NullableListenerProtocol { + return &NullableListenerProtocol{value: val, isSet: true} +} + +func (v NullableListenerProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListenerProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ListenerGetProtocolAttributeType = *ListenerProtocol +type ListenerGetProtocolArgType = ListenerProtocol +type ListenerGetProtocolRetType = ListenerProtocol func getListenerGetProtocolAttributeTypeOk(arg ListenerGetProtocolAttributeType) (ret ListenerGetProtocolRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_load_balancer.go b/services/lbapplication/model_load_balancer.go index 6b639f36f..f8ba6b552 100644 --- a/services/lbapplication/model_load_balancer.go +++ b/services/lbapplication/model_load_balancer.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the LoadBalancer type satisfies the MappedNullable interface at compile time @@ -185,10 +186,116 @@ type LoadBalancerGetPrivateAddressRetType = string types and functions for status */ -// isEnumRef -type LoadBalancerGetStatusAttributeType = *string -type LoadBalancerGetStatusArgType = string -type LoadBalancerGetStatusRetType = string +//isEnum + +// LoadBalancerStatus the model 'LoadBalancer' +type LoadBalancerStatus string + +// List of Status +const ( + LOADBALANCERSTATUS_UNSPECIFIED LoadBalancerStatus = "STATUS_UNSPECIFIED" + LOADBALANCERSTATUS_PENDING LoadBalancerStatus = "STATUS_PENDING" + LOADBALANCERSTATUS_READY LoadBalancerStatus = "STATUS_READY" + LOADBALANCERSTATUS_ERROR LoadBalancerStatus = "STATUS_ERROR" + LOADBALANCERSTATUS_TERMINATING LoadBalancerStatus = "STATUS_TERMINATING" +) + +// All allowed values of LoadBalancer enum +var AllowedLoadBalancerStatusEnumValues = []LoadBalancerStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *LoadBalancerStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerStatus(value) + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancer", value) +} + +// NewLoadBalancerStatusFromValue returns a pointer to a valid LoadBalancerStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerStatusFromValue(v string) (*LoadBalancerStatus, error) { + ev := LoadBalancerStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerStatus: valid values are %v", v, AllowedLoadBalancerStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerStatus) IsValid() bool { + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v LoadBalancerStatus) Ptr() *LoadBalancerStatus { + return &v +} + +type NullableLoadBalancerStatus struct { + value *LoadBalancerStatus + isSet bool +} + +func (v NullableLoadBalancerStatus) Get() *LoadBalancerStatus { + return v.value +} + +func (v *NullableLoadBalancerStatus) Set(val *LoadBalancerStatus) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerStatus(val *LoadBalancerStatus) *NullableLoadBalancerStatus { + return &NullableLoadBalancerStatus{value: val, isSet: true} +} + +func (v NullableLoadBalancerStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerGetStatusAttributeType = *LoadBalancerStatus +type LoadBalancerGetStatusArgType = LoadBalancerStatus +type LoadBalancerGetStatusRetType = LoadBalancerStatus func getLoadBalancerGetStatusAttributeTypeOk(arg LoadBalancerGetStatusAttributeType) (ret LoadBalancerGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_load_balancer_error.go b/services/lbapplication/model_load_balancer_error.go index c2bc60efb..587b87846 100644 --- a/services/lbapplication/model_load_balancer_error.go +++ b/services/lbapplication/model_load_balancer_error.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the LoadBalancerError type satisfies the MappedNullable interface at compile time @@ -42,10 +43,124 @@ type LoadBalancerErrorGetDescriptionRetType = string types and functions for type */ -// isEnumRef -type LoadBalancerErrorGetTypeAttributeType = *string -type LoadBalancerErrorGetTypeArgType = string -type LoadBalancerErrorGetTypeRetType = string +//isEnum + +// LoadBalancerErrorTypes The error type specifies which part of the application load balancer encountered the error. I.e. the API will not check if a provided public IP is actually available in the project. Instead the application load balancer with try to use the provided IP and if not available reports TYPE_FIP_NOT_CONFIGURED error. +type LoadBalancerErrorTypes string + +// List of Type +const ( + LOADBALANCERERRORTYPE_UNSPECIFIED LoadBalancerErrorTypes = "TYPE_UNSPECIFIED" + LOADBALANCERERRORTYPE_INTERNAL LoadBalancerErrorTypes = "TYPE_INTERNAL" + LOADBALANCERERRORTYPE_QUOTA_SECGROUP_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUP_EXCEEDED" + LOADBALANCERERRORTYPE_QUOTA_SECGROUPRULE_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUPRULE_EXCEEDED" + LOADBALANCERERRORTYPE_PORT_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_PORT_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_FIP_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_FIP_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_TARGET_NOT_ACTIVE LoadBalancerErrorTypes = "TYPE_TARGET_NOT_ACTIVE" + LOADBALANCERERRORTYPE_METRICS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_METRICS_MISCONFIGURED" + LOADBALANCERERRORTYPE_LOGS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_LOGS_MISCONFIGURED" +) + +// All allowed values of LoadBalancerError enum +var AllowedLoadBalancerErrorTypesEnumValues = []LoadBalancerErrorTypes{ + "TYPE_UNSPECIFIED", + "TYPE_INTERNAL", + "TYPE_QUOTA_SECGROUP_EXCEEDED", + "TYPE_QUOTA_SECGROUPRULE_EXCEEDED", + "TYPE_PORT_NOT_CONFIGURED", + "TYPE_FIP_NOT_CONFIGURED", + "TYPE_TARGET_NOT_ACTIVE", + "TYPE_METRICS_MISCONFIGURED", + "TYPE_LOGS_MISCONFIGURED", +} + +func (v *LoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerErrorTypes(value) + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancerError", value) +} + +// NewLoadBalancerErrorTypesFromValue returns a pointer to a valid LoadBalancerErrorTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerErrorTypesFromValue(v string) (*LoadBalancerErrorTypes, error) { + ev := LoadBalancerErrorTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerErrorTypes: valid values are %v", v, AllowedLoadBalancerErrorTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerErrorTypes) IsValid() bool { + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v LoadBalancerErrorTypes) Ptr() *LoadBalancerErrorTypes { + return &v +} + +type NullableLoadBalancerErrorTypes struct { + value *LoadBalancerErrorTypes + isSet bool +} + +func (v NullableLoadBalancerErrorTypes) Get() *LoadBalancerErrorTypes { + return v.value +} + +func (v *NullableLoadBalancerErrorTypes) Set(val *LoadBalancerErrorTypes) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerErrorTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerErrorTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerErrorTypes(val *LoadBalancerErrorTypes) *NullableLoadBalancerErrorTypes { + return &NullableLoadBalancerErrorTypes{value: val, isSet: true} +} + +func (v NullableLoadBalancerErrorTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerErrorGetTypeAttributeType = *LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeArgType = LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeRetType = LoadBalancerErrorTypes func getLoadBalancerErrorGetTypeAttributeTypeOk(arg LoadBalancerErrorGetTypeAttributeType) (ret LoadBalancerErrorGetTypeRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_load_balancer_options.go b/services/lbapplication/model_load_balancer_options.go index 82c0cc6ec..511087fdb 100644 --- a/services/lbapplication/model_load_balancer_options.go +++ b/services/lbapplication/model_load_balancer_options.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_loadbalancer_option_access_control.go b/services/lbapplication/model_loadbalancer_option_access_control.go index 7c2fde916..d73c79df5 100644 --- a/services/lbapplication/model_loadbalancer_option_access_control.go +++ b/services/lbapplication/model_loadbalancer_option_access_control.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_loadbalancer_option_logs.go b/services/lbapplication/model_loadbalancer_option_logs.go index 096ffd401..a39e8cde2 100644 --- a/services/lbapplication/model_loadbalancer_option_logs.go +++ b/services/lbapplication/model_loadbalancer_option_logs.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_loadbalancer_option_metrics.go b/services/lbapplication/model_loadbalancer_option_metrics.go index 7ac5264e5..2f920f295 100644 --- a/services/lbapplication/model_loadbalancer_option_metrics.go +++ b/services/lbapplication/model_loadbalancer_option_metrics.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_loadbalancer_option_observability.go b/services/lbapplication/model_loadbalancer_option_observability.go index a5d70dab4..9d5ca9a02 100644 --- a/services/lbapplication/model_loadbalancer_option_observability.go +++ b/services/lbapplication/model_loadbalancer_option_observability.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_matcher.go b/services/lbapplication/model_matcher.go index 0f205209e..932160319 100644 --- a/services/lbapplication/model_matcher.go +++ b/services/lbapplication/model_matcher.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_network.go b/services/lbapplication/model_network.go index e1e10317d..4bbc3c54b 100644 --- a/services/lbapplication/model_network.go +++ b/services/lbapplication/model_network.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the Network type satisfies the MappedNullable interface at compile time @@ -42,10 +43,114 @@ type NetworkGetNetworkIdRetType = string types and functions for role */ -// isEnumRef -type NetworkGetRoleAttributeType = *string -type NetworkGetRoleArgType = string -type NetworkGetRoleRetType = string +//isEnum + +// NetworkRole The role defines how the Application Load Balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported. +type NetworkRole string + +// List of Role +const ( + NETWORKROLE_UNSPECIFIED NetworkRole = "ROLE_UNSPECIFIED" + NETWORKROLE_LISTENERS_AND_TARGETS NetworkRole = "ROLE_LISTENERS_AND_TARGETS" + NETWORKROLE_LISTENERS NetworkRole = "ROLE_LISTENERS" + NETWORKROLE_TARGETS NetworkRole = "ROLE_TARGETS" +) + +// All allowed values of Network enum +var AllowedNetworkRoleEnumValues = []NetworkRole{ + "ROLE_UNSPECIFIED", + "ROLE_LISTENERS_AND_TARGETS", + "ROLE_LISTENERS", + "ROLE_TARGETS", +} + +func (v *NetworkRole) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := NetworkRole(value) + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Network", value) +} + +// NewNetworkRoleFromValue returns a pointer to a valid NetworkRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewNetworkRoleFromValue(v string) (*NetworkRole, error) { + ev := NetworkRole(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for NetworkRole: valid values are %v", v, AllowedNetworkRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v NetworkRole) IsValid() bool { + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RoleRole value +func (v NetworkRole) Ptr() *NetworkRole { + return &v +} + +type NullableNetworkRole struct { + value *NetworkRole + isSet bool +} + +func (v NullableNetworkRole) Get() *NetworkRole { + return v.value +} + +func (v *NullableNetworkRole) Set(val *NetworkRole) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRole) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRole(val *NetworkRole) *NullableNetworkRole { + return &NullableNetworkRole{value: val, isSet: true} +} + +func (v NullableNetworkRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NetworkGetRoleAttributeType = *NetworkRole +type NetworkGetRoleArgType = NetworkRole +type NetworkGetRoleRetType = NetworkRole func getNetworkGetRoleAttributeTypeOk(arg NetworkGetRoleAttributeType) (ret NetworkGetRoleRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_plan_details.go b/services/lbapplication/model_plan_details.go index 3fb2540d6..60de37ecd 100644 --- a/services/lbapplication/model_plan_details.go +++ b/services/lbapplication/model_plan_details.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_protocol_options_https.go b/services/lbapplication/model_protocol_options_https.go index 8fa733e81..e4713421b 100644 --- a/services/lbapplication/model_protocol_options_https.go +++ b/services/lbapplication/model_protocol_options_https.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_query_parameters.go b/services/lbapplication/model_query_parameters.go index fcb915944..0c856ca9a 100644 --- a/services/lbapplication/model_query_parameters.go +++ b/services/lbapplication/model_query_parameters.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_rule.go b/services/lbapplication/model_rule.go index f45d20b8e..fa905b6f6 100644 --- a/services/lbapplication/model_rule.go +++ b/services/lbapplication/model_rule.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_status.go b/services/lbapplication/model_status.go index 34384841c..b07b44184 100644 --- a/services/lbapplication/model_status.go +++ b/services/lbapplication/model_status.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_target.go b/services/lbapplication/model_target.go index bc5cedc3e..18193ae3d 100644 --- a/services/lbapplication/model_target.go +++ b/services/lbapplication/model_target.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_target_pool.go b/services/lbapplication/model_target_pool.go index 296d73caf..10e913b2f 100644 --- a/services/lbapplication/model_target_pool.go +++ b/services/lbapplication/model_target_pool.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_update_credentials_payload.go b/services/lbapplication/model_update_credentials_payload.go index df63904a0..7b61f05ff 100644 --- a/services/lbapplication/model_update_credentials_payload.go +++ b/services/lbapplication/model_update_credentials_payload.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_update_credentials_response.go b/services/lbapplication/model_update_credentials_response.go index 871796f42..556325578 100644 --- a/services/lbapplication/model_update_credentials_response.go +++ b/services/lbapplication/model_update_credentials_response.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/model_update_load_balancer_payload.go b/services/lbapplication/model_update_load_balancer_payload.go index 388a22360..62ccbafbb 100644 --- a/services/lbapplication/model_update_load_balancer_payload.go +++ b/services/lbapplication/model_update_load_balancer_payload.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ @@ -12,6 +12,7 @@ package lbapplication import ( "encoding/json" + "fmt" ) // checks if the UpdateLoadBalancerPayload type satisfies the MappedNullable interface at compile time @@ -185,10 +186,116 @@ type UpdateLoadBalancerPayloadGetPrivateAddressRetType = string types and functions for status */ -// isEnumRef -type UpdateLoadBalancerPayloadGetStatusAttributeType = *string -type UpdateLoadBalancerPayloadGetStatusArgType = string -type UpdateLoadBalancerPayloadGetStatusRetType = string +//isEnum + +// UpdateLoadBalancerPayloadStatus the model 'UpdateLoadBalancerPayload' +type UpdateLoadBalancerPayloadStatus string + +// List of Status +const ( + UPDATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED UpdateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + UPDATELOADBALANCERPAYLOADSTATUS_PENDING UpdateLoadBalancerPayloadStatus = "STATUS_PENDING" + UPDATELOADBALANCERPAYLOADSTATUS_READY UpdateLoadBalancerPayloadStatus = "STATUS_READY" + UPDATELOADBALANCERPAYLOADSTATUS_ERROR UpdateLoadBalancerPayloadStatus = "STATUS_ERROR" + UPDATELOADBALANCERPAYLOADSTATUS_TERMINATING UpdateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of UpdateLoadBalancerPayload enum +var AllowedUpdateLoadBalancerPayloadStatusEnumValues = []UpdateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *UpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := UpdateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UpdateLoadBalancerPayload", value) +} + +// NewUpdateLoadBalancerPayloadStatusFromValue returns a pointer to a valid UpdateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateLoadBalancerPayloadStatusFromValue(v string) (*UpdateLoadBalancerPayloadStatus, error) { + ev := UpdateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateLoadBalancerPayloadStatus: valid values are %v", v, AllowedUpdateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v UpdateLoadBalancerPayloadStatus) Ptr() *UpdateLoadBalancerPayloadStatus { + return &v +} + +type NullableUpdateLoadBalancerPayloadStatus struct { + value *UpdateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableUpdateLoadBalancerPayloadStatus) Get() *UpdateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Set(val *UpdateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLoadBalancerPayloadStatus(val *UpdateLoadBalancerPayloadStatus) *NullableUpdateLoadBalancerPayloadStatus { + return &NullableUpdateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableUpdateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type UpdateLoadBalancerPayloadGetStatusAttributeType = *UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusArgType = UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusRetType = UpdateLoadBalancerPayloadStatus func getUpdateLoadBalancerPayloadGetStatusAttributeTypeOk(arg UpdateLoadBalancerPayloadGetStatusAttributeType) (ret UpdateLoadBalancerPayloadGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/lbapplication/model_update_target_pool_payload.go b/services/lbapplication/model_update_target_pool_payload.go index d8123f329..545ff74f8 100644 --- a/services/lbapplication/model_update_target_pool_payload.go +++ b/services/lbapplication/model_update_target_pool_payload.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/lbapplication/utils.go b/services/lbapplication/utils.go index 41f25bf0e..b07c51304 100644 --- a/services/lbapplication/utils.go +++ b/services/lbapplication/utils.go @@ -1,7 +1,7 @@ /* Application Load Balancer API -This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. +### DEPRECATED! This service, lb-application, is no longer maintained. Please use the alb service, version v2beta2 instead This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. API version: 1beta.0.0 */ diff --git a/services/loadbalancer/CHANGELOG.md b/services/loadbalancer/CHANGELOG.md index bf488681f..312c2fd83 100644 --- a/services/loadbalancer/CHANGELOG.md +++ b/services/loadbalancer/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.0.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/loadbalancer/model_create_load_balancer_payload.go b/services/loadbalancer/model_create_load_balancer_payload.go index f9cdb0268..84024e228 100644 --- a/services/loadbalancer/model_create_load_balancer_payload.go +++ b/services/loadbalancer/model_create_load_balancer_payload.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "fmt" ) // checks if the CreateLoadBalancerPayload type satisfies the MappedNullable interface at compile time @@ -206,10 +207,116 @@ type CreateLoadBalancerPayloadGetRegionRetType = string types and functions for status */ -// isEnumRef -type CreateLoadBalancerPayloadGetStatusAttributeType = *string -type CreateLoadBalancerPayloadGetStatusArgType = string -type CreateLoadBalancerPayloadGetStatusRetType = string +//isEnum + +// CreateLoadBalancerPayloadStatus the model 'CreateLoadBalancerPayload' +type CreateLoadBalancerPayloadStatus string + +// List of Status +const ( + CREATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED CreateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + CREATELOADBALANCERPAYLOADSTATUS_PENDING CreateLoadBalancerPayloadStatus = "STATUS_PENDING" + CREATELOADBALANCERPAYLOADSTATUS_READY CreateLoadBalancerPayloadStatus = "STATUS_READY" + CREATELOADBALANCERPAYLOADSTATUS_ERROR CreateLoadBalancerPayloadStatus = "STATUS_ERROR" + CREATELOADBALANCERPAYLOADSTATUS_TERMINATING CreateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of CreateLoadBalancerPayload enum +var AllowedCreateLoadBalancerPayloadStatusEnumValues = []CreateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *CreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateLoadBalancerPayload", value) +} + +// NewCreateLoadBalancerPayloadStatusFromValue returns a pointer to a valid CreateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateLoadBalancerPayloadStatusFromValue(v string) (*CreateLoadBalancerPayloadStatus, error) { + ev := CreateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateLoadBalancerPayloadStatus: valid values are %v", v, AllowedCreateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CreateLoadBalancerPayloadStatus) Ptr() *CreateLoadBalancerPayloadStatus { + return &v +} + +type NullableCreateLoadBalancerPayloadStatus struct { + value *CreateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadStatus) Get() *CreateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Set(val *CreateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadStatus(val *CreateLoadBalancerPayloadStatus) *NullableCreateLoadBalancerPayloadStatus { + return &NullableCreateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateLoadBalancerPayloadGetStatusAttributeType = *CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusArgType = CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusRetType = CreateLoadBalancerPayloadStatus func getCreateLoadBalancerPayloadGetStatusAttributeTypeOk(arg CreateLoadBalancerPayloadGetStatusAttributeType) (ret CreateLoadBalancerPayloadGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/loadbalancer/model_listener.go b/services/loadbalancer/model_listener.go index fea341c06..4dca477d9 100644 --- a/services/loadbalancer/model_listener.go +++ b/services/loadbalancer/model_listener.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "fmt" ) // checks if the Listener type satisfies the MappedNullable interface at compile time @@ -83,10 +84,116 @@ func setListenerGetPortAttributeType(arg *ListenerGetPortAttributeType, val List types and functions for protocol */ -// isEnumRef -type ListenerGetProtocolAttributeType = *string -type ListenerGetProtocolArgType = string -type ListenerGetProtocolRetType = string +//isEnum + +// ListenerProtocol Protocol is the highest network protocol we understand to load balance. Currently only PROTOCOL_TCP, PROTOCOL_TCP_PROXY and PROTOCOL_TLS_PASSTHROUGH are supported. +type ListenerProtocol string + +// List of Protocol +const ( + LISTENERPROTOCOL_UNSPECIFIED ListenerProtocol = "PROTOCOL_UNSPECIFIED" + LISTENERPROTOCOL_TCP ListenerProtocol = "PROTOCOL_TCP" + LISTENERPROTOCOL_UDP ListenerProtocol = "PROTOCOL_UDP" + LISTENERPROTOCOL_TCP_PROXY ListenerProtocol = "PROTOCOL_TCP_PROXY" + LISTENERPROTOCOL_TLS_PASSTHROUGH ListenerProtocol = "PROTOCOL_TLS_PASSTHROUGH" +) + +// All allowed values of Listener enum +var AllowedListenerProtocolEnumValues = []ListenerProtocol{ + "PROTOCOL_UNSPECIFIED", + "PROTOCOL_TCP", + "PROTOCOL_UDP", + "PROTOCOL_TCP_PROXY", + "PROTOCOL_TLS_PASSTHROUGH", +} + +func (v *ListenerProtocol) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ListenerProtocol(value) + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Listener", value) +} + +// NewListenerProtocolFromValue returns a pointer to a valid ListenerProtocol +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListenerProtocolFromValue(v string) (*ListenerProtocol, error) { + ev := ListenerProtocol(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListenerProtocol: valid values are %v", v, AllowedListenerProtocolEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListenerProtocol) IsValid() bool { + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProtocolProtocol value +func (v ListenerProtocol) Ptr() *ListenerProtocol { + return &v +} + +type NullableListenerProtocol struct { + value *ListenerProtocol + isSet bool +} + +func (v NullableListenerProtocol) Get() *ListenerProtocol { + return v.value +} + +func (v *NullableListenerProtocol) Set(val *ListenerProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableListenerProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableListenerProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListenerProtocol(val *ListenerProtocol) *NullableListenerProtocol { + return &NullableListenerProtocol{value: val, isSet: true} +} + +func (v NullableListenerProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListenerProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ListenerGetProtocolAttributeType = *ListenerProtocol +type ListenerGetProtocolArgType = ListenerProtocol +type ListenerGetProtocolRetType = ListenerProtocol func getListenerGetProtocolAttributeTypeOk(arg ListenerGetProtocolAttributeType) (ret ListenerGetProtocolRetType, ok bool) { if arg == nil { diff --git a/services/loadbalancer/model_load_balancer.go b/services/loadbalancer/model_load_balancer.go index 6867a2a26..471698f83 100644 --- a/services/loadbalancer/model_load_balancer.go +++ b/services/loadbalancer/model_load_balancer.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "fmt" ) // checks if the LoadBalancer type satisfies the MappedNullable interface at compile time @@ -206,10 +207,116 @@ type LoadBalancerGetRegionRetType = string types and functions for status */ -// isEnumRef -type LoadBalancerGetStatusAttributeType = *string -type LoadBalancerGetStatusArgType = string -type LoadBalancerGetStatusRetType = string +//isEnum + +// LoadBalancerStatus the model 'LoadBalancer' +type LoadBalancerStatus string + +// List of Status +const ( + LOADBALANCERSTATUS_UNSPECIFIED LoadBalancerStatus = "STATUS_UNSPECIFIED" + LOADBALANCERSTATUS_PENDING LoadBalancerStatus = "STATUS_PENDING" + LOADBALANCERSTATUS_READY LoadBalancerStatus = "STATUS_READY" + LOADBALANCERSTATUS_ERROR LoadBalancerStatus = "STATUS_ERROR" + LOADBALANCERSTATUS_TERMINATING LoadBalancerStatus = "STATUS_TERMINATING" +) + +// All allowed values of LoadBalancer enum +var AllowedLoadBalancerStatusEnumValues = []LoadBalancerStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *LoadBalancerStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerStatus(value) + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancer", value) +} + +// NewLoadBalancerStatusFromValue returns a pointer to a valid LoadBalancerStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerStatusFromValue(v string) (*LoadBalancerStatus, error) { + ev := LoadBalancerStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerStatus: valid values are %v", v, AllowedLoadBalancerStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerStatus) IsValid() bool { + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v LoadBalancerStatus) Ptr() *LoadBalancerStatus { + return &v +} + +type NullableLoadBalancerStatus struct { + value *LoadBalancerStatus + isSet bool +} + +func (v NullableLoadBalancerStatus) Get() *LoadBalancerStatus { + return v.value +} + +func (v *NullableLoadBalancerStatus) Set(val *LoadBalancerStatus) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerStatus(val *LoadBalancerStatus) *NullableLoadBalancerStatus { + return &NullableLoadBalancerStatus{value: val, isSet: true} +} + +func (v NullableLoadBalancerStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerGetStatusAttributeType = *LoadBalancerStatus +type LoadBalancerGetStatusArgType = LoadBalancerStatus +type LoadBalancerGetStatusRetType = LoadBalancerStatus func getLoadBalancerGetStatusAttributeTypeOk(arg LoadBalancerGetStatusAttributeType) (ret LoadBalancerGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/loadbalancer/model_load_balancer_error.go b/services/loadbalancer/model_load_balancer_error.go index 68bc6ba21..fb801ee41 100644 --- a/services/loadbalancer/model_load_balancer_error.go +++ b/services/loadbalancer/model_load_balancer_error.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "fmt" ) // checks if the LoadBalancerError type satisfies the MappedNullable interface at compile time @@ -42,10 +43,126 @@ type LoadBalancerErrorGetDescriptionRetType = string types and functions for type */ -// isEnumRef -type LoadBalancerErrorGetTypeAttributeType = *string -type LoadBalancerErrorGetTypeArgType = string -type LoadBalancerErrorGetTypeRetType = string +//isEnum + +// LoadBalancerErrorTypes The error type specifies which part of the load balancer encountered the error. I.e. the API will not check if a provided public IP is actually available in the project. Instead the load balancer with try to use the provided IP and if not available reports TYPE_FIP_NOT_CONFIGURED error or TYPE_FIP_NOT_FOUND if the IP was deleted. +type LoadBalancerErrorTypes string + +// List of Type +const ( + LOADBALANCERERRORTYPE_UNSPECIFIED LoadBalancerErrorTypes = "TYPE_UNSPECIFIED" + LOADBALANCERERRORTYPE_INTERNAL LoadBalancerErrorTypes = "TYPE_INTERNAL" + LOADBALANCERERRORTYPE_QUOTA_SECGROUP_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUP_EXCEEDED" + LOADBALANCERERRORTYPE_QUOTA_SECGROUPRULE_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUPRULE_EXCEEDED" + LOADBALANCERERRORTYPE_PORT_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_PORT_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_FIP_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_FIP_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_TARGET_NOT_ACTIVE LoadBalancerErrorTypes = "TYPE_TARGET_NOT_ACTIVE" + LOADBALANCERERRORTYPE_METRICS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_METRICS_MISCONFIGURED" + LOADBALANCERERRORTYPE_LOGS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_LOGS_MISCONFIGURED" + LOADBALANCERERRORTYPE_FIP_NOT_FOUND LoadBalancerErrorTypes = "TYPE_FIP_NOT_FOUND" +) + +// All allowed values of LoadBalancerError enum +var AllowedLoadBalancerErrorTypesEnumValues = []LoadBalancerErrorTypes{ + "TYPE_UNSPECIFIED", + "TYPE_INTERNAL", + "TYPE_QUOTA_SECGROUP_EXCEEDED", + "TYPE_QUOTA_SECGROUPRULE_EXCEEDED", + "TYPE_PORT_NOT_CONFIGURED", + "TYPE_FIP_NOT_CONFIGURED", + "TYPE_TARGET_NOT_ACTIVE", + "TYPE_METRICS_MISCONFIGURED", + "TYPE_LOGS_MISCONFIGURED", + "TYPE_FIP_NOT_FOUND", +} + +func (v *LoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerErrorTypes(value) + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancerError", value) +} + +// NewLoadBalancerErrorTypesFromValue returns a pointer to a valid LoadBalancerErrorTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerErrorTypesFromValue(v string) (*LoadBalancerErrorTypes, error) { + ev := LoadBalancerErrorTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerErrorTypes: valid values are %v", v, AllowedLoadBalancerErrorTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerErrorTypes) IsValid() bool { + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v LoadBalancerErrorTypes) Ptr() *LoadBalancerErrorTypes { + return &v +} + +type NullableLoadBalancerErrorTypes struct { + value *LoadBalancerErrorTypes + isSet bool +} + +func (v NullableLoadBalancerErrorTypes) Get() *LoadBalancerErrorTypes { + return v.value +} + +func (v *NullableLoadBalancerErrorTypes) Set(val *LoadBalancerErrorTypes) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerErrorTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerErrorTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerErrorTypes(val *LoadBalancerErrorTypes) *NullableLoadBalancerErrorTypes { + return &NullableLoadBalancerErrorTypes{value: val, isSet: true} +} + +func (v NullableLoadBalancerErrorTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerErrorGetTypeAttributeType = *LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeArgType = LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeRetType = LoadBalancerErrorTypes func getLoadBalancerErrorGetTypeAttributeTypeOk(arg LoadBalancerErrorGetTypeAttributeType) (ret LoadBalancerErrorGetTypeRetType, ok bool) { if arg == nil { diff --git a/services/loadbalancer/model_network.go b/services/loadbalancer/model_network.go index 25a42bcdf..73576ffeb 100644 --- a/services/loadbalancer/model_network.go +++ b/services/loadbalancer/model_network.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "fmt" ) // checks if the Network type satisfies the MappedNullable interface at compile time @@ -42,10 +43,114 @@ type NetworkGetNetworkIdRetType = string types and functions for role */ -// isEnumRef -type NetworkGetRoleAttributeType = *string -type NetworkGetRoleArgType = string -type NetworkGetRoleRetType = string +//isEnum + +// NetworkRole The role defines how the load balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported. +type NetworkRole string + +// List of Role +const ( + NETWORKROLE_UNSPECIFIED NetworkRole = "ROLE_UNSPECIFIED" + NETWORKROLE_LISTENERS_AND_TARGETS NetworkRole = "ROLE_LISTENERS_AND_TARGETS" + NETWORKROLE_LISTENERS NetworkRole = "ROLE_LISTENERS" + NETWORKROLE_TARGETS NetworkRole = "ROLE_TARGETS" +) + +// All allowed values of Network enum +var AllowedNetworkRoleEnumValues = []NetworkRole{ + "ROLE_UNSPECIFIED", + "ROLE_LISTENERS_AND_TARGETS", + "ROLE_LISTENERS", + "ROLE_TARGETS", +} + +func (v *NetworkRole) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := NetworkRole(value) + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Network", value) +} + +// NewNetworkRoleFromValue returns a pointer to a valid NetworkRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewNetworkRoleFromValue(v string) (*NetworkRole, error) { + ev := NetworkRole(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for NetworkRole: valid values are %v", v, AllowedNetworkRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v NetworkRole) IsValid() bool { + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RoleRole value +func (v NetworkRole) Ptr() *NetworkRole { + return &v +} + +type NullableNetworkRole struct { + value *NetworkRole + isSet bool +} + +func (v NullableNetworkRole) Get() *NetworkRole { + return v.value +} + +func (v *NullableNetworkRole) Set(val *NetworkRole) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRole) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRole(val *NetworkRole) *NullableNetworkRole { + return &NullableNetworkRole{value: val, isSet: true} +} + +func (v NullableNetworkRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NetworkGetRoleAttributeType = *NetworkRole +type NetworkGetRoleArgType = NetworkRole +type NetworkGetRoleRetType = NetworkRole func getNetworkGetRoleAttributeTypeOk(arg NetworkGetRoleAttributeType) (ret NetworkGetRoleRetType, ok bool) { if arg == nil { diff --git a/services/loadbalancer/model_update_load_balancer_payload.go b/services/loadbalancer/model_update_load_balancer_payload.go index eb03f07a4..a6b538037 100644 --- a/services/loadbalancer/model_update_load_balancer_payload.go +++ b/services/loadbalancer/model_update_load_balancer_payload.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "fmt" ) // checks if the UpdateLoadBalancerPayload type satisfies the MappedNullable interface at compile time @@ -206,10 +207,116 @@ type UpdateLoadBalancerPayloadGetRegionRetType = string types and functions for status */ -// isEnumRef -type UpdateLoadBalancerPayloadGetStatusAttributeType = *string -type UpdateLoadBalancerPayloadGetStatusArgType = string -type UpdateLoadBalancerPayloadGetStatusRetType = string +//isEnum + +// UpdateLoadBalancerPayloadStatus the model 'UpdateLoadBalancerPayload' +type UpdateLoadBalancerPayloadStatus string + +// List of Status +const ( + UPDATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED UpdateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + UPDATELOADBALANCERPAYLOADSTATUS_PENDING UpdateLoadBalancerPayloadStatus = "STATUS_PENDING" + UPDATELOADBALANCERPAYLOADSTATUS_READY UpdateLoadBalancerPayloadStatus = "STATUS_READY" + UPDATELOADBALANCERPAYLOADSTATUS_ERROR UpdateLoadBalancerPayloadStatus = "STATUS_ERROR" + UPDATELOADBALANCERPAYLOADSTATUS_TERMINATING UpdateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of UpdateLoadBalancerPayload enum +var AllowedUpdateLoadBalancerPayloadStatusEnumValues = []UpdateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *UpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := UpdateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UpdateLoadBalancerPayload", value) +} + +// NewUpdateLoadBalancerPayloadStatusFromValue returns a pointer to a valid UpdateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateLoadBalancerPayloadStatusFromValue(v string) (*UpdateLoadBalancerPayloadStatus, error) { + ev := UpdateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateLoadBalancerPayloadStatus: valid values are %v", v, AllowedUpdateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v UpdateLoadBalancerPayloadStatus) Ptr() *UpdateLoadBalancerPayloadStatus { + return &v +} + +type NullableUpdateLoadBalancerPayloadStatus struct { + value *UpdateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableUpdateLoadBalancerPayloadStatus) Get() *UpdateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Set(val *UpdateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLoadBalancerPayloadStatus(val *UpdateLoadBalancerPayloadStatus) *NullableUpdateLoadBalancerPayloadStatus { + return &NullableUpdateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableUpdateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type UpdateLoadBalancerPayloadGetStatusAttributeType = *UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusArgType = UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusRetType = UpdateLoadBalancerPayloadStatus func getUpdateLoadBalancerPayloadGetStatusAttributeTypeOk(arg UpdateLoadBalancerPayloadGetStatusAttributeType) (ret UpdateLoadBalancerPayloadGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/loadbalancer/wait/wait.go b/services/loadbalancer/wait/wait.go index de4a3a26b..9c55218b3 100644 --- a/services/loadbalancer/wait/wait.go +++ b/services/loadbalancer/wait/wait.go @@ -14,10 +14,15 @@ import ( // Load balancer instance status const ( + // Deprecated: InstanceStatusUnspecified is deprecated and will be removed after 14th November 2025. Use [loadbalancer.LOADBALANCERSTATUS_UNSPECIFIED] instead. InstanceStatusUnspecified = "STATUS_UNSPECIFIED" - InstanceStatusPending = "STATUS_PENDING" - InstanceStatusReady = "STATUS_READY" - InstanceStatusError = "STATUS_ERROR" + // Deprecated: InstanceStatusPending is deprecated and will be removed after 14th November 2025. Use [loadbalancer.LOADBALANCERSTATUS_PENDING] instead. + InstanceStatusPending = "STATUS_PENDING" + // Deprecated: InstanceStatusReady is deprecated and will be removed after 14th November 2025. Use [loadbalancer.LOADBALANCERSTATUS_READY] instead. + InstanceStatusReady = "STATUS_READY" + // Deprecated: InstanceStatusError is deprecated and will be removed after 14th November 2025. Use [loadbalancer.LOADBALANCERSTATUS_ERROR] instead. + InstanceStatusError = "STATUS_ERROR" + // Deprecated: InstanceStatusTerminating is deprecated and will be removed after 12th November 2025. Use [loadbalancer.LOADBALANCERSTATUS_TERMINATING] instead. InstanceStatusTerminating = "STATUS_TERMINATING" ) @@ -48,15 +53,15 @@ func CreateLoadBalancerWaitHandler(ctx context.Context, a APIClientInterface, pr } switch *s.Status { - case InstanceStatusReady: + case loadbalancer.LOADBALANCERSTATUS_READY: return true, s, nil - case InstanceStatusUnspecified: + case loadbalancer.LOADBALANCERSTATUS_UNSPECIFIED: return false, nil, nil - case InstanceStatusPending: + case loadbalancer.LOADBALANCERSTATUS_PENDING: return false, nil, nil - case InstanceStatusTerminating: + case loadbalancer.LOADBALANCERSTATUS_TERMINATING: return true, s, fmt.Errorf("create failed for instance with name %s, got status %s", instanceName, InstanceStatusTerminating) - case InstanceStatusError: + case loadbalancer.LOADBALANCERSTATUS_ERROR: return true, s, fmt.Errorf("create failed for instance with name %s, got status %s", instanceName, InstanceStatusError) default: return true, s, fmt.Errorf("instance with name %s has unexpected status %s", instanceName, *s.Status) diff --git a/services/loadbalancer/wait/wait_test.go b/services/loadbalancer/wait/wait_test.go index 961e36894..7aa60a65b 100644 --- a/services/loadbalancer/wait/wait_test.go +++ b/services/loadbalancer/wait/wait_test.go @@ -14,7 +14,7 @@ import ( // Used for testing instance operations type apiClientMocked struct { instanceName string - instanceStatus string + instanceStatus loadbalancer.LoadBalancerStatus instanceIsDeleted bool instanceGetFails bool } @@ -44,28 +44,28 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string instanceGetFails bool - instanceStatus string + instanceStatus loadbalancer.LoadBalancerStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", instanceGetFails: false, - instanceStatus: InstanceStatusReady, + instanceStatus: loadbalancer.LOADBALANCERSTATUS_READY, wantErr: false, wantResp: true, }, { desc: "create_failed", instanceGetFails: false, - instanceStatus: InstanceStatusError, + instanceStatus: loadbalancer.LOADBALANCERSTATUS_ERROR, wantErr: true, wantResp: true, }, { desc: "create_failed_2", instanceGetFails: false, - instanceStatus: InstanceStatusTerminating, + instanceStatus: loadbalancer.LOADBALANCERSTATUS_TERMINATING, wantErr: true, wantResp: true, }, @@ -78,7 +78,7 @@ func TestCreateInstanceWaitHandler(t *testing.T) { { desc: "timeout", instanceGetFails: false, - instanceStatus: InstanceStatusPending, + instanceStatus: loadbalancer.LOADBALANCERSTATUS_PENDING, wantErr: true, wantResp: false, }, diff --git a/services/logme/CHANGELOG.md b/services/logme/CHANGELOG.md index 79508653d..3193b9cf2 100644 --- a/services/logme/CHANGELOG.md +++ b/services/logme/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.23.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.22.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/logme/model_instance.go b/services/logme/model_instance.go index 9dcb93e1f..574f673bf 100644 --- a/services/logme/model_instance.go +++ b/services/logme/model_instance.go @@ -12,6 +12,7 @@ package logme import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -292,10 +293,118 @@ type InstanceGetPlanNameRetType = string types and functions for status */ -// isEnumRef -type InstanceGetStatusAttributeType = *string -type InstanceGetStatusArgType = string -type InstanceGetStatusRetType = string +//isEnum + +// InstanceStatus the model 'Instance' +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_FAILED InstanceStatus = "failed" + INSTANCESTATUS_STOPPED InstanceStatus = "stopped" + INSTANCESTATUS_CREATING InstanceStatus = "creating" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" + INSTANCESTATUS_UPDATING InstanceStatus = "updating" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "active", + "failed", + "stopped", + "creating", + "deleting", + "updating", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/logme/model_instance_last_operation.go b/services/logme/model_instance_last_operation.go index 82df13a78..5fabaf52b 100644 --- a/services/logme/model_instance_last_operation.go +++ b/services/logme/model_instance_last_operation.go @@ -12,6 +12,7 @@ package logme import ( "encoding/json" + "fmt" ) // checks if the InstanceLastOperation type satisfies the MappedNullable interface at compile time @@ -42,10 +43,112 @@ type InstanceLastOperationGetDescriptionRetType = string types and functions for state */ -// isEnumRef -type InstanceLastOperationGetStateAttributeType = *string -type InstanceLastOperationGetStateArgType = string -type InstanceLastOperationGetStateRetType = string +//isEnum + +// InstanceLastOperationState the model 'InstanceLastOperation' +type InstanceLastOperationState string + +// List of State +const ( + INSTANCELASTOPERATIONSTATE_IN_PROGRESS InstanceLastOperationState = "in progress" + INSTANCELASTOPERATIONSTATE_SUCCEEDED InstanceLastOperationState = "succeeded" + INSTANCELASTOPERATIONSTATE_FAILED InstanceLastOperationState = "failed" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationStateEnumValues = []InstanceLastOperationState{ + "in progress", + "succeeded", + "failed", +} + +func (v *InstanceLastOperationState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationState(value) + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationStateFromValue returns a pointer to a valid InstanceLastOperationState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationStateFromValue(v string) (*InstanceLastOperationState, error) { + ev := InstanceLastOperationState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationState: valid values are %v", v, AllowedInstanceLastOperationStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationState) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceLastOperationState) Ptr() *InstanceLastOperationState { + return &v +} + +type NullableInstanceLastOperationState struct { + value *InstanceLastOperationState + isSet bool +} + +func (v NullableInstanceLastOperationState) Get() *InstanceLastOperationState { + return v.value +} + +func (v *NullableInstanceLastOperationState) Set(val *InstanceLastOperationState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationState(val *InstanceLastOperationState) *NullableInstanceLastOperationState { + return &NullableInstanceLastOperationState{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetStateAttributeType = *InstanceLastOperationState +type InstanceLastOperationGetStateArgType = InstanceLastOperationState +type InstanceLastOperationGetStateRetType = InstanceLastOperationState func getInstanceLastOperationGetStateAttributeTypeOk(arg InstanceLastOperationGetStateAttributeType) (ret InstanceLastOperationGetStateRetType, ok bool) { if arg == nil { @@ -62,10 +165,112 @@ func setInstanceLastOperationGetStateAttributeType(arg *InstanceLastOperationGet types and functions for type */ -// isEnumRef -type InstanceLastOperationGetTypeAttributeType = *string -type InstanceLastOperationGetTypeArgType = string -type InstanceLastOperationGetTypeRetType = string +//isEnum + +// InstanceLastOperationTypes the model 'InstanceLastOperation' +type InstanceLastOperationTypes string + +// List of Type +const ( + INSTANCELASTOPERATIONTYPE_CREATE InstanceLastOperationTypes = "create" + INSTANCELASTOPERATIONTYPE_UPDATE InstanceLastOperationTypes = "update" + INSTANCELASTOPERATIONTYPE_DELETE InstanceLastOperationTypes = "delete" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationTypesEnumValues = []InstanceLastOperationTypes{ + "create", + "update", + "delete", +} + +func (v *InstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationTypes(value) + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationTypesFromValue returns a pointer to a valid InstanceLastOperationTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationTypesFromValue(v string) (*InstanceLastOperationTypes, error) { + ev := InstanceLastOperationTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationTypes: valid values are %v", v, AllowedInstanceLastOperationTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationTypes) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v InstanceLastOperationTypes) Ptr() *InstanceLastOperationTypes { + return &v +} + +type NullableInstanceLastOperationTypes struct { + value *InstanceLastOperationTypes + isSet bool +} + +func (v NullableInstanceLastOperationTypes) Get() *InstanceLastOperationTypes { + return v.value +} + +func (v *NullableInstanceLastOperationTypes) Set(val *InstanceLastOperationTypes) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationTypes(val *InstanceLastOperationTypes) *NullableInstanceLastOperationTypes { + return &NullableInstanceLastOperationTypes{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetTypeAttributeType = *InstanceLastOperationTypes +type InstanceLastOperationGetTypeArgType = InstanceLastOperationTypes +type InstanceLastOperationGetTypeRetType = InstanceLastOperationTypes func getInstanceLastOperationGetTypeAttributeTypeOk(arg InstanceLastOperationGetTypeAttributeType) (ret InstanceLastOperationGetTypeRetType, ok bool) { if arg == nil { @@ -94,11 +299,11 @@ type _InstanceLastOperation InstanceLastOperation // 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 NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, type_ InstanceLastOperationGetTypeArgType) *InstanceLastOperation { +func NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, types InstanceLastOperationGetTypeArgType) *InstanceLastOperation { this := InstanceLastOperation{} setInstanceLastOperationGetDescriptionAttributeType(&this.Description, description) setInstanceLastOperationGetStateAttributeType(&this.State, state) - setInstanceLastOperationGetTypeAttributeType(&this.Type, type_) + setInstanceLastOperationGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/logme/wait/wait.go b/services/logme/wait/wait.go index 96725c804..44d15b20c 100644 --- a/services/logme/wait/wait.go +++ b/services/logme/wait/wait.go @@ -13,30 +13,42 @@ import ( ) const ( - InstanceStatusActive = "active" - InstanceStatusFailed = "failed" - InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusActive is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCESTATUS_ACTIVE] instead. + InstanceStatusActive = "active" + // Deprecated: InstanceStatusFailed is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCESTATUS_FAILED] instead. + InstanceStatusFailed = "failed" + // Deprecated: InstanceStatusStopped is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCESTATUS_STOPPED] instead. + InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusCreating is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCESTATUS_CREATING] instead. InstanceStatusCreating = "creating" + // Deprecated: InstanceStatusDeleting is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCESTATUS_DELETING] instead. InstanceStatusDeleting = "deleting" + // Deprecated: InstanceStatusUpdating is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCESTATUS_UPDATING] instead. InstanceStatusUpdating = "updating" + // Deprecated: InstanceOperationStateInProgress is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCELASTOPERATIONSTATE_IN_PROGRESS] instead. InstanceOperationStateInProgress = "in progress" - InstanceOperationStateSucceeded = "succeeded" - InstanceOperationStateFailed = "failed" + // Deprecated: InstanceOperationStateSucceeded is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. + InstanceOperationStateSucceeded = "succeeded" + // Deprecated: InstanceOperationStateFailed is deprecated and will be removed after 14th November 2025. Use [logme.INSTANCELASTOPERATIONSTATE_FAILED] instead. + InstanceOperationStateFailed = "failed" + // Deprecated: InstanceOperationTypeCreate is deprecated and will be removed after 12th November 2025. Use [logme.INSTANCELASTOPERATIONTYPE_CREATE] instead. InstanceOperationTypeCreate = "create" + // Deprecated: InstanceOperationTypeUpdate is deprecated and will be removed after 12th November 2025. Use [logme.INSTANCELASTOPERATIONTYPE_UPDATE] instead. InstanceOperationTypeUpdate = "update" + // Deprecated: InstanceOperationTypeDelete is deprecated and will be removed after 12th November 2025. Use [logme.INSTANCELASTOPERATIONTYPE_DELETE] instead. InstanceOperationTypeDelete = "delete" - // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateSucceeded] instead. + // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [logme.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. InstanceStateSuccess = "succeeded" - // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateFailed] instead. + // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [logme.INSTANCELASTOPERATIONSTATE_FAILED] instead. InstanceStateFailed = "failed" - // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeCreate] instead. + // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [logme.INSTANCELASTOPERATIONTYPE_CREATE] instead. InstanceTypeCreate = "create" - // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeUpdate] instead. + // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [logme.INSTANCELASTOPERATIONTYPE_UPDATE] instead. InstanceTypeUpdate = "update" - // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeDelete] instead. + // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [logme.INSTANCELASTOPERATIONTYPE_DELETE] instead. InstanceTypeDelete = "delete" ) @@ -61,9 +73,9 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return false, nil, fmt.Errorf("create failed for instance with id %s. The response is not valid: the status is missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case logme.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case logme.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -87,9 +99,9 @@ func PartialUpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceIn return false, nil, fmt.Errorf("update failed for instance with id %s. The response is not valid: the instance id or the status are missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case logme.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case logme.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -110,10 +122,10 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface if s.LastOperation == nil || s.LastOperation.Description == nil || s.Status == nil { return false, nil, fmt.Errorf("delete failed for instance with id %s. The response is not valid: The status or last operation description are missing", instanceId) } - if *s.Status != InstanceStatusDeleting { + if *s.Status != logme.INSTANCESTATUS_DELETING { return false, nil, nil } - if *s.Status == InstanceStatusActive { + if *s.Status == logme.INSTANCESTATUS_ACTIVE { if strings.Contains(*s.LastOperation.Description, "DeleteFailed") || strings.Contains(*s.LastOperation.Description, "failed") { return true, nil, fmt.Errorf("instance was deleted successfully but has errors: %s", *s.LastOperation.Description) } diff --git a/services/logme/wait/wait_test.go b/services/logme/wait/wait_test.go index 1d93cd921..eaf10eedf 100644 --- a/services/logme/wait/wait_test.go +++ b/services/logme/wait/wait_test.go @@ -17,7 +17,7 @@ type apiClientInstanceMocked struct { deletionSucceedsWithErrors bool resourceId string resourceOperation *string - resourceState string + resourceState logme.InstanceStatus resourceDescription string } @@ -29,7 +29,7 @@ func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ str StatusCode: 500, } } - if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == InstanceStatusActive { + if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == logme.INSTANCESTATUS_ACTIVE { if a.deletionSucceedsWithErrors { return &logme.Instance{ InstanceId: &a.resourceId, @@ -80,21 +80,21 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState logme.InstanceStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: logme.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: logme.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -149,21 +149,21 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState logme.InstanceStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: logme.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: logme.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -218,7 +218,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc string getFails bool deleteSucceeedsWithErrors bool - resourceState string + resourceState logme.InstanceStatus resourceDescription string wantErr bool wantResp bool @@ -227,7 +227,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc: "delete_succeeded", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusActive, + resourceState: logme.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, @@ -235,14 +235,14 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc: "delete_failed", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusFailed, + resourceState: logme.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, { desc: "delete_succeeds_with_errors", getFails: false, - resourceState: InstanceStatusActive, + resourceState: logme.INSTANCESTATUS_ACTIVE, deleteSucceeedsWithErrors: true, resourceDescription: "Deleting resource: cf failed with error: DeleteFailed", wantErr: true, diff --git a/services/mariadb/CHANGELOG.md b/services/mariadb/CHANGELOG.md index 7fdc059de..0a3515968 100644 --- a/services/mariadb/CHANGELOG.md +++ b/services/mariadb/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.23.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.22.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/mariadb/model_instance.go b/services/mariadb/model_instance.go index f5694f75c..5d4b42269 100644 --- a/services/mariadb/model_instance.go +++ b/services/mariadb/model_instance.go @@ -12,6 +12,7 @@ package mariadb import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -292,10 +293,118 @@ type InstanceGetPlanNameRetType = string types and functions for status */ -// isEnumRef -type InstanceGetStatusAttributeType = *string -type InstanceGetStatusArgType = string -type InstanceGetStatusRetType = string +//isEnum + +// InstanceStatus the model 'Instance' +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_FAILED InstanceStatus = "failed" + INSTANCESTATUS_STOPPED InstanceStatus = "stopped" + INSTANCESTATUS_CREATING InstanceStatus = "creating" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" + INSTANCESTATUS_UPDATING InstanceStatus = "updating" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "active", + "failed", + "stopped", + "creating", + "deleting", + "updating", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/mariadb/model_instance_last_operation.go b/services/mariadb/model_instance_last_operation.go index a1c1068f7..ba38dc9e6 100644 --- a/services/mariadb/model_instance_last_operation.go +++ b/services/mariadb/model_instance_last_operation.go @@ -12,6 +12,7 @@ package mariadb import ( "encoding/json" + "fmt" ) // checks if the InstanceLastOperation type satisfies the MappedNullable interface at compile time @@ -42,10 +43,112 @@ type InstanceLastOperationGetDescriptionRetType = string types and functions for state */ -// isEnumRef -type InstanceLastOperationGetStateAttributeType = *string -type InstanceLastOperationGetStateArgType = string -type InstanceLastOperationGetStateRetType = string +//isEnum + +// InstanceLastOperationState the model 'InstanceLastOperation' +type InstanceLastOperationState string + +// List of State +const ( + INSTANCELASTOPERATIONSTATE_IN_PROGRESS InstanceLastOperationState = "in progress" + INSTANCELASTOPERATIONSTATE_SUCCEEDED InstanceLastOperationState = "succeeded" + INSTANCELASTOPERATIONSTATE_FAILED InstanceLastOperationState = "failed" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationStateEnumValues = []InstanceLastOperationState{ + "in progress", + "succeeded", + "failed", +} + +func (v *InstanceLastOperationState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationState(value) + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationStateFromValue returns a pointer to a valid InstanceLastOperationState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationStateFromValue(v string) (*InstanceLastOperationState, error) { + ev := InstanceLastOperationState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationState: valid values are %v", v, AllowedInstanceLastOperationStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationState) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceLastOperationState) Ptr() *InstanceLastOperationState { + return &v +} + +type NullableInstanceLastOperationState struct { + value *InstanceLastOperationState + isSet bool +} + +func (v NullableInstanceLastOperationState) Get() *InstanceLastOperationState { + return v.value +} + +func (v *NullableInstanceLastOperationState) Set(val *InstanceLastOperationState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationState(val *InstanceLastOperationState) *NullableInstanceLastOperationState { + return &NullableInstanceLastOperationState{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetStateAttributeType = *InstanceLastOperationState +type InstanceLastOperationGetStateArgType = InstanceLastOperationState +type InstanceLastOperationGetStateRetType = InstanceLastOperationState func getInstanceLastOperationGetStateAttributeTypeOk(arg InstanceLastOperationGetStateAttributeType) (ret InstanceLastOperationGetStateRetType, ok bool) { if arg == nil { @@ -62,10 +165,112 @@ func setInstanceLastOperationGetStateAttributeType(arg *InstanceLastOperationGet types and functions for type */ -// isEnumRef -type InstanceLastOperationGetTypeAttributeType = *string -type InstanceLastOperationGetTypeArgType = string -type InstanceLastOperationGetTypeRetType = string +//isEnum + +// InstanceLastOperationTypes the model 'InstanceLastOperation' +type InstanceLastOperationTypes string + +// List of Type +const ( + INSTANCELASTOPERATIONTYPE_CREATE InstanceLastOperationTypes = "create" + INSTANCELASTOPERATIONTYPE_UPDATE InstanceLastOperationTypes = "update" + INSTANCELASTOPERATIONTYPE_DELETE InstanceLastOperationTypes = "delete" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationTypesEnumValues = []InstanceLastOperationTypes{ + "create", + "update", + "delete", +} + +func (v *InstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationTypes(value) + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationTypesFromValue returns a pointer to a valid InstanceLastOperationTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationTypesFromValue(v string) (*InstanceLastOperationTypes, error) { + ev := InstanceLastOperationTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationTypes: valid values are %v", v, AllowedInstanceLastOperationTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationTypes) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v InstanceLastOperationTypes) Ptr() *InstanceLastOperationTypes { + return &v +} + +type NullableInstanceLastOperationTypes struct { + value *InstanceLastOperationTypes + isSet bool +} + +func (v NullableInstanceLastOperationTypes) Get() *InstanceLastOperationTypes { + return v.value +} + +func (v *NullableInstanceLastOperationTypes) Set(val *InstanceLastOperationTypes) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationTypes(val *InstanceLastOperationTypes) *NullableInstanceLastOperationTypes { + return &NullableInstanceLastOperationTypes{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetTypeAttributeType = *InstanceLastOperationTypes +type InstanceLastOperationGetTypeArgType = InstanceLastOperationTypes +type InstanceLastOperationGetTypeRetType = InstanceLastOperationTypes func getInstanceLastOperationGetTypeAttributeTypeOk(arg InstanceLastOperationGetTypeAttributeType) (ret InstanceLastOperationGetTypeRetType, ok bool) { if arg == nil { @@ -94,11 +299,11 @@ type _InstanceLastOperation InstanceLastOperation // 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 NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, type_ InstanceLastOperationGetTypeArgType) *InstanceLastOperation { +func NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, types InstanceLastOperationGetTypeArgType) *InstanceLastOperation { this := InstanceLastOperation{} setInstanceLastOperationGetDescriptionAttributeType(&this.Description, description) setInstanceLastOperationGetStateAttributeType(&this.State, state) - setInstanceLastOperationGetTypeAttributeType(&this.Type, type_) + setInstanceLastOperationGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/mariadb/wait/wait.go b/services/mariadb/wait/wait.go index 9bf287f8a..2b9ad8372 100644 --- a/services/mariadb/wait/wait.go +++ b/services/mariadb/wait/wait.go @@ -13,29 +13,42 @@ import ( ) const ( - InstanceStatusActive = "active" - InstanceStatusFailed = "failed" - InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusActive is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCESTATUS_ACTIVE] instead. + InstanceStatusActive = "active" + // Deprecated: InstanceStatusFailed is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCESTATUS_FAILED] instead. + InstanceStatusFailed = "failed" + // Deprecated: InstanceStatusStopped is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCESTATUS_STOPPED] instead. + InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusCreating is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCESTATUS_CREATING] instead. InstanceStatusCreating = "creating" + // Deprecated: InstanceStatusDeleting is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCESTATUS_DELETING] instead. InstanceStatusDeleting = "deleting" + // Deprecated: InstanceStatusUpdating is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCESTATUS_UPDATING] instead. InstanceStatusUpdating = "updating" + // Deprecated: InstanceOperationStateInProgress is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCELASTOPERATIONSTATE_IN_PROGRESS] instead. InstanceOperationStateInProgress = "in progress" - InstanceOperationStateSucceeded = "succeeded" - InstanceOperationStateFailed = "failed" - InstanceOperationTypeCreate = "create" - InstanceOperationTypeUpdate = "update" - InstanceOperationTypeDelete = "delete" + // Deprecated: InstanceOperationStateSucceeded is deprecated and will be removed after 14th November 2025. Use [mariadb.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. + InstanceOperationStateSucceeded = "succeeded" + // Deprecated: InstanceOperationStateFailed is deprecated and will be removed after 12th November 2025. Use [mariadb.INSTANCELASTOPERATIONSTATE_FAILED] instead. + InstanceOperationStateFailed = "failed" - // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateSucceeded] instead. + // Deprecated: InstanceOperationTypeCreate is deprecated and will be removed after 12th November 2025. Use [mariadb.INSTANCELASTOPERATIONTYPE_CREATE] instead. + InstanceOperationTypeCreate = "create" + // Deprecated: InstanceOperationTypeUpdate is deprecated and will be removed after 12th November 2025. Use [mariadb.INSTANCELASTOPERATIONTYPE_UPDATE] instead. + InstanceOperationTypeUpdate = "update" + // Deprecated: InstanceOperationTypeDelete is deprecated and will be removed after 12th November 2025. Use [mariadb.INSTANCELASTOPERATIONTYPE_DELETE] instead. + InstanceOperationTypeDelete = "delete" + + // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [mariadb.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. InstanceStateSuccess = "succeeded" - // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateFailed] instead. + // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [mariadb.INSTANCELASTOPERATIONSTATE_FAILED] instead. InstanceStateFailed = "failed" - // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeCreate] instead. + // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [mariadb.INSTANCELASTOPERATIONTYPE_CREATE] instead. InstanceTypeCreate = "create" - // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeUpdate] instead. + // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [mariadb.INSTANCELASTOPERATIONTYPE_UPDATE] instead. InstanceTypeUpdate = "update" - // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeDelete] instead. + // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [mariadb.INSTANCELASTOPERATIONTYPE_DELETE] instead. InstanceTypeDelete = "delete" ) @@ -60,9 +73,9 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return false, nil, fmt.Errorf("create failed for instance with id %s. The response is not valid: the status is missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case mariadb.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case mariadb.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -86,9 +99,9 @@ func PartialUpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceIn return false, nil, fmt.Errorf("update failed for instance with id %s. The response is not valid: the instance id or the status are missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case mariadb.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case mariadb.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -109,10 +122,10 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface if s.LastOperation == nil || s.LastOperation.Description == nil || s.Status == nil { return false, nil, fmt.Errorf("delete failed for instance with id %s. The response is not valid: The status or last operation description are missing", instanceId) } - if *s.Status != InstanceStatusDeleting { + if *s.Status != mariadb.INSTANCESTATUS_DELETING { return false, nil, nil } - if *s.Status == InstanceStatusActive { + if *s.Status == mariadb.INSTANCESTATUS_ACTIVE { if strings.Contains(*s.LastOperation.Description, "DeleteFailed") || strings.Contains(*s.LastOperation.Description, "failed") { return true, nil, fmt.Errorf("instance was deleted successfully but has errors: %s", *s.LastOperation.Description) } diff --git a/services/mariadb/wait/wait_test.go b/services/mariadb/wait/wait_test.go index ed03d33a4..358af0d30 100644 --- a/services/mariadb/wait/wait_test.go +++ b/services/mariadb/wait/wait_test.go @@ -17,7 +17,7 @@ type apiClientInstanceMocked struct { deletionSucceedsWithErrors bool resourceId string resourceOperation *string - resourceState string + resourceState mariadb.InstanceStatus resourceDescription string } @@ -29,7 +29,7 @@ func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ str StatusCode: 500, } } - if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == InstanceStatusActive { + if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == mariadb.INSTANCESTATUS_ACTIVE { if a.deletionSucceedsWithErrors { return &mariadb.Instance{ InstanceId: &a.resourceId, @@ -80,21 +80,21 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState mariadb.InstanceStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: mariadb.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: mariadb.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -149,21 +149,21 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState mariadb.InstanceStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: mariadb.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: mariadb.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -218,7 +218,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc string getFails bool deleteSucceeedsWithErrors bool - resourceState string + resourceState mariadb.InstanceStatus resourceDescription string wantErr bool }{ @@ -226,20 +226,20 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc: "delete_succeeded", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusActive, + resourceState: mariadb.INSTANCESTATUS_ACTIVE, wantErr: false, }, { desc: "delete_failed", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusFailed, + resourceState: mariadb.INSTANCESTATUS_FAILED, wantErr: true, }, { desc: "delete_succeeds_with_errors", getFails: false, - resourceState: InstanceStatusActive, + resourceState: mariadb.INSTANCESTATUS_ACTIVE, deleteSucceeedsWithErrors: true, resourceDescription: "Deleting resource: cf failed with error: DeleteFailed", wantErr: true, diff --git a/services/modelserving/CHANGELOG.md b/services/modelserving/CHANGELOG.md index ce7268c4f..b86957e41 100644 --- a/services/modelserving/CHANGELOG.md +++ b/services/modelserving/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.3.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.2.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/modelserving/model_chat_model_details.go b/services/modelserving/model_chat_model_details.go index 2bc541508..0eadff036 100644 --- a/services/modelserving/model_chat_model_details.go +++ b/services/modelserving/model_chat_model_details.go @@ -12,6 +12,7 @@ package modelserving import ( "encoding/json" + "fmt" ) // checks if the ChatModelDetails type satisfies the MappedNullable interface at compile time @@ -21,10 +22,116 @@ var _ MappedNullable = &ChatModelDetails{} types and functions for bits */ -// isEnumRef -type ChatModelDetailsGetBitsAttributeType = *int64 -type ChatModelDetailsGetBitsArgType = int64 -type ChatModelDetailsGetBitsRetType = int64 +//isEnum + +// ChatModelDetailsBits the model 'ChatModelDetails' +type ChatModelDetailsBits int32 + +// List of Bits +const ( + CHATMODELDETAILSBITS_1Bit ChatModelDetailsBits = 1 + CHATMODELDETAILSBITS_2Bits ChatModelDetailsBits = 2 + CHATMODELDETAILSBITS_4Bits ChatModelDetailsBits = 4 + CHATMODELDETAILSBITS_8Bits ChatModelDetailsBits = 8 + CHATMODELDETAILSBITS_16Bits ChatModelDetailsBits = 16 +) + +// All allowed values of ChatModelDetails enum +var AllowedChatModelDetailsBitsEnumValues = []ChatModelDetailsBits{ + 1, + 2, + 4, + 8, + 16, +} + +func (v *ChatModelDetailsBits) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue int32 + if value == zeroValue { + return nil + } + enumTypeValue := ChatModelDetailsBits(value) + for _, existing := range AllowedChatModelDetailsBitsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ChatModelDetails", value) +} + +// NewChatModelDetailsBitsFromValue returns a pointer to a valid ChatModelDetailsBits +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewChatModelDetailsBitsFromValue(v int32) (*ChatModelDetailsBits, error) { + ev := ChatModelDetailsBits(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ChatModelDetailsBits: valid values are %v", v, AllowedChatModelDetailsBitsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ChatModelDetailsBits) IsValid() bool { + for _, existing := range AllowedChatModelDetailsBitsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BitsBits value +func (v ChatModelDetailsBits) Ptr() *ChatModelDetailsBits { + return &v +} + +type NullableChatModelDetailsBits struct { + value *ChatModelDetailsBits + isSet bool +} + +func (v NullableChatModelDetailsBits) Get() *ChatModelDetailsBits { + return v.value +} + +func (v *NullableChatModelDetailsBits) Set(val *ChatModelDetailsBits) { + v.value = val + v.isSet = true +} + +func (v NullableChatModelDetailsBits) IsSet() bool { + return v.isSet +} + +func (v *NullableChatModelDetailsBits) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChatModelDetailsBits(val *ChatModelDetailsBits) *NullableChatModelDetailsBits { + return &NullableChatModelDetailsBits{value: val, isSet: true} +} + +func (v NullableChatModelDetailsBits) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChatModelDetailsBits) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ChatModelDetailsGetBitsAttributeType = *ChatModelDetailsBits +type ChatModelDetailsGetBitsArgType = ChatModelDetailsBits +type ChatModelDetailsGetBitsRetType = ChatModelDetailsBits func getChatModelDetailsGetBitsAttributeTypeOk(arg ChatModelDetailsGetBitsAttributeType) (ret ChatModelDetailsGetBitsRetType, ok bool) { if arg == nil { @@ -41,10 +148,112 @@ func setChatModelDetailsGetBitsAttributeType(arg *ChatModelDetailsGetBitsAttribu types and functions for category */ -// isEnumRef -type ChatModelDetailsGetCategoryAttributeType = *string -type ChatModelDetailsGetCategoryArgType = string -type ChatModelDetailsGetCategoryRetType = string +//isEnum + +// ChatModelDetailsCategory the model 'ChatModelDetails' +type ChatModelDetailsCategory string + +// List of Category +const ( + CHATMODELDETAILSCATEGORY_STANDARD ChatModelDetailsCategory = "standard" + CHATMODELDETAILSCATEGORY_PLUS ChatModelDetailsCategory = "plus" + CHATMODELDETAILSCATEGORY_PREMIUM ChatModelDetailsCategory = "premium" +) + +// All allowed values of ChatModelDetails enum +var AllowedChatModelDetailsCategoryEnumValues = []ChatModelDetailsCategory{ + "standard", + "plus", + "premium", +} + +func (v *ChatModelDetailsCategory) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ChatModelDetailsCategory(value) + for _, existing := range AllowedChatModelDetailsCategoryEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ChatModelDetails", value) +} + +// NewChatModelDetailsCategoryFromValue returns a pointer to a valid ChatModelDetailsCategory +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewChatModelDetailsCategoryFromValue(v string) (*ChatModelDetailsCategory, error) { + ev := ChatModelDetailsCategory(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ChatModelDetailsCategory: valid values are %v", v, AllowedChatModelDetailsCategoryEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ChatModelDetailsCategory) IsValid() bool { + for _, existing := range AllowedChatModelDetailsCategoryEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CategoryCategory value +func (v ChatModelDetailsCategory) Ptr() *ChatModelDetailsCategory { + return &v +} + +type NullableChatModelDetailsCategory struct { + value *ChatModelDetailsCategory + isSet bool +} + +func (v NullableChatModelDetailsCategory) Get() *ChatModelDetailsCategory { + return v.value +} + +func (v *NullableChatModelDetailsCategory) Set(val *ChatModelDetailsCategory) { + v.value = val + v.isSet = true +} + +func (v NullableChatModelDetailsCategory) IsSet() bool { + return v.isSet +} + +func (v *NullableChatModelDetailsCategory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChatModelDetailsCategory(val *ChatModelDetailsCategory) *NullableChatModelDetailsCategory { + return &NullableChatModelDetailsCategory{value: val, isSet: true} +} + +func (v NullableChatModelDetailsCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChatModelDetailsCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ChatModelDetailsGetCategoryAttributeType = *ChatModelDetailsCategory +type ChatModelDetailsGetCategoryArgType = ChatModelDetailsCategory +type ChatModelDetailsGetCategoryRetType = ChatModelDetailsCategory func getChatModelDetailsGetCategoryAttributeTypeOk(arg ChatModelDetailsGetCategoryAttributeType) (ret ChatModelDetailsGetCategoryRetType, ok bool) { if arg == nil { @@ -165,10 +374,110 @@ type ChatModelDetailsGetNameRetType = string types and functions for quantizationMethod */ -// isEnumRef -type ChatModelDetailsGetQuantizationMethodAttributeType = *string -type ChatModelDetailsGetQuantizationMethodArgType = string -type ChatModelDetailsGetQuantizationMethodRetType = string +//isEnum + +// ChatModelDetailsQuantizationMethod the model 'ChatModelDetails' +type ChatModelDetailsQuantizationMethod string + +// List of QuantizationMethod +const ( + CHATMODELDETAILSQUANTIZATION_METHOD_PTQ ChatModelDetailsQuantizationMethod = "PTQ" + CHATMODELDETAILSQUANTIZATION_METHOD_QAT ChatModelDetailsQuantizationMethod = "QAT" +) + +// All allowed values of ChatModelDetails enum +var AllowedChatModelDetailsQuantizationMethodEnumValues = []ChatModelDetailsQuantizationMethod{ + "PTQ", + "QAT", +} + +func (v *ChatModelDetailsQuantizationMethod) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ChatModelDetailsQuantizationMethod(value) + for _, existing := range AllowedChatModelDetailsQuantizationMethodEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ChatModelDetails", value) +} + +// NewChatModelDetailsQuantizationMethodFromValue returns a pointer to a valid ChatModelDetailsQuantizationMethod +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewChatModelDetailsQuantizationMethodFromValue(v string) (*ChatModelDetailsQuantizationMethod, error) { + ev := ChatModelDetailsQuantizationMethod(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ChatModelDetailsQuantizationMethod: valid values are %v", v, AllowedChatModelDetailsQuantizationMethodEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ChatModelDetailsQuantizationMethod) IsValid() bool { + for _, existing := range AllowedChatModelDetailsQuantizationMethodEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to QuantizationMethodQuantizationMethod value +func (v ChatModelDetailsQuantizationMethod) Ptr() *ChatModelDetailsQuantizationMethod { + return &v +} + +type NullableChatModelDetailsQuantizationMethod struct { + value *ChatModelDetailsQuantizationMethod + isSet bool +} + +func (v NullableChatModelDetailsQuantizationMethod) Get() *ChatModelDetailsQuantizationMethod { + return v.value +} + +func (v *NullableChatModelDetailsQuantizationMethod) Set(val *ChatModelDetailsQuantizationMethod) { + v.value = val + v.isSet = true +} + +func (v NullableChatModelDetailsQuantizationMethod) IsSet() bool { + return v.isSet +} + +func (v *NullableChatModelDetailsQuantizationMethod) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChatModelDetailsQuantizationMethod(val *ChatModelDetailsQuantizationMethod) *NullableChatModelDetailsQuantizationMethod { + return &NullableChatModelDetailsQuantizationMethod{value: val, isSet: true} +} + +func (v NullableChatModelDetailsQuantizationMethod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChatModelDetailsQuantizationMethod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ChatModelDetailsGetQuantizationMethodAttributeType = *ChatModelDetailsQuantizationMethod +type ChatModelDetailsGetQuantizationMethodArgType = ChatModelDetailsQuantizationMethod +type ChatModelDetailsGetQuantizationMethodRetType = ChatModelDetailsQuantizationMethod func getChatModelDetailsGetQuantizationMethodAttributeTypeOk(arg ChatModelDetailsGetQuantizationMethodAttributeType) (ret ChatModelDetailsGetQuantizationMethodRetType, ok bool) { if arg == nil { diff --git a/services/modelserving/model_embedding_model_details.go b/services/modelserving/model_embedding_model_details.go index d6eec497f..89ab932a3 100644 --- a/services/modelserving/model_embedding_model_details.go +++ b/services/modelserving/model_embedding_model_details.go @@ -12,6 +12,7 @@ package modelserving import ( "encoding/json" + "fmt" ) // checks if the EmbeddingModelDetails type satisfies the MappedNullable interface at compile time @@ -21,10 +22,112 @@ var _ MappedNullable = &EmbeddingModelDetails{} types and functions for category */ -// isEnumRef -type EmbeddingModelDetailsGetCategoryAttributeType = *string -type EmbeddingModelDetailsGetCategoryArgType = string -type EmbeddingModelDetailsGetCategoryRetType = string +//isEnum + +// EmbeddingModelDetailsCategory the model 'EmbeddingModelDetails' +type EmbeddingModelDetailsCategory string + +// List of Category +const ( + EMBEDDINGMODELDETAILSCATEGORY_STANDARD EmbeddingModelDetailsCategory = "standard" + EMBEDDINGMODELDETAILSCATEGORY_PLUS EmbeddingModelDetailsCategory = "plus" + EMBEDDINGMODELDETAILSCATEGORY_PREMIUM EmbeddingModelDetailsCategory = "premium" +) + +// All allowed values of EmbeddingModelDetails enum +var AllowedEmbeddingModelDetailsCategoryEnumValues = []EmbeddingModelDetailsCategory{ + "standard", + "plus", + "premium", +} + +func (v *EmbeddingModelDetailsCategory) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := EmbeddingModelDetailsCategory(value) + for _, existing := range AllowedEmbeddingModelDetailsCategoryEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EmbeddingModelDetails", value) +} + +// NewEmbeddingModelDetailsCategoryFromValue returns a pointer to a valid EmbeddingModelDetailsCategory +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEmbeddingModelDetailsCategoryFromValue(v string) (*EmbeddingModelDetailsCategory, error) { + ev := EmbeddingModelDetailsCategory(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EmbeddingModelDetailsCategory: valid values are %v", v, AllowedEmbeddingModelDetailsCategoryEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EmbeddingModelDetailsCategory) IsValid() bool { + for _, existing := range AllowedEmbeddingModelDetailsCategoryEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CategoryCategory value +func (v EmbeddingModelDetailsCategory) Ptr() *EmbeddingModelDetailsCategory { + return &v +} + +type NullableEmbeddingModelDetailsCategory struct { + value *EmbeddingModelDetailsCategory + isSet bool +} + +func (v NullableEmbeddingModelDetailsCategory) Get() *EmbeddingModelDetailsCategory { + return v.value +} + +func (v *NullableEmbeddingModelDetailsCategory) Set(val *EmbeddingModelDetailsCategory) { + v.value = val + v.isSet = true +} + +func (v NullableEmbeddingModelDetailsCategory) IsSet() bool { + return v.isSet +} + +func (v *NullableEmbeddingModelDetailsCategory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEmbeddingModelDetailsCategory(val *EmbeddingModelDetailsCategory) *NullableEmbeddingModelDetailsCategory { + return &NullableEmbeddingModelDetailsCategory{value: val, isSet: true} +} + +func (v NullableEmbeddingModelDetailsCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEmbeddingModelDetailsCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type EmbeddingModelDetailsGetCategoryAttributeType = *EmbeddingModelDetailsCategory +type EmbeddingModelDetailsGetCategoryArgType = EmbeddingModelDetailsCategory +type EmbeddingModelDetailsGetCategoryRetType = EmbeddingModelDetailsCategory func getEmbeddingModelDetailsGetCategoryAttributeTypeOk(arg EmbeddingModelDetailsGetCategoryAttributeType) (ret EmbeddingModelDetailsGetCategoryRetType, ok bool) { if arg == nil { diff --git a/services/modelserving/model_model.go b/services/modelserving/model_model.go index 98e79990c..2a7a03c33 100644 --- a/services/modelserving/model_model.go +++ b/services/modelserving/model_model.go @@ -12,6 +12,7 @@ package modelserving import ( "encoding/json" + "fmt" ) // checks if the Model type satisfies the MappedNullable interface at compile time @@ -21,10 +22,112 @@ var _ MappedNullable = &Model{} types and functions for category */ -// isEnumRef -type ModelGetCategoryAttributeType = *string -type ModelGetCategoryArgType = string -type ModelGetCategoryRetType = string +//isEnum + +// ModelCategory the model 'Model' +type ModelCategory string + +// List of Category +const ( + MODELCATEGORY_STANDARD ModelCategory = "standard" + MODELCATEGORY_PLUS ModelCategory = "plus" + MODELCATEGORY_PREMIUM ModelCategory = "premium" +) + +// All allowed values of Model enum +var AllowedModelCategoryEnumValues = []ModelCategory{ + "standard", + "plus", + "premium", +} + +func (v *ModelCategory) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ModelCategory(value) + for _, existing := range AllowedModelCategoryEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Model", value) +} + +// NewModelCategoryFromValue returns a pointer to a valid ModelCategory +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewModelCategoryFromValue(v string) (*ModelCategory, error) { + ev := ModelCategory(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ModelCategory: valid values are %v", v, AllowedModelCategoryEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ModelCategory) IsValid() bool { + for _, existing := range AllowedModelCategoryEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CategoryCategory value +func (v ModelCategory) Ptr() *ModelCategory { + return &v +} + +type NullableModelCategory struct { + value *ModelCategory + isSet bool +} + +func (v NullableModelCategory) Get() *ModelCategory { + return v.value +} + +func (v *NullableModelCategory) Set(val *ModelCategory) { + v.value = val + v.isSet = true +} + +func (v NullableModelCategory) IsSet() bool { + return v.isSet +} + +func (v *NullableModelCategory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelCategory(val *ModelCategory) *NullableModelCategory { + return &NullableModelCategory{value: val, isSet: true} +} + +func (v NullableModelCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ModelGetCategoryAttributeType = *ModelCategory +type ModelGetCategoryArgType = ModelCategory +type ModelGetCategoryRetType = ModelCategory func getModelGetCategoryAttributeTypeOk(arg ModelGetCategoryAttributeType) (ret ModelGetCategoryRetType, ok bool) { if arg == nil { @@ -186,10 +289,110 @@ func setModelGetTagsAttributeType(arg *ModelGetTagsAttributeType, val ModelGetTa types and functions for type */ -// isEnumRef -type ModelGetTypeAttributeType = *string -type ModelGetTypeArgType = string -type ModelGetTypeRetType = string +//isEnum + +// ModelTypes the model 'Model' +type ModelTypes string + +// List of Type +const ( + MODELTYPE_CHAT ModelTypes = "chat" + MODELTYPE_EMBEDDING ModelTypes = "embedding" +) + +// All allowed values of Model enum +var AllowedModelTypesEnumValues = []ModelTypes{ + "chat", + "embedding", +} + +func (v *ModelTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ModelTypes(value) + for _, existing := range AllowedModelTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Model", value) +} + +// NewModelTypesFromValue returns a pointer to a valid ModelTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewModelTypesFromValue(v string) (*ModelTypes, error) { + ev := ModelTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ModelTypes: valid values are %v", v, AllowedModelTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ModelTypes) IsValid() bool { + for _, existing := range AllowedModelTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v ModelTypes) Ptr() *ModelTypes { + return &v +} + +type NullableModelTypes struct { + value *ModelTypes + isSet bool +} + +func (v NullableModelTypes) Get() *ModelTypes { + return v.value +} + +func (v *NullableModelTypes) Set(val *ModelTypes) { + v.value = val + v.isSet = true +} + +func (v NullableModelTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableModelTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelTypes(val *ModelTypes) *NullableModelTypes { + return &NullableModelTypes{value: val, isSet: true} +} + +func (v NullableModelTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ModelGetTypeAttributeType = *ModelTypes +type ModelGetTypeArgType = ModelTypes +type ModelGetTypeRetType = ModelTypes func getModelGetTypeAttributeTypeOk(arg ModelGetTypeAttributeType) (ret ModelGetTypeRetType, ok bool) { if arg == nil { @@ -255,7 +458,7 @@ type _Model Model // 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 NewModel(category ModelGetCategoryArgType, description ModelGetDescriptionArgType, displayedName ModelGetDisplayedNameArgType, id ModelGetIdArgType, name ModelGetNameArgType, region ModelGetRegionArgType, skus ModelGetSkusArgType, type_ ModelGetTypeArgType, url ModelGetUrlArgType) *Model { +func NewModel(category ModelGetCategoryArgType, description ModelGetDescriptionArgType, displayedName ModelGetDisplayedNameArgType, id ModelGetIdArgType, name ModelGetNameArgType, region ModelGetRegionArgType, skus ModelGetSkusArgType, types ModelGetTypeArgType, url ModelGetUrlArgType) *Model { this := Model{} setModelGetCategoryAttributeType(&this.Category, category) setModelGetDescriptionAttributeType(&this.Description, description) @@ -264,7 +467,7 @@ func NewModel(category ModelGetCategoryArgType, description ModelGetDescriptionA setModelGetNameAttributeType(&this.Name, name) setModelGetRegionAttributeType(&this.Region, region) setModelGetSkusAttributeType(&this.Skus, skus) - setModelGetTypeAttributeType(&this.Type, type_) + setModelGetTypeAttributeType(&this.Type, types) setModelGetUrlAttributeType(&this.Url, url) return &this } diff --git a/services/modelserving/model_token.go b/services/modelserving/model_token.go index e85a142fe..b8fdf8e8c 100644 --- a/services/modelserving/model_token.go +++ b/services/modelserving/model_token.go @@ -12,6 +12,7 @@ package modelserving import ( "encoding/json" + "fmt" "time" ) @@ -106,10 +107,114 @@ type TokenGetRegionRetType = string types and functions for state */ -// isEnumRef -type TokenGetStateAttributeType = *string -type TokenGetStateArgType = string -type TokenGetStateRetType = string +//isEnum + +// TokenState the model 'Token' +type TokenState string + +// List of State +const ( + TOKENSTATE_CREATING TokenState = "creating" + TOKENSTATE_ACTIVE TokenState = "active" + TOKENSTATE_DELETING TokenState = "deleting" + TOKENSTATE_INACTIVE TokenState = "inactive" +) + +// All allowed values of Token enum +var AllowedTokenStateEnumValues = []TokenState{ + "creating", + "active", + "deleting", + "inactive", +} + +func (v *TokenState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := TokenState(value) + for _, existing := range AllowedTokenStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Token", value) +} + +// NewTokenStateFromValue returns a pointer to a valid TokenState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTokenStateFromValue(v string) (*TokenState, error) { + ev := TokenState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TokenState: valid values are %v", v, AllowedTokenStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TokenState) IsValid() bool { + for _, existing := range AllowedTokenStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v TokenState) Ptr() *TokenState { + return &v +} + +type NullableTokenState struct { + value *TokenState + isSet bool +} + +func (v NullableTokenState) Get() *TokenState { + return v.value +} + +func (v *NullableTokenState) Set(val *TokenState) { + v.value = val + v.isSet = true +} + +func (v NullableTokenState) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenState(val *TokenState) *NullableTokenState { + return &NullableTokenState{value: val, isSet: true} +} + +func (v NullableTokenState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TokenGetStateAttributeType = *TokenState +type TokenGetStateArgType = TokenState +type TokenGetStateRetType = TokenState func getTokenGetStateAttributeTypeOk(arg TokenGetStateAttributeType) (ret TokenGetStateRetType, ok bool) { if arg == nil { diff --git a/services/modelserving/model_token_created.go b/services/modelserving/model_token_created.go index c8c95d8c3..559161d4d 100644 --- a/services/modelserving/model_token_created.go +++ b/services/modelserving/model_token_created.go @@ -12,6 +12,7 @@ package modelserving import ( "encoding/json" + "fmt" "time" ) @@ -127,10 +128,112 @@ type TokenCreatedGetRegionRetType = string types and functions for state */ -// isEnumRef -type TokenCreatedGetStateAttributeType = *string -type TokenCreatedGetStateArgType = string -type TokenCreatedGetStateRetType = string +//isEnum + +// TokenCreatedState the model 'TokenCreated' +type TokenCreatedState string + +// List of State +const ( + TOKENCREATEDSTATE_CREATING TokenCreatedState = "creating" + TOKENCREATEDSTATE_ACTIVE TokenCreatedState = "active" + TOKENCREATEDSTATE_DELETING TokenCreatedState = "deleting" +) + +// All allowed values of TokenCreated enum +var AllowedTokenCreatedStateEnumValues = []TokenCreatedState{ + "creating", + "active", + "deleting", +} + +func (v *TokenCreatedState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := TokenCreatedState(value) + for _, existing := range AllowedTokenCreatedStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TokenCreated", value) +} + +// NewTokenCreatedStateFromValue returns a pointer to a valid TokenCreatedState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTokenCreatedStateFromValue(v string) (*TokenCreatedState, error) { + ev := TokenCreatedState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TokenCreatedState: valid values are %v", v, AllowedTokenCreatedStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TokenCreatedState) IsValid() bool { + for _, existing := range AllowedTokenCreatedStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v TokenCreatedState) Ptr() *TokenCreatedState { + return &v +} + +type NullableTokenCreatedState struct { + value *TokenCreatedState + isSet bool +} + +func (v NullableTokenCreatedState) Get() *TokenCreatedState { + return v.value +} + +func (v *NullableTokenCreatedState) Set(val *TokenCreatedState) { + v.value = val + v.isSet = true +} + +func (v NullableTokenCreatedState) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenCreatedState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenCreatedState(val *TokenCreatedState) *NullableTokenCreatedState { + return &NullableTokenCreatedState{value: val, isSet: true} +} + +func (v NullableTokenCreatedState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenCreatedState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TokenCreatedGetStateAttributeType = *TokenCreatedState +type TokenCreatedGetStateArgType = TokenCreatedState +type TokenCreatedGetStateRetType = TokenCreatedState func getTokenCreatedGetStateAttributeTypeOk(arg TokenCreatedGetStateAttributeType) (ret TokenCreatedGetStateRetType, ok bool) { if arg == nil { diff --git a/services/modelserving/wait/wait.go b/services/modelserving/wait/wait.go index 7c7341394..e6548062e 100644 --- a/services/modelserving/wait/wait.go +++ b/services/modelserving/wait/wait.go @@ -12,10 +12,6 @@ import ( "github.com/stackitcloud/stackit-sdk-go/services/modelserving" ) -const ( - activeState = "active" -) - type APIClientInterface interface { GetTokenExecute(ctx context.Context, region, projectId, tokenId string) (*modelserving.GetTokenResponse, error) } @@ -32,7 +28,7 @@ func CreateModelServingWaitHandler(ctx context.Context, a APIClientInterface, re tokenId, ) } - if *getTokenResp.Token.State == activeState { + if *getTokenResp.Token.State == modelserving.TOKENSTATE_ACTIVE { return true, getTokenResp, nil } diff --git a/services/modelserving/wait/wait_test.go b/services/modelserving/wait/wait_test.go index 31fd6f7b1..f91cea8ec 100644 --- a/services/modelserving/wait/wait_test.go +++ b/services/modelserving/wait/wait_test.go @@ -13,7 +13,7 @@ import ( type apiClientMocked struct { getFails bool - resourceState string + resourceState modelserving.TokenState statusCode int } @@ -37,7 +37,7 @@ func TestCreateModelServingWaitHandler(t *testing.T) { desc string getFails bool statusCode int - resourceState string + resourceState modelserving.TokenState wantErr bool wantResp bool }{ @@ -45,7 +45,7 @@ func TestCreateModelServingWaitHandler(t *testing.T) { desc: "create_succeeded", getFails: false, statusCode: 200, - resourceState: activeState, + resourceState: modelserving.TOKENSTATE_ACTIVE, wantErr: false, wantResp: true, }, @@ -103,7 +103,7 @@ func TestUpdateModelServingWaitHandler(t *testing.T) { desc string getFails bool statusCode int - resourceState string + resourceState modelserving.TokenState wantErr bool wantResp bool }{ @@ -111,7 +111,7 @@ func TestUpdateModelServingWaitHandler(t *testing.T) { desc: "update_succeeded", getFails: false, statusCode: 200, - resourceState: activeState, + resourceState: modelserving.TOKENSTATE_ACTIVE, wantErr: false, wantResp: true, }, @@ -169,7 +169,7 @@ func TestDeleteModelServingWaitHandler(t *testing.T) { desc string getFails bool statusCode int - resourceState string + resourceState modelserving.TokenState wantErr bool wantResp bool }{ @@ -185,7 +185,7 @@ func TestDeleteModelServingWaitHandler(t *testing.T) { desc: "delete_in_progress", getFails: false, statusCode: 200, - resourceState: "DELETING", + resourceState: modelserving.TOKENSTATE_DELETING, wantErr: true, // Should timeout since delete is not complete wantResp: false, }, diff --git a/services/mongodbflex/CHANGELOG.md b/services/mongodbflex/CHANGELOG.md index c4e8e0d92..bc4f05609 100644 --- a/services/mongodbflex/CHANGELOG.md +++ b/services/mongodbflex/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.0.1 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/mongodbflex/model_instance.go b/services/mongodbflex/model_instance.go index d0fde3510..62c15a816 100644 --- a/services/mongodbflex/model_instance.go +++ b/services/mongodbflex/model_instance.go @@ -12,6 +12,7 @@ package mongodbflex import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -164,10 +165,116 @@ func setInstanceGetReplicasAttributeType(arg *InstanceGetReplicasAttributeType, types and functions for status */ -// isEnumRef -type InstanceGetStatusAttributeType = *string -type InstanceGetStatusArgType = string -type InstanceGetStatusRetType = string +//isEnum + +// InstanceStatus The current status of the instance. +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_READY InstanceStatus = "READY" + INSTANCESTATUS_PENDING InstanceStatus = "PENDING" + INSTANCESTATUS_PROCESSING InstanceStatus = "PROCESSING" + INSTANCESTATUS_FAILED InstanceStatus = "FAILED" + INSTANCESTATUS_UNKNOWN InstanceStatus = "UNKNOWN" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "READY", + "PENDING", + "PROCESSING", + "FAILED", + "UNKNOWN", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/mongodbflex/model_instance_list_instance.go b/services/mongodbflex/model_instance_list_instance.go index ad9d78eae..4826b9d1a 100644 --- a/services/mongodbflex/model_instance_list_instance.go +++ b/services/mongodbflex/model_instance_list_instance.go @@ -12,6 +12,7 @@ package mongodbflex import ( "encoding/json" + "fmt" ) // checks if the InstanceListInstance type satisfies the MappedNullable interface at compile time @@ -63,10 +64,116 @@ type InstanceListInstanceGetNameRetType = string types and functions for status */ -// isEnumRef -type InstanceListInstanceGetStatusAttributeType = *string -type InstanceListInstanceGetStatusArgType = string -type InstanceListInstanceGetStatusRetType = string +//isEnum + +// InstanceListInstanceStatus The current status of the instance. +type InstanceListInstanceStatus string + +// List of Status +const ( + INSTANCELISTINSTANCESTATUS_READY InstanceListInstanceStatus = "READY" + INSTANCELISTINSTANCESTATUS_PENDING InstanceListInstanceStatus = "PENDING" + INSTANCELISTINSTANCESTATUS_PROCESSING InstanceListInstanceStatus = "PROCESSING" + INSTANCELISTINSTANCESTATUS_FAILED InstanceListInstanceStatus = "FAILED" + INSTANCELISTINSTANCESTATUS_UNKNOWN InstanceListInstanceStatus = "UNKNOWN" +) + +// All allowed values of InstanceListInstance enum +var AllowedInstanceListInstanceStatusEnumValues = []InstanceListInstanceStatus{ + "READY", + "PENDING", + "PROCESSING", + "FAILED", + "UNKNOWN", +} + +func (v *InstanceListInstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceListInstanceStatus(value) + for _, existing := range AllowedInstanceListInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceListInstance", value) +} + +// NewInstanceListInstanceStatusFromValue returns a pointer to a valid InstanceListInstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceListInstanceStatusFromValue(v string) (*InstanceListInstanceStatus, error) { + ev := InstanceListInstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceListInstanceStatus: valid values are %v", v, AllowedInstanceListInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceListInstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceListInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceListInstanceStatus) Ptr() *InstanceListInstanceStatus { + return &v +} + +type NullableInstanceListInstanceStatus struct { + value *InstanceListInstanceStatus + isSet bool +} + +func (v NullableInstanceListInstanceStatus) Get() *InstanceListInstanceStatus { + return v.value +} + +func (v *NullableInstanceListInstanceStatus) Set(val *InstanceListInstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceListInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceListInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceListInstanceStatus(val *InstanceListInstanceStatus) *NullableInstanceListInstanceStatus { + return &NullableInstanceListInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceListInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceListInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceListInstanceGetStatusAttributeType = *InstanceListInstanceStatus +type InstanceListInstanceGetStatusArgType = InstanceListInstanceStatus +type InstanceListInstanceGetStatusRetType = InstanceListInstanceStatus func getInstanceListInstanceGetStatusAttributeTypeOk(arg InstanceListInstanceGetStatusAttributeType) (ret InstanceListInstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/mongodbflex/wait/wait.go b/services/mongodbflex/wait/wait.go index 104468e1d..b9a54b5e4 100644 --- a/services/mongodbflex/wait/wait.go +++ b/services/mongodbflex/wait/wait.go @@ -13,11 +13,15 @@ import ( ) const ( - InstanceStateEmpty = "" + InstanceStateEmpty = "" + // Deprecated: InstanceStateProcessing is deprecated and will be removed after 14th November 2025. Use [mongodbflex.INSTANCESTATUS_PROCESSING] instead. InstanceStateProcessing = "PROCESSING" - InstanceStateUnknown = "UNKNOWN" - InstanceStateSuccess = "READY" - InstanceStateFailed = "FAILED" + // Deprecated: InstanceStateUnknown is deprecated and will be removed after 14th November 2025. Use [mongodbflex.INSTANCESTATUS_UNKNOWN] instead. + InstanceStateUnknown = "UNKNOWN" + // Deprecated: InstanceStateSuccess is deprecated and will be removed after 14th November 2025. Use [mongodbflex.INSTANCESTATUS_READY] instead. + InstanceStateSuccess = "READY" + // Deprecated: InstanceStateFailed is deprecated and will be removed after 14th November 2025. Use [mongodbflex.INSTANCESTATUS_FAILED] instead. + InstanceStateFailed = "FAILED" RestoreJobProcessing = "IN_PROGRESS" RestoreJobFinished = "FINISHED" @@ -46,13 +50,13 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, *s.Item.Status) case InstanceStateEmpty: return false, nil, nil - case InstanceStateProcessing: + case mongodbflex.INSTANCESTATUS_PROCESSING: return false, nil, nil - case InstanceStateUnknown: + case mongodbflex.INSTANCESTATUS_UNKNOWN: return false, nil, nil - case InstanceStateSuccess: + case mongodbflex.INSTANCESTATUS_READY: return true, s, nil - case InstanceStateFailed: + case mongodbflex.INSTANCESTATUS_FAILED: return true, s, fmt.Errorf("create failed for instance with id %s", instanceId) } }) @@ -125,13 +129,13 @@ func UpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, *s.Item.Status) case InstanceStateEmpty: return false, nil, nil - case InstanceStateProcessing: + case mongodbflex.INSTANCESTATUS_PROCESSING: return false, nil, nil - case InstanceStateUnknown: + case mongodbflex.INSTANCESTATUS_UNKNOWN: return false, nil, nil - case InstanceStateSuccess: + case mongodbflex.INSTANCESTATUS_READY: return true, s, nil - case InstanceStateFailed: + case mongodbflex.INSTANCESTATUS_FAILED: return true, s, fmt.Errorf("update failed for instance with id %s", instanceId) } }) diff --git a/services/mongodbflex/wait/wait_test.go b/services/mongodbflex/wait/wait_test.go index 9f908d93a..fcbfa4925 100644 --- a/services/mongodbflex/wait/wait_test.go +++ b/services/mongodbflex/wait/wait_test.go @@ -14,7 +14,7 @@ import ( // Used for testing instance operations type apiClientInstanceMocked struct { instanceId string - instanceState string + instanceState mongodbflex.InstanceStatus instanceIsDeleted bool instanceGetFails bool @@ -65,7 +65,7 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string instanceGetFails bool - instanceState string + instanceState mongodbflex.InstanceStatus usersGetErrorStatus int wantErr bool wantResp bool @@ -73,14 +73,14 @@ func TestCreateInstanceWaitHandler(t *testing.T) { { desc: "create_succeeded", instanceGetFails: false, - instanceState: InstanceStateSuccess, + instanceState: mongodbflex.INSTANCESTATUS_READY, wantErr: false, wantResp: true, }, { desc: "create_failed", instanceGetFails: false, - instanceState: InstanceStateFailed, + instanceState: mongodbflex.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -100,7 +100,7 @@ func TestCreateInstanceWaitHandler(t *testing.T) { { desc: "timeout", instanceGetFails: false, - instanceState: InstanceStateProcessing, + instanceState: mongodbflex.INSTANCESTATUS_PROCESSING, wantErr: true, wantResp: false, }, @@ -143,21 +143,21 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string instanceGetFails bool - instanceState string + instanceState mongodbflex.InstanceStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", instanceGetFails: false, - instanceState: InstanceStateSuccess, + instanceState: mongodbflex.INSTANCESTATUS_READY, wantErr: false, wantResp: true, }, { desc: "update_failed", instanceGetFails: false, - instanceState: InstanceStateFailed, + instanceState: mongodbflex.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -177,7 +177,7 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { { desc: "timeout", instanceGetFails: false, - instanceState: InstanceStateProcessing, + instanceState: mongodbflex.INSTANCESTATUS_PROCESSING, wantErr: true, wantResp: false, }, @@ -220,19 +220,19 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { tests := []struct { desc string instanceGetFails bool - instanceState string + instanceState mongodbflex.InstanceStatus wantErr bool }{ { desc: "delete_succeeded", instanceGetFails: false, - instanceState: InstanceStateSuccess, + instanceState: mongodbflex.INSTANCESTATUS_READY, wantErr: false, }, { desc: "delete_failed", instanceGetFails: false, - instanceState: InstanceStateFailed, + instanceState: mongodbflex.INSTANCESTATUS_FAILED, wantErr: true, }, { @@ -247,7 +247,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { apiClient := &apiClientInstanceMocked{ instanceGetFails: tt.instanceGetFails, - instanceIsDeleted: tt.instanceState == InstanceStateSuccess, + instanceIsDeleted: tt.instanceState == mongodbflex.INSTANCESTATUS_READY, instanceId: instanceId, instanceState: tt.instanceState, } diff --git a/services/objectstorage/model_validation_error.go b/services/objectstorage/model_validation_error.go index d49f8b1b6..4dc923722 100644 --- a/services/objectstorage/model_validation_error.go +++ b/services/objectstorage/model_validation_error.go @@ -95,11 +95,11 @@ type _ValidationError ValidationError // 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 NewValidationError(loc ValidationErrorGetLocArgType, msg ValidationErrorGetMsgArgType, type_ ValidationErrorGetTypeArgType) *ValidationError { +func NewValidationError(loc ValidationErrorGetLocArgType, msg ValidationErrorGetMsgArgType, types ValidationErrorGetTypeArgType) *ValidationError { this := ValidationError{} setValidationErrorGetLocAttributeType(&this.Loc, loc) setValidationErrorGetMsgAttributeType(&this.Msg, msg) - setValidationErrorGetTypeAttributeType(&this.Type, type_) + setValidationErrorGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/observability/CHANGELOG.md b/services/observability/CHANGELOG.md index b30915a48..ef87755b9 100644 --- a/services/observability/CHANGELOG.md +++ b/services/observability/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.6.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.5.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/observability/model_create_scrape_config_payload.go b/services/observability/model_create_scrape_config_payload.go index 428e6b280..d3735e555 100644 --- a/services/observability/model_create_scrape_config_payload.go +++ b/services/observability/model_create_scrape_config_payload.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the CreateScrapeConfigPayload type satisfies the MappedNullable interface at compile time @@ -244,10 +245,110 @@ func setCreateScrapeConfigPayloadGetSampleLimitAttributeType(arg *CreateScrapeCo types and functions for scheme */ -// isEnumRef -type CreateScrapeConfigPayloadGetSchemeAttributeType = *string -type CreateScrapeConfigPayloadGetSchemeArgType = string -type CreateScrapeConfigPayloadGetSchemeRetType = string +//isEnum + +// CreateScrapeConfigPayloadScheme Configures the protocol scheme used for requests. https or http +type CreateScrapeConfigPayloadScheme string + +// List of Scheme +const ( + CREATESCRAPECONFIGPAYLOADSCHEME_HTTP CreateScrapeConfigPayloadScheme = "http" + CREATESCRAPECONFIGPAYLOADSCHEME_HTTPS CreateScrapeConfigPayloadScheme = "https" +) + +// All allowed values of CreateScrapeConfigPayload enum +var AllowedCreateScrapeConfigPayloadSchemeEnumValues = []CreateScrapeConfigPayloadScheme{ + "http", + "https", +} + +func (v *CreateScrapeConfigPayloadScheme) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateScrapeConfigPayloadScheme(value) + for _, existing := range AllowedCreateScrapeConfigPayloadSchemeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateScrapeConfigPayload", value) +} + +// NewCreateScrapeConfigPayloadSchemeFromValue returns a pointer to a valid CreateScrapeConfigPayloadScheme +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateScrapeConfigPayloadSchemeFromValue(v string) (*CreateScrapeConfigPayloadScheme, error) { + ev := CreateScrapeConfigPayloadScheme(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateScrapeConfigPayloadScheme: valid values are %v", v, AllowedCreateScrapeConfigPayloadSchemeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateScrapeConfigPayloadScheme) IsValid() bool { + for _, existing := range AllowedCreateScrapeConfigPayloadSchemeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SchemeScheme value +func (v CreateScrapeConfigPayloadScheme) Ptr() *CreateScrapeConfigPayloadScheme { + return &v +} + +type NullableCreateScrapeConfigPayloadScheme struct { + value *CreateScrapeConfigPayloadScheme + isSet bool +} + +func (v NullableCreateScrapeConfigPayloadScheme) Get() *CreateScrapeConfigPayloadScheme { + return v.value +} + +func (v *NullableCreateScrapeConfigPayloadScheme) Set(val *CreateScrapeConfigPayloadScheme) { + v.value = val + v.isSet = true +} + +func (v NullableCreateScrapeConfigPayloadScheme) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateScrapeConfigPayloadScheme) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateScrapeConfigPayloadScheme(val *CreateScrapeConfigPayloadScheme) *NullableCreateScrapeConfigPayloadScheme { + return &NullableCreateScrapeConfigPayloadScheme{value: val, isSet: true} +} + +func (v NullableCreateScrapeConfigPayloadScheme) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateScrapeConfigPayloadScheme) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateScrapeConfigPayloadGetSchemeAttributeType = *CreateScrapeConfigPayloadScheme +type CreateScrapeConfigPayloadGetSchemeArgType = CreateScrapeConfigPayloadScheme +type CreateScrapeConfigPayloadGetSchemeRetType = CreateScrapeConfigPayloadScheme func getCreateScrapeConfigPayloadGetSchemeAttributeTypeOk(arg CreateScrapeConfigPayloadGetSchemeAttributeType) (ret CreateScrapeConfigPayloadGetSchemeRetType, ok bool) { if arg == nil { diff --git a/services/observability/model_create_scrape_config_payload_metrics_relabel_configs_inner.go b/services/observability/model_create_scrape_config_payload_metrics_relabel_configs_inner.go index a5362b183..70395bf50 100644 --- a/services/observability/model_create_scrape_config_payload_metrics_relabel_configs_inner.go +++ b/services/observability/model_create_scrape_config_payload_metrics_relabel_configs_inner.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the CreateScrapeConfigPayloadMetricsRelabelConfigsInner type satisfies the MappedNullable interface at compile time @@ -21,10 +22,120 @@ var _ MappedNullable = &CreateScrapeConfigPayloadMetricsRelabelConfigsInner{} types and functions for action */ -// isEnumRef -type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionAttributeType = *string -type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionArgType = string -type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionRetType = string +//isEnum + +// CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction Action to perform based on regex matching. `Additional Validators:` * if action is replace, targetLabel needs to be in body +type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction string + +// List of Action +const ( + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_REPLACE CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "replace" + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_KEEP CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "keep" + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_DROP CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "drop" + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_HASHMOD CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "hashmod" + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_LABELMAP CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "labelmap" + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_LABELDROP CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "labeldrop" + CREATESCRAPECONFIGPAYLOADMETRICSRELABELCONFIGSINNERACTION_LABELKEEP CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "labelkeep" +) + +// All allowed values of CreateScrapeConfigPayloadMetricsRelabelConfigsInner enum +var AllowedCreateScrapeConfigPayloadMetricsRelabelConfigsInnerActionEnumValues = []CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction{ + "replace", + "keep", + "drop", + "hashmod", + "labelmap", + "labeldrop", + "labelkeep", +} + +func (v *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction(value) + for _, existing := range AllowedCreateScrapeConfigPayloadMetricsRelabelConfigsInnerActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateScrapeConfigPayloadMetricsRelabelConfigsInner", value) +} + +// NewCreateScrapeConfigPayloadMetricsRelabelConfigsInnerActionFromValue returns a pointer to a valid CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateScrapeConfigPayloadMetricsRelabelConfigsInnerActionFromValue(v string) (*CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction, error) { + ev := CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction: valid values are %v", v, AllowedCreateScrapeConfigPayloadMetricsRelabelConfigsInnerActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) IsValid() bool { + for _, existing := range AllowedCreateScrapeConfigPayloadMetricsRelabelConfigsInnerActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ActionAction value +func (v CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) Ptr() *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction { + return &v +} + +type NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction struct { + value *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction + isSet bool +} + +func (v NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) Get() *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction { + return v.value +} + +func (v *NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) Set(val *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) { + v.value = val + v.isSet = true +} + +func (v NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction(val *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) *NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction { + return &NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction{value: val, isSet: true} +} + +func (v NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionAttributeType = *CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction +type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionArgType = CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction +type CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionRetType = CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction func getCreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionAttributeTypeOk(arg CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionAttributeType) (ret CreateScrapeConfigPayloadMetricsRelabelConfigsInnerGetActionRetType, ok bool) { if arg == nil { @@ -193,7 +304,7 @@ func NewCreateScrapeConfigPayloadMetricsRelabelConfigsInner() *CreateScrapeConfi // but it doesn't guarantee that properties required by API are set func NewCreateScrapeConfigPayloadMetricsRelabelConfigsInnerWithDefaults() *CreateScrapeConfigPayloadMetricsRelabelConfigsInner { this := CreateScrapeConfigPayloadMetricsRelabelConfigsInner{} - var action string = "replace" + var action CreateScrapeConfigPayloadMetricsRelabelConfigsInnerAction = "replace" this.Action = &action var regex string = ".*" this.Regex = ®ex diff --git a/services/observability/model_get_instance_response.go b/services/observability/model_get_instance_response.go index eba3407cb..5e5c699aa 100644 --- a/services/observability/model_get_instance_response.go +++ b/services/observability/model_get_instance_response.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the GetInstanceResponse type satisfies the MappedNullable interface at compile time @@ -274,10 +275,124 @@ type GetInstanceResponseGetServiceNameRetType = string types and functions for status */ -// isEnumRef -type GetInstanceResponseGetStatusAttributeType = *string -type GetInstanceResponseGetStatusArgType = string -type GetInstanceResponseGetStatusRetType = string +//isEnum + +// GetInstanceResponseStatus the model 'GetInstanceResponse' +type GetInstanceResponseStatus string + +// List of Status +const ( + GETINSTANCERESPONSESTATUS_CREATING GetInstanceResponseStatus = "CREATING" + GETINSTANCERESPONSESTATUS_CREATE_SUCCEEDED GetInstanceResponseStatus = "CREATE_SUCCEEDED" + GETINSTANCERESPONSESTATUS_CREATE_FAILED GetInstanceResponseStatus = "CREATE_FAILED" + GETINSTANCERESPONSESTATUS_DELETING GetInstanceResponseStatus = "DELETING" + GETINSTANCERESPONSESTATUS_DELETE_SUCCEEDED GetInstanceResponseStatus = "DELETE_SUCCEEDED" + GETINSTANCERESPONSESTATUS_DELETE_FAILED GetInstanceResponseStatus = "DELETE_FAILED" + GETINSTANCERESPONSESTATUS_UPDATING GetInstanceResponseStatus = "UPDATING" + GETINSTANCERESPONSESTATUS_UPDATE_SUCCEEDED GetInstanceResponseStatus = "UPDATE_SUCCEEDED" + GETINSTANCERESPONSESTATUS_UPDATE_FAILED GetInstanceResponseStatus = "UPDATE_FAILED" +) + +// All allowed values of GetInstanceResponse enum +var AllowedGetInstanceResponseStatusEnumValues = []GetInstanceResponseStatus{ + "CREATING", + "CREATE_SUCCEEDED", + "CREATE_FAILED", + "DELETING", + "DELETE_SUCCEEDED", + "DELETE_FAILED", + "UPDATING", + "UPDATE_SUCCEEDED", + "UPDATE_FAILED", +} + +func (v *GetInstanceResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetInstanceResponseStatus(value) + for _, existing := range AllowedGetInstanceResponseStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetInstanceResponse", value) +} + +// NewGetInstanceResponseStatusFromValue returns a pointer to a valid GetInstanceResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetInstanceResponseStatusFromValue(v string) (*GetInstanceResponseStatus, error) { + ev := GetInstanceResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetInstanceResponseStatus: valid values are %v", v, AllowedGetInstanceResponseStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetInstanceResponseStatus) IsValid() bool { + for _, existing := range AllowedGetInstanceResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v GetInstanceResponseStatus) Ptr() *GetInstanceResponseStatus { + return &v +} + +type NullableGetInstanceResponseStatus struct { + value *GetInstanceResponseStatus + isSet bool +} + +func (v NullableGetInstanceResponseStatus) Get() *GetInstanceResponseStatus { + return v.value +} + +func (v *NullableGetInstanceResponseStatus) Set(val *GetInstanceResponseStatus) { + v.value = val + v.isSet = true +} + +func (v NullableGetInstanceResponseStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableGetInstanceResponseStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetInstanceResponseStatus(val *GetInstanceResponseStatus) *NullableGetInstanceResponseStatus { + return &NullableGetInstanceResponseStatus{value: val, isSet: true} +} + +func (v NullableGetInstanceResponseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetInstanceResponseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetInstanceResponseGetStatusAttributeType = *GetInstanceResponseStatus +type GetInstanceResponseGetStatusArgType = GetInstanceResponseStatus +type GetInstanceResponseGetStatusRetType = GetInstanceResponseStatus func getGetInstanceResponseGetStatusAttributeTypeOk(arg GetInstanceResponseGetStatusAttributeType) (ret GetInstanceResponseGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/observability/model_instance.go b/services/observability/model_instance.go index 159f5a46e..356e08a6f 100644 --- a/services/observability/model_instance.go +++ b/services/observability/model_instance.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -204,10 +205,132 @@ func setInstanceGetPlanAttributeType(arg *InstanceGetPlanAttributeType, val Inst types and functions for state */ -// isEnumRef -type InstanceGetStateAttributeType = *string -type InstanceGetStateArgType = string -type InstanceGetStateRetType = string +//isEnum + +// InstanceState the model 'Instance' +type InstanceState string + +// List of State +const ( + INSTANCESTATE_CREATION_STARTED InstanceState = "Component creation started" + INSTANCESTATE_CREATION_FAILED InstanceState = "Component creation failed" + INSTANCESTATE_CREATION_SUCCEEDED__NOW_NEED_TO_CHECK_READINESS InstanceState = "Component creation succeeded. Now need to check readiness" + INSTANCESTATE_CREATION_SUCCEEDED InstanceState = "Component creation succeeded" + INSTANCESTATE_DELETION_STARTED InstanceState = "Component deletion started" + INSTANCESTATE_DELETION_FAILED InstanceState = "Component deletion failed" + INSTANCESTATE_DELETION_SUCCEEDED InstanceState = "Component deletion succeeded" + INSTANCESTATE_DELETION_OF_ROUTINE_SUCCEEDED__NOW_NEED_TO_CHECK_IF_RESOURCES_GONE InstanceState = "Component deletion of routine succeeded. Now need to check if resources gone" + INSTANCESTATE_DELETION_BUCKETS_SUCCEEDED InstanceState = "Component deletion buckets succeeded" + INSTANCESTATE_UPDATE_FAILED InstanceState = "Component update failed" + INSTANCESTATE_UPDATE_STARTED InstanceState = "Component update started" + INSTANCESTATE_UPDATE_CREATION_SUCCEEDED InstanceState = "Component update creation succeeded" + INSTANCESTATE_UPDATE_DOWNGRADE_DELETION_RESOURCES_SUCCEEDED InstanceState = "Component update downgrade deletion resources succeeded" +) + +// All allowed values of Instance enum +var AllowedInstanceStateEnumValues = []InstanceState{ + "Component creation started", + "Component creation failed", + "Component creation succeeded. Now need to check readiness", + "Component creation succeeded", + "Component deletion started", + "Component deletion failed", + "Component deletion succeeded", + "Component deletion of routine succeeded. Now need to check if resources gone", + "Component deletion buckets succeeded", + "Component update failed", + "Component update started", + "Component update creation succeeded", + "Component update downgrade deletion resources succeeded", +} + +func (v *InstanceState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceState(value) + for _, existing := range AllowedInstanceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStateFromValue returns a pointer to a valid InstanceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStateFromValue(v string) (*InstanceState, error) { + ev := InstanceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceState: valid values are %v", v, AllowedInstanceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceState) IsValid() bool { + for _, existing := range AllowedInstanceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceState) Ptr() *InstanceState { + return &v +} + +type NullableInstanceState struct { + value *InstanceState + isSet bool +} + +func (v NullableInstanceState) Get() *InstanceState { + return v.value +} + +func (v *NullableInstanceState) Set(val *InstanceState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceState(val *InstanceState) *NullableInstanceState { + return &NullableInstanceState{value: val, isSet: true} +} + +func (v NullableInstanceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStateAttributeType = *InstanceState +type InstanceGetStateArgType = InstanceState +type InstanceGetStateRetType = InstanceState func getInstanceGetStateAttributeTypeOk(arg InstanceGetStateAttributeType) (ret InstanceGetStateRetType, ok bool) { if arg == nil { diff --git a/services/observability/model_job.go b/services/observability/model_job.go index 1396cdc46..4666a9feb 100644 --- a/services/observability/model_job.go +++ b/services/observability/model_job.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the Job type satisfies the MappedNullable interface at compile time @@ -244,10 +245,110 @@ func setJobGetSampleLimitAttributeType(arg *JobGetSampleLimitAttributeType, val types and functions for scheme */ -// isEnumRef -type JobGetSchemeAttributeType = *string -type JobGetSchemeArgType = string -type JobGetSchemeRetType = string +//isEnum + +// JobScheme the model 'Job' +type JobScheme string + +// List of Scheme +const ( + JOBSCHEME_HTTP JobScheme = "http" + JOBSCHEME_HTTPS JobScheme = "https" +) + +// All allowed values of Job enum +var AllowedJobSchemeEnumValues = []JobScheme{ + "http", + "https", +} + +func (v *JobScheme) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := JobScheme(value) + for _, existing := range AllowedJobSchemeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Job", value) +} + +// NewJobSchemeFromValue returns a pointer to a valid JobScheme +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewJobSchemeFromValue(v string) (*JobScheme, error) { + ev := JobScheme(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for JobScheme: valid values are %v", v, AllowedJobSchemeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v JobScheme) IsValid() bool { + for _, existing := range AllowedJobSchemeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SchemeScheme value +func (v JobScheme) Ptr() *JobScheme { + return &v +} + +type NullableJobScheme struct { + value *JobScheme + isSet bool +} + +func (v NullableJobScheme) Get() *JobScheme { + return v.value +} + +func (v *NullableJobScheme) Set(val *JobScheme) { + v.value = val + v.isSet = true +} + +func (v NullableJobScheme) IsSet() bool { + return v.isSet +} + +func (v *NullableJobScheme) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableJobScheme(val *JobScheme) *NullableJobScheme { + return &NullableJobScheme{value: val, isSet: true} +} + +func (v NullableJobScheme) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableJobScheme) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type JobGetSchemeAttributeType = *JobScheme +type JobGetSchemeArgType = JobScheme +type JobGetSchemeRetType = JobScheme func getJobGetSchemeAttributeTypeOk(arg JobGetSchemeAttributeType) (ret JobGetSchemeRetType, ok bool) { if arg == nil { @@ -392,7 +493,7 @@ func NewJobWithDefaults() *Job { this.HonorTimeStamps = &honorTimeStamps var metricsPath string = "/metrics" this.MetricsPath = &metricsPath - var scheme string = "http" + var scheme JobScheme = "http" this.Scheme = &scheme return &this } diff --git a/services/observability/model_metrics_relabel_config.go b/services/observability/model_metrics_relabel_config.go index 235465f1a..9cb8d14c1 100644 --- a/services/observability/model_metrics_relabel_config.go +++ b/services/observability/model_metrics_relabel_config.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the MetricsRelabelConfig type satisfies the MappedNullable interface at compile time @@ -21,10 +22,120 @@ var _ MappedNullable = &MetricsRelabelConfig{} types and functions for action */ -// isEnumRef -type MetricsRelabelConfigGetActionAttributeType = *string -type MetricsRelabelConfigGetActionArgType = string -type MetricsRelabelConfigGetActionRetType = string +//isEnum + +// MetricsRelabelConfigAction the model 'MetricsRelabelConfig' +type MetricsRelabelConfigAction string + +// List of Action +const ( + METRICSRELABELCONFIGACTION_REPLACE MetricsRelabelConfigAction = "replace" + METRICSRELABELCONFIGACTION_KEEP MetricsRelabelConfigAction = "keep" + METRICSRELABELCONFIGACTION_DROP MetricsRelabelConfigAction = "drop" + METRICSRELABELCONFIGACTION_HASHMOD MetricsRelabelConfigAction = "hashmod" + METRICSRELABELCONFIGACTION_LABELMAP MetricsRelabelConfigAction = "labelmap" + METRICSRELABELCONFIGACTION_LABELDROP MetricsRelabelConfigAction = "labeldrop" + METRICSRELABELCONFIGACTION_LABELKEEP MetricsRelabelConfigAction = "labelkeep" +) + +// All allowed values of MetricsRelabelConfig enum +var AllowedMetricsRelabelConfigActionEnumValues = []MetricsRelabelConfigAction{ + "replace", + "keep", + "drop", + "hashmod", + "labelmap", + "labeldrop", + "labelkeep", +} + +func (v *MetricsRelabelConfigAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := MetricsRelabelConfigAction(value) + for _, existing := range AllowedMetricsRelabelConfigActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid MetricsRelabelConfig", value) +} + +// NewMetricsRelabelConfigActionFromValue returns a pointer to a valid MetricsRelabelConfigAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewMetricsRelabelConfigActionFromValue(v string) (*MetricsRelabelConfigAction, error) { + ev := MetricsRelabelConfigAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for MetricsRelabelConfigAction: valid values are %v", v, AllowedMetricsRelabelConfigActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v MetricsRelabelConfigAction) IsValid() bool { + for _, existing := range AllowedMetricsRelabelConfigActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ActionAction value +func (v MetricsRelabelConfigAction) Ptr() *MetricsRelabelConfigAction { + return &v +} + +type NullableMetricsRelabelConfigAction struct { + value *MetricsRelabelConfigAction + isSet bool +} + +func (v NullableMetricsRelabelConfigAction) Get() *MetricsRelabelConfigAction { + return v.value +} + +func (v *NullableMetricsRelabelConfigAction) Set(val *MetricsRelabelConfigAction) { + v.value = val + v.isSet = true +} + +func (v NullableMetricsRelabelConfigAction) IsSet() bool { + return v.isSet +} + +func (v *NullableMetricsRelabelConfigAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetricsRelabelConfigAction(val *MetricsRelabelConfigAction) *NullableMetricsRelabelConfigAction { + return &NullableMetricsRelabelConfigAction{value: val, isSet: true} +} + +func (v NullableMetricsRelabelConfigAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetricsRelabelConfigAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type MetricsRelabelConfigGetActionAttributeType = *MetricsRelabelConfigAction +type MetricsRelabelConfigGetActionArgType = MetricsRelabelConfigAction +type MetricsRelabelConfigGetActionRetType = MetricsRelabelConfigAction func getMetricsRelabelConfigGetActionAttributeTypeOk(arg MetricsRelabelConfigGetActionAttributeType) (ret MetricsRelabelConfigGetActionRetType, ok bool) { if arg == nil { @@ -190,7 +301,7 @@ func NewMetricsRelabelConfig(sourceLabels MetricsRelabelConfigGetSourceLabelsArg // but it doesn't guarantee that properties required by API are set func NewMetricsRelabelConfigWithDefaults() *MetricsRelabelConfig { this := MetricsRelabelConfig{} - var action string = "replace" + var action MetricsRelabelConfigAction = "replace" this.Action = &action var regex string = ".*" this.Regex = ®ex diff --git a/services/observability/model_project_instance_full.go b/services/observability/model_project_instance_full.go index c8b417187..a9d2c25d4 100644 --- a/services/observability/model_project_instance_full.go +++ b/services/observability/model_project_instance_full.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the ProjectInstanceFull type satisfies the MappedNullable interface at compile time @@ -151,10 +152,124 @@ type ProjectInstanceFullGetServiceNameRetType = string types and functions for status */ -// isEnumRef -type ProjectInstanceFullGetStatusAttributeType = *string -type ProjectInstanceFullGetStatusArgType = string -type ProjectInstanceFullGetStatusRetType = string +//isEnum + +// ProjectInstanceFullStatus the model 'ProjectInstanceFull' +type ProjectInstanceFullStatus string + +// List of Status +const ( + PROJECTINSTANCEFULLSTATUS_CREATING ProjectInstanceFullStatus = "CREATING" + PROJECTINSTANCEFULLSTATUS_CREATE_SUCCEEDED ProjectInstanceFullStatus = "CREATE_SUCCEEDED" + PROJECTINSTANCEFULLSTATUS_CREATE_FAILED ProjectInstanceFullStatus = "CREATE_FAILED" + PROJECTINSTANCEFULLSTATUS_DELETING ProjectInstanceFullStatus = "DELETING" + PROJECTINSTANCEFULLSTATUS_DELETE_SUCCEEDED ProjectInstanceFullStatus = "DELETE_SUCCEEDED" + PROJECTINSTANCEFULLSTATUS_DELETE_FAILED ProjectInstanceFullStatus = "DELETE_FAILED" + PROJECTINSTANCEFULLSTATUS_UPDATING ProjectInstanceFullStatus = "UPDATING" + PROJECTINSTANCEFULLSTATUS_UPDATE_SUCCEEDED ProjectInstanceFullStatus = "UPDATE_SUCCEEDED" + PROJECTINSTANCEFULLSTATUS_UPDATE_FAILED ProjectInstanceFullStatus = "UPDATE_FAILED" +) + +// All allowed values of ProjectInstanceFull enum +var AllowedProjectInstanceFullStatusEnumValues = []ProjectInstanceFullStatus{ + "CREATING", + "CREATE_SUCCEEDED", + "CREATE_FAILED", + "DELETING", + "DELETE_SUCCEEDED", + "DELETE_FAILED", + "UPDATING", + "UPDATE_SUCCEEDED", + "UPDATE_FAILED", +} + +func (v *ProjectInstanceFullStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ProjectInstanceFullStatus(value) + for _, existing := range AllowedProjectInstanceFullStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProjectInstanceFull", value) +} + +// NewProjectInstanceFullStatusFromValue returns a pointer to a valid ProjectInstanceFullStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProjectInstanceFullStatusFromValue(v string) (*ProjectInstanceFullStatus, error) { + ev := ProjectInstanceFullStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProjectInstanceFullStatus: valid values are %v", v, AllowedProjectInstanceFullStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProjectInstanceFullStatus) IsValid() bool { + for _, existing := range AllowedProjectInstanceFullStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v ProjectInstanceFullStatus) Ptr() *ProjectInstanceFullStatus { + return &v +} + +type NullableProjectInstanceFullStatus struct { + value *ProjectInstanceFullStatus + isSet bool +} + +func (v NullableProjectInstanceFullStatus) Get() *ProjectInstanceFullStatus { + return v.value +} + +func (v *NullableProjectInstanceFullStatus) Set(val *ProjectInstanceFullStatus) { + v.value = val + v.isSet = true +} + +func (v NullableProjectInstanceFullStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectInstanceFullStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectInstanceFullStatus(val *ProjectInstanceFullStatus) *NullableProjectInstanceFullStatus { + return &NullableProjectInstanceFullStatus{value: val, isSet: true} +} + +func (v NullableProjectInstanceFullStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectInstanceFullStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ProjectInstanceFullGetStatusAttributeType = *ProjectInstanceFullStatus +type ProjectInstanceFullGetStatusArgType = ProjectInstanceFullStatus +type ProjectInstanceFullGetStatusRetType = ProjectInstanceFullStatus func getProjectInstanceFullGetStatusAttributeTypeOk(arg ProjectInstanceFullGetStatusAttributeType) (ret ProjectInstanceFullGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/observability/model_update_scrape_config_payload.go b/services/observability/model_update_scrape_config_payload.go index e0c90c187..d3211052a 100644 --- a/services/observability/model_update_scrape_config_payload.go +++ b/services/observability/model_update_scrape_config_payload.go @@ -12,6 +12,7 @@ package observability import ( "encoding/json" + "fmt" ) // checks if the UpdateScrapeConfigPayload type satisfies the MappedNullable interface at compile time @@ -183,10 +184,110 @@ func setUpdateScrapeConfigPayloadGetSampleLimitAttributeType(arg *UpdateScrapeCo types and functions for scheme */ -// isEnumRef -type UpdateScrapeConfigPayloadGetSchemeAttributeType = *string -type UpdateScrapeConfigPayloadGetSchemeArgType = string -type UpdateScrapeConfigPayloadGetSchemeRetType = string +//isEnum + +// UpdateScrapeConfigPayloadScheme Configures the protocol scheme used for requests. https or http +type UpdateScrapeConfigPayloadScheme string + +// List of Scheme +const ( + UPDATESCRAPECONFIGPAYLOADSCHEME_HTTP UpdateScrapeConfigPayloadScheme = "http" + UPDATESCRAPECONFIGPAYLOADSCHEME_HTTPS UpdateScrapeConfigPayloadScheme = "https" +) + +// All allowed values of UpdateScrapeConfigPayload enum +var AllowedUpdateScrapeConfigPayloadSchemeEnumValues = []UpdateScrapeConfigPayloadScheme{ + "http", + "https", +} + +func (v *UpdateScrapeConfigPayloadScheme) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := UpdateScrapeConfigPayloadScheme(value) + for _, existing := range AllowedUpdateScrapeConfigPayloadSchemeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UpdateScrapeConfigPayload", value) +} + +// NewUpdateScrapeConfigPayloadSchemeFromValue returns a pointer to a valid UpdateScrapeConfigPayloadScheme +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateScrapeConfigPayloadSchemeFromValue(v string) (*UpdateScrapeConfigPayloadScheme, error) { + ev := UpdateScrapeConfigPayloadScheme(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateScrapeConfigPayloadScheme: valid values are %v", v, AllowedUpdateScrapeConfigPayloadSchemeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateScrapeConfigPayloadScheme) IsValid() bool { + for _, existing := range AllowedUpdateScrapeConfigPayloadSchemeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SchemeScheme value +func (v UpdateScrapeConfigPayloadScheme) Ptr() *UpdateScrapeConfigPayloadScheme { + return &v +} + +type NullableUpdateScrapeConfigPayloadScheme struct { + value *UpdateScrapeConfigPayloadScheme + isSet bool +} + +func (v NullableUpdateScrapeConfigPayloadScheme) Get() *UpdateScrapeConfigPayloadScheme { + return v.value +} + +func (v *NullableUpdateScrapeConfigPayloadScheme) Set(val *UpdateScrapeConfigPayloadScheme) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateScrapeConfigPayloadScheme) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateScrapeConfigPayloadScheme) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateScrapeConfigPayloadScheme(val *UpdateScrapeConfigPayloadScheme) *NullableUpdateScrapeConfigPayloadScheme { + return &NullableUpdateScrapeConfigPayloadScheme{value: val, isSet: true} +} + +func (v NullableUpdateScrapeConfigPayloadScheme) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateScrapeConfigPayloadScheme) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type UpdateScrapeConfigPayloadGetSchemeAttributeType = *UpdateScrapeConfigPayloadScheme +type UpdateScrapeConfigPayloadGetSchemeArgType = UpdateScrapeConfigPayloadScheme +type UpdateScrapeConfigPayloadGetSchemeRetType = UpdateScrapeConfigPayloadScheme func getUpdateScrapeConfigPayloadGetSchemeAttributeTypeOk(arg UpdateScrapeConfigPayloadGetSchemeAttributeType) (ret UpdateScrapeConfigPayloadGetSchemeRetType, ok bool) { if arg == nil { diff --git a/services/observability/wait/wait.go b/services/observability/wait/wait.go index 503520b69..8d7784c90 100644 --- a/services/observability/wait/wait.go +++ b/services/observability/wait/wait.go @@ -10,12 +10,18 @@ import ( ) const ( + // Deprecated: CreateSuccess is deprecated and will be removed after 14th November 2025. Use [observability.GETINSTANCERESPONSESTATUS_CREATE_SUCCEEDED] instead. CreateSuccess = "CREATE_SUCCEEDED" - CreateFail = "CREATE_FAILED" + // Deprecated: CreateFail is deprecated and will be removed after 14th November 2025. Use [observability.GETINSTANCERESPONSESTATUS_CREATE_FAILED] instead. + CreateFail = "CREATE_FAILED" + // Deprecated: UpdateSuccess is deprecated and will be removed after 14th November 2025. Use [observability.GETINSTANCERESPONSESTATUS_UPDATE_SUCCEEDED] instead. UpdateSuccess = "UPDATE_SUCCEEDED" - UpdateFail = "UPDATE_FAILED" + // Deprecated: UpdateFail is deprecated and will be removed after 14th November 2025. Use [observability.GETINSTANCERESPONSESTATUS_UPDATE_FAILED] instead. + UpdateFail = "UPDATE_FAILED" + // Deprecated: DeleteSuccess is deprecated and will be removed after 12th November 2025. Use [observability.GETINSTANCERESPONSESTATUS_DELETE_SUCCEEDED] instead. DeleteSuccess = "DELETE_SUCCEEDED" - DeleteFail = "DELETE_FAILED" + // Deprecated: DeleteFail is deprecated and will be removed after 12th November 2025. Use [observability.GETINSTANCERESPONSESTATUS_DELETE_FAILED] instead. + DeleteFail = "DELETE_FAILED" ) // APIClientInterface Interfaces needed for tests @@ -34,10 +40,10 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInterface, instan if s.Id == nil || s.Status == nil { return false, nil, fmt.Errorf("could not get instance id or status from response for project %s and instance %s", projectId, instanceId) } - if *s.Id == instanceId && *s.Status == CreateSuccess { + if *s.Id == instanceId && *s.Status == observability.GETINSTANCERESPONSESTATUS_CREATE_SUCCEEDED { return true, s, nil } - if *s.Id == instanceId && *s.Status == CreateFail { + if *s.Id == instanceId && *s.Status == observability.GETINSTANCERESPONSESTATUS_CREATE_FAILED { return true, s, fmt.Errorf("create failed for instance with id %s", instanceId) } return false, nil, nil @@ -57,10 +63,10 @@ func UpdateInstanceWaitHandler(ctx context.Context, a APIClientInterface, instan return false, nil, fmt.Errorf("could not get instance id or status from response for project %s and instance %s", projectId, instanceId) } // The observability instance API currently replies with create success in case the update was successful. - if *s.Id == instanceId && (*s.Status == UpdateSuccess || *s.Status == CreateSuccess) { + if *s.Id == instanceId && (*s.Status == observability.GETINSTANCERESPONSESTATUS_UPDATE_SUCCEEDED || *s.Status == observability.GETINSTANCERESPONSESTATUS_CREATE_FAILED) { return true, s, nil } - if *s.Id == instanceId && (*s.Status == UpdateFail || *s.Status == CreateFail) { + if *s.Id == instanceId && (*s.Status == observability.GETINSTANCERESPONSESTATUS_UPDATE_FAILED || *s.Status == observability.GETINSTANCERESPONSESTATUS_CREATE_FAILED) { return true, s, fmt.Errorf("update failed for instance with id %s", instanceId) } return false, nil, nil @@ -79,10 +85,10 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInterface, instan if s.Id == nil || s.Status == nil { return false, nil, fmt.Errorf("could not get instance id or status from response for project %s and instance %s", projectId, instanceId) } - if *s.Id == instanceId && *s.Status == DeleteSuccess { + if *s.Id == instanceId && *s.Status == observability.GETINSTANCERESPONSESTATUS_DELETE_SUCCEEDED { return true, s, nil } - if *s.Id == instanceId && *s.Status == DeleteFail { + if *s.Id == instanceId && *s.Status == observability.GETINSTANCERESPONSESTATUS_DELETE_FAILED { return true, s, fmt.Errorf("delete failed for instance with id %s", instanceId) } return false, nil, nil diff --git a/services/observability/wait/wait_test.go b/services/observability/wait/wait_test.go index 21931af69..5b5a559c2 100644 --- a/services/observability/wait/wait_test.go +++ b/services/observability/wait/wait_test.go @@ -14,7 +14,7 @@ import ( type apiClientMocked struct { getFails bool - resourceState *string + resourceState *observability.GetInstanceResponseStatus jobs []observability.Job } @@ -47,28 +47,28 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState *string + resourceState *observability.GetInstanceResponseStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: utils.Ptr(CreateSuccess), + resourceState: utils.Ptr(observability.GETINSTANCERESPONSESTATUS_CREATE_SUCCEEDED), wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: utils.Ptr(CreateFail), + resourceState: utils.Ptr(observability.GETINSTANCERESPONSESTATUS_CREATE_FAILED), wantErr: true, wantResp: true, }, { desc: "get_fails", getFails: true, - resourceState: utils.Ptr(""), + resourceState: utils.Ptr(observability.GetInstanceResponseStatus("")), wantErr: true, wantResp: false, }, @@ -82,7 +82,7 @@ func TestCreateInstanceWaitHandler(t *testing.T) { { desc: "timeout", getFails: false, - resourceState: utils.Ptr("ANOTHER STATE"), + resourceState: utils.Ptr(observability.GetInstanceResponseStatus("ANOTHER STATE")), wantErr: true, wantResp: false, }, @@ -120,35 +120,35 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState *string + resourceState *observability.GetInstanceResponseStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: utils.Ptr(UpdateSuccess), + resourceState: utils.Ptr(observability.GETINSTANCERESPONSESTATUS_UPDATE_SUCCEEDED), wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: utils.Ptr(UpdateFail), + resourceState: utils.Ptr(observability.GETINSTANCERESPONSESTATUS_UPDATE_FAILED), wantErr: true, wantResp: true, }, { desc: "get_fails", getFails: true, - resourceState: utils.Ptr(""), + resourceState: utils.Ptr(observability.GetInstanceResponseStatus("")), wantErr: true, wantResp: false, }, { desc: "timeout", getFails: false, - resourceState: utils.Ptr("ANOTHER STATE"), + resourceState: utils.Ptr(observability.GetInstanceResponseStatus("ANOTHER STATE")), wantErr: true, wantResp: false, }, @@ -186,35 +186,35 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState *string + resourceState *observability.GetInstanceResponseStatus wantErr bool wantResp bool }{ { desc: "delete_succeeded", getFails: false, - resourceState: utils.Ptr(DeleteSuccess), + resourceState: utils.Ptr(observability.GETINSTANCERESPONSESTATUS_DELETE_SUCCEEDED), wantErr: false, wantResp: true, }, { desc: "delete_failed", getFails: false, - resourceState: utils.Ptr(DeleteFail), + resourceState: utils.Ptr(observability.GETINSTANCERESPONSESTATUS_DELETE_FAILED), wantErr: true, wantResp: true, }, { desc: "get_fails", getFails: true, - resourceState: utils.Ptr(""), + resourceState: utils.Ptr(observability.GetInstanceResponseStatus("")), wantErr: true, wantResp: false, }, { desc: "timeout", getFails: false, - resourceState: utils.Ptr("ANOTHER STATE"), + resourceState: utils.Ptr(observability.GetInstanceResponseStatus("ANOTHER STATE")), wantErr: true, wantResp: false, }, diff --git a/services/opensearch/CHANGELOG.md b/services/opensearch/CHANGELOG.md index 887f91a4b..8d26e7cad 100644 --- a/services/opensearch/CHANGELOG.md +++ b/services/opensearch/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.21.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/opensearch/model_instance.go b/services/opensearch/model_instance.go index b63dd9a33..e7afbdd8f 100644 --- a/services/opensearch/model_instance.go +++ b/services/opensearch/model_instance.go @@ -12,6 +12,7 @@ package opensearch import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -292,10 +293,118 @@ type InstanceGetPlanNameRetType = string types and functions for status */ -// isEnumRef -type InstanceGetStatusAttributeType = *string -type InstanceGetStatusArgType = string -type InstanceGetStatusRetType = string +//isEnum + +// InstanceStatus the model 'Instance' +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_FAILED InstanceStatus = "failed" + INSTANCESTATUS_STOPPED InstanceStatus = "stopped" + INSTANCESTATUS_CREATING InstanceStatus = "creating" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" + INSTANCESTATUS_UPDATING InstanceStatus = "updating" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "active", + "failed", + "stopped", + "creating", + "deleting", + "updating", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/opensearch/model_instance_last_operation.go b/services/opensearch/model_instance_last_operation.go index 0b0b924d6..385650f6e 100644 --- a/services/opensearch/model_instance_last_operation.go +++ b/services/opensearch/model_instance_last_operation.go @@ -12,6 +12,7 @@ package opensearch import ( "encoding/json" + "fmt" ) // checks if the InstanceLastOperation type satisfies the MappedNullable interface at compile time @@ -42,10 +43,112 @@ type InstanceLastOperationGetDescriptionRetType = string types and functions for state */ -// isEnumRef -type InstanceLastOperationGetStateAttributeType = *string -type InstanceLastOperationGetStateArgType = string -type InstanceLastOperationGetStateRetType = string +//isEnum + +// InstanceLastOperationState the model 'InstanceLastOperation' +type InstanceLastOperationState string + +// List of State +const ( + INSTANCELASTOPERATIONSTATE_IN_PROGRESS InstanceLastOperationState = "in progress" + INSTANCELASTOPERATIONSTATE_SUCCEEDED InstanceLastOperationState = "succeeded" + INSTANCELASTOPERATIONSTATE_FAILED InstanceLastOperationState = "failed" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationStateEnumValues = []InstanceLastOperationState{ + "in progress", + "succeeded", + "failed", +} + +func (v *InstanceLastOperationState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationState(value) + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationStateFromValue returns a pointer to a valid InstanceLastOperationState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationStateFromValue(v string) (*InstanceLastOperationState, error) { + ev := InstanceLastOperationState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationState: valid values are %v", v, AllowedInstanceLastOperationStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationState) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceLastOperationState) Ptr() *InstanceLastOperationState { + return &v +} + +type NullableInstanceLastOperationState struct { + value *InstanceLastOperationState + isSet bool +} + +func (v NullableInstanceLastOperationState) Get() *InstanceLastOperationState { + return v.value +} + +func (v *NullableInstanceLastOperationState) Set(val *InstanceLastOperationState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationState(val *InstanceLastOperationState) *NullableInstanceLastOperationState { + return &NullableInstanceLastOperationState{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetStateAttributeType = *InstanceLastOperationState +type InstanceLastOperationGetStateArgType = InstanceLastOperationState +type InstanceLastOperationGetStateRetType = InstanceLastOperationState func getInstanceLastOperationGetStateAttributeTypeOk(arg InstanceLastOperationGetStateAttributeType) (ret InstanceLastOperationGetStateRetType, ok bool) { if arg == nil { @@ -62,10 +165,112 @@ func setInstanceLastOperationGetStateAttributeType(arg *InstanceLastOperationGet types and functions for type */ -// isEnumRef -type InstanceLastOperationGetTypeAttributeType = *string -type InstanceLastOperationGetTypeArgType = string -type InstanceLastOperationGetTypeRetType = string +//isEnum + +// InstanceLastOperationTypes the model 'InstanceLastOperation' +type InstanceLastOperationTypes string + +// List of Type +const ( + INSTANCELASTOPERATIONTYPE_CREATE InstanceLastOperationTypes = "create" + INSTANCELASTOPERATIONTYPE_UPDATE InstanceLastOperationTypes = "update" + INSTANCELASTOPERATIONTYPE_DELETE InstanceLastOperationTypes = "delete" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationTypesEnumValues = []InstanceLastOperationTypes{ + "create", + "update", + "delete", +} + +func (v *InstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationTypes(value) + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationTypesFromValue returns a pointer to a valid InstanceLastOperationTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationTypesFromValue(v string) (*InstanceLastOperationTypes, error) { + ev := InstanceLastOperationTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationTypes: valid values are %v", v, AllowedInstanceLastOperationTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationTypes) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v InstanceLastOperationTypes) Ptr() *InstanceLastOperationTypes { + return &v +} + +type NullableInstanceLastOperationTypes struct { + value *InstanceLastOperationTypes + isSet bool +} + +func (v NullableInstanceLastOperationTypes) Get() *InstanceLastOperationTypes { + return v.value +} + +func (v *NullableInstanceLastOperationTypes) Set(val *InstanceLastOperationTypes) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationTypes(val *InstanceLastOperationTypes) *NullableInstanceLastOperationTypes { + return &NullableInstanceLastOperationTypes{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetTypeAttributeType = *InstanceLastOperationTypes +type InstanceLastOperationGetTypeArgType = InstanceLastOperationTypes +type InstanceLastOperationGetTypeRetType = InstanceLastOperationTypes func getInstanceLastOperationGetTypeAttributeTypeOk(arg InstanceLastOperationGetTypeAttributeType) (ret InstanceLastOperationGetTypeRetType, ok bool) { if arg == nil { @@ -94,11 +299,11 @@ type _InstanceLastOperation InstanceLastOperation // 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 NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, type_ InstanceLastOperationGetTypeArgType) *InstanceLastOperation { +func NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, types InstanceLastOperationGetTypeArgType) *InstanceLastOperation { this := InstanceLastOperation{} setInstanceLastOperationGetDescriptionAttributeType(&this.Description, description) setInstanceLastOperationGetStateAttributeType(&this.State, state) - setInstanceLastOperationGetTypeAttributeType(&this.Type, type_) + setInstanceLastOperationGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/opensearch/model_instance_parameters.go b/services/opensearch/model_instance_parameters.go index 0314b5667..389bba5d2 100644 --- a/services/opensearch/model_instance_parameters.go +++ b/services/opensearch/model_instance_parameters.go @@ -12,6 +12,7 @@ package opensearch import ( "encoding/json" + "fmt" ) // checks if the InstanceParameters type satisfies the MappedNullable interface at compile time @@ -62,10 +63,114 @@ type InstanceParametersGetGraphiteRetType = string types and functions for java_garbage_collector */ -// isEnumRef -type InstanceParametersGetJavaGarbageCollectorAttributeType = *string -type InstanceParametersGetJavaGarbageCollectorArgType = string -type InstanceParametersGetJavaGarbageCollectorRetType = string +//isEnum + +// InstanceParametersJavaGarbageCollector the model 'InstanceParameters' +type InstanceParametersJavaGarbageCollector string + +// List of JavaGarbageCollector +const ( + INSTANCEPARAMETERSJAVA_GARBAGE_COLLECTOR_USE_SERIAL_GC InstanceParametersJavaGarbageCollector = "UseSerialGC" + INSTANCEPARAMETERSJAVA_GARBAGE_COLLECTOR_USE_PARALLEL_GC InstanceParametersJavaGarbageCollector = "UseParallelGC" + INSTANCEPARAMETERSJAVA_GARBAGE_COLLECTOR_USE_PARALLEL_OLD_GC InstanceParametersJavaGarbageCollector = "UseParallelOldGC" + INSTANCEPARAMETERSJAVA_GARBAGE_COLLECTOR_USE_G1_GC InstanceParametersJavaGarbageCollector = "UseG1GC" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersJavaGarbageCollectorEnumValues = []InstanceParametersJavaGarbageCollector{ + "UseSerialGC", + "UseParallelGC", + "UseParallelOldGC", + "UseG1GC", +} + +func (v *InstanceParametersJavaGarbageCollector) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersJavaGarbageCollector(value) + for _, existing := range AllowedInstanceParametersJavaGarbageCollectorEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersJavaGarbageCollectorFromValue returns a pointer to a valid InstanceParametersJavaGarbageCollector +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersJavaGarbageCollectorFromValue(v string) (*InstanceParametersJavaGarbageCollector, error) { + ev := InstanceParametersJavaGarbageCollector(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersJavaGarbageCollector: valid values are %v", v, AllowedInstanceParametersJavaGarbageCollectorEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersJavaGarbageCollector) IsValid() bool { + for _, existing := range AllowedInstanceParametersJavaGarbageCollectorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to JavaGarbageCollectorJavaGarbageCollector value +func (v InstanceParametersJavaGarbageCollector) Ptr() *InstanceParametersJavaGarbageCollector { + return &v +} + +type NullableInstanceParametersJavaGarbageCollector struct { + value *InstanceParametersJavaGarbageCollector + isSet bool +} + +func (v NullableInstanceParametersJavaGarbageCollector) Get() *InstanceParametersJavaGarbageCollector { + return v.value +} + +func (v *NullableInstanceParametersJavaGarbageCollector) Set(val *InstanceParametersJavaGarbageCollector) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersJavaGarbageCollector) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersJavaGarbageCollector) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersJavaGarbageCollector(val *InstanceParametersJavaGarbageCollector) *NullableInstanceParametersJavaGarbageCollector { + return &NullableInstanceParametersJavaGarbageCollector{value: val, isSet: true} +} + +func (v NullableInstanceParametersJavaGarbageCollector) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersJavaGarbageCollector) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetJavaGarbageCollectorAttributeType = *InstanceParametersJavaGarbageCollector +type InstanceParametersGetJavaGarbageCollectorArgType = InstanceParametersJavaGarbageCollector +type InstanceParametersGetJavaGarbageCollectorRetType = InstanceParametersJavaGarbageCollector func getInstanceParametersGetJavaGarbageCollectorAttributeTypeOk(arg InstanceParametersGetJavaGarbageCollectorAttributeType) (ret InstanceParametersGetJavaGarbageCollectorRetType, ok bool) { if arg == nil { @@ -285,10 +390,110 @@ func setInstanceParametersGetTlsCiphersAttributeType(arg *InstanceParametersGetT types and functions for tls-protocols */ -// isEnumRef -type InstanceParametersGetTlsProtocolsAttributeType = *string -type InstanceParametersGetTlsProtocolsArgType = string -type InstanceParametersGetTlsProtocolsRetType = string +//isEnum + +// InstanceParametersTlsProtocols the model 'InstanceParameters' +type InstanceParametersTlsProtocols string + +// List of TlsProtocols +const ( + INSTANCEPARAMETERSTLS_PROTOCOLS__2 InstanceParametersTlsProtocols = "TLSv1.2" + INSTANCEPARAMETERSTLS_PROTOCOLS__3 InstanceParametersTlsProtocols = "TLSv1.3" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersTlsProtocolsEnumValues = []InstanceParametersTlsProtocols{ + "TLSv1.2", + "TLSv1.3", +} + +func (v *InstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersTlsProtocols(value) + for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersTlsProtocolsFromValue returns a pointer to a valid InstanceParametersTlsProtocols +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersTlsProtocolsFromValue(v string) (*InstanceParametersTlsProtocols, error) { + ev := InstanceParametersTlsProtocols(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersTlsProtocols: valid values are %v", v, AllowedInstanceParametersTlsProtocolsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersTlsProtocols) IsValid() bool { + for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TlsProtocolsTlsProtocols value +func (v InstanceParametersTlsProtocols) Ptr() *InstanceParametersTlsProtocols { + return &v +} + +type NullableInstanceParametersTlsProtocols struct { + value *InstanceParametersTlsProtocols + isSet bool +} + +func (v NullableInstanceParametersTlsProtocols) Get() *InstanceParametersTlsProtocols { + return v.value +} + +func (v *NullableInstanceParametersTlsProtocols) Set(val *InstanceParametersTlsProtocols) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersTlsProtocols) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersTlsProtocols) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersTlsProtocols(val *InstanceParametersTlsProtocols) *NullableInstanceParametersTlsProtocols { + return &NullableInstanceParametersTlsProtocols{value: val, isSet: true} +} + +func (v NullableInstanceParametersTlsProtocols) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetTlsProtocolsAttributeType = *InstanceParametersTlsProtocols +type InstanceParametersGetTlsProtocolsArgType = InstanceParametersTlsProtocols +type InstanceParametersGetTlsProtocolsRetType = InstanceParametersTlsProtocols func getInstanceParametersGetTlsProtocolsAttributeTypeOk(arg InstanceParametersGetTlsProtocolsAttributeType) (ret InstanceParametersGetTlsProtocolsRetType, ok bool) { if arg == nil { @@ -348,7 +553,7 @@ func NewInstanceParametersWithDefaults() *InstanceParameters { this := InstanceParameters{} var enableMonitoring bool = false this.EnableMonitoring = &enableMonitoring - var javaGarbageCollector string = "UseG1GC" + var javaGarbageCollector InstanceParametersJavaGarbageCollector = "UseG1GC" this.JavaGarbageCollector = &javaGarbageCollector var javaMaxmetaspace int64 = 512 this.JavaMaxmetaspace = &javaMaxmetaspace diff --git a/services/opensearch/wait/wait.go b/services/opensearch/wait/wait.go index 8373905d8..49ea5f171 100644 --- a/services/opensearch/wait/wait.go +++ b/services/opensearch/wait/wait.go @@ -13,29 +13,41 @@ import ( ) const ( - InstanceStatusActive = "active" - InstanceStatusFailed = "failed" - InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusActive is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCESTATUS_ACTIVE] instead. + InstanceStatusActive = "active" + // Deprecated: InstanceStatusFailed is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCESTATUS_FAILED] instead. + InstanceStatusFailed = "failed" + // Deprecated: InstanceStatusStopped is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCESTATUS_STOPPED] instead. + InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusCreating is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCESTATUS_CREATING] instead. InstanceStatusCreating = "creating" + // Deprecated: InstanceStatusDeleting is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCESTATUS_DELETING] instead. InstanceStatusDeleting = "deleting" + // Deprecated: InstanceStatusUpdating is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCESTATUS_UPDATING] instead. InstanceStatusUpdating = "updating" + // Deprecated: InstanceOperationStateInProgress is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCELASTOPERATIONSTATE_IN_PROGRESS] instead. InstanceOperationStateInProgress = "in progress" - InstanceOperationStateSucceeded = "succeeded" - InstanceOperationStateFailed = "failed" - InstanceOperationTypeCreate = "create" - InstanceOperationTypeUpdate = "update" - InstanceOperationTypeDelete = "delete" + // Deprecated: InstanceOperationStateSucceeded is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. + InstanceOperationStateSucceeded = "succeeded" + // Deprecated: InstanceOperationStateFailed is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCELASTOPERATIONSTATE_FAILED] instead. + InstanceOperationStateFailed = "failed" + // Deprecated: InstanceOperationTypeCreate is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCELASTOPERATIONTYPE_CREATE] instead. + InstanceOperationTypeCreate = "create" + // Deprecated: InstanceOperationTypeUpdate is deprecated and will be removed after 14th November 2025. Use [opensearch.INSTANCELASTOPERATIONTYPE_UPDATE] instead. + InstanceOperationTypeUpdate = "update" + // Deprecated: InstanceOperationTypeDelete is deprecated and will be removed after 12th November 2025. Use [opensearch.INSTANCELASTOPERATIONTYPE_DELETE] instead. + InstanceOperationTypeDelete = "delete" - // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateSucceeded] instead. + // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [opensearch.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. InstanceStateSuccess = "succeeded" - // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateFailed] instead. + // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [opensearch.INSTANCELASTOPERATIONSTATE_FAILED] instead. InstanceStateFailed = "failed" - // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeCreate] instead. + // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [opensearch.INSTANCELASTOPERATIONTYPE_CREATE] instead. InstanceTypeCreate = "create" - // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeUpdate] instead. + // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [opensearch.INSTANCELASTOPERATIONTYPE_UPDATE] instead. InstanceTypeUpdate = "update" - // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeDelete] instead. + // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [opensearch.INSTANCELASTOPERATIONTYPE_DELETE] instead. InstanceTypeDelete = "delete" ) @@ -60,9 +72,9 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return false, nil, fmt.Errorf("create failed for instance with id %s. The response is not valid: the status are missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case opensearch.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case opensearch.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -86,9 +98,9 @@ func PartialUpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceIn return false, nil, fmt.Errorf("update failed for instance with id %s. The response is not valid: the instance id or the status are missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case opensearch.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case opensearch.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -109,10 +121,10 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface if s.LastOperation == nil || s.LastOperation.Description == nil || s.Status == nil { return false, nil, fmt.Errorf("delete failed for instance with id %s. The response is not valid: The status or last operation description are missing", instanceId) } - if *s.Status != InstanceStatusDeleting { + if *s.Status != opensearch.INSTANCESTATUS_DELETING { return false, nil, nil } - if *s.Status == InstanceStatusActive { + if *s.Status == opensearch.INSTANCESTATUS_ACTIVE { if strings.Contains(*s.LastOperation.Description, "DeleteFailed") || strings.Contains(*s.LastOperation.Description, "failed") { return true, nil, fmt.Errorf("instance was deleted successfully but has errors: %s", *s.LastOperation.Description) } diff --git a/services/opensearch/wait/wait_test.go b/services/opensearch/wait/wait_test.go index 0980d61a1..a8eb45d4b 100644 --- a/services/opensearch/wait/wait_test.go +++ b/services/opensearch/wait/wait_test.go @@ -16,20 +16,18 @@ type apiClientInstanceMocked struct { getFails bool deletionSucceedsWithErrors bool resourceId string - resourceOperation *string - resourceState string + resourceOperation *opensearch.InstanceLastOperationTypes + resourceState opensearch.InstanceStatus resourceDescription string } -const deleteOperation = "delete" - func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*opensearch.Instance, error) { if a.getFails { return nil, &oapierror.GenericOpenAPIError{ StatusCode: 500, } } - if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == InstanceStatusActive { + if a.resourceOperation != nil && *a.resourceOperation == opensearch.INSTANCELASTOPERATIONTYPE_DELETE && a.resourceState == opensearch.INSTANCESTATUS_ACTIVE { if a.deletionSucceedsWithErrors { return &opensearch.Instance{ InstanceId: &a.resourceId, @@ -37,7 +35,6 @@ func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ str LastOperation: &opensearch.InstanceLastOperation{ Description: &a.resourceDescription, Type: a.resourceOperation, - State: &a.resourceState, }, }, nil } @@ -82,21 +79,21 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState opensearch.InstanceStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: opensearch.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: opensearch.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -151,21 +148,21 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState opensearch.InstanceStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: opensearch.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: opensearch.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -220,7 +217,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc string getFails bool deleteSucceeedsWithErrors bool - resourceState string + resourceState opensearch.InstanceStatus resourceDescription string wantErr bool }{ @@ -228,20 +225,20 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc: "delete_succeeded", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusActive, + resourceState: opensearch.INSTANCESTATUS_ACTIVE, wantErr: false, }, { desc: "delete_failed", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusFailed, + resourceState: opensearch.INSTANCESTATUS_FAILED, wantErr: true, }, { desc: "delete_succeeds_with_errors", getFails: false, - resourceState: InstanceStatusActive, + resourceState: opensearch.INSTANCESTATUS_ACTIVE, deleteSucceeedsWithErrors: true, resourceDescription: "Deleting resource: cf failed with error: DeleteFailed", wantErr: true, @@ -261,7 +258,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { getFails: tt.getFails, deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors, resourceId: instanceId, - resourceOperation: utils.Ptr(deleteOperation), + resourceOperation: utils.Ptr(opensearch.INSTANCELASTOPERATIONTYPE_DELETE), resourceDescription: tt.resourceDescription, resourceState: tt.resourceState, } diff --git a/services/rabbitmq/CHANGELOG.md b/services/rabbitmq/CHANGELOG.md index b164de994..28e75bd85 100644 --- a/services/rabbitmq/CHANGELOG.md +++ b/services/rabbitmq/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.23.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.22.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/rabbitmq/model_instance.go b/services/rabbitmq/model_instance.go index e7a011b4b..650a5970c 100644 --- a/services/rabbitmq/model_instance.go +++ b/services/rabbitmq/model_instance.go @@ -12,6 +12,7 @@ package rabbitmq import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -292,10 +293,118 @@ type InstanceGetPlanNameRetType = string types and functions for status */ -// isEnumRef -type InstanceGetStatusAttributeType = *string -type InstanceGetStatusArgType = string -type InstanceGetStatusRetType = string +//isEnum + +// InstanceStatus the model 'Instance' +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_FAILED InstanceStatus = "failed" + INSTANCESTATUS_STOPPED InstanceStatus = "stopped" + INSTANCESTATUS_CREATING InstanceStatus = "creating" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" + INSTANCESTATUS_UPDATING InstanceStatus = "updating" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "active", + "failed", + "stopped", + "creating", + "deleting", + "updating", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/rabbitmq/model_instance_last_operation.go b/services/rabbitmq/model_instance_last_operation.go index a83c9c512..0bbde1548 100644 --- a/services/rabbitmq/model_instance_last_operation.go +++ b/services/rabbitmq/model_instance_last_operation.go @@ -12,6 +12,7 @@ package rabbitmq import ( "encoding/json" + "fmt" ) // checks if the InstanceLastOperation type satisfies the MappedNullable interface at compile time @@ -42,10 +43,112 @@ type InstanceLastOperationGetDescriptionRetType = string types and functions for state */ -// isEnumRef -type InstanceLastOperationGetStateAttributeType = *string -type InstanceLastOperationGetStateArgType = string -type InstanceLastOperationGetStateRetType = string +//isEnum + +// InstanceLastOperationState the model 'InstanceLastOperation' +type InstanceLastOperationState string + +// List of State +const ( + INSTANCELASTOPERATIONSTATE_IN_PROGRESS InstanceLastOperationState = "in progress" + INSTANCELASTOPERATIONSTATE_SUCCEEDED InstanceLastOperationState = "succeeded" + INSTANCELASTOPERATIONSTATE_FAILED InstanceLastOperationState = "failed" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationStateEnumValues = []InstanceLastOperationState{ + "in progress", + "succeeded", + "failed", +} + +func (v *InstanceLastOperationState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationState(value) + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationStateFromValue returns a pointer to a valid InstanceLastOperationState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationStateFromValue(v string) (*InstanceLastOperationState, error) { + ev := InstanceLastOperationState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationState: valid values are %v", v, AllowedInstanceLastOperationStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationState) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceLastOperationState) Ptr() *InstanceLastOperationState { + return &v +} + +type NullableInstanceLastOperationState struct { + value *InstanceLastOperationState + isSet bool +} + +func (v NullableInstanceLastOperationState) Get() *InstanceLastOperationState { + return v.value +} + +func (v *NullableInstanceLastOperationState) Set(val *InstanceLastOperationState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationState(val *InstanceLastOperationState) *NullableInstanceLastOperationState { + return &NullableInstanceLastOperationState{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetStateAttributeType = *InstanceLastOperationState +type InstanceLastOperationGetStateArgType = InstanceLastOperationState +type InstanceLastOperationGetStateRetType = InstanceLastOperationState func getInstanceLastOperationGetStateAttributeTypeOk(arg InstanceLastOperationGetStateAttributeType) (ret InstanceLastOperationGetStateRetType, ok bool) { if arg == nil { @@ -62,10 +165,112 @@ func setInstanceLastOperationGetStateAttributeType(arg *InstanceLastOperationGet types and functions for type */ -// isEnumRef -type InstanceLastOperationGetTypeAttributeType = *string -type InstanceLastOperationGetTypeArgType = string -type InstanceLastOperationGetTypeRetType = string +//isEnum + +// InstanceLastOperationTypes the model 'InstanceLastOperation' +type InstanceLastOperationTypes string + +// List of Type +const ( + INSTANCELASTOPERATIONTYPE_CREATE InstanceLastOperationTypes = "create" + INSTANCELASTOPERATIONTYPE_UPDATE InstanceLastOperationTypes = "update" + INSTANCELASTOPERATIONTYPE_DELETE InstanceLastOperationTypes = "delete" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationTypesEnumValues = []InstanceLastOperationTypes{ + "create", + "update", + "delete", +} + +func (v *InstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationTypes(value) + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationTypesFromValue returns a pointer to a valid InstanceLastOperationTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationTypesFromValue(v string) (*InstanceLastOperationTypes, error) { + ev := InstanceLastOperationTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationTypes: valid values are %v", v, AllowedInstanceLastOperationTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationTypes) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v InstanceLastOperationTypes) Ptr() *InstanceLastOperationTypes { + return &v +} + +type NullableInstanceLastOperationTypes struct { + value *InstanceLastOperationTypes + isSet bool +} + +func (v NullableInstanceLastOperationTypes) Get() *InstanceLastOperationTypes { + return v.value +} + +func (v *NullableInstanceLastOperationTypes) Set(val *InstanceLastOperationTypes) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationTypes(val *InstanceLastOperationTypes) *NullableInstanceLastOperationTypes { + return &NullableInstanceLastOperationTypes{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetTypeAttributeType = *InstanceLastOperationTypes +type InstanceLastOperationGetTypeArgType = InstanceLastOperationTypes +type InstanceLastOperationGetTypeRetType = InstanceLastOperationTypes func getInstanceLastOperationGetTypeAttributeTypeOk(arg InstanceLastOperationGetTypeAttributeType) (ret InstanceLastOperationGetTypeRetType, ok bool) { if arg == nil { @@ -94,11 +299,11 @@ type _InstanceLastOperation InstanceLastOperation // 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 NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, type_ InstanceLastOperationGetTypeArgType) *InstanceLastOperation { +func NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, types InstanceLastOperationGetTypeArgType) *InstanceLastOperation { this := InstanceLastOperation{} setInstanceLastOperationGetDescriptionAttributeType(&this.Description, description) setInstanceLastOperationGetStateAttributeType(&this.State, state) - setInstanceLastOperationGetTypeAttributeType(&this.Type, type_) + setInstanceLastOperationGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/rabbitmq/model_instance_parameters.go b/services/rabbitmq/model_instance_parameters.go index 1bb1af943..21bf3f840 100644 --- a/services/rabbitmq/model_instance_parameters.go +++ b/services/rabbitmq/model_instance_parameters.go @@ -12,6 +12,7 @@ package rabbitmq import ( "encoding/json" + "fmt" ) // checks if the InstanceParameters type satisfies the MappedNullable interface at compile time @@ -265,10 +266,110 @@ func setInstanceParametersGetTlsCiphersAttributeType(arg *InstanceParametersGetT types and functions for tls-protocols */ -// isEnumRef -type InstanceParametersGetTlsProtocolsAttributeType = *string -type InstanceParametersGetTlsProtocolsArgType = string -type InstanceParametersGetTlsProtocolsRetType = string +//isEnum + +// InstanceParametersTlsProtocols the model 'InstanceParameters' +type InstanceParametersTlsProtocols string + +// List of TlsProtocols +const ( + INSTANCEPARAMETERSTLS_PROTOCOLS__2 InstanceParametersTlsProtocols = "tlsv1.2" + INSTANCEPARAMETERSTLS_PROTOCOLS__3 InstanceParametersTlsProtocols = "tlsv1.3" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersTlsProtocolsEnumValues = []InstanceParametersTlsProtocols{ + "tlsv1.2", + "tlsv1.3", +} + +func (v *InstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersTlsProtocols(value) + for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersTlsProtocolsFromValue returns a pointer to a valid InstanceParametersTlsProtocols +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersTlsProtocolsFromValue(v string) (*InstanceParametersTlsProtocols, error) { + ev := InstanceParametersTlsProtocols(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersTlsProtocols: valid values are %v", v, AllowedInstanceParametersTlsProtocolsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersTlsProtocols) IsValid() bool { + for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TlsProtocolsTlsProtocols value +func (v InstanceParametersTlsProtocols) Ptr() *InstanceParametersTlsProtocols { + return &v +} + +type NullableInstanceParametersTlsProtocols struct { + value *InstanceParametersTlsProtocols + isSet bool +} + +func (v NullableInstanceParametersTlsProtocols) Get() *InstanceParametersTlsProtocols { + return v.value +} + +func (v *NullableInstanceParametersTlsProtocols) Set(val *InstanceParametersTlsProtocols) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersTlsProtocols) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersTlsProtocols) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersTlsProtocols(val *InstanceParametersTlsProtocols) *NullableInstanceParametersTlsProtocols { + return &NullableInstanceParametersTlsProtocols{value: val, isSet: true} +} + +func (v NullableInstanceParametersTlsProtocols) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetTlsProtocolsAttributeType = *InstanceParametersTlsProtocols +type InstanceParametersGetTlsProtocolsArgType = InstanceParametersTlsProtocols +type InstanceParametersGetTlsProtocolsRetType = InstanceParametersTlsProtocols func getInstanceParametersGetTlsProtocolsAttributeTypeOk(arg InstanceParametersGetTlsProtocolsAttributeType) (ret InstanceParametersGetTlsProtocolsRetType, ok bool) { if arg == nil { diff --git a/services/rabbitmq/wait/wait.go b/services/rabbitmq/wait/wait.go index ccd58403f..3349ba229 100644 --- a/services/rabbitmq/wait/wait.go +++ b/services/rabbitmq/wait/wait.go @@ -13,29 +13,41 @@ import ( ) const ( - InstanceStatusActive = "active" - InstanceStatusFailed = "failed" - InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusActive is deprecated and will be removed after 14th November 2025. Use [rabbitmq.INSTANCESTATUS_ACTIVE] instead. + InstanceStatusActive = "active" + // Deprecated: InstanceStatusFailed is deprecated and will be removed after 14th November 2025. Use [rabbitmq.INSTANCESTATUS_FAILED] instead. + InstanceStatusFailed = "failed" + // Deprecated: InstanceStatusStopped is deprecated and will be removed after 14th November 2025. Use [rabbitmq.INSTANCESTATUS_STOPPED] instead. + InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusCreating is deprecated and will be removed after 14th November 2025. Use [rabbitmq.INSTANCESTATUS_CREATING] instead. InstanceStatusCreating = "creating" + // Deprecated: InstanceStatusDeleting is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCESTATUS_DELETING] instead. InstanceStatusDeleting = "deleting" + // Deprecated: InstanceStatusUpdating is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCESTATUS_UPDATING] instead. InstanceStatusUpdating = "updating" + // Deprecated: InstanceOperationStateInProgress is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCELASTOPERATIONSTATE_IN_PROGRESS] instead. InstanceOperationStateInProgress = "in progress" - InstanceOperationStateSucceeded = "succeeded" - InstanceOperationStateFailed = "failed" - InstanceOperationTypeCreate = "create" - InstanceOperationTypeUpdate = "update" - InstanceOperationTypeDelete = "delete" + // Deprecated: InstanceOperationStateSucceeded is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. + InstanceOperationStateSucceeded = "succeeded" + // Deprecated: InstanceOperationStateFailed is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCELASTOPERATIONSTATE_FAILED] instead. + InstanceOperationStateFailed = "failed" + // Deprecated: InstanceOperationTypeCreate is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCELASTOPERATIONTYPE_CREATE] instead. + InstanceOperationTypeCreate = "create" + // Deprecated: InstanceOperationTypeUpdate is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCELASTOPERATIONTYPE_UPDATE] instead. + InstanceOperationTypeUpdate = "update" + // Deprecated: InstanceOperationTypeDelete is deprecated and will be removed after 12th November 2025. Use [rabbitmq.INSTANCELASTOPERATIONTYPE_DELETE] instead. + InstanceOperationTypeDelete = "delete" - // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateSucceeded] instead. + // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [rabbitmq.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. InstanceStateSuccess = "succeeded" - // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateFailed] instead. + // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [rabbitmq.INSTANCELASTOPERATIONSTATE_FAILED] instead. InstanceStateFailed = "failed" - // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeCreate] instead. + // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [rabbitmq.INSTANCELASTOPERATIONTYPE_CREATE] instead. InstanceTypeCreate = "create" - // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeUpdate] instead. + // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [rabbitmq.INSTANCELASTOPERATIONTYPE_UPDATE] instead. InstanceTypeUpdate = "update" - // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeDelete] instead. + // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [rabbitmq.INSTANCELASTOPERATIONTYPE_DELETE] instead. InstanceTypeDelete = "delete" ) @@ -60,9 +72,9 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return false, nil, fmt.Errorf("create failed for instance with id %s. The response is not valid: the status is missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case rabbitmq.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case rabbitmq.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -86,9 +98,9 @@ func PartialUpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceIn return false, nil, fmt.Errorf("update failed for instance with id %s. The response is not valid: the instance id or the status are missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case rabbitmq.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case rabbitmq.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -109,10 +121,10 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface if s.LastOperation == nil || s.LastOperation.Description == nil || s.Status == nil { return false, nil, fmt.Errorf("delete failed for instance with id %s. The response is not valid: The status or last operation description are missing", instanceId) } - if *s.Status != InstanceStatusDeleting { + if *s.Status != rabbitmq.INSTANCESTATUS_DELETING { return false, nil, nil } - if *s.Status == InstanceStatusActive { + if *s.Status == rabbitmq.INSTANCESTATUS_ACTIVE { if strings.Contains(*s.LastOperation.Description, "DeleteFailed") || strings.Contains(*s.LastOperation.Description, "failed") { return true, nil, fmt.Errorf("instance was deleted successfully but has errors: %s", *s.LastOperation.Description) } diff --git a/services/rabbitmq/wait/wait_test.go b/services/rabbitmq/wait/wait_test.go index b0cc964d9..72bc675ce 100644 --- a/services/rabbitmq/wait/wait_test.go +++ b/services/rabbitmq/wait/wait_test.go @@ -16,20 +16,18 @@ type apiClientInstanceMocked struct { getFails bool deletionSucceedsWithErrors bool resourceId string - resourceOperation *string - resourceState string + resourceOperation *rabbitmq.InstanceLastOperationTypes + resourceState rabbitmq.InstanceStatus resourceDescription string } -const deleteOperation = "delete" - func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*rabbitmq.Instance, error) { if a.getFails { return nil, &oapierror.GenericOpenAPIError{ StatusCode: 500, } } - if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == InstanceStatusActive { + if a.resourceOperation != nil && *a.resourceOperation == rabbitmq.INSTANCELASTOPERATIONTYPE_DELETE && a.resourceState == rabbitmq.INSTANCESTATUS_ACTIVE { if a.deletionSucceedsWithErrors { return &rabbitmq.Instance{ InstanceId: &a.resourceId, @@ -37,7 +35,6 @@ func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ str LastOperation: &rabbitmq.InstanceLastOperation{ Description: &a.resourceDescription, Type: a.resourceOperation, - State: &a.resourceState, }, }, nil } @@ -82,21 +79,21 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState rabbitmq.InstanceStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: rabbitmq.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: rabbitmq.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -151,21 +148,21 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState rabbitmq.InstanceStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: rabbitmq.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: rabbitmq.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -220,7 +217,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc string getFails bool deleteSucceeedsWithErrors bool - resourceState string + resourceState rabbitmq.InstanceStatus resourceDescription string wantErr bool }{ @@ -228,20 +225,20 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc: "delete_succeeded", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusActive, + resourceState: rabbitmq.INSTANCESTATUS_ACTIVE, wantErr: false, }, { desc: "delete_failed", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusFailed, + resourceState: rabbitmq.INSTANCESTATUS_FAILED, wantErr: true, }, { desc: "delete_succeeds_with_errors", getFails: false, - resourceState: InstanceStatusActive, + resourceState: rabbitmq.INSTANCESTATUS_ACTIVE, deleteSucceeedsWithErrors: true, resourceDescription: "Deleting resource: cf failed with error: DeleteFailed", wantErr: true, @@ -261,7 +258,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { getFails: tt.getFails, deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors, resourceId: instanceId, - resourceOperation: utils.Ptr(deleteOperation), + resourceOperation: utils.Ptr(rabbitmq.INSTANCELASTOPERATIONTYPE_DELETE), resourceDescription: tt.resourceDescription, resourceState: tt.resourceState, } diff --git a/services/redis/CHANGELOG.md b/services/redis/CHANGELOG.md index de03fb345..66d4cb6c8 100644 --- a/services/redis/CHANGELOG.md +++ b/services/redis/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.23.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.22.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/redis/model_instance.go b/services/redis/model_instance.go index aa73d2a23..7d7f53a97 100644 --- a/services/redis/model_instance.go +++ b/services/redis/model_instance.go @@ -12,6 +12,7 @@ package redis import ( "encoding/json" + "fmt" ) // checks if the Instance type satisfies the MappedNullable interface at compile time @@ -292,10 +293,118 @@ type InstanceGetPlanNameRetType = string types and functions for status */ -// isEnumRef -type InstanceGetStatusAttributeType = *string -type InstanceGetStatusArgType = string -type InstanceGetStatusRetType = string +//isEnum + +// InstanceStatus the model 'Instance' +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_FAILED InstanceStatus = "failed" + INSTANCESTATUS_STOPPED InstanceStatus = "stopped" + INSTANCESTATUS_CREATING InstanceStatus = "creating" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" + INSTANCESTATUS_UPDATING InstanceStatus = "updating" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "active", + "failed", + "stopped", + "creating", + "deleting", + "updating", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/redis/model_instance_last_operation.go b/services/redis/model_instance_last_operation.go index afb50a9fc..409f07d57 100644 --- a/services/redis/model_instance_last_operation.go +++ b/services/redis/model_instance_last_operation.go @@ -12,6 +12,7 @@ package redis import ( "encoding/json" + "fmt" ) // checks if the InstanceLastOperation type satisfies the MappedNullable interface at compile time @@ -42,10 +43,112 @@ type InstanceLastOperationGetDescriptionRetType = string types and functions for state */ -// isEnumRef -type InstanceLastOperationGetStateAttributeType = *string -type InstanceLastOperationGetStateArgType = string -type InstanceLastOperationGetStateRetType = string +//isEnum + +// InstanceLastOperationState the model 'InstanceLastOperation' +type InstanceLastOperationState string + +// List of State +const ( + INSTANCELASTOPERATIONSTATE_IN_PROGRESS InstanceLastOperationState = "in progress" + INSTANCELASTOPERATIONSTATE_SUCCEEDED InstanceLastOperationState = "succeeded" + INSTANCELASTOPERATIONSTATE_FAILED InstanceLastOperationState = "failed" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationStateEnumValues = []InstanceLastOperationState{ + "in progress", + "succeeded", + "failed", +} + +func (v *InstanceLastOperationState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationState(value) + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationStateFromValue returns a pointer to a valid InstanceLastOperationState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationStateFromValue(v string) (*InstanceLastOperationState, error) { + ev := InstanceLastOperationState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationState: valid values are %v", v, AllowedInstanceLastOperationStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationState) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceLastOperationState) Ptr() *InstanceLastOperationState { + return &v +} + +type NullableInstanceLastOperationState struct { + value *InstanceLastOperationState + isSet bool +} + +func (v NullableInstanceLastOperationState) Get() *InstanceLastOperationState { + return v.value +} + +func (v *NullableInstanceLastOperationState) Set(val *InstanceLastOperationState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationState(val *InstanceLastOperationState) *NullableInstanceLastOperationState { + return &NullableInstanceLastOperationState{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetStateAttributeType = *InstanceLastOperationState +type InstanceLastOperationGetStateArgType = InstanceLastOperationState +type InstanceLastOperationGetStateRetType = InstanceLastOperationState func getInstanceLastOperationGetStateAttributeTypeOk(arg InstanceLastOperationGetStateAttributeType) (ret InstanceLastOperationGetStateRetType, ok bool) { if arg == nil { @@ -62,10 +165,112 @@ func setInstanceLastOperationGetStateAttributeType(arg *InstanceLastOperationGet types and functions for type */ -// isEnumRef -type InstanceLastOperationGetTypeAttributeType = *string -type InstanceLastOperationGetTypeArgType = string -type InstanceLastOperationGetTypeRetType = string +//isEnum + +// InstanceLastOperationTypes the model 'InstanceLastOperation' +type InstanceLastOperationTypes string + +// List of Type +const ( + INSTANCELASTOPERATIONTYPE_CREATE InstanceLastOperationTypes = "create" + INSTANCELASTOPERATIONTYPE_UPDATE InstanceLastOperationTypes = "update" + INSTANCELASTOPERATIONTYPE_DELETE InstanceLastOperationTypes = "delete" +) + +// All allowed values of InstanceLastOperation enum +var AllowedInstanceLastOperationTypesEnumValues = []InstanceLastOperationTypes{ + "create", + "update", + "delete", +} + +func (v *InstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceLastOperationTypes(value) + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceLastOperation", value) +} + +// NewInstanceLastOperationTypesFromValue returns a pointer to a valid InstanceLastOperationTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceLastOperationTypesFromValue(v string) (*InstanceLastOperationTypes, error) { + ev := InstanceLastOperationTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceLastOperationTypes: valid values are %v", v, AllowedInstanceLastOperationTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceLastOperationTypes) IsValid() bool { + for _, existing := range AllowedInstanceLastOperationTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v InstanceLastOperationTypes) Ptr() *InstanceLastOperationTypes { + return &v +} + +type NullableInstanceLastOperationTypes struct { + value *InstanceLastOperationTypes + isSet bool +} + +func (v NullableInstanceLastOperationTypes) Get() *InstanceLastOperationTypes { + return v.value +} + +func (v *NullableInstanceLastOperationTypes) Set(val *InstanceLastOperationTypes) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceLastOperationTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceLastOperationTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceLastOperationTypes(val *InstanceLastOperationTypes) *NullableInstanceLastOperationTypes { + return &NullableInstanceLastOperationTypes{value: val, isSet: true} +} + +func (v NullableInstanceLastOperationTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceLastOperationTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceLastOperationGetTypeAttributeType = *InstanceLastOperationTypes +type InstanceLastOperationGetTypeArgType = InstanceLastOperationTypes +type InstanceLastOperationGetTypeRetType = InstanceLastOperationTypes func getInstanceLastOperationGetTypeAttributeTypeOk(arg InstanceLastOperationGetTypeAttributeType) (ret InstanceLastOperationGetTypeRetType, ok bool) { if arg == nil { @@ -94,11 +299,11 @@ type _InstanceLastOperation InstanceLastOperation // 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 NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, type_ InstanceLastOperationGetTypeArgType) *InstanceLastOperation { +func NewInstanceLastOperation(description InstanceLastOperationGetDescriptionArgType, state InstanceLastOperationGetStateArgType, types InstanceLastOperationGetTypeArgType) *InstanceLastOperation { this := InstanceLastOperation{} setInstanceLastOperationGetDescriptionAttributeType(&this.Description, description) setInstanceLastOperationGetStateAttributeType(&this.State, state) - setInstanceLastOperationGetTypeAttributeType(&this.Type, type_) + setInstanceLastOperationGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/redis/model_instance_parameters.go b/services/redis/model_instance_parameters.go index df7bc79cc..d3d5d1bfb 100644 --- a/services/redis/model_instance_parameters.go +++ b/services/redis/model_instance_parameters.go @@ -12,6 +12,7 @@ package redis import ( "encoding/json" + "fmt" ) // checks if the InstanceParameters type satisfies the MappedNullable interface at compile time @@ -102,10 +103,110 @@ type InstanceParametersGetGraphiteRetType = string types and functions for lazyfree-lazy-eviction */ -// isEnumRef -type InstanceParametersGetLazyfreeLazyEvictionAttributeType = *string -type InstanceParametersGetLazyfreeLazyEvictionArgType = string -type InstanceParametersGetLazyfreeLazyEvictionRetType = string +//isEnum + +// InstanceParametersLazyfreeLazyEviction the model 'InstanceParameters' +type InstanceParametersLazyfreeLazyEviction string + +// List of LazyfreeLazyEviction +const ( + INSTANCEPARAMETERSLAZYFREE_LAZY_EVICTION_YES InstanceParametersLazyfreeLazyEviction = "yes" + INSTANCEPARAMETERSLAZYFREE_LAZY_EVICTION_NO InstanceParametersLazyfreeLazyEviction = "no" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersLazyfreeLazyEvictionEnumValues = []InstanceParametersLazyfreeLazyEviction{ + "yes", + "no", +} + +func (v *InstanceParametersLazyfreeLazyEviction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersLazyfreeLazyEviction(value) + for _, existing := range AllowedInstanceParametersLazyfreeLazyEvictionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersLazyfreeLazyEvictionFromValue returns a pointer to a valid InstanceParametersLazyfreeLazyEviction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersLazyfreeLazyEvictionFromValue(v string) (*InstanceParametersLazyfreeLazyEviction, error) { + ev := InstanceParametersLazyfreeLazyEviction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersLazyfreeLazyEviction: valid values are %v", v, AllowedInstanceParametersLazyfreeLazyEvictionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersLazyfreeLazyEviction) IsValid() bool { + for _, existing := range AllowedInstanceParametersLazyfreeLazyEvictionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LazyfreeLazyEvictionLazyfreeLazyEviction value +func (v InstanceParametersLazyfreeLazyEviction) Ptr() *InstanceParametersLazyfreeLazyEviction { + return &v +} + +type NullableInstanceParametersLazyfreeLazyEviction struct { + value *InstanceParametersLazyfreeLazyEviction + isSet bool +} + +func (v NullableInstanceParametersLazyfreeLazyEviction) Get() *InstanceParametersLazyfreeLazyEviction { + return v.value +} + +func (v *NullableInstanceParametersLazyfreeLazyEviction) Set(val *InstanceParametersLazyfreeLazyEviction) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersLazyfreeLazyEviction) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersLazyfreeLazyEviction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersLazyfreeLazyEviction(val *InstanceParametersLazyfreeLazyEviction) *NullableInstanceParametersLazyfreeLazyEviction { + return &NullableInstanceParametersLazyfreeLazyEviction{value: val, isSet: true} +} + +func (v NullableInstanceParametersLazyfreeLazyEviction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersLazyfreeLazyEviction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetLazyfreeLazyEvictionAttributeType = *InstanceParametersLazyfreeLazyEviction +type InstanceParametersGetLazyfreeLazyEvictionArgType = InstanceParametersLazyfreeLazyEviction +type InstanceParametersGetLazyfreeLazyEvictionRetType = InstanceParametersLazyfreeLazyEviction func getInstanceParametersGetLazyfreeLazyEvictionAttributeTypeOk(arg InstanceParametersGetLazyfreeLazyEvictionAttributeType) (ret InstanceParametersGetLazyfreeLazyEvictionRetType, ok bool) { if arg == nil { @@ -122,10 +223,110 @@ func setInstanceParametersGetLazyfreeLazyEvictionAttributeType(arg *InstancePara types and functions for lazyfree-lazy-expire */ -// isEnumRef -type InstanceParametersGetLazyfreeLazyExpireAttributeType = *string -type InstanceParametersGetLazyfreeLazyExpireArgType = string -type InstanceParametersGetLazyfreeLazyExpireRetType = string +//isEnum + +// InstanceParametersLazyfreeLazyExpire the model 'InstanceParameters' +type InstanceParametersLazyfreeLazyExpire string + +// List of LazyfreeLazyExpire +const ( + INSTANCEPARAMETERSLAZYFREE_LAZY_EXPIRE_YES InstanceParametersLazyfreeLazyExpire = "yes" + INSTANCEPARAMETERSLAZYFREE_LAZY_EXPIRE_NO InstanceParametersLazyfreeLazyExpire = "no" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersLazyfreeLazyExpireEnumValues = []InstanceParametersLazyfreeLazyExpire{ + "yes", + "no", +} + +func (v *InstanceParametersLazyfreeLazyExpire) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersLazyfreeLazyExpire(value) + for _, existing := range AllowedInstanceParametersLazyfreeLazyExpireEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersLazyfreeLazyExpireFromValue returns a pointer to a valid InstanceParametersLazyfreeLazyExpire +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersLazyfreeLazyExpireFromValue(v string) (*InstanceParametersLazyfreeLazyExpire, error) { + ev := InstanceParametersLazyfreeLazyExpire(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersLazyfreeLazyExpire: valid values are %v", v, AllowedInstanceParametersLazyfreeLazyExpireEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersLazyfreeLazyExpire) IsValid() bool { + for _, existing := range AllowedInstanceParametersLazyfreeLazyExpireEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LazyfreeLazyExpireLazyfreeLazyExpire value +func (v InstanceParametersLazyfreeLazyExpire) Ptr() *InstanceParametersLazyfreeLazyExpire { + return &v +} + +type NullableInstanceParametersLazyfreeLazyExpire struct { + value *InstanceParametersLazyfreeLazyExpire + isSet bool +} + +func (v NullableInstanceParametersLazyfreeLazyExpire) Get() *InstanceParametersLazyfreeLazyExpire { + return v.value +} + +func (v *NullableInstanceParametersLazyfreeLazyExpire) Set(val *InstanceParametersLazyfreeLazyExpire) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersLazyfreeLazyExpire) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersLazyfreeLazyExpire) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersLazyfreeLazyExpire(val *InstanceParametersLazyfreeLazyExpire) *NullableInstanceParametersLazyfreeLazyExpire { + return &NullableInstanceParametersLazyfreeLazyExpire{value: val, isSet: true} +} + +func (v NullableInstanceParametersLazyfreeLazyExpire) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersLazyfreeLazyExpire) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetLazyfreeLazyExpireAttributeType = *InstanceParametersLazyfreeLazyExpire +type InstanceParametersGetLazyfreeLazyExpireArgType = InstanceParametersLazyfreeLazyExpire +type InstanceParametersGetLazyfreeLazyExpireRetType = InstanceParametersLazyfreeLazyExpire func getInstanceParametersGetLazyfreeLazyExpireAttributeTypeOk(arg InstanceParametersGetLazyfreeLazyExpireAttributeType) (ret InstanceParametersGetLazyfreeLazyExpireRetType, ok bool) { if arg == nil { @@ -202,10 +403,118 @@ func setInstanceParametersGetMaxclientsAttributeType(arg *InstanceParametersGetM types and functions for maxmemory-policy */ -// isEnumRef -type InstanceParametersGetMaxmemoryPolicyAttributeType = *string -type InstanceParametersGetMaxmemoryPolicyArgType = string -type InstanceParametersGetMaxmemoryPolicyRetType = string +//isEnum + +// InstanceParametersMaxmemoryPolicy the model 'InstanceParameters' +type InstanceParametersMaxmemoryPolicy string + +// List of MaxmemoryPolicy +const ( + INSTANCEPARAMETERSMAXMEMORY_POLICY_VOLATILE_LRU InstanceParametersMaxmemoryPolicy = "volatile-lru" + INSTANCEPARAMETERSMAXMEMORY_POLICY_ALLKEYS_LRU InstanceParametersMaxmemoryPolicy = "allkeys-lru" + INSTANCEPARAMETERSMAXMEMORY_POLICY_VOLATILE_RANDOM InstanceParametersMaxmemoryPolicy = "volatile-random" + INSTANCEPARAMETERSMAXMEMORY_POLICY_ALLKEYS_RANDOM InstanceParametersMaxmemoryPolicy = "allkeys-random" + INSTANCEPARAMETERSMAXMEMORY_POLICY_VOLATILE_TTL InstanceParametersMaxmemoryPolicy = "volatile-ttl" + INSTANCEPARAMETERSMAXMEMORY_POLICY_NOEVICTION InstanceParametersMaxmemoryPolicy = "noeviction" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersMaxmemoryPolicyEnumValues = []InstanceParametersMaxmemoryPolicy{ + "volatile-lru", + "allkeys-lru", + "volatile-random", + "allkeys-random", + "volatile-ttl", + "noeviction", +} + +func (v *InstanceParametersMaxmemoryPolicy) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersMaxmemoryPolicy(value) + for _, existing := range AllowedInstanceParametersMaxmemoryPolicyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersMaxmemoryPolicyFromValue returns a pointer to a valid InstanceParametersMaxmemoryPolicy +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersMaxmemoryPolicyFromValue(v string) (*InstanceParametersMaxmemoryPolicy, error) { + ev := InstanceParametersMaxmemoryPolicy(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersMaxmemoryPolicy: valid values are %v", v, AllowedInstanceParametersMaxmemoryPolicyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersMaxmemoryPolicy) IsValid() bool { + for _, existing := range AllowedInstanceParametersMaxmemoryPolicyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MaxmemoryPolicyMaxmemoryPolicy value +func (v InstanceParametersMaxmemoryPolicy) Ptr() *InstanceParametersMaxmemoryPolicy { + return &v +} + +type NullableInstanceParametersMaxmemoryPolicy struct { + value *InstanceParametersMaxmemoryPolicy + isSet bool +} + +func (v NullableInstanceParametersMaxmemoryPolicy) Get() *InstanceParametersMaxmemoryPolicy { + return v.value +} + +func (v *NullableInstanceParametersMaxmemoryPolicy) Set(val *InstanceParametersMaxmemoryPolicy) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersMaxmemoryPolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersMaxmemoryPolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersMaxmemoryPolicy(val *InstanceParametersMaxmemoryPolicy) *NullableInstanceParametersMaxmemoryPolicy { + return &NullableInstanceParametersMaxmemoryPolicy{value: val, isSet: true} +} + +func (v NullableInstanceParametersMaxmemoryPolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersMaxmemoryPolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetMaxmemoryPolicyAttributeType = *InstanceParametersMaxmemoryPolicy +type InstanceParametersGetMaxmemoryPolicyArgType = InstanceParametersMaxmemoryPolicy +type InstanceParametersGetMaxmemoryPolicyRetType = InstanceParametersMaxmemoryPolicy func getInstanceParametersGetMaxmemoryPolicyAttributeTypeOk(arg InstanceParametersGetMaxmemoryPolicyAttributeType) (ret InstanceParametersGetMaxmemoryPolicyRetType, ok bool) { if arg == nil { @@ -448,10 +757,110 @@ type InstanceParametersGetTlsCiphersuitesRetType = string types and functions for tls-protocols */ -// isEnumRef -type InstanceParametersGetTlsProtocolsAttributeType = *string -type InstanceParametersGetTlsProtocolsArgType = string -type InstanceParametersGetTlsProtocolsRetType = string +//isEnum + +// InstanceParametersTlsProtocols the model 'InstanceParameters' +type InstanceParametersTlsProtocols string + +// List of TlsProtocols +const ( + INSTANCEPARAMETERSTLS_PROTOCOLS__2 InstanceParametersTlsProtocols = "TLSv1.2" + INSTANCEPARAMETERSTLS_PROTOCOLS__3 InstanceParametersTlsProtocols = "TLSv1.3" +) + +// All allowed values of InstanceParameters enum +var AllowedInstanceParametersTlsProtocolsEnumValues = []InstanceParametersTlsProtocols{ + "TLSv1.2", + "TLSv1.3", +} + +func (v *InstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := InstanceParametersTlsProtocols(value) + for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid InstanceParameters", value) +} + +// NewInstanceParametersTlsProtocolsFromValue returns a pointer to a valid InstanceParametersTlsProtocols +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceParametersTlsProtocolsFromValue(v string) (*InstanceParametersTlsProtocols, error) { + ev := InstanceParametersTlsProtocols(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceParametersTlsProtocols: valid values are %v", v, AllowedInstanceParametersTlsProtocolsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceParametersTlsProtocols) IsValid() bool { + for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TlsProtocolsTlsProtocols value +func (v InstanceParametersTlsProtocols) Ptr() *InstanceParametersTlsProtocols { + return &v +} + +type NullableInstanceParametersTlsProtocols struct { + value *InstanceParametersTlsProtocols + isSet bool +} + +func (v NullableInstanceParametersTlsProtocols) Get() *InstanceParametersTlsProtocols { + return v.value +} + +func (v *NullableInstanceParametersTlsProtocols) Set(val *InstanceParametersTlsProtocols) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceParametersTlsProtocols) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceParametersTlsProtocols) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceParametersTlsProtocols(val *InstanceParametersTlsProtocols) *NullableInstanceParametersTlsProtocols { + return &NullableInstanceParametersTlsProtocols{value: val, isSet: true} +} + +func (v NullableInstanceParametersTlsProtocols) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceParametersGetTlsProtocolsAttributeType = *InstanceParametersTlsProtocols +type InstanceParametersGetTlsProtocolsArgType = InstanceParametersTlsProtocols +type InstanceParametersGetTlsProtocolsRetType = InstanceParametersTlsProtocols func getInstanceParametersGetTlsProtocolsAttributeTypeOk(arg InstanceParametersGetTlsProtocolsAttributeType) (ret InstanceParametersGetTlsProtocolsRetType, ok bool) { if arg == nil { @@ -528,9 +937,9 @@ func NewInstanceParametersWithDefaults() *InstanceParameters { this.EnableMonitoring = &enableMonitoring var failoverTimeout int64 = 30000 this.FailoverTimeout = &failoverTimeout - var lazyfreeLazyEviction string = "no" + var lazyfreeLazyEviction InstanceParametersLazyfreeLazyEviction = "no" this.LazyfreeLazyEviction = &lazyfreeLazyEviction - var lazyfreeLazyExpire string = "no" + var lazyfreeLazyExpire InstanceParametersLazyfreeLazyExpire = "no" this.LazyfreeLazyExpire = &lazyfreeLazyExpire var luaTimeLimit int64 = 5000 this.LuaTimeLimit = &luaTimeLimit @@ -538,7 +947,7 @@ func NewInstanceParametersWithDefaults() *InstanceParameters { this.MaxDiskThreshold = &maxDiskThreshold var maxclients int64 = 10000 this.Maxclients = &maxclients - var maxmemoryPolicy string = "volatile-lru" + var maxmemoryPolicy InstanceParametersMaxmemoryPolicy = "volatile-lru" this.MaxmemoryPolicy = &maxmemoryPolicy var maxmemorySamples int64 = 5 this.MaxmemorySamples = &maxmemorySamples diff --git a/services/redis/wait/wait.go b/services/redis/wait/wait.go index 84fbb4b06..14067bdf3 100644 --- a/services/redis/wait/wait.go +++ b/services/redis/wait/wait.go @@ -13,29 +13,41 @@ import ( ) const ( - InstanceStatusActive = "active" - InstanceStatusFailed = "failed" - InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusActive is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCESTATUS_ACTIVE] instead. + InstanceStatusActive = "active" + // Deprecated: InstanceStatusFailed is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCESTATUS_FAILED] instead. + InstanceStatusFailed = "failed" + // Deprecated: InstanceStatusStopped is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCESTATUS_STOPPED] instead. + InstanceStatusStopped = "stopped" + // Deprecated: InstanceStatusCreating is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCESTATUS_CREATING] instead. InstanceStatusCreating = "creating" + // Deprecated: InstanceStatusDeleting is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCESTATUS_DELETING] instead. InstanceStatusDeleting = "deleting" + // Deprecated: InstanceStatusUpdating is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCESTATUS_UPDATING] instead. InstanceStatusUpdating = "updating" + // Deprecated: InstanceOperationStateInProgress is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCELASTOPERATIONSTATE_IN_PROGRESS] instead. InstanceOperationStateInProgress = "in progress" - InstanceOperationStateSucceeded = "succeeded" - InstanceOperationStateFailed = "failed" - InstanceOperationTypeCreate = "create" - InstanceOperationTypeUpdate = "update" - InstanceOperationTypeDelete = "delete" + // Deprecated: InstanceOperationStateSucceeded is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. + InstanceOperationStateSucceeded = "succeeded" + // Deprecated: InstanceOperationStateFailed is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCELASTOPERATIONSTATE_FAILED] instead. + InstanceOperationStateFailed = "failed" + // Deprecated: InstanceOperationTypeCreate is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCELASTOPERATIONTYPE_CREATE] instead. + InstanceOperationTypeCreate = "create" + // Deprecated: InstanceOperationTypeUpdate is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCELASTOPERATIONTYPE_UPDATE] instead. + InstanceOperationTypeUpdate = "update" + // Deprecated: InstanceOperationTypeDelete is deprecated and will be removed after 14th November 2025. Use [redis.INSTANCELASTOPERATIONTYPE_DELETE] instead. + InstanceOperationTypeDelete = "delete" - // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateSucceeded] instead. + // Deprecated: InstanceStateSuccess is deprecated and will be removed after 2nd October 2025. Use [redis.INSTANCELASTOPERATIONSTATE_SUCCEEDED] instead. InstanceStateSuccess = "succeeded" - // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationStateFailed] instead. + // Deprecated: InstanceStateFailed is deprecated and will be removed after 2nd October 2025. Use [redis.INSTANCELASTOPERATIONSTATE_FAILED] instead. InstanceStateFailed = "failed" - // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeCreate] instead. + // Deprecated: InstanceTypeCreate is deprecated and will be removed after 2nd October 2025. Use [redis.INSTANCELASTOPERATIONTYPE_CREATE] instead. InstanceTypeCreate = "create" - // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeUpdate] instead. + // Deprecated: InstanceTypeUpdate is deprecated and will be removed after 2nd October 2025. Use [redis.INSTANCELASTOPERATIONTYPE_UPDATE] instead. InstanceTypeUpdate = "update" - // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [InstanceOperationTypeDelete] instead. + // Deprecated: InstanceTypeDelete is deprecated and will be removed after 2nd October 2025. Use [redis.INSTANCELASTOPERATIONTYPE_DELETE] instead. InstanceTypeDelete = "delete" ) @@ -60,9 +72,9 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface return false, nil, fmt.Errorf("create failed for instance with id %s. The response is not valid: the status is missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case redis.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case redis.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -86,9 +98,9 @@ func PartialUpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceIn return false, nil, fmt.Errorf("update failed for instance with id %s. The response is not valid: the instance id or the status are missing", instanceId) } switch *s.Status { - case InstanceStatusActive: + case redis.INSTANCESTATUS_ACTIVE: return true, s, nil - case InstanceStatusFailed: + case redis.INSTANCESTATUS_FAILED: var failedDescription string if s.LastOperation != nil && s.LastOperation.Description != nil { failedDescription = *s.LastOperation.Description @@ -109,10 +121,10 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface if s.LastOperation == nil || s.LastOperation.Description == nil || s.Status == nil { return false, nil, fmt.Errorf("delete failed for instance with id %s. The response is not valid: The status or last operation description are missing", instanceId) } - if *s.Status != InstanceStatusDeleting { + if *s.Status != redis.INSTANCESTATUS_DELETING { return false, nil, nil } - if *s.Status == InstanceStatusActive { + if *s.Status == redis.INSTANCESTATUS_ACTIVE { if strings.Contains(*s.LastOperation.Description, "DeleteFailed") || strings.Contains(*s.LastOperation.Description, "failed") { return true, nil, fmt.Errorf("instance was deleted successfully but has errors: %s", *s.LastOperation.Description) } diff --git a/services/redis/wait/wait_test.go b/services/redis/wait/wait_test.go index 52c49fb2c..273ed468d 100644 --- a/services/redis/wait/wait_test.go +++ b/services/redis/wait/wait_test.go @@ -16,20 +16,18 @@ type apiClientInstanceMocked struct { getFails bool deletionSucceedsWithErrors bool resourceId string - resourceOperation *string - resourceState string + resourceOperation *redis.InstanceLastOperationTypes + resourceState redis.InstanceStatus resourceDescription string } -const deleteOperation = "delete" - func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*redis.Instance, error) { if a.getFails { return nil, &oapierror.GenericOpenAPIError{ StatusCode: 500, } } - if a.resourceOperation != nil && *a.resourceOperation == deleteOperation && a.resourceState == InstanceStatusActive { + if a.resourceOperation != nil && *a.resourceOperation == redis.INSTANCELASTOPERATIONTYPE_DELETE && a.resourceState == redis.INSTANCESTATUS_ACTIVE { if a.deletionSucceedsWithErrors { return &redis.Instance{ InstanceId: &a.resourceId, @@ -37,7 +35,6 @@ func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ str LastOperation: &redis.InstanceLastOperation{ Description: &a.resourceDescription, Type: a.resourceOperation, - State: &a.resourceState, }, }, nil } @@ -82,21 +79,21 @@ func TestCreateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState redis.InstanceStatus wantErr bool wantResp bool }{ { desc: "create_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: redis.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "create_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: redis.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -151,21 +148,21 @@ func TestUpdateInstanceWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState redis.InstanceStatus wantErr bool wantResp bool }{ { desc: "update_succeeded", getFails: false, - resourceState: InstanceStatusActive, + resourceState: redis.INSTANCESTATUS_ACTIVE, wantErr: false, wantResp: true, }, { desc: "update_failed", getFails: false, - resourceState: InstanceStatusFailed, + resourceState: redis.INSTANCESTATUS_FAILED, wantErr: true, wantResp: true, }, @@ -220,7 +217,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc string getFails bool deleteSucceeedsWithErrors bool - resourceState string + resourceState redis.InstanceStatus resourceDescription string wantErr bool }{ @@ -228,20 +225,20 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { desc: "delete_succeeded", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusActive, + resourceState: redis.INSTANCESTATUS_ACTIVE, wantErr: false, }, { desc: "delete_failed", getFails: false, deleteSucceeedsWithErrors: false, - resourceState: InstanceStatusFailed, + resourceState: redis.INSTANCESTATUS_FAILED, wantErr: true, }, { desc: "delete_succeeds_with_errors", getFails: false, - resourceState: InstanceStatusActive, + resourceState: redis.INSTANCESTATUS_ACTIVE, deleteSucceeedsWithErrors: true, resourceDescription: "Deleting resource: cf failed with error: DeleteFailed", wantErr: true, @@ -261,7 +258,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) { getFails: tt.getFails, deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors, resourceId: instanceId, - resourceOperation: utils.Ptr(deleteOperation), + resourceOperation: utils.Ptr(redis.INSTANCELASTOPERATIONTYPE_DELETE), resourceDescription: tt.resourceDescription, resourceState: tt.resourceState, } diff --git a/services/resourcemanager/CHANGELOG.md b/services/resourcemanager/CHANGELOG.md index 491c3cd37..54c95c52b 100644 --- a/services/resourcemanager/CHANGELOG.md +++ b/services/resourcemanager/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.14.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.13.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/resourcemanager/model_parent.go b/services/resourcemanager/model_parent.go index a6b63c802..ff9b772dc 100644 --- a/services/resourcemanager/model_parent.go +++ b/services/resourcemanager/model_parent.go @@ -12,6 +12,7 @@ package resourcemanager import ( "encoding/json" + "fmt" ) // checks if the Parent type satisfies the MappedNullable interface at compile time @@ -63,10 +64,110 @@ type ParentGetIdRetType = string types and functions for type */ -// isEnumRef -type ParentGetTypeAttributeType = *string -type ParentGetTypeArgType = string -type ParentGetTypeRetType = string +//isEnum + +// ParentTypes Container type of parent container. +type ParentTypes string + +// List of Type +const ( + PARENTTYPE_ORGANIZATION ParentTypes = "ORGANIZATION" + PARENTTYPE_FOLDER ParentTypes = "FOLDER" +) + +// All allowed values of Parent enum +var AllowedParentTypesEnumValues = []ParentTypes{ + "ORGANIZATION", + "FOLDER", +} + +func (v *ParentTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ParentTypes(value) + for _, existing := range AllowedParentTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Parent", value) +} + +// NewParentTypesFromValue returns a pointer to a valid ParentTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewParentTypesFromValue(v string) (*ParentTypes, error) { + ev := ParentTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ParentTypes: valid values are %v", v, AllowedParentTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ParentTypes) IsValid() bool { + for _, existing := range AllowedParentTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v ParentTypes) Ptr() *ParentTypes { + return &v +} + +type NullableParentTypes struct { + value *ParentTypes + isSet bool +} + +func (v NullableParentTypes) Get() *ParentTypes { + return v.value +} + +func (v *NullableParentTypes) Set(val *ParentTypes) { + v.value = val + v.isSet = true +} + +func (v NullableParentTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableParentTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableParentTypes(val *ParentTypes) *NullableParentTypes { + return &NullableParentTypes{value: val, isSet: true} +} + +func (v NullableParentTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableParentTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ParentGetTypeAttributeType = *ParentTypes +type ParentGetTypeArgType = ParentTypes +type ParentGetTypeRetType = ParentTypes func getParentGetTypeAttributeTypeOk(arg ParentGetTypeAttributeType) (ret ParentGetTypeRetType, ok bool) { if arg == nil { @@ -98,11 +199,11 @@ type _Parent Parent // 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 NewParent(containerId ParentGetContainerIdArgType, id ParentGetIdArgType, type_ ParentGetTypeArgType) *Parent { +func NewParent(containerId ParentGetContainerIdArgType, id ParentGetIdArgType, types ParentGetTypeArgType) *Parent { this := Parent{} setParentGetContainerIdAttributeType(&this.ContainerId, containerId) setParentGetIdAttributeType(&this.Id, id) - setParentGetTypeAttributeType(&this.Type, type_) + setParentGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/resourcemanager/model_parent_list_inner.go b/services/resourcemanager/model_parent_list_inner.go index 3a10231d9..4b2c2bfe8 100644 --- a/services/resourcemanager/model_parent_list_inner.go +++ b/services/resourcemanager/model_parent_list_inner.go @@ -12,6 +12,7 @@ package resourcemanager import ( "encoding/json" + "fmt" ) // checks if the ParentListInner type satisfies the MappedNullable interface at compile time @@ -126,10 +127,110 @@ type ParentListInnerGetParentIdRetType = string types and functions for type */ -// isEnumRef -type ParentListInnerGetTypeAttributeType = *string -type ParentListInnerGetTypeArgType = string -type ParentListInnerGetTypeRetType = string +//isEnum + +// ParentListInnerTypes Parent container type. +type ParentListInnerTypes string + +// List of Type +const ( + PARENTLISTINNERTYPE_FOLDER ParentListInnerTypes = "FOLDER" + PARENTLISTINNERTYPE_ORGANIZATION ParentListInnerTypes = "ORGANIZATION" +) + +// All allowed values of ParentListInner enum +var AllowedParentListInnerTypesEnumValues = []ParentListInnerTypes{ + "FOLDER", + "ORGANIZATION", +} + +func (v *ParentListInnerTypes) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ParentListInnerTypes(value) + for _, existing := range AllowedParentListInnerTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ParentListInner", value) +} + +// NewParentListInnerTypesFromValue returns a pointer to a valid ParentListInnerTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewParentListInnerTypesFromValue(v string) (*ParentListInnerTypes, error) { + ev := ParentListInnerTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ParentListInnerTypes: valid values are %v", v, AllowedParentListInnerTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ParentListInnerTypes) IsValid() bool { + for _, existing := range AllowedParentListInnerTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v ParentListInnerTypes) Ptr() *ParentListInnerTypes { + return &v +} + +type NullableParentListInnerTypes struct { + value *ParentListInnerTypes + isSet bool +} + +func (v NullableParentListInnerTypes) Get() *ParentListInnerTypes { + return v.value +} + +func (v *NullableParentListInnerTypes) Set(val *ParentListInnerTypes) { + v.value = val + v.isSet = true +} + +func (v NullableParentListInnerTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableParentListInnerTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableParentListInnerTypes(val *ParentListInnerTypes) *NullableParentListInnerTypes { + return &NullableParentListInnerTypes{value: val, isSet: true} +} + +func (v NullableParentListInnerTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableParentListInnerTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ParentListInnerGetTypeAttributeType = *ParentListInnerTypes +type ParentListInnerGetTypeArgType = ParentListInnerTypes +type ParentListInnerGetTypeRetType = ParentListInnerTypes func getParentListInnerGetTypeAttributeTypeOk(arg ParentListInnerGetTypeAttributeType) (ret ParentListInnerGetTypeRetType, ok bool) { if arg == nil { @@ -148,8 +249,7 @@ type ParentListInner struct { // REQUIRED ContainerId ParentListInnerGetContainerIdAttributeType `json:"containerId"` // User-friendly parent identifier of either organization or folder (will replace parentId). - // REQUIRED - ContainerParentId ParentListInnerGetContainerParentIdAttributeType `json:"containerParentId"` + ContainerParentId ParentListInnerGetContainerParentIdAttributeType `json:"containerParentId,omitempty"` // Identifier. // REQUIRED Id ParentListInnerGetIdAttributeType `json:"id"` @@ -157,8 +257,7 @@ type ParentListInner struct { // REQUIRED Name ParentListInnerGetNameAttributeType `json:"name"` // Identifier of the parent resource container. - // REQUIRED - ParentId ParentListInnerGetParentIdAttributeType `json:"parentId"` + ParentId ParentListInnerGetParentIdAttributeType `json:"parentId,omitempty"` // Parent container type. // REQUIRED Type ParentListInnerGetTypeAttributeType `json:"type"` @@ -170,14 +269,12 @@ type _ParentListInner ParentListInner // 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 NewParentListInner(containerId ParentListInnerGetContainerIdArgType, containerParentId ParentListInnerGetContainerParentIdArgType, id ParentListInnerGetIdArgType, name ParentListInnerGetNameArgType, parentId ParentListInnerGetParentIdArgType, type_ ParentListInnerGetTypeArgType) *ParentListInner { +func NewParentListInner(containerId ParentListInnerGetContainerIdArgType, id ParentListInnerGetIdArgType, name ParentListInnerGetNameArgType, types ParentListInnerGetTypeArgType) *ParentListInner { this := ParentListInner{} setParentListInnerGetContainerIdAttributeType(&this.ContainerId, containerId) - setParentListInnerGetContainerParentIdAttributeType(&this.ContainerParentId, containerParentId) setParentListInnerGetIdAttributeType(&this.Id, id) setParentListInnerGetNameAttributeType(&this.Name, name) - setParentListInnerGetParentIdAttributeType(&this.ParentId, parentId) - setParentListInnerGetTypeAttributeType(&this.Type, type_) + setParentListInnerGetTypeAttributeType(&this.Type, types) return &this } @@ -206,19 +303,25 @@ func (o *ParentListInner) SetContainerId(v ParentListInnerGetContainerIdRetType) setParentListInnerGetContainerIdAttributeType(&o.ContainerId, v) } -// GetContainerParentId returns the ContainerParentId field value -func (o *ParentListInner) GetContainerParentId() (ret ParentListInnerGetContainerParentIdRetType) { - ret, _ = o.GetContainerParentIdOk() - return ret +// GetContainerParentId returns the ContainerParentId field value if set, zero value otherwise. +func (o *ParentListInner) GetContainerParentId() (res ParentListInnerGetContainerParentIdRetType) { + res, _ = o.GetContainerParentIdOk() + return } -// GetContainerParentIdOk returns a tuple with the ContainerParentId field value +// GetContainerParentIdOk returns a tuple with the ContainerParentId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ParentListInner) GetContainerParentIdOk() (ret ParentListInnerGetContainerParentIdRetType, ok bool) { return getParentListInnerGetContainerParentIdAttributeTypeOk(o.ContainerParentId) } -// SetContainerParentId sets field value +// HasContainerParentId returns a boolean if a field has been set. +func (o *ParentListInner) HasContainerParentId() bool { + _, ok := o.GetContainerParentIdOk() + return ok +} + +// SetContainerParentId gets a reference to the given string and assigns it to the ContainerParentId field. func (o *ParentListInner) SetContainerParentId(v ParentListInnerGetContainerParentIdRetType) { setParentListInnerGetContainerParentIdAttributeType(&o.ContainerParentId, v) } @@ -257,19 +360,25 @@ func (o *ParentListInner) SetName(v ParentListInnerGetNameRetType) { setParentListInnerGetNameAttributeType(&o.Name, v) } -// GetParentId returns the ParentId field value -func (o *ParentListInner) GetParentId() (ret ParentListInnerGetParentIdRetType) { - ret, _ = o.GetParentIdOk() - return ret +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *ParentListInner) GetParentId() (res ParentListInnerGetParentIdRetType) { + res, _ = o.GetParentIdOk() + return } -// GetParentIdOk returns a tuple with the ParentId field value +// GetParentIdOk returns a tuple with the ParentId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ParentListInner) GetParentIdOk() (ret ParentListInnerGetParentIdRetType, ok bool) { return getParentListInnerGetParentIdAttributeTypeOk(o.ParentId) } -// SetParentId sets field value +// HasParentId returns a boolean if a field has been set. +func (o *ParentListInner) HasParentId() bool { + _, ok := o.GetParentIdOk() + return ok +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. func (o *ParentListInner) SetParentId(v ParentListInnerGetParentIdRetType) { setParentListInnerGetParentIdAttributeType(&o.ParentId, v) } diff --git a/services/resourcemanager/wait/wait.go b/services/resourcemanager/wait/wait.go index 2a2516105..f392eada4 100644 --- a/services/resourcemanager/wait/wait.go +++ b/services/resourcemanager/wait/wait.go @@ -12,7 +12,9 @@ import ( ) const ( - ActiveState = resourcemanager.LifecycleState("ACTIVE") + // Deprecated: ActiveState is deprecated and will be removed after 14th November 2025. Use [resourcemanager.LIFECYCLESTATE_ACTIVE] instead. + ActiveState = resourcemanager.LifecycleState("ACTIVE") + // Deprecated: CreatingState is deprecated and will be removed after 14th November 2025. Use [resourcemanager.LIFECYCLESTATE_CREATING] instead. CreatingState = resourcemanager.LifecycleState("CREATING") ) @@ -31,10 +33,10 @@ func CreateProjectWaitHandler(ctx context.Context, a APIClientInterface, contain if p.ContainerId == nil || p.LifecycleState == nil { return false, nil, fmt.Errorf("creation failed: response invalid for container id %s. Container id or LifeCycleState missing", containerId) } - if *p.ContainerId == containerId && *p.LifecycleState == ActiveState { + if *p.ContainerId == containerId && *p.LifecycleState == resourcemanager.LIFECYCLESTATE_ACTIVE { return true, p, nil } - if *p.ContainerId == containerId && *p.LifecycleState == CreatingState { + if *p.ContainerId == containerId && *p.LifecycleState == resourcemanager.LIFECYCLESTATE_CREATING { return false, nil, nil } return true, p, fmt.Errorf("creation failed: received project state '%s'", *p.LifecycleState) diff --git a/services/resourcemanager/wait/wait_test.go b/services/resourcemanager/wait/wait_test.go index fc43a3409..5d45df0f9 100644 --- a/services/resourcemanager/wait/wait_test.go +++ b/services/resourcemanager/wait/wait_test.go @@ -48,14 +48,14 @@ func TestCreateProjectWaitHandler(t *testing.T) { { desc: "create_succeeded", getFails: false, - projectState: ActiveState, + projectState: resourcemanager.LIFECYCLESTATE_ACTIVE, wantErr: false, wantResp: true, }, { desc: "creating", getFails: false, - projectState: CreatingState, + projectState: resourcemanager.LIFECYCLESTATE_CREATING, wantErr: true, wantResp: false, }, diff --git a/services/runcommand/CHANGELOG.md b/services/runcommand/CHANGELOG.md index 3243ab154..3cdf9107f 100644 --- a/services/runcommand/CHANGELOG.md +++ b/services/runcommand/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.0.2 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/runcommand/model_command_details.go b/services/runcommand/model_command_details.go index c5cfe4aaf..6f4258c8d 100644 --- a/services/runcommand/model_command_details.go +++ b/services/runcommand/model_command_details.go @@ -12,6 +12,7 @@ package runcommand import ( "encoding/json" + "fmt" ) // checks if the CommandDetails type satisfies the MappedNullable interface at compile time @@ -187,10 +188,114 @@ type CommandDetailsGetStartedAtRetType = string types and functions for status */ -// isEnumRef -type CommandDetailsGetStatusAttributeType = *string -type CommandDetailsGetStatusArgType = string -type CommandDetailsGetStatusRetType = string +//isEnum + +// CommandDetailsStatus the model 'CommandDetails' +type CommandDetailsStatus string + +// List of Status +const ( + COMMANDDETAILSSTATUS_PENDING CommandDetailsStatus = "pending" + COMMANDDETAILSSTATUS_RUNNING CommandDetailsStatus = "running" + COMMANDDETAILSSTATUS_COMPLETED CommandDetailsStatus = "completed" + COMMANDDETAILSSTATUS_FAILED CommandDetailsStatus = "failed" +) + +// All allowed values of CommandDetails enum +var AllowedCommandDetailsStatusEnumValues = []CommandDetailsStatus{ + "pending", + "running", + "completed", + "failed", +} + +func (v *CommandDetailsStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CommandDetailsStatus(value) + for _, existing := range AllowedCommandDetailsStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CommandDetails", value) +} + +// NewCommandDetailsStatusFromValue returns a pointer to a valid CommandDetailsStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCommandDetailsStatusFromValue(v string) (*CommandDetailsStatus, error) { + ev := CommandDetailsStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CommandDetailsStatus: valid values are %v", v, AllowedCommandDetailsStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CommandDetailsStatus) IsValid() bool { + for _, existing := range AllowedCommandDetailsStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CommandDetailsStatus) Ptr() *CommandDetailsStatus { + return &v +} + +type NullableCommandDetailsStatus struct { + value *CommandDetailsStatus + isSet bool +} + +func (v NullableCommandDetailsStatus) Get() *CommandDetailsStatus { + return v.value +} + +func (v *NullableCommandDetailsStatus) Set(val *CommandDetailsStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCommandDetailsStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandDetailsStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandDetailsStatus(val *CommandDetailsStatus) *NullableCommandDetailsStatus { + return &NullableCommandDetailsStatus{value: val, isSet: true} +} + +func (v NullableCommandDetailsStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandDetailsStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CommandDetailsGetStatusAttributeType = *CommandDetailsStatus +type CommandDetailsGetStatusArgType = CommandDetailsStatus +type CommandDetailsGetStatusRetType = CommandDetailsStatus func getCommandDetailsGetStatusAttributeTypeOk(arg CommandDetailsGetStatusAttributeType) (ret CommandDetailsGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/runcommand/model_commands.go b/services/runcommand/model_commands.go index db96331d1..155a16f5a 100644 --- a/services/runcommand/model_commands.go +++ b/services/runcommand/model_commands.go @@ -12,6 +12,7 @@ package runcommand import ( "encoding/json" + "fmt" ) // checks if the Commands type satisfies the MappedNullable interface at compile time @@ -125,10 +126,114 @@ type CommandsGetStartedAtRetType = string types and functions for status */ -// isEnumRef -type CommandsGetStatusAttributeType = *string -type CommandsGetStatusArgType = string -type CommandsGetStatusRetType = string +//isEnum + +// CommandsStatus the model 'Commands' +type CommandsStatus string + +// List of Status +const ( + COMMANDSSTATUS_PENDING CommandsStatus = "pending" + COMMANDSSTATUS_RUNNING CommandsStatus = "running" + COMMANDSSTATUS_COMPLETED CommandsStatus = "completed" + COMMANDSSTATUS_FAILED CommandsStatus = "failed" +) + +// All allowed values of Commands enum +var AllowedCommandsStatusEnumValues = []CommandsStatus{ + "pending", + "running", + "completed", + "failed", +} + +func (v *CommandsStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CommandsStatus(value) + for _, existing := range AllowedCommandsStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Commands", value) +} + +// NewCommandsStatusFromValue returns a pointer to a valid CommandsStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCommandsStatusFromValue(v string) (*CommandsStatus, error) { + ev := CommandsStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CommandsStatus: valid values are %v", v, AllowedCommandsStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CommandsStatus) IsValid() bool { + for _, existing := range AllowedCommandsStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CommandsStatus) Ptr() *CommandsStatus { + return &v +} + +type NullableCommandsStatus struct { + value *CommandsStatus + isSet bool +} + +func (v NullableCommandsStatus) Get() *CommandsStatus { + return v.value +} + +func (v *NullableCommandsStatus) Set(val *CommandsStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCommandsStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandsStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandsStatus(val *CommandsStatus) *NullableCommandsStatus { + return &NullableCommandsStatus{value: val, isSet: true} +} + +func (v NullableCommandsStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandsStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CommandsGetStatusAttributeType = *CommandsStatus +type CommandsGetStatusArgType = CommandsStatus +type CommandsGetStatusRetType = CommandsStatus func getCommandsGetStatusAttributeTypeOk(arg CommandsGetStatusAttributeType) (ret CommandsGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/serverbackup/CHANGELOG.md b/services/serverbackup/CHANGELOG.md index 7b13ca2f7..c29e740fd 100644 --- a/services/serverbackup/CHANGELOG.md +++ b/services/serverbackup/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.0.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/serverbackup/model_backup.go b/services/serverbackup/model_backup.go index db467b021..d4da53eb4 100644 --- a/services/serverbackup/model_backup.go +++ b/services/serverbackup/model_backup.go @@ -12,6 +12,7 @@ package serverbackup import ( "encoding/json" + "fmt" ) // checks if the Backup type satisfies the MappedNullable interface at compile time @@ -146,10 +147,124 @@ func setBackupGetSizeAttributeType(arg *BackupGetSizeAttributeType, val BackupGe types and functions for status */ -// isEnumRef -type BackupGetStatusAttributeType = *string -type BackupGetStatusArgType = string -type BackupGetStatusRetType = string +//isEnum + +// BackupStatus the model 'Backup' +type BackupStatus string + +// List of Status +const ( + BACKUPSTATUS_CREATING BackupStatus = "creating" + BACKUPSTATUS_AVAILABLE BackupStatus = "available" + BACKUPSTATUS_DELETING BackupStatus = "deleting" + BACKUPSTATUS_ERROR BackupStatus = "error" + BACKUPSTATUS_RESTORING BackupStatus = "restoring" + BACKUPSTATUS_ERROR_DELETING BackupStatus = "error_deleting" + BACKUPSTATUS_BACKING_UP BackupStatus = "backing up" + BACKUPSTATUS_INCONSISTENT BackupStatus = "inconsistent" + BACKUPSTATUS_ERROR_CREATING BackupStatus = "error-creating" +) + +// All allowed values of Backup enum +var AllowedBackupStatusEnumValues = []BackupStatus{ + "creating", + "available", + "deleting", + "error", + "restoring", + "error_deleting", + "backing up", + "inconsistent", + "error-creating", +} + +func (v *BackupStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := BackupStatus(value) + for _, existing := range AllowedBackupStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Backup", value) +} + +// NewBackupStatusFromValue returns a pointer to a valid BackupStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBackupStatusFromValue(v string) (*BackupStatus, error) { + ev := BackupStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BackupStatus: valid values are %v", v, AllowedBackupStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BackupStatus) IsValid() bool { + for _, existing := range AllowedBackupStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v BackupStatus) Ptr() *BackupStatus { + return &v +} + +type NullableBackupStatus struct { + value *BackupStatus + isSet bool +} + +func (v NullableBackupStatus) Get() *BackupStatus { + return v.value +} + +func (v *NullableBackupStatus) Set(val *BackupStatus) { + v.value = val + v.isSet = true +} + +func (v NullableBackupStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupStatus(val *BackupStatus) *NullableBackupStatus { + return &NullableBackupStatus{value: val, isSet: true} +} + +func (v NullableBackupStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type BackupGetStatusAttributeType = *BackupStatus +type BackupGetStatusArgType = BackupStatus +type BackupGetStatusRetType = BackupStatus func getBackupGetStatusAttributeTypeOk(arg BackupGetStatusAttributeType) (ret BackupGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/serverbackup/model_backup_volume_backups_inner.go b/services/serverbackup/model_backup_volume_backups_inner.go index ecbf1eeea..122a5cc4e 100644 --- a/services/serverbackup/model_backup_volume_backups_inner.go +++ b/services/serverbackup/model_backup_volume_backups_inner.go @@ -12,6 +12,7 @@ package serverbackup import ( "encoding/json" + "fmt" ) // checks if the BackupVolumeBackupsInner type satisfies the MappedNullable interface at compile time @@ -104,10 +105,120 @@ func setBackupVolumeBackupsInnerGetSizeAttributeType(arg *BackupVolumeBackupsInn types and functions for status */ -// isEnumRef -type BackupVolumeBackupsInnerGetStatusAttributeType = *string -type BackupVolumeBackupsInnerGetStatusArgType = string -type BackupVolumeBackupsInnerGetStatusRetType = string +//isEnum + +// BackupVolumeBackupsInnerStatus the model 'BackupVolumeBackupsInner' +type BackupVolumeBackupsInnerStatus string + +// List of Status +const ( + BACKUPVOLUMEBACKUPSINNERSTATUS_CREATING BackupVolumeBackupsInnerStatus = "creating" + BACKUPVOLUMEBACKUPSINNERSTATUS_AVAILABLE BackupVolumeBackupsInnerStatus = "available" + BACKUPVOLUMEBACKUPSINNERSTATUS_DELETING BackupVolumeBackupsInnerStatus = "deleting" + BACKUPVOLUMEBACKUPSINNERSTATUS_ERROR BackupVolumeBackupsInnerStatus = "error" + BACKUPVOLUMEBACKUPSINNERSTATUS_RESTORING BackupVolumeBackupsInnerStatus = "restoring" + BACKUPVOLUMEBACKUPSINNERSTATUS_ERROR_DELETING BackupVolumeBackupsInnerStatus = "error_deleting" + BACKUPVOLUMEBACKUPSINNERSTATUS_ERROR_CREATING BackupVolumeBackupsInnerStatus = "error-creating" +) + +// All allowed values of BackupVolumeBackupsInner enum +var AllowedBackupVolumeBackupsInnerStatusEnumValues = []BackupVolumeBackupsInnerStatus{ + "creating", + "available", + "deleting", + "error", + "restoring", + "error_deleting", + "error-creating", +} + +func (v *BackupVolumeBackupsInnerStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := BackupVolumeBackupsInnerStatus(value) + for _, existing := range AllowedBackupVolumeBackupsInnerStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid BackupVolumeBackupsInner", value) +} + +// NewBackupVolumeBackupsInnerStatusFromValue returns a pointer to a valid BackupVolumeBackupsInnerStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBackupVolumeBackupsInnerStatusFromValue(v string) (*BackupVolumeBackupsInnerStatus, error) { + ev := BackupVolumeBackupsInnerStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BackupVolumeBackupsInnerStatus: valid values are %v", v, AllowedBackupVolumeBackupsInnerStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BackupVolumeBackupsInnerStatus) IsValid() bool { + for _, existing := range AllowedBackupVolumeBackupsInnerStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v BackupVolumeBackupsInnerStatus) Ptr() *BackupVolumeBackupsInnerStatus { + return &v +} + +type NullableBackupVolumeBackupsInnerStatus struct { + value *BackupVolumeBackupsInnerStatus + isSet bool +} + +func (v NullableBackupVolumeBackupsInnerStatus) Get() *BackupVolumeBackupsInnerStatus { + return v.value +} + +func (v *NullableBackupVolumeBackupsInnerStatus) Set(val *BackupVolumeBackupsInnerStatus) { + v.value = val + v.isSet = true +} + +func (v NullableBackupVolumeBackupsInnerStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupVolumeBackupsInnerStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupVolumeBackupsInnerStatus(val *BackupVolumeBackupsInnerStatus) *NullableBackupVolumeBackupsInnerStatus { + return &NullableBackupVolumeBackupsInnerStatus{value: val, isSet: true} +} + +func (v NullableBackupVolumeBackupsInnerStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupVolumeBackupsInnerStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type BackupVolumeBackupsInnerGetStatusAttributeType = *BackupVolumeBackupsInnerStatus +type BackupVolumeBackupsInnerGetStatusArgType = BackupVolumeBackupsInnerStatus +type BackupVolumeBackupsInnerGetStatusRetType = BackupVolumeBackupsInnerStatus func getBackupVolumeBackupsInnerGetStatusAttributeTypeOk(arg BackupVolumeBackupsInnerGetStatusAttributeType) (ret BackupVolumeBackupsInnerGetStatusRetType, ok bool) { if arg == nil { diff --git a/services/serviceaccount/CHANGELOG.md b/services/serviceaccount/CHANGELOG.md index aff10b6f6..32f580be9 100644 --- a/services/serviceaccount/CHANGELOG.md +++ b/services/serviceaccount/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.7.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.6.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/serviceaccount/model_create_service_account_key_response.go b/services/serviceaccount/model_create_service_account_key_response.go index a4e1dc400..1552a91e8 100644 --- a/services/serviceaccount/model_create_service_account_key_response.go +++ b/services/serviceaccount/model_create_service_account_key_response.go @@ -12,6 +12,7 @@ package serviceaccount import ( "encoding/json" + "fmt" "time" ) @@ -103,10 +104,108 @@ type CreateServiceAccountKeyResponseGetIdRetType = string types and functions for keyAlgorithm */ -// isEnumRef -type CreateServiceAccountKeyResponseGetKeyAlgorithmAttributeType = *string -type CreateServiceAccountKeyResponseGetKeyAlgorithmArgType = string -type CreateServiceAccountKeyResponseGetKeyAlgorithmRetType = string +//isEnum + +// CreateServiceAccountKeyResponseKeyAlgorithm the model 'CreateServiceAccountKeyResponse' +type CreateServiceAccountKeyResponseKeyAlgorithm string + +// List of KeyAlgorithm +const ( + CREATESERVICEACCOUNTKEYRESPONSEKEY_ALGORITHM_RSA_2048 CreateServiceAccountKeyResponseKeyAlgorithm = "RSA_2048" +) + +// All allowed values of CreateServiceAccountKeyResponse enum +var AllowedCreateServiceAccountKeyResponseKeyAlgorithmEnumValues = []CreateServiceAccountKeyResponseKeyAlgorithm{ + "RSA_2048", +} + +func (v *CreateServiceAccountKeyResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateServiceAccountKeyResponseKeyAlgorithm(value) + for _, existing := range AllowedCreateServiceAccountKeyResponseKeyAlgorithmEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateServiceAccountKeyResponse", value) +} + +// NewCreateServiceAccountKeyResponseKeyAlgorithmFromValue returns a pointer to a valid CreateServiceAccountKeyResponseKeyAlgorithm +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateServiceAccountKeyResponseKeyAlgorithmFromValue(v string) (*CreateServiceAccountKeyResponseKeyAlgorithm, error) { + ev := CreateServiceAccountKeyResponseKeyAlgorithm(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateServiceAccountKeyResponseKeyAlgorithm: valid values are %v", v, AllowedCreateServiceAccountKeyResponseKeyAlgorithmEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateServiceAccountKeyResponseKeyAlgorithm) IsValid() bool { + for _, existing := range AllowedCreateServiceAccountKeyResponseKeyAlgorithmEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyAlgorithmKeyAlgorithm value +func (v CreateServiceAccountKeyResponseKeyAlgorithm) Ptr() *CreateServiceAccountKeyResponseKeyAlgorithm { + return &v +} + +type NullableCreateServiceAccountKeyResponseKeyAlgorithm struct { + value *CreateServiceAccountKeyResponseKeyAlgorithm + isSet bool +} + +func (v NullableCreateServiceAccountKeyResponseKeyAlgorithm) Get() *CreateServiceAccountKeyResponseKeyAlgorithm { + return v.value +} + +func (v *NullableCreateServiceAccountKeyResponseKeyAlgorithm) Set(val *CreateServiceAccountKeyResponseKeyAlgorithm) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServiceAccountKeyResponseKeyAlgorithm) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServiceAccountKeyResponseKeyAlgorithm) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServiceAccountKeyResponseKeyAlgorithm(val *CreateServiceAccountKeyResponseKeyAlgorithm) *NullableCreateServiceAccountKeyResponseKeyAlgorithm { + return &NullableCreateServiceAccountKeyResponseKeyAlgorithm{value: val, isSet: true} +} + +func (v NullableCreateServiceAccountKeyResponseKeyAlgorithm) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServiceAccountKeyResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateServiceAccountKeyResponseGetKeyAlgorithmAttributeType = *CreateServiceAccountKeyResponseKeyAlgorithm +type CreateServiceAccountKeyResponseGetKeyAlgorithmArgType = CreateServiceAccountKeyResponseKeyAlgorithm +type CreateServiceAccountKeyResponseGetKeyAlgorithmRetType = CreateServiceAccountKeyResponseKeyAlgorithm func getCreateServiceAccountKeyResponseGetKeyAlgorithmAttributeTypeOk(arg CreateServiceAccountKeyResponseGetKeyAlgorithmAttributeType) (ret CreateServiceAccountKeyResponseGetKeyAlgorithmRetType, ok bool) { if arg == nil { @@ -123,10 +222,110 @@ func setCreateServiceAccountKeyResponseGetKeyAlgorithmAttributeType(arg *CreateS types and functions for keyOrigin */ -// isEnumRef -type CreateServiceAccountKeyResponseGetKeyOriginAttributeType = *string -type CreateServiceAccountKeyResponseGetKeyOriginArgType = string -type CreateServiceAccountKeyResponseGetKeyOriginRetType = string +//isEnum + +// CreateServiceAccountKeyResponseKeyOrigin the model 'CreateServiceAccountKeyResponse' +type CreateServiceAccountKeyResponseKeyOrigin string + +// List of KeyOrigin +const ( + CREATESERVICEACCOUNTKEYRESPONSEKEY_ORIGIN_USER_PROVIDED CreateServiceAccountKeyResponseKeyOrigin = "USER_PROVIDED" + CREATESERVICEACCOUNTKEYRESPONSEKEY_ORIGIN_GENERATED CreateServiceAccountKeyResponseKeyOrigin = "GENERATED" +) + +// All allowed values of CreateServiceAccountKeyResponse enum +var AllowedCreateServiceAccountKeyResponseKeyOriginEnumValues = []CreateServiceAccountKeyResponseKeyOrigin{ + "USER_PROVIDED", + "GENERATED", +} + +func (v *CreateServiceAccountKeyResponseKeyOrigin) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateServiceAccountKeyResponseKeyOrigin(value) + for _, existing := range AllowedCreateServiceAccountKeyResponseKeyOriginEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateServiceAccountKeyResponse", value) +} + +// NewCreateServiceAccountKeyResponseKeyOriginFromValue returns a pointer to a valid CreateServiceAccountKeyResponseKeyOrigin +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateServiceAccountKeyResponseKeyOriginFromValue(v string) (*CreateServiceAccountKeyResponseKeyOrigin, error) { + ev := CreateServiceAccountKeyResponseKeyOrigin(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateServiceAccountKeyResponseKeyOrigin: valid values are %v", v, AllowedCreateServiceAccountKeyResponseKeyOriginEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateServiceAccountKeyResponseKeyOrigin) IsValid() bool { + for _, existing := range AllowedCreateServiceAccountKeyResponseKeyOriginEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyOriginKeyOrigin value +func (v CreateServiceAccountKeyResponseKeyOrigin) Ptr() *CreateServiceAccountKeyResponseKeyOrigin { + return &v +} + +type NullableCreateServiceAccountKeyResponseKeyOrigin struct { + value *CreateServiceAccountKeyResponseKeyOrigin + isSet bool +} + +func (v NullableCreateServiceAccountKeyResponseKeyOrigin) Get() *CreateServiceAccountKeyResponseKeyOrigin { + return v.value +} + +func (v *NullableCreateServiceAccountKeyResponseKeyOrigin) Set(val *CreateServiceAccountKeyResponseKeyOrigin) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServiceAccountKeyResponseKeyOrigin) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServiceAccountKeyResponseKeyOrigin) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServiceAccountKeyResponseKeyOrigin(val *CreateServiceAccountKeyResponseKeyOrigin) *NullableCreateServiceAccountKeyResponseKeyOrigin { + return &NullableCreateServiceAccountKeyResponseKeyOrigin{value: val, isSet: true} +} + +func (v NullableCreateServiceAccountKeyResponseKeyOrigin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServiceAccountKeyResponseKeyOrigin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateServiceAccountKeyResponseGetKeyOriginAttributeType = *CreateServiceAccountKeyResponseKeyOrigin +type CreateServiceAccountKeyResponseGetKeyOriginArgType = CreateServiceAccountKeyResponseKeyOrigin +type CreateServiceAccountKeyResponseGetKeyOriginRetType = CreateServiceAccountKeyResponseKeyOrigin func getCreateServiceAccountKeyResponseGetKeyOriginAttributeTypeOk(arg CreateServiceAccountKeyResponseGetKeyOriginAttributeType) (ret CreateServiceAccountKeyResponseGetKeyOriginRetType, ok bool) { if arg == nil { @@ -143,10 +342,110 @@ func setCreateServiceAccountKeyResponseGetKeyOriginAttributeType(arg *CreateServ types and functions for keyType */ -// isEnumRef -type CreateServiceAccountKeyResponseGetKeyTypeAttributeType = *string -type CreateServiceAccountKeyResponseGetKeyTypeArgType = string -type CreateServiceAccountKeyResponseGetKeyTypeRetType = string +//isEnum + +// CreateServiceAccountKeyResponseKeyType the model 'CreateServiceAccountKeyResponse' +type CreateServiceAccountKeyResponseKeyType string + +// List of KeyType +const ( + CREATESERVICEACCOUNTKEYRESPONSEKEY_TYPE_USER_MANAGED CreateServiceAccountKeyResponseKeyType = "USER_MANAGED" + CREATESERVICEACCOUNTKEYRESPONSEKEY_TYPE_SYSTEM_MANAGED CreateServiceAccountKeyResponseKeyType = "SYSTEM_MANAGED" +) + +// All allowed values of CreateServiceAccountKeyResponse enum +var AllowedCreateServiceAccountKeyResponseKeyTypeEnumValues = []CreateServiceAccountKeyResponseKeyType{ + "USER_MANAGED", + "SYSTEM_MANAGED", +} + +func (v *CreateServiceAccountKeyResponseKeyType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateServiceAccountKeyResponseKeyType(value) + for _, existing := range AllowedCreateServiceAccountKeyResponseKeyTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateServiceAccountKeyResponse", value) +} + +// NewCreateServiceAccountKeyResponseKeyTypeFromValue returns a pointer to a valid CreateServiceAccountKeyResponseKeyType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateServiceAccountKeyResponseKeyTypeFromValue(v string) (*CreateServiceAccountKeyResponseKeyType, error) { + ev := CreateServiceAccountKeyResponseKeyType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateServiceAccountKeyResponseKeyType: valid values are %v", v, AllowedCreateServiceAccountKeyResponseKeyTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateServiceAccountKeyResponseKeyType) IsValid() bool { + for _, existing := range AllowedCreateServiceAccountKeyResponseKeyTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyTypeKeyType value +func (v CreateServiceAccountKeyResponseKeyType) Ptr() *CreateServiceAccountKeyResponseKeyType { + return &v +} + +type NullableCreateServiceAccountKeyResponseKeyType struct { + value *CreateServiceAccountKeyResponseKeyType + isSet bool +} + +func (v NullableCreateServiceAccountKeyResponseKeyType) Get() *CreateServiceAccountKeyResponseKeyType { + return v.value +} + +func (v *NullableCreateServiceAccountKeyResponseKeyType) Set(val *CreateServiceAccountKeyResponseKeyType) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServiceAccountKeyResponseKeyType) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServiceAccountKeyResponseKeyType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServiceAccountKeyResponseKeyType(val *CreateServiceAccountKeyResponseKeyType) *NullableCreateServiceAccountKeyResponseKeyType { + return &NullableCreateServiceAccountKeyResponseKeyType{value: val, isSet: true} +} + +func (v NullableCreateServiceAccountKeyResponseKeyType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServiceAccountKeyResponseKeyType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateServiceAccountKeyResponseGetKeyTypeAttributeType = *CreateServiceAccountKeyResponseKeyType +type CreateServiceAccountKeyResponseGetKeyTypeArgType = CreateServiceAccountKeyResponseKeyType +type CreateServiceAccountKeyResponseGetKeyTypeRetType = CreateServiceAccountKeyResponseKeyType func getCreateServiceAccountKeyResponseGetKeyTypeAttributeTypeOk(arg CreateServiceAccountKeyResponseGetKeyTypeAttributeType) (ret CreateServiceAccountKeyResponseGetKeyTypeRetType, ok bool) { if arg == nil { diff --git a/services/serviceaccount/model_create_short_lived_access_token_response.go b/services/serviceaccount/model_create_short_lived_access_token_response.go index f1b7df46a..4f29e1322 100644 --- a/services/serviceaccount/model_create_short_lived_access_token_response.go +++ b/services/serviceaccount/model_create_short_lived_access_token_response.go @@ -12,6 +12,7 @@ package serviceaccount import ( "encoding/json" + "fmt" ) // checks if the CreateShortLivedAccessTokenResponse type satisfies the MappedNullable interface at compile time @@ -104,10 +105,108 @@ type CreateShortLivedAccessTokenResponseGetScopeRetType = string types and functions for token_type */ -// isEnumRef -type CreateShortLivedAccessTokenResponseGetTokenTypeAttributeType = *string -type CreateShortLivedAccessTokenResponseGetTokenTypeArgType = string -type CreateShortLivedAccessTokenResponseGetTokenTypeRetType = string +//isEnum + +// CreateShortLivedAccessTokenResponseTokenType the model 'CreateShortLivedAccessTokenResponse' +type CreateShortLivedAccessTokenResponseTokenType string + +// List of TokenType +const ( + CREATESHORTLIVEDACCESSTOKENRESPONSETOKEN_TYPE_BEARER CreateShortLivedAccessTokenResponseTokenType = "Bearer" +) + +// All allowed values of CreateShortLivedAccessTokenResponse enum +var AllowedCreateShortLivedAccessTokenResponseTokenTypeEnumValues = []CreateShortLivedAccessTokenResponseTokenType{ + "Bearer", +} + +func (v *CreateShortLivedAccessTokenResponseTokenType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CreateShortLivedAccessTokenResponseTokenType(value) + for _, existing := range AllowedCreateShortLivedAccessTokenResponseTokenTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateShortLivedAccessTokenResponse", value) +} + +// NewCreateShortLivedAccessTokenResponseTokenTypeFromValue returns a pointer to a valid CreateShortLivedAccessTokenResponseTokenType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateShortLivedAccessTokenResponseTokenTypeFromValue(v string) (*CreateShortLivedAccessTokenResponseTokenType, error) { + ev := CreateShortLivedAccessTokenResponseTokenType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateShortLivedAccessTokenResponseTokenType: valid values are %v", v, AllowedCreateShortLivedAccessTokenResponseTokenTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateShortLivedAccessTokenResponseTokenType) IsValid() bool { + for _, existing := range AllowedCreateShortLivedAccessTokenResponseTokenTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TokenTypeTokenType value +func (v CreateShortLivedAccessTokenResponseTokenType) Ptr() *CreateShortLivedAccessTokenResponseTokenType { + return &v +} + +type NullableCreateShortLivedAccessTokenResponseTokenType struct { + value *CreateShortLivedAccessTokenResponseTokenType + isSet bool +} + +func (v NullableCreateShortLivedAccessTokenResponseTokenType) Get() *CreateShortLivedAccessTokenResponseTokenType { + return v.value +} + +func (v *NullableCreateShortLivedAccessTokenResponseTokenType) Set(val *CreateShortLivedAccessTokenResponseTokenType) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShortLivedAccessTokenResponseTokenType) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShortLivedAccessTokenResponseTokenType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShortLivedAccessTokenResponseTokenType(val *CreateShortLivedAccessTokenResponseTokenType) *NullableCreateShortLivedAccessTokenResponseTokenType { + return &NullableCreateShortLivedAccessTokenResponseTokenType{value: val, isSet: true} +} + +func (v NullableCreateShortLivedAccessTokenResponseTokenType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShortLivedAccessTokenResponseTokenType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateShortLivedAccessTokenResponseGetTokenTypeAttributeType = *CreateShortLivedAccessTokenResponseTokenType +type CreateShortLivedAccessTokenResponseGetTokenTypeArgType = CreateShortLivedAccessTokenResponseTokenType +type CreateShortLivedAccessTokenResponseGetTokenTypeRetType = CreateShortLivedAccessTokenResponseTokenType func getCreateShortLivedAccessTokenResponseGetTokenTypeAttributeTypeOk(arg CreateShortLivedAccessTokenResponseGetTokenTypeAttributeType) (ret CreateShortLivedAccessTokenResponseGetTokenTypeRetType, ok bool) { if arg == nil { diff --git a/services/serviceaccount/model_get_service_account_key_response.go b/services/serviceaccount/model_get_service_account_key_response.go index e61a8509e..435055e99 100644 --- a/services/serviceaccount/model_get_service_account_key_response.go +++ b/services/serviceaccount/model_get_service_account_key_response.go @@ -12,6 +12,7 @@ package serviceaccount import ( "encoding/json" + "fmt" "time" ) @@ -103,10 +104,108 @@ type GetServiceAccountKeyResponseGetIdRetType = string types and functions for keyAlgorithm */ -// isEnumRef -type GetServiceAccountKeyResponseGetKeyAlgorithmAttributeType = *string -type GetServiceAccountKeyResponseGetKeyAlgorithmArgType = string -type GetServiceAccountKeyResponseGetKeyAlgorithmRetType = string +//isEnum + +// GetServiceAccountKeyResponseKeyAlgorithm the model 'GetServiceAccountKeyResponse' +type GetServiceAccountKeyResponseKeyAlgorithm string + +// List of KeyAlgorithm +const ( + GETSERVICEACCOUNTKEYRESPONSEKEY_ALGORITHM_RSA_2048 GetServiceAccountKeyResponseKeyAlgorithm = "RSA_2048" +) + +// All allowed values of GetServiceAccountKeyResponse enum +var AllowedGetServiceAccountKeyResponseKeyAlgorithmEnumValues = []GetServiceAccountKeyResponseKeyAlgorithm{ + "RSA_2048", +} + +func (v *GetServiceAccountKeyResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetServiceAccountKeyResponseKeyAlgorithm(value) + for _, existing := range AllowedGetServiceAccountKeyResponseKeyAlgorithmEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetServiceAccountKeyResponse", value) +} + +// NewGetServiceAccountKeyResponseKeyAlgorithmFromValue returns a pointer to a valid GetServiceAccountKeyResponseKeyAlgorithm +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetServiceAccountKeyResponseKeyAlgorithmFromValue(v string) (*GetServiceAccountKeyResponseKeyAlgorithm, error) { + ev := GetServiceAccountKeyResponseKeyAlgorithm(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetServiceAccountKeyResponseKeyAlgorithm: valid values are %v", v, AllowedGetServiceAccountKeyResponseKeyAlgorithmEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetServiceAccountKeyResponseKeyAlgorithm) IsValid() bool { + for _, existing := range AllowedGetServiceAccountKeyResponseKeyAlgorithmEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyAlgorithmKeyAlgorithm value +func (v GetServiceAccountKeyResponseKeyAlgorithm) Ptr() *GetServiceAccountKeyResponseKeyAlgorithm { + return &v +} + +type NullableGetServiceAccountKeyResponseKeyAlgorithm struct { + value *GetServiceAccountKeyResponseKeyAlgorithm + isSet bool +} + +func (v NullableGetServiceAccountKeyResponseKeyAlgorithm) Get() *GetServiceAccountKeyResponseKeyAlgorithm { + return v.value +} + +func (v *NullableGetServiceAccountKeyResponseKeyAlgorithm) Set(val *GetServiceAccountKeyResponseKeyAlgorithm) { + v.value = val + v.isSet = true +} + +func (v NullableGetServiceAccountKeyResponseKeyAlgorithm) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServiceAccountKeyResponseKeyAlgorithm) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServiceAccountKeyResponseKeyAlgorithm(val *GetServiceAccountKeyResponseKeyAlgorithm) *NullableGetServiceAccountKeyResponseKeyAlgorithm { + return &NullableGetServiceAccountKeyResponseKeyAlgorithm{value: val, isSet: true} +} + +func (v NullableGetServiceAccountKeyResponseKeyAlgorithm) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServiceAccountKeyResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetServiceAccountKeyResponseGetKeyAlgorithmAttributeType = *GetServiceAccountKeyResponseKeyAlgorithm +type GetServiceAccountKeyResponseGetKeyAlgorithmArgType = GetServiceAccountKeyResponseKeyAlgorithm +type GetServiceAccountKeyResponseGetKeyAlgorithmRetType = GetServiceAccountKeyResponseKeyAlgorithm func getGetServiceAccountKeyResponseGetKeyAlgorithmAttributeTypeOk(arg GetServiceAccountKeyResponseGetKeyAlgorithmAttributeType) (ret GetServiceAccountKeyResponseGetKeyAlgorithmRetType, ok bool) { if arg == nil { @@ -123,10 +222,110 @@ func setGetServiceAccountKeyResponseGetKeyAlgorithmAttributeType(arg *GetService types and functions for keyOrigin */ -// isEnumRef -type GetServiceAccountKeyResponseGetKeyOriginAttributeType = *string -type GetServiceAccountKeyResponseGetKeyOriginArgType = string -type GetServiceAccountKeyResponseGetKeyOriginRetType = string +//isEnum + +// GetServiceAccountKeyResponseKeyOrigin the model 'GetServiceAccountKeyResponse' +type GetServiceAccountKeyResponseKeyOrigin string + +// List of KeyOrigin +const ( + GETSERVICEACCOUNTKEYRESPONSEKEY_ORIGIN_USER_PROVIDED GetServiceAccountKeyResponseKeyOrigin = "USER_PROVIDED" + GETSERVICEACCOUNTKEYRESPONSEKEY_ORIGIN_GENERATED GetServiceAccountKeyResponseKeyOrigin = "GENERATED" +) + +// All allowed values of GetServiceAccountKeyResponse enum +var AllowedGetServiceAccountKeyResponseKeyOriginEnumValues = []GetServiceAccountKeyResponseKeyOrigin{ + "USER_PROVIDED", + "GENERATED", +} + +func (v *GetServiceAccountKeyResponseKeyOrigin) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetServiceAccountKeyResponseKeyOrigin(value) + for _, existing := range AllowedGetServiceAccountKeyResponseKeyOriginEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetServiceAccountKeyResponse", value) +} + +// NewGetServiceAccountKeyResponseKeyOriginFromValue returns a pointer to a valid GetServiceAccountKeyResponseKeyOrigin +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetServiceAccountKeyResponseKeyOriginFromValue(v string) (*GetServiceAccountKeyResponseKeyOrigin, error) { + ev := GetServiceAccountKeyResponseKeyOrigin(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetServiceAccountKeyResponseKeyOrigin: valid values are %v", v, AllowedGetServiceAccountKeyResponseKeyOriginEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetServiceAccountKeyResponseKeyOrigin) IsValid() bool { + for _, existing := range AllowedGetServiceAccountKeyResponseKeyOriginEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyOriginKeyOrigin value +func (v GetServiceAccountKeyResponseKeyOrigin) Ptr() *GetServiceAccountKeyResponseKeyOrigin { + return &v +} + +type NullableGetServiceAccountKeyResponseKeyOrigin struct { + value *GetServiceAccountKeyResponseKeyOrigin + isSet bool +} + +func (v NullableGetServiceAccountKeyResponseKeyOrigin) Get() *GetServiceAccountKeyResponseKeyOrigin { + return v.value +} + +func (v *NullableGetServiceAccountKeyResponseKeyOrigin) Set(val *GetServiceAccountKeyResponseKeyOrigin) { + v.value = val + v.isSet = true +} + +func (v NullableGetServiceAccountKeyResponseKeyOrigin) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServiceAccountKeyResponseKeyOrigin) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServiceAccountKeyResponseKeyOrigin(val *GetServiceAccountKeyResponseKeyOrigin) *NullableGetServiceAccountKeyResponseKeyOrigin { + return &NullableGetServiceAccountKeyResponseKeyOrigin{value: val, isSet: true} +} + +func (v NullableGetServiceAccountKeyResponseKeyOrigin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServiceAccountKeyResponseKeyOrigin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetServiceAccountKeyResponseGetKeyOriginAttributeType = *GetServiceAccountKeyResponseKeyOrigin +type GetServiceAccountKeyResponseGetKeyOriginArgType = GetServiceAccountKeyResponseKeyOrigin +type GetServiceAccountKeyResponseGetKeyOriginRetType = GetServiceAccountKeyResponseKeyOrigin func getGetServiceAccountKeyResponseGetKeyOriginAttributeTypeOk(arg GetServiceAccountKeyResponseGetKeyOriginAttributeType) (ret GetServiceAccountKeyResponseGetKeyOriginRetType, ok bool) { if arg == nil { @@ -143,10 +342,110 @@ func setGetServiceAccountKeyResponseGetKeyOriginAttributeType(arg *GetServiceAcc types and functions for keyType */ -// isEnumRef -type GetServiceAccountKeyResponseGetKeyTypeAttributeType = *string -type GetServiceAccountKeyResponseGetKeyTypeArgType = string -type GetServiceAccountKeyResponseGetKeyTypeRetType = string +//isEnum + +// GetServiceAccountKeyResponseKeyType the model 'GetServiceAccountKeyResponse' +type GetServiceAccountKeyResponseKeyType string + +// List of KeyType +const ( + GETSERVICEACCOUNTKEYRESPONSEKEY_TYPE_USER_MANAGED GetServiceAccountKeyResponseKeyType = "USER_MANAGED" + GETSERVICEACCOUNTKEYRESPONSEKEY_TYPE_SYSTEM_MANAGED GetServiceAccountKeyResponseKeyType = "SYSTEM_MANAGED" +) + +// All allowed values of GetServiceAccountKeyResponse enum +var AllowedGetServiceAccountKeyResponseKeyTypeEnumValues = []GetServiceAccountKeyResponseKeyType{ + "USER_MANAGED", + "SYSTEM_MANAGED", +} + +func (v *GetServiceAccountKeyResponseKeyType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetServiceAccountKeyResponseKeyType(value) + for _, existing := range AllowedGetServiceAccountKeyResponseKeyTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetServiceAccountKeyResponse", value) +} + +// NewGetServiceAccountKeyResponseKeyTypeFromValue returns a pointer to a valid GetServiceAccountKeyResponseKeyType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetServiceAccountKeyResponseKeyTypeFromValue(v string) (*GetServiceAccountKeyResponseKeyType, error) { + ev := GetServiceAccountKeyResponseKeyType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetServiceAccountKeyResponseKeyType: valid values are %v", v, AllowedGetServiceAccountKeyResponseKeyTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetServiceAccountKeyResponseKeyType) IsValid() bool { + for _, existing := range AllowedGetServiceAccountKeyResponseKeyTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyTypeKeyType value +func (v GetServiceAccountKeyResponseKeyType) Ptr() *GetServiceAccountKeyResponseKeyType { + return &v +} + +type NullableGetServiceAccountKeyResponseKeyType struct { + value *GetServiceAccountKeyResponseKeyType + isSet bool +} + +func (v NullableGetServiceAccountKeyResponseKeyType) Get() *GetServiceAccountKeyResponseKeyType { + return v.value +} + +func (v *NullableGetServiceAccountKeyResponseKeyType) Set(val *GetServiceAccountKeyResponseKeyType) { + v.value = val + v.isSet = true +} + +func (v NullableGetServiceAccountKeyResponseKeyType) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServiceAccountKeyResponseKeyType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServiceAccountKeyResponseKeyType(val *GetServiceAccountKeyResponseKeyType) *NullableGetServiceAccountKeyResponseKeyType { + return &NullableGetServiceAccountKeyResponseKeyType{value: val, isSet: true} +} + +func (v NullableGetServiceAccountKeyResponseKeyType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServiceAccountKeyResponseKeyType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetServiceAccountKeyResponseGetKeyTypeAttributeType = *GetServiceAccountKeyResponseKeyType +type GetServiceAccountKeyResponseGetKeyTypeArgType = GetServiceAccountKeyResponseKeyType +type GetServiceAccountKeyResponseGetKeyTypeRetType = GetServiceAccountKeyResponseKeyType func getGetServiceAccountKeyResponseGetKeyTypeAttributeTypeOk(arg GetServiceAccountKeyResponseGetKeyTypeAttributeType) (ret GetServiceAccountKeyResponseGetKeyTypeRetType, ok bool) { if arg == nil { diff --git a/services/serviceaccount/model_partial_update_service_account_key_response.go b/services/serviceaccount/model_partial_update_service_account_key_response.go index f44d39f8c..096c85bbb 100644 --- a/services/serviceaccount/model_partial_update_service_account_key_response.go +++ b/services/serviceaccount/model_partial_update_service_account_key_response.go @@ -12,6 +12,7 @@ package serviceaccount import ( "encoding/json" + "fmt" "time" ) @@ -83,10 +84,108 @@ type PartialUpdateServiceAccountKeyResponseGetIdRetType = string types and functions for keyAlgorithm */ -// isEnumRef -type PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmAttributeType = *string -type PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmArgType = string -type PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmRetType = string +//isEnum + +// PartialUpdateServiceAccountKeyResponseKeyAlgorithm the model 'PartialUpdateServiceAccountKeyResponse' +type PartialUpdateServiceAccountKeyResponseKeyAlgorithm string + +// List of KeyAlgorithm +const ( + PARTIALUPDATESERVICEACCOUNTKEYRESPONSEKEY_ALGORITHM_RSA_2048 PartialUpdateServiceAccountKeyResponseKeyAlgorithm = "RSA_2048" +) + +// All allowed values of PartialUpdateServiceAccountKeyResponse enum +var AllowedPartialUpdateServiceAccountKeyResponseKeyAlgorithmEnumValues = []PartialUpdateServiceAccountKeyResponseKeyAlgorithm{ + "RSA_2048", +} + +func (v *PartialUpdateServiceAccountKeyResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := PartialUpdateServiceAccountKeyResponseKeyAlgorithm(value) + for _, existing := range AllowedPartialUpdateServiceAccountKeyResponseKeyAlgorithmEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PartialUpdateServiceAccountKeyResponse", value) +} + +// NewPartialUpdateServiceAccountKeyResponseKeyAlgorithmFromValue returns a pointer to a valid PartialUpdateServiceAccountKeyResponseKeyAlgorithm +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPartialUpdateServiceAccountKeyResponseKeyAlgorithmFromValue(v string) (*PartialUpdateServiceAccountKeyResponseKeyAlgorithm, error) { + ev := PartialUpdateServiceAccountKeyResponseKeyAlgorithm(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PartialUpdateServiceAccountKeyResponseKeyAlgorithm: valid values are %v", v, AllowedPartialUpdateServiceAccountKeyResponseKeyAlgorithmEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PartialUpdateServiceAccountKeyResponseKeyAlgorithm) IsValid() bool { + for _, existing := range AllowedPartialUpdateServiceAccountKeyResponseKeyAlgorithmEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyAlgorithmKeyAlgorithm value +func (v PartialUpdateServiceAccountKeyResponseKeyAlgorithm) Ptr() *PartialUpdateServiceAccountKeyResponseKeyAlgorithm { + return &v +} + +type NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm struct { + value *PartialUpdateServiceAccountKeyResponseKeyAlgorithm + isSet bool +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm) Get() *PartialUpdateServiceAccountKeyResponseKeyAlgorithm { + return v.value +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm) Set(val *PartialUpdateServiceAccountKeyResponseKeyAlgorithm) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm(val *PartialUpdateServiceAccountKeyResponseKeyAlgorithm) *NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm { + return &NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm{value: val, isSet: true} +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmAttributeType = *PartialUpdateServiceAccountKeyResponseKeyAlgorithm +type PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmArgType = PartialUpdateServiceAccountKeyResponseKeyAlgorithm +type PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmRetType = PartialUpdateServiceAccountKeyResponseKeyAlgorithm func getPartialUpdateServiceAccountKeyResponseGetKeyAlgorithmAttributeTypeOk(arg PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmAttributeType) (ret PartialUpdateServiceAccountKeyResponseGetKeyAlgorithmRetType, ok bool) { if arg == nil { @@ -103,10 +202,110 @@ func setPartialUpdateServiceAccountKeyResponseGetKeyAlgorithmAttributeType(arg * types and functions for keyOrigin */ -// isEnumRef -type PartialUpdateServiceAccountKeyResponseGetKeyOriginAttributeType = *string -type PartialUpdateServiceAccountKeyResponseGetKeyOriginArgType = string -type PartialUpdateServiceAccountKeyResponseGetKeyOriginRetType = string +//isEnum + +// PartialUpdateServiceAccountKeyResponseKeyOrigin the model 'PartialUpdateServiceAccountKeyResponse' +type PartialUpdateServiceAccountKeyResponseKeyOrigin string + +// List of KeyOrigin +const ( + PARTIALUPDATESERVICEACCOUNTKEYRESPONSEKEY_ORIGIN_USER_PROVIDED PartialUpdateServiceAccountKeyResponseKeyOrigin = "USER_PROVIDED" + PARTIALUPDATESERVICEACCOUNTKEYRESPONSEKEY_ORIGIN_GENERATED PartialUpdateServiceAccountKeyResponseKeyOrigin = "GENERATED" +) + +// All allowed values of PartialUpdateServiceAccountKeyResponse enum +var AllowedPartialUpdateServiceAccountKeyResponseKeyOriginEnumValues = []PartialUpdateServiceAccountKeyResponseKeyOrigin{ + "USER_PROVIDED", + "GENERATED", +} + +func (v *PartialUpdateServiceAccountKeyResponseKeyOrigin) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := PartialUpdateServiceAccountKeyResponseKeyOrigin(value) + for _, existing := range AllowedPartialUpdateServiceAccountKeyResponseKeyOriginEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PartialUpdateServiceAccountKeyResponse", value) +} + +// NewPartialUpdateServiceAccountKeyResponseKeyOriginFromValue returns a pointer to a valid PartialUpdateServiceAccountKeyResponseKeyOrigin +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPartialUpdateServiceAccountKeyResponseKeyOriginFromValue(v string) (*PartialUpdateServiceAccountKeyResponseKeyOrigin, error) { + ev := PartialUpdateServiceAccountKeyResponseKeyOrigin(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PartialUpdateServiceAccountKeyResponseKeyOrigin: valid values are %v", v, AllowedPartialUpdateServiceAccountKeyResponseKeyOriginEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PartialUpdateServiceAccountKeyResponseKeyOrigin) IsValid() bool { + for _, existing := range AllowedPartialUpdateServiceAccountKeyResponseKeyOriginEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyOriginKeyOrigin value +func (v PartialUpdateServiceAccountKeyResponseKeyOrigin) Ptr() *PartialUpdateServiceAccountKeyResponseKeyOrigin { + return &v +} + +type NullablePartialUpdateServiceAccountKeyResponseKeyOrigin struct { + value *PartialUpdateServiceAccountKeyResponseKeyOrigin + isSet bool +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyOrigin) Get() *PartialUpdateServiceAccountKeyResponseKeyOrigin { + return v.value +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyOrigin) Set(val *PartialUpdateServiceAccountKeyResponseKeyOrigin) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyOrigin) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyOrigin) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateServiceAccountKeyResponseKeyOrigin(val *PartialUpdateServiceAccountKeyResponseKeyOrigin) *NullablePartialUpdateServiceAccountKeyResponseKeyOrigin { + return &NullablePartialUpdateServiceAccountKeyResponseKeyOrigin{value: val, isSet: true} +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyOrigin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyOrigin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type PartialUpdateServiceAccountKeyResponseGetKeyOriginAttributeType = *PartialUpdateServiceAccountKeyResponseKeyOrigin +type PartialUpdateServiceAccountKeyResponseGetKeyOriginArgType = PartialUpdateServiceAccountKeyResponseKeyOrigin +type PartialUpdateServiceAccountKeyResponseGetKeyOriginRetType = PartialUpdateServiceAccountKeyResponseKeyOrigin func getPartialUpdateServiceAccountKeyResponseGetKeyOriginAttributeTypeOk(arg PartialUpdateServiceAccountKeyResponseGetKeyOriginAttributeType) (ret PartialUpdateServiceAccountKeyResponseGetKeyOriginRetType, ok bool) { if arg == nil { @@ -123,10 +322,110 @@ func setPartialUpdateServiceAccountKeyResponseGetKeyOriginAttributeType(arg *Par types and functions for keyType */ -// isEnumRef -type PartialUpdateServiceAccountKeyResponseGetKeyTypeAttributeType = *string -type PartialUpdateServiceAccountKeyResponseGetKeyTypeArgType = string -type PartialUpdateServiceAccountKeyResponseGetKeyTypeRetType = string +//isEnum + +// PartialUpdateServiceAccountKeyResponseKeyType the model 'PartialUpdateServiceAccountKeyResponse' +type PartialUpdateServiceAccountKeyResponseKeyType string + +// List of KeyType +const ( + PARTIALUPDATESERVICEACCOUNTKEYRESPONSEKEY_TYPE_USER_MANAGED PartialUpdateServiceAccountKeyResponseKeyType = "USER_MANAGED" + PARTIALUPDATESERVICEACCOUNTKEYRESPONSEKEY_TYPE_SYSTEM_MANAGED PartialUpdateServiceAccountKeyResponseKeyType = "SYSTEM_MANAGED" +) + +// All allowed values of PartialUpdateServiceAccountKeyResponse enum +var AllowedPartialUpdateServiceAccountKeyResponseKeyTypeEnumValues = []PartialUpdateServiceAccountKeyResponseKeyType{ + "USER_MANAGED", + "SYSTEM_MANAGED", +} + +func (v *PartialUpdateServiceAccountKeyResponseKeyType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := PartialUpdateServiceAccountKeyResponseKeyType(value) + for _, existing := range AllowedPartialUpdateServiceAccountKeyResponseKeyTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PartialUpdateServiceAccountKeyResponse", value) +} + +// NewPartialUpdateServiceAccountKeyResponseKeyTypeFromValue returns a pointer to a valid PartialUpdateServiceAccountKeyResponseKeyType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPartialUpdateServiceAccountKeyResponseKeyTypeFromValue(v string) (*PartialUpdateServiceAccountKeyResponseKeyType, error) { + ev := PartialUpdateServiceAccountKeyResponseKeyType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PartialUpdateServiceAccountKeyResponseKeyType: valid values are %v", v, AllowedPartialUpdateServiceAccountKeyResponseKeyTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PartialUpdateServiceAccountKeyResponseKeyType) IsValid() bool { + for _, existing := range AllowedPartialUpdateServiceAccountKeyResponseKeyTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyTypeKeyType value +func (v PartialUpdateServiceAccountKeyResponseKeyType) Ptr() *PartialUpdateServiceAccountKeyResponseKeyType { + return &v +} + +type NullablePartialUpdateServiceAccountKeyResponseKeyType struct { + value *PartialUpdateServiceAccountKeyResponseKeyType + isSet bool +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyType) Get() *PartialUpdateServiceAccountKeyResponseKeyType { + return v.value +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyType) Set(val *PartialUpdateServiceAccountKeyResponseKeyType) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyType) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateServiceAccountKeyResponseKeyType(val *PartialUpdateServiceAccountKeyResponseKeyType) *NullablePartialUpdateServiceAccountKeyResponseKeyType { + return &NullablePartialUpdateServiceAccountKeyResponseKeyType{value: val, isSet: true} +} + +func (v NullablePartialUpdateServiceAccountKeyResponseKeyType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateServiceAccountKeyResponseKeyType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type PartialUpdateServiceAccountKeyResponseGetKeyTypeAttributeType = *PartialUpdateServiceAccountKeyResponseKeyType +type PartialUpdateServiceAccountKeyResponseGetKeyTypeArgType = PartialUpdateServiceAccountKeyResponseKeyType +type PartialUpdateServiceAccountKeyResponseGetKeyTypeRetType = PartialUpdateServiceAccountKeyResponseKeyType func getPartialUpdateServiceAccountKeyResponseGetKeyTypeAttributeTypeOk(arg PartialUpdateServiceAccountKeyResponseGetKeyTypeAttributeType) (ret PartialUpdateServiceAccountKeyResponseGetKeyTypeRetType, ok bool) { if arg == nil { diff --git a/services/serviceaccount/model_service_account_key_list_response.go b/services/serviceaccount/model_service_account_key_list_response.go index 32711bd51..a3613f550 100644 --- a/services/serviceaccount/model_service_account_key_list_response.go +++ b/services/serviceaccount/model_service_account_key_list_response.go @@ -12,6 +12,7 @@ package serviceaccount import ( "encoding/json" + "fmt" "time" ) @@ -83,10 +84,108 @@ type ServiceAccountKeyListResponseGetIdRetType = string types and functions for keyAlgorithm */ -// isEnumRef -type ServiceAccountKeyListResponseGetKeyAlgorithmAttributeType = *string -type ServiceAccountKeyListResponseGetKeyAlgorithmArgType = string -type ServiceAccountKeyListResponseGetKeyAlgorithmRetType = string +//isEnum + +// ServiceAccountKeyListResponseKeyAlgorithm the model 'ServiceAccountKeyListResponse' +type ServiceAccountKeyListResponseKeyAlgorithm string + +// List of KeyAlgorithm +const ( + SERVICEACCOUNTKEYLISTRESPONSEKEY_ALGORITHM_RSA_2048 ServiceAccountKeyListResponseKeyAlgorithm = "RSA_2048" +) + +// All allowed values of ServiceAccountKeyListResponse enum +var AllowedServiceAccountKeyListResponseKeyAlgorithmEnumValues = []ServiceAccountKeyListResponseKeyAlgorithm{ + "RSA_2048", +} + +func (v *ServiceAccountKeyListResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceAccountKeyListResponseKeyAlgorithm(value) + for _, existing := range AllowedServiceAccountKeyListResponseKeyAlgorithmEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceAccountKeyListResponse", value) +} + +// NewServiceAccountKeyListResponseKeyAlgorithmFromValue returns a pointer to a valid ServiceAccountKeyListResponseKeyAlgorithm +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceAccountKeyListResponseKeyAlgorithmFromValue(v string) (*ServiceAccountKeyListResponseKeyAlgorithm, error) { + ev := ServiceAccountKeyListResponseKeyAlgorithm(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceAccountKeyListResponseKeyAlgorithm: valid values are %v", v, AllowedServiceAccountKeyListResponseKeyAlgorithmEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceAccountKeyListResponseKeyAlgorithm) IsValid() bool { + for _, existing := range AllowedServiceAccountKeyListResponseKeyAlgorithmEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyAlgorithmKeyAlgorithm value +func (v ServiceAccountKeyListResponseKeyAlgorithm) Ptr() *ServiceAccountKeyListResponseKeyAlgorithm { + return &v +} + +type NullableServiceAccountKeyListResponseKeyAlgorithm struct { + value *ServiceAccountKeyListResponseKeyAlgorithm + isSet bool +} + +func (v NullableServiceAccountKeyListResponseKeyAlgorithm) Get() *ServiceAccountKeyListResponseKeyAlgorithm { + return v.value +} + +func (v *NullableServiceAccountKeyListResponseKeyAlgorithm) Set(val *ServiceAccountKeyListResponseKeyAlgorithm) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountKeyListResponseKeyAlgorithm) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountKeyListResponseKeyAlgorithm) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountKeyListResponseKeyAlgorithm(val *ServiceAccountKeyListResponseKeyAlgorithm) *NullableServiceAccountKeyListResponseKeyAlgorithm { + return &NullableServiceAccountKeyListResponseKeyAlgorithm{value: val, isSet: true} +} + +func (v NullableServiceAccountKeyListResponseKeyAlgorithm) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountKeyListResponseKeyAlgorithm) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceAccountKeyListResponseGetKeyAlgorithmAttributeType = *ServiceAccountKeyListResponseKeyAlgorithm +type ServiceAccountKeyListResponseGetKeyAlgorithmArgType = ServiceAccountKeyListResponseKeyAlgorithm +type ServiceAccountKeyListResponseGetKeyAlgorithmRetType = ServiceAccountKeyListResponseKeyAlgorithm func getServiceAccountKeyListResponseGetKeyAlgorithmAttributeTypeOk(arg ServiceAccountKeyListResponseGetKeyAlgorithmAttributeType) (ret ServiceAccountKeyListResponseGetKeyAlgorithmRetType, ok bool) { if arg == nil { @@ -103,10 +202,110 @@ func setServiceAccountKeyListResponseGetKeyAlgorithmAttributeType(arg *ServiceAc types and functions for keyOrigin */ -// isEnumRef -type ServiceAccountKeyListResponseGetKeyOriginAttributeType = *string -type ServiceAccountKeyListResponseGetKeyOriginArgType = string -type ServiceAccountKeyListResponseGetKeyOriginRetType = string +//isEnum + +// ServiceAccountKeyListResponseKeyOrigin the model 'ServiceAccountKeyListResponse' +type ServiceAccountKeyListResponseKeyOrigin string + +// List of KeyOrigin +const ( + SERVICEACCOUNTKEYLISTRESPONSEKEY_ORIGIN_USER_PROVIDED ServiceAccountKeyListResponseKeyOrigin = "USER_PROVIDED" + SERVICEACCOUNTKEYLISTRESPONSEKEY_ORIGIN_GENERATED ServiceAccountKeyListResponseKeyOrigin = "GENERATED" +) + +// All allowed values of ServiceAccountKeyListResponse enum +var AllowedServiceAccountKeyListResponseKeyOriginEnumValues = []ServiceAccountKeyListResponseKeyOrigin{ + "USER_PROVIDED", + "GENERATED", +} + +func (v *ServiceAccountKeyListResponseKeyOrigin) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceAccountKeyListResponseKeyOrigin(value) + for _, existing := range AllowedServiceAccountKeyListResponseKeyOriginEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceAccountKeyListResponse", value) +} + +// NewServiceAccountKeyListResponseKeyOriginFromValue returns a pointer to a valid ServiceAccountKeyListResponseKeyOrigin +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceAccountKeyListResponseKeyOriginFromValue(v string) (*ServiceAccountKeyListResponseKeyOrigin, error) { + ev := ServiceAccountKeyListResponseKeyOrigin(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceAccountKeyListResponseKeyOrigin: valid values are %v", v, AllowedServiceAccountKeyListResponseKeyOriginEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceAccountKeyListResponseKeyOrigin) IsValid() bool { + for _, existing := range AllowedServiceAccountKeyListResponseKeyOriginEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyOriginKeyOrigin value +func (v ServiceAccountKeyListResponseKeyOrigin) Ptr() *ServiceAccountKeyListResponseKeyOrigin { + return &v +} + +type NullableServiceAccountKeyListResponseKeyOrigin struct { + value *ServiceAccountKeyListResponseKeyOrigin + isSet bool +} + +func (v NullableServiceAccountKeyListResponseKeyOrigin) Get() *ServiceAccountKeyListResponseKeyOrigin { + return v.value +} + +func (v *NullableServiceAccountKeyListResponseKeyOrigin) Set(val *ServiceAccountKeyListResponseKeyOrigin) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountKeyListResponseKeyOrigin) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountKeyListResponseKeyOrigin) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountKeyListResponseKeyOrigin(val *ServiceAccountKeyListResponseKeyOrigin) *NullableServiceAccountKeyListResponseKeyOrigin { + return &NullableServiceAccountKeyListResponseKeyOrigin{value: val, isSet: true} +} + +func (v NullableServiceAccountKeyListResponseKeyOrigin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountKeyListResponseKeyOrigin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceAccountKeyListResponseGetKeyOriginAttributeType = *ServiceAccountKeyListResponseKeyOrigin +type ServiceAccountKeyListResponseGetKeyOriginArgType = ServiceAccountKeyListResponseKeyOrigin +type ServiceAccountKeyListResponseGetKeyOriginRetType = ServiceAccountKeyListResponseKeyOrigin func getServiceAccountKeyListResponseGetKeyOriginAttributeTypeOk(arg ServiceAccountKeyListResponseGetKeyOriginAttributeType) (ret ServiceAccountKeyListResponseGetKeyOriginRetType, ok bool) { if arg == nil { @@ -123,10 +322,110 @@ func setServiceAccountKeyListResponseGetKeyOriginAttributeType(arg *ServiceAccou types and functions for keyType */ -// isEnumRef -type ServiceAccountKeyListResponseGetKeyTypeAttributeType = *string -type ServiceAccountKeyListResponseGetKeyTypeArgType = string -type ServiceAccountKeyListResponseGetKeyTypeRetType = string +//isEnum + +// ServiceAccountKeyListResponseKeyType the model 'ServiceAccountKeyListResponse' +type ServiceAccountKeyListResponseKeyType string + +// List of KeyType +const ( + SERVICEACCOUNTKEYLISTRESPONSEKEY_TYPE_USER_MANAGED ServiceAccountKeyListResponseKeyType = "USER_MANAGED" + SERVICEACCOUNTKEYLISTRESPONSEKEY_TYPE_SYSTEM_MANAGED ServiceAccountKeyListResponseKeyType = "SYSTEM_MANAGED" +) + +// All allowed values of ServiceAccountKeyListResponse enum +var AllowedServiceAccountKeyListResponseKeyTypeEnumValues = []ServiceAccountKeyListResponseKeyType{ + "USER_MANAGED", + "SYSTEM_MANAGED", +} + +func (v *ServiceAccountKeyListResponseKeyType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceAccountKeyListResponseKeyType(value) + for _, existing := range AllowedServiceAccountKeyListResponseKeyTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceAccountKeyListResponse", value) +} + +// NewServiceAccountKeyListResponseKeyTypeFromValue returns a pointer to a valid ServiceAccountKeyListResponseKeyType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceAccountKeyListResponseKeyTypeFromValue(v string) (*ServiceAccountKeyListResponseKeyType, error) { + ev := ServiceAccountKeyListResponseKeyType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceAccountKeyListResponseKeyType: valid values are %v", v, AllowedServiceAccountKeyListResponseKeyTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceAccountKeyListResponseKeyType) IsValid() bool { + for _, existing := range AllowedServiceAccountKeyListResponseKeyTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyTypeKeyType value +func (v ServiceAccountKeyListResponseKeyType) Ptr() *ServiceAccountKeyListResponseKeyType { + return &v +} + +type NullableServiceAccountKeyListResponseKeyType struct { + value *ServiceAccountKeyListResponseKeyType + isSet bool +} + +func (v NullableServiceAccountKeyListResponseKeyType) Get() *ServiceAccountKeyListResponseKeyType { + return v.value +} + +func (v *NullableServiceAccountKeyListResponseKeyType) Set(val *ServiceAccountKeyListResponseKeyType) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountKeyListResponseKeyType) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountKeyListResponseKeyType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountKeyListResponseKeyType(val *ServiceAccountKeyListResponseKeyType) *NullableServiceAccountKeyListResponseKeyType { + return &NullableServiceAccountKeyListResponseKeyType{value: val, isSet: true} +} + +func (v NullableServiceAccountKeyListResponseKeyType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountKeyListResponseKeyType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceAccountKeyListResponseGetKeyTypeAttributeType = *ServiceAccountKeyListResponseKeyType +type ServiceAccountKeyListResponseGetKeyTypeArgType = ServiceAccountKeyListResponseKeyType +type ServiceAccountKeyListResponseGetKeyTypeRetType = ServiceAccountKeyListResponseKeyType func getServiceAccountKeyListResponseGetKeyTypeAttributeTypeOk(arg ServiceAccountKeyListResponseGetKeyTypeAttributeType) (ret ServiceAccountKeyListResponseGetKeyTypeRetType, ok bool) { if arg == nil { diff --git a/services/serviceenablement/CHANGELOG.md b/services/serviceenablement/CHANGELOG.md index e583a06a3..0e252e01b 100644 --- a/services/serviceenablement/CHANGELOG.md +++ b/services/serviceenablement/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.0.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/serviceenablement/model_action_error.go b/services/serviceenablement/model_action_error.go index 2d5f9e2c4..9425c2ce3 100644 --- a/services/serviceenablement/model_action_error.go +++ b/services/serviceenablement/model_action_error.go @@ -12,6 +12,7 @@ package serviceenablement import ( "encoding/json" + "fmt" ) // checks if the ActionError type satisfies the MappedNullable interface at compile time @@ -21,10 +22,110 @@ var _ MappedNullable = &ActionError{} types and functions for action */ -// isEnumRef -type ActionErrorGetActionAttributeType = *string -type ActionErrorGetActionArgType = string -type ActionErrorGetActionRetType = string +//isEnum + +// ActionErrorAction the last action which was triggered on this service +type ActionErrorAction string + +// List of Action +const ( + ACTIONERRORACTION_DISABLE ActionErrorAction = "DISABLE" + ACTIONERRORACTION_ENABLE ActionErrorAction = "ENABLE" +) + +// All allowed values of ActionError enum +var AllowedActionErrorActionEnumValues = []ActionErrorAction{ + "DISABLE", + "ENABLE", +} + +func (v *ActionErrorAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ActionErrorAction(value) + for _, existing := range AllowedActionErrorActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ActionError", value) +} + +// NewActionErrorActionFromValue returns a pointer to a valid ActionErrorAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewActionErrorActionFromValue(v string) (*ActionErrorAction, error) { + ev := ActionErrorAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ActionErrorAction: valid values are %v", v, AllowedActionErrorActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ActionErrorAction) IsValid() bool { + for _, existing := range AllowedActionErrorActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ActionAction value +func (v ActionErrorAction) Ptr() *ActionErrorAction { + return &v +} + +type NullableActionErrorAction struct { + value *ActionErrorAction + isSet bool +} + +func (v NullableActionErrorAction) Get() *ActionErrorAction { + return v.value +} + +func (v *NullableActionErrorAction) Set(val *ActionErrorAction) { + v.value = val + v.isSet = true +} + +func (v NullableActionErrorAction) IsSet() bool { + return v.isSet +} + +func (v *NullableActionErrorAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActionErrorAction(val *ActionErrorAction) *NullableActionErrorAction { + return &NullableActionErrorAction{value: val, isSet: true} +} + +func (v NullableActionErrorAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActionErrorAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ActionErrorGetActionAttributeType = *ActionErrorAction +type ActionErrorGetActionArgType = ActionErrorAction +type ActionErrorGetActionRetType = ActionErrorAction func getActionErrorGetActionAttributeTypeOk(arg ActionErrorGetActionAttributeType) (ret ActionErrorGetActionRetType, ok bool) { if arg == nil { diff --git a/services/serviceenablement/model_check_service.go b/services/serviceenablement/model_check_service.go index 2ab976d0f..0c1ffd52c 100644 --- a/services/serviceenablement/model_check_service.go +++ b/services/serviceenablement/model_check_service.go @@ -12,6 +12,7 @@ package serviceenablement import ( "encoding/json" + "fmt" ) // checks if the CheckService type satisfies the MappedNullable interface at compile time @@ -42,10 +43,108 @@ type CheckServiceGetResourceRetType = string types and functions for resourceType */ -// isEnumRef -type CheckServiceGetResourceTypeAttributeType = *string -type CheckServiceGetResourceTypeArgType = string -type CheckServiceGetResourceTypeRetType = string +//isEnum + +// CheckServiceResourceType the model 'CheckService' +type CheckServiceResourceType string + +// List of ResourceType +const ( + CHECKSERVICERESOURCE_TYPE_PROJECT CheckServiceResourceType = "project" +) + +// All allowed values of CheckService enum +var AllowedCheckServiceResourceTypeEnumValues = []CheckServiceResourceType{ + "project", +} + +func (v *CheckServiceResourceType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CheckServiceResourceType(value) + for _, existing := range AllowedCheckServiceResourceTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CheckService", value) +} + +// NewCheckServiceResourceTypeFromValue returns a pointer to a valid CheckServiceResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCheckServiceResourceTypeFromValue(v string) (*CheckServiceResourceType, error) { + ev := CheckServiceResourceType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CheckServiceResourceType: valid values are %v", v, AllowedCheckServiceResourceTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CheckServiceResourceType) IsValid() bool { + for _, existing := range AllowedCheckServiceResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ResourceTypeResourceType value +func (v CheckServiceResourceType) Ptr() *CheckServiceResourceType { + return &v +} + +type NullableCheckServiceResourceType struct { + value *CheckServiceResourceType + isSet bool +} + +func (v NullableCheckServiceResourceType) Get() *CheckServiceResourceType { + return v.value +} + +func (v *NullableCheckServiceResourceType) Set(val *CheckServiceResourceType) { + v.value = val + v.isSet = true +} + +func (v NullableCheckServiceResourceType) IsSet() bool { + return v.isSet +} + +func (v *NullableCheckServiceResourceType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCheckServiceResourceType(val *CheckServiceResourceType) *NullableCheckServiceResourceType { + return &NullableCheckServiceResourceType{value: val, isSet: true} +} + +func (v NullableCheckServiceResourceType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCheckServiceResourceType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CheckServiceGetResourceTypeAttributeType = *CheckServiceResourceType +type CheckServiceGetResourceTypeArgType = CheckServiceResourceType +type CheckServiceGetResourceTypeRetType = CheckServiceResourceType func getCheckServiceGetResourceTypeAttributeTypeOk(arg CheckServiceGetResourceTypeAttributeType) (ret CheckServiceGetResourceTypeRetType, ok bool) { if arg == nil { @@ -102,7 +201,7 @@ func NewCheckService() *CheckService { // but it doesn't guarantee that properties required by API are set func NewCheckServiceWithDefaults() *CheckService { this := CheckService{} - var resourceType string = "project" + var resourceType CheckServiceResourceType = "project" this.ResourceType = &resourceType return &this } diff --git a/services/serviceenablement/model_cloud_service.go b/services/serviceenablement/model_cloud_service.go index a08edd5f2..b26f2384d 100644 --- a/services/serviceenablement/model_cloud_service.go +++ b/services/serviceenablement/model_cloud_service.go @@ -12,6 +12,7 @@ package serviceenablement import ( "encoding/json" + "fmt" ) // checks if the CloudService type satisfies the MappedNullable interface at compile time @@ -61,10 +62,110 @@ func setCloudServiceGetLabelsAttributeType(arg *CloudServiceGetLabelsAttributeTy types and functions for scope */ -// isEnumRef -type CloudServiceGetScopeAttributeType = *string -type CloudServiceGetScopeArgType = string -type CloudServiceGetScopeRetType = string +//isEnum + +// CloudServiceScope the model 'CloudService' +type CloudServiceScope string + +// List of Scope +const ( + CLOUDSERVICESCOPE_PRIVATE CloudServiceScope = "PRIVATE" + CLOUDSERVICESCOPE_PUBLIC CloudServiceScope = "PUBLIC" +) + +// All allowed values of CloudService enum +var AllowedCloudServiceScopeEnumValues = []CloudServiceScope{ + "PRIVATE", + "PUBLIC", +} + +func (v *CloudServiceScope) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CloudServiceScope(value) + for _, existing := range AllowedCloudServiceScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CloudService", value) +} + +// NewCloudServiceScopeFromValue returns a pointer to a valid CloudServiceScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCloudServiceScopeFromValue(v string) (*CloudServiceScope, error) { + ev := CloudServiceScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CloudServiceScope: valid values are %v", v, AllowedCloudServiceScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CloudServiceScope) IsValid() bool { + for _, existing := range AllowedCloudServiceScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ScopeScope value +func (v CloudServiceScope) Ptr() *CloudServiceScope { + return &v +} + +type NullableCloudServiceScope struct { + value *CloudServiceScope + isSet bool +} + +func (v NullableCloudServiceScope) Get() *CloudServiceScope { + return v.value +} + +func (v *NullableCloudServiceScope) Set(val *CloudServiceScope) { + v.value = val + v.isSet = true +} + +func (v NullableCloudServiceScope) IsSet() bool { + return v.isSet +} + +func (v *NullableCloudServiceScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCloudServiceScope(val *CloudServiceScope) *NullableCloudServiceScope { + return &NullableCloudServiceScope{value: val, isSet: true} +} + +func (v NullableCloudServiceScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCloudServiceScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CloudServiceGetScopeAttributeType = *CloudServiceScope +type CloudServiceGetScopeArgType = CloudServiceScope +type CloudServiceGetScopeRetType = CloudServiceScope func getCloudServiceGetScopeAttributeTypeOk(arg CloudServiceGetScopeAttributeType) (ret CloudServiceGetScopeRetType, ok bool) { if arg == nil { @@ -121,7 +222,7 @@ func NewCloudService() *CloudService { // but it doesn't guarantee that properties required by API are set func NewCloudServiceWithDefaults() *CloudService { this := CloudService{} - var scope string = "PUBLIC" + var scope CloudServiceScope = "PUBLIC" this.Scope = &scope return &this } diff --git a/services/serviceenablement/model_parameters_general.go b/services/serviceenablement/model_parameters_general.go index cc60076cb..7c76de0f0 100644 --- a/services/serviceenablement/model_parameters_general.go +++ b/services/serviceenablement/model_parameters_general.go @@ -12,6 +12,7 @@ package serviceenablement import ( "encoding/json" + "fmt" ) // checks if the ParametersGeneral type satisfies the MappedNullable interface at compile time @@ -63,10 +64,110 @@ type ParametersGeneralGetProjectNameRetType = string types and functions for projectScope */ -// isEnumRef -type ParametersGeneralGetProjectScopeAttributeType = *string -type ParametersGeneralGetProjectScopeArgType = string -type ParametersGeneralGetProjectScopeRetType = string +//isEnum + +// ParametersGeneralProjectScope the model 'ParametersGeneral' +type ParametersGeneralProjectScope string + +// List of ProjectScope +const ( + PARAMETERSGENERALPROJECT_SCOPE_SCHWARZ ParametersGeneralProjectScope = "SCHWARZ" + PARAMETERSGENERALPROJECT_SCOPE_PUBLIC ParametersGeneralProjectScope = "PUBLIC" +) + +// All allowed values of ParametersGeneral enum +var AllowedParametersGeneralProjectScopeEnumValues = []ParametersGeneralProjectScope{ + "SCHWARZ", + "PUBLIC", +} + +func (v *ParametersGeneralProjectScope) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ParametersGeneralProjectScope(value) + for _, existing := range AllowedParametersGeneralProjectScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ParametersGeneral", value) +} + +// NewParametersGeneralProjectScopeFromValue returns a pointer to a valid ParametersGeneralProjectScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewParametersGeneralProjectScopeFromValue(v string) (*ParametersGeneralProjectScope, error) { + ev := ParametersGeneralProjectScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ParametersGeneralProjectScope: valid values are %v", v, AllowedParametersGeneralProjectScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ParametersGeneralProjectScope) IsValid() bool { + for _, existing := range AllowedParametersGeneralProjectScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProjectScopeProjectScope value +func (v ParametersGeneralProjectScope) Ptr() *ParametersGeneralProjectScope { + return &v +} + +type NullableParametersGeneralProjectScope struct { + value *ParametersGeneralProjectScope + isSet bool +} + +func (v NullableParametersGeneralProjectScope) Get() *ParametersGeneralProjectScope { + return v.value +} + +func (v *NullableParametersGeneralProjectScope) Set(val *ParametersGeneralProjectScope) { + v.value = val + v.isSet = true +} + +func (v NullableParametersGeneralProjectScope) IsSet() bool { + return v.isSet +} + +func (v *NullableParametersGeneralProjectScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableParametersGeneralProjectScope(val *ParametersGeneralProjectScope) *NullableParametersGeneralProjectScope { + return &NullableParametersGeneralProjectScope{value: val, isSet: true} +} + +func (v NullableParametersGeneralProjectScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableParametersGeneralProjectScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ParametersGeneralGetProjectScopeAttributeType = *ParametersGeneralProjectScope +type ParametersGeneralGetProjectScopeArgType = ParametersGeneralProjectScope +type ParametersGeneralGetProjectScopeRetType = ParametersGeneralProjectScope func getParametersGeneralGetProjectScopeAttributeTypeOk(arg ParametersGeneralGetProjectScopeAttributeType) (ret ParametersGeneralGetProjectScopeRetType, ok bool) { if arg == nil { @@ -100,7 +201,7 @@ func NewParametersGeneral() *ParametersGeneral { // but it doesn't guarantee that properties required by API are set func NewParametersGeneralWithDefaults() *ParametersGeneral { this := ParametersGeneral{} - var projectScope string = "PUBLIC" + var projectScope ParametersGeneralProjectScope = "PUBLIC" this.ProjectScope = &projectScope return &this } diff --git a/services/serviceenablement/model_service_status.go b/services/serviceenablement/model_service_status.go index 2a7c8e9e5..2b04c65b1 100644 --- a/services/serviceenablement/model_service_status.go +++ b/services/serviceenablement/model_service_status.go @@ -12,6 +12,7 @@ package serviceenablement import ( "encoding/json" + "fmt" ) // checks if the ServiceStatus type satisfies the MappedNullable interface at compile time @@ -41,10 +42,110 @@ func setServiceStatusGetDependenciesAttributeType(arg *ServiceStatusGetDependenc types and functions for enablement */ -// isEnumRef -type ServiceStatusGetEnablementAttributeType = *string -type ServiceStatusGetEnablementArgType = string -type ServiceStatusGetEnablementRetType = string +//isEnum + +// ServiceStatusEnablement the model 'ServiceStatus' +type ServiceStatusEnablement string + +// List of Enablement +const ( + SERVICESTATUSENABLEMENT_REQUEST ServiceStatusEnablement = "REQUEST" + SERVICESTATUSENABLEMENT_AUTO ServiceStatusEnablement = "AUTO" +) + +// All allowed values of ServiceStatus enum +var AllowedServiceStatusEnablementEnumValues = []ServiceStatusEnablement{ + "REQUEST", + "AUTO", +} + +func (v *ServiceStatusEnablement) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceStatusEnablement(value) + for _, existing := range AllowedServiceStatusEnablementEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceStatus", value) +} + +// NewServiceStatusEnablementFromValue returns a pointer to a valid ServiceStatusEnablement +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceStatusEnablementFromValue(v string) (*ServiceStatusEnablement, error) { + ev := ServiceStatusEnablement(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceStatusEnablement: valid values are %v", v, AllowedServiceStatusEnablementEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceStatusEnablement) IsValid() bool { + for _, existing := range AllowedServiceStatusEnablementEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EnablementEnablement value +func (v ServiceStatusEnablement) Ptr() *ServiceStatusEnablement { + return &v +} + +type NullableServiceStatusEnablement struct { + value *ServiceStatusEnablement + isSet bool +} + +func (v NullableServiceStatusEnablement) Get() *ServiceStatusEnablement { + return v.value +} + +func (v *NullableServiceStatusEnablement) Set(val *ServiceStatusEnablement) { + v.value = val + v.isSet = true +} + +func (v NullableServiceStatusEnablement) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceStatusEnablement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceStatusEnablement(val *ServiceStatusEnablement) *NullableServiceStatusEnablement { + return &NullableServiceStatusEnablement{value: val, isSet: true} +} + +func (v NullableServiceStatusEnablement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceStatusEnablement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceStatusGetEnablementAttributeType = *ServiceStatusEnablement +type ServiceStatusGetEnablementArgType = ServiceStatusEnablement +type ServiceStatusGetEnablementRetType = ServiceStatusEnablement func getServiceStatusGetEnablementAttributeTypeOk(arg ServiceStatusGetEnablementAttributeType) (ret ServiceStatusGetEnablementRetType, ok bool) { if arg == nil { @@ -101,10 +202,110 @@ func setServiceStatusGetLabelsAttributeType(arg *ServiceStatusGetLabelsAttribute types and functions for lifecycle */ -// isEnumRef -type ServiceStatusGetLifecycleAttributeType = *string -type ServiceStatusGetLifecycleArgType = string -type ServiceStatusGetLifecycleRetType = string +//isEnum + +// ServiceStatusLifecycle the model 'ServiceStatus' +type ServiceStatusLifecycle string + +// List of Lifecycle +const ( + SERVICESTATUSLIFECYCLE_FLEX ServiceStatusLifecycle = "FLEX" + SERVICESTATUSLIFECYCLE_PROJECT ServiceStatusLifecycle = "PROJECT" +) + +// All allowed values of ServiceStatus enum +var AllowedServiceStatusLifecycleEnumValues = []ServiceStatusLifecycle{ + "FLEX", + "PROJECT", +} + +func (v *ServiceStatusLifecycle) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceStatusLifecycle(value) + for _, existing := range AllowedServiceStatusLifecycleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceStatus", value) +} + +// NewServiceStatusLifecycleFromValue returns a pointer to a valid ServiceStatusLifecycle +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceStatusLifecycleFromValue(v string) (*ServiceStatusLifecycle, error) { + ev := ServiceStatusLifecycle(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceStatusLifecycle: valid values are %v", v, AllowedServiceStatusLifecycleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceStatusLifecycle) IsValid() bool { + for _, existing := range AllowedServiceStatusLifecycleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LifecycleLifecycle value +func (v ServiceStatusLifecycle) Ptr() *ServiceStatusLifecycle { + return &v +} + +type NullableServiceStatusLifecycle struct { + value *ServiceStatusLifecycle + isSet bool +} + +func (v NullableServiceStatusLifecycle) Get() *ServiceStatusLifecycle { + return v.value +} + +func (v *NullableServiceStatusLifecycle) Set(val *ServiceStatusLifecycle) { + v.value = val + v.isSet = true +} + +func (v NullableServiceStatusLifecycle) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceStatusLifecycle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceStatusLifecycle(val *ServiceStatusLifecycle) *NullableServiceStatusLifecycle { + return &NullableServiceStatusLifecycle{value: val, isSet: true} +} + +func (v NullableServiceStatusLifecycle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceStatusLifecycle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceStatusGetLifecycleAttributeType = *ServiceStatusLifecycle +type ServiceStatusGetLifecycleArgType = ServiceStatusLifecycle +type ServiceStatusGetLifecycleRetType = ServiceStatusLifecycle func getServiceStatusGetLifecycleAttributeTypeOk(arg ServiceStatusGetLifecycleAttributeType) (ret ServiceStatusGetLifecycleRetType, ok bool) { if arg == nil { @@ -141,10 +342,110 @@ func setServiceStatusGetParametersAttributeType(arg *ServiceStatusGetParametersA types and functions for scope */ -// isEnumRef -type ServiceStatusGetScopeAttributeType = *string -type ServiceStatusGetScopeArgType = string -type ServiceStatusGetScopeRetType = string +//isEnum + +// ServiceStatusScope the model 'ServiceStatus' +type ServiceStatusScope string + +// List of Scope +const ( + SERVICESTATUSSCOPE_PRIVATE ServiceStatusScope = "PRIVATE" + SERVICESTATUSSCOPE_PUBLIC ServiceStatusScope = "PUBLIC" +) + +// All allowed values of ServiceStatus enum +var AllowedServiceStatusScopeEnumValues = []ServiceStatusScope{ + "PRIVATE", + "PUBLIC", +} + +func (v *ServiceStatusScope) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceStatusScope(value) + for _, existing := range AllowedServiceStatusScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceStatus", value) +} + +// NewServiceStatusScopeFromValue returns a pointer to a valid ServiceStatusScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceStatusScopeFromValue(v string) (*ServiceStatusScope, error) { + ev := ServiceStatusScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceStatusScope: valid values are %v", v, AllowedServiceStatusScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceStatusScope) IsValid() bool { + for _, existing := range AllowedServiceStatusScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ScopeScope value +func (v ServiceStatusScope) Ptr() *ServiceStatusScope { + return &v +} + +type NullableServiceStatusScope struct { + value *ServiceStatusScope + isSet bool +} + +func (v NullableServiceStatusScope) Get() *ServiceStatusScope { + return v.value +} + +func (v *NullableServiceStatusScope) Set(val *ServiceStatusScope) { + v.value = val + v.isSet = true +} + +func (v NullableServiceStatusScope) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceStatusScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceStatusScope(val *ServiceStatusScope) *NullableServiceStatusScope { + return &NullableServiceStatusScope{value: val, isSet: true} +} + +func (v NullableServiceStatusScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceStatusScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceStatusGetScopeAttributeType = *ServiceStatusScope +type ServiceStatusGetScopeArgType = ServiceStatusScope +type ServiceStatusGetScopeRetType = ServiceStatusScope func getServiceStatusGetScopeAttributeTypeOk(arg ServiceStatusGetScopeAttributeType) (ret ServiceStatusGetScopeRetType, ok bool) { if arg == nil { @@ -182,10 +483,114 @@ type ServiceStatusGetServiceIdRetType = string types and functions for state */ -// isEnumRef -type ServiceStatusGetStateAttributeType = *string -type ServiceStatusGetStateArgType = string -type ServiceStatusGetStateRetType = string +//isEnum + +// ServiceStatusState the state of a service within a project +type ServiceStatusState string + +// List of State +const ( + SERVICESTATUSSTATE_ENABLED ServiceStatusState = "ENABLED" + SERVICESTATUSSTATE_ENABLING ServiceStatusState = "ENABLING" + SERVICESTATUSSTATE_DISABLED ServiceStatusState = "DISABLED" + SERVICESTATUSSTATE_DISABLING ServiceStatusState = "DISABLING" +) + +// All allowed values of ServiceStatus enum +var AllowedServiceStatusStateEnumValues = []ServiceStatusState{ + "ENABLED", + "ENABLING", + "DISABLED", + "DISABLING", +} + +func (v *ServiceStatusState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ServiceStatusState(value) + for _, existing := range AllowedServiceStatusStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ServiceStatus", value) +} + +// NewServiceStatusStateFromValue returns a pointer to a valid ServiceStatusState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewServiceStatusStateFromValue(v string) (*ServiceStatusState, error) { + ev := ServiceStatusState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ServiceStatusState: valid values are %v", v, AllowedServiceStatusStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ServiceStatusState) IsValid() bool { + for _, existing := range AllowedServiceStatusStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v ServiceStatusState) Ptr() *ServiceStatusState { + return &v +} + +type NullableServiceStatusState struct { + value *ServiceStatusState + isSet bool +} + +func (v NullableServiceStatusState) Get() *ServiceStatusState { + return v.value +} + +func (v *NullableServiceStatusState) Set(val *ServiceStatusState) { + v.value = val + v.isSet = true +} + +func (v NullableServiceStatusState) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceStatusState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceStatusState(val *ServiceStatusState) *NullableServiceStatusState { + return &NullableServiceStatusState{value: val, isSet: true} +} + +func (v NullableServiceStatusState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceStatusState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ServiceStatusGetStateAttributeType = *ServiceStatusState +type ServiceStatusGetStateArgType = ServiceStatusState +type ServiceStatusGetStateRetType = ServiceStatusState func getServiceStatusGetStateAttributeTypeOk(arg ServiceStatusGetStateAttributeType) (ret ServiceStatusGetStateRetType, ok bool) { if arg == nil { @@ -227,13 +632,13 @@ func NewServiceStatus() *ServiceStatus { // but it doesn't guarantee that properties required by API are set func NewServiceStatusWithDefaults() *ServiceStatus { this := ServiceStatus{} - var enablement string = "REQUEST" + var enablement ServiceStatusEnablement = "REQUEST" this.Enablement = &enablement - var lifecycle string = "FLEX" + var lifecycle ServiceStatusLifecycle = "FLEX" this.Lifecycle = &lifecycle - var scope string = "PUBLIC" + var scope ServiceStatusScope = "PUBLIC" this.Scope = &scope - var state string = "ENABLED" + var state ServiceStatusState = "ENABLED" this.State = &state return &this } diff --git a/services/serviceenablement/wait/wait.go b/services/serviceenablement/wait/wait.go index 58221e403..7b52aeda5 100644 --- a/services/serviceenablement/wait/wait.go +++ b/services/serviceenablement/wait/wait.go @@ -10,9 +10,13 @@ import ( ) const ( - ServiceStateEnabled = "ENABLED" - ServiceStateEnabling = "ENABLING" - ServiceStateDisabled = "DISABLED" + // Deprecated: ServiceStateEnabled is deprecated and will be removed after 14th November 2025. Use [serviceenablement.SERVICESTATUSSTATE_ENABLED] instead. + ServiceStateEnabled = "ENABLED" + // Deprecated: ServiceStateEnabling is deprecated and will be removed after 14th November 2025. Use [serviceenablement.SERVICESTATUSSTATE_ENABLING] instead. + ServiceStateEnabling = "ENABLING" + // Deprecated: ServiceStateDisabled is deprecated and will be removed after 14th November 2025. Use [serviceenablement.SERVICESTATUSSTATE_DISABLED] instead. + ServiceStateDisabled = "DISABLED" + // Deprecated: ServiceStateDisabling is deprecated and will be removed after 14th November 2025. Use [serviceenablement.SERVICESTATUSSTATE_DISABLING] instead. ServiceStateDisabling = "DISABLING" ) @@ -33,13 +37,13 @@ func EnableServiceWaitHandler(ctx context.Context, a APIClientInstanceInterface, switch *s.State { default: return true, s, fmt.Errorf("service with id %s has unexpected state %s", serviceId, *s.State) - case ServiceStateEnabled: + case serviceenablement.SERVICESTATUSSTATE_ENABLED: return true, s, nil - case ServiceStateEnabling: + case serviceenablement.SERVICESTATUSSTATE_ENABLING: return false, nil, nil - case ServiceStateDisabled: + case serviceenablement.SERVICESTATUSSTATE_DISABLED: return true, s, fmt.Errorf("enabling failed for service with id %s", serviceId) - case ServiceStateDisabling: + case serviceenablement.SERVICESTATUSSTATE_DISABLING: return true, s, fmt.Errorf("service with id %s is in state %s", serviceId, *s.State) } }) @@ -60,13 +64,13 @@ func DisableServiceWaitHandler(ctx context.Context, a APIClientInstanceInterface switch *s.State { default: return true, s, fmt.Errorf("service with id %s has unexpected state %s", serviceId, *s.State) - case ServiceStateDisabled: + case serviceenablement.SERVICESTATUSSTATE_DISABLED: return true, s, nil - case ServiceStateDisabling: + case serviceenablement.SERVICESTATUSSTATE_DISABLING: return false, nil, nil - case ServiceStateEnabled: + case serviceenablement.SERVICESTATUSSTATE_ENABLED: return true, s, fmt.Errorf("disabling failed for service with id %s", serviceId) - case ServiceStateEnabling: + case serviceenablement.SERVICESTATUSSTATE_ENABLING: return true, s, fmt.Errorf("service with id %s is in state %s", serviceId, *s.State) } }) diff --git a/services/serviceenablement/wait/wait_test.go b/services/serviceenablement/wait/wait_test.go index 2c2a8a0cd..e4a85a938 100644 --- a/services/serviceenablement/wait/wait_test.go +++ b/services/serviceenablement/wait/wait_test.go @@ -14,7 +14,7 @@ import ( // Used for testing service operations type apiClientServiceMocked struct { serviceId string - serviceState string + serviceState serviceenablement.ServiceStatusState getServiceFails bool } @@ -35,42 +35,42 @@ func TestEnableServiceWaitHandler(t *testing.T) { tests := []struct { desc string getServiceFails bool - serviceState string + serviceState serviceenablement.ServiceStatusState wantErr bool wantResp bool }{ { desc: "enable_succeeded", getServiceFails: false, - serviceState: ServiceStateEnabled, + serviceState: serviceenablement.SERVICESTATUSSTATE_ENABLED, wantErr: false, wantResp: true, }, { desc: "enable_failed", getServiceFails: false, - serviceState: ServiceStateDisabled, + serviceState: serviceenablement.SERVICESTATUSSTATE_DISABLED, wantErr: true, wantResp: false, }, { desc: "enable_failed_2", getServiceFails: false, - serviceState: ServiceStateDisabling, + serviceState: serviceenablement.SERVICESTATUSSTATE_DISABLING, wantErr: true, wantResp: false, }, { desc: "timeout", getServiceFails: false, - serviceState: ServiceStateEnabling, + serviceState: serviceenablement.SERVICESTATUSSTATE_ENABLING, wantErr: true, wantResp: false, }, { desc: "get_service_fails", getServiceFails: true, - serviceState: ServiceStateEnabling, + serviceState: serviceenablement.SERVICESTATUSSTATE_ENABLING, wantErr: true, wantResp: false, }, @@ -117,42 +117,42 @@ func TestDisableServiceWaitHandler(t *testing.T) { tests := []struct { desc string getServiceFails bool - serviceState string + serviceState serviceenablement.ServiceStatusState wantErr bool wantResp bool }{ { desc: "disable_succeeded", getServiceFails: false, - serviceState: ServiceStateDisabled, + serviceState: serviceenablement.SERVICESTATUSSTATE_DISABLED, wantErr: false, wantResp: true, }, { desc: "disable_failed", getServiceFails: false, - serviceState: ServiceStateEnabled, + serviceState: serviceenablement.SERVICESTATUSSTATE_ENABLED, wantErr: true, wantResp: false, }, { desc: "disable_failed_2", getServiceFails: false, - serviceState: ServiceStateEnabling, + serviceState: serviceenablement.SERVICESTATUSSTATE_ENABLING, wantErr: true, wantResp: false, }, { desc: "timeout", getServiceFails: false, - serviceState: ServiceStateDisabling, + serviceState: serviceenablement.SERVICESTATUSSTATE_DISABLING, wantErr: true, wantResp: false, }, { desc: "get_service_fails", getServiceFails: true, - serviceState: ServiceStateDisabling, + serviceState: serviceenablement.SERVICESTATUSSTATE_DISABLING, wantErr: true, wantResp: false, }, diff --git a/services/ske/CHANGELOG.md b/services/ske/CHANGELOG.md index 03266c774..21716e87c 100644 --- a/services/ske/CHANGELOG.md +++ b/services/ske/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.23.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v0.22.4 (2025-05-13) - **Feature:** Added `ClusterError` diff --git a/services/ske/model_credentials_rotation_state.go b/services/ske/model_credentials_rotation_state.go index fa3ab6c3f..7bfdcdecc 100644 --- a/services/ske/model_credentials_rotation_state.go +++ b/services/ske/model_credentials_rotation_state.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "fmt" "time" ) @@ -62,10 +63,116 @@ func setCredentialsRotationStateGetLastInitiationTimeAttributeType(arg *Credenti types and functions for phase */ -// isEnumRef -type CredentialsRotationStateGetPhaseAttributeType = *string -type CredentialsRotationStateGetPhaseArgType = string -type CredentialsRotationStateGetPhaseRetType = string +//isEnum + +// CredentialsRotationStatePhase Phase of the credentials rotation. `NEVER` indicates that no credentials rotation has been performed using the new credentials rotation endpoints yet. +type CredentialsRotationStatePhase string + +// List of Phase +const ( + CREDENTIALSROTATIONSTATEPHASE_NEVER CredentialsRotationStatePhase = "NEVER" + CREDENTIALSROTATIONSTATEPHASE_PREPARING CredentialsRotationStatePhase = "PREPARING" + CREDENTIALSROTATIONSTATEPHASE_PREPARED CredentialsRotationStatePhase = "PREPARED" + CREDENTIALSROTATIONSTATEPHASE_COMPLETING CredentialsRotationStatePhase = "COMPLETING" + CREDENTIALSROTATIONSTATEPHASE_COMPLETED CredentialsRotationStatePhase = "COMPLETED" +) + +// All allowed values of CredentialsRotationState enum +var AllowedCredentialsRotationStatePhaseEnumValues = []CredentialsRotationStatePhase{ + "NEVER", + "PREPARING", + "PREPARED", + "COMPLETING", + "COMPLETED", +} + +func (v *CredentialsRotationStatePhase) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CredentialsRotationStatePhase(value) + for _, existing := range AllowedCredentialsRotationStatePhaseEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CredentialsRotationState", value) +} + +// NewCredentialsRotationStatePhaseFromValue returns a pointer to a valid CredentialsRotationStatePhase +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCredentialsRotationStatePhaseFromValue(v string) (*CredentialsRotationStatePhase, error) { + ev := CredentialsRotationStatePhase(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CredentialsRotationStatePhase: valid values are %v", v, AllowedCredentialsRotationStatePhaseEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CredentialsRotationStatePhase) IsValid() bool { + for _, existing := range AllowedCredentialsRotationStatePhaseEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PhasePhase value +func (v CredentialsRotationStatePhase) Ptr() *CredentialsRotationStatePhase { + return &v +} + +type NullableCredentialsRotationStatePhase struct { + value *CredentialsRotationStatePhase + isSet bool +} + +func (v NullableCredentialsRotationStatePhase) Get() *CredentialsRotationStatePhase { + return v.value +} + +func (v *NullableCredentialsRotationStatePhase) Set(val *CredentialsRotationStatePhase) { + v.value = val + v.isSet = true +} + +func (v NullableCredentialsRotationStatePhase) IsSet() bool { + return v.isSet +} + +func (v *NullableCredentialsRotationStatePhase) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredentialsRotationStatePhase(val *CredentialsRotationStatePhase) *NullableCredentialsRotationStatePhase { + return &NullableCredentialsRotationStatePhase{value: val, isSet: true} +} + +func (v NullableCredentialsRotationStatePhase) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredentialsRotationStatePhase) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CredentialsRotationStateGetPhaseAttributeType = *CredentialsRotationStatePhase +type CredentialsRotationStateGetPhaseArgType = CredentialsRotationStatePhase +type CredentialsRotationStateGetPhaseRetType = CredentialsRotationStatePhase func getCredentialsRotationStateGetPhaseAttributeTypeOk(arg CredentialsRotationStateGetPhaseAttributeType) (ret CredentialsRotationStateGetPhaseRetType, ok bool) { if arg == nil { diff --git a/services/ske/model_cri.go b/services/ske/model_cri.go index 58a819c03..f019ae92f 100644 --- a/services/ske/model_cri.go +++ b/services/ske/model_cri.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "fmt" ) // checks if the CRI type satisfies the MappedNullable interface at compile time @@ -21,10 +22,110 @@ var _ MappedNullable = &CRI{} types and functions for name */ -// isEnumRef -type CRIGetNameAttributeType = *string -type CRIGetNameArgType = string -type CRIGetNameRetType = string +//isEnum + +// CRIName the model 'CRI' +type CRIName string + +// List of Name +const ( + CRINAME_DOCKER CRIName = "docker" + CRINAME_CONTAINERD CRIName = "containerd" +) + +// All allowed values of CRI enum +var AllowedCRINameEnumValues = []CRIName{ + "docker", + "containerd", +} + +func (v *CRIName) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CRIName(value) + for _, existing := range AllowedCRINameEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CRI", value) +} + +// NewCRINameFromValue returns a pointer to a valid CRIName +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCRINameFromValue(v string) (*CRIName, error) { + ev := CRIName(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CRIName: valid values are %v", v, AllowedCRINameEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CRIName) IsValid() bool { + for _, existing := range AllowedCRINameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NameName value +func (v CRIName) Ptr() *CRIName { + return &v +} + +type NullableCRIName struct { + value *CRIName + isSet bool +} + +func (v NullableCRIName) Get() *CRIName { + return v.value +} + +func (v *NullableCRIName) Set(val *CRIName) { + v.value = val + v.isSet = true +} + +func (v NullableCRIName) IsSet() bool { + return v.isSet +} + +func (v *NullableCRIName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCRIName(val *CRIName) *NullableCRIName { + return &NullableCRIName{value: val, isSet: true} +} + +func (v NullableCRIName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCRIName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CRIGetNameAttributeType = *CRIName +type CRIGetNameArgType = CRIName +type CRIGetNameRetType = CRIName func getCRIGetNameAttributeTypeOk(arg CRIGetNameAttributeType) (ret CRIGetNameRetType, ok bool) { if arg == nil { diff --git a/services/ske/model_machine.go b/services/ske/model_machine.go index 9e4ae3b09..d51fcebfd 100644 --- a/services/ske/model_machine.go +++ b/services/ske/model_machine.go @@ -73,10 +73,10 @@ type _Machine Machine // 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 NewMachine(image MachineGetImageArgType, type_ MachineGetTypeArgType) *Machine { +func NewMachine(image MachineGetImageArgType, types MachineGetTypeArgType) *Machine { this := Machine{} setMachineGetImageAttributeType(&this.Image, image) - setMachineGetTypeAttributeType(&this.Type, type_) + setMachineGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/ske/model_runtime_error.go b/services/ske/model_runtime_error.go index f3939086f..74e9b2044 100644 --- a/services/ske/model_runtime_error.go +++ b/services/ske/model_runtime_error.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "fmt" ) // checks if the RuntimeError type satisfies the MappedNullable interface at compile time @@ -21,10 +22,128 @@ var _ MappedNullable = &RuntimeError{} types and functions for code */ -// isEnumRef -type RuntimeErrorGetCodeAttributeType = *string -type RuntimeErrorGetCodeArgType = string -type RuntimeErrorGetCodeRetType = string +//isEnum + +// RuntimeErrorCode - Code: `SKE_UNSPECIFIED` Message: \"An error occurred. Please open a support ticket if this error persists.\" - Code: `SKE_TMP_AUTH_ERROR` Message: \"Authentication failed. This is a temporary error. Please wait while the system recovers.\" - Code: `SKE_QUOTA_EXCEEDED` Message: \"Your project's resource quotas are exhausted. Please make sure your quota is sufficient for the ordered cluster.\" - Code: `SKE_ARGUS_INSTANCE_NOT_FOUND` Message: \"The provided Argus instance could not be found.\" - Code: `SKE_RATE_LIMITS` Message: \"While provisioning your cluster, request rate limits where incurred. Please wait while the system recovers.\" - Code: `SKE_INFRA_ERROR` Message: \"An error occurred with the underlying infrastructure. Please open a support ticket if this error persists.\" - Code: `SKE_REMAINING_RESOURCES` Message: \"There are remaining Kubernetes resources in your cluster that prevent deletion. Please make sure to remove them.\" - Code: `SKE_CONFIGURATION_PROBLEM` Message: \"A configuration error occurred. Please open a support ticket if this error persists.\" - Code: `SKE_UNREADY_NODES` Message: \"Not all worker nodes are ready. Please open a support ticket if this error persists.\" - Code: `SKE_API_SERVER_ERROR` Message: \"The Kubernetes API server is not reporting readiness. Please open a support ticket if this error persists.\" - Code: `SKE_DNS_ZONE_NOT_FOUND` Message: \"The provided DNS zone for the STACKIT DNS extension could not be found. Please ensure you defined a valid domain that belongs to a STACKIT DNS zone.\" +type RuntimeErrorCode string + +// List of Code +const ( + RUNTIMEERRORCODE_UNSPECIFIED RuntimeErrorCode = "SKE_UNSPECIFIED" + RUNTIMEERRORCODE_TMP_AUTH_ERROR RuntimeErrorCode = "SKE_TMP_AUTH_ERROR" + RUNTIMEERRORCODE_QUOTA_EXCEEDED RuntimeErrorCode = "SKE_QUOTA_EXCEEDED" + RUNTIMEERRORCODE_ARGUS_INSTANCE_NOT_FOUND RuntimeErrorCode = "SKE_ARGUS_INSTANCE_NOT_FOUND" + RUNTIMEERRORCODE_RATE_LIMITS RuntimeErrorCode = "SKE_RATE_LIMITS" + RUNTIMEERRORCODE_INFRA_ERROR RuntimeErrorCode = "SKE_INFRA_ERROR" + RUNTIMEERRORCODE_REMAINING_RESOURCES RuntimeErrorCode = "SKE_REMAINING_RESOURCES" + RUNTIMEERRORCODE_CONFIGURATION_PROBLEM RuntimeErrorCode = "SKE_CONFIGURATION_PROBLEM" + RUNTIMEERRORCODE_UNREADY_NODES RuntimeErrorCode = "SKE_UNREADY_NODES" + RUNTIMEERRORCODE_API_SERVER_ERROR RuntimeErrorCode = "SKE_API_SERVER_ERROR" + RUNTIMEERRORCODE_DNS_ZONE_NOT_FOUND RuntimeErrorCode = "SKE_DNS_ZONE_NOT_FOUND" +) + +// All allowed values of RuntimeError enum +var AllowedRuntimeErrorCodeEnumValues = []RuntimeErrorCode{ + "SKE_UNSPECIFIED", + "SKE_TMP_AUTH_ERROR", + "SKE_QUOTA_EXCEEDED", + "SKE_ARGUS_INSTANCE_NOT_FOUND", + "SKE_RATE_LIMITS", + "SKE_INFRA_ERROR", + "SKE_REMAINING_RESOURCES", + "SKE_CONFIGURATION_PROBLEM", + "SKE_UNREADY_NODES", + "SKE_API_SERVER_ERROR", + "SKE_DNS_ZONE_NOT_FOUND", +} + +func (v *RuntimeErrorCode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := RuntimeErrorCode(value) + for _, existing := range AllowedRuntimeErrorCodeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RuntimeError", value) +} + +// NewRuntimeErrorCodeFromValue returns a pointer to a valid RuntimeErrorCode +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRuntimeErrorCodeFromValue(v string) (*RuntimeErrorCode, error) { + ev := RuntimeErrorCode(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RuntimeErrorCode: valid values are %v", v, AllowedRuntimeErrorCodeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RuntimeErrorCode) IsValid() bool { + for _, existing := range AllowedRuntimeErrorCodeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CodeCode value +func (v RuntimeErrorCode) Ptr() *RuntimeErrorCode { + return &v +} + +type NullableRuntimeErrorCode struct { + value *RuntimeErrorCode + isSet bool +} + +func (v NullableRuntimeErrorCode) Get() *RuntimeErrorCode { + return v.value +} + +func (v *NullableRuntimeErrorCode) Set(val *RuntimeErrorCode) { + v.value = val + v.isSet = true +} + +func (v NullableRuntimeErrorCode) IsSet() bool { + return v.isSet +} + +func (v *NullableRuntimeErrorCode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRuntimeErrorCode(val *RuntimeErrorCode) *NullableRuntimeErrorCode { + return &NullableRuntimeErrorCode{value: val, isSet: true} +} + +func (v NullableRuntimeErrorCode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRuntimeErrorCode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type RuntimeErrorGetCodeAttributeType = *RuntimeErrorCode +type RuntimeErrorGetCodeArgType = RuntimeErrorCode +type RuntimeErrorGetCodeRetType = RuntimeErrorCode func getRuntimeErrorGetCodeAttributeTypeOk(arg RuntimeErrorGetCodeAttributeType) (ret RuntimeErrorGetCodeRetType, ok bool) { if arg == nil { diff --git a/services/ske/model_taint.go b/services/ske/model_taint.go index 40ee56884..5f0e4d4b0 100644 --- a/services/ske/model_taint.go +++ b/services/ske/model_taint.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "fmt" ) // checks if the Taint type satisfies the MappedNullable interface at compile time @@ -21,10 +22,112 @@ var _ MappedNullable = &Taint{} types and functions for effect */ -// isEnumRef -type TaintGetEffectAttributeType = *string -type TaintGetEffectArgType = string -type TaintGetEffectRetType = string +//isEnum + +// TaintEffect the model 'Taint' +type TaintEffect string + +// List of Effect +const ( + TAINTEFFECT_NO_SCHEDULE TaintEffect = "NoSchedule" + TAINTEFFECT_PREFER_NO_SCHEDULE TaintEffect = "PreferNoSchedule" + TAINTEFFECT_NO_EXECUTE TaintEffect = "NoExecute" +) + +// All allowed values of Taint enum +var AllowedTaintEffectEnumValues = []TaintEffect{ + "NoSchedule", + "PreferNoSchedule", + "NoExecute", +} + +func (v *TaintEffect) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := TaintEffect(value) + for _, existing := range AllowedTaintEffectEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Taint", value) +} + +// NewTaintEffectFromValue returns a pointer to a valid TaintEffect +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTaintEffectFromValue(v string) (*TaintEffect, error) { + ev := TaintEffect(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TaintEffect: valid values are %v", v, AllowedTaintEffectEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TaintEffect) IsValid() bool { + for _, existing := range AllowedTaintEffectEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EffectEffect value +func (v TaintEffect) Ptr() *TaintEffect { + return &v +} + +type NullableTaintEffect struct { + value *TaintEffect + isSet bool +} + +func (v NullableTaintEffect) Get() *TaintEffect { + return v.value +} + +func (v *NullableTaintEffect) Set(val *TaintEffect) { + v.value = val + v.isSet = true +} + +func (v NullableTaintEffect) IsSet() bool { + return v.isSet +} + +func (v *NullableTaintEffect) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTaintEffect(val *TaintEffect) *NullableTaintEffect { + return &NullableTaintEffect{value: val, isSet: true} +} + +func (v NullableTaintEffect) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTaintEffect) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TaintGetEffectAttributeType = *TaintEffect +type TaintGetEffectArgType = TaintEffect +type TaintGetEffectRetType = TaintEffect func getTaintGetEffectAttributeTypeOk(arg TaintGetEffectAttributeType) (ret TaintGetEffectRetType, ok bool) { if arg == nil { diff --git a/services/ske/wait/wait.go b/services/ske/wait/wait.go index 3750bb475..575660943 100644 --- a/services/ske/wait/wait.go +++ b/services/ske/wait/wait.go @@ -10,18 +10,29 @@ import ( ) const ( - StateHealthy = "STATE_HEALTHY" - StateHibernated = "STATE_HIBERNATED" - StateFailed = "STATE_FAILED" - StateDeleting = "STATE_DELETING" - StateCreated = "STATE_CREATED" - StateUnhealthy = "STATE_UNHEALTHY" - StateReconciling = "STATE_RECONCILING" - CredentialsRotationStatePreparing = "PREPARING" - CredentialsRotationStatePrepared = "PREPARED" + // Deprecated: StateHealthy is deprecated and will be removed after 14th November 2025. Use [ske.CLUSTERSTATUSSTATE_HEALTHY] instead. + StateHealthy = "STATE_HEALTHY" + // Deprecated: StateHibernated is deprecated and will be removed after 14th November 2025. Use [ske.CLUSTERSTATUSSTATE_HIBERNATED] instead. + StateHibernated = "STATE_HIBERNATED" + StateFailed = "STATE_FAILED" + // Deprecated: StateDeleting is deprecated and will be removed after 14th November 2025. Use [ske.CLUSTERSTATUSSTATE_DELETING] instead. + StateDeleting = "STATE_DELETING" + // Deprecated: StateCreated is deprecated and will be removed after 14th November 2025. + StateCreated = "STATE_CREATED" + // Deprecated: StateUnhealthy is deprecated and will be removed after 14th November 2025. Use [ske.CLUSTERSTATUSSTATE_UNHEALTHY] instead. + StateUnhealthy = "STATE_UNHEALTHY" + // Deprecated: StateReconciling is deprecated and will be removed after 14th November 2025. Use [ske.CLUSTERSTATUSSTATE_RECONCILING] instead. + StateReconciling = "STATE_RECONCILING" + // Deprecated: CredentialsRotationStatePreparing is deprecated and will be removed after 14th November 2025. Use [ske.CREDENTIALSROTATIONSTATEPHASE_PREPARING] instead. + CredentialsRotationStatePreparing = "PREPARING" + // Deprecated: CredentialsRotationStatePrepared is deprecated and will be removed after 14th November 2025. Use [ske.CREDENTIALSROTATIONSTATEPHASE_PREPARED] instead. + CredentialsRotationStatePrepared = "PREPARED" + // Deprecated: CredentialsRotationStateCompleting is deprecated and will be removed after 14th November 2025. Use [ske.CREDENTIALSROTATIONSTATEPHASE_COMPLETING] instead. CredentialsRotationStateCompleting = "COMPLETING" - CredentialsRotationStateCompleted = "COMPLETED" - InvalidArgusInstanceErrorCode = "SKE_ARGUS_INSTANCE_NOT_FOUND" + // Deprecated: CredentialsRotationStateCompleted is deprecated and will be removed after 14th November 2025. Use [ske.CREDENTIALSROTATIONSTATEPHASE_COMPLETED] instead. + CredentialsRotationStateCompleted = "COMPLETED" + // Deprecated: InvalidArgusInstanceErrorCode is deprecated and will be removed after 14th November 2025. Use [ske.RUNTIMEERRORCODE_ARGUS_INSTANCE_NOT_FOUND] instead. + InvalidArgusInstanceErrorCode = "SKE_ARGUS_INSTANCE_NOT_FOUND" ) type APIClientClusterInterface interface { @@ -41,11 +52,11 @@ func CreateOrUpdateClusterWaitHandler(ctx context.Context, a APIClientClusterInt // The state "STATE_UNHEALTHY" (aka "Impaired" in the portal) could be temporarily occur during cluster creation and the system is recovering usually, so it is not considered as a failed state here. // -- alignment meeting with SKE team on 4.8.23 // The exception is when providing an invalid argus instance id, in that case the cluster will stay as "Impaired" until the SKE team solves it, but it is still usable. - if state == StateUnhealthy && s.Status.Error != nil && s.Status.Error.Message != nil && *s.Status.Error.Code == InvalidArgusInstanceErrorCode { + if state == ske.CLUSTERSTATUSSTATE_UNHEALTHY && s.Status.Error != nil && s.Status.Error.Message != nil && *s.Status.Error.Code == ske.RUNTIMEERRORCODE_ARGUS_INSTANCE_NOT_FOUND { return true, s, nil } - if state == StateHealthy || state == StateHibernated { + if state == ske.CLUSTERSTATUSSTATE_HEALTHY || state == ske.CLUSTERSTATUSSTATE_HIBERNATED { return true, s, nil } @@ -88,11 +99,11 @@ func RotateCredentialsWaitHandler(ctx context.Context, a APIClientClusterInterfa } state := *s.Status.Aggregated - if state == StateHealthy || state == StateHibernated { + if state == ske.CLUSTERSTATUSSTATE_HEALTHY || state == ske.CLUSTERSTATUSSTATE_HIBERNATED { return true, s, nil } - if state == StateReconciling { + if state == ske.CLUSTERSTATUSSTATE_RECONCILING { return false, nil, nil } @@ -116,11 +127,11 @@ func StartCredentialsRotationWaitHandler(ctx context.Context, a APIClientCluster } state := *s.Status.CredentialsRotation.Phase - if state == CredentialsRotationStatePrepared { + if state == ske.CREDENTIALSROTATIONSTATEPHASE_PREPARED { return true, s, nil } - if state == CredentialsRotationStatePreparing { + if state == ske.CREDENTIALSROTATIONSTATEPHASE_PREPARING { return false, nil, nil } @@ -140,11 +151,11 @@ func CompleteCredentialsRotationWaitHandler(ctx context.Context, a APIClientClus } state := *s.Status.CredentialsRotation.Phase - if state == CredentialsRotationStateCompleted { + if state == ske.CREDENTIALSROTATIONSTATEPHASE_COMPLETED { return true, s, nil } - if state == CredentialsRotationStateCompleting { + if state == ske.CREDENTIALSROTATIONSTATEPHASE_COMPLETING { return false, nil, nil } diff --git a/services/ske/wait/wait_test.go b/services/ske/wait/wait_test.go index 84b644209..35c6c78e9 100644 --- a/services/ske/wait/wait_test.go +++ b/services/ske/wait/wait_test.go @@ -16,7 +16,7 @@ import ( type apiClientClusterMocked struct { getFails bool name string - resourceState string + resourceState ske.ClusterStatusState invalidArgusInstance bool } @@ -34,7 +34,7 @@ func (a *apiClientClusterMocked) GetClusterExecute(_ context.Context, _, _ strin Status: &ske.ClusterStatus{ Aggregated: &rs, Error: &ske.RuntimeError{ - Code: utils.Ptr(string(InvalidArgusInstanceErrorCode)), + Code: utils.Ptr(ske.RUNTIMEERRORCODE_ARGUS_INSTANCE_NOT_FOUND), Message: utils.Ptr("invalid argus instance"), }, }, @@ -71,7 +71,7 @@ func TestCreateOrUpdateClusterWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState ske.ClusterStatusState invalidArgusInstance bool wantErr bool wantResp bool @@ -79,21 +79,21 @@ func TestCreateOrUpdateClusterWaitHandler(t *testing.T) { { desc: "create_succeeded", getFails: false, - resourceState: StateHealthy, + resourceState: ske.CLUSTERSTATUSSTATE_HEALTHY, wantErr: false, wantResp: true, }, { desc: "update_succeeded", getFails: false, - resourceState: StateHibernated, + resourceState: ske.CLUSTERSTATUSSTATE_HIBERNATED, wantErr: false, wantResp: true, }, { desc: "unhealthy_cluster", getFails: false, - resourceState: StateUnhealthy, + resourceState: ske.CLUSTERSTATUSSTATE_UNHEALTHY, invalidArgusInstance: true, wantErr: false, wantResp: true, @@ -141,7 +141,7 @@ func TestCreateOrUpdateClusterWaitHandler(t *testing.T) { if tt.invalidArgusInstance { wantRes.Status.Error = &ske.RuntimeError{ - Code: utils.Ptr(string(InvalidArgusInstanceErrorCode)), + Code: utils.Ptr(ske.RUNTIMEERRORCODE_ARGUS_INSTANCE_NOT_FOUND), Message: utils.Ptr("invalid argus instance"), } } @@ -165,21 +165,21 @@ func TestRotateCredentialsWaitHandler(t *testing.T) { tests := []struct { desc string getFails bool - resourceState string + resourceState ske.ClusterStatusState wantErr bool wantResp bool }{ { desc: "reconciliation_succeeded_1", getFails: false, - resourceState: StateHealthy, + resourceState: ske.CLUSTERSTATUSSTATE_HEALTHY, wantErr: false, wantResp: true, }, { desc: "reconciliation_succeeded_2", getFails: false, - resourceState: StateHibernated, + resourceState: ske.CLUSTERSTATUSSTATE_HIBERNATED, wantErr: false, wantResp: true, }, @@ -199,7 +199,7 @@ func TestRotateCredentialsWaitHandler(t *testing.T) { { desc: "timeout", getFails: false, - resourceState: StateReconciling, + resourceState: ske.CLUSTERSTATUSSTATE_RECONCILING, wantErr: true, wantResp: false, }, @@ -214,12 +214,11 @@ func TestRotateCredentialsWaitHandler(t *testing.T) { resourceState: tt.resourceState, } var wantRes *ske.Cluster - rs := ske.ClusterStatusState(tt.resourceState) if tt.wantResp { wantRes = &ske.Cluster{ Name: &name, Status: &ske.ClusterStatus{ - Aggregated: &rs, + Aggregated: utils.Ptr(tt.resourceState), }, } } diff --git a/services/stackitmarketplace/CHANGELOG.md b/services/stackitmarketplace/CHANGELOG.md index e8bb1fc1a..f18f6c461 100644 --- a/services/stackitmarketplace/CHANGELOG.md +++ b/services/stackitmarketplace/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.2.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + ## v1.1.0 (2025-05-13) - **Breaking Change:** Added organization id to `VendorSubscription` diff --git a/services/stackitmarketplace/model_become_vendor.go b/services/stackitmarketplace/model_become_vendor.go index c39901a9a..f4e4de868 100644 --- a/services/stackitmarketplace/model_become_vendor.go +++ b/services/stackitmarketplace/model_become_vendor.go @@ -71,10 +71,10 @@ type _BecomeVendor BecomeVendor // 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 NewBecomeVendor(becomeVendor BecomeVendorGetBecomeVendorArgType, type_ BecomeVendorGetTypeArgType) *BecomeVendor { +func NewBecomeVendor(becomeVendor BecomeVendorGetBecomeVendorArgType, types BecomeVendorGetTypeArgType) *BecomeVendor { this := BecomeVendor{} setBecomeVendorGetBecomeVendorAttributeType(&this.BecomeVendor, becomeVendor) - setBecomeVendorGetTypeAttributeType(&this.Type, type_) + setBecomeVendorGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/stackitmarketplace/model_contact_sales.go b/services/stackitmarketplace/model_contact_sales.go index ca5d36a16..da213a791 100644 --- a/services/stackitmarketplace/model_contact_sales.go +++ b/services/stackitmarketplace/model_contact_sales.go @@ -71,10 +71,10 @@ type _ContactSales ContactSales // 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 NewContactSales(contactSales ContactSalesGetContactSalesArgType, type_ ContactSalesGetTypeArgType) *ContactSales { +func NewContactSales(contactSales ContactSalesGetContactSalesArgType, types ContactSalesGetTypeArgType) *ContactSales { this := ContactSales{} setContactSalesGetContactSalesAttributeType(&this.ContactSales, contactSales) - setContactSalesGetTypeAttributeType(&this.Type, type_) + setContactSalesGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/stackitmarketplace/model_register_testing.go b/services/stackitmarketplace/model_register_testing.go index a43ce635f..7b3efbfd7 100644 --- a/services/stackitmarketplace/model_register_testing.go +++ b/services/stackitmarketplace/model_register_testing.go @@ -71,10 +71,10 @@ type _RegisterTesting RegisterTesting // 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 NewRegisterTesting(registerTesting RegisterTestingGetRegisterTestingArgType, type_ RegisterTestingGetTypeArgType) *RegisterTesting { +func NewRegisterTesting(registerTesting RegisterTestingGetRegisterTestingArgType, types RegisterTestingGetTypeArgType) *RegisterTesting { this := RegisterTesting{} setRegisterTestingGetRegisterTestingAttributeType(&this.RegisterTesting, registerTesting) - setRegisterTestingGetTypeAttributeType(&this.Type, type_) + setRegisterTestingGetTypeAttributeType(&this.Type, types) return &this } diff --git a/services/stackitmarketplace/model_suggest_product.go b/services/stackitmarketplace/model_suggest_product.go index aea67f875..e878a3c2c 100644 --- a/services/stackitmarketplace/model_suggest_product.go +++ b/services/stackitmarketplace/model_suggest_product.go @@ -71,10 +71,10 @@ type _SuggestProduct SuggestProduct // 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 NewSuggestProduct(suggestProduct SuggestProductGetSuggestProductArgType, type_ SuggestProductGetTypeArgType) *SuggestProduct { +func NewSuggestProduct(suggestProduct SuggestProductGetSuggestProductArgType, types SuggestProductGetTypeArgType) *SuggestProduct { this := SuggestProduct{} setSuggestProductGetSuggestProductAttributeType(&this.SuggestProduct, suggestProduct) - setSuggestProductGetTypeAttributeType(&this.Type, type_) + setSuggestProductGetTypeAttributeType(&this.Type, types) return &this }