Class DeviceManagerClient (2.13.0)

Internet of Things (IoT) service.

Securely connect and manage IoT devices.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

DeviceManagerClient(DeviceManagerClient const &)

Copy and move support

Parameter
Name Description
DeviceManagerClient const &

DeviceManagerClient(DeviceManagerClient &&)

Copy and move support

Parameter
Name Description
DeviceManagerClient &&

DeviceManagerClient(std::shared_ptr< DeviceManagerConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< DeviceManagerConnection >
opts Options

Operators

operator=(DeviceManagerClient const &)

Copy and move support

Parameter
Name Description
DeviceManagerClient const &
Returns
Type Description
DeviceManagerClient &

operator=(DeviceManagerClient &&)

Copy and move support

Parameter
Name Description
DeviceManagerClient &&
Returns
Type Description
DeviceManagerClient &

Functions

CreateDeviceRegistry(std::string const &, google::cloud::iot::v1::DeviceRegistry const &, Options)

Creates a device registry that contains devices.

Parameters
Name Description
parent std::string const &

Required. The project and cloud region where this device registry must be created. For example, projects/example-project/locations/us-central1.

device_registry google::cloud::iot::v1::DeviceRegistry const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceRegistry >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateDeviceRegistry(google::cloud::iot::v1::CreateDeviceRegistryRequest const &, Options)

Creates a device registry that contains devices.

Parameters
Name Description
request google::cloud::iot::v1::CreateDeviceRegistryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.CreateDeviceRegistryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceRegistry >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDeviceRegistry(std::string const &, Options)

Gets a device registry configuration.

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceRegistry >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDeviceRegistry(google::cloud::iot::v1::GetDeviceRegistryRequest const &, Options)

Gets a device registry configuration.

Parameters
Name Description
request google::cloud::iot::v1::GetDeviceRegistryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.GetDeviceRegistryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceRegistry >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDeviceRegistry(google::cloud::iot::v1::DeviceRegistry const &, google::protobuf::FieldMask const &, Options)

Updates a device registry configuration.

Parameters
Name Description
device_registry google::cloud::iot::v1::DeviceRegistry const &

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.

update_mask google::protobuf::FieldMask const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceRegistry >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDeviceRegistry(google::cloud::iot::v1::UpdateDeviceRegistryRequest const &, Options)

Updates a device registry configuration.

Parameters
Name Description
request google::cloud::iot::v1::UpdateDeviceRegistryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.UpdateDeviceRegistryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceRegistry >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteDeviceRegistry(std::string const &, Options)

Deletes a device registry configuration.

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteDeviceRegistry(google::cloud::iot::v1::DeleteDeviceRegistryRequest const &, Options)

Deletes a device registry configuration.

Parameters
Name Description
request google::cloud::iot::v1::DeleteDeviceRegistryRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.DeleteDeviceRegistryRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

ListDeviceRegistries(std::string const &, Options)

Lists device registries.

Parameters
Name Description
parent std::string const &

Required. The project and cloud region path. For example, projects/example-project/locations/us-central1.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::iot::v1::DeviceRegistry >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.iot.v1.DeviceRegistry, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListDeviceRegistries(google::cloud::iot::v1::ListDeviceRegistriesRequest, Options)

Lists device registries.

Parameters
Name Description
request google::cloud::iot::v1::ListDeviceRegistriesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.ListDeviceRegistriesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::iot::v1::DeviceRegistry >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.iot.v1.DeviceRegistry, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

CreateDevice(std::string const &, google::cloud::iot::v1::Device const &, Options)

Creates a device in a device registry.

Parameters
Name Description
parent std::string const &

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 google::cloud::iot::v1::Device const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::Device >

the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateDevice(google::cloud::iot::v1::CreateDeviceRequest const &, Options)

Creates a device in a device registry.

Parameters
Name Description
request google::cloud::iot::v1::CreateDeviceRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.CreateDeviceRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::Device >

the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDevice(std::string const &, Options)

Gets details about a device.

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::Device >

the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDevice(google::cloud::iot::v1::GetDeviceRequest const &, Options)

Gets details about a device.

Parameters
Name Description
request google::cloud::iot::v1::GetDeviceRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.GetDeviceRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::Device >

the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDevice(google::cloud::iot::v1::Device const &, google::protobuf::FieldMask const &, Options)

Updates a device.

Parameters
Name Description
device google::cloud::iot::v1::Device const &

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/device0or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

update_mask google::protobuf::FieldMask const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::Device >

the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDevice(google::cloud::iot::v1::UpdateDeviceRequest const &, Options)

Updates a device.

Parameters
Name Description
request google::cloud::iot::v1::UpdateDeviceRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.UpdateDeviceRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::Device >

the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteDevice(std::string const &, Options)

Deletes a device.

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteDevice(google::cloud::iot::v1::DeleteDeviceRequest const &, Options)

Deletes a device.

Parameters
Name Description
request google::cloud::iot::v1::DeleteDeviceRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.DeleteDeviceRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

ListDevices(std::string const &, Options)

List devices in a device registry.

Parameters
Name Description
parent std::string const &

Required. The device registry path. Required. For example, projects/my-project/locations/us-central1/registries/my-registry.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::iot::v1::Device >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.iot.v1.Device, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListDevices(google::cloud::iot::v1::ListDevicesRequest, Options)

List devices in a device registry.

Parameters
Name Description
request google::cloud::iot::v1::ListDevicesRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.ListDevicesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::iot::v1::Device >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.iot.v1.Device, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ModifyCloudToDeviceConfig(std::string const &, std::string const &, Options)

Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers.

Returns the modified configuration version and its metadata.

Parameters
Name Description
name std::string const &

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 std::string const &

Required. The configuration data for the device.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceConfig >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceConfig) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ModifyCloudToDeviceConfig(google::cloud::iot::v1::ModifyCloudToDeviceConfigRequest const &, Options)

Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers.

Returns the modified configuration version and its metadata.

Parameters
Name Description
request google::cloud::iot::v1::ModifyCloudToDeviceConfigRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::DeviceConfig >

the result of the RPC. The response message type (google.cloud.iot.v1.DeviceConfig) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListDeviceConfigVersions(std::string const &, Options)

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

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::ListDeviceConfigVersionsResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceConfigVersionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListDeviceConfigVersions(google::cloud::iot::v1::ListDeviceConfigVersionsRequest const &, Options)

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

Parameters
Name Description
request google::cloud::iot::v1::ListDeviceConfigVersionsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.ListDeviceConfigVersionsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::ListDeviceConfigVersionsResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceConfigVersionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListDeviceStates(std::string const &, Options)

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

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::ListDeviceStatesResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceStatesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListDeviceStates(google::cloud::iot::v1::ListDeviceStatesRequest const &, Options)

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

Parameters
Name Description
request google::cloud::iot::v1::ListDeviceStatesRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.ListDeviceStatesRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::ListDeviceStatesResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceStatesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SetIamPolicy(std::string const &, google::iam::v1::Policy const &, Options)

Sets the access control policy on the specified resource.

Replaces any existing policy.

Parameters
Name Description
resource std::string const &

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

policy google::iam::v1::Policy const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SetIamPolicy(std::string const &, IamUpdater const &, Options)

Updates the IAM policy for resource using an optimistic concurrency control loop.

The loop fetches the current policy for resource, and passes it to updater, which should return the new policy. This new policy should use the current etag so that the read-modify-write cycle can detect races and rerun the update when there is a mismatch. If the new policy does not have an etag, the existing policy will be blindly overwritten. If updater does not yield a policy, the control loop is terminated and kCancelled is returned.

Parameters
Name Description
resource std::string const &

Required. The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

updater IamUpdater const &

Required. Functor to map the current policy to a new one.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

google::iam::v1::Policy

SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &, Options)

Sets the access control policy on the specified resource.

Replaces any existing policy.

Parameters
Name Description
request google::iam::v1::SetIamPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.SetIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetIamPolicy(std::string const &, Options)

Gets the access control policy for a resource.

Returns an empty policy if the resource exists and does not have a policy set.

Parameters
Name Description
resource std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &, Options)

Gets the access control policy for a resource.

Returns an empty policy if the resource exists and does not have a policy set.

Parameters
Name Description
request google::iam::v1::GetIamPolicyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.GetIamPolicyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::Policy >

the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

TestIamPermissions(std::string const &, std::vector< std::string > const &, Options)

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.

Parameters
Name Description
resource std::string const &

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

permissions std::vector< std::string > const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::TestIamPermissionsResponse >

the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &, Options)

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.

Parameters
Name Description
request google::iam::v1::TestIamPermissionsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.iam.v1.TestIamPermissionsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::iam::v1::TestIamPermissionsResponse >

the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SendCommandToDevice(std::string const &, std::string const &, Options)

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.

Parameters
Name Description
name std::string const &

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 std::string const &

Required. The command data to send to the device.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.SendCommandToDeviceResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SendCommandToDevice(std::string const &, std::string const &, std::string const &, Options)

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.

Parameters
Name Description
name std::string const &

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 std::string const &

Required. The command data to send to the device.

subfolder std::string const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.SendCommandToDeviceResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SendCommandToDevice(google::cloud::iot::v1::SendCommandToDeviceRequest const &, Options)

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.

Parameters
Name Description
request google::cloud::iot::v1::SendCommandToDeviceRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.SendCommandToDeviceRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.SendCommandToDeviceResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

BindDeviceToGateway(std::string const &, std::string const &, std::string const &, Options)

Associates the device with the gateway.

Parameters
Name Description
parent std::string const &

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

gateway_id std::string const &

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

device_id std::string const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::BindDeviceToGatewayResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.BindDeviceToGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

BindDeviceToGateway(google::cloud::iot::v1::BindDeviceToGatewayRequest const &, Options)

Associates the device with the gateway.

Parameters
Name Description
request google::cloud::iot::v1::BindDeviceToGatewayRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.BindDeviceToGatewayRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::BindDeviceToGatewayResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.BindDeviceToGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UnbindDeviceFromGateway(std::string const &, std::string const &, std::string const &, Options)

Deletes the association between the device and the gateway.

Parameters
Name Description
parent std::string const &

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

gateway_id std::string const &

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

device_id std::string const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::UnbindDeviceFromGatewayResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UnbindDeviceFromGateway(google::cloud::iot::v1::UnbindDeviceFromGatewayRequest const &, Options)

Deletes the association between the device and the gateway.

Parameters
Name Description
request google::cloud::iot::v1::UnbindDeviceFromGatewayRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.iot.v1.UnbindDeviceFromGatewayRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::iot::v1::UnbindDeviceFromGatewayResponse >

the result of the RPC. The response message type (google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.