ModulesClient.DeleteAsync Method

Definition

Overloads

DeleteAsync(Module, Boolean, CancellationToken)

Delete the module identity from your IoT hub's registry.

DeleteAsync(String, String, CancellationToken)

Delete the module identity with the provided Id from the device with the provided Id from your IoT hub's registry.

DeleteAsync(Module, Boolean, CancellationToken)

Delete the module identity from your IoT hub's registry.

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

Parameters

module
Module

The module identity to delete from your IoT hub's registry. If the provided module's ETag is out of date, this operation will throw a IotHubServiceException with PreconditionFailed An up-to-date ETag can be retrieved using GetAsync(String, String, CancellationToken). To force the operation to execute regardless of ETag, set the module identity's ETag to "*" or use DeleteAsync(String, String, CancellationToken).

onlyIfUnchanged
Boolean

If false, this delete operation will be performed even if the provided device identity has an out of date ETag. If true, the operation will throw a IotHubServiceException with PreconditionFailed if the provided module has an out of date ETag. An up-to-date ETag can be retrieved using GetAsync(String, String, CancellationToken).

cancellationToken
CancellationToken

The token which allows the operation to be canceled.

Returns

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

DeleteAsync(String, String, CancellationToken)

Delete the module identity with the provided Id from the device with the provided Id from your IoT hub's registry.

public virtual System.Threading.Tasks.Task DeleteAsync (string deviceId, string moduleId, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.DeleteAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function DeleteAsync (deviceId As String, moduleId As String, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

deviceId
String

The Id of the device identity that contains the module to be deleted.

moduleId
String

The Id of the module identity to be deleted.

cancellationToken
CancellationToken

The token which allows the operation to be canceled.

Returns

Exceptions

Thrown when the provided device Id or module Id is null.

Thrown when the provided device Id or module Id is empty or whitespace.

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