in SubTemplates/IoT/Lambdas/provision_device/client/provisioning_handler.py [0:0]
def register_thing(self, serial, token):
"""Calls the fleet provisioning service responsible for acting upon instructions within device templates.
Arguments:
serial {string} -- unique identifer for the thing. Specified as a property in provisioning template.
token {string} -- The token response from certificate creation to prove ownership/immediate possession of the certs.
Triggers:
on_message_callback() - providing acknowledgement that the provisioning template was processed.
"""
if self.isRotation:
self.logger.info('##### VALIDATING EXPIRY & ACTIVATING CERT #####')
print('##### VALIDATING EXPIRY & ACTIVATING CERT #####')
else:
self.logger.info('##### CREATING THING ACTIVATING CERT #####')
print('##### CREATING THING ACTIVATING CERT #####')
register_template = {"certificateOwnershipToken": token, "parameters": {"DeviceSerial": serial}}
#Register thing / activate certificate
self.primary_MQTTClient.publish("$aws/provisioning-templates/{}/provision/json".format(self.template_name), json.dumps(register_template), 0)