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

**************************
associate_targets_with_job
**************************



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

  

  Associates a group with a continuous job. The following criteria must be met:

   

  
  * The job must have been created with the ``targetSelection`` field set to "CONTINUOUS".
   
  * The job status must currently be "IN_PROGRESS".
   
  * The total number of targets associated with a job must not exceed 100.
  

   

  Requires permission to access the `AssociateTargetsWithJob <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/AssociateTargetsWithJob>`_  


  **Request Syntax**
  ::

    response = client.associate_targets_with_job(
        targets=[
            'string',
        ],
        jobId='string',
        comment='string',
        namespaceId='string'
    )
    
  :type targets: list
  :param targets: **[REQUIRED]** 

    A list of thing group ARNs that define the targets of the job.

    

  
    - *(string) --* 

    

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

    The unique identifier you assigned to this job when it was created.

    

  
  :type comment: string
  :param comment: 

    An optional comment string describing why the job was associated with the targets.

    

  
  :type namespaceId: string
  :param namespaceId: 

    The namespace used to indicate that a job is a customer-managed job.

     

    When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.

     

    ``$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/``

     

    .. note::

      

      The ``namespaceId`` feature is only supported by IoT Greengrass at this time. For more information, see `Setting up IoT Greengrass core devices. <https://docs.aws.amazon.com/greengrass/v2/developerguide/setting-up.html>`__

      

    

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

    
    ::

      {
          'jobArn': 'string',
          'jobId': 'string',
          'description': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **jobArn** *(string) --* 

        An ARN identifying the job.

        
      

      - **jobId** *(string) --* 

        The unique identifier you assigned to this job when it was created.

        
      

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

        A short text description of the job.

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

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

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

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

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

  