terraform-provider-stackitp.../pkg/vpnalpha/model_api_error_detail.go
2026-01-21 09:07:29 +01:00

326 lines
9.6 KiB
Go

/*
STACKIT VPN API
The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project.
API version: 1alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package vpnalpha
import (
"encoding/json"
"fmt"
)
// checks if the APIErrorDetail type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &APIErrorDetail{}
/*
types and functions for domain
*/
// isNotNullableString
type APIErrorDetailGetDomainAttributeType = *string
func getAPIErrorDetailGetDomainAttributeTypeOk(arg APIErrorDetailGetDomainAttributeType) (ret APIErrorDetailGetDomainRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAPIErrorDetailGetDomainAttributeType(arg *APIErrorDetailGetDomainAttributeType, val APIErrorDetailGetDomainRetType) {
*arg = &val
}
type APIErrorDetailGetDomainArgType = string
type APIErrorDetailGetDomainRetType = string
/*
types and functions for metadata
*/
// isFreeform
type APIErrorDetailGetMetadataAttributeType = *map[string]interface{}
type APIErrorDetailGetMetadataArgType = map[string]interface{}
type APIErrorDetailGetMetadataRetType = map[string]interface{}
func getAPIErrorDetailGetMetadataAttributeTypeOk(arg APIErrorDetailGetMetadataAttributeType) (ret APIErrorDetailGetMetadataRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAPIErrorDetailGetMetadataAttributeType(arg *APIErrorDetailGetMetadataAttributeType, val APIErrorDetailGetMetadataRetType) {
*arg = &val
}
/*
types and functions for reason
*/
// isEnum
// APIErrorDetailReason The reason why the error occurs.
// value type for enums
type APIErrorDetailReason string
// List of Reason
const (
APIERRORDETAILREASON_FIELD APIErrorDetailReason = "INVALID_FIELD"
APIERRORDETAILREASON_PATH_PARAMETER APIErrorDetailReason = "INVALID_PATH_PARAMETER"
)
// All allowed values of APIErrorDetail enum
var AllowedAPIErrorDetailReasonEnumValues = []APIErrorDetailReason{
"INVALID_FIELD",
"INVALID_PATH_PARAMETER",
}
func (v *APIErrorDetailReason) 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 APIErrorDetailReason
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 := APIErrorDetailReason(value)
for _, existing := range AllowedAPIErrorDetailReasonEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid APIErrorDetail", value)
}
// NewAPIErrorDetailReasonFromValue returns a pointer to a valid APIErrorDetailReason
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewAPIErrorDetailReasonFromValue(v APIErrorDetailReason) (*APIErrorDetailReason, error) {
ev := APIErrorDetailReason(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for APIErrorDetailReason: valid values are %v", v, AllowedAPIErrorDetailReasonEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v APIErrorDetailReason) IsValid() bool {
for _, existing := range AllowedAPIErrorDetailReasonEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to ReasonReason value
func (v APIErrorDetailReason) Ptr() *APIErrorDetailReason {
return &v
}
type NullableAPIErrorDetailReason struct {
value *APIErrorDetailReason
isSet bool
}
func (v NullableAPIErrorDetailReason) Get() *APIErrorDetailReason {
return v.value
}
func (v *NullableAPIErrorDetailReason) Set(val *APIErrorDetailReason) {
v.value = val
v.isSet = true
}
func (v NullableAPIErrorDetailReason) IsSet() bool {
return v.isSet
}
func (v *NullableAPIErrorDetailReason) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAPIErrorDetailReason(val *APIErrorDetailReason) *NullableAPIErrorDetailReason {
return &NullableAPIErrorDetailReason{value: val, isSet: true}
}
func (v NullableAPIErrorDetailReason) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAPIErrorDetailReason) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type APIErrorDetailGetReasonAttributeType = *APIErrorDetailReason
type APIErrorDetailGetReasonArgType = APIErrorDetailReason
type APIErrorDetailGetReasonRetType = APIErrorDetailReason
func getAPIErrorDetailGetReasonAttributeTypeOk(arg APIErrorDetailGetReasonAttributeType) (ret APIErrorDetailGetReasonRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAPIErrorDetailGetReasonAttributeType(arg *APIErrorDetailGetReasonAttributeType, val APIErrorDetailGetReasonRetType) {
*arg = &val
}
// APIErrorDetail struct for APIErrorDetail
type APIErrorDetail struct {
// The domain of the error source.
// REQUIRED
Domain APIErrorDetailGetDomainAttributeType `json:"domain" required:"true"`
// Metadata contains more information. For bad requests this would be field information.
Metadata APIErrorDetailGetMetadataAttributeType `json:"metadata,omitempty"`
// The reason why the error occurs.
// REQUIRED
Reason APIErrorDetailGetReasonAttributeType `json:"reason" required:"true"`
}
type _APIErrorDetail APIErrorDetail
// NewAPIErrorDetail instantiates a new APIErrorDetail 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 NewAPIErrorDetail(domain APIErrorDetailGetDomainArgType, reason APIErrorDetailGetReasonArgType) *APIErrorDetail {
this := APIErrorDetail{}
setAPIErrorDetailGetDomainAttributeType(&this.Domain, domain)
setAPIErrorDetailGetReasonAttributeType(&this.Reason, reason)
return &this
}
// NewAPIErrorDetailWithDefaults instantiates a new APIErrorDetail 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 NewAPIErrorDetailWithDefaults() *APIErrorDetail {
this := APIErrorDetail{}
var domain string = "vpn.access.stackit.cloud"
this.Domain = &domain
return &this
}
// GetDomain returns the Domain field value
func (o *APIErrorDetail) GetDomain() (ret APIErrorDetailGetDomainRetType) {
ret, _ = o.GetDomainOk()
return ret
}
// GetDomainOk returns a tuple with the Domain field value
// and a boolean to check if the value has been set.
func (o *APIErrorDetail) GetDomainOk() (ret APIErrorDetailGetDomainRetType, ok bool) {
return getAPIErrorDetailGetDomainAttributeTypeOk(o.Domain)
}
// SetDomain sets field value
func (o *APIErrorDetail) SetDomain(v APIErrorDetailGetDomainRetType) {
setAPIErrorDetailGetDomainAttributeType(&o.Domain, v)
}
// GetMetadata returns the Metadata field value if set, zero value otherwise.
func (o *APIErrorDetail) GetMetadata() (res APIErrorDetailGetMetadataRetType) {
res, _ = o.GetMetadataOk()
return
}
// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *APIErrorDetail) GetMetadataOk() (ret APIErrorDetailGetMetadataRetType, ok bool) {
return getAPIErrorDetailGetMetadataAttributeTypeOk(o.Metadata)
}
// HasMetadata returns a boolean if a field has been set.
func (o *APIErrorDetail) HasMetadata() bool {
_, ok := o.GetMetadataOk()
return ok
}
// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field.
func (o *APIErrorDetail) SetMetadata(v APIErrorDetailGetMetadataRetType) {
setAPIErrorDetailGetMetadataAttributeType(&o.Metadata, v)
}
// GetReason returns the Reason field value
func (o *APIErrorDetail) GetReason() (ret APIErrorDetailGetReasonRetType) {
ret, _ = o.GetReasonOk()
return ret
}
// GetReasonOk returns a tuple with the Reason field value
// and a boolean to check if the value has been set.
func (o *APIErrorDetail) GetReasonOk() (ret APIErrorDetailGetReasonRetType, ok bool) {
return getAPIErrorDetailGetReasonAttributeTypeOk(o.Reason)
}
// SetReason sets field value
func (o *APIErrorDetail) SetReason(v APIErrorDetailGetReasonRetType) {
setAPIErrorDetailGetReasonAttributeType(&o.Reason, v)
}
func (o APIErrorDetail) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAPIErrorDetailGetDomainAttributeTypeOk(o.Domain); ok {
toSerialize["Domain"] = val
}
if val, ok := getAPIErrorDetailGetMetadataAttributeTypeOk(o.Metadata); ok {
toSerialize["Metadata"] = val
}
if val, ok := getAPIErrorDetailGetReasonAttributeTypeOk(o.Reason); ok {
toSerialize["Reason"] = val
}
return toSerialize, nil
}
type NullableAPIErrorDetail struct {
value *APIErrorDetail
isSet bool
}
func (v NullableAPIErrorDetail) Get() *APIErrorDetail {
return v.value
}
func (v *NullableAPIErrorDetail) Set(val *APIErrorDetail) {
v.value = val
v.isSet = true
}
func (v NullableAPIErrorDetail) IsSet() bool {
return v.isSet
}
func (v *NullableAPIErrorDetail) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAPIErrorDetail(val *APIErrorDetail) *NullableAPIErrorDetail {
return &NullableAPIErrorDetail{value: val, isSet: true}
}
func (v NullableAPIErrorDetail) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAPIErrorDetail) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}