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

686 lines
20 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"
"time"
)
// checks if the Instance type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Instance{}
/*
types and functions for acl
*/
// isArray
type InstanceGetAclAttributeType = *[]string
type InstanceGetAclArgType = []string
type InstanceGetAclRetType = []string
func getInstanceGetAclAttributeTypeOk(arg InstanceGetAclAttributeType) (ret InstanceGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetAclAttributeType(arg *InstanceGetAclAttributeType, val InstanceGetAclRetType) {
*arg = &val
}
/*
types and functions for consumed_disk
*/
// isNotNullableString
type InstanceGetConsumedDiskAttributeType = *string
func getInstanceGetConsumedDiskAttributeTypeOk(arg InstanceGetConsumedDiskAttributeType) (ret InstanceGetConsumedDiskRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetConsumedDiskAttributeType(arg *InstanceGetConsumedDiskAttributeType, val InstanceGetConsumedDiskRetType) {
*arg = &val
}
type InstanceGetConsumedDiskArgType = string
type InstanceGetConsumedDiskRetType = string
/*
types and functions for consumed_object_storage
*/
// isNotNullableString
type InstanceGetConsumedObjectStorageAttributeType = *string
func getInstanceGetConsumedObjectStorageAttributeTypeOk(arg InstanceGetConsumedObjectStorageAttributeType) (ret InstanceGetConsumedObjectStorageRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetConsumedObjectStorageAttributeType(arg *InstanceGetConsumedObjectStorageAttributeType, val InstanceGetConsumedObjectStorageRetType) {
*arg = &val
}
type InstanceGetConsumedObjectStorageArgType = string
type InstanceGetConsumedObjectStorageRetType = string
/*
types and functions for created
*/
// isDateTime
type InstanceGetCreatedAttributeType = *time.Time
type InstanceGetCreatedArgType = time.Time
type InstanceGetCreatedRetType = time.Time
func getInstanceGetCreatedAttributeTypeOk(arg InstanceGetCreatedAttributeType) (ret InstanceGetCreatedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetCreatedAttributeType(arg *InstanceGetCreatedAttributeType, val InstanceGetCreatedRetType) {
*arg = &val
}
/*
types and functions for feature_toggle
*/
// isModel
type InstanceGetFeatureToggleAttributeType = *FeatureToggle
type InstanceGetFeatureToggleArgType = FeatureToggle
type InstanceGetFeatureToggleRetType = FeatureToggle
func getInstanceGetFeatureToggleAttributeTypeOk(arg InstanceGetFeatureToggleAttributeType) (ret InstanceGetFeatureToggleRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetFeatureToggleAttributeType(arg *InstanceGetFeatureToggleAttributeType, val InstanceGetFeatureToggleRetType) {
*arg = &val
}
/*
types and functions for flavor
*/
// isNotNullableString
type InstanceGetFlavorAttributeType = *string
func getInstanceGetFlavorAttributeTypeOk(arg InstanceGetFlavorAttributeType) (ret InstanceGetFlavorRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetFlavorAttributeType(arg *InstanceGetFlavorAttributeType, val InstanceGetFlavorRetType) {
*arg = &val
}
type InstanceGetFlavorArgType = string
type InstanceGetFlavorRetType = string
/*
types and functions for id
*/
// isNotNullableString
type InstanceGetIdAttributeType = *string
func getInstanceGetIdAttributeTypeOk(arg InstanceGetIdAttributeType) (ret InstanceGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetIdAttributeType(arg *InstanceGetIdAttributeType, val InstanceGetIdRetType) {
*arg = &val
}
type InstanceGetIdArgType = string
type InstanceGetIdRetType = string
/*
types and functions for name
*/
// isNotNullableString
type InstanceGetNameAttributeType = *string
func getInstanceGetNameAttributeTypeOk(arg InstanceGetNameAttributeType) (ret InstanceGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetNameAttributeType(arg *InstanceGetNameAttributeType, val InstanceGetNameRetType) {
*arg = &val
}
type InstanceGetNameArgType = string
type InstanceGetNameRetType = string
/*
types and functions for state
*/
// isEnum
// InstanceState The current state of the STACKIT Git instance.
// value type for enums
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 {
// 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 InstanceState
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 := 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 InstanceState) (*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 {
return ret, false
}
return *arg, true
}
func setInstanceGetStateAttributeType(arg *InstanceGetStateAttributeType, val InstanceGetStateRetType) {
*arg = &val
}
/*
types and functions for url
*/
// isNotNullableString
type InstanceGetUrlAttributeType = *string
func getInstanceGetUrlAttributeTypeOk(arg InstanceGetUrlAttributeType) (ret InstanceGetUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetUrlAttributeType(arg *InstanceGetUrlAttributeType, val InstanceGetUrlRetType) {
*arg = &val
}
type InstanceGetUrlArgType = string
type InstanceGetUrlRetType = string
/*
types and functions for version
*/
// isNotNullableString
type InstanceGetVersionAttributeType = *string
func getInstanceGetVersionAttributeTypeOk(arg InstanceGetVersionAttributeType) (ret InstanceGetVersionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetVersionAttributeType(arg *InstanceGetVersionAttributeType, val InstanceGetVersionRetType) {
*arg = &val
}
type InstanceGetVersionArgType = string
type InstanceGetVersionRetType = string
// Instance Describes a STACKIT Git instance.
type Instance struct {
// Restricted ACL for instance access.
// REQUIRED
Acl InstanceGetAclAttributeType `json:"acl" required:"true"`
// How many bytes of disk space is consumed. Read Only.
// REQUIRED
ConsumedDisk InstanceGetConsumedDiskAttributeType `json:"consumed_disk" required:"true"`
// How many bytes of Object Storage is consumed. Read Only.
// REQUIRED
ConsumedObjectStorage InstanceGetConsumedObjectStorageAttributeType `json:"consumed_object_storage" required:"true"`
// The date and time the creation of the STACKIT Git instance was triggered.
// REQUIRED
Created InstanceGetCreatedAttributeType `json:"created" required:"true"`
// REQUIRED
FeatureToggle InstanceGetFeatureToggleAttributeType `json:"feature_toggle" required:"true"`
// Instance flavor.
// REQUIRED
Flavor InstanceGetFlavorAttributeType `json:"flavor" required:"true"`
// A auto generated unique id which identifies the STACKIT Git instances.
// REQUIRED
Id InstanceGetIdAttributeType `json:"id" required:"true"`
// A user chosen name to distinguish multiple STACKIT Git instances.
// REQUIRED
Name InstanceGetNameAttributeType `json:"name" required:"true"`
// The current state of the STACKIT Git instance.
// REQUIRED
State InstanceGetStateAttributeType `json:"state" required:"true"`
// The URL for reaching the STACKIT Git instance.
// REQUIRED
Url InstanceGetUrlAttributeType `json:"url" required:"true"`
// The current version of STACKIT Git deployed to the instance.
// REQUIRED
Version InstanceGetVersionAttributeType `json:"version" required:"true"`
}
type _Instance Instance
// NewInstance instantiates a new Instance 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 NewInstance(acl InstanceGetAclArgType, consumedDisk InstanceGetConsumedDiskArgType, consumedObjectStorage InstanceGetConsumedObjectStorageArgType, created InstanceGetCreatedArgType, featureToggle InstanceGetFeatureToggleArgType, flavor InstanceGetFlavorArgType, id InstanceGetIdArgType, name InstanceGetNameArgType, state InstanceGetStateArgType, url InstanceGetUrlArgType, version InstanceGetVersionArgType) *Instance {
this := Instance{}
setInstanceGetAclAttributeType(&this.Acl, acl)
setInstanceGetConsumedDiskAttributeType(&this.ConsumedDisk, consumedDisk)
setInstanceGetConsumedObjectStorageAttributeType(&this.ConsumedObjectStorage, consumedObjectStorage)
setInstanceGetCreatedAttributeType(&this.Created, created)
setInstanceGetFeatureToggleAttributeType(&this.FeatureToggle, featureToggle)
setInstanceGetFlavorAttributeType(&this.Flavor, flavor)
setInstanceGetIdAttributeType(&this.Id, id)
setInstanceGetNameAttributeType(&this.Name, name)
setInstanceGetStateAttributeType(&this.State, state)
setInstanceGetUrlAttributeType(&this.Url, url)
setInstanceGetVersionAttributeType(&this.Version, version)
return &this
}
// NewInstanceWithDefaults instantiates a new Instance 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 NewInstanceWithDefaults() *Instance {
this := Instance{}
return &this
}
// GetAcl returns the Acl field value
func (o *Instance) GetAcl() (ret InstanceGetAclRetType) {
ret, _ = o.GetAclOk()
return ret
}
// GetAclOk returns a tuple with the Acl field value
// and a boolean to check if the value has been set.
func (o *Instance) GetAclOk() (ret InstanceGetAclRetType, ok bool) {
return getInstanceGetAclAttributeTypeOk(o.Acl)
}
// SetAcl sets field value
func (o *Instance) SetAcl(v InstanceGetAclRetType) {
setInstanceGetAclAttributeType(&o.Acl, v)
}
// GetConsumedDisk returns the ConsumedDisk field value
func (o *Instance) GetConsumedDisk() (ret InstanceGetConsumedDiskRetType) {
ret, _ = o.GetConsumedDiskOk()
return ret
}
// GetConsumedDiskOk returns a tuple with the ConsumedDisk field value
// and a boolean to check if the value has been set.
func (o *Instance) GetConsumedDiskOk() (ret InstanceGetConsumedDiskRetType, ok bool) {
return getInstanceGetConsumedDiskAttributeTypeOk(o.ConsumedDisk)
}
// SetConsumedDisk sets field value
func (o *Instance) SetConsumedDisk(v InstanceGetConsumedDiskRetType) {
setInstanceGetConsumedDiskAttributeType(&o.ConsumedDisk, v)
}
// GetConsumedObjectStorage returns the ConsumedObjectStorage field value
func (o *Instance) GetConsumedObjectStorage() (ret InstanceGetConsumedObjectStorageRetType) {
ret, _ = o.GetConsumedObjectStorageOk()
return ret
}
// GetConsumedObjectStorageOk returns a tuple with the ConsumedObjectStorage field value
// and a boolean to check if the value has been set.
func (o *Instance) GetConsumedObjectStorageOk() (ret InstanceGetConsumedObjectStorageRetType, ok bool) {
return getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage)
}
// SetConsumedObjectStorage sets field value
func (o *Instance) SetConsumedObjectStorage(v InstanceGetConsumedObjectStorageRetType) {
setInstanceGetConsumedObjectStorageAttributeType(&o.ConsumedObjectStorage, v)
}
// GetCreated returns the Created field value
func (o *Instance) GetCreated() (ret InstanceGetCreatedRetType) {
ret, _ = o.GetCreatedOk()
return ret
}
// GetCreatedOk returns a tuple with the Created field value
// and a boolean to check if the value has been set.
func (o *Instance) GetCreatedOk() (ret InstanceGetCreatedRetType, ok bool) {
return getInstanceGetCreatedAttributeTypeOk(o.Created)
}
// SetCreated sets field value
func (o *Instance) SetCreated(v InstanceGetCreatedRetType) {
setInstanceGetCreatedAttributeType(&o.Created, v)
}
// GetFeatureToggle returns the FeatureToggle field value
func (o *Instance) GetFeatureToggle() (ret InstanceGetFeatureToggleRetType) {
ret, _ = o.GetFeatureToggleOk()
return ret
}
// GetFeatureToggleOk returns a tuple with the FeatureToggle field value
// and a boolean to check if the value has been set.
func (o *Instance) GetFeatureToggleOk() (ret InstanceGetFeatureToggleRetType, ok bool) {
return getInstanceGetFeatureToggleAttributeTypeOk(o.FeatureToggle)
}
// SetFeatureToggle sets field value
func (o *Instance) SetFeatureToggle(v InstanceGetFeatureToggleRetType) {
setInstanceGetFeatureToggleAttributeType(&o.FeatureToggle, v)
}
// GetFlavor returns the Flavor field value
func (o *Instance) GetFlavor() (ret InstanceGetFlavorRetType) {
ret, _ = o.GetFlavorOk()
return ret
}
// GetFlavorOk returns a tuple with the Flavor field value
// and a boolean to check if the value has been set.
func (o *Instance) GetFlavorOk() (ret InstanceGetFlavorRetType, ok bool) {
return getInstanceGetFlavorAttributeTypeOk(o.Flavor)
}
// SetFlavor sets field value
func (o *Instance) SetFlavor(v InstanceGetFlavorRetType) {
setInstanceGetFlavorAttributeType(&o.Flavor, v)
}
// GetId returns the Id field value
func (o *Instance) GetId() (ret InstanceGetIdRetType) {
ret, _ = o.GetIdOk()
return ret
}
// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
func (o *Instance) GetIdOk() (ret InstanceGetIdRetType, ok bool) {
return getInstanceGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *Instance) SetId(v InstanceGetIdRetType) {
setInstanceGetIdAttributeType(&o.Id, v)
}
// GetName returns the Name field value
func (o *Instance) GetName() (ret InstanceGetNameRetType) {
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 *Instance) GetNameOk() (ret InstanceGetNameRetType, ok bool) {
return getInstanceGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *Instance) SetName(v InstanceGetNameRetType) {
setInstanceGetNameAttributeType(&o.Name, v)
}
// GetState returns the State field value
func (o *Instance) GetState() (ret InstanceGetStateRetType) {
ret, _ = o.GetStateOk()
return ret
}
// GetStateOk returns a tuple with the State field value
// and a boolean to check if the value has been set.
func (o *Instance) GetStateOk() (ret InstanceGetStateRetType, ok bool) {
return getInstanceGetStateAttributeTypeOk(o.State)
}
// SetState sets field value
func (o *Instance) SetState(v InstanceGetStateRetType) {
setInstanceGetStateAttributeType(&o.State, v)
}
// GetUrl returns the Url field value
func (o *Instance) GetUrl() (ret InstanceGetUrlRetType) {
ret, _ = o.GetUrlOk()
return ret
}
// GetUrlOk returns a tuple with the Url field value
// and a boolean to check if the value has been set.
func (o *Instance) GetUrlOk() (ret InstanceGetUrlRetType, ok bool) {
return getInstanceGetUrlAttributeTypeOk(o.Url)
}
// SetUrl sets field value
func (o *Instance) SetUrl(v InstanceGetUrlRetType) {
setInstanceGetUrlAttributeType(&o.Url, v)
}
// GetVersion returns the Version field value
func (o *Instance) GetVersion() (ret InstanceGetVersionRetType) {
ret, _ = o.GetVersionOk()
return ret
}
// GetVersionOk returns a tuple with the Version field value
// and a boolean to check if the value has been set.
func (o *Instance) GetVersionOk() (ret InstanceGetVersionRetType, ok bool) {
return getInstanceGetVersionAttributeTypeOk(o.Version)
}
// SetVersion sets field value
func (o *Instance) SetVersion(v InstanceGetVersionRetType) {
setInstanceGetVersionAttributeType(&o.Version, v)
}
func (o Instance) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getInstanceGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getInstanceGetConsumedDiskAttributeTypeOk(o.ConsumedDisk); ok {
toSerialize["ConsumedDisk"] = val
}
if val, ok := getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage); ok {
toSerialize["ConsumedObjectStorage"] = val
}
if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok {
toSerialize["Created"] = val
}
if val, ok := getInstanceGetFeatureToggleAttributeTypeOk(o.FeatureToggle); ok {
toSerialize["FeatureToggle"] = val
}
if val, ok := getInstanceGetFlavorAttributeTypeOk(o.Flavor); ok {
toSerialize["Flavor"] = val
}
if val, ok := getInstanceGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getInstanceGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getInstanceGetStateAttributeTypeOk(o.State); ok {
toSerialize["State"] = val
}
if val, ok := getInstanceGetUrlAttributeTypeOk(o.Url); ok {
toSerialize["Url"] = val
}
if val, ok := getInstanceGetVersionAttributeTypeOk(o.Version); ok {
toSerialize["Version"] = val
}
return toSerialize, nil
}
type NullableInstance struct {
value *Instance
isSet bool
}
func (v NullableInstance) Get() *Instance {
return v.value
}
func (v *NullableInstance) Set(val *Instance) {
v.value = val
v.isSet = true
}
func (v NullableInstance) IsSet() bool {
return v.isSet
}
func (v *NullableInstance) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInstance(val *Instance) *NullableInstance {
return &NullableInstance{value: val, isSet: true}
}
func (v NullableInstance) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInstance) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}