Udostępnij za pośrednictwem


ModulesClient.CreateAsync(Module, CancellationToken) Method

Definition

Create a module identity in your IoT hub's registry.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.Module> CreateAsync (Microsoft.Azure.Devices.Module module, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateAsync : Microsoft.Azure.Devices.Module * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Module>
override this.CreateAsync : Microsoft.Azure.Devices.Module * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Module>
Public Overridable Function CreateAsync (module As Module, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Module)

Parameters

module
Module

The module identity to register.

cancellationToken
CancellationToken

The token which allows the operation to be canceled.

Returns

The registered module with the generated keys and ETags.

Exceptions

Thrown when the provided module is null.

Thrown 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