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

****************************
get_associated_package_group
****************************



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

  

  Returns the most closely associated package group to the specified package. This API does not require that the package exist in any repository in the domain. As such, ``GetAssociatedPackageGroup`` can be used to see which package group's origin configuration applies to a package before that package is in a repository. This can be helpful to check if public packages are blocked without ingesting them.

   

  For information package group association and matching, see `Package group definition syntax and matching behavior <https://docs.aws.amazon.com/codeartifact/latest/ug/package-group-definition-syntax-matching-behavior.html>`__ in the *CodeArtifact User Guide*.

  

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


  **Request Syntax**
  ::

    response = client.get_associated_package_group(
        domain='string',
        domainOwner='string',
        format='npm'|'pypi'|'maven'|'nuget'|'generic'|'ruby'|'swift'|'cargo',
        namespace='string',
        package='string'
    )
    
  :type domain: string
  :param domain: **[REQUIRED]** 

    The name of the domain that contains the package from which to get the associated package group.

    

  
  :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 format: string
  :param format: **[REQUIRED]** 

    The format of the package from which to get the associated package group.

    

  
  :type namespace: string
  :param namespace: 

    The namespace of the package from which to get the associated package group. The package component that specifies its namespace depends on its type. For example:

     

    .. note::

      

      The namespace is required when getting associated package groups from packages 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 package from which to get the associated package group.

    

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

    
    ::

      {
          'packageGroup': {
              'arn': 'string',
              'pattern': 'string',
              'domainName': 'string',
              'domainOwner': 'string',
              'createdTime': datetime(2015, 1, 1),
              'contactInfo': 'string',
              'description': 'string',
              'originConfiguration': {
                  'restrictions': {
                      'string': {
                          'mode': 'ALLOW'|'ALLOW_SPECIFIC_REPOSITORIES'|'BLOCK'|'INHERIT',
                          'effectiveMode': 'ALLOW'|'ALLOW_SPECIFIC_REPOSITORIES'|'BLOCK'|'INHERIT',
                          'inheritedFrom': {
                              'arn': 'string',
                              'pattern': 'string'
                          },
                          'repositoriesCount': 123
                      }
                  }
              },
              'parent': {
                  'arn': 'string',
                  'pattern': 'string'
              }
          },
          'associationType': 'STRONG'|'WEAK'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **packageGroup** *(dict) --* 

        The package group that is associated with the requested package.

        
        

        - **arn** *(string) --* 

          The ARN of the package group.

          
        

        - **pattern** *(string) --* 

          The pattern of the package group. The pattern determines which packages are associated with the package group.

          
        

        - **domainName** *(string) --* 

          The name of the domain that contains the package group.

          
        

        - **domainOwner** *(string) --* 

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

          
        

        - **createdTime** *(datetime) --* 

          A timestamp that represents the date and time the package group was created.

          
        

        - **contactInfo** *(string) --* 

          The contact information of the package group.

          
        

        - **description** *(string) --* 

          The description of the package group.

          
        

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

          The package group origin configuration that determines how package versions can enter repositories.

          
          

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

            The origin configuration settings that determine how package versions can enter repositories.

            
            

            - *(string) --* 
              

              - *(dict) --* 

                Contains information about the configured restrictions of the origin controls of a package group.

                
                

                - **mode** *(string) --* 

                  The package group origin restriction setting. If the value of ``mode`` is ``ALLOW``, ``ALLOW_SPECIFIC_REPOSITORIES``, or ``BLOCK``, then the value of ``effectiveMode`` is the same. Otherwise, when the value is ``INHERIT``, then the value of ``effectiveMode`` is the value of ``mode`` of the first parent group which does not have a value of ``INHERIT``.

                  
                

                - **effectiveMode** *(string) --* 

                  The effective package group origin restriction setting. If the value of ``mode`` is ``ALLOW``, ``ALLOW_SPECIFIC_REPOSITORIES``, or ``BLOCK``, then the value of ``effectiveMode`` is the same. Otherwise, when the value of ``mode`` is ``INHERIT``, then the value of ``effectiveMode`` is the value of ``mode`` of the first parent group which does not have a value of ``INHERIT``.

                  
                

                - **inheritedFrom** *(dict) --* 

                  The parent package group that the package group origin restrictions are inherited from.

                  
                  

                  - **arn** *(string) --* 

                    The ARN of the package group.

                    
                  

                  - **pattern** *(string) --* 

                    The pattern of the package group. The pattern determines which packages are associated with the package group, and is also the identifier of the package group.

                    
              
                

                - **repositoriesCount** *(integer) --* 

                  The number of repositories in the allowed repository list.

                  
            
        
      
      
        

        - **parent** *(dict) --* 

          The direct parent package group of the package group.

          
          

          - **arn** *(string) --* 

            The ARN of the package group.

            
          

          - **pattern** *(string) --* 

            The pattern of the package group. The pattern determines which packages are associated with the package group, and is also the identifier of the package group.

            
      
    
      

      - **associationType** *(string) --* 

        Describes the strength of the association between the package and package group. A strong match is also known as an exact match, and a weak match is known as a relative match.

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

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

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

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

  