Select your cookie preferences

We use cookies and similar tools to enhance your experience, provide our services, deliver relevant advertising, and make improvements. Approved third parties also use these tools to help us deliver advertising and provide certain site features.

set_repository_policy

set_repository_policy(**kwargs)

Applies a repository policy to the specified repository to control access permissions. For more information, see Amazon ECR Repository policies in the Amazon Elastic Container Registry User Guide .

See also: AWS API Documentation

Request Syntax

response = client.set_repository_policy(
    registryId='string',
    repositoryName='string',
    policyText='string',
    force=True|False
)
Parameters
  • registryId (string) -- 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.
  • repositoryName (string) --

    [REQUIRED]

    The name of the repository to receive the policy.

  • policyText (string) --

    [REQUIRED]

    The JSON repository policy text to apply to the repository. For more information, see Amazon ECR repository policies in the Amazon Elastic Container Registry User Guide .

  • force (boolean) -- If the policy you are attempting to set on a repository policy would prevent you from setting another policy in the future, you must force the SetRepositoryPolicy operation. This is intended to prevent accidental repository lock outs.
Return type

dict

Returns

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 applied to the repository.

Exceptions

  • ECR.Client.exceptions.ServerException
  • ECR.Client.exceptions.InvalidParameterException
  • ECR.Client.exceptions.RepositoryNotFoundException