ModulesClient.SetAsync(Module, Boolean, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Replace a module identity's state with the provided module identity's state.
public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.Module> SetAsync (Microsoft.Azure.Devices.Module module, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default);
abstract member SetAsync : Microsoft.Azure.Devices.Module * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Module>
override this.SetAsync : Microsoft.Azure.Devices.Module * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Module>
Public Overridable Function SetAsync (module As Module, Optional onlyIfUnchanged As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Module)
Parameters
- module
- Module
The module identity's new state.
- onlyIfUnchanged
- Boolean
If false, this 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
The newly updated module identity including its new ETag.
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
Azure SDK for .NET