ProvisioningServiceClient.deleteDeviceRegistrationState 方法

定义

重载

deleteDeviceRegistrationState(DeviceRegistrationState deviceRegistrationState)

Delete the Registration Status information.

This method will remove the DeviceRegistrationState from the Device Provisioning Service using the provided DeviceRegistrationState information. The Device Provisioning Service will care about the id and the eTag on the DeviceRegistrationState. If you want to delete the deviceRegistrationState regardless the eTag, you can use the deleteDeviceRegistrationState(String id) passing only the id.

If the id does not exists or the eTag does not matches, this method will throw ProvisioningServiceClientNotFoundException. for more exceptions that this method can throw, please see ProvisioningServiceClientExceptionManager

Sample:

The follow code will delete the information about the deviceRegistrationState "registrationId-1".

// Registration Status information.
    private static final String PROVISIONING_CONNECTION_STRING = "HostName=ContosoProvisioning.azure-devices-provisioning.net;" +
                                                                 "SharedAccessKeyName=contosoprovisioningserviceowner;" +
                                                                 "SharedAccessKey=0000000000000000000000000000000000000000000=";
    private static final String REGISTRATION_ID = "registrationId-1";
    
    public static void main(String[] args) throws IOException, URISyntaxException, ProvisioningServiceClientException
    {
        // Create a Device Provisioning Service Client.
        DeviceProvisioningServiceClient deviceProvisioningServiceClient =
            DeviceProvisioningServiceClient.createFromConnectionString(PROVISIONING_CONNECTION_STRING);
    
        // Get the registration status information.
        DeviceRegistrationState registrationStateResult =  deviceProvisioningServiceClient.getDeviceRegistrationState(REGISTRATION_ID);
    
        // Delete the registration status information.
        deviceProvisioningServiceClient.deleteDeviceRegistrationState(registrationStateResult);
    }
    

deleteDeviceRegistrationState(String id)

Delete the registration status information.

This method will remove the DeviceRegistrationState from the Device Provisioning Service using the provided id. It will delete the registration status regardless the eTag. It means that this API correspond to the deleteDeviceRegistrationState(String id, String eTag) with theeTag="*"  .

If the id does not exists, this method will throw ProvisioningServiceClientNotFoundException. for more exceptions that this method can throw, please see ProvisioningServiceClientExceptionManager

Sample:

The follow code will delete the information about the registration status "registrationId-1".

// deviceRegistrationState information.
    private static final String PROVISIONING_CONNECTION_STRING = "HostName=ContosoProvisioning.azure-devices-provisioning.net;" +
                                                                 "SharedAccessKeyName=contosoprovisioningserviceowner;" +
                                                                 "SharedAccessKey=0000000000000000000000000000000000000000000=";
    private static final String REGISTRATION_ID = "registrationId-1";
    
    public static void main(String[] args) throws IOException, URISyntaxException, ProvisioningServiceClientException
    {
        // Create a Device Provisioning Service Client.
        DeviceProvisioningServiceClient deviceProvisioningServiceClient =
            DeviceProvisioningServiceClient.createFromConnectionString(PROVISIONING_CONNECTION_STRING);
    
        // Delete the registration status information.
        deviceProvisioningServiceClient.deleteDeviceRegistrationState(REGISTRATION_ID);
    }
    

deleteDeviceRegistrationState(String id, String eTag)

Delete the registration status information.

This method will remove the registration status from the Device Provisioning Service using the provided id and eTag. If you want to delete the registration status regardless the eTag, you can use deleteDeviceRegistrationState(String id) or you can pass the eTag asnull  , empty, or "*"  .

If the id does not exists or the eTag does not matches, this method will throw ProvisioningServiceClientNotFoundException. for more exceptions that this method can throw, please see ProvisioningServiceClientExceptionManager

Sample:

The follow code will delete the information about the deviceRegistrationState "registrationId-1" regardless the eTag.

// Registration Status information.
    private static final String PROVISIONING_CONNECTION_STRING = "HostName=ContosoProvisioning.azure-devices-provisioning.net;" +
                                                                 "SharedAccessKeyName=contosoprovisioningserviceowner;" +
                                                                 "SharedAccessKey=0000000000000000000000000000000000000000000=";
    private static final String REGISTRATION_ID = "registrationId-1";
    private Static final String ANY_ETAG = "*";
    
    public static void main(String[] args) throws IOException, URISyntaxException, ProvisioningServiceClientException
    {
        // Create a Device Provisioning Service Client.
        DeviceProvisioningServiceClient deviceProvisioningServiceClient =
            DeviceProvisioningServiceClient.createFromConnectionString(PROVISIONING_CONNECTION_STRING);
    
        // Delete the deviceRegistrationState information.
        deviceProvisioningServiceClient.deleteDeviceRegistrationState(REGISTRATION_ID, ANY_ETAG);
    }
    

deleteDeviceRegistrationState(DeviceRegistrationState deviceRegistrationState)

Delete the Registration Status information.

This method will remove the DeviceRegistrationState from the Device Provisioning Service using the provided DeviceRegistrationState information. The Device Provisioning Service will care about the id and the eTag on the DeviceRegistrationState. If you want to delete the deviceRegistrationState regardless the eTag, you can use the deleteDeviceRegistrationState(String id) passing only the id.

If the id does not exists or the eTag does not matches, this method will throw ProvisioningServiceClientNotFoundException. for more exceptions that this method can throw, please see ProvisioningServiceClientExceptionManager

Sample:

The follow code will delete the information about the deviceRegistrationState "registrationId-1".

// Registration Status information.
    private static final String PROVISIONING_CONNECTION_STRING = "HostName=ContosoProvisioning.azure-devices-provisioning.net;" +
                                                                 "SharedAccessKeyName=contosoprovisioningserviceowner;" +
                                                                 "SharedAccessKey=0000000000000000000000000000000000000000000=";
    private static final String REGISTRATION_ID = "registrationId-1";
    
    public static void main(String[] args) throws IOException, URISyntaxException, ProvisioningServiceClientException
    {
        // Create a Device Provisioning Service Client.
        DeviceProvisioningServiceClient deviceProvisioningServiceClient =
            DeviceProvisioningServiceClient.createFromConnectionString(PROVISIONING_CONNECTION_STRING);
    
        // Get the registration status information.
        DeviceRegistrationState registrationStateResult =  deviceProvisioningServiceClient.getDeviceRegistrationState(REGISTRATION_ID);
    
        // Delete the registration status information.
        deviceProvisioningServiceClient.deleteDeviceRegistrationState(registrationStateResult);
    }
    

public void deleteDeviceRegistrationState(DeviceRegistrationState deviceRegistrationState)

参数

deviceRegistrationState
DeviceRegistrationState

the DeviceRegistrationState that identifies the deviceRegistrationState. It cannot benull 

</code> . </p>

例外

ProvisioningServiceClientException

if the Provisioning Device Service was not able to delete the registration status information for the provided DeviceRegistrationState.

deleteDeviceRegistrationState(String id)

Delete the registration status information.

This method will remove the DeviceRegistrationState from the Device Provisioning Service using the provided id. It will delete the registration status regardless the eTag. It means that this API correspond to the deleteDeviceRegistrationState(String id, String eTag) with theeTag="*"  .

If the id does not exists, this method will throw ProvisioningServiceClientNotFoundException. for more exceptions that this method can throw, please see ProvisioningServiceClientExceptionManager

Sample:

The follow code will delete the information about the registration status "registrationId-1".

// deviceRegistrationState information.
    private static final String PROVISIONING_CONNECTION_STRING = "HostName=ContosoProvisioning.azure-devices-provisioning.net;" +
                                                                 "SharedAccessKeyName=contosoprovisioningserviceowner;" +
                                                                 "SharedAccessKey=0000000000000000000000000000000000000000000=";
    private static final String REGISTRATION_ID = "registrationId-1";
    
    public static void main(String[] args) throws IOException, URISyntaxException, ProvisioningServiceClientException
    {
        // Create a Device Provisioning Service Client.
        DeviceProvisioningServiceClient deviceProvisioningServiceClient =
            DeviceProvisioningServiceClient.createFromConnectionString(PROVISIONING_CONNECTION_STRING);
    
        // Delete the registration status information.
        deviceProvisioningServiceClient.deleteDeviceRegistrationState(REGISTRATION_ID);
    }
    

public void deleteDeviceRegistrationState(String id)

参数

id
String

theString 

</code> that identifies the deviceRegistrationState. It cannot be<code>null 

</code> or empty. </p>

例外

ProvisioningServiceClientException

if the Provisioning Device Service was not able to delete the deviceRegistrationState information for the provided registrationId.

deleteDeviceRegistrationState(String id, String eTag)

Delete the registration status information.

This method will remove the registration status from the Device Provisioning Service using the provided id and eTag. If you want to delete the registration status regardless the eTag, you can use deleteDeviceRegistrationState(String id) or you can pass the eTag asnull  , empty, or "*"  .

If the id does not exists or the eTag does not matches, this method will throw ProvisioningServiceClientNotFoundException. for more exceptions that this method can throw, please see ProvisioningServiceClientExceptionManager

Sample:

The follow code will delete the information about the deviceRegistrationState "registrationId-1" regardless the eTag.

// Registration Status information.
    private static final String PROVISIONING_CONNECTION_STRING = "HostName=ContosoProvisioning.azure-devices-provisioning.net;" +
                                                                 "SharedAccessKeyName=contosoprovisioningserviceowner;" +
                                                                 "SharedAccessKey=0000000000000000000000000000000000000000000=";
    private static final String REGISTRATION_ID = "registrationId-1";
    private Static final String ANY_ETAG = "*";
    
    public static void main(String[] args) throws IOException, URISyntaxException, ProvisioningServiceClientException
    {
        // Create a Device Provisioning Service Client.
        DeviceProvisioningServiceClient deviceProvisioningServiceClient =
            DeviceProvisioningServiceClient.createFromConnectionString(PROVISIONING_CONNECTION_STRING);
    
        // Delete the deviceRegistrationState information.
        deviceProvisioningServiceClient.deleteDeviceRegistrationState(REGISTRATION_ID, ANY_ETAG);
    }
    

public void deleteDeviceRegistrationState(String id, String eTag)

参数

id
String

theString 

</code> that identifies the deviceRegistrationState. It cannot be<code>null 

</code> or empty. </p>
eTag
String

theString 

</code> with the deviceRegistrationState eTag. It can be<code>null 

</code> or empty. The Device Provisioning Service will ignore it in all of these cases. </p>

例外

ProvisioningServiceClientException

if the Provisioning Device Service was not able to delete the deviceRegistrationState information for the provided registrationId and eTag.

适用于