public final class TwinClient extends Object
| Constructor and Description |
|---|
TwinClient(String connectionString)
Constructor to create instance from connection string.
|
TwinClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential)
Create a new TwinClient instance.
|
TwinClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential,
TwinClientOptions options)
Create a new TwinClient instance.
|
TwinClient(String hostName,
com.azure.core.credential.TokenCredential credential)
Create a new TwinClient instance.
|
TwinClient(String hostName,
com.azure.core.credential.TokenCredential credential,
TwinClientOptions options)
Create a new TwinClient instance.
|
TwinClient(String connectionString,
TwinClientOptions options)
Constructor to create instance from connection string.
|
| Modifier and Type | Method and Description |
|---|---|
Twin |
get(String deviceId)
This method retrieves device twin for the specified device.
|
Twin |
get(String deviceId,
String moduleId)
This method retrieves device twin for the specified device.
|
Twin |
patch(Twin twin)
This method patches the twin for the specified device.
|
Twin |
patch(Twin twin,
String ifMatch)
This method patches the twin for the specified device.
|
TwinQueryResponse |
query(String query)
Query from your IoT Hub's set of Twins.
|
TwinQueryResponse |
query(String query,
QueryPageOptions options)
Query from your IoT Hub's set of Twins.
|
Twin |
replace(Twin twin)
Replace the full twin for a given device or module with the provided twin.
|
Twin |
replace(Twin twin,
String ifMatch)
Replace the full twin for a given device or module with the provided twin.
|
public TwinClient(String connectionString)
connectionString - The iot hub connection string.public TwinClient(String connectionString, TwinClientOptions options)
connectionString - The iot hub connection string.options - the configurable options for each operation on this client. May not be null.public TwinClient(String hostName, com.azure.core.credential.TokenCredential credential)
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.public TwinClient(String hostName, com.azure.core.credential.TokenCredential credential, TwinClientOptions options)
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.public TwinClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential)
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.public TwinClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential, TwinClientOptions options)
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.public Twin get(String deviceId) throws IotHubException, IOException
deviceId - The id of the device whose twin will be retrieved.IOException - This exception is thrown if the IO operation failed.IotHubException - This exception is thrown if the response verification failed.public Twin get(String deviceId, String moduleId) throws IotHubException, IOException
deviceId - The id of the device whose twin will be retrieved.moduleId - The id of the module on the device whose twin will be retrieved.IOException - This exception is thrown if the IO operation failed.IotHubException - This exception is thrown if the response verification failed.public Twin patch(Twin twin) throws IotHubException, IOException
See PATCH for more details.
twin - The twin to be patched. To delete a particular property, set the value to null.IOException - This exception is thrown if the IO operation failed.IotHubException - This exception is thrown if the response verification failed.public Twin patch(Twin twin, String ifMatch) throws IotHubException, IOException
See PATCH for more details.
twin - The twin to be patched. To delete a particular property, set the value to null.ifMatch - the string representing a ETag for the device twin, as per RFC7232. If null, no if-match header
will be sent as a part of this request and it will be executed unconditionally.IOException - This exception is thrown if the IO operation failed.IotHubException - This exception is thrown if the response verification failed.public Twin replace(Twin twin) throws IotHubException, IOException
twin - The twin object to replace the current twin object.IotHubException - If any an IoT hub level exception is thrown. For instance,
if the sendHttpRequest is unauthorized, a exception that extends IotHubException will be thrown.IOException - If the sendHttpRequest failed to send to IoT hub.public Twin replace(Twin twin, String ifMatch) throws IotHubException, IOException
twin - The twin object to replace the current twin object.ifMatch - the string representing a ETag for the device twin, as per RFC7232. If null, no if-match header
will be sent as a part of this request and it will be executed unconditionally.IotHubException - If any an IoT hub level exception is thrown. For instance,
if the sendHttpRequest is unauthorized, an exception that extends IotHubException will be thrown.IOException - If the sendHttpRequest failed to send to IoT hub.public TwinQueryResponse query(String query) throws IOException, IotHubException
query - The IoT Hub query for selecting which twins to getJob.IOException - If IoT Hub cannot be reached due to network level issues.IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.public TwinQueryResponse query(String query, QueryPageOptions options) throws IOException, IotHubException
query - The IoT Hub query for selecting which twins to getJob.options - The optional parameters used to decide how the query's results are returned. May not be null.IOException - If IoT Hub cannot be reached due to network level issues.IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.Copyright © 2024. All rights reserved.