## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
286 lines
7.7 KiB
Go
286 lines
7.7 KiB
Go
/*
|
|
STACKIT Application Load Balancer API
|
|
|
|
### DEPRECATED! 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: 2beta2.0.0
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package albbeta
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// checks if the Network type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &Network{}
|
|
|
|
/*
|
|
types and functions for networkId
|
|
*/
|
|
|
|
// isNotNullableString
|
|
type NetworkGetNetworkIdAttributeType = *string
|
|
|
|
func getNetworkGetNetworkIdAttributeTypeOk(arg NetworkGetNetworkIdAttributeType) (ret NetworkGetNetworkIdRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setNetworkGetNetworkIdAttributeType(arg *NetworkGetNetworkIdAttributeType, val NetworkGetNetworkIdRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
type NetworkGetNetworkIdArgType = string
|
|
type NetworkGetNetworkIdRetType = string
|
|
|
|
/*
|
|
types and functions for role
|
|
*/
|
|
|
|
// isEnum
|
|
|
|
// NetworkRole The role defines how the Application Load Balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported.
|
|
// value type for enums
|
|
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 {
|
|
// use a type alias to prevent infinite recursion during unmarshal,
|
|
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
|
|
type TmpJson NetworkRole
|
|
var value TmpJson
|
|
err := json.Unmarshal(src, &value)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Allow unmarshalling zero value for testing purposes
|
|
var zeroValue TmpJson
|
|
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 NetworkRole) (*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 {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setNetworkGetRoleAttributeType(arg *NetworkGetRoleAttributeType, val NetworkGetRoleRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
// Network struct for Network
|
|
type Network struct {
|
|
// Openstack network ID
|
|
NetworkId NetworkGetNetworkIdAttributeType `json:"networkId,omitempty"`
|
|
// The role defines how the Application Load Balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported.
|
|
Role NetworkGetRoleAttributeType `json:"role,omitempty"`
|
|
}
|
|
|
|
// NewNetwork instantiates a new Network 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 NewNetwork() *Network {
|
|
this := Network{}
|
|
return &this
|
|
}
|
|
|
|
// NewNetworkWithDefaults instantiates a new Network 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 NewNetworkWithDefaults() *Network {
|
|
this := Network{}
|
|
return &this
|
|
}
|
|
|
|
// GetNetworkId returns the NetworkId field value if set, zero value otherwise.
|
|
func (o *Network) GetNetworkId() (res NetworkGetNetworkIdRetType) {
|
|
res, _ = o.GetNetworkIdOk()
|
|
return
|
|
}
|
|
|
|
// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Network) GetNetworkIdOk() (ret NetworkGetNetworkIdRetType, ok bool) {
|
|
return getNetworkGetNetworkIdAttributeTypeOk(o.NetworkId)
|
|
}
|
|
|
|
// HasNetworkId returns a boolean if a field has been set.
|
|
func (o *Network) HasNetworkId() bool {
|
|
_, ok := o.GetNetworkIdOk()
|
|
return ok
|
|
}
|
|
|
|
// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field.
|
|
func (o *Network) SetNetworkId(v NetworkGetNetworkIdRetType) {
|
|
setNetworkGetNetworkIdAttributeType(&o.NetworkId, v)
|
|
}
|
|
|
|
// GetRole returns the Role field value if set, zero value otherwise.
|
|
func (o *Network) GetRole() (res NetworkGetRoleRetType) {
|
|
res, _ = o.GetRoleOk()
|
|
return
|
|
}
|
|
|
|
// GetRoleOk returns a tuple with the Role field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Network) GetRoleOk() (ret NetworkGetRoleRetType, ok bool) {
|
|
return getNetworkGetRoleAttributeTypeOk(o.Role)
|
|
}
|
|
|
|
// HasRole returns a boolean if a field has been set.
|
|
func (o *Network) HasRole() bool {
|
|
_, ok := o.GetRoleOk()
|
|
return ok
|
|
}
|
|
|
|
// SetRole gets a reference to the given string and assigns it to the Role field.
|
|
func (o *Network) SetRole(v NetworkGetRoleRetType) {
|
|
setNetworkGetRoleAttributeType(&o.Role, v)
|
|
}
|
|
|
|
func (o Network) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getNetworkGetNetworkIdAttributeTypeOk(o.NetworkId); ok {
|
|
toSerialize["NetworkId"] = val
|
|
}
|
|
if val, ok := getNetworkGetRoleAttributeTypeOk(o.Role); ok {
|
|
toSerialize["Role"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableNetwork struct {
|
|
value *Network
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableNetwork) Get() *Network {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableNetwork) Set(val *Network) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableNetwork) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableNetwork) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableNetwork(val *Network) *NullableNetwork {
|
|
return &NullableNetwork{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableNetwork) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableNetwork) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|