Returns the details of a single sign-in session. The session must belong to the identity specified by principalArn, or to the caller if principalArn is omitted. A session that belongs to a different identity or account is reported as not found.
Parameters:
-
session_arn
(SessionArn)
–
The ARN of the session to retrieve
-
principal_arn
(Optional[PrincipalArnFilter], default:
None
)
–
The identity that owns the session. Omit to use the caller. Specify arn:aws:iam::{account-id}:* to retrieve any session in the account.
Raises:
Examples:
Get one of your own sessions
Returns a session owned by the caller when principalArn is omitted.
>>> client.get_session(session_arn='arn:aws:signin:us-east-1:123456789012:session/3b0a6152-ba23-447d-83cf-b3b3cc7b95f7')
Get another identity's session as an account administrator
Uses the account wildcard principal ARN to get a session owned by another IAM identity.
>>> client.get_session(principal_arn='arn:aws:iam::123456789012:*', session_arn='arn:aws:signin:us-east-1:123456789012:session/5dbdd43b-4135-4c59-ad06-5ddbcc2c1d77')
Source code in docs_src/capo_signin/_services/signin.py
| def get_session(
self,
session_arn: "capo_signin.types.session_arn.SessionArn",
*,
config_overrides: Optional[SigninClientConfig] = None,
principal_arn: Optional[
"capo_signin.types.principal_arn_filter.PrincipalArnFilter"
] = None,
) -> "capo_signin.types.get_session_output.GetSessionOutput":
"""Returns the details of a single sign-in session. The session must belong to the identity specified by principalArn, or to the caller if principalArn is omitted. A session that belongs to a different identity or account is reported as not found.
Args:
session_arn: The ARN of the session to retrieve
principal_arn: The identity that owns the session. Omit to use the caller. Specify arn:aws:iam::{account-id}:* to retrieve any session in the account.
Raises:
capo_signin.errors.access_denied_exception.AccessDeniedException: You do not have sufficient access to perform this action.
capo_signin.errors.internal_server_exception.InternalServerException: The request failed because of an internal server error.
capo_signin.errors.resource_not_found_exception.ResourceNotFoundException: Error thrown when requested resource is not found HTTP Status Code: 404 Not Found Used when the specified resource does not exist
capo_signin.errors.too_many_requests_error.TooManyRequestsError: The request failed because you exceeded the request rate limit for this operation.
capo_signin.errors.validation_exception.ValidationException: The request failed because it contains a malformed, missing, or invalid parameter.
capo_signin.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Get one of your own sessions
Returns a session owned by the caller when principalArn is omitted.
>>> client.get_session(session_arn='arn:aws:signin:us-east-1:123456789012:session/3b0a6152-ba23-447d-83cf-b3b3cc7b95f7')
Get another identity's session as an account administrator
Uses the account wildcard principal ARN to get a session owned by another IAM identity.
>>> client.get_session(principal_arn='arn:aws:iam::123456789012:*', session_arn='arn:aws:signin:us-east-1:123456789012:session/5dbdd43b-4135-4c59-ad06-5ddbcc2c1d77')
"""
def _handler(
req: "OperationRequest[capo_signin.types.get_session_input.GetSessionInput]",
) -> OperationResponse["capo_signin.types.get_session_output.GetSessionOutput"]:
import capo_signin._operations.signin.get_session
output, http_response = (
capo_signin._operations.signin.get_session.get_session(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetSession")
)
input_: capo_signin.types.get_session_input.GetSessionInput = {
"session_arn": session_arn
}
if principal_arn is not None:
input_["principal_arn"] = principal_arn
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|