terraform-provider-stackitp.../pkg/gitbeta/model_create_instance_payload.go

327 lines
10 KiB
Go

/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"fmt"
)
// checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateInstancePayload{}
/*
types and functions for acl
*/
// isArray
type CreateInstancePayloadGetAclAttributeType = *[]string
type CreateInstancePayloadGetAclArgType = []string
type CreateInstancePayloadGetAclRetType = []string
func getCreateInstancePayloadGetAclAttributeTypeOk(arg CreateInstancePayloadGetAclAttributeType) (ret CreateInstancePayloadGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateInstancePayloadGetAclAttributeType(arg *CreateInstancePayloadGetAclAttributeType, val CreateInstancePayloadGetAclRetType) {
*arg = &val
}
/*
types and functions for flavor
*/
// isEnum
// CreateInstancePayloadFlavor the model 'CreateInstancePayload'
// value type for enums
type CreateInstancePayloadFlavor string
// List of Flavor
const (
CREATEINSTANCEPAYLOADFLAVOR__10 CreateInstancePayloadFlavor = "git-10"
CREATEINSTANCEPAYLOADFLAVOR__100 CreateInstancePayloadFlavor = "git-100"
)
// All allowed values of CreateInstancePayload enum
var AllowedCreateInstancePayloadFlavorEnumValues = []CreateInstancePayloadFlavor{
"git-10",
"git-100",
}
func (v *CreateInstancePayloadFlavor) 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 CreateInstancePayloadFlavor
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 := CreateInstancePayloadFlavor(value)
for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid CreateInstancePayload", value)
}
// NewCreateInstancePayloadFlavorFromValue returns a pointer to a valid CreateInstancePayloadFlavor
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewCreateInstancePayloadFlavorFromValue(v CreateInstancePayloadFlavor) (*CreateInstancePayloadFlavor, error) {
ev := CreateInstancePayloadFlavor(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for CreateInstancePayloadFlavor: valid values are %v", v, AllowedCreateInstancePayloadFlavorEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v CreateInstancePayloadFlavor) IsValid() bool {
for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to FlavorFlavor value
func (v CreateInstancePayloadFlavor) Ptr() *CreateInstancePayloadFlavor {
return &v
}
type NullableCreateInstancePayloadFlavor struct {
value *CreateInstancePayloadFlavor
isSet bool
}
func (v NullableCreateInstancePayloadFlavor) Get() *CreateInstancePayloadFlavor {
return v.value
}
func (v *NullableCreateInstancePayloadFlavor) Set(val *CreateInstancePayloadFlavor) {
v.value = val
v.isSet = true
}
func (v NullableCreateInstancePayloadFlavor) IsSet() bool {
return v.isSet
}
func (v *NullableCreateInstancePayloadFlavor) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateInstancePayloadFlavor(val *CreateInstancePayloadFlavor) *NullableCreateInstancePayloadFlavor {
return &NullableCreateInstancePayloadFlavor{value: val, isSet: true}
}
func (v NullableCreateInstancePayloadFlavor) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateInstancePayloadFlavor) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type CreateInstancePayloadGetFlavorAttributeType = *CreateInstancePayloadFlavor
type CreateInstancePayloadGetFlavorArgType = CreateInstancePayloadFlavor
type CreateInstancePayloadGetFlavorRetType = CreateInstancePayloadFlavor
func getCreateInstancePayloadGetFlavorAttributeTypeOk(arg CreateInstancePayloadGetFlavorAttributeType) (ret CreateInstancePayloadGetFlavorRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateInstancePayloadGetFlavorAttributeType(arg *CreateInstancePayloadGetFlavorAttributeType, val CreateInstancePayloadGetFlavorRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type CreateInstancePayloadGetNameAttributeType = *string
func getCreateInstancePayloadGetNameAttributeTypeOk(arg CreateInstancePayloadGetNameAttributeType) (ret CreateInstancePayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateInstancePayloadGetNameAttributeType(arg *CreateInstancePayloadGetNameAttributeType, val CreateInstancePayloadGetNameRetType) {
*arg = &val
}
type CreateInstancePayloadGetNameArgType = string
type CreateInstancePayloadGetNameRetType = string
// CreateInstancePayload Request a STACKIT Git instance to be created with these properties.
type CreateInstancePayload struct {
// A list of CIDR network addresses that are allowed to access the instance.
Acl CreateInstancePayloadGetAclAttributeType `json:"acl,omitempty"`
Flavor CreateInstancePayloadGetFlavorAttributeType `json:"flavor,omitempty"`
// A user chosen name to distinguish multiple STACKIT Git instances.
// REQUIRED
Name CreateInstancePayloadGetNameAttributeType `json:"name" required:"true"`
}
type _CreateInstancePayload CreateInstancePayload
// NewCreateInstancePayload instantiates a new CreateInstancePayload 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 NewCreateInstancePayload(name CreateInstancePayloadGetNameArgType) *CreateInstancePayload {
this := CreateInstancePayload{}
setCreateInstancePayloadGetNameAttributeType(&this.Name, name)
return &this
}
// NewCreateInstancePayloadWithDefaults instantiates a new CreateInstancePayload 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 NewCreateInstancePayloadWithDefaults() *CreateInstancePayload {
this := CreateInstancePayload{}
return &this
}
// GetAcl returns the Acl field value if set, zero value otherwise.
func (o *CreateInstancePayload) GetAcl() (res CreateInstancePayloadGetAclRetType) {
res, _ = o.GetAclOk()
return
}
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateInstancePayload) GetAclOk() (ret CreateInstancePayloadGetAclRetType, ok bool) {
return getCreateInstancePayloadGetAclAttributeTypeOk(o.Acl)
}
// HasAcl returns a boolean if a field has been set.
func (o *CreateInstancePayload) HasAcl() bool {
_, ok := o.GetAclOk()
return ok
}
// SetAcl gets a reference to the given []string and assigns it to the Acl field.
func (o *CreateInstancePayload) SetAcl(v CreateInstancePayloadGetAclRetType) {
setCreateInstancePayloadGetAclAttributeType(&o.Acl, v)
}
// GetFlavor returns the Flavor field value if set, zero value otherwise.
func (o *CreateInstancePayload) GetFlavor() (res CreateInstancePayloadGetFlavorRetType) {
res, _ = o.GetFlavorOk()
return
}
// GetFlavorOk returns a tuple with the Flavor field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateInstancePayload) GetFlavorOk() (ret CreateInstancePayloadGetFlavorRetType, ok bool) {
return getCreateInstancePayloadGetFlavorAttributeTypeOk(o.Flavor)
}
// HasFlavor returns a boolean if a field has been set.
func (o *CreateInstancePayload) HasFlavor() bool {
_, ok := o.GetFlavorOk()
return ok
}
// SetFlavor gets a reference to the given string and assigns it to the Flavor field.
func (o *CreateInstancePayload) SetFlavor(v CreateInstancePayloadGetFlavorRetType) {
setCreateInstancePayloadGetFlavorAttributeType(&o.Flavor, v)
}
// GetName returns the Name field value
func (o *CreateInstancePayload) GetName() (ret CreateInstancePayloadGetNameRetType) {
ret, _ = o.GetNameOk()
return ret
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *CreateInstancePayload) GetNameOk() (ret CreateInstancePayloadGetNameRetType, ok bool) {
return getCreateInstancePayloadGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *CreateInstancePayload) SetName(v CreateInstancePayloadGetNameRetType) {
setCreateInstancePayloadGetNameAttributeType(&o.Name, v)
}
func (o CreateInstancePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateInstancePayloadGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getCreateInstancePayloadGetFlavorAttributeTypeOk(o.Flavor); ok {
toSerialize["Flavor"] = val
}
if val, ok := getCreateInstancePayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
return toSerialize, nil
}
type NullableCreateInstancePayload struct {
value *CreateInstancePayload
isSet bool
}
func (v NullableCreateInstancePayload) Get() *CreateInstancePayload {
return v.value
}
func (v *NullableCreateInstancePayload) Set(val *CreateInstancePayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateInstancePayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateInstancePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateInstancePayload(val *CreateInstancePayload) *NullableCreateInstancePayload {
return &NullableCreateInstancePayload{value: val, isSet: true}
}
func (v NullableCreateInstancePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateInstancePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}