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.
§Constructing a Client
A Config
is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env()
, since this will resolve an SdkConfig
which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env()
instead, which returns a ConfigLoader
that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_secretsmanager::Client::new(&config);
Occasionally, SDKs may have additional service-specific values that can be set on the Config
that
is absent from SdkConfig
, or slightly different settings for a specific client may be desired.
The Config
struct implements From<&SdkConfig>
, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_secretsmanager::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();
See the aws-config
docs and Config
for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the BatchGetSecretValue
operation has
a Client::batch_get_secret_value
, function which returns a builder for that operation.
The fluent builder ultimately has a send()
function that returns an async future that
returns a result, as illustrated below:
let result = client.batch_get_secret_value()
.next_token("example")
.send()
.await;
The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize
module for more
information.
Implementations§
Source§impl Client
impl Client
Sourcepub fn batch_get_secret_value(&self) -> BatchGetSecretValueFluentBuilder
pub fn batch_get_secret_value(&self) -> BatchGetSecretValueFluentBuilder
Constructs a fluent builder for the BatchGetSecretValue
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
secret_id_list(impl Into<String>)
/set_secret_id_list(Option<Vec::<String>>)
:
required: falseThe ARN or names of the secrets to retrieve. You must include
Filters
orSecretIdList
, but not both.filters(Filter)
/set_filters(Option<Vec::<Filter>>)
:
required: falseThe filters to choose which secrets to retrieve. You must include
Filters
orSecretIdList
, but not both.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe number of results to include in the response.
If there are more results available, in the response, Secrets Manager includes
NextToken
. To get the next results, callBatchGetSecretValue
again with the value fromNextToken
. To use this parameter, you must also use theFilters
parameter.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call
BatchGetSecretValue
again with this value.
- On success, responds with
BatchGetSecretValueOutput
with field(s):secret_values(Option<Vec::<SecretValueEntry>>)
:A list of secret values.
next_token(Option<String>)
:Secrets Manager includes this value if there’s more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call
BatchGetSecretValue
again with this value.errors(Option<Vec::<ApiErrorType>>)
:A list of errors Secrets Manager encountered while attempting to retrieve individual secrets.
- On failure, responds with
SdkError<BatchGetSecretValueError>
Source§impl Client
impl Client
Sourcepub fn cancel_rotate_secret(&self) -> CancelRotateSecretFluentBuilder
pub fn cancel_rotate_secret(&self) -> CancelRotateSecretFluentBuilder
Constructs a fluent builder for the CancelRotateSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
- On success, responds with
CancelRotateSecretOutput
with field(s):arn(Option<String>)
:The ARN of the secret.
name(Option<String>)
:The name of the secret.
version_id(Option<String>)
:The unique identifier of the version of the secret created during the rotation. This version might not be complete, and should be evaluated for possible deletion. We recommend that you remove the
VersionStage
valueAWSPENDING
from this version so that Secrets Manager can delete it. Failing to clean up a cancelled rotation can block you from starting future rotations.
- On failure, responds with
SdkError<CancelRotateSecretError>
Source§impl Client
impl Client
Sourcepub fn create_secret(&self) -> CreateSecretFluentBuilder
pub fn create_secret(&self) -> CreateSecretFluentBuilder
Constructs a fluent builder for the CreateSecret
operation.
- The fluent builder is configurable:
name(impl Into<String>)
/set_name(Option<String>)
:
required: trueThe 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>)
:
required: falseIf you include
SecretString
orSecretBinary
, 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 generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a
ClientRequestToken
and include it 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
andSecretBinary
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
andSecretBinary
values are different from those in the request, then the request fails because you cannot modify an existing version. Instead, usePutSecretValue
to create a new version.
This value becomes the
VersionId
of the new version.-
description(impl Into<String>)
/set_description(Option<String>)
:
required: falseThe description of the secret.
kms_key_id(impl Into<String>)
/set_kms_key_id(Option<String>)
:
required: falseThe 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
alias/
, for examplealias/aws/secretsmanager
. For more information, see About aliases.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>)
:
required: falseThe 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
orSecretBinary
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>)
:
required: falseThe 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
orSecretBinary
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(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: falseA 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.
For tag quotas and naming restrictions, see Service quotas for Tagging in the Amazon Web Services General Reference guide.
add_replica_regions(ReplicaRegionType)
/set_add_replica_regions(Option<Vec::<ReplicaRegionType>>)
:
required: falseA list of Regions and KMS keys to replicate secrets.
force_overwrite_replica_secret(bool)
/set_force_overwrite_replica_secret(Option<bool>)
:
required: falseSpecifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren’t overwritten.
- 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>
Source§impl Client
impl Client
Sourcepub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
pub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
Constructs a fluent builder for the DeleteResourcePolicy
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to delete the attached resource-based policy for.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
- On success, responds with
DeleteResourcePolicyOutput
with field(s):arn(Option<String>)
:The ARN of the secret that the resource-based policy was deleted for.
name(Option<String>)
:The name of the secret that the resource-based policy was deleted for.
- On failure, responds with
SdkError<DeleteResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn delete_secret(&self) -> DeleteSecretFluentBuilder
pub fn delete_secret(&self) -> DeleteSecretFluentBuilder
Constructs a fluent builder for the DeleteSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to delete.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
recovery_window_in_days(i64)
/set_recovery_window_in_days(Option<i64>)
:
required: falseThe 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 by default Secrets Manager uses a 30 day recovery window.force_delete_without_recovery(bool)
/set_force_delete_without_recovery(Option<bool>)
:
required: falseSpecifies 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 by default Secrets Manager uses 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.
If you forcibly delete an already deleted or nonexistent secret, the operation does not return
ResourceNotFoundException
.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 theForceDeleteWithoutRecovery
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>
Source§impl Client
impl Client
Sourcepub fn describe_secret(&self) -> DescribeSecretFluentBuilder
pub fn describe_secret(&self) -> DescribeSecretFluentBuilder
Constructs a fluent builder for the DescribeSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
- 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 key ID or alias 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. Secrets created using the console use an KMS key ID.rotation_enabled(Option<bool>)
:Specifies whether automatic rotation is turned on for this secret.
To turn on rotation, use
RotateSecret
. To turn off rotation, useCancelRotateSecret
.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 or rotation has been disabled, 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 date that the secret was last accessed in the Region. This field is omitted if the secret has never been retrieved in the Region.
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
.next_rotation_date(Option<DateTime>)
:The next rotation is scheduled to occur on or before this date. If the secret isn’t configured for rotation or rotation has been disabled, Secrets Manager returns null. If rotation fails, Secrets Manager retries the entire rotation process multiple times. If rotation is unsuccessful, this date may be in the past.
This date represents the latest date that rotation will occur, but it is not an approximate rotation date. In some cases, for example if you turn off automatic rotation and then turn it back on, the next rotation may occur much sooner than this date.
tags(Option<Vec::<Tag>>)
:The list of tags attached to the secret. To add tags to a secret, use
TagResource
. To remove tags, useUntagResource
.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, callGetSecretValue
. -
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 ID of the service that created this secret. For more information, see Secrets managed by other Amazon Web Services services.
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>
Source§impl Client
impl Client
Sourcepub fn get_random_password(&self) -> GetRandomPasswordFluentBuilder
pub fn get_random_password(&self) -> GetRandomPasswordFluentBuilder
Constructs a fluent builder for the GetRandomPassword
operation.
- The fluent builder is configurable:
password_length(i64)
/set_password_length(Option<i64>)
:
required: falseThe length of the password. If you don’t include this parameter, the default length is 32 characters.
exclude_characters(impl Into<String>)
/set_exclude_characters(Option<String>)
:
required: falseA string of the characters that you don’t want in the password.
exclude_numbers(bool)
/set_exclude_numbers(Option<bool>)
:
required: falseSpecifies whether to exclude numbers from the password. If you don’t include this switch, the password can contain numbers.
exclude_punctuation(bool)
/set_exclude_punctuation(Option<bool>)
:
required: falseSpecifies whether to exclude the following punctuation characters from the password:
! “ # $ % & ’ ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
. If you don’t include this switch, the password can contain punctuation.exclude_uppercase(bool)
/set_exclude_uppercase(Option<bool>)
:
required: falseSpecifies whether to exclude uppercase letters from the password. If you don’t include this switch, the password can contain uppercase letters.
exclude_lowercase(bool)
/set_exclude_lowercase(Option<bool>)
:
required: falseSpecifies whether to exclude lowercase letters from the password. If you don’t include this switch, the password can contain lowercase letters.
include_space(bool)
/set_include_space(Option<bool>)
:
required: falseSpecifies whether to include the space character. If you include this switch, the password can contain space characters.
require_each_included_type(bool)
/set_require_each_included_type(Option<bool>)
:
required: falseSpecifies whether to include at least one upper and lowercase letter, one number, and one punctuation. If you don’t include this switch, the password contains at least one of every character type.
- On success, responds with
GetRandomPasswordOutput
with field(s):random_password(Option<String>)
:A string with the password.
- On failure, responds with
SdkError<GetRandomPasswordError>
Source§impl Client
impl Client
Sourcepub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
pub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
Constructs a fluent builder for the GetResourcePolicy
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to retrieve the attached resource-based policy for.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
- On success, responds with
GetResourcePolicyOutput
with field(s):arn(Option<String>)
:The ARN of the secret that the resource-based policy was retrieved for.
name(Option<String>)
:The name of the secret that the resource-based policy was retrieved for.
resource_policy(Option<String>)
:A JSON-formatted string that contains the permissions policy attached to the secret. For more information about permissions policies, see Authentication and access control for Secrets Manager.
- On failure, responds with
SdkError<GetResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn get_secret_value(&self) -> GetSecretValueFluentBuilder
pub fn get_secret_value(&self) -> GetSecretValueFluentBuilder
Constructs a fluent builder for the GetSecretValue
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to retrieve.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
version_id(impl Into<String>)
/set_version_id(Option<String>)
:
required: falseThe 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 aVersionStage
orVersionId
, then Secrets Manager returns theAWSCURRENT
version.This value is typically a UUID-type value with 32 hexadecimal digits.
version_stage(impl Into<String>)
/set_version_stage(Option<String>)
:
required: falseThe 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 aVersionStage
orVersionId
, Secrets Manager returns theAWSCURRENT
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. When you retrieve a
SecretBinary
using the HTTP API, the Python SDK, or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not encoded.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
orVersionStage
, then Secrets Manager uses theAWSCURRENT
version.
- On failure, responds with
SdkError<GetSecretValueError>
Source§impl Client
impl Client
Sourcepub fn list_secret_version_ids(&self) -> ListSecretVersionIdsFluentBuilder
pub fn list_secret_version_ids(&self) -> ListSecretVersionIdsFluentBuilder
Constructs a fluent builder for the ListSecretVersionIds
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret whose versions you want to list.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe number of results to include in the response.
If there are more results available, in the response, Secrets Manager includes
NextToken
. To get the next results, callListSecretVersionIds
again with the value fromNextToken
.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call
ListSecretVersionIds
again with this value.include_deprecated(bool)
/set_include_deprecated(Option<bool>)
:
required: falseSpecifies whether to include versions of secrets that don’t have any staging labels attached to them. Versions without staging labels are considered deprecated and are subject to deletion by Secrets Manager. By default, versions without staging labels aren’t included.
- On success, responds with
ListSecretVersionIdsOutput
with field(s):versions(Option<Vec::<SecretVersionsListEntry>>)
:A list of the versions of the secret.
next_token(Option<String>)
:Secrets Manager includes this value if there’s more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call
ListSecretVersionIds
again with this value.arn(Option<String>)
:The ARN of the secret.
name(Option<String>)
:The name of the secret.
- On failure, responds with
SdkError<ListSecretVersionIdsError>
Source§impl Client
impl Client
Sourcepub fn list_secrets(&self) -> ListSecretsFluentBuilder
pub fn list_secrets(&self) -> ListSecretsFluentBuilder
Constructs a fluent builder for the ListSecrets
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
include_planned_deletion(bool)
/set_include_planned_deletion(Option<bool>)
:
required: falseSpecifies whether to include secrets scheduled for deletion. By default, secrets scheduled for deletion aren’t included.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe number of results to include in the response.
If there are more results available, in the response, Secrets Manager includes
NextToken
. To get the next results, callListSecrets
again with the value fromNextToken
.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call
ListSecrets
again with this value.filters(Filter)
/set_filters(Option<Vec::<Filter>>)
:
required: falseThe filters to apply to the list of secrets.
sort_order(SortOrderType)
/set_sort_order(Option<SortOrderType>)
:
required: falseSecrets are listed by
CreatedDate
.
- On success, responds with
ListSecretsOutput
with field(s):secret_list(Option<Vec::<SecretListEntry>>)
:A list of the secrets in the account.
next_token(Option<String>)
:Secrets Manager includes this value if there’s more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call
ListSecrets
again with this value.
- On failure, responds with
SdkError<ListSecretsError>
Source§impl Client
impl Client
Sourcepub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
pub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
Constructs a fluent builder for the PutResourcePolicy
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to attach the resource-based policy.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
resource_policy(impl Into<String>)
/set_resource_policy(Option<String>)
:
required: trueA JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions policy examples.
block_public_policy(bool)
/set_block_public_policy(Option<bool>)
:
required: falseSpecifies whether to block resource-based policies that allow broad access to the secret, for example those that use a wildcard for the principal. By default, public policies aren’t blocked.
Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public access from being granted through the resource policies that are directly attached to your secrets. In addition to using these features, carefully inspect the following policies to confirm that they do not grant public access:
-
Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
-
Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service (KMS) keys)
To review permissions to your secrets, see Determine who has permissions to your secrets.
-
- On success, responds with
PutResourcePolicyOutput
with field(s):arn(Option<String>)
:The ARN of the secret.
name(Option<String>)
:The name of the secret.
- On failure, responds with
SdkError<PutResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn put_secret_value(&self) -> PutSecretValueFluentBuilder
pub fn put_secret_value(&self) -> PutSecretValueFluentBuilder
Constructs a fluent builder for the PutSecretValue
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe 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. See Finding a secret from 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>)
:
required: falseA 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. The CLI or SDK generates a random UUID for you and includes it as the value for this parameter in the request.
If you generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a
ClientRequestToken
and include it 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 that version’s
SecretString
orSecretBinary
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
andSecretBinary
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>)
:
required: falseThe 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
orSecretString
, but not both.You can’t access this value from the Secrets Manager console.
secret_string(impl Into<String>)
/set_secret_string(Option<String>)
:
required: falseThe text to encrypt and store in the new version of the secret.
You must include
SecretBinary
orSecretString
, but not both.We recommend you create the secret string as JSON key/value pairs, as shown in the example.
version_stages(impl Into<String>)
/set_version_stages(Option<Vec::<String>>)
:
required: falseA 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 labelAWSPREVIOUS
to the version thatAWSCURRENT
was removed from.If you don’t include
VersionStages
, then Secrets Manager automatically moves the staging labelAWSCURRENT
to this version.
- On success, responds with
PutSecretValueOutput
with field(s):arn(Option<String>)
:The ARN of the secret.
name(Option<String>)
:The name of the secret.
version_id(Option<String>)
:The unique identifier of the version of the secret.
version_stages(Option<Vec::<String>>)
:The list of staging labels that are currently attached to this version of the secret. Secrets Manager uses staging labels to track a version as it progresses through the secret rotation process.
- On failure, responds with
SdkError<PutSecretValueError>
Source§impl Client
impl Client
Sourcepub fn remove_regions_from_replication(
&self,
) -> RemoveRegionsFromReplicationFluentBuilder
pub fn remove_regions_from_replication( &self, ) -> RemoveRegionsFromReplicationFluentBuilder
Constructs a fluent builder for the RemoveRegionsFromReplication
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret.
remove_replica_regions(impl Into<String>)
/set_remove_replica_regions(Option<Vec::<String>>)
:
required: trueThe Regions of the replicas to remove.
- On success, responds with
RemoveRegionsFromReplicationOutput
with field(s):arn(Option<String>)
:The ARN of the primary secret.
replication_status(Option<Vec::<ReplicationStatusType>>)
:The status of replicas for this secret after you remove Regions.
- On failure, responds with
SdkError<RemoveRegionsFromReplicationError>
Source§impl Client
impl Client
Sourcepub fn replicate_secret_to_regions(
&self,
) -> ReplicateSecretToRegionsFluentBuilder
pub fn replicate_secret_to_regions( &self, ) -> ReplicateSecretToRegionsFluentBuilder
Constructs a fluent builder for the ReplicateSecretToRegions
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to replicate.
add_replica_regions(ReplicaRegionType)
/set_add_replica_regions(Option<Vec::<ReplicaRegionType>>)
:
required: trueA list of Regions in which to replicate the secret.
force_overwrite_replica_secret(bool)
/set_force_overwrite_replica_secret(Option<bool>)
:
required: falseSpecifies whether to overwrite a secret with the same name in the destination Region. By default, secrets aren’t overwritten.
- On success, responds with
ReplicateSecretToRegionsOutput
with field(s):arn(Option<String>)
:The ARN of the primary secret.
replication_status(Option<Vec::<ReplicationStatusType>>)
:The status of replication.
- On failure, responds with
SdkError<ReplicateSecretToRegionsError>
Source§impl Client
impl Client
Sourcepub fn restore_secret(&self) -> RestoreSecretFluentBuilder
pub fn restore_secret(&self) -> RestoreSecretFluentBuilder
Constructs a fluent builder for the RestoreSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to restore.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
- On success, responds with
RestoreSecretOutput
with field(s):arn(Option<String>)
:The ARN of the secret that was restored.
name(Option<String>)
:The name of the secret that was restored.
- On failure, responds with
SdkError<RestoreSecretError>
Source§impl Client
impl Client
Sourcepub fn rotate_secret(&self) -> RotateSecretFluentBuilder
pub fn rotate_secret(&self) -> RotateSecretFluentBuilder
Constructs a fluent builder for the RotateSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret to rotate.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
client_request_token(impl Into<String>)
/set_client_request_token(Option<String>)
:
required: falseA unique identifier for the new version of the secret. 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.
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 generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a
ClientRequestToken
and include it 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.
rotation_lambda_arn(impl Into<String>)
/set_rotation_lambda_arn(Option<String>)
:
required: falseFor secrets that use a Lambda rotation function to rotate, the ARN of the Lambda rotation function.
For secrets that use managed rotation, omit this field. For more information, see Managed rotation in the Secrets Manager User Guide.
rotation_rules(RotationRulesType)
/set_rotation_rules(Option<RotationRulesType>)
:
required: falseA structure that defines the rotation configuration for this secret.
rotate_immediately(bool)
/set_rotate_immediately(Option<bool>)
:
required: falseSpecifies whether to rotate the secret immediately or wait until the next scheduled rotation window. The rotation schedule is defined in
RotateSecretRequest$RotationRules
.For secrets that use a Lambda rotation function to rotate, 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 anAWSPENDING
version of the secret and then removes it.By default, Secrets Manager rotates the secret immediately.
- On success, responds with
RotateSecretOutput
with field(s):arn(Option<String>)
:The ARN of the secret.
name(Option<String>)
:The name of the secret.
version_id(Option<String>)
:The ID of the new version of the secret.
- On failure, responds with
SdkError<RotateSecretError>
Source§impl Client
impl Client
Sourcepub fn stop_replication_to_replica(
&self,
) -> StopReplicationToReplicaFluentBuilder
pub fn stop_replication_to_replica( &self, ) -> StopReplicationToReplicaFluentBuilder
Constructs a fluent builder for the StopReplicationToReplica
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN of the primary secret.
- On success, responds with
StopReplicationToReplicaOutput
with field(s):arn(Option<String>)
:The ARN of the promoted secret. The ARN is the same as the original primary secret except the Region is changed.
- On failure, responds with
SdkError<StopReplicationToReplicaError>
Source§impl Client
impl Client
Sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe identifier for the secret to attach tags to. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
tags(Tag)
/set_tags(Option<Vec::<Tag>>)
:
required: trueThe tags to attach to the secret as a JSON text string argument. Each element in the list consists of a
Key
and aValue
.For storing multiple values, we recommend that you use a JSON text string argument and specify key/value pairs. For more information, see Specifying parameter values for the Amazon Web Services CLI in the Amazon Web Services CLI User Guide.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
Source§impl Client
impl Client
Sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueA list of tag key names to remove from the secret. You don’t specify the value. Both the key and its associated value are removed.
This parameter requires a JSON text string argument.
For storing multiple values, we recommend that you use a JSON text string argument and specify key/value pairs. For more information, see Specifying parameter values for the Amazon Web Services CLI in the Amazon Web Services CLI User Guide.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
Source§impl Client
impl Client
Sourcepub fn update_secret(&self) -> UpdateSecretFluentBuilder
pub fn update_secret(&self) -> UpdateSecretFluentBuilder
Constructs a fluent builder for the UpdateSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or name of the secret.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
client_request_token(impl Into<String>)
/set_client_request_token(Option<String>)
:
required: falseIf you include
SecretString
orSecretBinary
, 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 generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a
ClientRequestToken
and include it 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.
description(impl Into<String>)
/set_description(Option<String>)
:
required: falseThe description of the secret.
kms_key_id(impl Into<String>)
/set_kms_key_id(Option<String>)
:
required: falseThe ARN, key ID, or alias of the KMS key that Secrets Manager uses to encrypt new secret versions as well as any existing versions with the staging labels
AWSCURRENT
,AWSPENDING
, orAWSPREVIOUS
. If you don’t havekms:Encrypt
permission to the new key, Secrets Manager does not re-ecrypt existing secret versions with the new key. For more information about versions and staging labels, see Concepts: Version.A key alias is always prefixed by
alias/
, for examplealias/aws/secretsmanager
. For more information, see About aliases.If you set this to an empty string, Secrets Manager uses the Amazon Web Services managed key
aws/secretsmanager
. If this key doesn’t already exist in your account, then Secrets Manager creates it for you automatically. All users and roles in the Amazon Web Services account automatically have access to useaws/secretsmanager
. Creatingaws/secretsmanager
can result in a one-time significant delay in returning the result.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>)
:
required: falseThe 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
orSecretString
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>)
:
required: falseThe 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
orSecretString
must have a value, but not both.
- On success, responds with
UpdateSecretOutput
with field(s):arn(Option<String>)
:The ARN of the secret that was updated.
name(Option<String>)
:The name of the secret that was updated.
version_id(Option<String>)
:If Secrets Manager created a new version of the secret during this operation, then
VersionId
contains the unique identifier of the new version.
- On failure, responds with
SdkError<UpdateSecretError>
Source§impl Client
impl Client
Sourcepub fn update_secret_version_stage(
&self,
) -> UpdateSecretVersionStageFluentBuilder
pub fn update_secret_version_stage( &self, ) -> UpdateSecretVersionStageFluentBuilder
Constructs a fluent builder for the UpdateSecretVersionStage
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: trueThe ARN or the name of the secret with the version and staging labelsto modify.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
version_stage(impl Into<String>)
/set_version_stage(Option<String>)
:
required: trueThe staging label to add to this version.
remove_from_version_id(impl Into<String>)
/set_remove_from_version_id(Option<String>)
:
required: falseThe ID of the version that the staging label is to be removed from. If the staging label you are trying to attach to one version is already attached to a different version, then you must include this parameter and specify the version that the label is to be removed from. If the label is attached and you either do not specify this parameter, or the version ID does not match, then the operation fails.
move_to_version_id(impl Into<String>)
/set_move_to_version_id(Option<String>)
:
required: falseThe ID of the version to add the staging label to. To remove a label from a version, then do not specify this parameter.
If the staging label is already attached to a different version of the secret, then you must also specify the
RemoveFromVersionId
parameter.
- On success, responds with
UpdateSecretVersionStageOutput
with field(s):arn(Option<String>)
:The ARN of the secret that was updated.
name(Option<String>)
:The name of the secret that was updated.
- On failure, responds with
SdkError<UpdateSecretVersionStageError>
Source§impl Client
impl Client
Sourcepub fn validate_resource_policy(&self) -> ValidateResourcePolicyFluentBuilder
pub fn validate_resource_policy(&self) -> ValidateResourcePolicyFluentBuilder
Constructs a fluent builder for the ValidateResourcePolicy
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:
required: falseThis field is reserved for internal use.
resource_policy(impl Into<String>)
/set_resource_policy(Option<String>)
:
required: trueA JSON-formatted string that contains an Amazon Web Services resource-based policy. The policy in the string identifies who can access or manage this secret and its versions. For example policies, see Permissions policy examples.
- On success, responds with
ValidateResourcePolicyOutput
with field(s):policy_validation_passed(bool)
:True if your policy passes validation, otherwise false.
validation_errors(Option<Vec::<ValidationErrorsEntry>>)
:Validation errors if your policy didn’t pass validation.
- On failure, responds with
SdkError<ValidateResourcePolicyError>
Source§impl Client
impl Client
Sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config
.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_impl
configured. - Identity caching is enabled without a
sleep_impl
andtime_source
configured. - No
behavior_version
is provided.
The panic message for each of these will have instructions on how to resolve them.
Source§impl Client
impl Client
Sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_config
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
sdk_config
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it. - This method will panic if no
BehaviorVersion
is provided. If you experience this panic, setbehavior_version
on the Config or enable thebehavior-version-latest
Cargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)