/* 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" "time" ) // checks if the Key type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Key{} /* types and functions for access_scope */ // isEnumRef type KeyGetAccessScopeAttributeType = *AccessScope type KeyGetAccessScopeArgType = AccessScope type KeyGetAccessScopeRetType = AccessScope func getKeyGetAccessScopeAttributeTypeOk(arg KeyGetAccessScopeAttributeType) (ret KeyGetAccessScopeRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetAccessScopeAttributeType(arg *KeyGetAccessScopeAttributeType, val KeyGetAccessScopeRetType) { *arg = &val } /* types and functions for algorithm */ // isEnumRef type KeyGetAlgorithmAttributeType = *Algorithm type KeyGetAlgorithmArgType = Algorithm type KeyGetAlgorithmRetType = Algorithm func getKeyGetAlgorithmAttributeTypeOk(arg KeyGetAlgorithmAttributeType) (ret KeyGetAlgorithmRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetAlgorithmAttributeType(arg *KeyGetAlgorithmAttributeType, val KeyGetAlgorithmRetType) { *arg = &val } /* types and functions for backend */ // isEnumRef type KeyGetBackendAttributeType = *Backend type KeyGetBackendArgType = Backend type KeyGetBackendRetType = Backend func getKeyGetBackendAttributeTypeOk(arg KeyGetBackendAttributeType) (ret KeyGetBackendRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetBackendAttributeType(arg *KeyGetBackendAttributeType, val KeyGetBackendRetType) { *arg = &val } /* types and functions for createdAt */ // isDateTime type KeyGetCreatedAtAttributeType = *time.Time type KeyGetCreatedAtArgType = time.Time type KeyGetCreatedAtRetType = time.Time func getKeyGetCreatedAtAttributeTypeOk(arg KeyGetCreatedAtAttributeType) (ret KeyGetCreatedAtRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetCreatedAtAttributeType(arg *KeyGetCreatedAtAttributeType, val KeyGetCreatedAtRetType) { *arg = &val } /* types and functions for deletionDate */ // isDateTime type KeyGetDeletionDateAttributeType = *time.Time type KeyGetDeletionDateArgType = time.Time type KeyGetDeletionDateRetType = time.Time func getKeyGetDeletionDateAttributeTypeOk(arg KeyGetDeletionDateAttributeType) (ret KeyGetDeletionDateRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetDeletionDateAttributeType(arg *KeyGetDeletionDateAttributeType, val KeyGetDeletionDateRetType) { *arg = &val } /* types and functions for description */ // isNotNullableString type KeyGetDescriptionAttributeType = *string func getKeyGetDescriptionAttributeTypeOk(arg KeyGetDescriptionAttributeType) (ret KeyGetDescriptionRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetDescriptionAttributeType(arg *KeyGetDescriptionAttributeType, val KeyGetDescriptionRetType) { *arg = &val } type KeyGetDescriptionArgType = string type KeyGetDescriptionRetType = string /* types and functions for displayName */ // isNotNullableString type KeyGetDisplayNameAttributeType = *string func getKeyGetDisplayNameAttributeTypeOk(arg KeyGetDisplayNameAttributeType) (ret KeyGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetDisplayNameAttributeType(arg *KeyGetDisplayNameAttributeType, val KeyGetDisplayNameRetType) { *arg = &val } type KeyGetDisplayNameArgType = string type KeyGetDisplayNameRetType = string /* types and functions for id */ // isNotNullableString type KeyGetIdAttributeType = *string func getKeyGetIdAttributeTypeOk(arg KeyGetIdAttributeType) (ret KeyGetIdRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetIdAttributeType(arg *KeyGetIdAttributeType, val KeyGetIdRetType) { *arg = &val } type KeyGetIdArgType = string type KeyGetIdRetType = string /* types and functions for importOnly */ // isBoolean type KeygetImportOnlyAttributeType = *bool type KeygetImportOnlyArgType = bool type KeygetImportOnlyRetType = bool func getKeygetImportOnlyAttributeTypeOk(arg KeygetImportOnlyAttributeType) (ret KeygetImportOnlyRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeygetImportOnlyAttributeType(arg *KeygetImportOnlyAttributeType, val KeygetImportOnlyRetType) { *arg = &val } /* types and functions for keyRingId */ // isNotNullableString type KeyGetKeyRingIdAttributeType = *string func getKeyGetKeyRingIdAttributeTypeOk(arg KeyGetKeyRingIdAttributeType) (ret KeyGetKeyRingIdRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetKeyRingIdAttributeType(arg *KeyGetKeyRingIdAttributeType, val KeyGetKeyRingIdRetType) { *arg = &val } type KeyGetKeyRingIdArgType = string type KeyGetKeyRingIdRetType = string /* types and functions for protection */ // isEnumRef type KeyGetProtectionAttributeType = *Protection type KeyGetProtectionArgType = Protection type KeyGetProtectionRetType = Protection func getKeyGetProtectionAttributeTypeOk(arg KeyGetProtectionAttributeType) (ret KeyGetProtectionRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetProtectionAttributeType(arg *KeyGetProtectionAttributeType, val KeyGetProtectionRetType) { *arg = &val } /* types and functions for purpose */ // isEnumRef type KeyGetPurposeAttributeType = *Purpose type KeyGetPurposeArgType = Purpose type KeyGetPurposeRetType = Purpose func getKeyGetPurposeAttributeTypeOk(arg KeyGetPurposeAttributeType) (ret KeyGetPurposeRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetPurposeAttributeType(arg *KeyGetPurposeAttributeType, val KeyGetPurposeRetType) { *arg = &val } /* types and functions for state */ // isEnum // KeyState The current state of the key. // value type for enums type KeyState string // List of State const ( KEYSTATE_ACTIVE KeyState = "active" KEYSTATE_DELETED KeyState = "deleted" KEYSTATE_NOT_AVAILABLE KeyState = "not_available" KEYSTATE_ERRORS_EXIST KeyState = "errors_exist" KEYSTATE_CREATING KeyState = "creating" KEYSTATE_NO_VERSION KeyState = "no_version" ) // All allowed values of Key enum var AllowedKeyStateEnumValues = []KeyState{ "active", "deleted", "not_available", "errors_exist", "creating", "no_version", } func (v *KeyState) 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 KeyState 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 := KeyState(value) for _, existing := range AllowedKeyStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid Key", value) } // NewKeyStateFromValue returns a pointer to a valid KeyState // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewKeyStateFromValue(v KeyState) (*KeyState, error) { ev := KeyState(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for KeyState: valid values are %v", v, AllowedKeyStateEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v KeyState) IsValid() bool { for _, existing := range AllowedKeyStateEnumValues { if existing == v { return true } } return false } // Ptr returns reference to StateState value func (v KeyState) Ptr() *KeyState { return &v } type NullableKeyState struct { value *KeyState isSet bool } func (v NullableKeyState) Get() *KeyState { return v.value } func (v *NullableKeyState) Set(val *KeyState) { v.value = val v.isSet = true } func (v NullableKeyState) IsSet() bool { return v.isSet } func (v *NullableKeyState) Unset() { v.value = nil v.isSet = false } func NewNullableKeyState(val *KeyState) *NullableKeyState { return &NullableKeyState{value: val, isSet: true} } func (v NullableKeyState) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableKeyState) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } type KeyGetStateAttributeType = *KeyState type KeyGetStateArgType = KeyState type KeyGetStateRetType = KeyState func getKeyGetStateAttributeTypeOk(arg KeyGetStateAttributeType) (ret KeyGetStateRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setKeyGetStateAttributeType(arg *KeyGetStateAttributeType, val KeyGetStateRetType) { *arg = &val } // Key struct for Key type Key struct { // REQUIRED AccessScope KeyGetAccessScopeAttributeType `json:"access_scope" required:"true"` // REQUIRED Algorithm KeyGetAlgorithmAttributeType `json:"algorithm" required:"true"` // Deprecated: Check the GitHub changelog for alternatives // REQUIRED Backend KeyGetBackendAttributeType `json:"backend" required:"true"` // The date and time the creation of the key was triggered. // REQUIRED CreatedAt KeyGetCreatedAtAttributeType `json:"createdAt" required:"true"` // This date is set when a key is pending deletion and refers to the scheduled date of deletion DeletionDate KeyGetDeletionDateAttributeType `json:"deletionDate,omitempty"` // A user chosen description to distinguish multiple keys. // REQUIRED Description KeyGetDescriptionAttributeType `json:"description" required:"true"` // The display name to distinguish multiple keys. // REQUIRED DisplayName KeyGetDisplayNameAttributeType `json:"displayName" required:"true"` // A auto generated unique id which identifies the keys. // REQUIRED Id KeyGetIdAttributeType `json:"id" required:"true"` // States whether versions can be created or only imported. // REQUIRED ImportOnly KeygetImportOnlyAttributeType `json:"importOnly" required:"true"` // The unique id of the key ring this key is assigned to. // REQUIRED KeyRingId KeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` // REQUIRED Protection KeyGetProtectionAttributeType `json:"protection" required:"true"` // REQUIRED Purpose KeyGetPurposeAttributeType `json:"purpose" required:"true"` // The current state of the key. // REQUIRED State KeyGetStateAttributeType `json:"state" required:"true"` } type _Key Key // NewKey instantiates a new Key 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 NewKey(accessScope KeyGetAccessScopeArgType, algorithm KeyGetAlgorithmArgType, backend KeyGetBackendArgType, createdAt KeyGetCreatedAtArgType, description KeyGetDescriptionArgType, displayName KeyGetDisplayNameArgType, id KeyGetIdArgType, importOnly KeygetImportOnlyArgType, keyRingId KeyGetKeyRingIdArgType, protection KeyGetProtectionArgType, purpose KeyGetPurposeArgType, state KeyGetStateArgType) *Key { this := Key{} setKeyGetAccessScopeAttributeType(&this.AccessScope, accessScope) setKeyGetAlgorithmAttributeType(&this.Algorithm, algorithm) setKeyGetBackendAttributeType(&this.Backend, backend) setKeyGetCreatedAtAttributeType(&this.CreatedAt, createdAt) setKeyGetDescriptionAttributeType(&this.Description, description) setKeyGetDisplayNameAttributeType(&this.DisplayName, displayName) setKeyGetIdAttributeType(&this.Id, id) setKeygetImportOnlyAttributeType(&this.ImportOnly, importOnly) setKeyGetKeyRingIdAttributeType(&this.KeyRingId, keyRingId) setKeyGetProtectionAttributeType(&this.Protection, protection) setKeyGetPurposeAttributeType(&this.Purpose, purpose) setKeyGetStateAttributeType(&this.State, state) return &this } // NewKeyWithDefaults instantiates a new Key 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 NewKeyWithDefaults() *Key { this := Key{} var accessScope AccessScope = ACCESSSCOPE_PUBLIC this.AccessScope = &accessScope var importOnly bool = false this.ImportOnly = &importOnly return &this } // GetAccessScope returns the AccessScope field value func (o *Key) GetAccessScope() (ret KeyGetAccessScopeRetType) { ret, _ = o.GetAccessScopeOk() return ret } // GetAccessScopeOk returns a tuple with the AccessScope field value // and a boolean to check if the value has been set. func (o *Key) GetAccessScopeOk() (ret KeyGetAccessScopeRetType, ok bool) { return getKeyGetAccessScopeAttributeTypeOk(o.AccessScope) } // SetAccessScope sets field value func (o *Key) SetAccessScope(v KeyGetAccessScopeRetType) { setKeyGetAccessScopeAttributeType(&o.AccessScope, v) } // GetAlgorithm returns the Algorithm field value func (o *Key) GetAlgorithm() (ret KeyGetAlgorithmRetType) { ret, _ = o.GetAlgorithmOk() return ret } // GetAlgorithmOk returns a tuple with the Algorithm field value // and a boolean to check if the value has been set. func (o *Key) GetAlgorithmOk() (ret KeyGetAlgorithmRetType, ok bool) { return getKeyGetAlgorithmAttributeTypeOk(o.Algorithm) } // SetAlgorithm sets field value func (o *Key) SetAlgorithm(v KeyGetAlgorithmRetType) { setKeyGetAlgorithmAttributeType(&o.Algorithm, v) } // GetBackend returns the Backend field value // Deprecated func (o *Key) GetBackend() (ret KeyGetBackendRetType) { ret, _ = o.GetBackendOk() return ret } // GetBackendOk returns a tuple with the Backend field value // and a boolean to check if the value has been set. // Deprecated func (o *Key) GetBackendOk() (ret KeyGetBackendRetType, ok bool) { return getKeyGetBackendAttributeTypeOk(o.Backend) } // SetBackend sets field value // Deprecated func (o *Key) SetBackend(v KeyGetBackendRetType) { setKeyGetBackendAttributeType(&o.Backend, v) } // GetCreatedAt returns the CreatedAt field value func (o *Key) GetCreatedAt() (ret KeyGetCreatedAtRetType) { ret, _ = o.GetCreatedAtOk() return ret } // GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. func (o *Key) GetCreatedAtOk() (ret KeyGetCreatedAtRetType, ok bool) { return getKeyGetCreatedAtAttributeTypeOk(o.CreatedAt) } // SetCreatedAt sets field value func (o *Key) SetCreatedAt(v KeyGetCreatedAtRetType) { setKeyGetCreatedAtAttributeType(&o.CreatedAt, v) } // GetDeletionDate returns the DeletionDate field value if set, zero value otherwise. func (o *Key) GetDeletionDate() (res KeyGetDeletionDateRetType) { res, _ = o.GetDeletionDateOk() return } // GetDeletionDateOk returns a tuple with the DeletionDate field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Key) GetDeletionDateOk() (ret KeyGetDeletionDateRetType, ok bool) { return getKeyGetDeletionDateAttributeTypeOk(o.DeletionDate) } // HasDeletionDate returns a boolean if a field has been set. func (o *Key) HasDeletionDate() bool { _, ok := o.GetDeletionDateOk() return ok } // SetDeletionDate gets a reference to the given time.Time and assigns it to the DeletionDate field. func (o *Key) SetDeletionDate(v KeyGetDeletionDateRetType) { setKeyGetDeletionDateAttributeType(&o.DeletionDate, v) } // GetDescription returns the Description field value func (o *Key) GetDescription() (ret KeyGetDescriptionRetType) { ret, _ = o.GetDescriptionOk() return ret } // GetDescriptionOk returns a tuple with the Description field value // and a boolean to check if the value has been set. func (o *Key) GetDescriptionOk() (ret KeyGetDescriptionRetType, ok bool) { return getKeyGetDescriptionAttributeTypeOk(o.Description) } // SetDescription sets field value func (o *Key) SetDescription(v KeyGetDescriptionRetType) { setKeyGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value func (o *Key) GetDisplayName() (ret KeyGetDisplayNameRetType) { 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 *Key) GetDisplayNameOk() (ret KeyGetDisplayNameRetType, ok bool) { return getKeyGetDisplayNameAttributeTypeOk(o.DisplayName) } // SetDisplayName sets field value func (o *Key) SetDisplayName(v KeyGetDisplayNameRetType) { setKeyGetDisplayNameAttributeType(&o.DisplayName, v) } // GetId returns the Id field value func (o *Key) GetId() (ret KeyGetIdRetType) { 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 *Key) GetIdOk() (ret KeyGetIdRetType, ok bool) { return getKeyGetIdAttributeTypeOk(o.Id) } // SetId sets field value func (o *Key) SetId(v KeyGetIdRetType) { setKeyGetIdAttributeType(&o.Id, v) } // GetImportOnly returns the ImportOnly field value func (o *Key) GetImportOnly() (ret KeygetImportOnlyRetType) { ret, _ = o.GetImportOnlyOk() return ret } // GetImportOnlyOk returns a tuple with the ImportOnly field value // and a boolean to check if the value has been set. func (o *Key) GetImportOnlyOk() (ret KeygetImportOnlyRetType, ok bool) { return getKeygetImportOnlyAttributeTypeOk(o.ImportOnly) } // SetImportOnly sets field value func (o *Key) SetImportOnly(v KeygetImportOnlyRetType) { setKeygetImportOnlyAttributeType(&o.ImportOnly, v) } // GetKeyRingId returns the KeyRingId field value func (o *Key) GetKeyRingId() (ret KeyGetKeyRingIdRetType) { ret, _ = o.GetKeyRingIdOk() return ret } // GetKeyRingIdOk returns a tuple with the KeyRingId field value // and a boolean to check if the value has been set. func (o *Key) GetKeyRingIdOk() (ret KeyGetKeyRingIdRetType, ok bool) { return getKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId) } // SetKeyRingId sets field value func (o *Key) SetKeyRingId(v KeyGetKeyRingIdRetType) { setKeyGetKeyRingIdAttributeType(&o.KeyRingId, v) } // GetProtection returns the Protection field value func (o *Key) GetProtection() (ret KeyGetProtectionRetType) { ret, _ = o.GetProtectionOk() return ret } // GetProtectionOk returns a tuple with the Protection field value // and a boolean to check if the value has been set. func (o *Key) GetProtectionOk() (ret KeyGetProtectionRetType, ok bool) { return getKeyGetProtectionAttributeTypeOk(o.Protection) } // SetProtection sets field value func (o *Key) SetProtection(v KeyGetProtectionRetType) { setKeyGetProtectionAttributeType(&o.Protection, v) } // GetPurpose returns the Purpose field value func (o *Key) GetPurpose() (ret KeyGetPurposeRetType) { ret, _ = o.GetPurposeOk() return ret } // GetPurposeOk returns a tuple with the Purpose field value // and a boolean to check if the value has been set. func (o *Key) GetPurposeOk() (ret KeyGetPurposeRetType, ok bool) { return getKeyGetPurposeAttributeTypeOk(o.Purpose) } // SetPurpose sets field value func (o *Key) SetPurpose(v KeyGetPurposeRetType) { setKeyGetPurposeAttributeType(&o.Purpose, v) } // GetState returns the State field value func (o *Key) GetState() (ret KeyGetStateRetType) { 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 *Key) GetStateOk() (ret KeyGetStateRetType, ok bool) { return getKeyGetStateAttributeTypeOk(o.State) } // SetState sets field value func (o *Key) SetState(v KeyGetStateRetType) { setKeyGetStateAttributeType(&o.State, v) } func (o Key) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getKeyGetAccessScopeAttributeTypeOk(o.AccessScope); ok { toSerialize["AccessScope"] = val } if val, ok := getKeyGetAlgorithmAttributeTypeOk(o.Algorithm); ok { toSerialize["Algorithm"] = val } if val, ok := getKeyGetBackendAttributeTypeOk(o.Backend); ok { toSerialize["Backend"] = val } if val, ok := getKeyGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { toSerialize["CreatedAt"] = val } if val, ok := getKeyGetDeletionDateAttributeTypeOk(o.DeletionDate); ok { toSerialize["DeletionDate"] = val } if val, ok := getKeyGetDescriptionAttributeTypeOk(o.Description); ok { toSerialize["Description"] = val } if val, ok := getKeyGetDisplayNameAttributeTypeOk(o.DisplayName); ok { toSerialize["DisplayName"] = val } if val, ok := getKeyGetIdAttributeTypeOk(o.Id); ok { toSerialize["Id"] = val } if val, ok := getKeygetImportOnlyAttributeTypeOk(o.ImportOnly); ok { toSerialize["ImportOnly"] = val } if val, ok := getKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId); ok { toSerialize["KeyRingId"] = val } if val, ok := getKeyGetProtectionAttributeTypeOk(o.Protection); ok { toSerialize["Protection"] = val } if val, ok := getKeyGetPurposeAttributeTypeOk(o.Purpose); ok { toSerialize["Purpose"] = val } if val, ok := getKeyGetStateAttributeTypeOk(o.State); ok { toSerialize["State"] = val } return toSerialize, nil } type NullableKey struct { value *Key isSet bool } func (v NullableKey) Get() *Key { return v.value } func (v *NullableKey) Set(val *Key) { v.value = val v.isSet = true } func (v NullableKey) IsSet() bool { return v.isSet } func (v *NullableKey) Unset() { v.value = nil v.isSet = false } func NewNullableKey(val *Key) *NullableKey { return &NullableKey{value: val, isSet: true} } func (v NullableKey) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableKey) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }