IoTHubJobManager Class

A class to provide convenience APIs for IoTHub Job Manager operations, based on top of the auto generated IotHub REST APIs

Initializer for a Job Manager Service client.

After a successful creation the class has been authenticated with IoTHub and it is ready to call the member APIs to communicate with IoTHub.

Inheritance
builtins.object
IoTHubJobManager

Constructor

IoTHubJobManager(connection_string=None, host=None, auth=None)

Parameters

Name Description
connection_string
str

The IoTHub connection string used to authenticate connection with IoTHub if we are using connection_str authentication. Default value: None

Default value: None
host
str

The Azure service url if we are using token credential authentication. Default value: None

Default value: None
auth
str

The Azure authentication object if we are using token credential authentication. Default value: None

Default value: None

Methods

cancel_import_export_job

Cancels an import/export job on an IoT hub.

cancel_scheduled_job

Cancels a scheduled job on an IoT hub.

create_import_export_job

Creates a new import/export job on an IoT hub.

create_scheduled_job

Creates a new job to schedule update twins or device direct methods on an IoT hub.

from_connection_string

Classmethod initializer for a IoTHubJobManager Service client. Creates IoTHubJobManager class from connection string.

After a successful creation the class has been authenticated with IoTHub and it is ready to call the member APIs to communicate with IoTHub.

from_token_credential

Classmethod initializer for a IoTHubJobManager Service client. Creates IoTHubJobManager class from host name url and Azure token credential.

After a successful creation the class has been authenticated with IoTHub and it is ready to call the member APIs to communicate with IoTHub.

get_import_export_job

Retrieves the status of an import/export job on an IoTHub.

get_import_export_jobs

Retrieves the status of all import/export jobs on an IoTHub.

get_scheduled_job

Retrieves the details of a scheduled job on an IoTHub.

query_scheduled_jobs

Query an IoT hub to retrieve information regarding jobs using the IoT Hub query language.

cancel_import_export_job

Cancels an import/export job on an IoT hub.

cancel_import_export_job(job_id)

Parameters

Name Description
job_id
Required
str

The ID of the job.

Returns

Type Description

Object.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

cancel_scheduled_job

Cancels a scheduled job on an IoT hub.

cancel_scheduled_job(job_id)

Parameters

Name Description
job_id
Required
str

The ID of the job.

Returns

Type Description
<xref:azure.iot.hub.models.JobResponse>

JobResponse object containing the cancelled job.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

create_import_export_job

Creates a new import/export job on an IoT hub.

create_import_export_job(job_properties)

Parameters

Name Description
job_properties
Required
<xref:azure.iot.hub.models.JobProperties>

Specifies the job specification.

Returns

Type Description
<xref:azure.iot.hub.models.JobProperties>

JobProperties object containing the created job.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

create_scheduled_job

Creates a new job to schedule update twins or device direct methods on an IoT hub.

create_scheduled_job(job_id, job_request)

Parameters

Name Description
job_id
Required
str

The ID of the job.

job_request
Required
<xref:azure.iot.hub.models.JobRequest>

Specifies the job.

Returns

Type Description
<xref:azure.iot.hub.models.JobResponse>

JobResponse object containing the created job.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

from_connection_string

Classmethod initializer for a IoTHubJobManager Service client. Creates IoTHubJobManager class from connection string.

After a successful creation the class has been authenticated with IoTHub and it is ready to call the member APIs to communicate with IoTHub.

from_connection_string(connection_string)

Parameters

Name Description
connection_string
Required
str

The IoTHub connection string used to authenticate connection with IoTHub.

Returns

Type Description

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

from_token_credential

Classmethod initializer for a IoTHubJobManager Service client. Creates IoTHubJobManager class from host name url and Azure token credential.

After a successful creation the class has been authenticated with IoTHub and it is ready to call the member APIs to communicate with IoTHub.

from_token_credential(url, token_credential)

Parameters

Name Description
url
Required
str

The Azure service url (host name).

token_credential
Required
<xref:azure.core.TokenCredential>

The Azure token credential object

Returns

Type Description

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

get_import_export_job

Retrieves the status of an import/export job on an IoTHub.

get_import_export_job(job_id)

Parameters

Name Description
job_id
Required
str

The ID of the job.

Returns

Type Description
<xref:azure.iot.hub.models.JobProperties>

The JobProperties object containing the requested job.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

get_import_export_jobs

Retrieves the status of all import/export jobs on an IoTHub.

get_import_export_jobs()

Returns

Type Description
list[<xref:azure.iot.hub.models.JobProperties>]

The list[job_properties] object.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

get_scheduled_job

Retrieves the details of a scheduled job on an IoTHub.

get_scheduled_job(job_id)

Parameters

Name Description
job_id
Required
str

The ID of the job.

Returns

Type Description
<xref:azure.iot.hub.models.JobResponse>

The JobResponse object containing the requested details.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>

query_scheduled_jobs

Query an IoT hub to retrieve information regarding jobs using the IoT Hub query language.

query_scheduled_jobs(job_type, job_status)

Parameters

Name Description
job_type
Required
str

The type of the jobs.

job_status
Required
str

The status of the jobs.

Returns

Type Description
<xref:azure.iot.hub.models.QueryResult>

QueryResult object containing the jobs.

Exceptions

Type Description
<xref:if the HTTP response status is not in >[<xref:200>]<xref:.>