azure.iot.deviceprovisioning.aio.operations package¶
-
class
azure.iot.deviceprovisioning.aio.operations.DeviceRegistrationStateOperations(*args, **kwargs)[source]¶ Warning
DO NOT instantiate this class directly.
Instead, you should access the following operations through
DeviceProvisioningClient’sdevice_registration_stateattribute.-
async
delete(id: str, *, if_match: Optional[str] = None, **kwargs: Any) → None[source]¶ Deletes the device registration.
Deletes the device registration.
-
async
get(id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Gets the device registration state.
Gets the device registration state.
- Parameters
id (str) – Registration ID. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". }
-
async
query(id: str, *, top: Optional[int] = None, **kwargs: Any) → azure.core.async_paging.AsyncItemPaged[collections.abc.MutableMapping[str, Any]][source]¶ Gets the registration state of devices in this enrollmentGroup.
Gets the registration state of devices in this enrollmentGroup.
- Parameters
id (str) – Enrollment group ID. Required.
- Keyword Arguments
top (Optional[int]) – Page size. Default value is None.
- Returns
list of JSON object
- Return type
AsyncItemPaged[JSON]
:raises ~azure.core.exceptions.HttpResponseError
Example
# response body for status code(s): 200 response == [ { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". } ]
-
async
-
class
azure.iot.deviceprovisioning.aio.operations.EnrollmentGroupOperations(*args, **kwargs)[source]¶ Warning
DO NOT instantiate this class directly.
Instead, you should access the following operations through
DeviceProvisioningClient’senrollment_groupattribute.-
async
create_or_update(id: str, enrollment_group: Union[collections.abc.MutableMapping[str, Any], IO], *, if_match: Optional[str] = None, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Create or update a device enrollment group.
Create or update a device enrollment group.
- Parameters
id (str) – Enrollment group ID. Required.
enrollment_group (JSON or IO) – The device enrollment group. Is either a JSON type or a IO type. Required.
- Keyword Arguments
- Returns
JSON object
- Return type
JSON
- Raises
Example
# JSON input template you can fill out and use as your body input. enrollment_group = { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "enrollmentGroupId": "str", # Enrollment Group ID. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } } # response body for status code(s): 200 response == { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "enrollmentGroupId": "str", # Enrollment Group ID. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } }
-
async
delete(id: str, *, if_match: Optional[str] = None, **kwargs: Any) → None[source]¶ Delete a device enrollment group.
Delete a device enrollment group.
-
async
get(id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Get a device enrollment group.
Get a device enrollment group.
- Parameters
id (str) – Enrollment group ID. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "enrollmentGroupId": "str", # Enrollment Group ID. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } }
-
async
get_attestation_mechanism(id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Get the attestation mechanism in the device enrollment group record.
Get the attestation mechanism in the device enrollment group record.
- Parameters
id (str) – Enrollment group ID. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }
-
async
query(query_specification: Union[collections.abc.MutableMapping[str, Any], IO], *, top: Optional[int] = None, **kwargs: Any) → azure.core.async_paging.AsyncItemPaged[collections.abc.MutableMapping[str, Any]][source]¶ Query the device enrollment groups.
Query the device enrollment groups.
- Parameters
query_specification (JSON or IO) – The query specification. Is either a JSON type or a IO type. Required.
- Keyword Arguments
top (Optional[int]) – Page size. Default value is None.
- Returns
list of JSON object
- Return type
AsyncItemPaged[JSON]
- Raises
Example
# JSON input template you can fill out and use as your body input. query_specification = { "query": "str" # Required. } # response body for status code(s): 200 response == [ { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "enrollmentGroupId": "str", # Enrollment Group ID. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } } ]
-
async
run_bulk_operation(bulk_operation: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Bulk device enrollment group operation with maximum of 10 groups.
Bulk device enrollment group operation with maximum of 10 groups.
- Parameters
bulk_operation (JSON or IO) – Bulk operation. Is either a JSON type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# JSON input template you can fill out and use as your body input. bulk_operation = { "enrollmentGroups": [ { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "enrollmentGroupId": "str", # Enrollment Group ID. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } } ], "mode": "str" # Operation mode. Required. Known values are: "create", "update", "updateIfMatchETag", and "delete". } # response body for status code(s): 200 response == { "isSuccessful": bool, # Indicates if the operation was successful in its entirety. Required. "errors": [ { "enrollmentGroupId": "str", # Enrollment group id. Required. "errorCode": 0, # Error code. Required. "errorStatus": "str" # Error status. Required. } ] }
-
async
-
class
azure.iot.deviceprovisioning.aio.operations.EnrollmentOperations(*args, **kwargs)[source]¶ Warning
DO NOT instantiate this class directly.
Instead, you should access the following operations through
DeviceProvisioningClient’senrollmentattribute.-
async
create_or_update(id: str, enrollment: Union[collections.abc.MutableMapping[str, Any], IO], *, if_match: Optional[str] = None, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Create or update a device enrollment record.
Create or update a device enrollment record.
- Parameters
id (str) – This id is used to uniquely identify a device registration of an enrollment. A case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required.
enrollment (JSON or IO) – The device enrollment record. Is either a JSON type or a IO type. Required.
- Keyword Arguments
- Returns
JSON object
- Return type
JSON
- Raises
Example
# JSON input template you can fill out and use as your body input. enrollment = { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "registrationId": "str", # This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "deviceId": "str", # Optional. Desired IoT Hub device ID (optional). "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "optionalDeviceInformation": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. }, "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "registrationState": { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". }, "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } } # response body for status code(s): 200 response == { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "registrationId": "str", # This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "deviceId": "str", # Optional. Desired IoT Hub device ID (optional). "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "optionalDeviceInformation": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. }, "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "registrationState": { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". }, "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } }
-
async
delete(id: str, *, if_match: Optional[str] = None, **kwargs: Any) → None[source]¶ Delete a device enrollment record.
Delete a device enrollment record.
- Parameters
id (str) – This id is used to uniquely identify a device registration of an enrollment. A case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required.
- Keyword Arguments
if_match (str) – The ETag of the enrollment record. Default value is None.
- Returns
None
- Return type
- Raises
-
async
get(id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Get a device enrollment record.
Get a device enrollment record.
- Parameters
id (str) – This id is used to uniquely identify a device registration of an enrollment. A case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "registrationId": "str", # This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "deviceId": "str", # Optional. Desired IoT Hub device ID (optional). "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "optionalDeviceInformation": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. }, "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "registrationState": { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". }, "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } }
-
async
get_attestation_mechanism(id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Get the attestation mechanism in the device enrollment record.
Get the attestation mechanism in the device enrollment record.
- Parameters
id (str) – This id is used to uniquely identify a device registration of an enrollment. A case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }
-
async
query(query_specification: Union[collections.abc.MutableMapping[str, Any], IO], *, top: Optional[int] = None, **kwargs: Any) → azure.core.async_paging.AsyncItemPaged[collections.abc.MutableMapping[str, Any]][source]¶ Query the device enrollment records.
Query the device enrollment records.
- Parameters
query_specification (JSON or IO) – The query specification. Is either a JSON type or a IO type. Required.
- Keyword Arguments
top (Optional[int]) – Page size. Default value is None.
- Returns
list of JSON object
- Return type
AsyncItemPaged[JSON]
:raises ~azure.core.exceptions.HttpResponseError
Example
# JSON input template you can fill out and use as your body input. query_specification = { "query": "str" # Required. } # response body for status code(s): 200 response == [ { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "registrationId": "str", # This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "deviceId": "str", # Optional. Desired IoT Hub device ID (optional). "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "optionalDeviceInformation": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. }, "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "registrationState": { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". }, "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } } ]
-
async
run_bulk_operation(bulk_operation: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → collections.abc.MutableMapping[str, Any][source]¶ Bulk device enrollment operation with maximum of 10 enrollments.
Bulk device enrollment operation with maximum of 10 enrollments.
- Parameters
bulk_operation (JSON or IO) – Bulk operation. Is either a JSON type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# JSON input template you can fill out and use as your body input. bulk_operation = { "enrollments": [ { "attestation": { "type": "str", # Attestation Type. Required. Known values are: "none", "tpm", "x509", and "symmetricKey". "symmetricKey": { "primaryKey": "str", # Optional. Primary symmetric key. "secondaryKey": "str" # Optional. Secondary symmetric key. }, "tpm": { "endorsementKey": "str", # Required. "storageRootKey": "str" # Optional. TPM attestation method. }, "x509": { "caReferences": { "primary": "str", # Optional. Primary and secondary CA references. "secondary": "str" # Optional. Primary and secondary CA references. }, "clientCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } }, "signingCertificates": { "primary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } }, "secondary": { "certificate": "str", # Optional. Certificate and Certificate info. "info": { "issuerName": "str", # Required. "notAfterUtc": "2020-02-20 00:00:00", # Required. "notBeforeUtc": "2020-02-20 00:00:00", # Required. "serialNumber": "str", # Required. "sha1Thumbprint": "str", # Required. "sha256Thumbprint": "str", # Required. "subjectName": "str", # Required. "version": 0 # Required. } } } } }, "registrationId": "str", # This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required. "allocationPolicy": "str", # Optional. The allocation policy of this resource. This policy overrides the tenant level allocation policy for this individual enrollment or enrollment group. Possible values include 'hashed': Linked IoT hubs are equally likely to have devices provisioned to them, 'geoLatency': Devices are provisioned to an IoT hub with the lowest latency to the device.If multiple linked IoT hubs would provide the same lowest latency, the provisioning service hashes devices across those hubs, 'static' : Specification of the desired IoT hub in the enrollment list takes priority over the service-level allocation policy, 'custom': Devices are provisioned to an IoT hub based on your own custom logic. The provisioning service passes information about the device to the logic, and the logic returns the desired IoT hub as well as the desired initial configuration. We recommend using Azure Functions to host your logic. Known values are: "hashed", "geoLatency", "static", and "custom". "capabilities": { "iotEdge": False # Default value is False. If set to true, this device is an IoTEdge device. Required. }, "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was created. "customAllocationDefinition": { "apiVersion": "str", # The API version of the provisioning service types (such as Enrollment) sent in the custom allocation request. Minimum supported version: "2018-09-01-preview". Required. "webhookUrl": "str" # The webhook URL used for allocation requests. Required. }, "deviceId": "str", # Optional. Desired IoT Hub device ID (optional). "etag": "str", # Optional. The entity tag associated with the resource. "initialTwin": { "properties": { "desired": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "tags": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. } }, "iotHubHostName": "str", # Optional. The Iot Hub host name. "iotHubs": [ "str" # Optional. The list of IoT Hub hostnames the device(s) in this resource can be allocated to. Must be a subset of tenant level list of IoT hubs. ], "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. The DateTime this resource was last updated. "optionalDeviceInformation": { "count": 0, # Optional. Number of properties in the TwinCollection. "metadata": { "lastUpdated": "2020-02-20 00:00:00", # Optional. Last time the TwinCollection was updated. "lastUpdatedVersion": 0 # Optional. This is null for reported properties metadata and is not null for desired properties metadata. }, "version": 0 # Optional. Version of the TwinCollection. }, "provisioningStatus": "enabled", # Optional. Default value is "enabled". The provisioning status. Known values are: "enabled" and "disabled". "registrationState": { "assignedHub": "str", # Optional. Assigned Azure IoT Hub. "createdDateTimeUtc": "2020-02-20 00:00:00", # Optional. Registration create date time (in UTC). "deviceId": "str", # Optional. Device ID. "errorCode": 0, # Optional. Error code. "errorMessage": "str", # Optional. Error message. "etag": "str", # Optional. The entity tag associated with the resource. "lastUpdatedDateTimeUtc": "2020-02-20 00:00:00", # Optional. Last updated date time (in UTC). "payload": {}, # Optional. Custom allocation payload returned from the webhook to the device. "registrationId": "str", # Optional. This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. "status": "str", # Optional. Enrollment status. Known values are: "unassigned", "assigning", "assigned", "failed", and "disabled". "substatus": "str" # Optional. Substatus for 'Assigned' devices. Possible values include - 'initialAssignment': Device has been assigned to an IoT hub for the first time, 'deviceDataMigrated': Device has been assigned to a different IoT hub and its device data was migrated from the previously assigned IoT hub. Device data was removed from the previously assigned IoT hub, 'deviceDataReset': Device has been assigned to a different IoT hub and its device data was populated from the initial state stored in the enrollment. Device data was removed from the previously assigned IoT hub, 'reprovisionedToInitialAssignment': Device has been re-provisioned to a previously assigned IoT hub. Known values are: "initialAssignment", "deviceDataMigrated", "deviceDataReset", and "reprovisionedToInitialAssignment". }, "reprovisionPolicy": { "migrateDeviceData": True, # Default value is True. When set to true (default), the Device Provisioning Service will migrate the device's data (twin, device capabilities, and device ID) from one IoT hub to another during an IoT hub assignment update. If set to false, the Device Provisioning Service will reset the device's data to the initial desired configuration stored in the corresponding enrollment list. "updateHubAssignment": True # Default value is True. When set to true (default), the Device Provisioning Service will evaluate the device's IoT Hub assignment and update it if necessary for any provisioning requests beyond the first from a given device. If set to false, the device will stay assigned to its current IoT hub. } } ], "mode": "str" # Operation mode. Required. Known values are: "create", "update", "updateIfMatchETag", and "delete". } # response body for status code(s): 200 response == { "isSuccessful": bool, # Indicates if the operation was successful in its entirety. Required. "errors": [ { "errorCode": 0, # Error code. Required. "errorStatus": "str", # Error status. Required. "registrationId": "str" # This id is used to uniquely identify a device registration of an enrollment."nA case-insensitive string (up to 128 characters long) of alphanumeric characters plus certain special characters : . _ -. No special characters allowed at start or end. Required. } ] }
-
async