Share via


DevicesClient.GetModulesAsync(String, CancellationToken) Method

Definition

Get all the modules that are registered on a particular device.

public virtual System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.Azure.Devices.Module>> GetModulesAsync (string deviceId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetModulesAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<seq<Microsoft.Azure.Devices.Module>>
override this.GetModulesAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<seq<Microsoft.Azure.Devices.Module>>
Public Overridable Function GetModulesAsync (deviceId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IEnumerable(Of Module))

Parameters

deviceId
String

The Id of the device to get the modules of.

cancellationToken
CancellationToken

The token which allows the operation to be canceled.

Returns

The modules that are registered on the specified device.

Exceptions

When the provided device Id is null.

When the provided device Id is empty or whitespace.

If IoT hub responded to the request with a non-successful status code. For example, if the provided request was throttled, IotHubServiceException with ThrottlingException is thrown. For a complete list of possible error cases, see IotHubServiceErrorCode.

If the HTTP request fails due to an underlying issue such as network connectivity, DNS failure, or server certificate validation.

If the provided cancellation token has requested cancellation.

Applies to