IoTHubConfigurationManager Class

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

Initializer for a Configuration 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
IoTHubConfigurationManager

Constructor

IoTHubConfigurationManager(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

apply_configuration_on_edge_device

Applies the provided configuration content to the specified edge device. Modules content is mandatory.

create_configuration

Creates a configuration for devices or modules of an IoTHub.

delete_configuration

Deletes a configuration from an IoTHub.

from_connection_string

Classmethod initializer for a IoTHubConfigurationManager Service client. Creates IoTHubConfigurationManager 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 IoTHubConfigurationManager Service client. Creates IoTHubConfigurationManager 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_configuration

Retrieves the IoTHub configuration for a particular device.

get_configurations

Retrieves multiple configurations for device and modules of an IoTHub. Returns the specified number of configurations. Pagination is not supported.

test_configuration_queries

Validates the target condition query and custom metric queries for a configuration.

update_configuration

Updates a configuration for devices or modules of an IoTHub. Note: that configuration Id and Content cannot be updated by the user.

apply_configuration_on_edge_device

Applies the provided configuration content to the specified edge device. Modules content is mandatory.

apply_configuration_on_edge_device(device_id, configuration_content)

Parameters

Name Description
configuration_content
Required

The name (Id) of the edge device.

device_id
Required

Returns

Type Description

An object.

Exceptions

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

create_configuration

Creates a configuration for devices or modules of an IoTHub.

create_configuration(configuration)

Parameters

Name Description
configuration_id
Required
str

The id of the configuration.

configuration
Required

The configuration to create.

Returns

Type Description

Configuration object containing the created configuration.

Exceptions

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

delete_configuration

Deletes a configuration from an IoTHub.

delete_configuration(configuration_id, etag=None)

Parameters

Name Description
configuration_id
Required
str

The id of the configuration.

configuration
Required

The configuration to create.

etag
str

The etag (if_match) value to use for the delete operation.

default value: None

Returns

Type Description

Configuration object containing the updated configuration.

Exceptions

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

from_connection_string

Classmethod initializer for a IoTHubConfigurationManager Service client. Creates IoTHubConfigurationManager 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 IoTHubConfigurationManager Service client. Creates IoTHubConfigurationManager 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_configuration

Retrieves the IoTHub configuration for a particular device.

get_configuration(configuration_id)

Parameters

Name Description
configuration_id
Required
str

The id of the configuration.

Returns

Type Description

The Configuration object.

Exceptions

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

get_configurations

Retrieves multiple configurations for device and modules of an IoTHub. Returns the specified number of configurations. Pagination is not supported.

get_configurations(max_count=None)

Parameters

Name Description
max_count
int

The maximum number of configurations requested.

default value: None

Returns

Type Description

The list[Configuration] object.

Exceptions

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

test_configuration_queries

Validates the target condition query and custom metric queries for a configuration.

test_configuration_queries(configuration_queries_test_input)

Parameters

Name Description
configuration_queries_test_input
Required

The queries test input.

Returns

Type Description

The ConfigurationQueriesTestResponse object.

Exceptions

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

update_configuration

Updates a configuration for devices or modules of an IoTHub. Note: that configuration Id and Content cannot be updated by the user.

update_configuration(configuration, etag)

Parameters

Name Description
configuration_id
Required
str

The id of the configuration.

configuration
Required

The configuration contains the updated configuration.

etag
Required
str

The etag (if_match) value to use for the update operation.

Returns

Type Description

Configuration object containing the updated configuration.

Exceptions

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