SecretsManagerClient#
Index > SecretsManager > SecretsManagerClient
Auto-generated documentation for SecretsManager type annotations stubs module mypy-boto3-secretsmanager.
SecretsManagerClient#
Type annotations and code completion for boto3.client("secretsmanager")
.
boto3 documentation
# SecretsManagerClient usage example
from boto3.session import Session
from mypy_boto3_secretsmanager.client import SecretsManagerClient
def get_secretsmanager_client() -> SecretsManagerClient:
return Session().client("secretsmanager")
Exceptions#
boto3
client exceptions are generated in runtime.
This class provides code completion for boto3.client("secretsmanager").exceptions
structure.
# Exceptions.exceptions usage example
client = boto3.client("secretsmanager")
try:
do_something(client)
except (
client.exceptions.ClientError,
client.exceptions.DecryptionFailure,
client.exceptions.EncryptionFailure,
client.exceptions.InternalServiceError,
client.exceptions.InvalidNextTokenException,
client.exceptions.InvalidParameterException,
client.exceptions.InvalidRequestException,
client.exceptions.LimitExceededException,
client.exceptions.MalformedPolicyDocumentException,
client.exceptions.PreconditionNotMetException,
client.exceptions.PublicPolicyException,
client.exceptions.ResourceExistsException,
client.exceptions.ResourceNotFoundException,
) as e:
print(e)
# Exceptions.exceptions type checking example
from mypy_boto3_secretsmanager.client import Exceptions
def handle_error(exc: Exceptions.ClientError) -> None:
...
Methods#
batch_get_secret_value#
Retrieves the contents of the encrypted fields SecretString
or SecretBinary
for up to 20
secrets.
Type annotations and code completion for boto3.client("secretsmanager").batch_get_secret_value
method.
boto3 documentation
# batch_get_secret_value method definition
def batch_get_secret_value(
self,
*,
SecretIdList: Sequence[str] = ...,
Filters: Sequence[FilterTypeDef] = ..., # (1)
MaxResults: int = ...,
NextToken: str = ...,
) -> BatchGetSecretValueResponseTypeDef: # (2)
...
# batch_get_secret_value method usage example with argument unpacking
kwargs: BatchGetSecretValueRequestRequestTypeDef = { # (1)
"SecretIdList": ...,
}
parent.batch_get_secret_value(**kwargs)
can_paginate#
Check if an operation can be paginated.
Type annotations and code completion for boto3.client("secretsmanager").can_paginate
method.
boto3 documentation
# can_paginate method definition
def can_paginate(
self,
operation_name: str,
) -> bool:
...
cancel_rotate_secret#
Turns off automatic rotation, and if a rotation is currently in progress, cancels the rotation.
Type annotations and code completion for boto3.client("secretsmanager").cancel_rotate_secret
method.
boto3 documentation
# cancel_rotate_secret method definition
def cancel_rotate_secret(
self,
*,
SecretId: str,
) -> CancelRotateSecretResponseTypeDef: # (1)
...
# cancel_rotate_secret method usage example with argument unpacking
kwargs: CancelRotateSecretRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.cancel_rotate_secret(**kwargs)
close#
Closes underlying endpoint connections.
Type annotations and code completion for boto3.client("secretsmanager").close
method.
boto3 documentation
# close method definition
def close(
self,
) -> None:
...
create_secret#
Creates a new secret.
Type annotations and code completion for boto3.client("secretsmanager").create_secret
method.
boto3 documentation
# create_secret method definition
def create_secret(
self,
*,
Name: str,
ClientRequestToken: str = ...,
Description: str = ...,
KmsKeyId: str = ...,
SecretBinary: BlobTypeDef = ...,
SecretString: str = ...,
Tags: Sequence[TagTypeDef] = ..., # (1)
AddReplicaRegions: Sequence[ReplicaRegionTypeTypeDef] = ..., # (2)
ForceOverwriteReplicaSecret: bool = ...,
) -> CreateSecretResponseTypeDef: # (3)
...
# create_secret method usage example with argument unpacking
kwargs: CreateSecretRequestRequestTypeDef = { # (1)
"Name": ...,
}
parent.create_secret(**kwargs)
delete_resource_policy#
Deletes the resource-based permission policy attached to the secret.
Type annotations and code completion for boto3.client("secretsmanager").delete_resource_policy
method.
boto3 documentation
# delete_resource_policy method definition
def delete_resource_policy(
self,
*,
SecretId: str,
) -> DeleteResourcePolicyResponseTypeDef: # (1)
...
# delete_resource_policy method usage example with argument unpacking
kwargs: DeleteResourcePolicyRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.delete_resource_policy(**kwargs)
delete_secret#
Deletes a secret and all of its versions.
Type annotations and code completion for boto3.client("secretsmanager").delete_secret
method.
boto3 documentation
# delete_secret method definition
def delete_secret(
self,
*,
SecretId: str,
RecoveryWindowInDays: int = ...,
ForceDeleteWithoutRecovery: bool = ...,
) -> DeleteSecretResponseTypeDef: # (1)
...
# delete_secret method usage example with argument unpacking
kwargs: DeleteSecretRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.delete_secret(**kwargs)
describe_secret#
Retrieves the details of a secret.
Type annotations and code completion for boto3.client("secretsmanager").describe_secret
method.
boto3 documentation
# describe_secret method definition
def describe_secret(
self,
*,
SecretId: str,
) -> DescribeSecretResponseTypeDef: # (1)
...
# describe_secret method usage example with argument unpacking
kwargs: DescribeSecretRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.describe_secret(**kwargs)
generate_presigned_url#
Generate a presigned url given a client, its method, and arguments.
Type annotations and code completion for boto3.client("secretsmanager").generate_presigned_url
method.
boto3 documentation
# generate_presigned_url method definition
def generate_presigned_url(
self,
ClientMethod: str,
Params: Mapping[str, Any] = ...,
ExpiresIn: int = 3600,
HttpMethod: str = ...,
) -> str:
...
get_random_password#
Generates a random password.
Type annotations and code completion for boto3.client("secretsmanager").get_random_password
method.
boto3 documentation
# get_random_password method definition
def get_random_password(
self,
*,
PasswordLength: int = ...,
ExcludeCharacters: str = ...,
ExcludeNumbers: bool = ...,
ExcludePunctuation: bool = ...,
ExcludeUppercase: bool = ...,
ExcludeLowercase: bool = ...,
IncludeSpace: bool = ...,
RequireEachIncludedType: bool = ...,
) -> GetRandomPasswordResponseTypeDef: # (1)
...
# get_random_password method usage example with argument unpacking
kwargs: GetRandomPasswordRequestRequestTypeDef = { # (1)
"PasswordLength": ...,
}
parent.get_random_password(**kwargs)
get_resource_policy#
Retrieves the JSON text of the resource-based policy document attached to the secret.
Type annotations and code completion for boto3.client("secretsmanager").get_resource_policy
method.
boto3 documentation
# get_resource_policy method definition
def get_resource_policy(
self,
*,
SecretId: str,
) -> GetResourcePolicyResponseTypeDef: # (1)
...
# get_resource_policy method usage example with argument unpacking
kwargs: GetResourcePolicyRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.get_resource_policy(**kwargs)
get_secret_value#
Retrieves the contents of the encrypted fields SecretString
or SecretBinary
from the specified version of a secret, whichever contains
content.
Type annotations and code completion for boto3.client("secretsmanager").get_secret_value
method.
boto3 documentation
# get_secret_value method definition
def get_secret_value(
self,
*,
SecretId: str,
VersionId: str = ...,
VersionStage: str = ...,
) -> GetSecretValueResponseTypeDef: # (1)
...
# get_secret_value method usage example with argument unpacking
kwargs: GetSecretValueRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.get_secret_value(**kwargs)
list_secret_version_ids#
Lists the versions of a secret.
Type annotations and code completion for boto3.client("secretsmanager").list_secret_version_ids
method.
boto3 documentation
# list_secret_version_ids method definition
def list_secret_version_ids(
self,
*,
SecretId: str,
MaxResults: int = ...,
NextToken: str = ...,
IncludeDeprecated: bool = ...,
) -> ListSecretVersionIdsResponseTypeDef: # (1)
...
# list_secret_version_ids method usage example with argument unpacking
kwargs: ListSecretVersionIdsRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.list_secret_version_ids(**kwargs)
list_secrets#
Lists the secrets that are stored by Secrets Manager in the Amazon Web Services account, not including secrets that are marked for deletion.
Type annotations and code completion for boto3.client("secretsmanager").list_secrets
method.
boto3 documentation
# list_secrets method definition
def list_secrets(
self,
*,
IncludePlannedDeletion: bool = ...,
MaxResults: int = ...,
NextToken: str = ...,
Filters: Sequence[FilterTypeDef] = ..., # (1)
SortOrder: SortOrderTypeType = ..., # (2)
) -> ListSecretsResponseTypeDef: # (3)
...
- See FilterTypeDef
- See SortOrderTypeType
- See ListSecretsResponseTypeDef
# list_secrets method usage example with argument unpacking
kwargs: ListSecretsRequestRequestTypeDef = { # (1)
"IncludePlannedDeletion": ...,
}
parent.list_secrets(**kwargs)
put_resource_policy#
Attaches a resource-based permission policy to a secret.
Type annotations and code completion for boto3.client("secretsmanager").put_resource_policy
method.
boto3 documentation
# put_resource_policy method definition
def put_resource_policy(
self,
*,
SecretId: str,
ResourcePolicy: str,
BlockPublicPolicy: bool = ...,
) -> PutResourcePolicyResponseTypeDef: # (1)
...
# put_resource_policy method usage example with argument unpacking
kwargs: PutResourcePolicyRequestRequestTypeDef = { # (1)
"SecretId": ...,
"ResourcePolicy": ...,
}
parent.put_resource_policy(**kwargs)
put_secret_value#
Creates a new version with a new encrypted secret value and attaches it to the secret.
Type annotations and code completion for boto3.client("secretsmanager").put_secret_value
method.
boto3 documentation
# put_secret_value method definition
def put_secret_value(
self,
*,
SecretId: str,
ClientRequestToken: str = ...,
SecretBinary: BlobTypeDef = ...,
SecretString: str = ...,
VersionStages: Sequence[str] = ...,
RotationToken: str = ...,
) -> PutSecretValueResponseTypeDef: # (1)
...
# put_secret_value method usage example with argument unpacking
kwargs: PutSecretValueRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.put_secret_value(**kwargs)
remove_regions_from_replication#
For a secret that is replicated to other Regions, deletes the secret replicas from the Regions you specify.
Type annotations and code completion for boto3.client("secretsmanager").remove_regions_from_replication
method.
boto3 documentation
# remove_regions_from_replication method definition
def remove_regions_from_replication(
self,
*,
SecretId: str,
RemoveReplicaRegions: Sequence[str],
) -> RemoveRegionsFromReplicationResponseTypeDef: # (1)
...
# remove_regions_from_replication method usage example with argument unpacking
kwargs: RemoveRegionsFromReplicationRequestRequestTypeDef = { # (1)
"SecretId": ...,
"RemoveReplicaRegions": ...,
}
parent.remove_regions_from_replication(**kwargs)
replicate_secret_to_regions#
Replicates the secret to a new Regions.
Type annotations and code completion for boto3.client("secretsmanager").replicate_secret_to_regions
method.
boto3 documentation
# replicate_secret_to_regions method definition
def replicate_secret_to_regions(
self,
*,
SecretId: str,
AddReplicaRegions: Sequence[ReplicaRegionTypeTypeDef], # (1)
ForceOverwriteReplicaSecret: bool = ...,
) -> ReplicateSecretToRegionsResponseTypeDef: # (2)
...
# replicate_secret_to_regions method usage example with argument unpacking
kwargs: ReplicateSecretToRegionsRequestRequestTypeDef = { # (1)
"SecretId": ...,
"AddReplicaRegions": ...,
}
parent.replicate_secret_to_regions(**kwargs)
restore_secret#
Cancels the scheduled deletion of a secret by removing the DeletedDate
time
stamp.
Type annotations and code completion for boto3.client("secretsmanager").restore_secret
method.
boto3 documentation
# restore_secret method definition
def restore_secret(
self,
*,
SecretId: str,
) -> RestoreSecretResponseTypeDef: # (1)
...
# restore_secret method usage example with argument unpacking
kwargs: RestoreSecretRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.restore_secret(**kwargs)
rotate_secret#
Configures and starts the asynchronous process of rotating the secret.
Type annotations and code completion for boto3.client("secretsmanager").rotate_secret
method.
boto3 documentation
# rotate_secret method definition
def rotate_secret(
self,
*,
SecretId: str,
ClientRequestToken: str = ...,
RotationLambdaARN: str = ...,
RotationRules: RotationRulesTypeTypeDef = ..., # (1)
RotateImmediately: bool = ...,
) -> RotateSecretResponseTypeDef: # (2)
...
# rotate_secret method usage example with argument unpacking
kwargs: RotateSecretRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.rotate_secret(**kwargs)
stop_replication_to_replica#
Removes the link between the replica secret and the primary secret and promotes the replica to a primary secret in the replica Region.
Type annotations and code completion for boto3.client("secretsmanager").stop_replication_to_replica
method.
boto3 documentation
# stop_replication_to_replica method definition
def stop_replication_to_replica(
self,
*,
SecretId: str,
) -> StopReplicationToReplicaResponseTypeDef: # (1)
...
# stop_replication_to_replica method usage example with argument unpacking
kwargs: StopReplicationToReplicaRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.stop_replication_to_replica(**kwargs)
tag_resource#
Attaches tags to a secret.
Type annotations and code completion for boto3.client("secretsmanager").tag_resource
method.
boto3 documentation
# tag_resource method definition
def tag_resource(
self,
*,
SecretId: str,
Tags: Sequence[TagTypeDef], # (1)
) -> EmptyResponseMetadataTypeDef: # (2)
...
# tag_resource method usage example with argument unpacking
kwargs: TagResourceRequestRequestTypeDef = { # (1)
"SecretId": ...,
"Tags": ...,
}
parent.tag_resource(**kwargs)
untag_resource#
Removes specific tags from a secret.
Type annotations and code completion for boto3.client("secretsmanager").untag_resource
method.
boto3 documentation
# untag_resource method definition
def untag_resource(
self,
*,
SecretId: str,
TagKeys: Sequence[str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
# untag_resource method usage example with argument unpacking
kwargs: UntagResourceRequestRequestTypeDef = { # (1)
"SecretId": ...,
"TagKeys": ...,
}
parent.untag_resource(**kwargs)
update_secret#
Modifies the details of a secret, including metadata and the secret value.
Type annotations and code completion for boto3.client("secretsmanager").update_secret
method.
boto3 documentation
# update_secret method definition
def update_secret(
self,
*,
SecretId: str,
ClientRequestToken: str = ...,
Description: str = ...,
KmsKeyId: str = ...,
SecretBinary: BlobTypeDef = ...,
SecretString: str = ...,
) -> UpdateSecretResponseTypeDef: # (1)
...
# update_secret method usage example with argument unpacking
kwargs: UpdateSecretRequestRequestTypeDef = { # (1)
"SecretId": ...,
}
parent.update_secret(**kwargs)
update_secret_version_stage#
Modifies the staging labels attached to a version of a secret.
Type annotations and code completion for boto3.client("secretsmanager").update_secret_version_stage
method.
boto3 documentation
# update_secret_version_stage method definition
def update_secret_version_stage(
self,
*,
SecretId: str,
VersionStage: str,
RemoveFromVersionId: str = ...,
MoveToVersionId: str = ...,
) -> UpdateSecretVersionStageResponseTypeDef: # (1)
...
# update_secret_version_stage method usage example with argument unpacking
kwargs: UpdateSecretVersionStageRequestRequestTypeDef = { # (1)
"SecretId": ...,
"VersionStage": ...,
}
parent.update_secret_version_stage(**kwargs)
validate_resource_policy#
Validates that a resource policy does not grant a wide range of principals access to your secret.
Type annotations and code completion for boto3.client("secretsmanager").validate_resource_policy
method.
boto3 documentation
# validate_resource_policy method definition
def validate_resource_policy(
self,
*,
ResourcePolicy: str,
SecretId: str = ...,
) -> ValidateResourcePolicyResponseTypeDef: # (1)
...
# validate_resource_policy method usage example with argument unpacking
kwargs: ValidateResourcePolicyRequestRequestTypeDef = { # (1)
"ResourcePolicy": ...,
}
parent.validate_resource_policy(**kwargs)
get_paginator#
Type annotations and code completion for boto3.client("secretsmanager").get_paginator
method with overloads.
client.get_paginator("list_secrets")
-> ListSecretsPaginator