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:
-
InvalidParameterException
–
The specified parameter is invalid. Review the available parameters for the API request.
-
ServerException
–
These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact Amazon Web Services Support.
-
UnsupportedCommandException
–
The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_ecr_public/_services/ecrpublic.py
| def get_authorization_token(
self, *, config_overrides: Optional[ECRPUBLICClientConfig] = 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. Retry the request. If it continues to fail, contact Amazon Web Services Support.</p>
capo_ecr_public.errors.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.</p>
capo_ecr_public.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ecr_public.types.get_authorization_token_request.GetAuthorizationTokenRequest]",
) -> OperationResponse[
"capo_ecr_public.types.get_authorization_token_response.GetAuthorizationTokenResponse"
]:
import capo_ecr_public._operations.spencer_frontend_service.get_authorization_token
output, http_response = (
capo_ecr_public._operations.spencer_frontend_service.get_authorization_token.get_authorization_token(
req.options, req.input
)
)
return OperationResponse(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 = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|