/* STACKIT MSSQL Service API This is the documentation for the STACKIT MSSQL service API version: 3alpha1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package sqlserverflexalpha import ( "encoding/json" "fmt" ) // checks if the SourceBackup type satisfies the MappedNullable interface at compile time var _ MappedNullable = &SourceBackup{} /* types and functions for type */ // isEnum // SourceBackupTypes the model 'SourceBackup' // value type for enums type SourceBackupTypes string // List of Type const ( SOURCEBACKUPTYPE_BACKUP SourceBackupTypes = "BACKUP" ) // All allowed values of SourceBackup enum var AllowedSourceBackupTypesEnumValues = []SourceBackupTypes{ "BACKUP", } func (v *SourceBackupTypes) 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 SourceBackupTypes 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 := SourceBackupTypes(value) for _, existing := range AllowedSourceBackupTypesEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid SourceBackup", value) } // NewSourceBackupTypesFromValue returns a pointer to a valid SourceBackupTypes // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewSourceBackupTypesFromValue(v SourceBackupTypes) (*SourceBackupTypes, error) { ev := SourceBackupTypes(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for SourceBackupTypes: valid values are %v", v, AllowedSourceBackupTypesEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v SourceBackupTypes) IsValid() bool { for _, existing := range AllowedSourceBackupTypesEnumValues { if existing == v { return true } } return false } // Ptr returns reference to TypeTypes value func (v SourceBackupTypes) Ptr() *SourceBackupTypes { return &v } type NullableSourceBackupTypes struct { value *SourceBackupTypes isSet bool } func (v NullableSourceBackupTypes) Get() *SourceBackupTypes { return v.value } func (v *NullableSourceBackupTypes) Set(val *SourceBackupTypes) { v.value = val v.isSet = true } func (v NullableSourceBackupTypes) IsSet() bool { return v.isSet } func (v *NullableSourceBackupTypes) Unset() { v.value = nil v.isSet = false } func NewNullableSourceBackupTypes(val *SourceBackupTypes) *NullableSourceBackupTypes { return &NullableSourceBackupTypes{value: val, isSet: true} } func (v NullableSourceBackupTypes) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableSourceBackupTypes) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } type SourceBackupGetTypeAttributeType = *SourceBackupTypes type SourceBackupGetTypeArgType = SourceBackupTypes type SourceBackupGetTypeRetType = SourceBackupTypes func getSourceBackupGetTypeAttributeTypeOk(arg SourceBackupGetTypeAttributeType) (ret SourceBackupGetTypeRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setSourceBackupGetTypeAttributeType(arg *SourceBackupGetTypeAttributeType, val SourceBackupGetTypeRetType) { *arg = &val } // SourceBackup Restore from an existing managed backup. type SourceBackup struct { // REQUIRED Type SourceBackupGetTypeAttributeType `json:"type" required:"true"` } type _SourceBackup SourceBackup // NewSourceBackup instantiates a new SourceBackup 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 NewSourceBackup(types SourceBackupGetTypeArgType) *SourceBackup { this := SourceBackup{} setSourceBackupGetTypeAttributeType(&this.Type, types) return &this } // NewSourceBackupWithDefaults instantiates a new SourceBackup 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 NewSourceBackupWithDefaults() *SourceBackup { this := SourceBackup{} return &this } // GetType returns the Type field value func (o *SourceBackup) GetType() (ret SourceBackupGetTypeRetType) { ret, _ = o.GetTypeOk() return ret } // GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. func (o *SourceBackup) GetTypeOk() (ret SourceBackupGetTypeRetType, ok bool) { return getSourceBackupGetTypeAttributeTypeOk(o.Type) } // SetType sets field value func (o *SourceBackup) SetType(v SourceBackupGetTypeRetType) { setSourceBackupGetTypeAttributeType(&o.Type, v) } func (o SourceBackup) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getSourceBackupGetTypeAttributeTypeOk(o.Type); ok { toSerialize["Type"] = val } return toSerialize, nil } type NullableSourceBackup struct { value *SourceBackup isSet bool } func (v NullableSourceBackup) Get() *SourceBackup { return v.value } func (v *NullableSourceBackup) Set(val *SourceBackup) { v.value = val v.isSet = true } func (v NullableSourceBackup) IsSet() bool { return v.isSet } func (v *NullableSourceBackup) Unset() { v.value = nil v.isSet = false } func NewNullableSourceBackup(val *SourceBackup) *NullableSourceBackup { return &NullableSourceBackup{value: val, isSet: true} } func (v NullableSourceBackup) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableSourceBackup) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }