Retrieves an authorization token. An authorization token represents your IAM authentication credentials and can be used to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours.
The authorizationToken returned is a base64 encoded string that can be decoded and used in a docker login command to authenticate to a registry. The CLI offers an get-login-password command that simplifies the login process. For more information, see Registry authentication in the Amazon Elastic Container Registry User Guide.
Parameters:
-
registry_ids
(Optional[GetAuthorizationTokenRegistryIdList], default:
None
)
–
A list of Amazon Web Services account IDs that are associated with the registries for which to get AuthorizationData objects. If you do not specify a registry, the default registry is assumed.
Raises:
Source code in docs_src/capo_ecr/_services/ecr.py
| def get_authorization_token(
self,
*,
config_overrides: Optional[ECRClientConfig] = None,
registry_ids: Optional[
"capo_ecr.types.get_authorization_token_registry_id_list.GetAuthorizationTokenRegistryIdList"
] = None,
) -> (
"capo_ecr.types.get_authorization_token_response.GetAuthorizationTokenResponse"
):
"""<p>Retrieves an authorization token. An authorization token represents your IAM authentication credentials and can be used to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours.</p> <p>The <code>authorizationToken</code> returned is a base64 encoded string that can be decoded and used in a <code>docker login</code> command to authenticate to a registry. The CLI offers an <code>get-login-password</code> command that simplifies the login process. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth">Registry authentication</a> in the <i>Amazon Elastic Container Registry User Guide</i>.</p>
Args:
registry_ids: <p>A list of Amazon Web Services account IDs that are associated with the registries for which to get AuthorizationData objects. If you do not specify a registry, the default registry is assumed.</p>
Raises:
capo_ecr.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
capo_ecr.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ecr.types.get_authorization_token_request.GetAuthorizationTokenRequest]",
) -> OperationResponse[
"capo_ecr.types.get_authorization_token_response.GetAuthorizationTokenResponse"
]:
import capo_ecr._operations.amazon_ec2_container_registry_v20150921.get_authorization_token
output, http_response = (
capo_ecr._operations.amazon_ec2_container_registry_v20150921.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.types.get_authorization_token_request.GetAuthorizationTokenRequest = {}
if registry_ids is not None:
input_["registry_ids"] = registry_ids
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|