v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1441293181.2 KB

Retrieves the repository policy for the specified repository.

post/#X-Amz-Target=AmazonEC2ContainerRegistry_V20150921.GetRepositoryPolicy

Headers

X-Amz-Target'AmazonEC2ContainerRegistry_V20150921.GetRepositoryPolicy' required

Request body

registryIdstring

The Amazon Web Services account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.

repositoryNamestring required

The name of the repository with the policy to retrieve.

Response

Success

registryIdstring

The registry ID associated with the request.

repositoryNamestring

The repository name associated with the request.

policyTextstring

The JSON repository policy text associated with the repository.

Example response

{
  "policyText": "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"new statement\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : {\n     \"AWS\" : \"arn:aws:iam::012345678901:role/CodeDeployDemo\"\n    },\n\"Action\" : [ \"ecr:GetDownloadUrlForLayer\", \"ecr:BatchGetImage\", \"ecr:BatchCheckLayerAvailability\" ]\n } ]\n}",
  "registryId": 12345678901,
  "repositoryName": "ubuntu"
}