diff --git a/CHANGELOG.md b/CHANGELOG.md index ac0f41034..7bc103834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,12 @@ - `intake`: [v0.1.0](services/intake/CHANGELOG.md#v010) - **New**: STACKIT Intake module can be used to manage the STACKIT Intake. Manage your `IntakeRunners`, `Intakes` and `IntakeUsers` - `kms`: + - [v0.6.0](services/kms/CHANGELOG.md#v060) + - **Breaking Change:** Updated `NewKey()` and `NewWrappingKey()` constructor signatures to require new `AccessScope` parameter + - **Breaking Change:** Added new required `AccessScope` field to `Key` and `WrappingKey` models + - **Feature:** Add new `AccessScope` field to `CreateKeyPayload` and `CreateWrappingKeyPayload` models for managing key access permissions + - **Feature:** Add new `Protection` field to `CreateKeyPayload`, `CreateWrappingKeyPayload`, `Key`, and `WrappingKey` models as a replacement for the deprecated `Backend` field + - **Deprecation:** The `Backend` field is now deprecated in all relevant models. Use the new `Protection` field instead - [v0.5.1](services/kms/CHANGELOG.md#v051) - **Improvement:** Improved error handling for multiple API methods including `DeleteKey`, `DeleteKeyRing`, `DeleteWrappingKey`, `DestroyVersion`, `DisableVersion`, `EnableVersion`, `RestoreKey`, and `RestoreVersion` - [v0.5.0](services/kms/CHANGELOG.md#v050) diff --git a/services/kms/CHANGELOG.md b/services/kms/CHANGELOG.md index e9d873104..7807a5ff8 100644 --- a/services/kms/CHANGELOG.md +++ b/services/kms/CHANGELOG.md @@ -1,3 +1,10 @@ +## v0.6.0 +- **Breaking Change:** Updated `NewKey()` and `NewWrappingKey()` constructor signatures to require new `AccessScope` parameter +- **Breaking Change:** Added new required `AccessScope` field to `Key` and `WrappingKey` models +- **Feature:** Add new `AccessScope` field to `CreateKeyPayload` and `CreateWrappingKeyPayload` models for managing key access permissions +- **Feature:** Add new `Protection` field to `CreateKeyPayload`, `CreateWrappingKeyPayload`, `Key`, and `WrappingKey` models as a replacement for the deprecated `Backend` field +- **Deprecation:** The `Backend` field is now deprecated in all relevant models. Use the new `Protection` field instead + ## v0.5.1 - **Improvement:** Improved error handling for multiple API methods including `DeleteKey`, `DeleteKeyRing`, `DeleteWrappingKey`, `DestroyVersion`, `DisableVersion`, `EnableVersion`, `RestoreKey`, and `RestoreVersion` diff --git a/services/kms/VERSION b/services/kms/VERSION index 992ac75e2..60f634328 100644 --- a/services/kms/VERSION +++ b/services/kms/VERSION @@ -1 +1 @@ -v0.5.1 +v0.6.0 diff --git a/services/kms/model_access_scope.go b/services/kms/model_access_scope.go new file mode 100644 index 000000000..387e9fd56 --- /dev/null +++ b/services/kms/model_access_scope.go @@ -0,0 +1,115 @@ +/* +STACKIT Key Management Service API + +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 kms + +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) +} diff --git a/services/kms/model_access_scope_test.go b/services/kms/model_access_scope_test.go new file mode 100644 index 000000000..575e8aba9 --- /dev/null +++ b/services/kms/model_access_scope_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +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 kms diff --git a/services/kms/model_backend.go b/services/kms/model_backend.go index 4e36f3834..31eaa6916 100644 --- a/services/kms/model_backend.go +++ b/services/kms/model_backend.go @@ -15,7 +15,7 @@ import ( "fmt" ) -// Backend The backend that is responsible for maintaining this key. +// Backend The backend that is responsible for maintaining this key. Deprecated - use `protection`. type Backend string // List of backend diff --git a/services/kms/model_create_key_payload.go b/services/kms/model_create_key_payload.go index cb8f44893..272ec1a3a 100644 --- a/services/kms/model_create_key_payload.go +++ b/services/kms/model_create_key_payload.go @@ -17,6 +17,26 @@ import ( // checks if the CreateKeyPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateKeyPayload{} +/* + types and functions for access_scope +*/ + +// isEnumRef +type CreateKeyPayloadGetAccessScopeAttributeType = *AccessScope +type CreateKeyPayloadGetAccessScopeArgType = AccessScope +type CreateKeyPayloadGetAccessScopeRetType = AccessScope + +func getCreateKeyPayloadGetAccessScopeAttributeTypeOk(arg CreateKeyPayloadGetAccessScopeAttributeType) (ret CreateKeyPayloadGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetAccessScopeAttributeType(arg *CreateKeyPayloadGetAccessScopeAttributeType, val CreateKeyPayloadGetAccessScopeRetType) { + *arg = &val +} + /* types and functions for algorithm */ @@ -119,6 +139,26 @@ func setCreateKeyPayloadgetImportOnlyAttributeType(arg *CreateKeyPayloadgetImpor *arg = &val } +/* + types and functions for protection +*/ + +// isEnumRef +type CreateKeyPayloadGetProtectionAttributeType = *Protection +type CreateKeyPayloadGetProtectionArgType = Protection +type CreateKeyPayloadGetProtectionRetType = Protection + +func getCreateKeyPayloadGetProtectionAttributeTypeOk(arg CreateKeyPayloadGetProtectionAttributeType) (ret CreateKeyPayloadGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetProtectionAttributeType(arg *CreateKeyPayloadGetProtectionAttributeType, val CreateKeyPayloadGetProtectionRetType) { + *arg = &val +} + /* types and functions for purpose */ @@ -141,8 +181,10 @@ func setCreateKeyPayloadGetPurposeAttributeType(arg *CreateKeyPayloadGetPurposeA // CreateKeyPayload struct for CreateKeyPayload type CreateKeyPayload struct { + AccessScope CreateKeyPayloadGetAccessScopeAttributeType `json:"access_scope,omitempty"` // REQUIRED Algorithm CreateKeyPayloadGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives // REQUIRED Backend CreateKeyPayloadGetBackendAttributeType `json:"backend" required:"true"` // A user chosen description to distinguish multiple keys. @@ -152,6 +194,7 @@ type CreateKeyPayload struct { DisplayName CreateKeyPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` // States whether versions can be created or only imported. ImportOnly CreateKeyPayloadgetImportOnlyAttributeType `json:"importOnly,omitempty"` + Protection CreateKeyPayloadGetProtectionAttributeType `json:"protection,omitempty"` // REQUIRED Purpose CreateKeyPayloadGetPurposeAttributeType `json:"purpose" required:"true"` } @@ -176,11 +219,36 @@ func NewCreateKeyPayload(algorithm CreateKeyPayloadGetAlgorithmArgType, backend // but it doesn't guarantee that properties required by API are set func NewCreateKeyPayloadWithDefaults() *CreateKeyPayload { this := CreateKeyPayload{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope var importOnly bool = false this.ImportOnly = &importOnly return &this } +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +func (o *CreateKeyPayload) GetAccessScope() (res CreateKeyPayloadGetAccessScopeRetType) { + res, _ = o.GetAccessScopeOk() + return +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetAccessScopeOk() (ret CreateKeyPayloadGetAccessScopeRetType, ok bool) { + return getCreateKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// HasAccessScope returns a boolean if a field has been set. +func (o *CreateKeyPayload) HasAccessScope() bool { + _, ok := o.GetAccessScopeOk() + return ok +} + +// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. +func (o *CreateKeyPayload) SetAccessScope(v CreateKeyPayloadGetAccessScopeRetType) { + setCreateKeyPayloadGetAccessScopeAttributeType(&o.AccessScope, v) +} + // GetAlgorithm returns the Algorithm field value func (o *CreateKeyPayload) GetAlgorithm() (ret CreateKeyPayloadGetAlgorithmRetType) { ret, _ = o.GetAlgorithmOk() @@ -199,6 +267,7 @@ func (o *CreateKeyPayload) SetAlgorithm(v CreateKeyPayloadGetAlgorithmRetType) { } // GetBackend returns the Backend field value +// Deprecated func (o *CreateKeyPayload) GetBackend() (ret CreateKeyPayloadGetBackendRetType) { ret, _ = o.GetBackendOk() return ret @@ -206,11 +275,13 @@ func (o *CreateKeyPayload) GetBackend() (ret CreateKeyPayloadGetBackendRetType) // GetBackendOk returns a tuple with the Backend field value // and a boolean to check if the value has been set. +// Deprecated func (o *CreateKeyPayload) GetBackendOk() (ret CreateKeyPayloadGetBackendRetType, ok bool) { return getCreateKeyPayloadGetBackendAttributeTypeOk(o.Backend) } // SetBackend sets field value +// Deprecated func (o *CreateKeyPayload) SetBackend(v CreateKeyPayloadGetBackendRetType) { setCreateKeyPayloadGetBackendAttributeType(&o.Backend, v) } @@ -278,6 +349,29 @@ func (o *CreateKeyPayload) SetImportOnly(v CreateKeyPayloadgetImportOnlyRetType) setCreateKeyPayloadgetImportOnlyAttributeType(&o.ImportOnly, v) } +// GetProtection returns the Protection field value if set, zero value otherwise. +func (o *CreateKeyPayload) GetProtection() (res CreateKeyPayloadGetProtectionRetType) { + res, _ = o.GetProtectionOk() + return +} + +// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetProtectionOk() (ret CreateKeyPayloadGetProtectionRetType, ok bool) { + return getCreateKeyPayloadGetProtectionAttributeTypeOk(o.Protection) +} + +// HasProtection returns a boolean if a field has been set. +func (o *CreateKeyPayload) HasProtection() bool { + _, ok := o.GetProtectionOk() + return ok +} + +// SetProtection gets a reference to the given Protection and assigns it to the Protection field. +func (o *CreateKeyPayload) SetProtection(v CreateKeyPayloadGetProtectionRetType) { + setCreateKeyPayloadGetProtectionAttributeType(&o.Protection, v) +} + // GetPurpose returns the Purpose field value func (o *CreateKeyPayload) GetPurpose() (ret CreateKeyPayloadGetPurposeRetType) { ret, _ = o.GetPurposeOk() @@ -297,6 +391,9 @@ func (o *CreateKeyPayload) SetPurpose(v CreateKeyPayloadGetPurposeRetType) { func (o CreateKeyPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getCreateKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } if val, ok := getCreateKeyPayloadGetAlgorithmAttributeTypeOk(o.Algorithm); ok { toSerialize["Algorithm"] = val } @@ -312,6 +409,9 @@ func (o CreateKeyPayload) ToMap() (map[string]interface{}, error) { if val, ok := getCreateKeyPayloadgetImportOnlyAttributeTypeOk(o.ImportOnly); ok { toSerialize["ImportOnly"] = val } + if val, ok := getCreateKeyPayloadGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } if val, ok := getCreateKeyPayloadGetPurposeAttributeTypeOk(o.Purpose); ok { toSerialize["Purpose"] = val } diff --git a/services/kms/model_create_wrapping_key_payload.go b/services/kms/model_create_wrapping_key_payload.go index 8915ae2cb..bdac73aa9 100644 --- a/services/kms/model_create_wrapping_key_payload.go +++ b/services/kms/model_create_wrapping_key_payload.go @@ -17,6 +17,26 @@ import ( // checks if the CreateWrappingKeyPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateWrappingKeyPayload{} +/* + types and functions for access_scope +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetAccessScopeAttributeType = *AccessScope +type CreateWrappingKeyPayloadGetAccessScopeArgType = AccessScope +type CreateWrappingKeyPayloadGetAccessScopeRetType = AccessScope + +func getCreateWrappingKeyPayloadGetAccessScopeAttributeTypeOk(arg CreateWrappingKeyPayloadGetAccessScopeAttributeType) (ret CreateWrappingKeyPayloadGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetAccessScopeAttributeType(arg *CreateWrappingKeyPayloadGetAccessScopeAttributeType, val CreateWrappingKeyPayloadGetAccessScopeRetType) { + *arg = &val +} + /* types and functions for algorithm */ @@ -99,6 +119,26 @@ func setCreateWrappingKeyPayloadGetDisplayNameAttributeType(arg *CreateWrappingK type CreateWrappingKeyPayloadGetDisplayNameArgType = string type CreateWrappingKeyPayloadGetDisplayNameRetType = string +/* + types and functions for protection +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetProtectionAttributeType = *Protection +type CreateWrappingKeyPayloadGetProtectionArgType = Protection +type CreateWrappingKeyPayloadGetProtectionRetType = Protection + +func getCreateWrappingKeyPayloadGetProtectionAttributeTypeOk(arg CreateWrappingKeyPayloadGetProtectionAttributeType) (ret CreateWrappingKeyPayloadGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetProtectionAttributeType(arg *CreateWrappingKeyPayloadGetProtectionAttributeType, val CreateWrappingKeyPayloadGetProtectionRetType) { + *arg = &val +} + /* types and functions for purpose */ @@ -121,8 +161,10 @@ func setCreateWrappingKeyPayloadGetPurposeAttributeType(arg *CreateWrappingKeyPa // CreateWrappingKeyPayload struct for CreateWrappingKeyPayload type CreateWrappingKeyPayload struct { + AccessScope CreateWrappingKeyPayloadGetAccessScopeAttributeType `json:"access_scope,omitempty"` // REQUIRED Algorithm CreateWrappingKeyPayloadGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives // REQUIRED Backend CreateWrappingKeyPayloadGetBackendAttributeType `json:"backend" required:"true"` // A user chosen description to distinguish multiple wrapping keys. @@ -130,6 +172,7 @@ type CreateWrappingKeyPayload struct { // The display name to distinguish multiple wrapping keys. // REQUIRED DisplayName CreateWrappingKeyPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + Protection CreateWrappingKeyPayloadGetProtectionAttributeType `json:"protection,omitempty"` // REQUIRED Purpose CreateWrappingKeyPayloadGetPurposeAttributeType `json:"purpose" required:"true"` } @@ -154,9 +197,34 @@ func NewCreateWrappingKeyPayload(algorithm CreateWrappingKeyPayloadGetAlgorithmA // but it doesn't guarantee that properties required by API are set func NewCreateWrappingKeyPayloadWithDefaults() *CreateWrappingKeyPayload { this := CreateWrappingKeyPayload{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope return &this } +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +func (o *CreateWrappingKeyPayload) GetAccessScope() (res CreateWrappingKeyPayloadGetAccessScopeRetType) { + res, _ = o.GetAccessScopeOk() + return +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetAccessScopeOk() (ret CreateWrappingKeyPayloadGetAccessScopeRetType, ok bool) { + return getCreateWrappingKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// HasAccessScope returns a boolean if a field has been set. +func (o *CreateWrappingKeyPayload) HasAccessScope() bool { + _, ok := o.GetAccessScopeOk() + return ok +} + +// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. +func (o *CreateWrappingKeyPayload) SetAccessScope(v CreateWrappingKeyPayloadGetAccessScopeRetType) { + setCreateWrappingKeyPayloadGetAccessScopeAttributeType(&o.AccessScope, v) +} + // GetAlgorithm returns the Algorithm field value func (o *CreateWrappingKeyPayload) GetAlgorithm() (ret CreateWrappingKeyPayloadGetAlgorithmRetType) { ret, _ = o.GetAlgorithmOk() @@ -175,6 +243,7 @@ func (o *CreateWrappingKeyPayload) SetAlgorithm(v CreateWrappingKeyPayloadGetAlg } // GetBackend returns the Backend field value +// Deprecated func (o *CreateWrappingKeyPayload) GetBackend() (ret CreateWrappingKeyPayloadGetBackendRetType) { ret, _ = o.GetBackendOk() return ret @@ -182,11 +251,13 @@ func (o *CreateWrappingKeyPayload) GetBackend() (ret CreateWrappingKeyPayloadGet // GetBackendOk returns a tuple with the Backend field value // and a boolean to check if the value has been set. +// Deprecated func (o *CreateWrappingKeyPayload) GetBackendOk() (ret CreateWrappingKeyPayloadGetBackendRetType, ok bool) { return getCreateWrappingKeyPayloadGetBackendAttributeTypeOk(o.Backend) } // SetBackend sets field value +// Deprecated func (o *CreateWrappingKeyPayload) SetBackend(v CreateWrappingKeyPayloadGetBackendRetType) { setCreateWrappingKeyPayloadGetBackendAttributeType(&o.Backend, v) } @@ -231,6 +302,29 @@ func (o *CreateWrappingKeyPayload) SetDisplayName(v CreateWrappingKeyPayloadGetD setCreateWrappingKeyPayloadGetDisplayNameAttributeType(&o.DisplayName, v) } +// GetProtection returns the Protection field value if set, zero value otherwise. +func (o *CreateWrappingKeyPayload) GetProtection() (res CreateWrappingKeyPayloadGetProtectionRetType) { + res, _ = o.GetProtectionOk() + return +} + +// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetProtectionOk() (ret CreateWrappingKeyPayloadGetProtectionRetType, ok bool) { + return getCreateWrappingKeyPayloadGetProtectionAttributeTypeOk(o.Protection) +} + +// HasProtection returns a boolean if a field has been set. +func (o *CreateWrappingKeyPayload) HasProtection() bool { + _, ok := o.GetProtectionOk() + return ok +} + +// SetProtection gets a reference to the given Protection and assigns it to the Protection field. +func (o *CreateWrappingKeyPayload) SetProtection(v CreateWrappingKeyPayloadGetProtectionRetType) { + setCreateWrappingKeyPayloadGetProtectionAttributeType(&o.Protection, v) +} + // GetPurpose returns the Purpose field value func (o *CreateWrappingKeyPayload) GetPurpose() (ret CreateWrappingKeyPayloadGetPurposeRetType) { ret, _ = o.GetPurposeOk() @@ -250,6 +344,9 @@ func (o *CreateWrappingKeyPayload) SetPurpose(v CreateWrappingKeyPayloadGetPurpo func (o CreateWrappingKeyPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getCreateWrappingKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } if val, ok := getCreateWrappingKeyPayloadGetAlgorithmAttributeTypeOk(o.Algorithm); ok { toSerialize["Algorithm"] = val } @@ -262,6 +359,9 @@ func (o CreateWrappingKeyPayload) ToMap() (map[string]interface{}, error) { if val, ok := getCreateWrappingKeyPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { toSerialize["DisplayName"] = val } + if val, ok := getCreateWrappingKeyPayloadGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } if val, ok := getCreateWrappingKeyPayloadGetPurposeAttributeTypeOk(o.Purpose); ok { toSerialize["Purpose"] = val } diff --git a/services/kms/model_key.go b/services/kms/model_key.go index d6e843142..7622db446 100644 --- a/services/kms/model_key.go +++ b/services/kms/model_key.go @@ -19,6 +19,26 @@ import ( // 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 */ @@ -203,6 +223,26 @@ func setKeyGetKeyRingIdAttributeType(arg *KeyGetKeyRingIdAttributeType, val KeyG 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 */ @@ -357,8 +397,11 @@ func setKeyGetStateAttributeType(arg *KeyGetStateAttributeType, val KeyGetStateR // 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. @@ -378,7 +421,8 @@ type Key struct { ImportOnly KeygetImportOnlyAttributeType `json:"importOnly,omitempty"` // The unique id of the key ring this key is assigned to. // REQUIRED - KeyRingId KeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + KeyRingId KeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + Protection KeyGetProtectionAttributeType `json:"protection,omitempty"` // REQUIRED Purpose KeyGetPurposeAttributeType `json:"purpose" required:"true"` // The current state of the key. @@ -392,8 +436,9 @@ type _Key Key // 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(algorithm KeyGetAlgorithmArgType, backend KeyGetBackendArgType, createdAt KeyGetCreatedAtArgType, displayName KeyGetDisplayNameArgType, id KeyGetIdArgType, keyRingId KeyGetKeyRingIdArgType, purpose KeyGetPurposeArgType, state KeyGetStateArgType) *Key { +func NewKey(accessScope KeyGetAccessScopeArgType, algorithm KeyGetAlgorithmArgType, backend KeyGetBackendArgType, createdAt KeyGetCreatedAtArgType, displayName KeyGetDisplayNameArgType, id KeyGetIdArgType, keyRingId KeyGetKeyRingIdArgType, purpose KeyGetPurposeArgType, state KeyGetStateArgType) *Key { this := Key{} + setKeyGetAccessScopeAttributeType(&this.AccessScope, accessScope) setKeyGetAlgorithmAttributeType(&this.Algorithm, algorithm) setKeyGetBackendAttributeType(&this.Backend, backend) setKeyGetCreatedAtAttributeType(&this.CreatedAt, createdAt) @@ -410,11 +455,30 @@ func NewKey(algorithm KeyGetAlgorithmArgType, backend KeyGetBackendArgType, crea // 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() @@ -433,6 +497,7 @@ func (o *Key) SetAlgorithm(v KeyGetAlgorithmRetType) { } // GetBackend returns the Backend field value +// Deprecated func (o *Key) GetBackend() (ret KeyGetBackendRetType) { ret, _ = o.GetBackendOk() return ret @@ -440,11 +505,13 @@ func (o *Key) GetBackend() (ret KeyGetBackendRetType) { // 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) } @@ -586,6 +653,29 @@ func (o *Key) SetKeyRingId(v KeyGetKeyRingIdRetType) { setKeyGetKeyRingIdAttributeType(&o.KeyRingId, v) } +// GetProtection returns the Protection field value if set, zero value otherwise. +func (o *Key) GetProtection() (res KeyGetProtectionRetType) { + res, _ = o.GetProtectionOk() + return +} + +// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Key) GetProtectionOk() (ret KeyGetProtectionRetType, ok bool) { + return getKeyGetProtectionAttributeTypeOk(o.Protection) +} + +// HasProtection returns a boolean if a field has been set. +func (o *Key) HasProtection() bool { + _, ok := o.GetProtectionOk() + return ok +} + +// SetProtection gets a reference to the given Protection and assigns it to the Protection field. +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() @@ -622,6 +712,9 @@ func (o *Key) SetState(v KeyGetStateRetType) { 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 } @@ -649,6 +742,9 @@ func (o Key) ToMap() (map[string]interface{}, error) { 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 } diff --git a/services/kms/model_protection.go b/services/kms/model_protection.go new file mode 100644 index 000000000..d1fae828b --- /dev/null +++ b/services/kms/model_protection.go @@ -0,0 +1,113 @@ +/* +STACKIT Key Management Service API + +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 kms + +import ( + "encoding/json" + "fmt" +) + +// Protection The underlying system that is responsible for protecting the key material. Overrides the deprecated 'backend' field. +type Protection string + +// List of protection +const ( + PROTECTION_SOFTWARE Protection = "software" +) + +// All allowed values of Protection enum +var AllowedProtectionEnumValues = []Protection{ + "software", +} + +func (v *Protection) 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 := Protection(value) + for _, existing := range AllowedProtectionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Protection", value) +} + +// NewProtectionFromValue returns a pointer to a valid Protection +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProtectionFromValue(v string) (*Protection, error) { + ev := Protection(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Protection: valid values are %v", v, AllowedProtectionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Protection) IsValid() bool { + for _, existing := range AllowedProtectionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to protection value +func (v Protection) Ptr() *Protection { + return &v +} + +type NullableProtection struct { + value *Protection + isSet bool +} + +func (v NullableProtection) Get() *Protection { + return v.value +} + +func (v *NullableProtection) Set(val *Protection) { + v.value = val + v.isSet = true +} + +func (v NullableProtection) IsSet() bool { + return v.isSet +} + +func (v *NullableProtection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtection(val *Protection) *NullableProtection { + return &NullableProtection{value: val, isSet: true} +} + +func (v NullableProtection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/kms/model_protection_test.go b/services/kms/model_protection_test.go new file mode 100644 index 000000000..575e8aba9 --- /dev/null +++ b/services/kms/model_protection_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +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 kms diff --git a/services/kms/model_wrapping_key.go b/services/kms/model_wrapping_key.go index fa3bba38d..57b25d110 100644 --- a/services/kms/model_wrapping_key.go +++ b/services/kms/model_wrapping_key.go @@ -19,6 +19,26 @@ import ( // checks if the WrappingKey type satisfies the MappedNullable interface at compile time var _ MappedNullable = &WrappingKey{} +/* + types and functions for access_scope +*/ + +// isEnumRef +type WrappingKeyGetAccessScopeAttributeType = *AccessScope +type WrappingKeyGetAccessScopeArgType = AccessScope +type WrappingKeyGetAccessScopeRetType = AccessScope + +func getWrappingKeyGetAccessScopeAttributeTypeOk(arg WrappingKeyGetAccessScopeAttributeType) (ret WrappingKeyGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetAccessScopeAttributeType(arg *WrappingKeyGetAccessScopeAttributeType, val WrappingKeyGetAccessScopeRetType) { + *arg = &val +} + /* types and functions for algorithm */ @@ -183,6 +203,26 @@ func setWrappingKeyGetKeyRingIdAttributeType(arg *WrappingKeyGetKeyRingIdAttribu type WrappingKeyGetKeyRingIdArgType = string type WrappingKeyGetKeyRingIdRetType = string +/* + types and functions for protection +*/ + +// isEnumRef +type WrappingKeyGetProtectionAttributeType = *Protection +type WrappingKeyGetProtectionArgType = Protection +type WrappingKeyGetProtectionRetType = Protection + +func getWrappingKeyGetProtectionAttributeTypeOk(arg WrappingKeyGetProtectionAttributeType) (ret WrappingKeyGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetProtectionAttributeType(arg *WrappingKeyGetProtectionAttributeType, val WrappingKeyGetProtectionRetType) { + *arg = &val +} + /* types and functions for publicKey */ @@ -356,8 +396,11 @@ func setWrappingKeyGetStateAttributeType(arg *WrappingKeyGetStateAttributeType, // WrappingKey struct for WrappingKey type WrappingKey struct { + // REQUIRED + AccessScope WrappingKeyGetAccessScopeAttributeType `json:"access_scope" required:"true"` // REQUIRED Algorithm WrappingKeyGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives // REQUIRED Backend WrappingKeyGetBackendAttributeType `json:"backend" required:"true"` // The date and time the creation of the wrapping key was triggered. @@ -376,7 +419,8 @@ type WrappingKey struct { Id WrappingKeyGetIdAttributeType `json:"id" required:"true"` // The unique id of the key ring this wrapping key is assigned to. // REQUIRED - KeyRingId WrappingKeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + KeyRingId WrappingKeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + Protection WrappingKeyGetProtectionAttributeType `json:"protection,omitempty"` // The public key of the wrapping key. PublicKey WrappingKeyGetPublicKeyAttributeType `json:"publicKey,omitempty"` // REQUIRED @@ -392,8 +436,9 @@ type _WrappingKey WrappingKey // 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 NewWrappingKey(algorithm WrappingKeyGetAlgorithmArgType, backend WrappingKeyGetBackendArgType, createdAt WrappingKeyGetCreatedAtArgType, displayName WrappingKeyGetDisplayNameArgType, expiresAt WrappingKeyGetExpiresAtArgType, id WrappingKeyGetIdArgType, keyRingId WrappingKeyGetKeyRingIdArgType, purpose WrappingKeyGetPurposeArgType, state WrappingKeyGetStateArgType) *WrappingKey { +func NewWrappingKey(accessScope WrappingKeyGetAccessScopeArgType, algorithm WrappingKeyGetAlgorithmArgType, backend WrappingKeyGetBackendArgType, createdAt WrappingKeyGetCreatedAtArgType, displayName WrappingKeyGetDisplayNameArgType, expiresAt WrappingKeyGetExpiresAtArgType, id WrappingKeyGetIdArgType, keyRingId WrappingKeyGetKeyRingIdArgType, purpose WrappingKeyGetPurposeArgType, state WrappingKeyGetStateArgType) *WrappingKey { this := WrappingKey{} + setWrappingKeyGetAccessScopeAttributeType(&this.AccessScope, accessScope) setWrappingKeyGetAlgorithmAttributeType(&this.Algorithm, algorithm) setWrappingKeyGetBackendAttributeType(&this.Backend, backend) setWrappingKeyGetCreatedAtAttributeType(&this.CreatedAt, createdAt) @@ -411,9 +456,28 @@ func NewWrappingKey(algorithm WrappingKeyGetAlgorithmArgType, backend WrappingKe // but it doesn't guarantee that properties required by API are set func NewWrappingKeyWithDefaults() *WrappingKey { this := WrappingKey{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope return &this } +// GetAccessScope returns the AccessScope field value +func (o *WrappingKey) GetAccessScope() (ret WrappingKeyGetAccessScopeRetType) { + 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 *WrappingKey) GetAccessScopeOk() (ret WrappingKeyGetAccessScopeRetType, ok bool) { + return getWrappingKeyGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// SetAccessScope sets field value +func (o *WrappingKey) SetAccessScope(v WrappingKeyGetAccessScopeRetType) { + setWrappingKeyGetAccessScopeAttributeType(&o.AccessScope, v) +} + // GetAlgorithm returns the Algorithm field value func (o *WrappingKey) GetAlgorithm() (ret WrappingKeyGetAlgorithmRetType) { ret, _ = o.GetAlgorithmOk() @@ -432,6 +496,7 @@ func (o *WrappingKey) SetAlgorithm(v WrappingKeyGetAlgorithmRetType) { } // GetBackend returns the Backend field value +// Deprecated func (o *WrappingKey) GetBackend() (ret WrappingKeyGetBackendRetType) { ret, _ = o.GetBackendOk() return ret @@ -439,11 +504,13 @@ func (o *WrappingKey) GetBackend() (ret WrappingKeyGetBackendRetType) { // GetBackendOk returns a tuple with the Backend field value // and a boolean to check if the value has been set. +// Deprecated func (o *WrappingKey) GetBackendOk() (ret WrappingKeyGetBackendRetType, ok bool) { return getWrappingKeyGetBackendAttributeTypeOk(o.Backend) } // SetBackend sets field value +// Deprecated func (o *WrappingKey) SetBackend(v WrappingKeyGetBackendRetType) { setWrappingKeyGetBackendAttributeType(&o.Backend, v) } @@ -556,6 +623,29 @@ func (o *WrappingKey) SetKeyRingId(v WrappingKeyGetKeyRingIdRetType) { setWrappingKeyGetKeyRingIdAttributeType(&o.KeyRingId, v) } +// GetProtection returns the Protection field value if set, zero value otherwise. +func (o *WrappingKey) GetProtection() (res WrappingKeyGetProtectionRetType) { + res, _ = o.GetProtectionOk() + return +} + +// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetProtectionOk() (ret WrappingKeyGetProtectionRetType, ok bool) { + return getWrappingKeyGetProtectionAttributeTypeOk(o.Protection) +} + +// HasProtection returns a boolean if a field has been set. +func (o *WrappingKey) HasProtection() bool { + _, ok := o.GetProtectionOk() + return ok +} + +// SetProtection gets a reference to the given Protection and assigns it to the Protection field. +func (o *WrappingKey) SetProtection(v WrappingKeyGetProtectionRetType) { + setWrappingKeyGetProtectionAttributeType(&o.Protection, v) +} + // GetPublicKey returns the PublicKey field value if set, zero value otherwise. func (o *WrappingKey) GetPublicKey() (res WrappingKeyGetPublicKeyRetType) { res, _ = o.GetPublicKeyOk() @@ -615,6 +705,9 @@ func (o *WrappingKey) SetState(v WrappingKeyGetStateRetType) { func (o WrappingKey) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getWrappingKeyGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } if val, ok := getWrappingKeyGetAlgorithmAttributeTypeOk(o.Algorithm); ok { toSerialize["Algorithm"] = val } @@ -639,6 +732,9 @@ func (o WrappingKey) ToMap() (map[string]interface{}, error) { if val, ok := getWrappingKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId); ok { toSerialize["KeyRingId"] = val } + if val, ok := getWrappingKeyGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } if val, ok := getWrappingKeyGetPublicKeyAttributeTypeOk(o.PublicKey); ok { toSerialize["PublicKey"] = val }