DigitalTwinsClient.DecommissionModelAsync(String, 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.
Decommissions a model asynchronously.
public virtual System.Threading.Tasks.Task<Azure.Response> DecommissionModelAsync (string modelId, System.Threading.CancellationToken cancellationToken = default);
abstract member DecommissionModelAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.DecommissionModelAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function DecommissionModelAsync (modelId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)
Parameters
- modelId
- String
The Id of the model to decommission.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
The HTTP response Response.
Exceptions
The exception that captures the errors from the service. Check the ErrorCode and Status properties for more details.
The exception is thrown when modelId
is null
.
Examples
try
{
await client.DecommissionModelAsync(sampleModelId);
Console.WriteLine($"Decommissioned model '{sampleModelId}'.");
}
catch (RequestFailedException ex)
{
FatalError($"Failed to decommision model '{sampleModelId}' due to:\n{ex}");
}
Remarks
When a model is decommissioned, new digital twins will no longer be able to be defined by this model. However, existing digital twins may continue to use this model. Once a model is decommissioned, it may not be recommissioned.
For more samples, see our repo samples.