1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
impl super::Client {
    /// Constructs a fluent builder for the [`CreateSecret`](crate::operation::create_secret::builders::CreateSecretFluentBuilder) operation.
    ///
    /// - The fluent builder is configurable:
    ///   - [`name(impl Into<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::name) / [`set_name(Option<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_name):<br>required: **true**<br><p>The name of the new secret.</p> <p>The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-</p> <p>Do not end your secret name with a hyphen followed by six characters. If you do so, you risk confusion and unexpected results when searching for a secret by partial ARN. Secrets Manager automatically adds a hyphen and six random characters after the secret name at the end of the ARN.</p><br>
    ///   - [`client_request_token(impl Into<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::client_request_token) / [`set_client_request_token(Option<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_client_request_token):<br>required: **false**<br><p>If you include <code>SecretString</code> or <code>SecretBinary</code>, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.</p><note>  <p>If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request.</p> </note> <p>If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a <code>ClientRequestToken</code> and include it in the request.</p> <p>This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during a rotation. We recommend that you generate a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID-type</a> value to ensure uniqueness of your versions within the specified secret.</p> <ul>  <li>   <p>If the <code>ClientRequestToken</code> value isn't already associated with a version of the secret then a new version of the secret is created.</p></li>  <li>   <p>If a version with this value already exists and the version <code>SecretString</code> and <code>SecretBinary</code> values are the same as those in the request, then the request is ignored.</p></li>  <li>   <p>If a version with this value already exists and that version's <code>SecretString</code> and <code>SecretBinary</code> values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use <code>PutSecretValue</code> to create a new version.</p></li> </ul> <p>This value becomes the <code>VersionId</code> of the new version.</p><br>
    ///   - [`description(impl Into<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::description) / [`set_description(Option<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_description):<br>required: **false**<br><p>The description of the secret.</p><br>
    ///   - [`kms_key_id(impl Into<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::kms_key_id) / [`set_kms_key_id(Option<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_kms_key_id):<br>required: **false**<br><p>The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret. An alias is always prefixed by <code>alias/</code>, for example <code>alias/aws/secretsmanager</code>. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html">About aliases</a>.</p> <p>To use a KMS key in a different account, use the key ARN or the alias ARN.</p> <p>If you don't specify this value, then Secrets Manager uses the key <code>aws/secretsmanager</code>. If that key doesn't yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.</p> <p>If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can't use <code>aws/secretsmanager</code> to encrypt the secret, and you must create and use a customer managed KMS key.</p><br>
    ///   - [`secret_binary(Blob)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::secret_binary) / [`set_secret_binary(Option<Blob>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_secret_binary):<br>required: **false**<br><p>The binary data to encrypt and store in the new version of the secret. We recommend that you store your binary data in a file and then pass the contents of the file as a parameter.</p> <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p> <p>This parameter is not available in the Secrets Manager console.</p><br>
    ///   - [`secret_string(impl Into<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::secret_string) / [`set_secret_string(Option<String>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_secret_string):<br>required: **false**<br><p>The text data to encrypt and store in this new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.</p> <p>Either <code>SecretString</code> or <code>SecretBinary</code> must have a value, but not both.</p> <p>If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the <code>SecretString</code> parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.</p><br>
    ///   - [`tags(Tag)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::tags) / [`set_tags(Option<Vec::<Tag>>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_tags):<br>required: **false**<br><p>A list of tags to attach to the secret. Each tag is a key and value pair of strings in a JSON text string, for example:</p> <p><code>[{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}]</code></p> <p>Secrets Manager tag key names are case sensitive. A tag with the key "ABC" is a different tag from one with key "abc".</p> <p>If you check tags in permissions policies as part of your security strategy, then adding or removing a tag can change permissions. If the completion of this operation would result in you losing your permissions for this secret, then Secrets Manager blocks the operation and returns an <code>Access Denied</code> error. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac">Control access to secrets using tags</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2">Limit access to identities with tags that match secrets' tags</a>.</p> <p>For information about how to format a JSON parameter for the various command line tool environments, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json">Using JSON for Parameters</a>. If your command-line tool or SDK requires quotation marks around the parameter, you should use single quotes to avoid confusion with the double quotes required in the JSON text.</p> <p>For tag quotas and naming restrictions, see <a href="https://docs.aws.amazon.com/general/latest/gr/arg.html#taged-reference-quotas">Service quotas for Tagging</a> in the <i>Amazon Web Services General Reference guide</i>.</p><br>
    ///   - [`add_replica_regions(ReplicaRegionType)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::add_replica_regions) / [`set_add_replica_regions(Option<Vec::<ReplicaRegionType>>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_add_replica_regions):<br>required: **false**<br><p>A list of Regions and KMS keys to replicate secrets.</p><br>
    ///   - [`force_overwrite_replica_secret(bool)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::force_overwrite_replica_secret) / [`set_force_overwrite_replica_secret(Option<bool>)`](crate::operation::create_secret::builders::CreateSecretFluentBuilder::set_force_overwrite_replica_secret):<br>required: **false**<br><p>Specifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren't overwritten.</p><br>
    /// - On success, responds with [`CreateSecretOutput`](crate::operation::create_secret::CreateSecretOutput) with field(s):
    ///   - [`arn(Option<String>)`](crate::operation::create_secret::CreateSecretOutput::arn): <p>The ARN of the new secret. The ARN includes the name of the secret followed by six random characters. This ensures that if you create a new secret with the same name as a deleted secret, then users with access to the old secret don't get access to the new secret because the ARNs are different.</p>
    ///   - [`name(Option<String>)`](crate::operation::create_secret::CreateSecretOutput::name): <p>The name of the new secret.</p>
    ///   - [`version_id(Option<String>)`](crate::operation::create_secret::CreateSecretOutput::version_id): <p>The unique identifier associated with the version of the new secret.</p>
    ///   - [`replication_status(Option<Vec::<ReplicationStatusType>>)`](crate::operation::create_secret::CreateSecretOutput::replication_status): <p>A list of the replicas of this secret and their status:</p> <ul>  <li>   <p><code>Failed</code>, which indicates that the replica was not created.</p></li>  <li>   <p><code>InProgress</code>, which indicates that Secrets Manager is in the process of creating the replica.</p></li>  <li>   <p><code>InSync</code>, which indicates that the replica was created.</p></li> </ul>
    /// - On failure, responds with [`SdkError<CreateSecretError>`](crate::operation::create_secret::CreateSecretError)
    pub fn create_secret(&self) -> crate::operation::create_secret::builders::CreateSecretFluentBuilder {
        crate::operation::create_secret::builders::CreateSecretFluentBuilder::new(self.handle.clone())
    }
}