Struct aws_sdk_secretsmanager::Client
source · [−]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
sourceimpl Client
impl Client
sourcepub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
pub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
Creates a client with the given service configuration.
sourceimpl Client
impl Client
sourcepub fn cancel_rotate_secret(&self) -> CancelRotateSecret
pub fn cancel_rotate_secret(&self) -> CancelRotateSecret
Constructs a fluent builder for the CancelRotateSecret
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.
- 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>
sourcepub fn create_secret(&self) -> CreateSecret
pub fn create_secret(&self) -> CreateSecret
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
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 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
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>)
: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
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>)
: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
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(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>
sourcepub fn delete_resource_policy(&self) -> DeleteResourcePolicy
pub fn delete_resource_policy(&self) -> DeleteResourcePolicy
Constructs a fluent builder for the DeleteResourcePolicy
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 the attached resource-based policy for.
For an ARN, we recommend that you specify a complete ARN rather than 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>
sourcepub fn delete_secret(&self) -> DeleteSecret
pub fn delete_secret(&self) -> DeleteSecret
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 theForceDeleteWithouRecovery
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>
sourcepub fn describe_secret(&self) -> DescribeSecret
pub fn describe_secret(&self) -> DescribeSecret
Constructs a fluent builder for the DescribeSecret
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.
- 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, 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, 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, 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 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>
sourcepub fn get_random_password(&self) -> GetRandomPassword
pub fn get_random_password(&self) -> GetRandomPassword
Constructs a fluent builder for the GetRandomPassword
operation.
- The fluent builder is configurable:
password_length(i64)
/set_password_length(Option<i64>)
:The 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>)
:A string of the characters that you don’t want in the password.
exclude_numbers(bool)
/set_exclude_numbers(Option<bool>)
:Specifies 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>)
:Specifies 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>)
:Specifies 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>)
:Specifies 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>)
:Specifies 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>)
:Specifies 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>
sourcepub fn get_resource_policy(&self) -> GetResourcePolicy
pub fn get_resource_policy(&self) -> GetResourcePolicy
Constructs a fluent builder for the GetResourcePolicy
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 the attached resource-based policy for.
For an ARN, we recommend that you specify a complete ARN rather than 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>
sourcepub fn get_secret_value(&self) -> GetSecretValue
pub fn get_secret_value(&self) -> GetSecretValue
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 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>)
: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 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. 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
orVersionStage
, then Secrets Manager uses theAWSCURRENT
version.
- On failure, responds with
SdkError<GetSecretValueError>
sourcepub fn list_secrets(&self) -> ListSecrets
pub fn list_secrets(&self) -> ListSecrets
Constructs a fluent builder for the ListSecrets
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
max_results(i32)
/set_max_results(Option<i32>)
:The 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>)
:A 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(Vec<Filter>)
/set_filters(Option<Vec<Filter>>)
:The filters to apply to the list of secrets.
sort_order(SortOrderType)
/set_sort_order(Option<SortOrderType>)
:Lists secrets in the requested order.
- 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>
sourcepub fn list_secret_version_ids(&self) -> ListSecretVersionIds
pub fn list_secret_version_ids(&self) -> ListSecretVersionIds
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>)
:The 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.
max_results(i32)
/set_max_results(Option<i32>)
:The 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>)
:A 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>)
:Specifies 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.
- 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>
sourcepub fn put_resource_policy(&self) -> PutResourcePolicy
pub fn put_resource_policy(&self) -> PutResourcePolicy
Constructs a fluent builder for the PutResourcePolicy
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The 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.
resource_policy(impl Into<String>)
/set_resource_policy(Option<String>)
:A 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>)
:Specifies whether to block resource-based policies that allow broad access to the secret. By default, Secrets Manager blocks policies that allow broad access, for example those that use a wildcard for the principal.
- 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>
sourcepub fn put_secret_value(&self) -> PutSecretValue
pub fn put_secret_value(&self) -> PutSecretValue
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
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>)
: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
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>)
:The 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(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 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>
sourcepub fn remove_regions_from_replication(&self) -> RemoveRegionsFromReplication
pub fn remove_regions_from_replication(&self) -> RemoveRegionsFromReplication
Constructs a fluent builder for the RemoveRegionsFromReplication
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The ARN or name of the secret.
remove_replica_regions(Vec<String>)
/set_remove_replica_regions(Option<Vec<String>>)
:The 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>
sourcepub fn replicate_secret_to_regions(&self) -> ReplicateSecretToRegions
pub fn replicate_secret_to_regions(&self) -> ReplicateSecretToRegions
Constructs a fluent builder for the ReplicateSecretToRegions
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The ARN or name of the secret to replicate.
add_replica_regions(Vec<ReplicaRegionType>)
/set_add_replica_regions(Option<Vec<ReplicaRegionType>>)
:A list of Regions in which to replicate the secret.
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
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>
sourcepub fn restore_secret(&self) -> RestoreSecret
pub fn restore_secret(&self) -> RestoreSecret
Constructs a fluent builder for the RestoreSecret
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The ARN or name of the secret to restore.
For an ARN, we recommend that you specify a complete ARN rather than 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>
sourcepub fn rotate_secret(&self) -> RotateSecret
pub fn rotate_secret(&self) -> RotateSecret
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 anAWSPENDING
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):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>
sourcepub fn stop_replication_to_replica(&self) -> StopReplicationToReplica
pub fn stop_replication_to_replica(&self) -> StopReplicationToReplica
Constructs a fluent builder for the StopReplicationToReplica
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The 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>
sourcepub fn tag_resource(&self) -> TagResource
pub fn tag_resource(&self) -> TagResource
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The 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.
tags(Vec<Tag>)
/set_tags(Option<Vec<Tag>>)
:The 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>
sourcepub fn untag_resource(&self) -> UntagResource
pub fn untag_resource(&self) -> UntagResource
Constructs a fluent builder for the UntagResource
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.
tag_keys(Vec<String>)
/set_tag_keys(Option<Vec<String>>)
:A 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>
sourcepub fn update_secret(&self) -> UpdateSecret
pub fn update_secret(&self) -> UpdateSecret
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
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 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
, orAWSPREVIOUS
. 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
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>)
: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
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>
sourcepub fn update_secret_version_stage(&self) -> UpdateSecretVersionStage
pub fn update_secret_version_stage(&self) -> UpdateSecretVersionStage
Constructs a fluent builder for the UpdateSecretVersionStage
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:The 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.
version_stage(impl Into<String>)
/set_version_stage(Option<String>)
:The staging label to add to this version.
remove_from_version_id(impl Into<String>)
/set_remove_from_version_id(Option<String>)
:The 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>)
:The 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>
sourcepub fn validate_resource_policy(&self) -> ValidateResourcePolicy
pub fn validate_resource_policy(&self) -> ValidateResourcePolicy
Constructs a fluent builder for the ValidateResourcePolicy
operation.
- The fluent builder is configurable:
secret_id(impl Into<String>)
/set_secret_id(Option<String>)
:This field is reserved for internal use.
resource_policy(impl Into<String>)
/set_resource_policy(Option<String>)
:A 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>
sourceimpl Client
impl Client
sourcepub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
pub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
Creates a client with the given service config and connector override.
Trait Implementations
sourceimpl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
impl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
sourcefn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
fn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more