:doc:`ECRPublic <../../ecr-public>` / Client / batch_delete_image

******************
batch_delete_image
******************



.. py:method:: ECRPublic.Client.batch_delete_image(**kwargs)

  

  Deletes a list of specified images that are within a repository in a public registry. Images are specified with either an ``imageTag`` or ``imageDigest``.

   

  You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository.

   

  You can completely delete an image (and all of its tags) by specifying the digest of the image in your request.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ecr-public-2020-10-30/BatchDeleteImage>`_  


  **Request Syntax**
  ::

    response = client.batch_delete_image(
        registryId='string',
        repositoryName='string',
        imageIds=[
            {
                'imageDigest': 'string',
                'imageTag': 'string'
            },
        ]
    )
    
  :type registryId: string
  :param registryId: 

    The Amazon Web Services account ID, or registry alias, that's associated with the registry that contains the image to delete. If you do not specify a registry, the default public registry is assumed.

    

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

    The repository in a public registry that contains the image to delete.

    

  
  :type imageIds: list
  :param imageIds: **[REQUIRED]** 

    A list of image ID references that correspond to images to delete. The format of the ``imageIds`` reference is ``imageTag=tag`` or ``imageDigest=digest``.

    

  
    - *(dict) --* 

      An object with identifying information for an Amazon ECR image.

      

    
      - **imageDigest** *(string) --* 

        The ``sha256`` digest of the image manifest.

        

      
      - **imageTag** *(string) --* 

        The tag that's used for the image.

        

      
    

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

    
    ::

      {
          'imageIds': [
              {
                  'imageDigest': 'string',
                  'imageTag': 'string'
              },
          ],
          'failures': [
              {
                  'imageId': {
                      'imageDigest': 'string',
                      'imageTag': 'string'
                  },
                  'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag'|'ImageReferencedByManifestList'|'KmsError',
                  'failureReason': 'string'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **imageIds** *(list) --* 

        The image IDs of the deleted images.

        
        

        - *(dict) --* 

          An object with identifying information for an Amazon ECR image.

          
          

          - **imageDigest** *(string) --* 

            The ``sha256`` digest of the image manifest.

            
          

          - **imageTag** *(string) --* 

            The tag that's used for the image.

            
      
    
      

      - **failures** *(list) --* 

        Any failures associated with the call.

        
        

        - *(dict) --* 

          An object that represents an Amazon ECR image failure.

          
          

          - **imageId** *(dict) --* 

            The image ID that's associated with the failure.

            
            

            - **imageDigest** *(string) --* 

              The ``sha256`` digest of the image manifest.

              
            

            - **imageTag** *(string) --* 

              The tag that's used for the image.

              
        
          

          - **failureCode** *(string) --* 

            The code that's associated with the failure.

            
          

          - **failureReason** *(string) --* 

            The reason for the failure.

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

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

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

  
  *   :py:class:`ECRPublic.Client.exceptions.UnsupportedCommandException`

  