get_repository_policy
(**kwargs)¶Retrieves the repository policy for the specified repository.
See also: AWS API Documentation
Request Syntax
response = client.get_repository_policy(
registryId='string',
repositoryName='string'
)
[REQUIRED]
The name of the repository with the policy to retrieve.
dict
Response Syntax
{
'registryId': 'string',
'repositoryName': 'string',
'policyText': 'string'
}
Response Structure
(dict) --
registryId (string) --
The registry ID associated with the request.
repositoryName (string) --
The repository name associated with the request.
policyText (string) --
The JSON repository policy text associated with the repository.
Exceptions
ECR.Client.exceptions.ServerException
ECR.Client.exceptions.InvalidParameterException
ECR.Client.exceptions.RepositoryNotFoundException
ECR.Client.exceptions.RepositoryPolicyNotFoundException
Examples
This example obtains the repository policy for the repository named ubuntu.
response = client.get_repository_policy(
repositoryName='ubuntu',
)
print(response)
Expected Output:
{
'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': '012345678901',
'repositoryName': 'ubuntu',
'ResponseMetadata': {
'...': '...',
},
}