/* STACKIT Key Management Service API ### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. API version: 1beta.0.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package kmsbeta import ( "encoding/json" "fmt" ) // AccessScope The access scope of the key. type AccessScope string // List of access_scope const ( ACCESSSCOPE_PUBLIC AccessScope = "PUBLIC" ACCESSSCOPE_SNA AccessScope = "SNA" ) // All allowed values of AccessScope enum var AllowedAccessScopeEnumValues = []AccessScope{ "PUBLIC", "SNA", } func (v *AccessScope) UnmarshalJSON(src []byte) error { var value string err := json.Unmarshal(src, &value) if err != nil { return err } // Allow unmarshalling zero value for testing purposes var zeroValue string if value == zeroValue { return nil } enumTypeValue := AccessScope(value) for _, existing := range AllowedAccessScopeEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid AccessScope", value) } // NewAccessScopeFromValue returns a pointer to a valid AccessScope // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewAccessScopeFromValue(v string) (*AccessScope, error) { ev := AccessScope(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for AccessScope: valid values are %v", v, AllowedAccessScopeEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v AccessScope) IsValid() bool { for _, existing := range AllowedAccessScopeEnumValues { if existing == v { return true } } return false } // Ptr returns reference to access_scope value func (v AccessScope) Ptr() *AccessScope { return &v } type NullableAccessScope struct { value *AccessScope isSet bool } func (v NullableAccessScope) Get() *AccessScope { return v.value } func (v *NullableAccessScope) Set(val *AccessScope) { v.value = val v.isSet = true } func (v NullableAccessScope) IsSet() bool { return v.isSet } func (v *NullableAccessScope) Unset() { v.value = nil v.isSet = false } func NewNullableAccessScope(val *AccessScope) *NullableAccessScope { return &NullableAccessScope{value: val, isSet: true} } func (v NullableAccessScope) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableAccessScope) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }