IndividualEnrollment 类

定义

Representation of a single Device Provisioning Service enrollment with a JSON serializer and deserializer.

This object is used to send IndividualEnrollment information to the provisioning service, or receive IndividualEnrollment information from the provisioning service.

To create or update an IndividualEnrollment on the provisioning service you should fill this object and call the public API createOrUpdateIndividualEnrollment(IndividualEnrollment individualEnrollment). The minimum information required by the provisioning service is theregistrationId 

</code> and the <code>attestation 

</code> .</p>

A new device can be provisioned by three attestation mechanisms, Trust Platform Module (see TpmAttestation), X509 (see X509Attestation) or SymmetricKeyAttestation mechanism. The definition of each one you should use depending on the physical authentication hardware that the device contains.

The content of this class will be serialized in a JSON format and sent as a body of the rest API to the provisioning service.

When serialized, an IndividualEnrollment will look like the following example:


    {

       "registrationId":"validRegistrationId",

       "deviceId":"ContosoDevice-123",

       "attestation":{

           "type":"tpm",

           "tpm":{

               "endorsementKey":"validEndorsementKey"

           }

       },

       "iotHubHostName":"ContosoIoTHub.azure-devices.net",

       "provisioningStatus":"enabled"

    }

    

  

The content of this class can be filled by a JSON, received from the provisioning service, as result of a IndividualEnrollment operation like create, update, or query enrollment.

The following JSON is a sample or the IndividualEnrollment response, received from the provisioning service.


    {

       "registrationId":"validRegistrationId",

       "deviceId":"ContosoDevice-123",

       "attestation":{

           "type":"tpm",

           "tpm":{

               "endorsementKey":"validEndorsementKey"

           }

       },

       "iotHubHostName":"ContosoIoTHub.azure-devices.net",

       "provisioningStatus":"enabled"

       "createdDateTimeUtc": "2017-09-28T16:29:42.3447817Z",

       "lastUpdatedDateTimeUtc": "2017-09-28T16:29:42.3447817Z",

       "etag": "\"00000000-0000-0000-0000-00000000000\""

    }

    

  

public class IndividualEnrollment extends Serializable
继承
java.lang.Object
java.io.Serializable
IndividualEnrollment

继承成员

构造函数

IndividualEnrollment(String json)

CONSTRUCTOR

This constructor creates an instance of the enrollment filling the class with the information provided in the JSON. It is used by the SDK to parse enrollment responses from the provisioning service.

The following JSON is a sample of the IndividualEnrollment response, received from the provisioning service.


    {

       "registrationId":"validRegistrationId",

       "deviceId":"ContosoDevice-123",

       "attestation":{

           "type":"tpm",

           "tpm":{

               "endorsementKey":"validEndorsementKey"

           }

       },

       "iotHubHostName":"ContosoIoTHub.azure-devices.net",

       "provisioningStatus":"enabled"

       "createdDateTimeUtc": "2017-09-28T16:29:42.3447817Z",

       "lastUpdatedDateTimeUtc": "2017-09-28T16:29:42.3447817Z",

       "etag": "\"00000000-0000-0000-0000-00000000000\""

    }

    

  

IndividualEnrollment(String registrationId, Attestation attestation)

CONSTRUCTOR

This constructor creates an instance of the enrollment with the minimum set of information required by the provisioning service. A valid enrollment must contain the registrationId, which uniquely identify this enrollment, and the attestation mechanism, which can be TPM, X509 or SymmetricKey.

Other parameters can be added by calling the setters on this class.

When serialized, an IndividualEnrollment will look like the following example:


    {

       "registrationId":"validRegistrationId",

       "attestation":{

           "type":"tpm",

           "tpm":{

               "endorsementKey":"validEndorsementKey"

           }

       }

    }

    

  

方法

getAllocationPolicy()

Getter for the allocation policy.

getAttestation()

Getter for the attestation mechanism.

getCapabilities()
getCreatedDateTimeUtc()

Getter for the createdDateTimeUtcDate.

getCustomAllocationDefinition()

Getter for the custom allocation definition policy.

getDeviceId()

Getter for the deviceId.

getDeviceRegistrationState()

Getter for the registrationState.

getEtag()

Getter for the etag.

getInitialTwin()

Getter for the initialTwin.

getIotHubHostName()

Getter for the iotHubHostName.

getIotHubs()

Getter for the list of IoTHub names that the device can be allocated to..

getLastUpdatedDateTimeUtc()

Getter for the lastUpdatedDateTimeUtcDate.

getProvisioningStatus()

Getter for the provisioningStatus.

getRegistrationId()

Getter for the registrationId.

getReprovisionPolicy()

Getter for the reprovision policy.

setAllocationPolicy(AllocationPolicy allocationPolicy)

Setter for the allocation policy.

setAttestation(Attestation attestation)

Setter for the attestation.

Attestation mechanism is a mandatory parameter that provides the mechanism type and the necessary keys/certificates

setAttestation(AttestationMechanism attestationMechanism)

Setter for the attestation.

Attestation mechanism is a mandatory parameter that provides the mechanism type and the necessary keys/certificates

setCapabilities(DeviceCapabilities capabilities)

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>as of provisioning-service-client version 1.3.3, please use <xref uid="com.microsoft.azure.sdk.iot.provisioning.service.configs.IndividualEnrollment.setCapabilitiesFinal(DeviceCapabilities)" data-throw-if-not-resolved="false" data-raw-source="setCapabilitiesFinal(DeviceCapabilities)"></xref></p>

</xrefdescription>

setCapabilitiesFinal(DeviceCapabilities capabilities)
setCreatedDateTimeUtc(String createdDateTimeUtc)

Setter for the createdDateTimeUtc.

This Date and Time is provided by the provisioning service. If the enrollment is not created yet, this string can represent an invalid Date. In this case, it will be ignored.

Example of the expected format: "2016-06-01T21:22:43.7996883Z" 

</code></p>

setCustomAllocationDefinition(CustomAllocationDefinition customAllocationDefinition)

Setter for the custom allocation definition policy.

setDeviceId(String deviceId)

Setter for the deviceId.

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>as of provisioning-service-client version 1.3.3, please use <xref uid="com.microsoft.azure.sdk.iot.provisioning.service.configs.IndividualEnrollment.setDeviceIdFinal(String)" data-throw-if-not-resolved="false" data-raw-source="setDeviceIdFinal(String)"></xref></p>

</xrefdescription>

setDeviceIdFinal(String deviceId)

Setter for the deviceId.

setEtag(String etag)

Setter for the etag.

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>as of provisioning-service-client version 1.3.3, please use <xref uid="com.microsoft.azure.sdk.iot.provisioning.service.configs.IndividualEnrollment.setEtagFinal(String)" data-throw-if-not-resolved="false" data-raw-source="setEtagFinal(String)"></xref></p>

</xrefdescription>

setEtagFinal(String etag)

Setter for the etag.

setInitialTwin(TwinState initialTwin)

Setter for the initialTwin.

It provides a Twin precondition for the provisioned device.

setIotHubHostName(String iotHubHostName)

Setter for the iotHubHostName.

A valid iothub host name shall follow this criteria. A case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars + {'-', ':', '.', '+', '', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}. A valid host name shall have, at least 2 parts separated by '.'.

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>as of provisioning-service-client version 1.3.3, please use <xref uid="com.microsoft.azure.sdk.iot.provisioning.service.configs.IndividualEnrollment.setIotHubHostNameFinal(String)" data-throw-if-not-resolved="false" data-raw-source="setIotHubHostNameFinal(String)"></xref></p>

</xrefdescription>

setIotHubHostNameFinal(String iotHubHostName)

Setter for the iotHubHostName.

A valid iothub host name shall follow this criteria. A case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars + {'-', ':', '.', '+', '', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}. A valid host name shall have, at least 2 parts separated by '.'.

setIotHubs(Collection<String> iotHubs)

Setter for the list of IotHubs available for allocation.

setLastUpdatedDateTimeUtc(String lastUpdatedDateTimeUtc)

Setter for the lastUpdatedDateTimeUtc.

This Date and Time is provided by the provisioning service. If the enrollment is not created yet, this string can represent an invalid Date. In this case, it will be ignored.

Example of the expected format: "2016-06-01T21:22:43.7996883Z" 

</code></p>

setProvisioningStatus(ProvisioningStatus provisioningStatus)

Setter for the provisioningStatus.

It provides a Status precondition for the provisioned device.

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>as of provisioning-service-client version 1.3.3, please use <xref uid="com.microsoft.azure.sdk.iot.provisioning.service.configs.IndividualEnrollment.setProvisioningStatusFinal(ProvisioningStatus)" data-throw-if-not-resolved="false" data-raw-source="setProvisioningStatusFinal(ProvisioningStatus)"></xref></p>

</xrefdescription>

setProvisioningStatusFinal(ProvisioningStatus provisioningStatus)

Setter for the provisioningStatus.

It provides a Status precondition for the provisioned device.

setRegistrationId(String registrationId)

Setter for the registrationId.

A valid registration Id shall follow this criteria. A case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars + {'-', ':', '.', '+', '', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}.

setRegistrationState(DeviceRegistrationState registrationState)

Setter for the registrationState.

setReprovisionPolicy(ReprovisionPolicy reprovisionPolicy)

Setter for the reprovision policy.

toJsonElement()

Serializer

Creates aJsonElement 

</code> , which the content represents the information in this class and its subclasses 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.

适用于