Share via


BulkEnrollmentOperation Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.provisioning.service.configs.BulkEnrollmentOperation

public final class BulkEnrollmentOperation

Representation of a single Device Provisioning Service bulk operation with a JSON serializer.

It is an internal class that creates a JSON for the bulk operations over the IndividualEnrollment. To use bulk operations, please use the external API runBulkEnrollmentOperation(BulkOperationMode bulkOperationMode, Collection<IndividualEnrollment> individualEnrollments).

The following JSON is an example of the result of this serializer.

{
    "mode":"update",
    "enrollments":
    [
        {
            "registrationId":"validRegistrationId-1",
            "deviceId":"ContosoDevice-1",
            "attestation":{
                "type":"tpm",
                "tpm":{
                    "endorsementKey":"validEndorsementKey"
                }
            },
            "iotHubHostName":"ContosoIoTHub.azure-devices.net",
            "provisioningStatus":"enabled"
        },
        {
            "registrationId":"validRegistrationId-2",
            "deviceId":"ContosoDevice-2",
            "attestation":{
                "type":"tpm",
               "tpm":{
                    "endorsementKey":"validEndorsementKey"
                }
            },
            "iotHubHostName":"ContosoIoTHub.azure-devices.net",
            "provisioningStatus":"enabled"
        }
    ]
}

Constructor Summary

Constructor Description
BulkEnrollmentOperation()

Method Summary

Modifier and Type Method and Description
static java.lang.String toJson(BulkOperationMode mode, Collection<IndividualEnrollment> individualEnrollments)

Serializer

static com.google.gson.JsonElement toJsonElement(BulkOperationMode mode, Collection<IndividualEnrollment> individualEnrollments)

Serializer

static java.lang.String toString(BulkOperationMode mode, Collection<IndividualEnrollment> individualEnrollments)

Convert the class in a pretty print string.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

BulkEnrollmentOperation

public BulkEnrollmentOperation()

Method Details

toJson

public static String toJson(BulkOperationMode mode, Collection<IndividualEnrollment> individualEnrollments)

Serializer

Creates a String, whose content represents the mode and the collection of individualEnrollments in a JSON format.

Parameters:

mode - the BulkOperationMode that defines the single operation to do over the individualEnrollments.
individualEnrollments - the collection of IndividualEnrollment that contains the description of each individualEnrollment.

Returns:

The String with the content of this class.

toJsonElement

public static JsonElement toJsonElement(BulkOperationMode mode, Collection<IndividualEnrollment> individualEnrollments)

Serializer

Creates a JsonElement, whose content represents the mode and the collection of individualEnrollments in a JSON format.

This is useful if the caller will integrate this JSON with JSON from other classes to generate a consolidated JSON.

Parameters:

mode - the BulkOperationMode that defines the single operation to do over the individualEnrollments.
individualEnrollments - the collection of IndividualEnrollment that contains the description of each individualEnrollment.

Returns:

The JsonElement with the content of this class.

toString

public static String toString(BulkOperationMode mode, Collection<IndividualEnrollment> individualEnrollments)

Convert the class in a pretty print string.

Creates a String, whose content represents the mode and the collection of individualEnrollments in a pretty print JSON format.

Parameters:

mode - the BulkOperationMode that defines the single operation to do over the individualEnrollments.
individualEnrollments - the collection of IndividualEnrollment that contains the description of each individualEnrollment.

Returns:

The String with the content of this class.

Applies to