get_role_credentials
async
¶
get_role_credentials(
tenant_id: TenantId,
role_arn: str,
access_type: AccessType,
*,
config_overrides: Optional[AsyncAccountAccessRuntimeClientConfig] = None,
session_name: Optional[SessionName] = None,
session_duration: Optional[int] = None,
) -> GetRoleCredentialsResponse
Returns temporary Amazon Web Services credentials for a role that you are entitled to assume within a tenant. You can use these credentials for programmatic access with the CLI or an Amazon Web Services SDK. If you aren't entitled to the role, the request fails with an AccessDeniedException error.
Parameters:
-
tenant_id(TenantId) –The identifier of the tenant that the request applies to. A tenant ID begins with
aa-and is 3 to 24 characters long. It can contain lowercase letters, numbers, and hyphens. -
role_arn(str) –The Amazon Resource Name (ARN) of the role to retrieve credentials for. You must be entitled to assume this role.
-
access_type(AccessType) –The type of access to request for the role. Specify
PROGRAMMATIC_ACCESSto receive access key credentials for use with the CLI or an Amazon Web Services SDK. -
session_name(Optional[SessionName], default:None) –An optional name for the role session. The name can be 2 to 64 characters and can contain alphanumeric characters and the following symbols: plus (+), equal (=), comma (,), period (.), at (@), and hyphen (-). The session name appears in CloudTrail logs for the assumed role session.
-
session_duration(Optional[int], default:None) –The duration, in seconds, that the returned credentials remain valid. If you don't specify a value, the service uses the default session duration. The maximum value can't exceed the maximum session duration configured for the role.
Raises:
-
AccessDeniedException–You are authenticated but not authorized to perform the requested action, such as assuming a role that you aren't entitled to. This error returns an HTTP 403 status code.
-
InternalServerException–An internal server error occurred. Retry the request. If the problem persists, contact Amazon Web Services Support. This error returns an HTTP 500 status code.
-
ThrottlingException–The request rate exceeded the allowed limit. Reduce your request rate, and then retry the request. This error returns an HTTP 429 status code.
-
UnauthorizedException–The bearer token is missing, invalid, or expired. Obtain a new token, and then retry the request. This error returns an HTTP 401 status code.
-
ValidationException–The request is missing a required parameter, or a parameter value doesn't satisfy its constraints, such as its length or pattern. Correct the input, and then retry the request. This error returns an HTTP 400 status code.
-
UnknownServiceError–The service returned an error code this client does not model.