Ecr client

This page contains examples with the Ecr client. See the client introduction for a more detailed description how to use a client. You may also want to consider the authentication documentation to understand the many ways you can authenticate with AWS.

The Ecr package could be installed with Composer.

composer require async-aws/ecr

A new client object may be instantiated by:

use AsyncAws\Ecr\EcrClient; $ecr = new EcrClient();

The authentication parameters is read from the environment by default. You can also specify a AWS access id and secret:

use AsyncAws\Ecr\EcrClient; $ecr = new EcrClient([ 'accessKeyId' => 'my_access_key', 'accessKeySecret' => 'my_access_secret', 'region' => 'eu-central-1', ]);

For all available options, see the configuration reference.

Usage

Get an Authorization Token

use AsyncAws\Ecr\EcrClient; use AsyncAws\Ecr\Input\GetAuthorizationTokenRequest; $ecr = new EcrClient(); $authorizationToken = $ecr->getAuthorizationToken(new GetAuthorizationTokenRequest([ 'registryIds' => '000000000000', ])); foreach ($authorizationToken->getAuthorizationData() as $authorizationData) { echo 'Authorization Token: '.$authorizationData->getAuthorizationToken().PHP_EOL; echo 'Expires At: '.$authorizationData->getExpiresAt()->format('Y-m-d H:i:s').PHP_EOL; echo 'Proxy Endpoint: '.$authorizationData->getProxyEndpoint().PHP_EOL; }

The source code to this page is found on GitHub.