:doc:`IoT <../../iot>` / Client / list_thing_principals_v2

************************
list_thing_principals_v2
************************



.. py:method:: IoT.Client.list_thing_principals_v2(**kwargs)

  

  Lists the principals associated with the specified thing. A principal can be an X.509 certificate or an Amazon Cognito ID.

   

  Requires permission to access the `ListThingPrincipals <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/ListThingPrincipalsV2>`_  


  **Request Syntax**
  ::

    response = client.list_thing_principals_v2(
        nextToken='string',
        maxResults=123,
        thingName='string',
        thingPrincipalType='EXCLUSIVE_THING'|'NON_EXCLUSIVE_THING'
    )
    
  :type nextToken: string
  :param nextToken: 

    To retrieve the next set of results, the ``nextToken`` value from a previous response; otherwise **null** to receive the first set of results.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return in this operation.

    

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

    The name of the thing.

    

  
  :type thingPrincipalType: string
  :param thingPrincipalType: 

    The type of the relation you want to filter in the response. If no value is provided in this field, the response will list all principals, including both the ``EXCLUSIVE_THING`` and ``NON_EXCLUSIVE_THING`` attachment types.

     

    
    * ``EXCLUSIVE_THING`` - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.
    

     

    
    * ``NON_EXCLUSIVE_THING`` - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.
    

    

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

    
    ::

      {
          'thingPrincipalObjects': [
              {
                  'principal': 'string',
                  'thingPrincipalType': 'EXCLUSIVE_THING'|'NON_EXCLUSIVE_THING'
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **thingPrincipalObjects** *(list) --* 

        A list of ``thingPrincipalObject`` that represents the principal and the type of relation it has with the thing.

        
        

        - *(dict) --* 

          An object that represents the principal and the type of relation it has with the thing.

          
          

          - **principal** *(string) --* 

            The principal of the thing principal object.

            
          

          - **thingPrincipalType** *(string) --* 

            The type of the relation you want to specify when you attach a principal to a thing. The value defaults to ``NON_EXCLUSIVE_THING``.

             

            
            * ``EXCLUSIVE_THING`` - Attaches the specified principal to the specified thing, exclusively. The thing will be the only thing that’s attached to the principal.
            

             

            
            * ``NON_EXCLUSIVE_THING`` - Attaches the specified principal to the specified thing. Multiple things can be attached to the principal.
            

            
      
    
      

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

        The token to use to get the next set of results, or **null** if there are no additional results.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

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

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

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

  