BulkEnrollmentOperation Class

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

public 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 ProvisioningServiceClient#runBulkEnrollmentOperation(BulkOperationMode, Collection).

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"

         }

     ]

*}

</code></pre></p>

Method Summary

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

Serializer

Creates aString 

</code> , whose content represents the mode and the collection of individualEnrollments in a JSON format.</p>

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

Serializer

Creates aJsonElement 

</code> , whose content represents the mode and the collection of individualEnrollments in a JSON format.</p>

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

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

Convert the class in a pretty print string.

Creates aString 

</code> , whose content represents the mode and the collection of individualEnrollments in a pretty print JSON format.</p>

Method Details

toJson

public static String toJson(BulkOperationMode mode, Collection individualEnrollments)

Serializer

Creates aString 

</code> , whose content represents the mode and the collection of individualEnrollments in a JSON format.</p>

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:

TheString 

</code> with the content of this class. </p>

Throws:

IllegalArgumentException - if one of the parameters is invalid.

toJsonElement

public static JsonElement toJsonElement(BulkOperationMode mode, Collection individualEnrollments)

Serializer

Creates aJsonElement 

</code> , whose content represents the mode and the collection of individualEnrollments in a JSON format.</p>

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:

TheJsonElement 

</code> with the content of this class. </p>

Throws:

IllegalArgumentException - if one of the parameters is invalid.

toString

public static String toString(BulkOperationMode mode, Collection individualEnrollments)

Convert the class in a pretty print string.

Creates aString 

</code> , whose content represents the mode and the collection of individualEnrollments in a pretty print JSON format.</p>

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:

TheString 

</code> with the content of this class. </p>

Throws:

IllegalArgumentException - if one of the parameters is invalid.

Applies to