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

********************
put_lifecycle_policy
********************



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

  

  Creates or updates the lifecycle policy for the specified repository. For more information, see `Lifecycle policy template <https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html>`__.

  

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


  **Request Syntax**
  ::

    response = client.put_lifecycle_policy(
        registryId='string',
        repositoryName='string',
        lifecyclePolicyText='string'
    )
    
  :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 lifecyclePolicyText: string
  :param lifecyclePolicyText: **[REQUIRED]** 

    The JSON repository policy text to apply to the repository.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'registryId': 'string',
          'repositoryName': 'string',
          'lifecyclePolicyText': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **registryId** *(string) --* 

        The registry ID associated with the request.

        
      

      - **repositoryName** *(string) --* 

        The repository name associated with the request.

        
      

      - **lifecyclePolicyText** *(string) --* 

        The JSON repository policy text.

        
  
  **Exceptions**
  
  *   :py:class:`ECR.Client.exceptions.ServerException`

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

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

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

  