From 39be194c227dd4a8cfba81ced0b0480a147c4599 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 5 Jun 2025 15:35:10 +0000 Subject: [PATCH] Generate loadbalancer --- .../model_create_load_balancer_payload.go | 49 ++++- ..._balancer_payload_target_security_group.go | 178 ++++++++++++++++++ ...ncer_payload_target_security_group_test.go | 11 ++ services/loadbalancer/model_load_balancer.go | 49 ++++- services/loadbalancer/model_security_group.go | 178 ++++++++++++++++++ .../loadbalancer/model_security_group_test.go | 11 ++ .../model_update_load_balancer_payload.go | 49 ++++- services/loadbalancer/utils.go | 12 ++ 8 files changed, 534 insertions(+), 3 deletions(-) create mode 100644 services/loadbalancer/model_create_load_balancer_payload_target_security_group.go create mode 100644 services/loadbalancer/model_create_load_balancer_payload_target_security_group_test.go create mode 100644 services/loadbalancer/model_security_group.go create mode 100644 services/loadbalancer/model_security_group_test.go diff --git a/services/loadbalancer/model_create_load_balancer_payload.go b/services/loadbalancer/model_create_load_balancer_payload.go index b7afa2c5..cda8e84d 100644 --- a/services/loadbalancer/model_create_load_balancer_payload.go +++ b/services/loadbalancer/model_create_load_balancer_payload.go @@ -353,6 +353,26 @@ func setCreateLoadBalancerPayloadGetTargetPoolsAttributeType(arg *CreateLoadBala *arg = &val } +/* + types and functions for targetSecurityGroup +*/ + +// isModel +type CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType = *CreateLoadBalancerPayloadTargetSecurityGroup +type CreateLoadBalancerPayloadGetTargetSecurityGroupArgType = CreateLoadBalancerPayloadTargetSecurityGroup +type CreateLoadBalancerPayloadGetTargetSecurityGroupRetType = CreateLoadBalancerPayloadTargetSecurityGroup + +func getCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(arg CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType) (ret CreateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(arg *CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType, val CreateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + *arg = &val +} + /* types and functions for version */ @@ -395,7 +415,8 @@ type CreateLoadBalancerPayload struct { Region CreateLoadBalancerPayloadGetRegionAttributeType `json:"region,omitempty"` Status CreateLoadBalancerPayloadGetStatusAttributeType `json:"status,omitempty"` // List of all target pools which will be used in the load balancer. Limited to 20. - TargetPools CreateLoadBalancerPayloadGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetPools CreateLoadBalancerPayloadGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetSecurityGroup CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType `json:"targetSecurityGroup,omitempty"` // Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case. Version CreateLoadBalancerPayloadGetVersionAttributeType `json:"version,omitempty"` } @@ -670,6 +691,29 @@ func (o *CreateLoadBalancerPayload) SetTargetPools(v CreateLoadBalancerPayloadGe setCreateLoadBalancerPayloadGetTargetPoolsAttributeType(&o.TargetPools, v) } +// GetTargetSecurityGroup returns the TargetSecurityGroup field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetTargetSecurityGroup() (res CreateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + res, _ = o.GetTargetSecurityGroupOk() + return +} + +// GetTargetSecurityGroupOk returns a tuple with the TargetSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetTargetSecurityGroupOk() (ret CreateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + return getCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup) +} + +// HasTargetSecurityGroup returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasTargetSecurityGroup() bool { + _, ok := o.GetTargetSecurityGroupOk() + return ok +} + +// SetTargetSecurityGroup gets a reference to the given CreateLoadBalancerPayloadTargetSecurityGroup and assigns it to the TargetSecurityGroup field. +func (o *CreateLoadBalancerPayload) SetTargetSecurityGroup(v CreateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + setCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(&o.TargetSecurityGroup, v) +} + // GetVersion returns the Version field value if set, zero value otherwise. func (o *CreateLoadBalancerPayload) GetVersion() (res CreateLoadBalancerPayloadGetVersionRetType) { res, _ = o.GetVersionOk() @@ -728,6 +772,9 @@ func (o CreateLoadBalancerPayload) ToMap() (map[string]interface{}, error) { if val, ok := getCreateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(o.TargetPools); ok { toSerialize["TargetPools"] = val } + if val, ok := getCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup); ok { + toSerialize["TargetSecurityGroup"] = val + } if val, ok := getCreateLoadBalancerPayloadGetVersionAttributeTypeOk(o.Version); ok { toSerialize["Version"] = val } diff --git a/services/loadbalancer/model_create_load_balancer_payload_target_security_group.go b/services/loadbalancer/model_create_load_balancer_payload_target_security_group.go new file mode 100644 index 00000000..90112e5e --- /dev/null +++ b/services/loadbalancer/model_create_load_balancer_payload_target_security_group.go @@ -0,0 +1,178 @@ +/* +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 load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package loadbalancer + +import ( + "encoding/json" +) + +// checks if the CreateLoadBalancerPayloadTargetSecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLoadBalancerPayloadTargetSecurityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType = *string + +func getCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeTypeOk(arg CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType) (ret CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType(arg *CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType, val CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadTargetSecurityGroupGetIdArgType = string +type CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType = *string + +func getCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeTypeOk(arg CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType) (ret CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType(arg *CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType, val CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadTargetSecurityGroupGetNameArgType = string +type CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType = string + +// CreateLoadBalancerPayloadTargetSecurityGroup Security Group permitting network traffic from the LoadBalancer to the targets. +type CreateLoadBalancerPayloadTargetSecurityGroup struct { + // ID of the security Group + Id CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Name of the security Group + Name CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType `json:"name,omitempty"` +} + +// NewCreateLoadBalancerPayloadTargetSecurityGroup instantiates a new CreateLoadBalancerPayloadTargetSecurityGroup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateLoadBalancerPayloadTargetSecurityGroup() *CreateLoadBalancerPayloadTargetSecurityGroup { + this := CreateLoadBalancerPayloadTargetSecurityGroup{} + return &this +} + +// NewCreateLoadBalancerPayloadTargetSecurityGroupWithDefaults instantiates a new CreateLoadBalancerPayloadTargetSecurityGroup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateLoadBalancerPayloadTargetSecurityGroupWithDefaults() *CreateLoadBalancerPayloadTargetSecurityGroup { + this := CreateLoadBalancerPayloadTargetSecurityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetId() (res CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetIdOk() (ret CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType, ok bool) { + return getCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) SetId(v CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType) { + setCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetName() (res CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetNameOk() (ret CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType, ok bool) { + return getCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) SetName(v CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType) { + setCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType(&o.Name, v) +} + +func (o CreateLoadBalancerPayloadTargetSecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateLoadBalancerPayloadTargetSecurityGroup struct { + value *CreateLoadBalancerPayloadTargetSecurityGroup + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadTargetSecurityGroup) Get() *CreateLoadBalancerPayloadTargetSecurityGroup { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadTargetSecurityGroup) Set(val *CreateLoadBalancerPayloadTargetSecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadTargetSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadTargetSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadTargetSecurityGroup(val *CreateLoadBalancerPayloadTargetSecurityGroup) *NullableCreateLoadBalancerPayloadTargetSecurityGroup { + return &NullableCreateLoadBalancerPayloadTargetSecurityGroup{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadTargetSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadTargetSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/loadbalancer/model_create_load_balancer_payload_target_security_group_test.go b/services/loadbalancer/model_create_load_balancer_payload_target_security_group_test.go new file mode 100644 index 00000000..681adf7a --- /dev/null +++ b/services/loadbalancer/model_create_load_balancer_payload_target_security_group_test.go @@ -0,0 +1,11 @@ +/* +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 load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package loadbalancer diff --git a/services/loadbalancer/model_load_balancer.go b/services/loadbalancer/model_load_balancer.go index c34a37e3..7f069ec4 100644 --- a/services/loadbalancer/model_load_balancer.go +++ b/services/loadbalancer/model_load_balancer.go @@ -353,6 +353,26 @@ func setLoadBalancerGetTargetPoolsAttributeType(arg *LoadBalancerGetTargetPoolsA *arg = &val } +/* + types and functions for targetSecurityGroup +*/ + +// isModel +type LoadBalancerGetTargetSecurityGroupAttributeType = *CreateLoadBalancerPayloadTargetSecurityGroup +type LoadBalancerGetTargetSecurityGroupArgType = CreateLoadBalancerPayloadTargetSecurityGroup +type LoadBalancerGetTargetSecurityGroupRetType = CreateLoadBalancerPayloadTargetSecurityGroup + +func getLoadBalancerGetTargetSecurityGroupAttributeTypeOk(arg LoadBalancerGetTargetSecurityGroupAttributeType) (ret LoadBalancerGetTargetSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetTargetSecurityGroupAttributeType(arg *LoadBalancerGetTargetSecurityGroupAttributeType, val LoadBalancerGetTargetSecurityGroupRetType) { + *arg = &val +} + /* types and functions for version */ @@ -395,7 +415,8 @@ type LoadBalancer struct { Region LoadBalancerGetRegionAttributeType `json:"region,omitempty"` Status LoadBalancerGetStatusAttributeType `json:"status,omitempty"` // List of all target pools which will be used in the load balancer. Limited to 20. - TargetPools LoadBalancerGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetPools LoadBalancerGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetSecurityGroup LoadBalancerGetTargetSecurityGroupAttributeType `json:"targetSecurityGroup,omitempty"` // Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case. Version LoadBalancerGetVersionAttributeType `json:"version,omitempty"` } @@ -670,6 +691,29 @@ func (o *LoadBalancer) SetTargetPools(v LoadBalancerGetTargetPoolsRetType) { setLoadBalancerGetTargetPoolsAttributeType(&o.TargetPools, v) } +// GetTargetSecurityGroup returns the TargetSecurityGroup field value if set, zero value otherwise. +func (o *LoadBalancer) GetTargetSecurityGroup() (res LoadBalancerGetTargetSecurityGroupRetType) { + res, _ = o.GetTargetSecurityGroupOk() + return +} + +// GetTargetSecurityGroupOk returns a tuple with the TargetSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetTargetSecurityGroupOk() (ret LoadBalancerGetTargetSecurityGroupRetType, ok bool) { + return getLoadBalancerGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup) +} + +// HasTargetSecurityGroup returns a boolean if a field has been set. +func (o *LoadBalancer) HasTargetSecurityGroup() bool { + _, ok := o.GetTargetSecurityGroupOk() + return ok +} + +// SetTargetSecurityGroup gets a reference to the given CreateLoadBalancerPayloadTargetSecurityGroup and assigns it to the TargetSecurityGroup field. +func (o *LoadBalancer) SetTargetSecurityGroup(v LoadBalancerGetTargetSecurityGroupRetType) { + setLoadBalancerGetTargetSecurityGroupAttributeType(&o.TargetSecurityGroup, v) +} + // GetVersion returns the Version field value if set, zero value otherwise. func (o *LoadBalancer) GetVersion() (res LoadBalancerGetVersionRetType) { res, _ = o.GetVersionOk() @@ -728,6 +772,9 @@ func (o LoadBalancer) ToMap() (map[string]interface{}, error) { if val, ok := getLoadBalancerGetTargetPoolsAttributeTypeOk(o.TargetPools); ok { toSerialize["TargetPools"] = val } + if val, ok := getLoadBalancerGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup); ok { + toSerialize["TargetSecurityGroup"] = val + } if val, ok := getLoadBalancerGetVersionAttributeTypeOk(o.Version); ok { toSerialize["Version"] = val } diff --git a/services/loadbalancer/model_security_group.go b/services/loadbalancer/model_security_group.go new file mode 100644 index 00000000..2143209a --- /dev/null +++ b/services/loadbalancer/model_security_group.go @@ -0,0 +1,178 @@ +/* +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 load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package loadbalancer + +import ( + "encoding/json" +) + +// checks if the SecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type SecurityGroupGetIdAttributeType = *string + +func getSecurityGroupGetIdAttributeTypeOk(arg SecurityGroupGetIdAttributeType) (ret SecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetIdAttributeType(arg *SecurityGroupGetIdAttributeType, val SecurityGroupGetIdRetType) { + *arg = &val +} + +type SecurityGroupGetIdArgType = string +type SecurityGroupGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type SecurityGroupGetNameAttributeType = *string + +func getSecurityGroupGetNameAttributeTypeOk(arg SecurityGroupGetNameAttributeType) (ret SecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetNameAttributeType(arg *SecurityGroupGetNameAttributeType, val SecurityGroupGetNameRetType) { + *arg = &val +} + +type SecurityGroupGetNameArgType = string +type SecurityGroupGetNameRetType = string + +// SecurityGroup struct for SecurityGroup +type SecurityGroup struct { + // ID of the security Group + Id SecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Name of the security Group + Name SecurityGroupGetNameAttributeType `json:"name,omitempty"` +} + +// NewSecurityGroup instantiates a new SecurityGroup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecurityGroup() *SecurityGroup { + this := SecurityGroup{} + return &this +} + +// NewSecurityGroupWithDefaults instantiates a new SecurityGroup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecurityGroupWithDefaults() *SecurityGroup { + this := SecurityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroup) GetId() (res SecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetIdOk() (ret SecurityGroupGetIdRetType, ok bool) { + return getSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroup) SetId(v SecurityGroupGetIdRetType) { + setSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityGroup) GetName() (res SecurityGroupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetNameOk() (ret SecurityGroupGetNameRetType, ok bool) { + return getSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityGroup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityGroup) SetName(v SecurityGroupGetNameRetType) { + setSecurityGroupGetNameAttributeType(&o.Name, v) +} + +func (o SecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroup struct { + value *SecurityGroup + isSet bool +} + +func (v NullableSecurityGroup) Get() *SecurityGroup { + return v.value +} + +func (v *NullableSecurityGroup) Set(val *SecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroup(val *SecurityGroup) *NullableSecurityGroup { + return &NullableSecurityGroup{value: val, isSet: true} +} + +func (v NullableSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/loadbalancer/model_security_group_test.go b/services/loadbalancer/model_security_group_test.go new file mode 100644 index 00000000..681adf7a --- /dev/null +++ b/services/loadbalancer/model_security_group_test.go @@ -0,0 +1,11 @@ +/* +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 load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package loadbalancer diff --git a/services/loadbalancer/model_update_load_balancer_payload.go b/services/loadbalancer/model_update_load_balancer_payload.go index b027f576..0bf1b652 100644 --- a/services/loadbalancer/model_update_load_balancer_payload.go +++ b/services/loadbalancer/model_update_load_balancer_payload.go @@ -353,6 +353,26 @@ func setUpdateLoadBalancerPayloadGetTargetPoolsAttributeType(arg *UpdateLoadBala *arg = &val } +/* + types and functions for targetSecurityGroup +*/ + +// isModel +type UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType = *CreateLoadBalancerPayloadTargetSecurityGroup +type UpdateLoadBalancerPayloadGetTargetSecurityGroupArgType = CreateLoadBalancerPayloadTargetSecurityGroup +type UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType = CreateLoadBalancerPayloadTargetSecurityGroup + +func getUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(arg UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType) (ret UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(arg *UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType, val UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + *arg = &val +} + /* types and functions for version */ @@ -395,7 +415,8 @@ type UpdateLoadBalancerPayload struct { Region UpdateLoadBalancerPayloadGetRegionAttributeType `json:"region,omitempty"` Status UpdateLoadBalancerPayloadGetStatusAttributeType `json:"status,omitempty"` // List of all target pools which will be used in the load balancer. Limited to 20. - TargetPools UpdateLoadBalancerPayloadGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetPools UpdateLoadBalancerPayloadGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetSecurityGroup UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType `json:"targetSecurityGroup,omitempty"` // Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case. Version UpdateLoadBalancerPayloadGetVersionAttributeType `json:"version,omitempty"` } @@ -670,6 +691,29 @@ func (o *UpdateLoadBalancerPayload) SetTargetPools(v UpdateLoadBalancerPayloadGe setUpdateLoadBalancerPayloadGetTargetPoolsAttributeType(&o.TargetPools, v) } +// GetTargetSecurityGroup returns the TargetSecurityGroup field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetTargetSecurityGroup() (res UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + res, _ = o.GetTargetSecurityGroupOk() + return +} + +// GetTargetSecurityGroupOk returns a tuple with the TargetSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetTargetSecurityGroupOk() (ret UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup) +} + +// HasTargetSecurityGroup returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasTargetSecurityGroup() bool { + _, ok := o.GetTargetSecurityGroupOk() + return ok +} + +// SetTargetSecurityGroup gets a reference to the given CreateLoadBalancerPayloadTargetSecurityGroup and assigns it to the TargetSecurityGroup field. +func (o *UpdateLoadBalancerPayload) SetTargetSecurityGroup(v UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + setUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(&o.TargetSecurityGroup, v) +} + // GetVersion returns the Version field value if set, zero value otherwise. func (o *UpdateLoadBalancerPayload) GetVersion() (res UpdateLoadBalancerPayloadGetVersionRetType) { res, _ = o.GetVersionOk() @@ -728,6 +772,9 @@ func (o UpdateLoadBalancerPayload) ToMap() (map[string]interface{}, error) { if val, ok := getUpdateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(o.TargetPools); ok { toSerialize["TargetPools"] = val } + if val, ok := getUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup); ok { + toSerialize["TargetSecurityGroup"] = val + } if val, ok := getUpdateLoadBalancerPayloadGetVersionAttributeTypeOk(o.Version); ok { toSerialize["Version"] = val } diff --git a/services/loadbalancer/utils.go b/services/loadbalancer/utils.go index 6c9d4721..ceda7add 100644 --- a/services/loadbalancer/utils.go +++ b/services/loadbalancer/utils.go @@ -12,6 +12,7 @@ package loadbalancer import ( "encoding/json" + "math/rand" "reflect" "time" ) @@ -371,3 +372,14 @@ func IsNil(i interface{}) bool { type MappedNullable interface { ToMap() (map[string]interface{}, error) } + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +}