Class DeviceManagerClient (0.3.3)

DeviceManagerClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

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

Methods

DeviceManagerClient

DeviceManagerClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

Constructor.

Parameters
NameDescription
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.

client_options Union[dict, google.api_core.client_options.ClientOptions]

Client options used to set user options on the client. API Endpoint should be set through client_options.

bind_device_to_gateway

bind_device_to_gateway(parent, gateway_id, device_id, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Associates the device with the gateway.

.. rubric:: 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
NameDescription
parent str

Required. The name of the registry. For example, projects/example-project/locations/us-central1/registries/my-registry.

gateway_id str

Required. The value of gateway_id can be either the device numeric ID or the user-defined device identifier.

device_id str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

create_device

create_device(parent, device, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Creates a device in a device registry.

.. rubric:: 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
NameDescription
parent str

Required. 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]

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

create_device_registry

create_device_registry(parent, device_registry, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Creates a device registry that contains devices.

.. rubric:: 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
NameDescription
parent str

Required. 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]

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

delete_device

delete_device(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes a device.

.. rubric:: Example

from google.cloud import iot_v1

client = iot_v1.DeviceManagerClient()

name = client.device_path('[PROJECT]', '[LOCATION]', '[REGISTRY]', '[DEVICE]')

client.delete_device(name)

Parameters
NameDescription
name str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

delete_device_registry

delete_device_registry(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes a device registry configuration.

.. rubric:: Example

from google.cloud import iot_v1

client = iot_v1.DeviceManagerClient()

name = client.registry_path('[PROJECT]', '[LOCATION]', '[REGISTRY]')

client.delete_device_registry(name)

Parameters
NameDescription
name str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

device_path

device_path(project, location, registry, device)

Return a fully-qualified device string.

from_service_account_file

from_service_account_file(filename, *args, **kwargs)

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

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
DeviceManagerClientThe constructed client.

from_service_account_json

from_service_account_json(filename, *args, **kwargs)

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

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
DeviceManagerClientThe constructed client.

get_device

get_device(name, field_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Gets details about a device.

.. rubric:: 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
NameDescription
name str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

get_device_registry

get_device_registry(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Gets a device registry configuration.

.. rubric:: 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
NameDescription
name str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

get_iam_policy

get_iam_policy(resource, options_=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: Example

from google.cloud import iot_v1

client = iot_v1.DeviceManagerClient()

TODO: Initialize resource:

resource = ''

response = client.get_iam_policy(resource)

Parameters
NameDescription
resource str

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

options_ Union[dict, GetPolicyOptions]

OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy. This field is only used by Cloud IAM. If a dict is provided, it must be of the same form as the protobuf message GetPolicyOptions

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

list_device_config_versions

list_device_config_versions(name, num_versions=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: 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
NameDescription
name str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

list_device_registries

list_device_registries(parent, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Lists device registries.

.. rubric:: 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
NameDescription
parent str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

list_device_states

list_device_states(name, num_states=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: 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
NameDescription
name str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

list_devices

list_devices(parent, device_num_ids=None, device_ids=None, field_mask=None, gateway_list_options=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

List devices in a device registry.

.. rubric:: 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
NameDescription
parent str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

location_path

location_path(project, location)

Return a fully-qualified location string.

modify_cloud_to_device_config

modify_cloud_to_device_config(name, binary_data, version_to_update=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: 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
NameDescription
name str

Required. 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

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

registry_path

registry_path(project, location, registry)

Return a fully-qualified registry string.

send_command_to_device

send_command_to_device(name, binary_data, subfolder=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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.

.. rubric:: 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
NameDescription
name str

Required. 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

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

set_iam_policy

set_iam_policy(resource, policy, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: Example

from google.cloud import iot_v1

client = iot_v1.DeviceManagerClient()

TODO: Initialize resource:

resource = ''

TODO: Initialize policy:

policy = {}

response = client.set_iam_policy(resource, policy)

Parameters
NameDescription
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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

test_iam_permissions

test_iam_permissions(resource, permissions, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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.

.. rubric:: Example

from google.cloud import iot_v1

client = iot_v1.DeviceManagerClient()

TODO: Initialize resource:

resource = ''

TODO: Initialize permissions:

permissions = []

response = client.test_iam_permissions(resource, permissions)

Parameters
NameDescription
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 https://cloud.google.com/iam/docs/overview#permissions__.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

unbind_device_from_gateway

unbind_device_from_gateway(parent, gateway_id, device_id, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes the association between the device and the gateway.

.. rubric:: 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
NameDescription
parent str

Required. The name of the registry. For example, projects/example-project/locations/us-central1/registries/my-registry.

gateway_id str

Required. The value of gateway_id can be either the device numeric ID or the user-defined device identifier.

device_id str

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

update_device

update_device(device, update_mask, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Updates a device.

.. rubric:: 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
NameDescription
device Union[dict, Device]

Required. 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/device0\ or 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]

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

update_device_registry

update_device_registry(device_registry, update_mask, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Updates a device registry configuration.

.. rubric:: 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
NameDescription
device_registry Union[dict, DeviceRegistry]

Required. 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]

Required. 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 be retried using a default configuration.

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.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.