ConfigurationsClient Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.configurations.ConfigurationsClient

public class ConfigurationsClient

The client for creating, updating, getting and deleting configurations.

Constructor Summary

Constructor Description
ConfigurationsClient(String connectionString)

Constructor to create instance from connection string

ConfigurationsClient(String hostName, AzureSasCredential azureSasCredential)

Create a new ConfigurationsClient instance.

ConfigurationsClient(String hostName, AzureSasCredential azureSasCredential, ConfigurationsClientOptions options)

Create a new ConfigurationsClient instance.

ConfigurationsClient(String connectionString, ConfigurationsClientOptions options)

Constructor to create instance from connection string

ConfigurationsClient(String hostName, TokenCredential credential)

Create a new ConfigurationsClient instance.

ConfigurationsClient(String hostName, TokenCredential credential, ConfigurationsClientOptions options)

Create a new ConfigurationsClient instance.

Method Summary

Modifier and Type Method and Description
void applyConfigurationContentOnDevice(String deviceId, ConfigurationContent content)

Apply the provided configuration content to the provided device

Configuration create(Configuration configuration)

Create a new configuration using the given Configuration object Return with the response configuration object from IotHub

void delete(Configuration configuration)

Send remove configuration request and verify response

void delete(String configurationId)

Send remove configuration request and verify response

List<Configuration> get(int maxCount)

Get list of Configuration

Configuration get(String configurationId)

Get configuration by configuration Id from IotHub

Configuration replace(Configuration configuration)

Update configuration not forced

Constructor Details

ConfigurationsClient

public ConfigurationsClient(String connectionString)

Constructor to create instance from connection string

Parameters:

connectionString - The iot hub connection string

ConfigurationsClient

public ConfigurationsClient(String hostName, AzureSasCredential azureSasCredential)

Create a new ConfigurationsClient instance.

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
azureSasCredential - The SAS token provider that will be used for authentication.

ConfigurationsClient

public ConfigurationsClient(String hostName, AzureSasCredential azureSasCredential, ConfigurationsClientOptions options)

Create a new ConfigurationsClient instance.

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
azureSasCredential - The SAS token provider that will be used for authentication.
options - The connection options to use when connecting to the service.

ConfigurationsClient

public ConfigurationsClient(String connectionString, ConfigurationsClientOptions options)

Constructor to create instance from connection string

Parameters:

connectionString - The iot hub connection string
options - The connection options to use when connecting to the service.

ConfigurationsClient

public ConfigurationsClient(String hostName, TokenCredential credential)

Create a new ConfigurationsClient instance.

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
credential - The custom TokenCredential that will provide authentication tokens to this library when they are needed. The provided tokens must be Json Web Tokens.

ConfigurationsClient

public ConfigurationsClient(String hostName, TokenCredential credential, ConfigurationsClientOptions options)

Create a new ConfigurationsClient instance.

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
credential - The custom TokenCredential that will provide authentication tokens to this library when they are needed. The provided tokens must be Json Web Tokens.
options - The connection options to use when connecting to the service.

Method Details

applyConfigurationContentOnDevice

public void applyConfigurationContentOnDevice(String deviceId, ConfigurationContent content)

Apply the provided configuration content to the provided device

Parameters:

deviceId - The device to apply the configuration to
content - The configuration content to apply to the device

Throws:

IOException - If the iot hub cannot be reached
IotHubException - If the response from the hub was an error code. This exception will contain that code

create

public Configuration create(Configuration configuration)

Create a new configuration using the given Configuration object Return with the response configuration object from IotHub

Parameters:

configuration - The configuration object to create

Returns:

The configuration object for the requested operation

Throws:

IOException - This exception is thrown if the IO operation failed
IotHubException - This exception is thrown if the response verification failed

delete

public void delete(Configuration configuration)

Send remove configuration request and verify response

Parameters:

configuration - The configuration to be removed

Throws:

IOException - This exception is thrown if the IO operation failed
IotHubException - This exception is thrown if the response verification failed

delete

public void delete(String configurationId)

Send remove configuration request and verify response

Parameters:

configurationId - The configuration to be removed

Throws:

IOException - This exception is thrown if the IO operation failed
IotHubException - This exception is thrown if the response verification failed

get

public List get(int maxCount)

Get list of Configuration

Parameters:

maxCount - The requested count of configurations

Returns:

The array of requested configuration objects

Throws:

IOException - This exception is thrown if the IO operation failed
IotHubException - This exception is thrown if the response verification failed

get

public Configuration get(String configurationId)

Get configuration by configuration Id from IotHub

Parameters:

configurationId - The id of requested configuration

Returns:

The configuration object of requested configuration on the specific device

Throws:

IOException - This exception is thrown if the IO operation failed
IotHubException - This exception is thrown if the response verification failed

replace

public Configuration replace(Configuration configuration)

Update configuration not forced

Parameters:

configuration - The configuration object containing updated data

Returns:

The updated configuration object

Throws:

IOException - This exception is thrown if the IO operation failed
IotHubException - This exception is thrown if the response verification failed

Applies to