pub struct Client { /* private fields */ }
Expand description

Client for AWS Secrets Manager

Client for invoking operations on AWS Secrets Manager. Each operation on AWS Secrets Manager is a method on this this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.

Examples

Constructing a client and invoking an operation

    // create a shared configuration. This can be used & shared between multiple service clients.
    let shared_config = aws_config::load_from_env().await;
    let client = aws_sdk_secretsmanager::Client::new(&shared_config);
    // invoke an operation
    /* let rsp = client
        .<operation_name>().
        .<param>("some value")
        .send().await; */

Constructing a client with custom configuration

use aws_config::RetryConfig;
    let shared_config = aws_config::load_from_env().await;
    let config = aws_sdk_secretsmanager::config::Builder::from(&shared_config)
        .retry_config(RetryConfig::disabled())
        .build();
    let client = aws_sdk_secretsmanager::Client::from_conf(config);

Implementations

Creates a client with the given service configuration.

Returns the client’s configuration.

Constructs a fluent builder for the CancelRotateSecret operation.

Constructs a fluent builder for the CreateSecret operation.

  • The fluent builder is configurable:
    • name(impl Into<String>) / set_name(Option<String>):

      The name of the new secret.

      The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-

      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.

    • client_request_token(impl Into<String>) / set_client_request_token(Option<String>):

      If you include SecretString or SecretBinary, then Secrets Manager creates an initial version for the secret, and this parameter specifies the unique identifier for the new version.

      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. If you don’t use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for the new version and include the value in the request.

      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 UUID-type value to ensure uniqueness of your versions within the specified secret.

      • If the ClientRequestToken value isn’t already associated with a version of the secret then a new version of the secret is created.

      • If a version with this value already exists and the version SecretString and SecretBinary values are the same as those in the request, then the request is ignored.

      • If a version with this value already exists and that version’s SecretString and SecretBinary values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, use PutSecretValue to create a new version.

      This value becomes the VersionId of the new version.

    • description(impl Into<String>) / set_description(Option<String>):

      The description of the secret.

    • kms_key_id(impl Into<String>) / set_kms_key_id(Option<String>):

      The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt the secret value in the secret.

      To use a KMS key in a different account, use the key ARN or the alias ARN.

      If you don’t specify this value, then Secrets Manager uses the key aws/secretsmanager. If that key doesn’t yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.

      If the secret is in a different Amazon Web Services account from the credentials calling the API, then you can’t use aws/secretsmanager to encrypt the secret, and you must create and use a customer managed KMS key.

    • secret_binary(Blob) / set_secret_binary(Option<Blob>):

      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.

      Either SecretString or SecretBinary must have a value, but not both.

      This parameter is not available in the Secrets Manager console.

    • secret_string(impl Into<String>) / set_secret_string(Option<String>):

      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.

      Either SecretString or SecretBinary must have a value, but not both.

      If you create a secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the SecretString parameter. The Secrets Manager console stores the information as a JSON structure of key/value pairs that a Lambda rotation function can parse.

    • tags(Vec<Tag>) / set_tags(Option<Vec<Tag>>):

      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:

      [{“Key”:“CostCenter”,“Value”:“12345”},{“Key”:“environment”,“Value”:“production”}]

      Secrets Manager tag key names are case sensitive. A tag with the key “ABC” is a different tag from one with key “abc”.

      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 Access Denied error. For more information, see Control access to secrets using tags and Limit access to identities with tags that match secrets’ tags.

      For information about how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters. 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.

      The following restrictions apply to tags:

      • Maximum number of tags per secret: 50

      • Maximum key length: 127 Unicode characters in UTF-8

      • Maximum value length: 255 Unicode characters in UTF-8

      • Tag keys and values are case sensitive.

      • Do not use the aws: prefix in your tag names or values because Amazon Web Services reserves it for Amazon Web Services use. You can’t edit or delete tag names or values with this prefix. Tags with this prefix do not count against your tags per secret limit.

      • If you use your tagging schema across multiple services and resources, other services might have restrictions on allowed characters. Generally allowed characters: letters, spaces, and numbers representable in UTF-8, plus the following special characters: + - = . _ : / @.

    • add_replica_regions(Vec<ReplicaRegionType>) / set_add_replica_regions(Option<Vec<ReplicaRegionType>>):

      A list of Regions and KMS keys to replicate secrets.

    • force_overwrite_replica_secret(bool) / set_force_overwrite_replica_secret(bool):

      Specifies whether to overwrite a secret with the same name in the destination Region.

  • On success, responds with CreateSecretOutput with field(s):
    • arn(Option<String>):

      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.

    • name(Option<String>):

      The name of the new secret.

    • version_id(Option<String>):

      The unique identifier associated with the version of the new secret.

    • replication_status(Option<Vec<ReplicationStatusType>>):

      A list of the replicas of this secret and their status:

      • Failed, which indicates that the replica was not created.

      • InProgress, which indicates that Secrets Manager is in the process of creating the replica.

      • InSync, which indicates that the replica was created.

  • On failure, responds with SdkError<CreateSecretError>

Constructs a fluent builder for the DeleteResourcePolicy operation.

Constructs a fluent builder for the DeleteSecret operation.

  • The fluent builder is configurable:
    • secret_id(impl Into<String>) / set_secret_id(Option<String>):

      The ARN or name of the secret to delete.

      For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

    • recovery_window_in_days(i64) / set_recovery_window_in_days(Option<i64>):

      The number of days from 7 to 30 that Secrets Manager waits before permanently deleting the secret. You can’t use both this parameter and ForceDeleteWithoutRecovery in the same call. If you don’t use either, then Secrets Manager defaults to a 30 day recovery window.

    • force_delete_without_recovery(bool) / set_force_delete_without_recovery(Option<bool>):

      Specifies whether to delete the secret without any recovery window. You can’t use both this parameter and RecoveryWindowInDays in the same call. If you don’t use either, then Secrets Manager defaults to a 30 day recovery window.

      Secrets Manager performs the actual deletion with an asynchronous background process, so there might be a short delay before the secret is permanently deleted. If you delete a secret and then immediately create a secret with the same name, use appropriate back off and retry logic.

      Use this parameter with caution. This parameter causes the operation to skip the normal recovery window before the permanent deletion that Secrets Manager would normally impose with the RecoveryWindowInDays parameter. If you delete a secret with the ForceDeleteWithouRecovery parameter, then you have no opportunity to recover the secret. You lose the secret permanently.

  • On success, responds with DeleteSecretOutput with field(s):
    • arn(Option<String>):

      The ARN of the secret.

    • name(Option<String>):

      The name of the secret.

    • deletion_date(Option<DateTime>):

      The date and time after which this secret Secrets Manager can permanently delete this secret, and it can no longer be restored. This value is the date and time of the delete request plus the number of days in RecoveryWindowInDays.

  • On failure, responds with SdkError<DeleteSecretError>

Constructs a fluent builder for the DescribeSecret operation.

  • The fluent builder is configurable:
  • On success, responds with DescribeSecretOutput with field(s):
    • arn(Option<String>):

      The ARN of the secret.

    • name(Option<String>):

      The name of the secret.

    • description(Option<String>):

      The description of the secret.

    • kms_key_id(Option<String>):

      The ARN of the KMS key that Secrets Manager uses to encrypt the secret value. If the secret is encrypted with the Amazon Web Services managed key aws/secretsmanager, this field is omitted.

    • rotation_enabled(Option<bool>):

      Specifies whether automatic rotation is turned on for this secret.

      To turn on rotation, use RotateSecret. To turn off rotation, use CancelRotateSecret.

    • rotation_lambda_arn(Option<String>):

      The ARN of the Lambda function that Secrets Manager invokes to rotate the secret.

    • rotation_rules(Option<RotationRulesType>):

      The rotation schedule and Lambda function for this secret. If the secret previously had rotation turned on, but it is now turned off, this field shows the previous rotation schedule and rotation function. If the secret never had rotation turned on, this field is omitted.

    • last_rotated_date(Option<DateTime>):

      The last date and time that Secrets Manager rotated the secret. If the secret isn’t configured for rotation, Secrets Manager returns null.

    • last_changed_date(Option<DateTime>):

      The last date and time that this secret was modified in any way.

    • last_accessed_date(Option<DateTime>):

      The last date that the secret value was retrieved. This value does not include the time. This field is omitted if the secret has never been retrieved.

    • deleted_date(Option<DateTime>):

      The date the secret is scheduled for deletion. If it is not scheduled for deletion, this field is omitted. When you delete a secret, Secrets Manager requires a recovery window of at least 7 days before deleting the secret. Some time after the deleted date, Secrets Manager deletes the secret, including all of its versions.

      If a secret is scheduled for deletion, then its details, including the encrypted secret value, is not accessible. To cancel a scheduled deletion and restore access to the secret, use RestoreSecret.

    • tags(Option<Vec<Tag>>):

      The list of tags attached to the secret. To add tags to a secret, use TagResource. To remove tags, use UntagResource.

    • version_ids_to_stages(Option<HashMap<String, Vec<String>>>):

      A list of the versions of the secret that have staging labels attached. Versions that don’t have staging labels are considered deprecated and Secrets Manager can delete them.

      Secrets Manager uses staging labels to indicate the status of a secret version during rotation. The three staging labels for rotation are:

      • AWSCURRENT, which indicates the current version of the secret.

      • AWSPENDING, which indicates the version of the secret that contains new secret information that will become the next current version when rotation finishes.

        During rotation, Secrets Manager creates an AWSPENDING version ID before creating the new secret version. To check if a secret version exists, call GetSecretValue.

      • AWSPREVIOUS, which indicates the previous current version of the secret. You can use this as the last known good version.

      For more information about rotation and staging labels, see How rotation works.

    • owning_service(Option<String>):

      The name of the service that created this secret.

    • created_date(Option<DateTime>):

      The date the secret was created.

    • primary_region(Option<String>):

      The Region the secret is in. If a secret is replicated to other Regions, the replicas are listed in ReplicationStatus.

    • replication_status(Option<Vec<ReplicationStatusType>>):

      A list of the replicas of this secret and their status:

      • Failed, which indicates that the replica was not created.

      • InProgress, which indicates that Secrets Manager is in the process of creating the replica.

      • InSync, which indicates that the replica was created.

  • On failure, responds with SdkError<DescribeSecretError>

Constructs a fluent builder for the GetRandomPassword operation.

Constructs a fluent builder for the GetResourcePolicy operation.

Constructs a fluent builder for the GetSecretValue operation.

  • The fluent builder is configurable:
    • secret_id(impl Into<String>) / set_secret_id(Option<String>):

      The ARN or name of the secret to retrieve.

      For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

    • version_id(impl Into<String>) / set_version_id(Option<String>):

      The unique identifier of the version of the secret to retrieve. If you include both this parameter and VersionStage, the two parameters must refer to the same secret version. If you don’t specify either a VersionStage or VersionId, then Secrets Manager returns the AWSCURRENT version.

      This value is typically a UUID-type value with 32 hexadecimal digits.

    • version_stage(impl Into<String>) / set_version_stage(Option<String>):

      The staging label of the version of the secret to retrieve.

      Secrets Manager uses staging labels to keep track of different versions during the rotation process. If you include both this parameter and VersionId, the two parameters must refer to the same secret version. If you don’t specify either a VersionStage or VersionId, Secrets Manager returns the AWSCURRENT version.

  • On success, responds with GetSecretValueOutput with field(s):
    • arn(Option<String>):

      The ARN of the secret.

    • name(Option<String>):

      The friendly name of the secret.

    • version_id(Option<String>):

      The unique identifier of this version of the secret.

    • secret_binary(Option<Blob>):

      The decrypted secret value, if the secret value was originally provided as binary data in the form of a byte array. The response parameter represents the binary data as a base64-encoded string.

      If the secret was created by using the Secrets Manager console, or if the secret value was originally provided as a string, then this field is omitted. The secret value appears in SecretString instead.

    • secret_string(Option<String>):

      The decrypted secret value, if the secret value was originally provided as a string or through the Secrets Manager console.

      If this secret was created by using the console, then Secrets Manager stores the information as a JSON structure of key/value pairs.

    • version_stages(Option<Vec<String>>):

      A list of all of the staging labels currently attached to this version of the secret.

    • created_date(Option<DateTime>):

      The date and time that this version of the secret was created. If you don’t specify which version in VersionId or VersionStage, then Secrets Manager uses the AWSCURRENT version.

  • On failure, responds with SdkError<GetSecretValueError>

Constructs a fluent builder for the ListSecrets operation. This operation supports pagination; See into_paginator().

Constructs a fluent builder for the ListSecretVersionIds operation. This operation supports pagination; See into_paginator().

Constructs a fluent builder for the PutResourcePolicy operation.

Constructs a fluent builder for the PutSecretValue operation.

  • The fluent builder is configurable:
    • secret_id(impl Into<String>) / set_secret_id(Option<String>):

      The ARN or name of the secret to add a new version to.

      For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

      If the secret doesn’t already exist, use CreateSecret instead.

    • client_request_token(impl Into<String>) / set_client_request_token(Option<String>):

      A unique identifier for the new version of the secret.

      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 because they generate a random UUID for you. If you don’t use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for new versions and include that value in the request.

      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 the Lambda rotation function processing. We recommend that you generate a UUID-type value to ensure uniqueness within the specified secret.

      • If the ClientRequestToken value isn’t already associated with a version of the secret then a new version of the secret is created.

      • If a version with this value already exists and that version’s SecretString or SecretBinary values are the same as those in the request then the request is ignored. The operation is idempotent.

      • If a version with this value already exists and the version of the SecretString and SecretBinary values are different from those in the request, then the request fails because you can’t modify a secret version. You can only create new versions to store new secret values.

      This value becomes the VersionId of the new version.

    • secret_binary(Blob) / set_secret_binary(Option<Blob>):

      The binary data to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then pass the contents of the file as a parameter.

      You must include SecretBinary or SecretString, but not both.

      You can’t access this value from the Secrets Manager console.

    • secret_string(impl Into<String>) / set_secret_string(Option<String>):

      The text to encrypt and store in the new version of the secret.

      You must include SecretBinary or SecretString, but not both.

      We recommend you create the secret string as JSON key/value pairs, as shown in the example.

    • version_stages(Vec<String>) / set_version_stages(Option<Vec<String>>):

      A list of staging labels to attach to this version of the secret. Secrets Manager uses staging labels to track versions of a secret through the rotation process.

      If you specify a staging label that’s already associated with a different version of the same secret, then Secrets Manager removes the label from the other version and attaches it to this version. If you specify AWSCURRENT, and it is already attached to another version, then Secrets Manager also moves the staging label AWSPREVIOUS to the version that AWSCURRENT was removed from.

      If you don’t include VersionStages, then Secrets Manager automatically moves the staging label AWSCURRENT to this version.

  • On success, responds with PutSecretValueOutput with field(s):
  • On failure, responds with SdkError<PutSecretValueError>

Constructs a fluent builder for the RemoveRegionsFromReplication operation.

Constructs a fluent builder for the ReplicateSecretToRegions operation.

Constructs a fluent builder for the RestoreSecret operation.

Constructs a fluent builder for the RotateSecret operation.

  • The fluent builder is configurable:
    • secret_id(impl Into<String>) / set_secret_id(Option<String>):

      The ARN or name of the secret to rotate.

      For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

    • client_request_token(impl Into<String>) / set_client_request_token(Option<String>):

      A unique identifier for the new version of the secret that helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during rotation. This value becomes the VersionId of the new version.

      If you use the Amazon Web Services CLI or one of the Amazon Web Services SDK to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes that in the request for this parameter. If you don’t use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for new versions and include that value in the request.

      You only need to specify this value if you implement your own retry logic and you want to ensure that Secrets Manager doesn’t attempt to create a secret version twice. We recommend that you generate a UUID-type value to ensure uniqueness within the specified secret.

    • rotation_lambda_arn(impl Into<String>) / set_rotation_lambda_arn(Option<String>):

      The ARN of the Lambda rotation function that can rotate the secret.

    • rotation_rules(RotationRulesType) / set_rotation_rules(Option<RotationRulesType>):

      A structure that defines the rotation configuration for this secret.

    • rotate_immediately(bool) / set_rotate_immediately(Option<bool>):

      Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. The rotation schedule is defined in RotateSecretRequest$RotationRules.

      If you don’t immediately rotate the secret, Secrets Manager tests the rotation configuration by running the testSecret step of the Lambda rotation function. The test creates an AWSPENDING version of the secret and then removes it.

      If you don’t specify this value, then by default, Secrets Manager rotates the secret immediately.

  • On success, responds with RotateSecretOutput with field(s):
  • On failure, responds with SdkError<RotateSecretError>

Constructs a fluent builder for the StopReplicationToReplica operation.

Constructs a fluent builder for the TagResource operation.

Constructs a fluent builder for the UntagResource operation.

Constructs a fluent builder for the UpdateSecret operation.

  • The fluent builder is configurable:
    • secret_id(impl Into<String>) / set_secret_id(Option<String>):

      The ARN or name of the secret.

      For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

    • client_request_token(impl Into<String>) / set_client_request_token(Option<String>):

      If you include SecretString or SecretBinary, then Secrets Manager creates a new version for the secret, and this parameter specifies the unique identifier for the new version.

      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. If you don’t use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for the new version and include the value in the request.

      This value becomes the VersionId of the new version.

    • description(impl Into<String>) / set_description(Option<String>):

      The description of the secret.

    • kms_key_id(impl Into<String>) / set_kms_key_id(Option<String>):

      The ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt new secret versions as well as any existing versions the staging labels AWSCURRENT, AWSPENDING, or AWSPREVIOUS. For more information about versions and staging labels, see Concepts: Version.

      You can only use the Amazon Web Services managed key aws/secretsmanager if you call this operation using credentials from the same Amazon Web Services account that owns the secret. If the secret is in a different account, then you must use a customer managed key and provide the ARN of that KMS key in this field. The user making the call must have permissions to both the secret and the KMS key in their respective accounts.

    • secret_binary(Blob) / set_secret_binary(Option<Blob>):

      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.

      Either SecretBinary or SecretString must have a value, but not both.

      You can’t access this parameter in the Secrets Manager console.

    • secret_string(impl Into<String>) / set_secret_string(Option<String>):

      The text data to encrypt and store in the new version of the secret. We recommend you use a JSON structure of key/value pairs for your secret value.

      Either SecretBinary or SecretString must have a value, but not both.

  • On success, responds with UpdateSecretOutput with field(s):
  • On failure, responds with SdkError<UpdateSecretError>

Constructs a fluent builder for the UpdateSecretVersionStage operation.

Constructs a fluent builder for the ValidateResourcePolicy operation.

Creates a client with the given service config and connector override.

Creates a new client from a shared config.

Creates a new client from the service Config.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more