set_repository_policy

ECRPublic.Client.set_repository_policy(**kwargs)

Applies a repository policy to the specified public 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 that's associated with the registry that contains the repository. If you do not specify a registry, the default public 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 that you want to set on a repository policy would prevent you from setting another policy in the future, you must force the SetRepositoryPolicy operation. This prevents accidental repository lockouts.
Return type

dict

Returns

Response Syntax

{
    'registryId': 'string',
    'repositoryName': 'string',
    'policyText': 'string'
}

Response Structure

  • (dict) --

    • registryId (string) --

      The registry ID that's associated with the request.

    • repositoryName (string) --

      The repository name that's associated with the request.

    • policyText (string) --

      The JSON repository policy text that's applied to the repository.

Exceptions

  • ECRPublic.Client.exceptions.ServerException
  • ECRPublic.Client.exceptions.InvalidParameterException
  • ECRPublic.Client.exceptions.RepositoryNotFoundException
  • ECRPublic.Client.exceptions.UnsupportedCommandException