Class AmazonECRClient
- java.lang.Object
-
- com.amazonaws.AmazonWebServiceClient
-
- com.amazonaws.services.ecr.AmazonECRClient
-
- All Implemented Interfaces:
AmazonECR
- Direct Known Subclasses:
AmazonECRAsyncClient
@ThreadSafe public class AmazonECRClient extends AmazonWebServiceClient implements AmazonECR
Client for accessing Amazon ECR. All service calls made using this client are blocking, and will not return until the service call completes.Amazon EC2 Container Registry (Amazon ECR) is a managed AWS Docker registry service. Customers can use the familiar Docker CLI to push, pull, and manage images. Amazon ECR provides a secure, scalable, and reliable registry. Amazon ECR supports private Docker repositories with resource-based permissions using AWS IAM so that specific users or Amazon EC2 instances can access repositories and images. Developers can use the Docker CLI to author and manage images.
-
-
Field Summary
Fields Modifier and Type Field Description protected static ClientConfigurationFactory
configFactory
Client configuration factory providing ClientConfigurations tailored to this client-
Fields inherited from class com.amazonaws.AmazonWebServiceClient
client, clientConfiguration, endpoint, LOGGING_AWS_REQUEST_METRIC, requestHandler2s, timeOffset
-
-
Constructor Summary
Constructors Constructor Description AmazonECRClient()
Constructs a new client to invoke service methods on Amazon ECR.AmazonECRClient(AWSCredentials awsCredentials)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials.AmazonECRClient(AWSCredentialsProvider awsCredentialsProvider)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials provider.AmazonECRClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials provider and client configuration options.AmazonECRClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials provider, client configuration options, and request metric collector.AmazonECRClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials and client configuration options.AmazonECRClient(ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on Amazon ECR.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchCheckLayerAvailabilityResult
batchCheckLayerAvailability(BatchCheckLayerAvailabilityRequest batchCheckLayerAvailabilityRequest)
Check the availability of multiple image layers in a specified registry and repository.BatchDeleteImageResult
batchDeleteImage(BatchDeleteImageRequest batchDeleteImageRequest)
Deletes a list of specified images within a specified repository.BatchGetImageResult
batchGetImage(BatchGetImageRequest batchGetImageRequest)
Gets detailed information for specified images within a specified repository.CompleteLayerUploadResult
completeLayerUpload(CompleteLayerUploadRequest completeLayerUploadRequest)
Inform Amazon ECR that the image layer upload for a specified registry, repository name, and upload ID, has completed.CreateRepositoryResult
createRepository(CreateRepositoryRequest createRepositoryRequest)
Creates an image repository.DeleteRepositoryResult
deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest)
Deletes an existing image repository.DeleteRepositoryPolicyResult
deleteRepositoryPolicy(DeleteRepositoryPolicyRequest deleteRepositoryPolicyRequest)
Deletes the repository policy from a specified repository.DescribeRepositoriesResult
describeRepositories(DescribeRepositoriesRequest describeRepositoriesRequest)
Describes image repositories in a registry.GetAuthorizationTokenResult
getAuthorizationToken(GetAuthorizationTokenRequest getAuthorizationTokenRequest)
Retrieves a token that is valid for a specified registry for 12 hours.ResponseMetadata
getCachedResponseMetadata(AmazonWebServiceRequest request)
Returns additional metadata for a previously executed successful, request, typically used for debugging issues where a service isn't acting as expected.GetDownloadUrlForLayerResult
getDownloadUrlForLayer(GetDownloadUrlForLayerRequest getDownloadUrlForLayerRequest)
Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer.GetRepositoryPolicyResult
getRepositoryPolicy(GetRepositoryPolicyRequest getRepositoryPolicyRequest)
Retrieves the repository policy for a specified repository.InitiateLayerUploadResult
initiateLayerUpload(InitiateLayerUploadRequest initiateLayerUploadRequest)
Notify Amazon ECR that you intend to upload an image layer.ListImagesResult
listImages(ListImagesRequest listImagesRequest)
Lists all the image IDs for a given repository.PutImageResult
putImage(PutImageRequest putImageRequest)
Creates or updates the image manifest associated with an image.SetRepositoryPolicyResult
setRepositoryPolicy(SetRepositoryPolicyRequest setRepositoryPolicyRequest)
Applies a repository policy on a specified repository to control access permissions.UploadLayerPartResult
uploadLayerPart(UploadLayerPartRequest uploadLayerPartRequest)
Uploads an image layer part to Amazon ECR.-
Methods inherited from class com.amazonaws.AmazonWebServiceClient
addRequestHandler, addRequestHandler, beforeMarshalling, configureRegion, createExecutionContext, createExecutionContext, createExecutionContext, endClientExecution, endClientExecution, findRequestMetricCollector, getEndpointPrefix, getRequestMetricsCollector, getServiceAbbreviation, getServiceName, getServiceNameIntern, getSigner, getSignerByURI, getSignerRegionOverride, getTimeOffset, isProfilingEnabled, isRequestMetricsEnabled, removeRequestHandler, removeRequestHandler, requestMetricCollector, setEndpoint, setEndpointPrefix, setRegion, setServiceNameIntern, setSignerRegionOverride, setTimeOffset, shutdown, withEndpoint, withRegion, withRegion, withTimeOffset
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.amazonaws.services.ecr.AmazonECR
setEndpoint, setRegion, shutdown
-
-
-
-
Field Detail
-
configFactory
protected static final ClientConfigurationFactory configFactory
Client configuration factory providing ClientConfigurations tailored to this client
-
-
Constructor Detail
-
AmazonECRClient
public AmazonECRClient()
Constructs a new client to invoke service methods on Amazon ECR. A credentials provider chain will be used that searches for credentials in this order:- Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
- Java System Properties - aws.accessKeyId and aws.secretKey
- Instance profile credentials delivered through the Amazon EC2 metadata service
All service calls made using this new client object are blocking, and will not return until the service call completes.
- See Also:
DefaultAWSCredentialsProviderChain
-
AmazonECRClient
public AmazonECRClient(ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on Amazon ECR. A credentials provider chain will be used that searches for credentials in this order:- Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
- Java System Properties - aws.accessKeyId and aws.secretKey
- Instance profile credentials delivered through the Amazon EC2 metadata service
All service calls made using this new client object are blocking, and will not return until the service call completes.
- Parameters:
clientConfiguration
- The client configuration options controlling how this client connects to Amazon ECR (ex: proxy settings, retry counts, etc.).- See Also:
DefaultAWSCredentialsProviderChain
-
AmazonECRClient
public AmazonECRClient(AWSCredentials awsCredentials)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials.All service calls made using this new client object are blocking, and will not return until the service call completes.
- Parameters:
awsCredentials
- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
-
AmazonECRClient
public AmazonECRClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials and client configuration options.All service calls made using this new client object are blocking, and will not return until the service call completes.
- Parameters:
awsCredentials
- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.clientConfiguration
- The client configuration options controlling how this client connects to Amazon ECR (ex: proxy settings, retry counts, etc.).
-
AmazonECRClient
public AmazonECRClient(AWSCredentialsProvider awsCredentialsProvider)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials provider.All service calls made using this new client object are blocking, and will not return until the service call completes.
- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
-
AmazonECRClient
public AmazonECRClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials provider and client configuration options.All service calls made using this new client object are blocking, and will not return until the service call completes.
- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.clientConfiguration
- The client configuration options controlling how this client connects to Amazon ECR (ex: proxy settings, retry counts, etc.).
-
AmazonECRClient
public AmazonECRClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector)
Constructs a new client to invoke service methods on Amazon ECR using the specified AWS account credentials provider, client configuration options, and request metric collector.All service calls made using this new client object are blocking, and will not return until the service call completes.
- Parameters:
awsCredentialsProvider
- The AWS credentials provider which will provide credentials to authenticate requests with AWS services.clientConfiguration
- The client configuration options controlling how this client connects to Amazon ECR (ex: proxy settings, retry counts, etc.).requestMetricCollector
- optional request metric collector
-
-
Method Detail
-
batchCheckLayerAvailability
public BatchCheckLayerAvailabilityResult batchCheckLayerAvailability(BatchCheckLayerAvailabilityRequest batchCheckLayerAvailabilityRequest)
Check the availability of multiple image layers in a specified registry and repository.
This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers. Use the
docker
CLI to pull, tag, and push images.- Specified by:
batchCheckLayerAvailability
in interfaceAmazonECR
- Parameters:
batchCheckLayerAvailabilityRequest
-- Returns:
- Result of the BatchCheckLayerAvailability operation returned by the service.
- Throws:
RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.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.
-
batchDeleteImage
public BatchDeleteImageResult batchDeleteImage(BatchDeleteImageRequest batchDeleteImageRequest)
Deletes a list of specified images within a specified repository. Images are specified with either
imageTag
orimageDigest
.- Specified by:
batchDeleteImage
in interfaceAmazonECR
- Parameters:
batchDeleteImageRequest
- Deletes specified images within a specified repository. Images are specified with either theimageTag
orimageDigest
.- Returns:
- Result of the BatchDeleteImage operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
batchGetImage
public BatchGetImageResult batchGetImage(BatchGetImageRequest batchGetImageRequest)
Gets detailed information for specified images within a specified repository. Images are specified with either
imageTag
orimageDigest
.- Specified by:
batchGetImage
in interfaceAmazonECR
- Parameters:
batchGetImageRequest
-- Returns:
- Result of the BatchGetImage operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
completeLayerUpload
public CompleteLayerUploadResult completeLayerUpload(CompleteLayerUploadRequest completeLayerUploadRequest)
Inform Amazon ECR that the image layer upload for a specified registry, repository name, and upload ID, has completed. You can optionally provide a
sha256
digest of the image layer for data validation purposes.This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers. Use the
docker
CLI to pull, tag, and push images.- Specified by:
completeLayerUpload
in interfaceAmazonECR
- Parameters:
completeLayerUploadRequest
-- Returns:
- Result of the CompleteLayerUpload operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.UploadNotFoundException
- The upload could not be found, or the specified upload id is not valid for this repository.InvalidLayerException
- The layer digest calculation performed by Amazon ECR upon receipt of the image layer does not match the digest specified.LayerPartTooSmallException
- Layer parts must be at least 5 MiB in size.LayerAlreadyExistsException
- The image layer already exists in the associated repository.EmptyUploadException
- The specified layer upload does not contain any layer parts.
-
createRepository
public CreateRepositoryResult createRepository(CreateRepositoryRequest createRepositoryRequest)
Creates an image repository.
- Specified by:
createRepository
in interfaceAmazonECR
- Parameters:
createRepositoryRequest
-- Returns:
- Result of the CreateRepository operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryAlreadyExistsException
- The specified repository already exists in the specified registry.LimitExceededException
- The operation did not succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR Default Service Limits in the Amazon EC2 Container Registry User Guide.
-
deleteRepository
public DeleteRepositoryResult deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest)
Deletes an existing image repository. If a repository contains images, you must use the
force
option to delete it.- Specified by:
deleteRepository
in interfaceAmazonECR
- Parameters:
deleteRepositoryRequest
-- Returns:
- Result of the DeleteRepository operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.RepositoryNotEmptyException
- The specified repository contains images. To delete a repository that contains images, you must force the deletion with theforce
parameter.
-
deleteRepositoryPolicy
public DeleteRepositoryPolicyResult deleteRepositoryPolicy(DeleteRepositoryPolicyRequest deleteRepositoryPolicyRequest)
Deletes the repository policy from a specified repository.
- Specified by:
deleteRepositoryPolicy
in interfaceAmazonECR
- Parameters:
deleteRepositoryPolicyRequest
-- Returns:
- Result of the DeleteRepositoryPolicy operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.RepositoryPolicyNotFoundException
- The specified repository and registry combination does not have an associated repository policy.
-
describeRepositories
public DescribeRepositoriesResult describeRepositories(DescribeRepositoriesRequest describeRepositoriesRequest)
Describes image repositories in a registry.
- Specified by:
describeRepositories
in interfaceAmazonECR
- Parameters:
describeRepositoriesRequest
-- Returns:
- Result of the DescribeRepositories operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
getAuthorizationToken
public GetAuthorizationTokenResult getAuthorizationToken(GetAuthorizationTokenRequest getAuthorizationTokenRequest)
Retrieves a token that is valid for a specified registry for 12 hours. This command allows you to use the
docker
CLI to push and pull images with Amazon ECR. If you do not specify a registry, the default registry is assumed.The
authorizationToken
returned for each registry specified is a base64 encoded string that can be decoded and used in adocker login
command to authenticate to a registry. The AWS CLI offers anaws ecr get-login
command that simplifies the login process.- Specified by:
getAuthorizationToken
in interfaceAmazonECR
- Parameters:
getAuthorizationTokenRequest
-- Returns:
- Result of the GetAuthorizationToken operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.
-
getDownloadUrlForLayer
public GetDownloadUrlForLayerResult getDownloadUrlForLayer(GetDownloadUrlForLayerRequest getDownloadUrlForLayerRequest)
Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image.
This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers. Use the
docker
CLI to pull, tag, and push images.- Specified by:
getDownloadUrlForLayer
in interfaceAmazonECR
- Parameters:
getDownloadUrlForLayerRequest
-- Returns:
- Result of the GetDownloadUrlForLayer operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.LayersNotFoundException
- The specified layers could not be found, or the specified layer is not valid for this repository.LayerInaccessibleException
- The specified layer is not available because it is not associated with an image. Unassociated image layers may be cleaned up at any time.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
getRepositoryPolicy
public GetRepositoryPolicyResult getRepositoryPolicy(GetRepositoryPolicyRequest getRepositoryPolicyRequest)
Retrieves the repository policy for a specified repository.
- Specified by:
getRepositoryPolicy
in interfaceAmazonECR
- Parameters:
getRepositoryPolicyRequest
-- Returns:
- Result of the GetRepositoryPolicy operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.RepositoryPolicyNotFoundException
- The specified repository and registry combination does not have an associated repository policy.
-
initiateLayerUpload
public InitiateLayerUploadResult initiateLayerUpload(InitiateLayerUploadRequest initiateLayerUploadRequest)
Notify Amazon ECR that you intend to upload an image layer.
This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers. Use the
docker
CLI to pull, tag, and push images.- Specified by:
initiateLayerUpload
in interfaceAmazonECR
- Parameters:
initiateLayerUploadRequest
-- Returns:
- Result of the InitiateLayerUpload operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
listImages
public ListImagesResult listImages(ListImagesRequest listImagesRequest)
Lists all the image IDs for a given repository.
- Specified by:
listImages
in interfaceAmazonECR
- Parameters:
listImagesRequest
-- Returns:
- Result of the ListImages operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
putImage
public PutImageResult putImage(PutImageRequest putImageRequest)
Creates or updates the image manifest associated with an image.
This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers. Use the
docker
CLI to pull, tag, and push images.- Specified by:
putImage
in interfaceAmazonECR
- Parameters:
putImageRequest
-- Returns:
- Result of the PutImage operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.ImageAlreadyExistsException
- The specified image has already been pushed, and there are no changes to the manifest or image tag since the last push.LayersNotFoundException
- The specified layers could not be found, or the specified layer is not valid for this repository.LimitExceededException
- The operation did not succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR Default Service Limits in the Amazon EC2 Container Registry User Guide.
-
setRepositoryPolicy
public SetRepositoryPolicyResult setRepositoryPolicy(SetRepositoryPolicyRequest setRepositoryPolicyRequest)
Applies a repository policy on a specified repository to control access permissions.
- Specified by:
setRepositoryPolicy
in interfaceAmazonECR
- Parameters:
setRepositoryPolicyRequest
-- Returns:
- Result of the SetRepositoryPolicy operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.
-
uploadLayerPart
public UploadLayerPartResult uploadLayerPart(UploadLayerPartRequest uploadLayerPartRequest)
Uploads an image layer part to Amazon ECR.
This operation is used by the Amazon ECR proxy, and it is not intended for general use by customers. Use the
docker
CLI to pull, tag, and push images.- Specified by:
uploadLayerPart
in interfaceAmazonECR
- Parameters:
uploadLayerPartRequest
-- Returns:
- Result of the UploadLayerPart operation returned by the service.
- Throws:
ServerException
- These errors are usually caused by a server-side issue.InvalidParameterException
- The specified parameter is invalid. Review the available parameters for the API request.InvalidLayerPartException
- The layer part size is not valid, or the first byte specified is not consecutive to the last byte of a previous layer part upload.RepositoryNotFoundException
- The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.UploadNotFoundException
- The upload could not be found, or the specified upload id is not valid for this repository.LimitExceededException
- The operation did not succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR Default Service Limits in the Amazon EC2 Container Registry User Guide.
-
getCachedResponseMetadata
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request)
Returns additional metadata for a previously executed successful, request, typically used for debugging issues where a service isn't acting as expected. This data isn't considered part of the result data returned by an operation, so it's available through this separate, diagnostic interface.Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic information for an executed request, you should use this method to retrieve it as soon as possible after executing the request.
- Specified by:
getCachedResponseMetadata
in interfaceAmazonECR
- Parameters:
request
- The originally executed request- Returns:
- The response metadata for the specified request, or null if none is available.
-
-