From 09c618bdaaafaea4e72a3b6c8f6afbd2a387d416 Mon Sep 17 00:00:00 2001 From: shacharn Date: Tue, 25 Jan 2022 14:41:15 +0200 Subject: [PATCH 1/6] update to latest api-docs changes --- common/version.go | 2 +- secretsmanagerv1/secrets_manager_v1.go | 601 ++++---------------- secretsmanagerv1/secrets_manager_v1_test.go | 88 +-- 3 files changed, 144 insertions(+), 547 deletions(-) diff --git a/common/version.go b/common/version.go index 3a31817..72a736c 100644 --- a/common/version.go +++ b/common/version.go @@ -17,4 +17,4 @@ package common // Version of the SDK -const Version = "1.0.29" +const Version = "1.0.32" diff --git a/secretsmanagerv1/secrets_manager_v1.go b/secretsmanagerv1/secrets_manager_v1.go index b0a8f45..0b44be9 100644 --- a/secretsmanagerv1/secrets_manager_v1.go +++ b/secretsmanagerv1/secrets_manager_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.43.3-d49d4b21-20220104-223519 + * IBM OpenAPI SDK Code Generator Version: 3.43.5-e0ec19e2-20220124-172004 */ // Package secretsmanagerv1 : Operations and models for the SecretsManagerV1 service @@ -37,7 +37,7 @@ import ( // SecretsManagerV1 : With IBM Cloud® Secrets Manager, you can create, lease, and centrally manage secrets that are used // in IBM Cloud services or your custom-built applications. Secrets are stored in a dedicated instance of Secrets -// Manager, built on open source HashiCorp Vault. +// Manager, which is built on open source HashiCorp Vault. // // API Version: 1.0.0 // See: https://cloud.ibm.com/docs/secrets-manager @@ -473,7 +473,7 @@ func (secretsManager *SecretsManagerV1) DeleteSecretGroupWithContext(ctx context } // CreateSecret : Create a secret -// Creates a secret or imports an existing value that you can use to access or authenticate to a protected resource. +// Create a secret or import an existing value that you can use to access or authenticate to a protected resource. // // Use this method to either generate or import an existing secret, such as an arbitrary value or a TLS certificate, // that you can manage in your Secrets Manager service instance. A successful request stores the secret in your @@ -689,7 +689,7 @@ func (secretsManager *SecretsManagerV1) ListAllSecretsWithContext(ctx context.Co } // GetSecret : Get a secret -// Retrieves a secret and its details by specifying the ID of the secret. +// Get a secret and its details by specifying the ID of the secret. // // A successful request returns the secret data that is associated with your secret, along with other metadata. To view // only the details of a specified secret without retrieving its value, use the [Get secret @@ -1476,7 +1476,7 @@ func (secretsManager *SecretsManagerV1) GetConfigWithContext(ctx context.Context // CreateConfigElement : Add a configuration // Adds a configuration element to the specified secret type. // -// Use this method to define the configurations that are required to enable the public certificates (`public_cert`) +// Use this method to define the configurations that are required to enable the public certificates (`public_cert`) // engine. You can add up to 10 certificate authority and DNS provider configurations for your instance. func (secretsManager *SecretsManagerV1) CreateConfigElement(createConfigElementOptions *CreateConfigElementOptions) (result *GetSingleConfigElement, response *core.DetailedResponse, err error) { return secretsManager.CreateConfigElementWithContext(context.Background(), createConfigElementOptions) @@ -1855,7 +1855,7 @@ type ConfigElementDef struct { Type *string `json:"type" validate:"required"` // The configuration to define for the specified secret type. - Config ConfigElementDefConfigIntf `json:"config" validate:"required"` + Config interface{} `json:"config" validate:"required"` } // Constants associated with the ConfigElementDef.Type property. @@ -1868,7 +1868,7 @@ const ( ) // NewConfigElementDef : Instantiate ConfigElementDef (Generic Model Constructor) -func (*SecretsManagerV1) NewConfigElementDef(name string, typeVar string, config ConfigElementDefConfigIntf) (_model *ConfigElementDef, err error) { +func (*SecretsManagerV1) NewConfigElementDef(name string, typeVar string, config interface{}) (_model *ConfigElementDef, err error) { _model = &ConfigElementDef{ Name: core.StringPtr(name), Type: core.StringPtr(typeVar), @@ -1889,87 +1889,7 @@ func UnmarshalConfigElementDef(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "config", &obj.Config, UnmarshalConfigElementDefConfig) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ConfigElementDefConfig : The configuration to define for the specified secret type. -// Models which "extend" this model: -// - ConfigElementDefConfigLetsEncryptConfig -// - ConfigElementDefConfigCloudInternetServicesConfig -// - ConfigElementDefConfigClassicInfrastructureConfig -type ConfigElementDefConfig struct { - // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. - // - // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable - // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). - PrivateKey *string `json:"private_key,omitempty"` - - // The Cloud Resource Name (CRN) that is associated with the CIS instance. - CisCRN *string `json:"cis_crn,omitempty"` - - // An IBM Cloud API key that has the capability to list domains in your CIS instance. - // - // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned - // the Reader service role on Internet Services (`internet-svcs`). - // - // If you need to manage specific domains, you can assign the Manager role. For production environments, it is - // recommended that you assign the Reader access role, and then use the - // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific - // domains. For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). - CisApikey *string `json:"cis_apikey,omitempty"` - - // The username that is associated with your classic infrastructure account. - // - // In most cases, your classic infrastructure username is your `_`. In the console, you can - // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructureUsername *string `json:"classic_infrastructure_username,omitempty"` - - // Your classic infrastructure API key. - // - // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) - // > Users > name > API keys.** For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructurePassword *string `json:"classic_infrastructure_password,omitempty"` -} - -func (*ConfigElementDefConfig) isaConfigElementDefConfig() bool { - return true -} - -type ConfigElementDefConfigIntf interface { - isaConfigElementDefConfig() bool -} - -// UnmarshalConfigElementDefConfig unmarshals an instance of ConfigElementDefConfig from the specified map of raw messages. -func UnmarshalConfigElementDefConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConfigElementDefConfig) - err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) + err = core.UnmarshalPrimitive(m, "config", &obj.Config) if err != nil { return } @@ -2025,7 +1945,7 @@ type CreateConfigElementOptions struct { Type *string `json:"type" validate:"required"` // The configuration to define for the specified secret type. - Config ConfigElementDefConfigIntf `json:"config" validate:"required"` + Config interface{} `json:"config" validate:"required"` // Allows users to set headers on API requests Headers map[string]string @@ -2054,7 +1974,7 @@ const ( ) // NewCreateConfigElementOptions : Instantiate CreateConfigElementOptions -func (*SecretsManagerV1) NewCreateConfigElementOptions(secretType string, configElement string, name string, typeVar string, config ConfigElementDefConfigIntf) *CreateConfigElementOptions { +func (*SecretsManagerV1) NewCreateConfigElementOptions(secretType string, configElement string, name string, typeVar string, config interface{}) *CreateConfigElementOptions { return &CreateConfigElementOptions{ SecretType: core.StringPtr(secretType), ConfigElement: core.StringPtr(configElement), @@ -2089,7 +2009,7 @@ func (_options *CreateConfigElementOptions) SetType(typeVar string) *CreateConfi } // SetConfig : Allow user to set Config -func (_options *CreateConfigElementOptions) SetConfig(config ConfigElementDefConfigIntf) *CreateConfigElementOptions { +func (_options *CreateConfigElementOptions) SetConfig(config interface{}) *CreateConfigElementOptions { _options.Config = config return _options } @@ -2174,7 +2094,7 @@ func (options *CreateSecretGroupOptions) SetHeaders(param map[string]string) *Cr // CreateSecretOptions : The CreateSecret options. type CreateSecretOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The metadata that describes the resource array. @@ -2188,7 +2108,7 @@ type CreateSecretOptions struct { } // Constants associated with the CreateSecretOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( CreateSecretOptionsSecretTypeArbitraryConst = "arbitrary" CreateSecretOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -2322,7 +2242,7 @@ func (options *DeleteSecretGroupOptions) SetHeaders(param map[string]string) *De // DeleteSecretOptions : The DeleteSecret options. type DeleteSecretOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -2333,7 +2253,7 @@ type DeleteSecretOptions struct { } // Constants associated with the DeleteSecretOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( DeleteSecretOptionsSecretTypeArbitraryConst = "arbitrary" DeleteSecretOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -2373,7 +2293,7 @@ func (options *DeleteSecretOptions) SetHeaders(param map[string]string) *DeleteS // Models which "extend" this model: // - CreateIamCredentialsSecretEngineRootConfig type EngineConfig struct { - // An IBM Cloud API key that has the capability to create and manage service IDs. + // An IBM Cloud API key that can create and manage service IDs. // // The API key must be assigned the Editor platform role on the Access Groups Service and the Operator platform role on // the IAM Identity Service. For more information, see the @@ -2646,7 +2566,7 @@ type GetConfigResourcesItem struct { // The DNS provider configurations that are associated with your instance. DNSProviders []ConfigElementMetadata `json:"dns_providers,omitempty"` - // An IBM Cloud API key that has the capability to create and manage service IDs. + // An IBM Cloud API key that can create and manage service IDs. // // The API key must be assigned the Editor platform role on the Access Groups Service and the Operator platform role on // the IAM Identity Service. For more information, see the @@ -2802,7 +2722,7 @@ func (options *GetSecretGroupOptions) SetHeaders(param map[string]string) *GetSe // GetSecretMetadataOptions : The GetSecretMetadata options. type GetSecretMetadataOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -2813,7 +2733,7 @@ type GetSecretMetadataOptions struct { } // Constants associated with the GetSecretMetadataOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( GetSecretMetadataOptionsSecretTypeArbitraryConst = "arbitrary" GetSecretMetadataOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -2851,7 +2771,7 @@ func (options *GetSecretMetadataOptions) SetHeaders(param map[string]string) *Ge // GetSecretOptions : The GetSecret options. type GetSecretOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -2862,7 +2782,7 @@ type GetSecretOptions struct { } // Constants associated with the GetSecretOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( GetSecretOptionsSecretTypeArbitraryConst = "arbitrary" GetSecretOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -2906,7 +2826,7 @@ type GetSecretPolicies struct { Metadata *CollectionMetadata `json:"metadata,omitempty"` // A collection of resources. - Resources []GetSecretPoliciesResourcesItem `json:"resources,omitempty"` + Resources []interface{} `json:"resources,omitempty"` } func (*GetSecretPolicies) isaGetSecretPolicies() bool { @@ -2924,149 +2844,7 @@ func UnmarshalGetSecretPolicies(m map[string]json.RawMessage, result interface{} if err != nil { return } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalGetSecretPoliciesResourcesItem) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// GetSecretPoliciesResourcesItem : Properties that describe a rotation policy. -type GetSecretPoliciesResourcesItem struct { - // The v4 UUID that uniquely identifies the policy. - ID *string `json:"id,omitempty"` - - // The Cloud Resource Name (CRN) that uniquely identifies your cloud resources. - CRN *string `json:"crn,omitempty"` - - // The date the policy was created. The date format follows RFC 3339. - CreationDate *strfmt.DateTime `json:"creation_date,omitempty"` - - // The unique identifier for the entity that created the policy. - CreatedBy *string `json:"created_by,omitempty"` - - // Updates when the policy is replaced or modified. The date format follows RFC 3339. - LastUpdateDate *strfmt.DateTime `json:"last_update_date,omitempty"` - - // The unique identifier for the entity that updated the policy. - UpdatedBy *string `json:"updated_by,omitempty"` - - // The MIME type that represents the policy. Currently, only the default is supported. - Type *string `json:"type" validate:"required"` - - Rotation SecretPolicyRotationRotationIntf `json:"rotation" validate:"required"` -} - -// Constants associated with the GetSecretPoliciesResourcesItem.Type property. -// The MIME type that represents the policy. Currently, only the default is supported. -const ( - GetSecretPoliciesResourcesItemTypeApplicationVndIBMSecretsManagerSecretPolicyJSONConst = "application/vnd.ibm.secrets-manager.secret.policy+json" -) - -// UnmarshalGetSecretPoliciesResourcesItem unmarshals an instance of GetSecretPoliciesResourcesItem from the specified map of raw messages. -func UnmarshalGetSecretPoliciesResourcesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(GetSecretPoliciesResourcesItem) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "creation_date", &obj.CreationDate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_update_date", &obj.LastUpdateDate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rotation", &obj.Rotation, UnmarshalSecretPolicyRotationRotation) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// GetSecretPolicyRotationResourcesItem : Properties that describe a rotation policy. -type GetSecretPolicyRotationResourcesItem struct { - // The v4 UUID that uniquely identifies the policy. - ID *string `json:"id,omitempty"` - - // The Cloud Resource Name (CRN) that uniquely identifies your cloud resources. - CRN *string `json:"crn,omitempty"` - - // The date the policy was created. The date format follows RFC 3339. - CreationDate *strfmt.DateTime `json:"creation_date,omitempty"` - - // The unique identifier for the entity that created the policy. - CreatedBy *string `json:"created_by,omitempty"` - - // Updates when the policy is replaced or modified. The date format follows RFC 3339. - LastUpdateDate *strfmt.DateTime `json:"last_update_date,omitempty"` - - // The unique identifier for the entity that updated the policy. - UpdatedBy *string `json:"updated_by,omitempty"` - - // The MIME type that represents the policy. Currently, only the default is supported. - Type *string `json:"type" validate:"required"` - - Rotation SecretPolicyRotationRotationIntf `json:"rotation" validate:"required"` -} - -// Constants associated with the GetSecretPolicyRotationResourcesItem.Type property. -// The MIME type that represents the policy. Currently, only the default is supported. -const ( - GetSecretPolicyRotationResourcesItemTypeApplicationVndIBMSecretsManagerSecretPolicyJSONConst = "application/vnd.ibm.secrets-manager.secret.policy+json" -) - -// UnmarshalGetSecretPolicyRotationResourcesItem unmarshals an instance of GetSecretPolicyRotationResourcesItem from the specified map of raw messages. -func UnmarshalGetSecretPolicyRotationResourcesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(GetSecretPolicyRotationResourcesItem) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "creation_date", &obj.CreationDate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last_update_date", &obj.LastUpdateDate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rotation", &obj.Rotation, UnmarshalSecretPolicyRotationRotation) + err = core.UnmarshalPrimitive(m, "resources", &obj.Resources) if err != nil { return } @@ -3124,7 +2902,7 @@ func UnmarshalGetSecretVersionMetadata(m map[string]json.RawMessage, result inte // GetSecretVersionMetadataOptions : The GetSecretVersionMetadata options. type GetSecretVersionMetadataOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -3142,7 +2920,7 @@ type GetSecretVersionMetadataOptions struct { } // Constants associated with the GetSecretVersionMetadataOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( GetSecretVersionMetadataOptionsSecretTypeArbitraryConst = "arbitrary" GetSecretVersionMetadataOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -3187,7 +2965,7 @@ func (options *GetSecretVersionMetadataOptions) SetHeaders(param map[string]stri // GetSecretVersionOptions : The GetSecretVersion options. type GetSecretVersionOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -3205,7 +2983,7 @@ type GetSecretVersionOptions struct { } // Constants associated with the GetSecretVersionOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( GetSecretVersionOptionsSecretTypeArbitraryConst = "arbitrary" GetSecretVersionOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -3277,7 +3055,7 @@ type IssuanceInfo struct { // The date the certificate was ordered. The date format follows RFC 3339. OrderedOn *strfmt.DateTime `json:"ordered_on,omitempty"` - // An code that identifies an issuance error. + // A code that identifies an issuance error. // // This field, along with `error_message`, is returned when Secrets Manager successfully processes your request, but a // certificate is unable to be issued by the certificate authority. @@ -3489,7 +3267,7 @@ func UnmarshalListSecretVersions(m map[string]json.RawMessage, result interface{ // ListSecretVersionsOptions : The ListSecretVersions options. type ListSecretVersionsOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -3500,7 +3278,7 @@ type ListSecretVersionsOptions struct { } // Constants associated with the ListSecretVersionsOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( ListSecretVersionsOptionsSecretTypeArbitraryConst = "arbitrary" ListSecretVersionsOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -3562,7 +3340,7 @@ func UnmarshalListSecrets(m map[string]json.RawMessage, result interface{}) (err // ListSecretsOptions : The ListSecrets options. type ListSecretsOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The number of secrets to retrieve. By default, list operations return the first 200 items. To retrieve a different @@ -3584,7 +3362,7 @@ type ListSecretsOptions struct { } // Constants associated with the ListSecretsOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( ListSecretsOptionsSecretTypeArbitraryConst = "arbitrary" ListSecretsOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -3754,7 +3532,7 @@ type Rotation struct { // Determines whether Secrets Manager rotates your certificate automatically. // // If set to `true`, the service reorders your certificate 31 days before it expires. To access the previous version - // of the certifcate, you can use the [Get a version of a secret](#get-secret-version) method. + // of the certificate, you can use the [Get a version of a secret](#get-secret-version) method. AutoRotate *bool `json:"auto_rotate,omitempty"` // Determines whether Secrets Manager rotates the private key for your certificate automatically. @@ -3791,7 +3569,7 @@ type SecretAction struct { // The new secret data to assign to an `arbitrary` secret. Payload *string `json:"payload,omitempty"` - // Determine whether keys should be rotated. + // Determine whether keys must be rotated. RotateKeys *bool `json:"rotate_keys,omitempty"` // The new password to assign to a `username_password` secret. @@ -3810,7 +3588,7 @@ type SecretAction struct { VersionID *string `json:"version_id,omitempty"` // The ID of the API key that you want to delete. If the secret was created with a static service ID, only the API key - // is deleted. Otherwise the service ID is deleted together with its API key. + // is deleted. Otherwise, the service ID is deleted together with its API key. APIKeyID *string `json:"api_key_id,omitempty"` // The service ID that you want to delete. This property can be used instead of the `api_key_id` field, but only for @@ -4079,8 +3857,8 @@ type SecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -4140,19 +3918,21 @@ type SecretMetadata struct { // For `iam_credentials` secrets, the TTL defines for how long each generated API key remains valid. The value can be // either an integer that specifies the number of seconds, or the string representation of a duration, such as `120m` // or `24h`. + // + // Minimum duration is 1 minute. Maximum is 90 days. TTL interface{} `json:"ttl,omitempty"` // Determines whether to use the same service ID and API key for future read operations on an // `iam_credentials` secret. // - // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key is + // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key are // generated each time that the secret is read or accessed. ReuseAPIKey *bool `json:"reuse_api_key,omitempty"` // Indicates whether an `iam_credentials` secret was created with a static service ID. // - // If `true`, the service ID for the secret was provided by the user at secret creation. If `false`, the service ID was - // generated by Secrets Manager. + // If the value is `true`, the service ID for the secret was provided by the user at secret creation. If the value is + // `false`, the service ID was generated by Secrets Manager. ServiceIDIsStatic *bool `json:"service_id_is_static,omitempty"` // The service ID under which the API key is created. The service ID is included in the metadata only if the secret was @@ -4167,8 +3947,8 @@ type SecretMetadata struct { // The unique serial number that was assigned to the certificate by the issuing certificate authority. SerialNumber *string `json:"serial_number,omitempty"` - // The identifier for the cryptographic algorthim that was used by the issuing certificate authority to sign the - // ceritificate. + // The identifier for the cryptographic algorithm that was used by the issuing certificate authority to sign the + // certificate. Algorithm *string `json:"algorithm,omitempty"` // The identifier for the cryptographic algorithm that was used to generate the public key that is associated with the @@ -4509,7 +4289,7 @@ type SecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -4577,6 +4357,8 @@ type SecretResource struct { // For `iam_credentials` secrets, the TTL defines for how long each generated API key remains valid. The value can be // either an integer that specifies the number of seconds, or the string representation of a duration, such as `120m` // or `24h`. + // + // Minimum duration is 1 minute. Maximum is 90 days. TTL interface{} `json:"ttl,omitempty"` // The access groups that define the capabilities of the service ID and API key that are generated for an @@ -4617,7 +4399,7 @@ type SecretResource struct { // Determines whether to use the same service ID and API key for future read operations on an // `iam_credentials` secret. // - // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key is + // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key are // generated each time that the secret is read or accessed. ReuseAPIKey *bool `json:"reuse_api_key,omitempty"` @@ -4635,8 +4417,8 @@ type SecretResource struct { // The unique serial number that was assigned to the certificate by the issuing certificate authority. SerialNumber *string `json:"serial_number,omitempty"` - // The identifier for the cryptographic algorthim that was used by the issuing certificate authority to sign the - // ceritificate. + // The identifier for the cryptographic algorithm that was used by the issuing certificate authority to sign the + // certificate. Algorithm *string `json:"algorithm,omitempty"` // The identifier for the cryptographic algorithm that was used to generate the public key that is associated with the @@ -4987,8 +4769,8 @@ type SecretVersionInfo struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` // Indicates whether the version of the secret was created by automatic rotation. @@ -5076,8 +4858,8 @@ type SecretVersionMetadata struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` // Indicates whether the version of the secret was created by automatic rotation. @@ -5161,7 +4943,7 @@ type UpdateConfigElementOptions struct { // The type of configuration. Value options differ depending on the `config_element` property that you want to define. Type *string `json:"type" validate:"required"` - // Properties that describe a configuration, depends on type. + // Properties that describe a configuration, which depends on type. Config interface{} `json:"config" validate:"required"` // Allows users to set headers on API requests @@ -5287,7 +5069,7 @@ func (options *UpdateSecretGroupMetadataOptions) SetHeaders(param map[string]str // UpdateSecretMetadataOptions : The UpdateSecretMetadata options. type UpdateSecretMetadataOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -5304,7 +5086,7 @@ type UpdateSecretMetadataOptions struct { } // Constants associated with the UpdateSecretMetadataOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( UpdateSecretMetadataOptionsSecretTypeArbitraryConst = "arbitrary" UpdateSecretMetadataOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -5356,7 +5138,7 @@ func (options *UpdateSecretMetadataOptions) SetHeaders(param map[string]string) // UpdateSecretOptions : The UpdateSecret options. type UpdateSecretOptions struct { - // The secret type. Kv is not supported at present. + // The secret type. SecretType *string `json:"secret_type" validate:"required,ne="` // The v4 UUID that uniquely identifies the secret. @@ -5373,7 +5155,7 @@ type UpdateSecretOptions struct { } // Constants associated with the UpdateSecretOptions.SecretType property. -// The secret type. Kv is not supported at present. +// The secret type. const ( UpdateSecretOptionsSecretTypeArbitraryConst = "arbitrary" UpdateSecretOptionsSecretTypeIamCredentialsConst = "iam_credentials" @@ -5462,8 +5244,8 @@ type ArbitrarySecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -5629,7 +5411,7 @@ type ArbitrarySecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -5845,8 +5627,8 @@ type ArbitrarySecretVersionInfo struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` } @@ -5899,8 +5681,8 @@ type ArbitrarySecretVersionMetadata struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` } @@ -5947,8 +5729,8 @@ type CertificateSecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -5996,8 +5778,8 @@ type CertificateSecretMetadata struct { // The unique serial number that was assigned to the certificate by the issuing certificate authority. SerialNumber *string `json:"serial_number,omitempty"` - // The identifier for the cryptographic algorthim that was used by the issuing certificate authority to sign the - // ceritificate. + // The identifier for the cryptographic algorithm that was used by the issuing certificate authority to sign the + // certificate. Algorithm *string `json:"algorithm,omitempty"` // The identifier for the cryptographic algorithm that was used to generate the public key that is associated with the @@ -6171,7 +5953,7 @@ type CertificateSecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -6226,8 +6008,8 @@ type CertificateSecretResource struct { // The unique serial number that was assigned to the certificate by the issuing certificate authority. SerialNumber *string `json:"serial_number,omitempty"` - // The identifier for the cryptographic algorthim that was used by the issuing certificate authority to sign the - // ceritificate. + // The identifier for the cryptographic algorithm that was used by the issuing certificate authority to sign the + // certificate. Algorithm *string `json:"algorithm,omitempty"` // The identifier for the cryptographic algorithm that was used to generate the public key that is associated with the @@ -6486,8 +6268,8 @@ type CertificateSecretVersionInfo struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` // The unique serial number that was assigned to the certificate by the issuing certificate authority. @@ -6560,8 +6342,8 @@ type CertificateSecretVersionMetadata struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` // The unique serial number that was assigned to the certificate by the issuing certificate authority. @@ -6620,141 +6402,10 @@ func UnmarshalCertificateSecretVersionMetadata(m map[string]json.RawMessage, res return } -// ConfigElementDefConfigClassicInfrastructureConfig : Properties that describe an IBM Cloud classic infrastructure (SoftLayer) configuration. -// This model "extends" ConfigElementDefConfig -type ConfigElementDefConfigClassicInfrastructureConfig struct { - // The username that is associated with your classic infrastructure account. - // - // In most cases, your classic infrastructure username is your `_`. In the console, you can - // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructureUsername *string `json:"classic_infrastructure_username" validate:"required"` - - // Your classic infrastructure API key. - // - // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) - // > Users > name > API keys.** For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructurePassword *string `json:"classic_infrastructure_password" validate:"required"` -} - -// NewConfigElementDefConfigClassicInfrastructureConfig : Instantiate ConfigElementDefConfigClassicInfrastructureConfig (Generic Model Constructor) -func (*SecretsManagerV1) NewConfigElementDefConfigClassicInfrastructureConfig(classicInfrastructureUsername string, classicInfrastructurePassword string) (_model *ConfigElementDefConfigClassicInfrastructureConfig, err error) { - _model = &ConfigElementDefConfigClassicInfrastructureConfig{ - ClassicInfrastructureUsername: core.StringPtr(classicInfrastructureUsername), - ClassicInfrastructurePassword: core.StringPtr(classicInfrastructurePassword), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ConfigElementDefConfigClassicInfrastructureConfig) isaConfigElementDefConfig() bool { - return true -} - -// UnmarshalConfigElementDefConfigClassicInfrastructureConfig unmarshals an instance of ConfigElementDefConfigClassicInfrastructureConfig from the specified map of raw messages. -func UnmarshalConfigElementDefConfigClassicInfrastructureConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConfigElementDefConfigClassicInfrastructureConfig) - err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ConfigElementDefConfigCloudInternetServicesConfig : Properties that describe an IBM Cloud Internet Services (CIS) configuration. -// This model "extends" ConfigElementDefConfig -type ConfigElementDefConfigCloudInternetServicesConfig struct { - // The Cloud Resource Name (CRN) that is associated with the CIS instance. - CisCRN *string `json:"cis_crn" validate:"required"` - - // An IBM Cloud API key that has the capability to list domains in your CIS instance. - // - // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned - // the Reader service role on Internet Services (`internet-svcs`). - // - // If you need to manage specific domains, you can assign the Manager role. For production environments, it is - // recommended that you assign the Reader access role, and then use the - // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific - // domains. For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). - CisApikey *string `json:"cis_apikey,omitempty"` -} - -// NewConfigElementDefConfigCloudInternetServicesConfig : Instantiate ConfigElementDefConfigCloudInternetServicesConfig (Generic Model Constructor) -func (*SecretsManagerV1) NewConfigElementDefConfigCloudInternetServicesConfig(cisCRN string) (_model *ConfigElementDefConfigCloudInternetServicesConfig, err error) { - _model = &ConfigElementDefConfigCloudInternetServicesConfig{ - CisCRN: core.StringPtr(cisCRN), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ConfigElementDefConfigCloudInternetServicesConfig) isaConfigElementDefConfig() bool { - return true -} - -// UnmarshalConfigElementDefConfigCloudInternetServicesConfig unmarshals an instance of ConfigElementDefConfigCloudInternetServicesConfig from the specified map of raw messages. -func UnmarshalConfigElementDefConfigCloudInternetServicesConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConfigElementDefConfigCloudInternetServicesConfig) - err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ConfigElementDefConfigLetsEncryptConfig : Properties that describe a Let's Encrypt configuration. -// This model "extends" ConfigElementDefConfig -type ConfigElementDefConfigLetsEncryptConfig struct { - // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. - // - // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable - // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). - PrivateKey *string `json:"private_key" validate:"required"` -} - -// NewConfigElementDefConfigLetsEncryptConfig : Instantiate ConfigElementDefConfigLetsEncryptConfig (Generic Model Constructor) -func (*SecretsManagerV1) NewConfigElementDefConfigLetsEncryptConfig(privateKey string) (_model *ConfigElementDefConfigLetsEncryptConfig, err error) { - _model = &ConfigElementDefConfigLetsEncryptConfig{ - PrivateKey: core.StringPtr(privateKey), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ConfigElementDefConfigLetsEncryptConfig) isaConfigElementDefConfig() bool { - return true -} - -// UnmarshalConfigElementDefConfigLetsEncryptConfig unmarshals an instance of ConfigElementDefConfigLetsEncryptConfig from the specified map of raw messages. -func UnmarshalConfigElementDefConfigLetsEncryptConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConfigElementDefConfigLetsEncryptConfig) - err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // CreateIamCredentialsSecretEngineRootConfig : Configuration for the IAM credentials engine. // This model "extends" EngineConfig type CreateIamCredentialsSecretEngineRootConfig struct { - // An IBM Cloud API key that has the capability to create and manage service IDs. + // An IBM Cloud API key that can create and manage service IDs. // // The API key must be assigned the Editor platform role on the Access Groups Service and the Operator platform role on // the IAM Identity Service. For more information, see the @@ -6797,7 +6448,7 @@ func UnmarshalCreateIamCredentialsSecretEngineRootConfig(m map[string]json.RawMe // This model "extends" SecretAction type DeleteCredentialsForIamCredentialsSecret struct { // The ID of the API key that you want to delete. If the secret was created with a static service ID, only the API key - // is deleted. Otherwise the service ID is deleted together with its API key. + // is deleted. Otherwise, the service ID is deleted together with its API key. APIKeyID *string `json:"api_key_id,omitempty"` // The service ID that you want to delete. This property can be used instead of the `api_key_id` field, but only for @@ -6875,7 +6526,7 @@ type GetSecretPolicyRotation struct { Metadata *CollectionMetadata `json:"metadata" validate:"required"` // A collection of resources. - Resources []GetSecretPolicyRotationResourcesItem `json:"resources" validate:"required"` + Resources []interface{} `json:"resources" validate:"required"` } func (*GetSecretPolicyRotation) isaGetSecretPolicies() bool { @@ -6889,7 +6540,7 @@ func UnmarshalGetSecretPolicyRotation(m map[string]json.RawMessage, result inter if err != nil { return } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalGetSecretPolicyRotationResourcesItem) + err = core.UnmarshalPrimitive(m, "resources", &obj.Resources) if err != nil { return } @@ -6900,7 +6551,7 @@ func UnmarshalGetSecretPolicyRotation(m map[string]json.RawMessage, result inter // IamCredentialsSecretEngineRootConfig : Configuration for the IAM credentials engine. // This model "extends" GetConfigResourcesItem type IamCredentialsSecretEngineRootConfig struct { - // An IBM Cloud API key that has the capability to create and manage service IDs. + // An IBM Cloud API key that can create and manage service IDs. // // The API key must be assigned the Editor platform role on the Access Groups Service and the Operator platform role on // the IAM Identity Service. For more information, see the @@ -6938,8 +6589,8 @@ type IamCredentialsSecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -6989,19 +6640,21 @@ type IamCredentialsSecretMetadata struct { // For `iam_credentials` secrets, the TTL defines for how long each generated API key remains valid. The value can be // either an integer that specifies the number of seconds, or the string representation of a duration, such as `120m` // or `24h`. + // + // Minimum duration is 1 minute. Maximum is 90 days. TTL interface{} `json:"ttl,omitempty"` // Determines whether to use the same service ID and API key for future read operations on an // `iam_credentials` secret. // - // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key is + // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key are // generated each time that the secret is read or accessed. ReuseAPIKey *bool `json:"reuse_api_key,omitempty"` // Indicates whether an `iam_credentials` secret was created with a static service ID. // - // If `true`, the service ID for the secret was provided by the user at secret creation. If `false`, the service ID was - // generated by Secrets Manager. + // If the value is `true`, the service ID for the secret was provided by the user at secret creation. If the value is + // `false`, the service ID was generated by Secrets Manager. ServiceIDIsStatic *bool `json:"service_id_is_static,omitempty"` // The service ID under which the API key is created. The service ID is included in the metadata only if the secret was @@ -7140,7 +6793,7 @@ type IamCredentialsSecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -7180,6 +6833,8 @@ type IamCredentialsSecretResource struct { // For `iam_credentials` secrets, the TTL defines for how long each generated API key remains valid. The value can be // either an integer that specifies the number of seconds, or the string representation of a duration, such as `120m` // or `24h`. + // + // Minimum duration is 1 minute. Maximum is 90 days. TTL interface{} `json:"ttl,omitempty"` // The access groups that define the capabilities of the service ID and API key that are generated for an @@ -7220,7 +6875,7 @@ type IamCredentialsSecretResource struct { // Determines whether to use the same service ID and API key for future read operations on an // `iam_credentials` secret. // - // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key is + // If set to `true`, the service reuses the current credentials. If set to `false`, a new service ID and API key are // generated each time that the secret is read or accessed. ReuseAPIKey *bool `json:"reuse_api_key,omitempty"` } @@ -7408,8 +7063,8 @@ type IamCredentialsSecretVersionInfo struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` } @@ -7462,8 +7117,8 @@ type IamCredentialsSecretVersionMetadata struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` } @@ -7502,7 +7157,7 @@ func UnmarshalIamCredentialsSecretVersionMetadata(m map[string]json.RawMessage, return } -// KvSecretMetadata : Metadata properties that describe a Kv secret. +// KvSecretMetadata : Metadata properties that describe a key-value secret. // This model "extends" SecretMetadata type KvSecretMetadata struct { // The unique ID of the secret. @@ -7510,8 +7165,8 @@ type KvSecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -7555,16 +7210,6 @@ type KvSecretMetadata struct { // The number of versions the secret has. VersionsTotal *int64 `json:"versions_total,omitempty"` - - // The date the secret material expires. The date format follows RFC 3339. - // - // You can set an expiration date on supported secret types at their creation. If you create a secret without - // specifying an expiration date, the secret does not expire. The `expiration_date` field is supported for the - // following secret types: - // - // - `arbitrary` - // - `username_password`. - ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"` } // Constants associated with the KvSecretMetadata.SecretType property. @@ -7646,10 +7291,6 @@ func UnmarshalKvSecretMetadata(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -7677,7 +7318,7 @@ type KvSecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -7865,8 +7506,8 @@ type PublicCertificateSecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -7919,8 +7560,8 @@ type PublicCertificateSecretMetadata struct { // Set to `false` for the certificate file to contain only the issued certificate. BundleCerts *bool `json:"bundle_certs,omitempty"` - // The identifier for the cryptographic algorthim to be used by the issuing certificate authority to sign the - // ceritificate. + // The identifier for the cryptographic algorithm to be used by the issuing certificate authority to sign the + // certificate. Algorithm *string `json:"algorithm,omitempty"` // The identifier for the cryptographic algorithm to be used to generate the public key that is associated with the @@ -8101,7 +7742,7 @@ type PublicCertificateSecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -8154,15 +7795,15 @@ type PublicCertificateSecretResource struct { // To view a list of your configured authorities, use the [List configurations API](#get-secret-config-element). DNS *string `json:"dns,omitempty"` - // The identifier for the cryptographic algorthim to be used by the issuing certificate authority to sign the - // ceritificate. + // The identifier for the cryptographic algorithm to be used by the issuing certificate authority to sign the + // certificate. Algorithm *string `json:"algorithm,omitempty"` // The identifier for the cryptographic algorithm to be used to generate the public key that is associated with the // certificate. // - // The algorithm that you select determines the encryption algorthim (`RSA` or `ECDSA`) and key size to be used to - // generate keys and sign certificates. For longer living certificates it is recommended to use longer keys to provide + // The algorithm that you select determines the encryption algorithm (`RSA` or `ECDSA`) and key size to be used to + // generate keys and sign certificates. For longer living certificates, it is recommended to use longer keys to provide // more encryption protection. KeyAlgorithm *string `json:"key_algorithm,omitempty"` @@ -8210,8 +7851,8 @@ const ( // The identifier for the cryptographic algorithm to be used to generate the public key that is associated with the // certificate. // -// The algorithm that you select determines the encryption algorthim (`RSA` or `ECDSA`) and key size to be used to -// generate keys and sign certificates. For longer living certificates it is recommended to use longer keys to provide +// The algorithm that you select determines the encryption algorithm (`RSA` or `ECDSA`) and key size to be used to +// generate keys and sign certificates. For longer living certificates, it is recommended to use longer keys to provide // more encryption protection. const ( PublicCertificateSecretResourceKeyAlgorithmEc256Const = "EC256" @@ -8462,7 +8103,7 @@ func UnmarshalRotateCertificateBody(m map[string]json.RawMessage, result interfa // RotateKvSecretBody : The request body of a `rotate` action. // This model "extends" SecretAction type RotateKvSecretBody struct { - // The new secret data to assign to a `kv` secret. + // The new secret data to assign to a key-value secret. Payload interface{} `json:"payload" validate:"required"` } @@ -8493,7 +8134,7 @@ func UnmarshalRotateKvSecretBody(m map[string]json.RawMessage, result interface{ // RotatePublicCertBody : The request body of a `rotate` action. // This model "extends" SecretAction type RotatePublicCertBody struct { - // Determine whether keys should be rotated. + // Determine whether keys must be rotated. RotateKeys *bool `json:"rotate_keys" validate:"required"` } @@ -8643,8 +8284,8 @@ type UsernamePasswordSecretMetadata struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not - // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). + // Up to 30 labels can be created. Labels can be in the range 2 - 30 characters, including spaces. Special characters + // that are not permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. Labels []string `json:"labels,omitempty"` @@ -8810,7 +8451,7 @@ type UsernamePasswordSecretResource struct { // Labels that you can use to filter for secrets in your instance. // - // Up to 30 labels can be created. Labels can be between 2-30 characters, including spaces. Special characters not + // Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not // permitted include the angled bracket, comma, colon, ampersand, and vertical pipe character (|). // // To protect your privacy, do not use personal data, such as your name or location, as a label for your secret. @@ -9054,8 +8695,8 @@ type UsernamePasswordSecretVersionInfo struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` // Indicates whether the version of the secret was created by automatic rotation. @@ -9115,8 +8756,8 @@ type UsernamePasswordSecretVersionMetadata struct { // Indicates whether the payload for the secret version is stored and available. PayloadAvailable *bool `json:"payload_available,omitempty"` - // Indicates whether the secret data that is associated with a secret version has been retrieved in a call to the - // service API. + // Indicates whether the secret data that is associated with a secret version was retrieved in a call to the service + // API. Downloaded *bool `json:"downloaded,omitempty"` // Indicates whether the version of the secret was created by automatic rotation. diff --git a/secretsmanagerv1/secrets_manager_v1_test.go b/secretsmanagerv1/secrets_manager_v1_test.go index f2edbf2..50fb5cf 100644 --- a/secretsmanagerv1/secrets_manager_v1_test.go +++ b/secretsmanagerv1/secrets_manager_v1_test.go @@ -3903,7 +3903,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"id": "ID", "crn": "crn:v1:bluemix:public:kms::a/:", "creation_date": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "last_update_date": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "type": "application/vnd.ibm.secrets-manager.secret.policy+json", "rotation": {"interval": 1, "unit": "day"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"anyKey": "anyValue"}]}`) })) }) It(`Invoke PutPolicy successfully with retries`, func() { @@ -3993,7 +3993,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"id": "ID", "crn": "crn:v1:bluemix:public:kms::a/:", "creation_date": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "last_update_date": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "type": "application/vnd.ibm.secrets-manager.secret.policy+json", "rotation": {"interval": 1, "unit": "day"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"anyKey": "anyValue"}]}`) })) }) It(`Invoke PutPolicy successfully`, func() { @@ -4212,7 +4212,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"id": "ID", "crn": "crn:v1:bluemix:public:kms::a/:", "creation_date": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "last_update_date": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "type": "application/vnd.ibm.secrets-manager.secret.policy+json", "rotation": {"interval": 1, "unit": "day"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"anyKey": "anyValue"}]}`) })) }) It(`Invoke GetPolicy successfully with retries`, func() { @@ -4269,7 +4269,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"id": "ID", "crn": "crn:v1:bluemix:public:kms::a/:", "creation_date": "2019-01-01T12:00:00.000Z", "created_by": "CreatedBy", "last_update_date": "2019-01-01T12:00:00.000Z", "updated_by": "UpdatedBy", "type": "application/vnd.ibm.secrets-manager.secret.policy+json", "rotation": {"interval": 1, "unit": "day"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"anyKey": "anyValue"}]}`) })) }) It(`Invoke GetPolicy successfully`, func() { @@ -4700,17 +4700,13 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) - // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model - configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) - configElementDefConfigModel.PrivateKey = core.StringPtr("testString") - // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = configElementDefConfigModel + createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := secretsManagerService.CreateConfigElement(createConfigElementOptionsModel) @@ -4763,7 +4759,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) })) }) It(`Invoke CreateConfigElement successfully with retries`, func() { @@ -4775,17 +4771,13 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(secretsManagerService).ToNot(BeNil()) secretsManagerService.EnableRetries(0, 0) - // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model - configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) - configElementDefConfigModel.PrivateKey = core.StringPtr("testString") - // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = configElementDefConfigModel + createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -4841,7 +4833,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) })) }) It(`Invoke CreateConfigElement successfully`, func() { @@ -4858,17 +4850,13 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model - configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) - configElementDefConfigModel.PrivateKey = core.StringPtr("testString") - // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = configElementDefConfigModel + createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -4886,17 +4874,13 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) - // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model - configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) - configElementDefConfigModel.PrivateKey = core.StringPtr("testString") - // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = configElementDefConfigModel + createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := secretsManagerService.SetServiceURL("") @@ -4935,17 +4919,13 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) - // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model - configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) - configElementDefConfigModel.PrivateKey = core.StringPtr("testString") - // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = configElementDefConfigModel + createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -5242,7 +5222,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) })) }) It(`Invoke GetConfigElement successfully with retries`, func() { @@ -5298,7 +5278,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) })) }) It(`Invoke GetConfigElement successfully`, func() { @@ -5482,7 +5462,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) })) }) It(`Invoke UpdateConfigElement successfully with retries`, func() { @@ -5556,7 +5536,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) })) }) It(`Invoke UpdateConfigElement successfully`, func() { @@ -5752,36 +5732,31 @@ var _ = Describe(`SecretsManagerV1`, func() { It(`Invoke NewConfigElementDef successfully`, func() { name := "testString" typeVar := "letsencrypt" - var config secretsmanagerv1.ConfigElementDefConfigIntf = nil - _, err := secretsManagerService.NewConfigElementDef(name, typeVar, config) - Expect(err).ToNot(BeNil()) + config := map[string]interface{}{"anyKey": "anyValue"} + _model, err := secretsManagerService.NewConfigElementDef(name, typeVar, config) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) }) It(`Invoke NewCreateConfigElementOptions successfully`, func() { - // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model - configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) - Expect(configElementDefConfigModel).ToNot(BeNil()) - configElementDefConfigModel.PrivateKey = core.StringPtr("testString") - Expect(configElementDefConfigModel.PrivateKey).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the CreateConfigElementOptions model secretType := "public_cert" configElement := "certificate_authorities" createConfigElementOptionsName := "testString" createConfigElementOptionsType := "letsencrypt" - var createConfigElementOptionsConfig secretsmanagerv1.ConfigElementDefConfigIntf = nil + createConfigElementOptionsConfig := map[string]interface{}{"anyKey": "anyValue"} createConfigElementOptionsModel := secretsManagerService.NewCreateConfigElementOptions(secretType, configElement, createConfigElementOptionsName, createConfigElementOptionsType, createConfigElementOptionsConfig) createConfigElementOptionsModel.SetSecretType("public_cert") createConfigElementOptionsModel.SetConfigElement("certificate_authorities") createConfigElementOptionsModel.SetName("testString") createConfigElementOptionsModel.SetType("letsencrypt") - createConfigElementOptionsModel.SetConfig(configElementDefConfigModel) + createConfigElementOptionsModel.SetConfig(map[string]interface{}{"anyKey": "anyValue"}) createConfigElementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createConfigElementOptionsModel).ToNot(BeNil()) Expect(createConfigElementOptionsModel.SecretType).To(Equal(core.StringPtr("public_cert"))) Expect(createConfigElementOptionsModel.ConfigElement).To(Equal(core.StringPtr("certificate_authorities"))) Expect(createConfigElementOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(createConfigElementOptionsModel.Type).To(Equal(core.StringPtr("letsencrypt"))) - Expect(createConfigElementOptionsModel.Config).To(Equal(configElementDefConfigModel)) + Expect(createConfigElementOptionsModel.Config).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(createConfigElementOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateSecret successfully`, func() { @@ -6306,25 +6281,6 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewConfigElementDefConfigClassicInfrastructureConfig successfully`, func() { - classicInfrastructureUsername := "testString" - classicInfrastructurePassword := "testString" - _model, err := secretsManagerService.NewConfigElementDefConfigClassicInfrastructureConfig(classicInfrastructureUsername, classicInfrastructurePassword) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewConfigElementDefConfigCloudInternetServicesConfig successfully`, func() { - cisCRN := "crn:v1:bluemix:public:internet-svcs:global:a/:::" - _model, err := secretsManagerService.NewConfigElementDefConfigCloudInternetServicesConfig(cisCRN) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewConfigElementDefConfigLetsEncryptConfig successfully`, func() { - privateKey := "testString" - _model, err := secretsManagerService.NewConfigElementDefConfigLetsEncryptConfig(privateKey) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) It(`Invoke NewCreateIamCredentialsSecretEngineRootConfig successfully`, func() { apiKey := "API_KEY" _model, err := secretsManagerService.NewCreateIamCredentialsSecretEngineRootConfig(apiKey) From ae56a1ba30c83f938ac7bf3c4cdb0981a5793ac2 Mon Sep 17 00:00:00 2001 From: shacharn Date: Sun, 6 Feb 2022 11:43:17 +0200 Subject: [PATCH 2/6] update to latest api-docs changes --- secretsmanagerv1/secrets_manager_v1.go | 223 +++++++++++++++++- .../secrets_manager_v1_integration_test.go | 8 +- secretsmanagerv1/secrets_manager_v1_test.go | 80 +++++-- 3 files changed, 283 insertions(+), 28 deletions(-) diff --git a/secretsmanagerv1/secrets_manager_v1.go b/secretsmanagerv1/secrets_manager_v1.go index 0b44be9..3d35ba8 100644 --- a/secretsmanagerv1/secrets_manager_v1.go +++ b/secretsmanagerv1/secrets_manager_v1.go @@ -1855,7 +1855,7 @@ type ConfigElementDef struct { Type *string `json:"type" validate:"required"` // The configuration to define for the specified secret type. - Config interface{} `json:"config" validate:"required"` + Config SecretConfigIntf `json:"config" validate:"required"` } // Constants associated with the ConfigElementDef.Type property. @@ -1868,7 +1868,7 @@ const ( ) // NewConfigElementDef : Instantiate ConfigElementDef (Generic Model Constructor) -func (*SecretsManagerV1) NewConfigElementDef(name string, typeVar string, config interface{}) (_model *ConfigElementDef, err error) { +func (*SecretsManagerV1) NewConfigElementDef(name string, typeVar string, config SecretConfigIntf) (_model *ConfigElementDef, err error) { _model = &ConfigElementDef{ Name: core.StringPtr(name), Type: core.StringPtr(typeVar), @@ -1889,7 +1889,7 @@ func UnmarshalConfigElementDef(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "config", &obj.Config) + err = core.UnmarshalModel(m, "config", &obj.Config, UnmarshalSecretConfig) if err != nil { return } @@ -1945,7 +1945,7 @@ type CreateConfigElementOptions struct { Type *string `json:"type" validate:"required"` // The configuration to define for the specified secret type. - Config interface{} `json:"config" validate:"required"` + Config SecretConfigIntf `json:"config" validate:"required"` // Allows users to set headers on API requests Headers map[string]string @@ -1974,7 +1974,7 @@ const ( ) // NewCreateConfigElementOptions : Instantiate CreateConfigElementOptions -func (*SecretsManagerV1) NewCreateConfigElementOptions(secretType string, configElement string, name string, typeVar string, config interface{}) *CreateConfigElementOptions { +func (*SecretsManagerV1) NewCreateConfigElementOptions(secretType string, configElement string, name string, typeVar string, config SecretConfigIntf) *CreateConfigElementOptions { return &CreateConfigElementOptions{ SecretType: core.StringPtr(secretType), ConfigElement: core.StringPtr(configElement), @@ -2009,7 +2009,7 @@ func (_options *CreateConfigElementOptions) SetType(typeVar string) *CreateConfi } // SetConfig : Allow user to set Config -func (_options *CreateConfigElementOptions) SetConfig(config interface{}) *CreateConfigElementOptions { +func (_options *CreateConfigElementOptions) SetConfig(config SecretConfigIntf) *CreateConfigElementOptions { _options.Config = config return _options } @@ -3649,6 +3649,86 @@ func UnmarshalSecretAction(m map[string]json.RawMessage, result interface{}) (er return } +// SecretConfig : The configuration to define for the specified secret type. +// Models which "extend" this model: +// - SecretConfigLetsEncryptConfig +// - SecretConfigCloudInternetServicesConfig +// - SecretConfigClassicInfrastructureConfig +type SecretConfig struct { + // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. + // + // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable + // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). + PrivateKey *string `json:"private_key,omitempty"` + + // The Cloud Resource Name (CRN) that is associated with the CIS instance. + CisCRN *string `json:"cis_crn,omitempty"` + + // An IBM Cloud API key that can to list domains in your CIS instance. + // + // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned + // the Reader service role on Internet Services (`internet-svcs`). + // + // If you need to manage specific domains, you can assign the Manager role. For production environments, it is + // recommended that you assign the Reader access role, and then use the + // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific + // domains. For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). + CisApikey *string `json:"cis_apikey,omitempty"` + + // The username that is associated with your classic infrastructure account. + // + // In most cases, your classic infrastructure username is your `_`. In the console, you can + // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructureUsername *string `json:"classic_infrastructure_username,omitempty"` + + // Your classic infrastructure API key. + // + // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) + // > Users > name > API keys.** For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructurePassword *string `json:"classic_infrastructure_password,omitempty"` +} + +func (*SecretConfig) isaSecretConfig() bool { + return true +} + +type SecretConfigIntf interface { + isaSecretConfig() bool +} + +// UnmarshalSecretConfig unmarshals an instance of SecretConfig from the specified map of raw messages. +func UnmarshalSecretConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecretConfig) + err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SecretGroupDef : Properties that describe a secret group. type SecretGroupDef struct { // The metadata that describes the resource array. @@ -8193,6 +8273,137 @@ func UnmarshalRotateUsernamePasswordSecretBody(m map[string]json.RawMessage, res return } +// SecretConfigClassicInfrastructureConfig : Properties that describe an IBM Cloud classic infrastructure (SoftLayer) configuration. +// This model "extends" SecretConfig +type SecretConfigClassicInfrastructureConfig struct { + // The username that is associated with your classic infrastructure account. + // + // In most cases, your classic infrastructure username is your `_`. In the console, you can + // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructureUsername *string `json:"classic_infrastructure_username" validate:"required"` + + // Your classic infrastructure API key. + // + // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) + // > Users > name > API keys.** For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructurePassword *string `json:"classic_infrastructure_password" validate:"required"` +} + +// NewSecretConfigClassicInfrastructureConfig : Instantiate SecretConfigClassicInfrastructureConfig (Generic Model Constructor) +func (*SecretsManagerV1) NewSecretConfigClassicInfrastructureConfig(classicInfrastructureUsername string, classicInfrastructurePassword string) (_model *SecretConfigClassicInfrastructureConfig, err error) { + _model = &SecretConfigClassicInfrastructureConfig{ + ClassicInfrastructureUsername: core.StringPtr(classicInfrastructureUsername), + ClassicInfrastructurePassword: core.StringPtr(classicInfrastructurePassword), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecretConfigClassicInfrastructureConfig) isaSecretConfig() bool { + return true +} + +// UnmarshalSecretConfigClassicInfrastructureConfig unmarshals an instance of SecretConfigClassicInfrastructureConfig from the specified map of raw messages. +func UnmarshalSecretConfigClassicInfrastructureConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecretConfigClassicInfrastructureConfig) + err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecretConfigCloudInternetServicesConfig : Properties that describe an IBM Cloud Internet Services (CIS) configuration. +// This model "extends" SecretConfig +type SecretConfigCloudInternetServicesConfig struct { + // The Cloud Resource Name (CRN) that is associated with the CIS instance. + CisCRN *string `json:"cis_crn" validate:"required"` + + // An IBM Cloud API key that can to list domains in your CIS instance. + // + // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned + // the Reader service role on Internet Services (`internet-svcs`). + // + // If you need to manage specific domains, you can assign the Manager role. For production environments, it is + // recommended that you assign the Reader access role, and then use the + // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific + // domains. For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). + CisApikey *string `json:"cis_apikey,omitempty"` +} + +// NewSecretConfigCloudInternetServicesConfig : Instantiate SecretConfigCloudInternetServicesConfig (Generic Model Constructor) +func (*SecretsManagerV1) NewSecretConfigCloudInternetServicesConfig(cisCRN string) (_model *SecretConfigCloudInternetServicesConfig, err error) { + _model = &SecretConfigCloudInternetServicesConfig{ + CisCRN: core.StringPtr(cisCRN), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecretConfigCloudInternetServicesConfig) isaSecretConfig() bool { + return true +} + +// UnmarshalSecretConfigCloudInternetServicesConfig unmarshals an instance of SecretConfigCloudInternetServicesConfig from the specified map of raw messages. +func UnmarshalSecretConfigCloudInternetServicesConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecretConfigCloudInternetServicesConfig) + err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecretConfigLetsEncryptConfig : Properties that describe a Let's Encrypt configuration. +// This model "extends" SecretConfig +type SecretConfigLetsEncryptConfig struct { + // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. + // + // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable + // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). + PrivateKey *string `json:"private_key" validate:"required"` +} + +// NewSecretConfigLetsEncryptConfig : Instantiate SecretConfigLetsEncryptConfig (Generic Model Constructor) +func (*SecretsManagerV1) NewSecretConfigLetsEncryptConfig(privateKey string) (_model *SecretConfigLetsEncryptConfig, err error) { + _model = &SecretConfigLetsEncryptConfig{ + PrivateKey: core.StringPtr(privateKey), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecretConfigLetsEncryptConfig) isaSecretConfig() bool { + return true +} + +// UnmarshalSecretConfigLetsEncryptConfig unmarshals an instance of SecretConfigLetsEncryptConfig from the specified map of raw messages. +func UnmarshalSecretConfigLetsEncryptConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecretConfigLetsEncryptConfig) + err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SecretPolicyRotationRotationPolicyRotation : The secret rotation time interval. // This model "extends" SecretPolicyRotationRotation type SecretPolicyRotationRotationPolicyRotation struct { diff --git a/secretsmanagerv1/secrets_manager_v1_integration_test.go b/secretsmanagerv1/secrets_manager_v1_integration_test.go index 8516bcb..0f37b60 100644 --- a/secretsmanagerv1/secrets_manager_v1_integration_test.go +++ b/secretsmanagerv1/secrets_manager_v1_integration_test.go @@ -305,7 +305,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { caConfigName := generateName() + "le-stage-config" privateKey := strings.ReplaceAll(os.Getenv("CA_CONFIG_PRIVATE_KEY"), `\n`, "\n") - leConfig := secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig{ + leConfig := secretsmanagerv1.SecretConfig{ PrivateKey: &privateKey, } _, resp, err := secretsManager.CreateConfigElement(&secretsmanagerv1.CreateConfigElementOptions{ @@ -323,7 +323,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { cis := "cis" dnsConfigName := generateName() + "dns-config" - cisConfig := secretsmanagerv1.ConfigElementDefConfigCloudInternetServicesConfig{ + cisConfig := secretsmanagerv1.SecretConfig{ CisCRN: core.StringPtr(os.Getenv("DNS_CONFIG_CRN")), CisApikey: core.StringPtr(os.Getenv("DNS_CONFIG_API_KEY")), } @@ -419,7 +419,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { caConfigName := generateName() + "le-stage-config" privateKey := strings.ReplaceAll(os.Getenv("CA_CONFIG_PRIVATE_KEY"), `\n`, "\n") - leConfig := secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig{ + leConfig := secretsmanagerv1.SecretConfig{ PrivateKey: &privateKey, } _, resp, err := secretsManager.CreateConfigElement(&secretsmanagerv1.CreateConfigElementOptions{ @@ -448,7 +448,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { cis := "cis" dnsConfigName := generateName() + "dns-config" - cisConfig := secretsmanagerv1.ConfigElementDefConfigCloudInternetServicesConfig{ + cisConfig := secretsmanagerv1.SecretConfig{ CisCRN: core.StringPtr(os.Getenv("DNS_CONFIG_CRN")), CisApikey: core.StringPtr(os.Getenv("DNS_CONFIG_API_KEY")), } diff --git a/secretsmanagerv1/secrets_manager_v1_test.go b/secretsmanagerv1/secrets_manager_v1_test.go index 50fb5cf..d752562 100644 --- a/secretsmanagerv1/secrets_manager_v1_test.go +++ b/secretsmanagerv1/secrets_manager_v1_test.go @@ -4700,13 +4700,17 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) + // Construct an instance of the SecretConfigLetsEncryptConfig model + secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) + secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} + createConfigElementOptionsModel.Config = secretConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := secretsManagerService.CreateConfigElement(createConfigElementOptionsModel) @@ -4759,7 +4763,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) })) }) It(`Invoke CreateConfigElement successfully with retries`, func() { @@ -4771,13 +4775,17 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(secretsManagerService).ToNot(BeNil()) secretsManagerService.EnableRetries(0, 0) + // Construct an instance of the SecretConfigLetsEncryptConfig model + secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) + secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} + createConfigElementOptionsModel.Config = secretConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -4833,7 +4841,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) })) }) It(`Invoke CreateConfigElement successfully`, func() { @@ -4850,13 +4858,17 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct an instance of the SecretConfigLetsEncryptConfig model + secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) + secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} + createConfigElementOptionsModel.Config = secretConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -4874,13 +4886,17 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) + // Construct an instance of the SecretConfigLetsEncryptConfig model + secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) + secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} + createConfigElementOptionsModel.Config = secretConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := secretsManagerService.SetServiceURL("") @@ -4919,13 +4935,17 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) + // Construct an instance of the SecretConfigLetsEncryptConfig model + secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) + secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) createConfigElementOptionsModel.SecretType = core.StringPtr("public_cert") createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = map[string]interface{}{"anyKey": "anyValue"} + createConfigElementOptionsModel.Config = secretConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -5222,7 +5242,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) })) }) It(`Invoke GetConfigElement successfully with retries`, func() { @@ -5278,7 +5298,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) })) }) It(`Invoke GetConfigElement successfully`, func() { @@ -5462,7 +5482,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) })) }) It(`Invoke UpdateConfigElement successfully with retries`, func() { @@ -5536,7 +5556,7 @@ var _ = Describe(`SecretsManagerV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"anyKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"metadata": {"collection_type": "application/vnd.ibm.secrets-manager.config+json", "collection_total": 1}, "resources": [{"name": "Name", "type": "letsencrypt", "config": {"private_key": "PrivateKey"}}]}`) })) }) It(`Invoke UpdateConfigElement successfully`, func() { @@ -5732,31 +5752,36 @@ var _ = Describe(`SecretsManagerV1`, func() { It(`Invoke NewConfigElementDef successfully`, func() { name := "testString" typeVar := "letsencrypt" - config := map[string]interface{}{"anyKey": "anyValue"} - _model, err := secretsManagerService.NewConfigElementDef(name, typeVar, config) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) + var config secretsmanagerv1.SecretConfigIntf = nil + _, err := secretsManagerService.NewConfigElementDef(name, typeVar, config) + Expect(err).ToNot(BeNil()) }) It(`Invoke NewCreateConfigElementOptions successfully`, func() { + // Construct an instance of the SecretConfigLetsEncryptConfig model + secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) + Expect(secretConfigModel).ToNot(BeNil()) + secretConfigModel.PrivateKey = core.StringPtr("testString") + Expect(secretConfigModel.PrivateKey).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the CreateConfigElementOptions model secretType := "public_cert" configElement := "certificate_authorities" createConfigElementOptionsName := "testString" createConfigElementOptionsType := "letsencrypt" - createConfigElementOptionsConfig := map[string]interface{}{"anyKey": "anyValue"} + var createConfigElementOptionsConfig secretsmanagerv1.SecretConfigIntf = nil createConfigElementOptionsModel := secretsManagerService.NewCreateConfigElementOptions(secretType, configElement, createConfigElementOptionsName, createConfigElementOptionsType, createConfigElementOptionsConfig) createConfigElementOptionsModel.SetSecretType("public_cert") createConfigElementOptionsModel.SetConfigElement("certificate_authorities") createConfigElementOptionsModel.SetName("testString") createConfigElementOptionsModel.SetType("letsencrypt") - createConfigElementOptionsModel.SetConfig(map[string]interface{}{"anyKey": "anyValue"}) + createConfigElementOptionsModel.SetConfig(secretConfigModel) createConfigElementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createConfigElementOptionsModel).ToNot(BeNil()) Expect(createConfigElementOptionsModel.SecretType).To(Equal(core.StringPtr("public_cert"))) Expect(createConfigElementOptionsModel.ConfigElement).To(Equal(core.StringPtr("certificate_authorities"))) Expect(createConfigElementOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(createConfigElementOptionsModel.Type).To(Equal(core.StringPtr("letsencrypt"))) - Expect(createConfigElementOptionsModel.Config).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(createConfigElementOptionsModel.Config).To(Equal(secretConfigModel)) Expect(createConfigElementOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateSecret successfully`, func() { @@ -6359,6 +6384,25 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewSecretConfigClassicInfrastructureConfig successfully`, func() { + classicInfrastructureUsername := "testString" + classicInfrastructurePassword := "testString" + _model, err := secretsManagerService.NewSecretConfigClassicInfrastructureConfig(classicInfrastructureUsername, classicInfrastructurePassword) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecretConfigCloudInternetServicesConfig successfully`, func() { + cisCRN := "crn:v1:bluemix:public:internet-svcs:global:a/:::" + _model, err := secretsManagerService.NewSecretConfigCloudInternetServicesConfig(cisCRN) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecretConfigLetsEncryptConfig successfully`, func() { + privateKey := "testString" + _model, err := secretsManagerService.NewSecretConfigLetsEncryptConfig(privateKey) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewSecretPolicyRotationRotationPolicyRotation successfully`, func() { interval := int64(1) unit := "day" From 8473755e4d6f7cc447993be199e587ff2681c921 Mon Sep 17 00:00:00 2001 From: shacharn Date: Sun, 6 Feb 2022 12:46:47 +0200 Subject: [PATCH 3/6] update to latest api-docs changes --- secretsmanagerv1/secrets_manager_v1_integration_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/secretsmanagerv1/secrets_manager_v1_integration_test.go b/secretsmanagerv1/secrets_manager_v1_integration_test.go index 0f37b60..2c5bc51 100644 --- a/secretsmanagerv1/secrets_manager_v1_integration_test.go +++ b/secretsmanagerv1/secrets_manager_v1_integration_test.go @@ -305,7 +305,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { caConfigName := generateName() + "le-stage-config" privateKey := strings.ReplaceAll(os.Getenv("CA_CONFIG_PRIVATE_KEY"), `\n`, "\n") - leConfig := secretsmanagerv1.SecretConfig{ + leConfig := secretsmanagerv1.SecretConfigLetsEncryptConfig{ PrivateKey: &privateKey, } _, resp, err := secretsManager.CreateConfigElement(&secretsmanagerv1.CreateConfigElementOptions{ @@ -323,7 +323,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { cis := "cis" dnsConfigName := generateName() + "dns-config" - cisConfig := secretsmanagerv1.SecretConfig{ + cisConfig := secretsmanagerv1.SecretConfigCloudInternetServicesConfig{ CisCRN: core.StringPtr(os.Getenv("DNS_CONFIG_CRN")), CisApikey: core.StringPtr(os.Getenv("DNS_CONFIG_API_KEY")), } @@ -419,7 +419,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { caConfigName := generateName() + "le-stage-config" privateKey := strings.ReplaceAll(os.Getenv("CA_CONFIG_PRIVATE_KEY"), `\n`, "\n") - leConfig := secretsmanagerv1.SecretConfig{ + leConfig := secretsmanagerv1.SecretConfigLetsEncryptConfig{ PrivateKey: &privateKey, } _, resp, err := secretsManager.CreateConfigElement(&secretsmanagerv1.CreateConfigElementOptions{ @@ -448,7 +448,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { cis := "cis" dnsConfigName := generateName() + "dns-config" - cisConfig := secretsmanagerv1.SecretConfig{ + cisConfig := secretsmanagerv1.SecretConfigCloudInternetServicesConfig{ CisCRN: core.StringPtr(os.Getenv("DNS_CONFIG_CRN")), CisApikey: core.StringPtr(os.Getenv("DNS_CONFIG_API_KEY")), } From dc26eace40dd7d933d78e2d83e571748f9175d25 Mon Sep 17 00:00:00 2001 From: shacharn Date: Sun, 6 Feb 2022 13:50:19 +0200 Subject: [PATCH 4/6] update to latest api-docs changes --- secretsmanagerv1/secrets_manager_v1.go | 434 +++++++++--------- .../secrets_manager_v1_integration_test.go | 8 +- secretsmanagerv1/secrets_manager_v1_test.go | 96 ++-- 3 files changed, 269 insertions(+), 269 deletions(-) diff --git a/secretsmanagerv1/secrets_manager_v1.go b/secretsmanagerv1/secrets_manager_v1.go index 3d35ba8..df5386f 100644 --- a/secretsmanagerv1/secrets_manager_v1.go +++ b/secretsmanagerv1/secrets_manager_v1.go @@ -1855,7 +1855,7 @@ type ConfigElementDef struct { Type *string `json:"type" validate:"required"` // The configuration to define for the specified secret type. - Config SecretConfigIntf `json:"config" validate:"required"` + Config ConfigElementDefConfigIntf `json:"config" validate:"required"` } // Constants associated with the ConfigElementDef.Type property. @@ -1868,7 +1868,7 @@ const ( ) // NewConfigElementDef : Instantiate ConfigElementDef (Generic Model Constructor) -func (*SecretsManagerV1) NewConfigElementDef(name string, typeVar string, config SecretConfigIntf) (_model *ConfigElementDef, err error) { +func (*SecretsManagerV1) NewConfigElementDef(name string, typeVar string, config ConfigElementDefConfigIntf) (_model *ConfigElementDef, err error) { _model = &ConfigElementDef{ Name: core.StringPtr(name), Type: core.StringPtr(typeVar), @@ -1889,7 +1889,87 @@ func UnmarshalConfigElementDef(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "config", &obj.Config, UnmarshalSecretConfig) + err = core.UnmarshalModel(m, "config", &obj.Config, UnmarshalConfigElementDefConfig) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ConfigElementDefConfig : The configuration to define for the specified secret type. +// Models which "extend" this model: +// - ConfigElementDefConfigLetsEncryptConfig +// - ConfigElementDefConfigCloudInternetServicesConfig +// - ConfigElementDefConfigClassicInfrastructureConfig +type ConfigElementDefConfig struct { + // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. + // + // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable + // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). + PrivateKey *string `json:"private_key,omitempty"` + + // The Cloud Resource Name (CRN) that is associated with the CIS instance. + CisCRN *string `json:"cis_crn,omitempty"` + + // An IBM Cloud API key that can to list domains in your CIS instance. + // + // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned + // the Reader service role on Internet Services (`internet-svcs`). + // + // If you need to manage specific domains, you can assign the Manager role. For production environments, it is + // recommended that you assign the Reader access role, and then use the + // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific + // domains. For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). + CisApikey *string `json:"cis_apikey,omitempty"` + + // The username that is associated with your classic infrastructure account. + // + // In most cases, your classic infrastructure username is your `_`. In the console, you can + // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructureUsername *string `json:"classic_infrastructure_username,omitempty"` + + // Your classic infrastructure API key. + // + // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) + // > Users > name > API keys.** For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructurePassword *string `json:"classic_infrastructure_password,omitempty"` +} + +func (*ConfigElementDefConfig) isaConfigElementDefConfig() bool { + return true +} + +type ConfigElementDefConfigIntf interface { + isaConfigElementDefConfig() bool +} + +// UnmarshalConfigElementDefConfig unmarshals an instance of ConfigElementDefConfig from the specified map of raw messages. +func UnmarshalConfigElementDefConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigElementDefConfig) + err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) if err != nil { return } @@ -1945,7 +2025,7 @@ type CreateConfigElementOptions struct { Type *string `json:"type" validate:"required"` // The configuration to define for the specified secret type. - Config SecretConfigIntf `json:"config" validate:"required"` + Config ConfigElementDefConfigIntf `json:"config" validate:"required"` // Allows users to set headers on API requests Headers map[string]string @@ -1974,7 +2054,7 @@ const ( ) // NewCreateConfigElementOptions : Instantiate CreateConfigElementOptions -func (*SecretsManagerV1) NewCreateConfigElementOptions(secretType string, configElement string, name string, typeVar string, config SecretConfigIntf) *CreateConfigElementOptions { +func (*SecretsManagerV1) NewCreateConfigElementOptions(secretType string, configElement string, name string, typeVar string, config ConfigElementDefConfigIntf) *CreateConfigElementOptions { return &CreateConfigElementOptions{ SecretType: core.StringPtr(secretType), ConfigElement: core.StringPtr(configElement), @@ -2009,7 +2089,7 @@ func (_options *CreateConfigElementOptions) SetType(typeVar string) *CreateConfi } // SetConfig : Allow user to set Config -func (_options *CreateConfigElementOptions) SetConfig(config SecretConfigIntf) *CreateConfigElementOptions { +func (_options *CreateConfigElementOptions) SetConfig(config ConfigElementDefConfigIntf) *CreateConfigElementOptions { _options.Config = config return _options } @@ -3649,86 +3729,6 @@ func UnmarshalSecretAction(m map[string]json.RawMessage, result interface{}) (er return } -// SecretConfig : The configuration to define for the specified secret type. -// Models which "extend" this model: -// - SecretConfigLetsEncryptConfig -// - SecretConfigCloudInternetServicesConfig -// - SecretConfigClassicInfrastructureConfig -type SecretConfig struct { - // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. - // - // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable - // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). - PrivateKey *string `json:"private_key,omitempty"` - - // The Cloud Resource Name (CRN) that is associated with the CIS instance. - CisCRN *string `json:"cis_crn,omitempty"` - - // An IBM Cloud API key that can to list domains in your CIS instance. - // - // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned - // the Reader service role on Internet Services (`internet-svcs`). - // - // If you need to manage specific domains, you can assign the Manager role. For production environments, it is - // recommended that you assign the Reader access role, and then use the - // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific - // domains. For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). - CisApikey *string `json:"cis_apikey,omitempty"` - - // The username that is associated with your classic infrastructure account. - // - // In most cases, your classic infrastructure username is your `_`. In the console, you can - // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructureUsername *string `json:"classic_infrastructure_username,omitempty"` - - // Your classic infrastructure API key. - // - // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) - // > Users > name > API keys.** For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructurePassword *string `json:"classic_infrastructure_password,omitempty"` -} - -func (*SecretConfig) isaSecretConfig() bool { - return true -} - -type SecretConfigIntf interface { - isaSecretConfig() bool -} - -// UnmarshalSecretConfig unmarshals an instance of SecretConfig from the specified map of raw messages. -func UnmarshalSecretConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecretConfig) - err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SecretGroupDef : Properties that describe a secret group. type SecretGroupDef struct { // The metadata that describes the resource array. @@ -6482,6 +6482,137 @@ func UnmarshalCertificateSecretVersionMetadata(m map[string]json.RawMessage, res return } +// ConfigElementDefConfigClassicInfrastructureConfig : Properties that describe an IBM Cloud classic infrastructure (SoftLayer) configuration. +// This model "extends" ConfigElementDefConfig +type ConfigElementDefConfigClassicInfrastructureConfig struct { + // The username that is associated with your classic infrastructure account. + // + // In most cases, your classic infrastructure username is your `_`. In the console, you can + // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructureUsername *string `json:"classic_infrastructure_username" validate:"required"` + + // Your classic infrastructure API key. + // + // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) + // > Users > name > API keys.** For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). + ClassicInfrastructurePassword *string `json:"classic_infrastructure_password" validate:"required"` +} + +// NewConfigElementDefConfigClassicInfrastructureConfig : Instantiate ConfigElementDefConfigClassicInfrastructureConfig (Generic Model Constructor) +func (*SecretsManagerV1) NewConfigElementDefConfigClassicInfrastructureConfig(classicInfrastructureUsername string, classicInfrastructurePassword string) (_model *ConfigElementDefConfigClassicInfrastructureConfig, err error) { + _model = &ConfigElementDefConfigClassicInfrastructureConfig{ + ClassicInfrastructureUsername: core.StringPtr(classicInfrastructureUsername), + ClassicInfrastructurePassword: core.StringPtr(classicInfrastructurePassword), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ConfigElementDefConfigClassicInfrastructureConfig) isaConfigElementDefConfig() bool { + return true +} + +// UnmarshalConfigElementDefConfigClassicInfrastructureConfig unmarshals an instance of ConfigElementDefConfigClassicInfrastructureConfig from the specified map of raw messages. +func UnmarshalConfigElementDefConfigClassicInfrastructureConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigElementDefConfigClassicInfrastructureConfig) + err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ConfigElementDefConfigCloudInternetServicesConfig : Properties that describe an IBM Cloud Internet Services (CIS) configuration. +// This model "extends" ConfigElementDefConfig +type ConfigElementDefConfigCloudInternetServicesConfig struct { + // The Cloud Resource Name (CRN) that is associated with the CIS instance. + CisCRN *string `json:"cis_crn" validate:"required"` + + // An IBM Cloud API key that can to list domains in your CIS instance. + // + // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned + // the Reader service role on Internet Services (`internet-svcs`). + // + // If you need to manage specific domains, you can assign the Manager role. For production environments, it is + // recommended that you assign the Reader access role, and then use the + // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific + // domains. For more information, see the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). + CisApikey *string `json:"cis_apikey,omitempty"` +} + +// NewConfigElementDefConfigCloudInternetServicesConfig : Instantiate ConfigElementDefConfigCloudInternetServicesConfig (Generic Model Constructor) +func (*SecretsManagerV1) NewConfigElementDefConfigCloudInternetServicesConfig(cisCRN string) (_model *ConfigElementDefConfigCloudInternetServicesConfig, err error) { + _model = &ConfigElementDefConfigCloudInternetServicesConfig{ + CisCRN: core.StringPtr(cisCRN), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ConfigElementDefConfigCloudInternetServicesConfig) isaConfigElementDefConfig() bool { + return true +} + +// UnmarshalConfigElementDefConfigCloudInternetServicesConfig unmarshals an instance of ConfigElementDefConfigCloudInternetServicesConfig from the specified map of raw messages. +func UnmarshalConfigElementDefConfigCloudInternetServicesConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigElementDefConfigCloudInternetServicesConfig) + err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ConfigElementDefConfigLetsEncryptConfig : Properties that describe a Let's Encrypt configuration. +// This model "extends" ConfigElementDefConfig +type ConfigElementDefConfigLetsEncryptConfig struct { + // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. + // + // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable + // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see + // the + // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). + PrivateKey *string `json:"private_key" validate:"required"` +} + +// NewConfigElementDefConfigLetsEncryptConfig : Instantiate ConfigElementDefConfigLetsEncryptConfig (Generic Model Constructor) +func (*SecretsManagerV1) NewConfigElementDefConfigLetsEncryptConfig(privateKey string) (_model *ConfigElementDefConfigLetsEncryptConfig, err error) { + _model = &ConfigElementDefConfigLetsEncryptConfig{ + PrivateKey: core.StringPtr(privateKey), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ConfigElementDefConfigLetsEncryptConfig) isaConfigElementDefConfig() bool { + return true +} + +// UnmarshalConfigElementDefConfigLetsEncryptConfig unmarshals an instance of ConfigElementDefConfigLetsEncryptConfig from the specified map of raw messages. +func UnmarshalConfigElementDefConfigLetsEncryptConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigElementDefConfigLetsEncryptConfig) + err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CreateIamCredentialsSecretEngineRootConfig : Configuration for the IAM credentials engine. // This model "extends" EngineConfig type CreateIamCredentialsSecretEngineRootConfig struct { @@ -8273,137 +8404,6 @@ func UnmarshalRotateUsernamePasswordSecretBody(m map[string]json.RawMessage, res return } -// SecretConfigClassicInfrastructureConfig : Properties that describe an IBM Cloud classic infrastructure (SoftLayer) configuration. -// This model "extends" SecretConfig -type SecretConfigClassicInfrastructureConfig struct { - // The username that is associated with your classic infrastructure account. - // - // In most cases, your classic infrastructure username is your `_`. In the console, you can - // find your username by going to **Manage > Access (IAM) > Users > name > VPN password.** For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructureUsername *string `json:"classic_infrastructure_username" validate:"required"` - - // Your classic infrastructure API key. - // - // In the console, you can view or create a classic infrastructure API key by going to **Manage > Access (IAM) - // > Users > name > API keys.** For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-classic-infrastructure). - ClassicInfrastructurePassword *string `json:"classic_infrastructure_password" validate:"required"` -} - -// NewSecretConfigClassicInfrastructureConfig : Instantiate SecretConfigClassicInfrastructureConfig (Generic Model Constructor) -func (*SecretsManagerV1) NewSecretConfigClassicInfrastructureConfig(classicInfrastructureUsername string, classicInfrastructurePassword string) (_model *SecretConfigClassicInfrastructureConfig, err error) { - _model = &SecretConfigClassicInfrastructureConfig{ - ClassicInfrastructureUsername: core.StringPtr(classicInfrastructureUsername), - ClassicInfrastructurePassword: core.StringPtr(classicInfrastructurePassword), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecretConfigClassicInfrastructureConfig) isaSecretConfig() bool { - return true -} - -// UnmarshalSecretConfigClassicInfrastructureConfig unmarshals an instance of SecretConfigClassicInfrastructureConfig from the specified map of raw messages. -func UnmarshalSecretConfigClassicInfrastructureConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecretConfigClassicInfrastructureConfig) - err = core.UnmarshalPrimitive(m, "classic_infrastructure_username", &obj.ClassicInfrastructureUsername) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "classic_infrastructure_password", &obj.ClassicInfrastructurePassword) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecretConfigCloudInternetServicesConfig : Properties that describe an IBM Cloud Internet Services (CIS) configuration. -// This model "extends" SecretConfig -type SecretConfigCloudInternetServicesConfig struct { - // The Cloud Resource Name (CRN) that is associated with the CIS instance. - CisCRN *string `json:"cis_crn" validate:"required"` - - // An IBM Cloud API key that can to list domains in your CIS instance. - // - // To grant Secrets Manager the ability to view the CIS instance and all of its domains, the API key must be assigned - // the Reader service role on Internet Services (`internet-svcs`). - // - // If you need to manage specific domains, you can assign the Manager role. For production environments, it is - // recommended that you assign the Reader access role, and then use the - // [IAM Policy Management API](https://cloud.ibm.com/apidocs/iam-policy-management#create-policy) to control specific - // domains. For more information, see the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#authorize-specific-domains). - CisApikey *string `json:"cis_apikey,omitempty"` -} - -// NewSecretConfigCloudInternetServicesConfig : Instantiate SecretConfigCloudInternetServicesConfig (Generic Model Constructor) -func (*SecretsManagerV1) NewSecretConfigCloudInternetServicesConfig(cisCRN string) (_model *SecretConfigCloudInternetServicesConfig, err error) { - _model = &SecretConfigCloudInternetServicesConfig{ - CisCRN: core.StringPtr(cisCRN), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecretConfigCloudInternetServicesConfig) isaSecretConfig() bool { - return true -} - -// UnmarshalSecretConfigCloudInternetServicesConfig unmarshals an instance of SecretConfigCloudInternetServicesConfig from the specified map of raw messages. -func UnmarshalSecretConfigCloudInternetServicesConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecretConfigCloudInternetServicesConfig) - err = core.UnmarshalPrimitive(m, "cis_crn", &obj.CisCRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cis_apikey", &obj.CisApikey) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecretConfigLetsEncryptConfig : Properties that describe a Let's Encrypt configuration. -// This model "extends" SecretConfig -type SecretConfigLetsEncryptConfig struct { - // The private key that is associated with your Automatic Certificate Management Environment (ACME) account. - // - // If you have a working ACME client or account for Let's Encrypt, you can use the existing private key to enable - // communications with Secrets Manager. If you don't have an account yet, you can create one. For more information, see - // the - // [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-prepare-order-certificates#create-acme-account). - PrivateKey *string `json:"private_key" validate:"required"` -} - -// NewSecretConfigLetsEncryptConfig : Instantiate SecretConfigLetsEncryptConfig (Generic Model Constructor) -func (*SecretsManagerV1) NewSecretConfigLetsEncryptConfig(privateKey string) (_model *SecretConfigLetsEncryptConfig, err error) { - _model = &SecretConfigLetsEncryptConfig{ - PrivateKey: core.StringPtr(privateKey), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecretConfigLetsEncryptConfig) isaSecretConfig() bool { - return true -} - -// UnmarshalSecretConfigLetsEncryptConfig unmarshals an instance of SecretConfigLetsEncryptConfig from the specified map of raw messages. -func UnmarshalSecretConfigLetsEncryptConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecretConfigLetsEncryptConfig) - err = core.UnmarshalPrimitive(m, "private_key", &obj.PrivateKey) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SecretPolicyRotationRotationPolicyRotation : The secret rotation time interval. // This model "extends" SecretPolicyRotationRotation type SecretPolicyRotationRotationPolicyRotation struct { diff --git a/secretsmanagerv1/secrets_manager_v1_integration_test.go b/secretsmanagerv1/secrets_manager_v1_integration_test.go index 2c5bc51..8516bcb 100644 --- a/secretsmanagerv1/secrets_manager_v1_integration_test.go +++ b/secretsmanagerv1/secrets_manager_v1_integration_test.go @@ -305,7 +305,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { caConfigName := generateName() + "le-stage-config" privateKey := strings.ReplaceAll(os.Getenv("CA_CONFIG_PRIVATE_KEY"), `\n`, "\n") - leConfig := secretsmanagerv1.SecretConfigLetsEncryptConfig{ + leConfig := secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig{ PrivateKey: &privateKey, } _, resp, err := secretsManager.CreateConfigElement(&secretsmanagerv1.CreateConfigElementOptions{ @@ -323,7 +323,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { cis := "cis" dnsConfigName := generateName() + "dns-config" - cisConfig := secretsmanagerv1.SecretConfigCloudInternetServicesConfig{ + cisConfig := secretsmanagerv1.ConfigElementDefConfigCloudInternetServicesConfig{ CisCRN: core.StringPtr(os.Getenv("DNS_CONFIG_CRN")), CisApikey: core.StringPtr(os.Getenv("DNS_CONFIG_API_KEY")), } @@ -419,7 +419,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { caConfigName := generateName() + "le-stage-config" privateKey := strings.ReplaceAll(os.Getenv("CA_CONFIG_PRIVATE_KEY"), `\n`, "\n") - leConfig := secretsmanagerv1.SecretConfigLetsEncryptConfig{ + leConfig := secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig{ PrivateKey: &privateKey, } _, resp, err := secretsManager.CreateConfigElement(&secretsmanagerv1.CreateConfigElementOptions{ @@ -448,7 +448,7 @@ var _ = Describe(`IbmCloudSecretsManagerApiV1_integration`, func() { cis := "cis" dnsConfigName := generateName() + "dns-config" - cisConfig := secretsmanagerv1.SecretConfigCloudInternetServicesConfig{ + cisConfig := secretsmanagerv1.ConfigElementDefConfigCloudInternetServicesConfig{ CisCRN: core.StringPtr(os.Getenv("DNS_CONFIG_CRN")), CisApikey: core.StringPtr(os.Getenv("DNS_CONFIG_API_KEY")), } diff --git a/secretsmanagerv1/secrets_manager_v1_test.go b/secretsmanagerv1/secrets_manager_v1_test.go index d752562..e1842dc 100644 --- a/secretsmanagerv1/secrets_manager_v1_test.go +++ b/secretsmanagerv1/secrets_manager_v1_test.go @@ -4700,9 +4700,9 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) - // Construct an instance of the SecretConfigLetsEncryptConfig model - secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) - secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model + configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) + configElementDefConfigModel.PrivateKey = core.StringPtr("testString") // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) @@ -4710,7 +4710,7 @@ var _ = Describe(`SecretsManagerV1`, func() { createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = secretConfigModel + createConfigElementOptionsModel.Config = configElementDefConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := secretsManagerService.CreateConfigElement(createConfigElementOptionsModel) @@ -4775,9 +4775,9 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(secretsManagerService).ToNot(BeNil()) secretsManagerService.EnableRetries(0, 0) - // Construct an instance of the SecretConfigLetsEncryptConfig model - secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) - secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model + configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) + configElementDefConfigModel.PrivateKey = core.StringPtr("testString") // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) @@ -4785,7 +4785,7 @@ var _ = Describe(`SecretsManagerV1`, func() { createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = secretConfigModel + createConfigElementOptionsModel.Config = configElementDefConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -4858,9 +4858,9 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SecretConfigLetsEncryptConfig model - secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) - secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model + configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) + configElementDefConfigModel.PrivateKey = core.StringPtr("testString") // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) @@ -4868,7 +4868,7 @@ var _ = Describe(`SecretsManagerV1`, func() { createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = secretConfigModel + createConfigElementOptionsModel.Config = configElementDefConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -4886,9 +4886,9 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) - // Construct an instance of the SecretConfigLetsEncryptConfig model - secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) - secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model + configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) + configElementDefConfigModel.PrivateKey = core.StringPtr("testString") // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) @@ -4896,7 +4896,7 @@ var _ = Describe(`SecretsManagerV1`, func() { createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = secretConfigModel + createConfigElementOptionsModel.Config = configElementDefConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := secretsManagerService.SetServiceURL("") @@ -4935,9 +4935,9 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(serviceErr).To(BeNil()) Expect(secretsManagerService).ToNot(BeNil()) - // Construct an instance of the SecretConfigLetsEncryptConfig model - secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) - secretConfigModel.PrivateKey = core.StringPtr("testString") + // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model + configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) + configElementDefConfigModel.PrivateKey = core.StringPtr("testString") // Construct an instance of the CreateConfigElementOptions model createConfigElementOptionsModel := new(secretsmanagerv1.CreateConfigElementOptions) @@ -4945,7 +4945,7 @@ var _ = Describe(`SecretsManagerV1`, func() { createConfigElementOptionsModel.ConfigElement = core.StringPtr("certificate_authorities") createConfigElementOptionsModel.Name = core.StringPtr("testString") createConfigElementOptionsModel.Type = core.StringPtr("letsencrypt") - createConfigElementOptionsModel.Config = secretConfigModel + createConfigElementOptionsModel.Config = configElementDefConfigModel createConfigElementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -5752,36 +5752,36 @@ var _ = Describe(`SecretsManagerV1`, func() { It(`Invoke NewConfigElementDef successfully`, func() { name := "testString" typeVar := "letsencrypt" - var config secretsmanagerv1.SecretConfigIntf = nil + var config secretsmanagerv1.ConfigElementDefConfigIntf = nil _, err := secretsManagerService.NewConfigElementDef(name, typeVar, config) Expect(err).ToNot(BeNil()) }) It(`Invoke NewCreateConfigElementOptions successfully`, func() { - // Construct an instance of the SecretConfigLetsEncryptConfig model - secretConfigModel := new(secretsmanagerv1.SecretConfigLetsEncryptConfig) - Expect(secretConfigModel).ToNot(BeNil()) - secretConfigModel.PrivateKey = core.StringPtr("testString") - Expect(secretConfigModel.PrivateKey).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the ConfigElementDefConfigLetsEncryptConfig model + configElementDefConfigModel := new(secretsmanagerv1.ConfigElementDefConfigLetsEncryptConfig) + Expect(configElementDefConfigModel).ToNot(BeNil()) + configElementDefConfigModel.PrivateKey = core.StringPtr("testString") + Expect(configElementDefConfigModel.PrivateKey).To(Equal(core.StringPtr("testString"))) // Construct an instance of the CreateConfigElementOptions model secretType := "public_cert" configElement := "certificate_authorities" createConfigElementOptionsName := "testString" createConfigElementOptionsType := "letsencrypt" - var createConfigElementOptionsConfig secretsmanagerv1.SecretConfigIntf = nil + var createConfigElementOptionsConfig secretsmanagerv1.ConfigElementDefConfigIntf = nil createConfigElementOptionsModel := secretsManagerService.NewCreateConfigElementOptions(secretType, configElement, createConfigElementOptionsName, createConfigElementOptionsType, createConfigElementOptionsConfig) createConfigElementOptionsModel.SetSecretType("public_cert") createConfigElementOptionsModel.SetConfigElement("certificate_authorities") createConfigElementOptionsModel.SetName("testString") createConfigElementOptionsModel.SetType("letsencrypt") - createConfigElementOptionsModel.SetConfig(secretConfigModel) + createConfigElementOptionsModel.SetConfig(configElementDefConfigModel) createConfigElementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createConfigElementOptionsModel).ToNot(BeNil()) Expect(createConfigElementOptionsModel.SecretType).To(Equal(core.StringPtr("public_cert"))) Expect(createConfigElementOptionsModel.ConfigElement).To(Equal(core.StringPtr("certificate_authorities"))) Expect(createConfigElementOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(createConfigElementOptionsModel.Type).To(Equal(core.StringPtr("letsencrypt"))) - Expect(createConfigElementOptionsModel.Config).To(Equal(secretConfigModel)) + Expect(createConfigElementOptionsModel.Config).To(Equal(configElementDefConfigModel)) Expect(createConfigElementOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateSecret successfully`, func() { @@ -6306,6 +6306,25 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewConfigElementDefConfigClassicInfrastructureConfig successfully`, func() { + classicInfrastructureUsername := "testString" + classicInfrastructurePassword := "testString" + _model, err := secretsManagerService.NewConfigElementDefConfigClassicInfrastructureConfig(classicInfrastructureUsername, classicInfrastructurePassword) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewConfigElementDefConfigCloudInternetServicesConfig successfully`, func() { + cisCRN := "crn:v1:bluemix:public:internet-svcs:global:a/:::" + _model, err := secretsManagerService.NewConfigElementDefConfigCloudInternetServicesConfig(cisCRN) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewConfigElementDefConfigLetsEncryptConfig successfully`, func() { + privateKey := "testString" + _model, err := secretsManagerService.NewConfigElementDefConfigLetsEncryptConfig(privateKey) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewCreateIamCredentialsSecretEngineRootConfig successfully`, func() { apiKey := "API_KEY" _model, err := secretsManagerService.NewCreateIamCredentialsSecretEngineRootConfig(apiKey) @@ -6384,25 +6403,6 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewSecretConfigClassicInfrastructureConfig successfully`, func() { - classicInfrastructureUsername := "testString" - classicInfrastructurePassword := "testString" - _model, err := secretsManagerService.NewSecretConfigClassicInfrastructureConfig(classicInfrastructureUsername, classicInfrastructurePassword) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecretConfigCloudInternetServicesConfig successfully`, func() { - cisCRN := "crn:v1:bluemix:public:internet-svcs:global:a/:::" - _model, err := secretsManagerService.NewSecretConfigCloudInternetServicesConfig(cisCRN) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecretConfigLetsEncryptConfig successfully`, func() { - privateKey := "testString" - _model, err := secretsManagerService.NewSecretConfigLetsEncryptConfig(privateKey) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) It(`Invoke NewSecretPolicyRotationRotationPolicyRotation successfully`, func() { interval := int64(1) unit := "day" From 577fbbdd1b0ea27a1a99d704f24b1ff99001ecb9 Mon Sep 17 00:00:00 2001 From: shacharn Date: Sun, 6 Feb 2022 14:13:32 +0200 Subject: [PATCH 5/6] update to latest api-docs changes --- secretsmanagerv1/secrets_manager_v1.go | 2 +- secretsmanagerv1/secrets_manager_v1_test.go | 42 ++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/secretsmanagerv1/secrets_manager_v1.go b/secretsmanagerv1/secrets_manager_v1.go index df5386f..3dc2ce1 100644 --- a/secretsmanagerv1/secrets_manager_v1.go +++ b/secretsmanagerv1/secrets_manager_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.43.5-e0ec19e2-20220124-172004 + * IBM OpenAPI SDK Code Generator Version: 3.44.0-98838c07-20220128-151531 */ // Package secretsmanagerv1 : Operations and models for the SecretsManagerV1 service diff --git a/secretsmanagerv1/secrets_manager_v1_test.go b/secretsmanagerv1/secrets_manager_v1_test.go index e1842dc..28e2aa9 100644 --- a/secretsmanagerv1/secrets_manager_v1_test.go +++ b/secretsmanagerv1/secrets_manager_v1_test.go @@ -173,7 +173,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke CreateSecretGroup with error: Operation response processing error`, func() { @@ -477,7 +477,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke ListSecretGroups with error: Operation response processing error`, func() { @@ -677,7 +677,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetSecretGroup with error: Operation response processing error`, func() { @@ -889,7 +889,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("PUT")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke UpdateSecretGroupMetadata with error: Operation response processing error`, func() { @@ -1261,7 +1261,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke CreateSecret with error: Operation response processing error`, func() { @@ -1587,7 +1587,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(0))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke ListSecrets with error: Operation response processing error`, func() { @@ -1817,7 +1817,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.URL.Query()["sort_by"]).To(Equal([]string{"id"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke ListAllSecrets with error: Operation response processing error`, func() { @@ -2050,7 +2050,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetSecret with error: Operation response processing error`, func() { @@ -2268,7 +2268,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.URL.Query()["action"]).To(Equal([]string{"rotate"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke UpdateSecret with error: Operation response processing error`, func() { @@ -2619,7 +2619,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke ListSecretVersions with error: Operation response processing error`, func() { @@ -2836,7 +2836,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetSecretVersion with error: Operation response processing error`, func() { @@ -3058,7 +3058,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetSecretVersionMetadata with error: Operation response processing error`, func() { @@ -3280,7 +3280,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetSecretMetadata with error: Operation response processing error`, func() { @@ -3497,7 +3497,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("PUT")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke UpdateSecretMetadata with error: Operation response processing error`, func() { @@ -3817,7 +3817,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.URL.Query()["policy"]).To(Equal([]string{"rotation"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke PutPolicy with error: Operation response processing error`, func() { @@ -4159,7 +4159,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.URL.Query()["policy"]).To(Equal([]string{"rotation"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetPolicy with error: Operation response processing error`, func() { @@ -4477,7 +4477,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetConfig with error: Operation response processing error`, func() { @@ -4689,7 +4689,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke CreateConfigElement with error: Operation response processing error`, func() { @@ -4973,7 +4973,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetConfigElements with error: Operation response processing error`, func() { @@ -5190,7 +5190,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetConfigElement with error: Operation response processing error`, func() { @@ -5412,7 +5412,7 @@ var _ = Describe(`SecretsManagerV1`, func() { Expect(req.Method).To(Equal("PUT")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke UpdateConfigElement with error: Operation response processing error`, func() { From c4ad3005cb66c4fa4e054955a1dddba5225f61ab Mon Sep 17 00:00:00 2001 From: shacharn Date: Sun, 6 Feb 2022 14:14:10 +0200 Subject: [PATCH 6/6] update to latest api-docs changes --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index c67b9ec..8bc96fd 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/IBM/secrets-manager-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.8.0 - github.com/go-openapi/strfmt v0.20.2 + github.com/IBM/go-sdk-core/v5 v5.9.1 + github.com/go-openapi/strfmt v0.21.1 github.com/onsi/ginkgo v1.16.4 github.com/onsi/gomega v1.16.0 github.com/stretchr/testify v1.7.0