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
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.
client = boto3.client("secretsmanager")
try:
do_something(client)
except (
client.ClientError,
client.DecryptionFailure,
client.EncryptionFailure,
client.InternalServiceError,
client.InvalidNextTokenException,
client.InvalidParameterException,
client.InvalidRequestException,
client.LimitExceededException,
client.MalformedPolicyDocumentException,
client.PreconditionNotMetException,
client.PublicPolicyException,
client.ResourceExistsException,
client.ResourceNotFoundException,
) as e:
print(e)
from mypy_boto3_secretsmanager.client import Exceptions
def handle_error(exc: Exceptions.ClientError) -> None:
...
Methods
can_paginate
Check if an operation can be paginated.
Type annotations and code completion for boto3.client("secretsmanager").can_paginate
method.
boto3 documentation
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
def cancel_rotate_secret(
self,
*,
SecretId: str,
) -> CancelRotateSecretResponseTypeDef: # (1)
...
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
create_secret
Creates a new secret.
Type annotations and code completion for boto3.client("secretsmanager").create_secret
method.
boto3 documentation
def create_secret(
self,
*,
Name: str,
ClientRequestToken: str = ...,
Description: str = ...,
KmsKeyId: str = ...,
SecretBinary: Union[str, bytes, IO[Any], StreamingBody] = ...,
SecretString: str = ...,
Tags: Sequence[TagTypeDef] = ..., # (1)
AddReplicaRegions: Sequence[ReplicaRegionTypeTypeDef] = ..., # (2)
ForceOverwriteReplicaSecret: bool = ...,
) -> CreateSecretResponseTypeDef: # (3)
...
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
def delete_resource_policy(
self,
*,
SecretId: str,
) -> DeleteResourcePolicyResponseTypeDef: # (1)
...
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
def delete_secret(
self,
*,
SecretId: str,
RecoveryWindowInDays: int = ...,
ForceDeleteWithoutRecovery: bool = ...,
) -> DeleteSecretResponseTypeDef: # (1)
...
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
def describe_secret(
self,
*,
SecretId: str,
) -> DescribeSecretResponseTypeDef: # (1)
...
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
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
def get_random_password(
self,
*,
PasswordLength: int = ...,
ExcludeCharacters: str = ...,
ExcludeNumbers: bool = ...,
ExcludePunctuation: bool = ...,
ExcludeUppercase: bool = ...,
ExcludeLowercase: bool = ...,
IncludeSpace: bool = ...,
RequireEachIncludedType: bool = ...,
) -> GetRandomPasswordResponseTypeDef: # (1)
...
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
def get_resource_policy(
self,
*,
SecretId: str,
) -> GetResourcePolicyResponseTypeDef: # (1)
...
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
def get_secret_value(
self,
*,
SecretId: str,
VersionId: str = ...,
VersionStage: str = ...,
) -> GetSecretValueResponseTypeDef: # (1)
...
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
def list_secret_version_ids(
self,
*,
SecretId: str,
MaxResults: int = ...,
NextToken: str = ...,
IncludeDeprecated: bool = ...,
) -> ListSecretVersionIdsResponseTypeDef: # (1)
...
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
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
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
def put_resource_policy(
self,
*,
SecretId: str,
ResourcePolicy: str,
BlockPublicPolicy: bool = ...,
) -> PutResourcePolicyResponseTypeDef: # (1)
...
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
def put_secret_value(
self,
*,
SecretId: str,
ClientRequestToken: str = ...,
SecretBinary: Union[str, bytes, IO[Any], StreamingBody] = ...,
SecretString: str = ...,
VersionStages: Sequence[str] = ...,
) -> PutSecretValueResponseTypeDef: # (1)
...
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
def remove_regions_from_replication(
self,
*,
SecretId: str,
RemoveReplicaRegions: Sequence[str],
) -> RemoveRegionsFromReplicationResponseTypeDef: # (1)
...
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
def replicate_secret_to_regions(
self,
*,
SecretId: str,
AddReplicaRegions: Sequence[ReplicaRegionTypeTypeDef], # (1)
ForceOverwriteReplicaSecret: bool = ...,
) -> ReplicateSecretToRegionsResponseTypeDef: # (2)
...
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
def restore_secret(
self,
*,
SecretId: str,
) -> RestoreSecretResponseTypeDef: # (1)
...
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
def rotate_secret(
self,
*,
SecretId: str,
ClientRequestToken: str = ...,
RotationLambdaARN: str = ...,
RotationRules: RotationRulesTypeTypeDef = ..., # (1)
RotateImmediately: bool = ...,
) -> RotateSecretResponseTypeDef: # (2)
...
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
def stop_replication_to_replica(
self,
*,
SecretId: str,
) -> StopReplicationToReplicaResponseTypeDef: # (1)
...
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
def tag_resource(
self,
*,
SecretId: str,
Tags: Sequence[TagTypeDef], # (1)
) -> EmptyResponseMetadataTypeDef: # (2)
...
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
def untag_resource(
self,
*,
SecretId: str,
TagKeys: Sequence[str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
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
def update_secret(
self,
*,
SecretId: str,
ClientRequestToken: str = ...,
Description: str = ...,
KmsKeyId: str = ...,
SecretBinary: Union[str, bytes, IO[Any], StreamingBody] = ...,
SecretString: str = ...,
) -> UpdateSecretResponseTypeDef: # (1)
...
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
def update_secret_version_stage(
self,
*,
SecretId: str,
VersionStage: str,
RemoveFromVersionId: str = ...,
MoveToVersionId: str = ...,
) -> UpdateSecretVersionStageResponseTypeDef: # (1)
...
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
def validate_resource_policy(
self,
*,
ResourcePolicy: str,
SecretId: str = ...,
) -> ValidateResourcePolicyResponseTypeDef: # (1)
...
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