def _make_thing()

in functions/source/api/api.py [0:0]


def _make_thing(device_id, certificate_arn):
    """Creates an AWS-IOT "thing" and attaches the certificate."""
    try:
        response = iot.create_thing(thingName=device_id)
        thing_arn = response["thingArn"]
    except:
        raise ManifestImportException("Unable to create thing")

    try:
        response = iot.attach_thing_principal(
            thingName=device_id, principal=certificate_arn
        )
    except:
        raise ManifestImportException("Unable to attach certificate to thing")

    return thing_arn