Share via


DeviceManagementClient.DeleteDeviceClassAsync(String, RequestContext) Method

Definition

Deletes a device class. Device classes are created automatically when Device Update-enabled devices are connected to the hub but are not automatically cleaned up since they are referenced by DeviceClassSubgroups. If the user has deleted all DeviceClassSubgroups for a device class they can also delete the device class to remove the records from the system and to stop checking the compatibility of this device class with new updates. If a device is ever reconnected for this device class it will be re-created.

public virtual System.Threading.Tasks.Task<Azure.Response> DeleteDeviceClassAsync (string deviceClassId, Azure.RequestContext context = default);
abstract member DeleteDeviceClassAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.DeleteDeviceClassAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function DeleteDeviceClassAsync (deviceClassId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

deviceClassId
String

Device class identifier.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

deviceClassId is null.

deviceClassId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call DeleteDeviceClassAsync with required parameters.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);

Response response = await client.DeleteDeviceClassAsync("<deviceClassId>");
Console.WriteLine(response.Status);

Applies to