azure.iot.deviceprovisioning package

class azure.iot.deviceprovisioning.ApiVersion(value)[source]

An enumeration.

V2021_10_01 = '2021-10-01'
class azure.iot.deviceprovisioning.DeviceProvisioningClient(endpoint: str, credential: Union[TokenCredential, AzureNamedKeyCredential, AzureSasCredential], *, api_version: Union[str, azure.iot.deviceprovisioning._api_version.ApiVersion] = <ApiVersion.V2021_10_01: '2021-10-01'>, **kwargs)[source]

API for connecting to, and conducting operations on a Device Provisioning Service instance

Parameters
Keyword Arguments

api_version (str or ApiVersion) – The Device Provisioning Service API version to use for requests. Default value is the most recent service version that is compatible with the current SDK. Setting to an older version may result in reduced feature compatibility.

Variables

enrollment – EnrollmentOperations operations

azure.iot.deviceprovisioningservice.operations.EnrollmentOperations :ivar enrollment_group: EnrollmentGroupOperations operations :vartype enrollment_group: azure.iot.deviceprovisioningservice.operations.EnrollmentGroupOperations :ivar device_registration_state: DeviceRegistrationStateOperations operations :vartype device_registration_state: azure.iot.deviceprovisioningservice.operations.DeviceRegistrationStateOperations

close()None[source]
classmethod from_connection_string(connection_string: str, *, api_version: Union[str, azure.iot.deviceprovisioning._api_version.ApiVersion] = <ApiVersion.V2021_10_01: '2021-10-01'>, **kwargs: Any)azure.iot.deviceprovisioning._patch.DeviceProvisioningClient[source]

Create a Provisioning Service Client from a connection string

Parameters

connection_string (str) – The connection string for the Device Provisioning Service

Keyword Arguments

api_version (str or ApiVersion) – The Device Provisioning Service API version to use for requests. Default value is the most recent service version that is compatible with the current SDK. Setting to an older version may result in reduced feature compatibility.

Returns

A new instance of DeviceProvisioningClient

Return type

DeviceProvisioningClient

Raises

ValueError if connection string is invalid

send_request(request: azure.core.rest._rest_py3.HttpRequest, **kwargs: Any)azure.core.rest._rest_py3.HttpResponse[source]

Runs the network request through the client’s chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

Parameters

request (HttpRequest) – The network request you want to make. Required.

Keyword Arguments

stream (bool) – Whether the response payload will be streamed. Defaults to False.

Returns

The response of your network call. Does not do error handling on your response.

Return type

HttpResponse

azure.iot.deviceprovisioning.generate_sas_token(audience: str, policy: str, key: str, expiry: int = 3600)str[source]

Generate a sas token according to the given audience, policy, key and expiry :param str audience: The audience / endpoint to create the SAS token for :param str policy: The policy this token represents :param str key: The key used to sign this token :param int expiry: Token expiry time in milliseconds :returns: SAS token as a string literal :rtype: str