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

*************
list_packages
*************



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

  

  Returns a list of `PackageSummary <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageSummary.html>`__ objects for packages in a repository that match the request parameters.

  

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


  **Request Syntax**
  ::

    response = client.list_packages(
        domain='string',
        domainOwner='string',
        repository='string',
        format='npm'|'pypi'|'maven'|'nuget'|'generic'|'ruby'|'swift'|'cargo',
        namespace='string',
        packagePrefix='string',
        maxResults=123,
        nextToken='string',
        publish='ALLOW'|'BLOCK',
        upstream='ALLOW'|'BLOCK'
    )
    
  :type domain: string
  :param domain: **[REQUIRED]** 

    The name of the domain that contains the repository that contains the requested packages.

    

  
  :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 requested packages.

    

  
  :type format: string
  :param format: 

    The format used to filter requested packages. Only packages from the provided format will be returned.

    

  
  :type namespace: string
  :param namespace: 

    The namespace prefix used to filter requested packages. Only packages with a namespace that starts with the provided string value are returned. Note that although this option is called ``--namespace`` and not ``--namespace-prefix``, it has prefix-matching behavior.

     

    Each package format uses namespace as follows:

     

    
    * 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 packagePrefix: string
  :param packagePrefix: 

    A prefix used to filter requested packages. Only packages with names that start with ``packagePrefix`` are returned.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return per page.

    

  
  :type nextToken: string
  :param nextToken: 

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

    

  
  :type publish: string
  :param publish: 

    The value of the ``Publish`` package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see `PackageOriginRestrictions <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html>`__.

    

  
  :type upstream: string
  :param upstream: 

    The value of the ``Upstream`` package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see `PackageOriginRestrictions <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html>`__.

    

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

    
    ::

      {
          'packages': [
              {
                  'format': 'npm'|'pypi'|'maven'|'nuget'|'generic'|'ruby'|'swift'|'cargo',
                  'namespace': 'string',
                  'package': 'string',
                  'originConfiguration': {
                      'restrictions': {
                          'publish': 'ALLOW'|'BLOCK',
                          'upstream': 'ALLOW'|'BLOCK'
                      }
                  }
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **packages** *(list) --* 

        The list of returned `PackageSummary <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageSummary.html>`__ objects.

        
        

        - *(dict) --* 

          Details about a package, including its format, namespace, and name.

          
          

          - **format** *(string) --* 

            The format of the package.

            
          

          - **namespace** *(string) --* 

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

             

            
            * 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.
            

            
          

          - **package** *(string) --* 

            The name of the package.

            
          

          - **originConfiguration** *(dict) --* 

            A `PackageOriginConfiguration <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginConfiguration.html>`__ object that contains a `PackageOriginRestrictions <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html>`__ object that contains information about the upstream and publish package origin restrictions.

            
            

            - **restrictions** *(dict) --* 

              A ``PackageOriginRestrictions`` object that contains information about the upstream and publish package origin configuration for the package.

              
              

              - **publish** *(string) --* 

                The package origin configuration that determines if new versions of the package can be published directly to the repository.

                
              

              - **upstream** *(string) --* 

                The package origin configuration that determines if new versions of the package can be added to the repository from an external connection or upstream source.

                
          
        
      
    
      

      - **nextToken** *(string) --* 

        If there are additional results, this is the token for the next set of results.

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

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

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

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

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

  