Skip to content

list_jobs async

list_jobs(
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    status: Optional[JobStatus] = None,
    target_selection: Optional[TargetSelection] = None,
    max_results: Optional[LaserMaxResults] = None,
    next_token: Optional[NextToken] = None,
    thing_group_name: Optional[ThingGroupName] = None,
    thing_group_id: Optional[ThingGroupId] = None,
    namespace_id: Optional[NamespaceId] = None,
) -> ListJobsResponse

Lists jobs.

Requires permission to access the ListJobs action.

Parameters:

  • status (Optional[JobStatus], default: None ) –

    An optional filter that lets you search for jobs that have the specified status.

  • target_selection (Optional[TargetSelection], default: None ) –

    Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a thing when the thing is added to a target group, even after the job was completed by all things originally in the group.

    We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.

  • max_results (Optional[LaserMaxResults], default: None ) –

    The maximum number of results to return per request.

  • next_token (Optional[NextToken], default: None ) –

    The token to retrieve the next set of results.

  • thing_group_name (Optional[ThingGroupName], default: None ) –

    A filter that limits the returned jobs to those for the specified group.

  • thing_group_id (Optional[ThingGroupId], default: None ) –

    A filter that limits the returned jobs to those for the specified group.

  • namespace_id (Optional[NamespaceId], default: None ) –

    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/

    The namespaceId feature is only supported by IoT Greengrass at this time. For more information, see Setting up IoT Greengrass core devices.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def list_jobs(
    self,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    status: Optional["capo_iot.types.job_status.JobStatus"] = None,
    target_selection: Optional[
        "capo_iot.types.target_selection.TargetSelection"
    ] = None,
    max_results: Optional[
        "capo_iot.types.laser_max_results.LaserMaxResults"
    ] = None,
    next_token: Optional["capo_iot.types.next_token.NextToken"] = None,
    thing_group_name: Optional[
        "capo_iot.types.thing_group_name.ThingGroupName"
    ] = None,
    thing_group_id: Optional["capo_iot.types.thing_group_id.ThingGroupId"] = None,
    namespace_id: Optional["capo_iot.types.namespace_id.NamespaceId"] = None,
) -> "capo_iot.types.list_jobs_response.ListJobsResponse":
    """<p>Lists jobs.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListJobs</a> action.</p>

    Args:
        status: <p>An optional filter that lets you search for jobs that have the specified status.</p>
        target_selection: <p>Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a thing when the thing is added to a target group, even after the job was completed by all things originally in the group. </p> <note> <p>We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.</p> </note>
        max_results: <p>The maximum number of results to return per request.</p>
        next_token: <p>The token to retrieve the next set of results.</p>
        thing_group_name: <p>A filter that limits the returned jobs to those for the specified group.</p>
        thing_group_id: <p>A filter that limits the returned jobs to those for the specified group.</p>
        namespace_id: <p>The namespace used to indicate that a job is a customer-managed job.</p> <p>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.</p> <p> <code>$aws/things/<i>THING_NAME</i>/jobs/<i>JOB_ID</i>/notify-namespace-<i>NAMESPACE_ID</i>/</code> </p> <note> <p>The <code>namespaceId</code> feature is only supported by IoT Greengrass at this time. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/setting-up.html">Setting up IoT Greengrass core devices.</a> </p> </note>

    Raises:
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.list_jobs_request.ListJobsRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.list_jobs_response.ListJobsResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_jobs

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.list_jobs.async_list_jobs(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListJobs")
    )
    input_: capo_iot.types.list_jobs_request.ListJobsRequest = {}
    if status is not None:
        input_["status"] = status
    if target_selection is not None:
        input_["target_selection"] = target_selection
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if thing_group_name is not None:
        input_["thing_group_name"] = thing_group_name
    if thing_group_id is not None:
        input_["thing_group_id"] = thing_group_id
    if namespace_id is not None:
        input_["namespace_id"] = namespace_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output