STSClient#
Auto-generated documentation for STS type annotations stubs module types-boto3-sts.
STSClient#
Type annotations and code completion for boto3.client("sts").
 boto3 documentation
# STSClient usage example
from boto3.session import Session
from types_boto3_sts.client import STSClient
def get_sts_client() -> STSClient:
    return Session().client("sts")Exceptions#
boto3 client exceptions are generated in runtime.
This class provides code completion for boto3.client("sts").exceptions structure.
# Exceptions.exceptions usage example
client = boto3.client("sts")
try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.ExpiredTokenException,
    client.exceptions.IDPCommunicationErrorException,
    client.exceptions.IDPRejectedClaimException,
    client.exceptions.InvalidAuthorizationMessageException,
    client.exceptions.InvalidIdentityTokenException,
    client.exceptions.MalformedPolicyDocumentException,
    client.exceptions.PackedPolicyTooLargeException,
    client.exceptions.RegionDisabledException,
) as e:
    print(e)# Exceptions.exceptions type checking example
from types_boto3_sts.client import Exceptions
def handle_error(exc: Exceptions.ClientError) -> None:
    ...Methods#
can_paginate#
Type annotations and code completion for boto3.client("sts").can_paginate method.
 boto3 documentation
# can_paginate method definition
def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...generate_presigned_url#
Type annotations and code completion for boto3.client("sts").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:
    ...assume_role#
Returns a set of temporary security credentials that you can use to access Amazon Web Services resources.
Type annotations and code completion for boto3.client("sts").assume_role method.
 boto3 documentation
# assume_role method definition
def assume_role(
    self,
    *,
    RoleArn: str,
    RoleSessionName: str,
    PolicyArns: Sequence[PolicyDescriptorTypeTypeDef] = ...,  # (1)
    Policy: str = ...,
    DurationSeconds: int = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (2)
    TransitiveTagKeys: Sequence[str] = ...,
    ExternalId: str = ...,
    SerialNumber: str = ...,
    TokenCode: str = ...,
    SourceIdentity: str = ...,
    ProvidedContexts: Sequence[ProvidedContextTypeDef] = ...,  # (3)
) -> AssumeRoleResponseTypeDef:  # (4)
    ...- See Sequence[PolicyDescriptorTypeTypeDef]
- See Sequence[TagTypeDef]
- See Sequence[ProvidedContextTypeDef]
- See AssumeRoleResponseTypeDef
# assume_role method usage example with argument unpacking
kwargs: AssumeRoleRequestTypeDef = {  # (1)
    "RoleArn": ...,
    "RoleSessionName": ...,
}
parent.assume_role(**kwargs)assume_role_with_saml#
Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response.
Type annotations and code completion for boto3.client("sts").assume_role_with_saml method.
 boto3 documentation
# assume_role_with_saml method definition
def assume_role_with_saml(
    self,
    *,
    RoleArn: str,
    PrincipalArn: str,
    SAMLAssertion: str,
    PolicyArns: Sequence[PolicyDescriptorTypeTypeDef] = ...,  # (1)
    Policy: str = ...,
    DurationSeconds: int = ...,
) -> AssumeRoleWithSAMLResponseTypeDef:  # (2)
    ...- See Sequence[PolicyDescriptorTypeTypeDef]
- See AssumeRoleWithSAMLResponseTypeDef
# assume_role_with_saml method usage example with argument unpacking
kwargs: AssumeRoleWithSAMLRequestTypeDef = {  # (1)
    "RoleArn": ...,
    "PrincipalArn": ...,
    "SAMLAssertion": ...,
}
parent.assume_role_with_saml(**kwargs)assume_role_with_web_identity#
Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider.
Type annotations and code completion for boto3.client("sts").assume_role_with_web_identity method.
 boto3 documentation
# assume_role_with_web_identity method definition
def assume_role_with_web_identity(
    self,
    *,
    RoleArn: str,
    RoleSessionName: str,
    WebIdentityToken: str,
    ProviderId: str = ...,
    PolicyArns: Sequence[PolicyDescriptorTypeTypeDef] = ...,  # (1)
    Policy: str = ...,
    DurationSeconds: int = ...,
) -> AssumeRoleWithWebIdentityResponseTypeDef:  # (2)
    ...- See Sequence[PolicyDescriptorTypeTypeDef]
- See AssumeRoleWithWebIdentityResponseTypeDef
# assume_role_with_web_identity method usage example with argument unpacking
kwargs: AssumeRoleWithWebIdentityRequestTypeDef = {  # (1)
    "RoleArn": ...,
    "RoleSessionName": ...,
    "WebIdentityToken": ...,
}
parent.assume_role_with_web_identity(**kwargs)assume_root#
Returns a set of short term credentials you can use to perform privileged tasks on a member account in your organization.
Type annotations and code completion for boto3.client("sts").assume_root method.
 boto3 documentation
# assume_root method definition
def assume_root(
    self,
    *,
    TargetPrincipal: str,
    TaskPolicyArn: PolicyDescriptorTypeTypeDef,  # (1)
    DurationSeconds: int = ...,
) -> AssumeRootResponseTypeDef:  # (2)
    ...# assume_root method usage example with argument unpacking
kwargs: AssumeRootRequestTypeDef = {  # (1)
    "TargetPrincipal": ...,
    "TaskPolicyArn": ...,
}
parent.assume_root(**kwargs)decode_authorization_message#
Decodes additional information about the authorization status of a request from an encoded message returned in response to an Amazon Web Services request.
Type annotations and code completion for boto3.client("sts").decode_authorization_message method.
 boto3 documentation
# decode_authorization_message method definition
def decode_authorization_message(
    self,
    *,
    EncodedMessage: str,
) -> DecodeAuthorizationMessageResponseTypeDef:  # (1)
    ...# decode_authorization_message method usage example with argument unpacking
kwargs: DecodeAuthorizationMessageRequestTypeDef = {  # (1)
    "EncodedMessage": ...,
}
parent.decode_authorization_message(**kwargs)get_access_key_info#
Returns the account identifier for the specified access key ID.
Type annotations and code completion for boto3.client("sts").get_access_key_info method.
 boto3 documentation
# get_access_key_info method definition
def get_access_key_info(
    self,
    *,
    AccessKeyId: str,
) -> GetAccessKeyInfoResponseTypeDef:  # (1)
    ...# get_access_key_info method usage example with argument unpacking
kwargs: GetAccessKeyInfoRequestTypeDef = {  # (1)
    "AccessKeyId": ...,
}
parent.get_access_key_info(**kwargs)get_caller_identity#
Returns details about the IAM user or role whose credentials are used to call the operation.
Type annotations and code completion for boto3.client("sts").get_caller_identity method.
 boto3 documentation
# get_caller_identity method definition
def get_caller_identity(
    self,
) -> GetCallerIdentityResponseTypeDef:  # (1)
    ...get_federation_token#
Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a user.
Type annotations and code completion for boto3.client("sts").get_federation_token method.
 boto3 documentation
# get_federation_token method definition
def get_federation_token(
    self,
    *,
    Name: str,
    Policy: str = ...,
    PolicyArns: Sequence[PolicyDescriptorTypeTypeDef] = ...,  # (1)
    DurationSeconds: int = ...,
    Tags: Sequence[TagTypeDef] = ...,  # (2)
) -> GetFederationTokenResponseTypeDef:  # (3)
    ...- See Sequence[PolicyDescriptorTypeTypeDef]
- See Sequence[TagTypeDef]
- See GetFederationTokenResponseTypeDef
# get_federation_token method usage example with argument unpacking
kwargs: GetFederationTokenRequestTypeDef = {  # (1)
    "Name": ...,
}
parent.get_federation_token(**kwargs)get_session_token#
Returns a set of temporary credentials for an Amazon Web Services account or IAM user.
Type annotations and code completion for boto3.client("sts").get_session_token method.
 boto3 documentation
# get_session_token method definition
def get_session_token(
    self,
    *,
    DurationSeconds: int = ...,
    SerialNumber: str = ...,
    TokenCode: str = ...,
) -> GetSessionTokenResponseTypeDef:  # (1)
    ...# get_session_token method usage example with argument unpacking
kwargs: GetSessionTokenRequestTypeDef = {  # (1)
    "DurationSeconds": ...,
}
parent.get_session_token(**kwargs)