:doc:`CodeArtifact <../../codeartifact>` / Client / dispose_package_versions

************************
dispose_package_versions
************************



.. py:method:: CodeArtifact.Client.dispose_package_versions(**kwargs)

  

  Deletes the assets in package versions and sets the package versions' status to ``Disposed``. A disposed package version cannot be restored in your repository because its assets are deleted.

   

  To view all disposed package versions in a repository, use `ListPackageVersions <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListPackageVersions.html>`__ and set the `status <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListPackageVersions.html#API_ListPackageVersions_RequestSyntax>`__ parameter to ``Disposed``.

   

  To view information about a disposed package version, use `DescribePackageVersion <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DescribePackageVersion.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/codeartifact-2018-09-22/DisposePackageVersions>`_  


  **Request Syntax**
  ::

    response = client.dispose_package_versions(
        domain='string',
        domainOwner='string',
        repository='string',
        format='npm'|'pypi'|'maven'|'nuget'|'generic'|'ruby'|'swift'|'cargo',
        namespace='string',
        package='string',
        versions=[
            'string',
        ],
        versionRevisions={
            'string': 'string'
        },
        expectedStatus='Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted'
    )
    
  :type domain: string
  :param domain: **[REQUIRED]** 

    The name of the domain that contains the repository you want to dispose.

    

  
  :type domainOwner: string
  :param domainOwner: 

    The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

    

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

    The name of the repository that contains the package versions you want to dispose.

    

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

    A format that specifies the type of package versions you want to dispose.

    

  
  :type namespace: string
  :param namespace: 

    The namespace of the package versions to be disposed. The package component that specifies its namespace depends on its type. For example:

     

    .. note::

      

      The namespace is required when disposing package versions of the following formats:

       

      
      * Maven
       
      * Swift
       
      * generic
      

      

     

    
    * The namespace of a Maven package version is its ``groupId``.
     
    * The namespace of an npm or Swift package version is its ``scope``.
     
    * The namespace of a generic package is its ``namespace``.
     
    * Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.
    

    

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

    The name of the package with the versions you want to dispose.

    

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

    The versions of the package you want to dispose.

    

  
    - *(string) --* 

    

  :type versionRevisions: dict
  :param versionRevisions: 

    The revisions of the package versions you want to dispose.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  :type expectedStatus: string
  :param expectedStatus: 

    The expected status of the package version to dispose.

    

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

    
    ::

      {
          'successfulVersions': {
              'string': {
                  'revision': 'string',
                  'status': 'Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted'
              }
          },
          'failedVersions': {
              'string': {
                  'errorCode': 'ALREADY_EXISTS'|'MISMATCHED_REVISION'|'MISMATCHED_STATUS'|'NOT_ALLOWED'|'NOT_FOUND'|'SKIPPED',
                  'errorMessage': 'string'
              }
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **successfulVersions** *(dict) --* 

        A list of the package versions that were successfully disposed.

        
        

        - *(string) --* 
          

          - *(dict) --* 

            Contains the revision and status of a package version.

            
            

            - **revision** *(string) --* 

              The revision of a package version.

              
            

            - **status** *(string) --* 

              The status of a package version.

              
        
    
  
      

      - **failedVersions** *(dict) --* 

        A ``PackageVersionError`` object that contains a map of errors codes for the disposed package versions that failed. The possible error codes are:

         

        
        * ``ALREADY_EXISTS``
         
        * ``MISMATCHED_REVISION``
         
        * ``MISMATCHED_STATUS``
         
        * ``NOT_ALLOWED``
         
        * ``NOT_FOUND``
         
        * ``SKIPPED``
        

        
        

        - *(string) --* 
          

          - *(dict) --* 

            l An error associated with package.

            
            

            - **errorCode** *(string) --* 

              The error code associated with the error. Valid error codes are:

               

              
              * ``ALREADY_EXISTS``
               
              * ``MISMATCHED_REVISION``
               
              * ``MISMATCHED_STATUS``
               
              * ``NOT_ALLOWED``
               
              * ``NOT_FOUND``
               
              * ``SKIPPED``
              

              
            

            - **errorMessage** *(string) --* 

              The error message associated with the error.

              
        
    
  
  
  **Exceptions**
  
  *   :py:class:`CodeArtifact.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.ConflictException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.InternalServerException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`CodeArtifact.Client.exceptions.ThrottlingException`

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

  