/* 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 Version type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Version{} /* types and functions for createdAt */ // isDateTime type VersionGetCreatedAtAttributeType = *time.Time type VersionGetCreatedAtArgType = time.Time type VersionGetCreatedAtRetType = time.Time func getVersionGetCreatedAtAttributeTypeOk(arg VersionGetCreatedAtAttributeType) (ret VersionGetCreatedAtRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetCreatedAtAttributeType(arg *VersionGetCreatedAtAttributeType, val VersionGetCreatedAtRetType) { *arg = &val } /* types and functions for destroyDate */ // isDateTime type VersionGetDestroyDateAttributeType = *time.Time type VersionGetDestroyDateArgType = time.Time type VersionGetDestroyDateRetType = time.Time func getVersionGetDestroyDateAttributeTypeOk(arg VersionGetDestroyDateAttributeType) (ret VersionGetDestroyDateRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetDestroyDateAttributeType(arg *VersionGetDestroyDateAttributeType, val VersionGetDestroyDateRetType) { *arg = &val } /* types and functions for disabled */ // isBoolean type VersiongetDisabledAttributeType = *bool type VersiongetDisabledArgType = bool type VersiongetDisabledRetType = bool func getVersiongetDisabledAttributeTypeOk(arg VersiongetDisabledAttributeType) (ret VersiongetDisabledRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersiongetDisabledAttributeType(arg *VersiongetDisabledAttributeType, val VersiongetDisabledRetType) { *arg = &val } /* types and functions for keyId */ // isNotNullableString type VersionGetKeyIdAttributeType = *string func getVersionGetKeyIdAttributeTypeOk(arg VersionGetKeyIdAttributeType) (ret VersionGetKeyIdRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetKeyIdAttributeType(arg *VersionGetKeyIdAttributeType, val VersionGetKeyIdRetType) { *arg = &val } type VersionGetKeyIdArgType = string type VersionGetKeyIdRetType = string /* types and functions for keyRingId */ // isNotNullableString type VersionGetKeyRingIdAttributeType = *string func getVersionGetKeyRingIdAttributeTypeOk(arg VersionGetKeyRingIdAttributeType) (ret VersionGetKeyRingIdRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetKeyRingIdAttributeType(arg *VersionGetKeyRingIdAttributeType, val VersionGetKeyRingIdRetType) { *arg = &val } type VersionGetKeyRingIdArgType = string type VersionGetKeyRingIdRetType = string /* types and functions for number */ // isLong type VersionGetNumberAttributeType = *int64 type VersionGetNumberArgType = int64 type VersionGetNumberRetType = int64 func getVersionGetNumberAttributeTypeOk(arg VersionGetNumberAttributeType) (ret VersionGetNumberRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetNumberAttributeType(arg *VersionGetNumberAttributeType, val VersionGetNumberRetType) { *arg = &val } /* types and functions for publicKey */ // isNotNullableString type VersionGetPublicKeyAttributeType = *string func getVersionGetPublicKeyAttributeTypeOk(arg VersionGetPublicKeyAttributeType) (ret VersionGetPublicKeyRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetPublicKeyAttributeType(arg *VersionGetPublicKeyAttributeType, val VersionGetPublicKeyRetType) { *arg = &val } type VersionGetPublicKeyArgType = string type VersionGetPublicKeyRetType = string /* types and functions for state */ // isEnum // VersionState The current state of the key. // value type for enums type VersionState string // List of State const ( VERSIONSTATE_ACTIVE VersionState = "active" VERSIONSTATE_CREATING VersionState = "creating" VERSIONSTATE_KEY_MATERIAL_INVALID VersionState = "key_material_invalid" VERSIONSTATE_KEY_MATERIAL_UNAVAILABLE VersionState = "key_material_unavailable" VERSIONSTATE_DISABLED VersionState = "disabled" VERSIONSTATE_DESTROYED VersionState = "destroyed" ) // All allowed values of Version enum var AllowedVersionStateEnumValues = []VersionState{ "active", "creating", "key_material_invalid", "key_material_unavailable", "disabled", "destroyed", } func (v *VersionState) 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 VersionState 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 := VersionState(value) for _, existing := range AllowedVersionStateEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid Version", value) } // NewVersionStateFromValue returns a pointer to a valid VersionState // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewVersionStateFromValue(v VersionState) (*VersionState, error) { ev := VersionState(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for VersionState: valid values are %v", v, AllowedVersionStateEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v VersionState) IsValid() bool { for _, existing := range AllowedVersionStateEnumValues { if existing == v { return true } } return false } // Ptr returns reference to StateState value func (v VersionState) Ptr() *VersionState { return &v } type NullableVersionState struct { value *VersionState isSet bool } func (v NullableVersionState) Get() *VersionState { return v.value } func (v *NullableVersionState) Set(val *VersionState) { v.value = val v.isSet = true } func (v NullableVersionState) IsSet() bool { return v.isSet } func (v *NullableVersionState) Unset() { v.value = nil v.isSet = false } func NewNullableVersionState(val *VersionState) *NullableVersionState { return &NullableVersionState{value: val, isSet: true} } func (v NullableVersionState) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableVersionState) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } type VersionGetStateAttributeType = *VersionState type VersionGetStateArgType = VersionState type VersionGetStateRetType = VersionState func getVersionGetStateAttributeTypeOk(arg VersionGetStateAttributeType) (ret VersionGetStateRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setVersionGetStateAttributeType(arg *VersionGetStateAttributeType, val VersionGetStateRetType) { *arg = &val } // Version struct for Version type Version struct { // The date and time the creation of the key was triggered. // REQUIRED CreatedAt VersionGetCreatedAtAttributeType `json:"createdAt" required:"true"` // The scheduled date when a version's key material will be erased completely from the backend DestroyDate VersionGetDestroyDateAttributeType `json:"destroyDate,omitempty"` // States whether versions is enabled or disabled. // REQUIRED Disabled VersiongetDisabledAttributeType `json:"disabled" required:"true"` // The unique id of the key this version is assigned to. // REQUIRED KeyId VersionGetKeyIdAttributeType `json:"keyId" required:"true"` // The unique id of the key ring the key of this version is assigned to. // REQUIRED KeyRingId VersionGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` // A sequential number which identifies the key versions. // REQUIRED Number VersionGetNumberAttributeType `json:"number" required:"true"` // The public key of the key version. Only present in asymmetric keys. PublicKey VersionGetPublicKeyAttributeType `json:"publicKey,omitempty"` // The current state of the key. // REQUIRED State VersionGetStateAttributeType `json:"state" required:"true"` } type _Version Version // NewVersion instantiates a new Version 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 NewVersion(createdAt VersionGetCreatedAtArgType, disabled VersiongetDisabledArgType, keyId VersionGetKeyIdArgType, keyRingId VersionGetKeyRingIdArgType, number VersionGetNumberArgType, state VersionGetStateArgType) *Version { this := Version{} setVersionGetCreatedAtAttributeType(&this.CreatedAt, createdAt) setVersiongetDisabledAttributeType(&this.Disabled, disabled) setVersionGetKeyIdAttributeType(&this.KeyId, keyId) setVersionGetKeyRingIdAttributeType(&this.KeyRingId, keyRingId) setVersionGetNumberAttributeType(&this.Number, number) setVersionGetStateAttributeType(&this.State, state) return &this } // NewVersionWithDefaults instantiates a new Version 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 NewVersionWithDefaults() *Version { this := Version{} var disabled bool = false this.Disabled = &disabled return &this } // GetCreatedAt returns the CreatedAt field value func (o *Version) GetCreatedAt() (ret VersionGetCreatedAtRetType) { 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 *Version) GetCreatedAtOk() (ret VersionGetCreatedAtRetType, ok bool) { return getVersionGetCreatedAtAttributeTypeOk(o.CreatedAt) } // SetCreatedAt sets field value func (o *Version) SetCreatedAt(v VersionGetCreatedAtRetType) { setVersionGetCreatedAtAttributeType(&o.CreatedAt, v) } // GetDestroyDate returns the DestroyDate field value if set, zero value otherwise. func (o *Version) GetDestroyDate() (res VersionGetDestroyDateRetType) { res, _ = o.GetDestroyDateOk() return } // GetDestroyDateOk returns a tuple with the DestroyDate field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Version) GetDestroyDateOk() (ret VersionGetDestroyDateRetType, ok bool) { return getVersionGetDestroyDateAttributeTypeOk(o.DestroyDate) } // HasDestroyDate returns a boolean if a field has been set. func (o *Version) HasDestroyDate() bool { _, ok := o.GetDestroyDateOk() return ok } // SetDestroyDate gets a reference to the given time.Time and assigns it to the DestroyDate field. func (o *Version) SetDestroyDate(v VersionGetDestroyDateRetType) { setVersionGetDestroyDateAttributeType(&o.DestroyDate, v) } // GetDisabled returns the Disabled field value func (o *Version) GetDisabled() (ret VersiongetDisabledRetType) { ret, _ = o.GetDisabledOk() return ret } // GetDisabledOk returns a tuple with the Disabled field value // and a boolean to check if the value has been set. func (o *Version) GetDisabledOk() (ret VersiongetDisabledRetType, ok bool) { return getVersiongetDisabledAttributeTypeOk(o.Disabled) } // SetDisabled sets field value func (o *Version) SetDisabled(v VersiongetDisabledRetType) { setVersiongetDisabledAttributeType(&o.Disabled, v) } // GetKeyId returns the KeyId field value func (o *Version) GetKeyId() (ret VersionGetKeyIdRetType) { ret, _ = o.GetKeyIdOk() return ret } // GetKeyIdOk returns a tuple with the KeyId field value // and a boolean to check if the value has been set. func (o *Version) GetKeyIdOk() (ret VersionGetKeyIdRetType, ok bool) { return getVersionGetKeyIdAttributeTypeOk(o.KeyId) } // SetKeyId sets field value func (o *Version) SetKeyId(v VersionGetKeyIdRetType) { setVersionGetKeyIdAttributeType(&o.KeyId, v) } // GetKeyRingId returns the KeyRingId field value func (o *Version) GetKeyRingId() (ret VersionGetKeyRingIdRetType) { 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 *Version) GetKeyRingIdOk() (ret VersionGetKeyRingIdRetType, ok bool) { return getVersionGetKeyRingIdAttributeTypeOk(o.KeyRingId) } // SetKeyRingId sets field value func (o *Version) SetKeyRingId(v VersionGetKeyRingIdRetType) { setVersionGetKeyRingIdAttributeType(&o.KeyRingId, v) } // GetNumber returns the Number field value func (o *Version) GetNumber() (ret VersionGetNumberRetType) { ret, _ = o.GetNumberOk() return ret } // GetNumberOk returns a tuple with the Number field value // and a boolean to check if the value has been set. func (o *Version) GetNumberOk() (ret VersionGetNumberRetType, ok bool) { return getVersionGetNumberAttributeTypeOk(o.Number) } // SetNumber sets field value func (o *Version) SetNumber(v VersionGetNumberRetType) { setVersionGetNumberAttributeType(&o.Number, v) } // GetPublicKey returns the PublicKey field value if set, zero value otherwise. func (o *Version) GetPublicKey() (res VersionGetPublicKeyRetType) { res, _ = o.GetPublicKeyOk() return } // GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Version) GetPublicKeyOk() (ret VersionGetPublicKeyRetType, ok bool) { return getVersionGetPublicKeyAttributeTypeOk(o.PublicKey) } // HasPublicKey returns a boolean if a field has been set. func (o *Version) HasPublicKey() bool { _, ok := o.GetPublicKeyOk() return ok } // SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. func (o *Version) SetPublicKey(v VersionGetPublicKeyRetType) { setVersionGetPublicKeyAttributeType(&o.PublicKey, v) } // GetState returns the State field value func (o *Version) GetState() (ret VersionGetStateRetType) { 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 *Version) GetStateOk() (ret VersionGetStateRetType, ok bool) { return getVersionGetStateAttributeTypeOk(o.State) } // SetState sets field value func (o *Version) SetState(v VersionGetStateRetType) { setVersionGetStateAttributeType(&o.State, v) } func (o Version) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getVersionGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { toSerialize["CreatedAt"] = val } if val, ok := getVersionGetDestroyDateAttributeTypeOk(o.DestroyDate); ok { toSerialize["DestroyDate"] = val } if val, ok := getVersiongetDisabledAttributeTypeOk(o.Disabled); ok { toSerialize["Disabled"] = val } if val, ok := getVersionGetKeyIdAttributeTypeOk(o.KeyId); ok { toSerialize["KeyId"] = val } if val, ok := getVersionGetKeyRingIdAttributeTypeOk(o.KeyRingId); ok { toSerialize["KeyRingId"] = val } if val, ok := getVersionGetNumberAttributeTypeOk(o.Number); ok { toSerialize["Number"] = val } if val, ok := getVersionGetPublicKeyAttributeTypeOk(o.PublicKey); ok { toSerialize["PublicKey"] = val } if val, ok := getVersionGetStateAttributeTypeOk(o.State); ok { toSerialize["State"] = val } return toSerialize, nil } type NullableVersion struct { value *Version isSet bool } func (v NullableVersion) Get() *Version { return v.value } func (v *NullableVersion) Set(val *Version) { v.value = val v.isSet = true } func (v NullableVersion) IsSet() bool { return v.isSet } func (v *NullableVersion) Unset() { v.value = nil v.isSet = false } func NewNullableVersion(val *Version) *NullableVersion { return &NullableVersion{value: val, isSet: true} } func (v NullableVersion) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableVersion) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }