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

509 lines
14 KiB
Go

/*
STACKIT Edge Cloud API
This API provides endpoints for managing STACKIT Edge Cloud instances.
API version: 1beta1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package edgebeta
import (
"encoding/json"
"fmt"
"time"
)
// checks if the Instance type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Instance{}
/*
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 description
*/
// isNotNullableString
type InstanceGetDescriptionAttributeType = *string
func getInstanceGetDescriptionAttributeTypeOk(arg InstanceGetDescriptionAttributeType) (ret InstanceGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetDescriptionAttributeType(arg *InstanceGetDescriptionAttributeType, val InstanceGetDescriptionRetType) {
*arg = &val
}
type InstanceGetDescriptionArgType = string
type InstanceGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type InstanceGetDisplayNameAttributeType = *string
func getInstanceGetDisplayNameAttributeTypeOk(arg InstanceGetDisplayNameAttributeType) (ret InstanceGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetDisplayNameAttributeType(arg *InstanceGetDisplayNameAttributeType, val InstanceGetDisplayNameRetType) {
*arg = &val
}
type InstanceGetDisplayNameArgType = string
type InstanceGetDisplayNameRetType = string
/*
types and functions for frontendUrl
*/
// isNotNullableString
type InstanceGetFrontendUrlAttributeType = *string
func getInstanceGetFrontendUrlAttributeTypeOk(arg InstanceGetFrontendUrlAttributeType) (ret InstanceGetFrontendUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetFrontendUrlAttributeType(arg *InstanceGetFrontendUrlAttributeType, val InstanceGetFrontendUrlRetType) {
*arg = &val
}
type InstanceGetFrontendUrlArgType = string
type InstanceGetFrontendUrlRetType = 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 planId
*/
// isNotNullableString
type InstanceGetPlanIdAttributeType = *string
func getInstanceGetPlanIdAttributeTypeOk(arg InstanceGetPlanIdAttributeType) (ret InstanceGetPlanIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetPlanIdAttributeType(arg *InstanceGetPlanIdAttributeType, val InstanceGetPlanIdRetType) {
*arg = &val
}
type InstanceGetPlanIdArgType = string
type InstanceGetPlanIdRetType = string
/*
types and functions for status
*/
// isEnum
// InstanceStatus The current status of the instance.
// value type for enums
type InstanceStatus string
// List of Status
const (
INSTANCESTATUS_ERROR InstanceStatus = "error"
INSTANCESTATUS_RECONCILING InstanceStatus = "reconciling"
INSTANCESTATUS_ACTIVE InstanceStatus = "active"
INSTANCESTATUS_DELETING InstanceStatus = "deleting"
)
// All allowed values of Instance enum
var AllowedInstanceStatusEnumValues = []InstanceStatus{
"error",
"reconciling",
"active",
"deleting",
}
func (v *InstanceStatus) 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 InstanceStatus
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 := 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 InstanceStatus) (*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 {
return ret, false
}
return *arg, true
}
func setInstanceGetStatusAttributeType(arg *InstanceGetStatusAttributeType, val InstanceGetStatusRetType) {
*arg = &val
}
// Instance struct for Instance
type Instance struct {
// The date and time the creation of the instance was triggered.
// REQUIRED
Created InstanceGetCreatedAttributeType `json:"created" required:"true"`
// A user chosen description to distinguish multiple instances.
Description InstanceGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name of the instance.
// REQUIRED
DisplayName InstanceGetDisplayNameAttributeType `json:"displayName" required:"true"`
// URL to the Management UI of the Instance.
// REQUIRED
FrontendUrl InstanceGetFrontendUrlAttributeType `json:"frontendUrl" required:"true"`
// A auto generated unique id which identifies the instance.
// REQUIRED
Id InstanceGetIdAttributeType `json:"id" required:"true"`
// Service Plan configures the size of the Instance.
// REQUIRED
PlanId InstanceGetPlanIdAttributeType `json:"planId" required:"true"`
// The current status of the instance.
// REQUIRED
Status InstanceGetStatusAttributeType `json:"status" 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(created InstanceGetCreatedArgType, displayName InstanceGetDisplayNameArgType, frontendUrl InstanceGetFrontendUrlArgType, id InstanceGetIdArgType, planId InstanceGetPlanIdArgType, status InstanceGetStatusArgType) *Instance {
this := Instance{}
setInstanceGetCreatedAttributeType(&this.Created, created)
setInstanceGetDisplayNameAttributeType(&this.DisplayName, displayName)
setInstanceGetFrontendUrlAttributeType(&this.FrontendUrl, frontendUrl)
setInstanceGetIdAttributeType(&this.Id, id)
setInstanceGetPlanIdAttributeType(&this.PlanId, planId)
setInstanceGetStatusAttributeType(&this.Status, status)
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
}
// 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)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *Instance) GetDescription() (res InstanceGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Instance) GetDescriptionOk() (ret InstanceGetDescriptionRetType, ok bool) {
return getInstanceGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *Instance) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *Instance) SetDescription(v InstanceGetDescriptionRetType) {
setInstanceGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *Instance) GetDisplayName() (ret InstanceGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *Instance) GetDisplayNameOk() (ret InstanceGetDisplayNameRetType, ok bool) {
return getInstanceGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *Instance) SetDisplayName(v InstanceGetDisplayNameRetType) {
setInstanceGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetFrontendUrl returns the FrontendUrl field value
func (o *Instance) GetFrontendUrl() (ret InstanceGetFrontendUrlRetType) {
ret, _ = o.GetFrontendUrlOk()
return ret
}
// GetFrontendUrlOk returns a tuple with the FrontendUrl field value
// and a boolean to check if the value has been set.
func (o *Instance) GetFrontendUrlOk() (ret InstanceGetFrontendUrlRetType, ok bool) {
return getInstanceGetFrontendUrlAttributeTypeOk(o.FrontendUrl)
}
// SetFrontendUrl sets field value
func (o *Instance) SetFrontendUrl(v InstanceGetFrontendUrlRetType) {
setInstanceGetFrontendUrlAttributeType(&o.FrontendUrl, 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)
}
// GetPlanId returns the PlanId field value
func (o *Instance) GetPlanId() (ret InstanceGetPlanIdRetType) {
ret, _ = o.GetPlanIdOk()
return ret
}
// GetPlanIdOk returns a tuple with the PlanId field value
// and a boolean to check if the value has been set.
func (o *Instance) GetPlanIdOk() (ret InstanceGetPlanIdRetType, ok bool) {
return getInstanceGetPlanIdAttributeTypeOk(o.PlanId)
}
// SetPlanId sets field value
func (o *Instance) SetPlanId(v InstanceGetPlanIdRetType) {
setInstanceGetPlanIdAttributeType(&o.PlanId, v)
}
// GetStatus returns the Status field value
func (o *Instance) GetStatus() (ret InstanceGetStatusRetType) {
ret, _ = o.GetStatusOk()
return ret
}
// GetStatusOk returns a tuple with the Status field value
// and a boolean to check if the value has been set.
func (o *Instance) GetStatusOk() (ret InstanceGetStatusRetType, ok bool) {
return getInstanceGetStatusAttributeTypeOk(o.Status)
}
// SetStatus sets field value
func (o *Instance) SetStatus(v InstanceGetStatusRetType) {
setInstanceGetStatusAttributeType(&o.Status, v)
}
func (o Instance) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok {
toSerialize["Created"] = val
}
if val, ok := getInstanceGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getInstanceGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getInstanceGetFrontendUrlAttributeTypeOk(o.FrontendUrl); ok {
toSerialize["FrontendUrl"] = val
}
if val, ok := getInstanceGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getInstanceGetPlanIdAttributeTypeOk(o.PlanId); ok {
toSerialize["PlanId"] = val
}
if val, ok := getInstanceGetStatusAttributeTypeOk(o.Status); ok {
toSerialize["Status"] = 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)
}