IotHubUri Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.device.net.IotHubUri

public final class IotHubUri

A URI for a device to connect to an IoT Hub.

Field Summary

Modifier and Type Field and Description
static final java.lang.String API_VERSION

The API version will be passed as a param in the URI.

Constructor Summary

Modifier Constructor Description
protected IotHubUri()
IotHubUri(String iotHubHostname, String deviceId, String iotHubMethodPath, String moduleId)

Constructor.

IotHubUri(String iotHubHostname, String deviceId, String iotHubMethodPath, Map<String,String> queryParams, String moduleId)

Constructor.

Method Summary

Modifier and Type Method and Description
static java.lang.String getApiVersionString()
java.lang.String getHostname()

Returns the string representation of the IoT Hub hostname.

java.lang.String getPath()

Returns the string representation of the IoT Hub path.

static java.lang.String getResourceUri(String iotHubHostname, String deviceId, String moduleId)

Returns the string representation of the IoT Hub resource URI.

java.lang.String toString()

Returns the string representation of the IoT Hub URI.

java.lang.String toStringWithoutApiVersion()

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

API_VERSION

public static final String API_VERSION

The API version will be passed as a param in the URI.

Constructor Details

IotHubUri

protected IotHubUri()

IotHubUri

public IotHubUri(String iotHubHostname, String deviceId, String iotHubMethodPath, String moduleId)

Constructor. Equivalent to new IotHubUri(iotHubHostname, deviceId, iotHubMethodPath, null).

Parameters:

iotHubHostname - the IoT Hub hostname.
deviceId - the device ID.
iotHubMethodPath - the path from the IoT Hub resource to the method.
moduleId - the module ID.

IotHubUri

public IotHubUri(String iotHubHostname, String deviceId, String iotHubMethodPath, Map<String,String> queryParams, String moduleId)

Constructor. Creates a URI to an IoT Hub method. The URI does not include a protocol. The function will safely escape the given arguments.

Parameters:

iotHubHostname - the IoT Hub hostname.
deviceId - the device ID.
iotHubMethodPath - the path from the IoT Hub resource to the method.
queryParams - the URL query parameters. Can be null.
moduleId - the module ID. May be null

Method Details

getApiVersionString

public static String getApiVersionString()

getHostname

public String getHostname()

Returns the string representation of the IoT Hub hostname.

Returns:

the string representation of the IoT Hub hostname.

getPath

public String getPath()

Returns the string representation of the IoT Hub path.

Returns:

the string representation of the IoT Hub path.

getResourceUri

public static String getResourceUri(String iotHubHostname, String deviceId, String moduleId)

Returns the string representation of the IoT Hub resource URI. The IoT Hub resource URI is the hostname and path component that is common to all IoT Hub communication methods between the given device and IoT Hub. Safely escapes the IoT Hub resource URI.

Parameters:

iotHubHostname - the IoT Hub hostname.
deviceId - the device ID.
moduleId - the module ID.

Returns:

the string representation of the IoT Hub resource URI.

toString

public String toString()

Returns the string representation of the IoT Hub URI.

Overrides:

IotHubUri.toString()

Returns:

the string representation of the IoT Hub URI.

toStringWithoutApiVersion

public String toStringWithoutApiVersion()

Applies to