Retrieves an authorization token. An authorization token represents your IAM authentication credentials. You can use it to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours. This API requires the ecr-public:GetAuthorizationToken and sts:GetServiceBearerToken permissions.
Raises:
Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
| async def get_authorization_token(
self, *, config_overrides: Optional[AsyncECRPUBLICClientConfig] = None
) -> "capo_ecr_public.types.get_authorization_token_response.GetAuthorizationTokenResponse":
"""<p>Retrieves an authorization token. An authorization token represents your IAM authentication credentials. You can use it to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours. This API requires the <code>ecr-public:GetAuthorizationToken</code> and <code>sts:GetServiceBearerToken</code> permissions.</p>
Raises:
capo_ecr_public.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
capo_ecr_public.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
capo_ecr_public.errors.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this Region.</p>
capo_ecr_public.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_ecr_public.types.get_authorization_token_request.GetAuthorizationTokenRequest]",
) -> AsyncOperationResponse[
"capo_ecr_public.types.get_authorization_token_response.GetAuthorizationTokenResponse"
]:
import capo_ecr_public._operations.spencer_frontend_service.get_authorization_token
(
output,
http_response,
) = await capo_ecr_public._operations.spencer_frontend_service.get_authorization_token.async_get_authorization_token(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetAuthorizationToken")
)
input_: capo_ecr_public.types.get_authorization_token_request.GetAuthorizationTokenRequest = {}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|