How to use azure-iot-hub - 10 common examples

To help you get started, we’ve selected a few azure-iot-hub examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: Module object containing the created module.
        """
        x509_thumbprint = X509Thumbprint(
            primary_thumbprint=primary_thumbprint, secondary_thumbprint=secondary_thumbprint
        )

        kwargs = {
            "device_id": device_id,
            "module_id": module_id,
            "managed_by": managed_by,
            "status": status,
            "authentication": AuthenticationMechanism(
                type="selfSigned", x509_thumbprint=x509_thumbprint
            ),
        }
        module = Module(**kwargs)

        return self.protocol.service.create_or_update_module(device_id, module_id, module)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
def update_device_with_certificate_authority(self, device_id, etag, status):
        """Updates a device identity on IoTHub using certificate authority.

        :param str device_id: The name (deviceId) of the device.
        :param str etag: The etag (if_match) value to use for the update operation.
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: The updated Device object containing the created device.
        """
        kwargs = {
            "device_id": device_id,
            "status": status,
            "etag": etag,
            "authentication": AuthenticationMechanism(type="certificateAuthority"),
        }
        device = Device(**kwargs)

        return self.protocol.service.create_or_update_device(device_id, device)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str device_id: The name (deviceId) of the device.
        :param str module_id: The name (moduleID) of the module.
        :param str managed_by: The name of the manager device (edge).
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: Module object containing the created module.
        """
        kwargs = {
            "device_id": device_id,
            "module_id": module_id,
            "managed_by": managed_by,
            "status": status,
            "authentication": AuthenticationMechanism(type="certificateAuthority"),
        }
        module = Module(**kwargs)

        return self.protocol.service.create_or_update_module(device_id, module_id, module)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str primary_thumbprint: Primary X509 thumbprint.
        :param str secondary_thumbprint: Secondary X509 thumbprint.
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: Device object containing the created device.
        """
        x509_thumbprint = X509Thumbprint(
            primary_thumbprint=primary_thumbprint, secondary_thumbprint=secondary_thumbprint
        )

        kwargs = {
            "device_id": device_id,
            "status": status,
            "authentication": AuthenticationMechanism(
                type="selfSigned", x509_thumbprint=x509_thumbprint
            ),
        }
        device = Device(**kwargs)

        return self.protocol.service.create_or_update_device(device_id, device)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str secondary_thumbprint: Secondary X509 thumbprint.
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: The updated Device object containing the created device.
        """
        x509_thumbprint = X509Thumbprint(
            primary_thumbprint=primary_thumbprint, secondary_thumbprint=secondary_thumbprint
        )

        kwargs = {
            "device_id": device_id,
            "status": status,
            "etag": etag,
            "authentication": AuthenticationMechanism(
                type="selfSigned", x509_thumbprint=x509_thumbprint
            ),
        }
        device = Device(**kwargs)

        return self.protocol.service.create_or_update_device(device_id, device)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str device_id: The name (deviceId) of the device.
        :param str primary_key: Primary authentication key.
        :param str secondary_key: Secondary authentication key.
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: Device object containing the created device.
        """
        symmetric_key = SymmetricKey(primary_key=primary_key, secondary_key=secondary_key)

        kwargs = {
            "device_id": device_id,
            "status": status,
            "authentication": AuthenticationMechanism(type="sas", symmetric_key=symmetric_key),
        }
        device = Device(**kwargs)

        return self.protocol.service.create_or_update_device(device_id, device)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str secondary_key: Secondary authentication key.
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: The updated Module object containing the created module.
        """
        symmetric_key = SymmetricKey(primary_key=primary_key, secondary_key=secondary_key)

        kwargs = {
            "device_id": device_id,
            "module_id": module_id,
            "managed_by": managed_by,
            "status": status,
            "etag": etag,
            "authentication": AuthenticationMechanism(type="sas", symmetric_key=symmetric_key),
        }
        module = Module(**kwargs)

        return self.protocol.service.create_or_update_module(device_id, module_id, module, "*")
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:param str etag: The etag (if_match) value to use for the update operation.
        :param str primary_key: Primary authentication key.
        :param str secondary_key: Secondary authentication key.
        :param str status: Initital state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: The updated Device object containing the created device.
        """
        symmetric_key = SymmetricKey(primary_key=primary_key, secondary_key=secondary_key)

        kwargs = {
            "device_id": device_id,
            "status": status,
            "etag": etag,
            "authentication": AuthenticationMechanism(type="sas", symmetric_key=symmetric_key),
        }
        device = Device(**kwargs)

        return self.protocol.service.create_or_update_device(device_id, device, "*")
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
:raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: The updated Module object containing the created module.
        """
        x509_thumbprint = X509Thumbprint(
            primary_thumbprint=primary_thumbprint, secondary_thumbprint=secondary_thumbprint
        )

        kwargs = {
            "device_id": device_id,
            "module_id": module_id,
            "managed_by": managed_by,
            "status": status,
            "etag": etag,
            "authentication": AuthenticationMechanism(
                type="selfSigned", x509_thumbprint=x509_thumbprint
            ),
        }
        module = Module(**kwargs)

        return self.protocol.service.create_or_update_module(device_id, module_id, module)
github Azure / azure-iot-sdk-python / azure-iot-hub / azure / iot / hub / iothub_registry_manager.py View on Github external
def create_device_with_certificate_authority(self, device_id, status):
        """Creates a device identity on IoTHub using certificate authority.

        :param str device_id: The name (deviceId) of the device.
        :param str status: Initial state of the created device (enabled or disabled).

        :raises: HttpOperationError if the HTTP response status is not in [200].

        :returns: Device object containing the created device.
        """
        kwargs = {
            "device_id": device_id,
            "status": status,
            "authentication": AuthenticationMechanism(type="certificateAuthority"),
        }
        device = Device(**kwargs)

        return self.protocol.service.create_or_update_device(device_id, device)