Client for Cloud IoT API

class google.cloud.iot_v1.DeviceManagerClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

Internet of Things (IoT) service. Securely connect and manage IoT devices.

Constructor.

Parameters
  • (Union[DeviceManagerGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.DeviceManagerGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

bind_device_to_gateway(parent, gateway_id, device_id, retry=<object object>, timeout=<object object>, metadata=None)[source]

Associates the device with the gateway.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: Initialize `gateway_id`:
>>> gateway_id = ''
>>>
>>> # TODO: Initialize `device_id`:
>>> device_id = ''
>>>
>>> response = client.bind_device_to_gateway(parent, gateway_id, device_id)
Parameters
  • parent (str) – The name of the registry. For example, projects/example-project/locations/us-central1/registries/my-registry.

  • gateway_id (str) – The value of gateway_id can be either the device numeric ID or the user-defined device identifier.

  • device_id (str) – The device to associate with the specified gateway. The value of device_id can be either the device numeric ID or the user-defined device identifier.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A BindDeviceToGatewayResponse instance.

Raises
create_device(parent, device, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a device in a device registry.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: Initialize `device`:
>>> device = {}
>>>
>>> response = client.create_device(parent, device)
Parameters
  • parent (str) – The name of the device registry where this device should be created. For example, projects/example-project/locations/us-central1/registries/my-registry.

  • device (Union[dict, Device]) –

    The device registration details. The field name must be empty. The server generates name from the device registry id and the parent field.

    If a dict is provided, it must be of the same form as the protobuf message Device

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Device instance.

Raises
create_device_registry(parent, device_registry, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a device registry that contains devices.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.location_path('[PROJECT]', '[LOCATION]')
>>>
>>> # TODO: Initialize `device_registry`:
>>> device_registry = {}
>>>
>>> response = client.create_device_registry(parent, device_registry)
Parameters
  • parent (str) – The project and cloud region where this device registry must be created. For example, projects/example-project/locations/us-central1.

  • device_registry (Union[dict, DeviceRegistry]) –

    The device registry. The field name must be empty. The server will generate that field from the device registry id provided and the parent field.

    If a dict is provided, it must be of the same form as the protobuf message DeviceRegistry

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A DeviceRegistry instance.

Raises
delete_device(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes a device.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')
>>>
>>> client.delete_device(name)
Parameters
  • name (str) – The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
delete_device_registry(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes a device registry configuration.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> client.delete_device_registry(name)
Parameters
  • name (str) – The name of the device registry. For example, projects/example-project/locations/us-central1/registries/my-registry.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
classmethod device_path(project, location, registry, device)[source]

Return a fully-qualified device string.

enums = <module 'google.cloud.iot_v1.gapic.enums' from '/tmpfs/src/github/google-cloud-python/iot/google/cloud/iot_v1/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

DeviceManagerClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

DeviceManagerClient

get_device(name, field_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets details about a device.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')
>>>
>>> response = client.get_device(name)
Parameters
  • name (str) – The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

  • field_mask (Union[dict, FieldMask]) –

    The fields of the Device resource to be returned in the response. If the field mask is unset or empty, all fields are returned.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Device instance.

Raises
get_device_registry(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets a device registry configuration.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> response = client.get_device_registry(name)
Parameters
  • name (str) – The name of the device registry. For example, projects/example-project/locations/us-central1/registries/my-registry.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A DeviceRegistry instance.

Raises
get_iam_policy(resource, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> resource = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> response = client.get_iam_policy(resource)
Parameters
  • resource (str) – REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Policy instance.

Raises
list_device_config_versions(name, num_versions=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists the last few versions of the device configuration in descending order (i.e.: newest first).

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')
>>>
>>> response = client.list_device_config_versions(name)
Parameters
  • name (str) – The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

  • num_versions (int) – The number of versions to list. Versions are listed in decreasing order of the version number. The maximum number of versions retained is 10. If this value is zero, it will return all the versions available.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A ListDeviceConfigVersionsResponse instance.

Raises
list_device_registries(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists device registries.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.location_path('[PROJECT]', '[LOCATION]')
>>>
>>> # Iterate over all results
>>> for element in client.list_device_registries(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_device_registries(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – The project and cloud region path. For example, projects/example-project/locations/us-central1.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of DeviceRegistry instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
list_device_states(name, num_states=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists the last few versions of the device state in descending order (i.e.: newest first).

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')
>>>
>>> response = client.list_device_states(name)
Parameters
  • name (str) – The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

  • num_states (int) – The number of states to list. States are listed in descending order of update time. The maximum number of states retained is 10. If this value is zero, it will return all the states available.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A ListDeviceStatesResponse instance.

Raises
list_devices(parent, device_num_ids=None, device_ids=None, field_mask=None, gateway_list_options=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

List devices in a device registry.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # Iterate over all results
>>> for element in client.list_devices(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_devices(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – The device registry path. Required. For example, projects/my-project/locations/us-central1/registries/my-registry.

  • device_num_ids (list[long]) – A list of device numeric IDs. If empty, this field is ignored. Maximum IDs: 10,000.

  • device_ids (list[str]) – A list of device string IDs. For example, ['device0', 'device12']. If empty, this field is ignored. Maximum IDs: 10,000

  • field_mask (Union[dict, FieldMask]) –

    The fields of the Device resource to be returned in the response. The fields id and num_id are always returned, along with any other fields specified.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • gateway_list_options (Union[dict, GatewayListOptions]) –

    Options related to gateways.

    If a dict is provided, it must be of the same form as the protobuf message GatewayListOptions

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Device instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
classmethod location_path(project, location)[source]

Return a fully-qualified location string.

modify_cloud_to_device_config(name, binary_data, version_to_update=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')
>>>
>>> # TODO: Initialize `binary_data`:
>>> binary_data = b''
>>>
>>> response = client.modify_cloud_to_device_config(name, binary_data)
Parameters
  • name (str) – The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

  • binary_data (bytes) – The configuration data for the device.

  • version_to_update (long) – The version number to update. If this value is zero, it will not check the version number of the server and will always update the current version; otherwise, this update will fail if the version number found on the server does not match this version number. This is used to support multiple simultaneous updates without losing data.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A DeviceConfig instance.

Raises
classmethod registry_path(project, location, registry)[source]

Return a fully-qualified registry string.

send_command_to_device(name, binary_data, subfolder=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sends a command to the specified device. In order for a device to be able to receive commands, it must:

  1. be connected to Cloud IoT Core using the MQTT protocol, and

  2. be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')
>>>
>>> # TODO: Initialize `binary_data`:
>>> binary_data = b''
>>>
>>> response = client.send_command_to_device(name, binary_data)
Parameters
  • name (str) – The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

  • binary_data (bytes) – The command data to send to the device.

  • subfolder (str) – Optional subfolder for the command. If empty, the command will be delivered to the /devices/{device-id}/commands topic, otherwise it will be delivered to the /devices/{device-id}/commands/{subfolder} topic. Multi-level subfolders are allowed. This field must not have more than 256 characters, and must not contain any MQTT wildcards (“+” or “#”) or null characters.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A SendCommandToDeviceResponse instance.

Raises
set_iam_policy(resource, policy, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the access control policy on the specified resource. Replaces any existing policy.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> resource = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: Initialize `policy`:
>>> policy = {}
>>>
>>> response = client.set_iam_policy(resource, policy)
Parameters
  • resource (str) – REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

  • policy (Union[dict, Policy]) –

    REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

    If a dict is provided, it must be of the same form as the protobuf message Policy

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Policy instance.

Raises
test_iam_permissions(resource, permissions, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> resource = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: Initialize `permissions`:
>>> permissions = []
>>>
>>> response = client.test_iam_permissions(resource, permissions)
Parameters
  • resource (str) – REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

  • permissions (list[str]) – The set of permissions to check for the resource. Permissions with wildcards (such as ‘*’ or ‘storage.*’) are not allowed. For more information see IAM Overview.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A TestIamPermissionsResponse instance.

Raises
unbind_device_from_gateway(parent, gateway_id, device_id, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes the association between the device and the gateway.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> parent = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')
>>>
>>> # TODO: Initialize `gateway_id`:
>>> gateway_id = ''
>>>
>>> # TODO: Initialize `device_id`:
>>> device_id = ''
>>>
>>> response = client.unbind_device_from_gateway(parent, gateway_id, device_id)
Parameters
  • parent (str) – The name of the registry. For example, projects/example-project/locations/us-central1/registries/my-registry.

  • gateway_id (str) – The value of gateway_id can be either the device numeric ID or the user-defined device identifier.

  • device_id (str) – The device to disassociate from the specified gateway. The value of device_id can be either the device numeric ID or the user-defined device identifier.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A UnbindDeviceFromGatewayResponse instance.

Raises
update_device(device, update_mask, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates a device.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> # TODO: Initialize `device`:
>>> device = {}
>>>
>>> # TODO: Initialize `update_mask`:
>>> update_mask = {}
>>>
>>> response = client.update_device(device, update_mask)
Parameters
  • device (Union[dict, Device]) –

    The new values for the device. The id and num_id fields must be empty, and the field name must specify the name path. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

    If a dict is provided, it must be of the same form as the protobuf message Device

  • update_mask (Union[dict, FieldMask]) –

    Only updates the device fields indicated by this mask. The field mask must not be empty, and it must not contain fields that are immutable or only set by the server. Mutable top-level fields: credentials, blocked, and metadata

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Device instance.

Raises
update_device_registry(device_registry, update_mask, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates a device registry configuration.

Example

>>> from google.cloud import iot_v1
>>>
>>> client = iot_v1.DeviceManagerClient()
>>>
>>> # TODO: Initialize `device_registry`:
>>> device_registry = {}
>>>
>>> # TODO: Initialize `update_mask`:
>>> update_mask = {}
>>>
>>> response = client.update_device_registry(device_registry, update_mask)
Parameters
  • device_registry (Union[dict, DeviceRegistry]) –

    The new values for the device registry. The id field must be empty, and the name field must indicate the path of the resource. For example, projects/example-project/locations/us-central1/registries/my-registry.

    If a dict is provided, it must be of the same form as the protobuf message DeviceRegistry

  • update_mask (Union[dict, FieldMask]) –

    Only updates the device_registry fields indicated by this mask. The field mask must not be empty, and it must not contain fields that are immutable or only set by the server. Mutable top-level fields: event_notification_config, http_config, mqtt_config, and state_notification_config.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A DeviceRegistry instance.

Raises