awsiot.iotidentity¶
- class awsiot.iotidentity.IotIdentityClient(mqtt_connection)¶
Bases:
MqttServiceClient
An AWS IoT service that assists with provisioning a device and installing unique client certificates on it
AWS Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html
- Parameters:
mqtt_connection (Connection) –
- publish_create_certificate_from_csr(request, qos)¶
Creates a certificate from a certificate signing request (CSR). AWS IoT provides client certificates that are signed by the Amazon Root certificate authority (CA). The new certificate has a PENDING_ACTIVATION status. When you call RegisterThing to provision a thing with this certificate, the certificate status changes to ACTIVE or INACTIVE as described in the template.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (CreateCertificateFromCsrRequest) – CreateCertificateFromCsrRequest instance.
qos (int) – The Quality of Service guarantee of this message
- Returns:
A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.
- Return type:
Future
- publish_create_keys_and_certificate(request, qos)¶
Creates new keys and a certificate. AWS IoT provides client certificates that are signed by the Amazon Root certificate authority (CA). The new certificate has a PENDING_ACTIVATION status. When you call RegisterThing to provision a thing with this certificate, the certificate status changes to ACTIVE or INACTIVE as described in the template.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (CreateKeysAndCertificateRequest) – CreateKeysAndCertificateRequest instance.
qos (int) – The Quality of Service guarantee of this message
- Returns:
A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.
- Return type:
Future
- publish_register_thing(request, qos)¶
Provisions an AWS IoT thing using a pre-defined template.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (RegisterThingRequest) – RegisterThingRequest instance.
qos (int) – The Quality of Service guarantee of this message
- Returns:
A Future whose result will be None if the request is successfully published. The Future’s result will be an exception if the request cannot be published.
- Return type:
Future
- subscribe_to_create_certificate_from_csr_accepted(request, qos, callback)¶
Subscribes to the accepted topic of the CreateCertificateFromCsr operation.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (CreateCertificateFromCsrSubscriptionRequest) – CreateCertificateFromCsrSubscriptionRequest instance.
qos (int) – The Quality of Service guarantee of this message
callback (Callable[[CreateCertificateFromCsrResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type CreateCertificateFromCsrResponse. The callback is not expected to return anything.
- Returns:
Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.
- Return type:
- subscribe_to_create_certificate_from_csr_rejected(request, qos, callback)¶
Subscribes to the rejected topic of the CreateCertificateFromCsr operation.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (CreateCertificateFromCsrSubscriptionRequest) – CreateCertificateFromCsrSubscriptionRequest instance.
qos (int) – The Quality of Service guarantee of this message
callback (Callable[[ErrorResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type ErrorResponse. The callback is not expected to return anything.
- Returns:
Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.
- Return type:
- subscribe_to_create_keys_and_certificate_accepted(request, qos, callback)¶
Subscribes to the accepted topic of the CreateKeysAndCertificate operation.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (CreateKeysAndCertificateSubscriptionRequest) – CreateKeysAndCertificateSubscriptionRequest instance.
qos (int) – The Quality of Service guarantee of this message
callback (Callable[[CreateKeysAndCertificateResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type CreateKeysAndCertificateResponse. The callback is not expected to return anything.
- Returns:
Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.
- Return type:
- subscribe_to_create_keys_and_certificate_rejected(request, qos, callback)¶
Subscribes to the rejected topic of the CreateKeysAndCertificate operation.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (CreateKeysAndCertificateSubscriptionRequest) – CreateKeysAndCertificateSubscriptionRequest instance.
qos (int) – The Quality of Service guarantee of this message
callback (Callable[[ErrorResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type ErrorResponse. The callback is not expected to return anything.
- Returns:
Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.
- Return type:
- subscribe_to_register_thing_accepted(request, qos, callback)¶
Subscribes to the accepted topic of the RegisterThing operation.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (RegisterThingSubscriptionRequest) – RegisterThingSubscriptionRequest instance.
qos (int) – The Quality of Service guarantee of this message
callback (Callable[[RegisterThingResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type RegisterThingResponse. The callback is not expected to return anything.
- Returns:
Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.
- Return type:
- subscribe_to_register_thing_rejected(request, qos, callback)¶
Subscribes to the rejected topic of the RegisterThing operation.
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api
- Parameters:
request (RegisterThingSubscriptionRequest) – RegisterThingSubscriptionRequest instance.
qos (int) – The Quality of Service guarantee of this message
callback (Callable[[ErrorResponse], None]) – Callback to invoke each time the event is received. The callback should take 1 argument of type ErrorResponse. The callback is not expected to return anything.
- Returns:
Tuple with two values. The first is a Future whose result will be the awscrt.mqtt.QoS granted by the server, or an exception if the subscription fails. The second value is a topic which may be passed to unsubscribe() to stop receiving messages. Note that messages may arrive before the subscription is acknowledged.
- Return type:
- class awsiot.iotidentity.CreateCertificateFromCsrRequest(*args, **kwargs)¶
Bases:
ModeledClass
Data needed to perform a CreateCertificateFromCsr operation.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
certificate_signing_request (str) – The CSR, in PEM format.
- class awsiot.iotidentity.CreateCertificateFromCsrResponse(*args, **kwargs)¶
Bases:
ModeledClass
Response payload to a CreateCertificateFromCsr request.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
- certificate_ownership_token¶
The token to prove ownership of the certificate during provisioning.
- Type:
- class awsiot.iotidentity.CreateCertificateFromCsrSubscriptionRequest(*args, **kwargs)¶
Bases:
ModeledClass
Data needed to subscribe to the responses of the CreateCertificateFromCsr operation.
This class has no attributes.
- class awsiot.iotidentity.CreateKeysAndCertificateRequest(*args, **kwargs)¶
Bases:
ModeledClass
Data needed to perform a CreateKeysAndCertificate operation.
This class has no attributes.
- class awsiot.iotidentity.CreateKeysAndCertificateResponse(*args, **kwargs)¶
Bases:
ModeledClass
Response payload to a CreateKeysAndCertificate request.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
- certificate_ownership_token¶
The token to prove ownership of the certificate during provisioning.
- Type:
- class awsiot.iotidentity.CreateKeysAndCertificateSubscriptionRequest(*args, **kwargs)¶
Bases:
ModeledClass
Data needed to subscribe to the responses of the CreateKeysAndCertificate operation.
This class has no attributes.
- class awsiot.iotidentity.ErrorResponse(*args, **kwargs)¶
Bases:
ModeledClass
Response document containing details about a failed request.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
- class awsiot.iotidentity.RegisterThingRequest(*args, **kwargs)¶
Bases:
ModeledClass
Data needed to perform a RegisterThing operation.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
certificate_ownership_token (str) – The token to prove ownership of the certificate. The token is generated by AWS IoT when you create a certificate over MQTT.
parameters (Dict[str, str]) – Optional. Key-value pairs from the device that are used by the pre-provisioning hooks to evaluate the registration request.
template_name (str) – The provisioning template name.
- certificate_ownership_token¶
The token to prove ownership of the certificate. The token is generated by AWS IoT when you create a certificate over MQTT.
- Type:
- parameters¶
Optional. Key-value pairs from the device that are used by the pre-provisioning hooks to evaluate the registration request.
- class awsiot.iotidentity.RegisterThingResponse(*args, **kwargs)¶
Bases:
ModeledClass
Response payload to a RegisterThing request.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
- class awsiot.iotidentity.RegisterThingSubscriptionRequest(*args, **kwargs)¶
Bases:
ModeledClass
Data needed to subscribe to the responses of the RegisterThing operation.
All attributes are None by default, and may be set by keyword in the constructor.
- Keyword Arguments:
template_name (str) – Name of the provisioning template to listen for RegisterThing responses for.