:doc:`ECR <../../ecr>` / Client / set_repository_policy

*********************
set_repository_policy
*********************



.. py:method:: ECR.Client.set_repository_policy(**kwargs)

  

  Applies a repository policy to the specified repository to control access permissions. For more information, see `Amazon ECR Repository policies <https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html>`__ in the *Amazon Elastic Container Registry User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/SetRepositoryPolicy>`_  


  **Request Syntax**
  ::

    response = client.set_repository_policy(
        registryId='string',
        repositoryName='string',
        policyText='string',
        force=True|False
    )
    
  :type registryId: string
  :param registryId: 

    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.

    

  
  :type repositoryName: string
  :param repositoryName: **[REQUIRED]** 

    The name of the repository to receive the policy.

    

  
  :type policyText: string
  :param policyText: **[REQUIRED]** 

    The JSON repository policy text to apply to the repository. For more information, see `Amazon ECR repository policies <https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html>`__ in the *Amazon Elastic Container Registry User Guide*.

    

  
  :type force: boolean
  :param force: 

    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.

    

  
  
  :rtype: 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**
  
  *   :py:class:`ECR.Client.exceptions.ServerException`

  
  *   :py:class:`ECR.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`ECR.Client.exceptions.RepositoryNotFoundException`

  