def register_thing()

in rpi-image-builder/aws-iot-fleet-provisioning/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": {"SerialNumber": serial}}
        
        #Register thing / activate certificate
        self.primary_MQTTClient.publish(
            topic="$aws/provisioning-templates/{}/provision/json".format(self.template_name),
            payload=json.dumps(register_template),
            qos=mqtt.QoS.AT_LEAST_ONCE)
        time.sleep(2)