Cloud IoT V1 API - Class Google::Cloud::Iot::V1::DeviceManager::Client (v0.9.0)

Reference documentation and code samples for the Cloud IoT V1 API class Google::Cloud::Iot::V1::DeviceManager::Client.

Client for the DeviceManager service.

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

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the DeviceManager Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all DeviceManager clients
::Google::Cloud::Iot::V1::DeviceManager::Client.configure do |config|
  config.timeout = 10.0
end

#bind_device_to_gateway

def bind_device_to_gateway(request, options = nil) -> ::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse
def bind_device_to_gateway(parent: nil, gateway_id: nil, device_id: nil) -> ::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse

Associates the device with the gateway.

Overloads
def bind_device_to_gateway(request, options = nil) -> ::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse
Pass arguments to bind_device_to_gateway via a request object, either of type BindDeviceToGatewayRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::BindDeviceToGatewayRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def bind_device_to_gateway(parent: nil, gateway_id: nil, device_id: nil) -> ::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse
Pass arguments to bind_device_to_gateway via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the registry. For example, projects/example-project/locations/us-central1/registries/my-registry.
  • gateway_id (::String) — Required. The value of gateway_id can be either the device numeric ID or the user-defined device identifier.
  • device_id (::String) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::BindDeviceToGatewayRequest.new

# Call the bind_device_to_gateway method.
result = client.bind_device_to_gateway request

# The returned object is of type Google::Cloud::Iot::V1::BindDeviceToGatewayResponse.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the DeviceManager Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_device

def create_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
def create_device(parent: nil, device: nil) -> ::Google::Cloud::Iot::V1::Device

Creates a device in a device registry.

Overloads
def create_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
Pass arguments to create_device via a request object, either of type CreateDeviceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::CreateDeviceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_device(parent: nil, device: nil) -> ::Google::Cloud::Iot::V1::Device
Pass arguments to create_device via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — 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, ::Hash) — Required. The device registration details. The field name must be empty. The server generates name from the device registry id and the parent field.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::CreateDeviceRequest.new

# Call the create_device method.
result = client.create_device request

# The returned object is of type Google::Cloud::Iot::V1::Device.
p result

#create_device_registry

def create_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
def create_device_registry(parent: nil, device_registry: nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry

Creates a device registry that contains devices.

Overloads
def create_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
Pass arguments to create_device_registry via a request object, either of type CreateDeviceRegistryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_device_registry(parent: nil, device_registry: nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
Pass arguments to create_device_registry via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — 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, ::Hash) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::CreateDeviceRegistryRequest.new

# Call the create_device_registry method.
result = client.create_device_registry request

# The returned object is of type Google::Cloud::Iot::V1::DeviceRegistry.
p result

#delete_device

def delete_device(request, options = nil) -> ::Google::Protobuf::Empty
def delete_device(name: nil) -> ::Google::Protobuf::Empty

Deletes a device.

Overloads
def delete_device(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_device via a request object, either of type Google::Cloud::Iot::V1::DeleteDeviceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::DeleteDeviceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_device(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_device via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — 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}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::DeleteDeviceRequest.new

# Call the delete_device method.
result = client.delete_device request

# The returned object is of type Google::Protobuf::Empty.
p result

#delete_device_registry

def delete_device_registry(request, options = nil) -> ::Google::Protobuf::Empty
def delete_device_registry(name: nil) -> ::Google::Protobuf::Empty

Deletes a device registry configuration.

Overloads
def delete_device_registry(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_device_registry via a request object, either of type Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_device_registry(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_device_registry via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the device registry. For example, projects/example-project/locations/us-central1/registries/my-registry.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest.new

# Call the delete_device_registry method.
result = client.delete_device_registry request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_device

def get_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
def get_device(name: nil, field_mask: nil) -> ::Google::Cloud::Iot::V1::Device

Gets details about a device.

Overloads
def get_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
Pass arguments to get_device via a request object, either of type GetDeviceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::GetDeviceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_device(name: nil, field_mask: nil) -> ::Google::Cloud::Iot::V1::Device
Pass arguments to get_device via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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 (::Google::Protobuf::FieldMask, ::Hash) — The fields of the Device resource to be returned in the response. If the field mask is unset or empty, all fields are returned. Fields have to be provided in snake_case format, for example: last_heartbeat_time.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::GetDeviceRequest.new

# Call the get_device method.
result = client.get_device request

# The returned object is of type Google::Cloud::Iot::V1::Device.
p result

#get_device_registry

def get_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
def get_device_registry(name: nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry

Gets a device registry configuration.

Overloads
def get_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
Pass arguments to get_device_registry via a request object, either of type GetDeviceRegistryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::GetDeviceRegistryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_device_registry(name: nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
Pass arguments to get_device_registry via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the device registry. For example, projects/example-project/locations/us-central1/registries/my-registry.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::GetDeviceRegistryRequest.new

# Call the get_device_registry method.
result = client.get_device_registry request

# The returned object is of type Google::Cloud::Iot::V1::DeviceRegistry.
p result

#get_iam_policy

def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

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

Overloads
def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via a request object, either of type Iam::V1::GetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::GetIamPolicyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
  • options (::Google::Iam::V1::GetPolicyOptions, ::Hash) — OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new DeviceManager client object.

Yields
  • (config) — Configure the DeviceManager client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Iot::V1::DeviceManager::Client.new do |config|
  config.timeout = 10.0
end

#list_device_config_versions

def list_device_config_versions(request, options = nil) -> ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse
def list_device_config_versions(name: nil, num_versions: nil) -> ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse

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

Overloads
def list_device_config_versions(request, options = nil) -> ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse
Pass arguments to list_device_config_versions via a request object, either of type ListDeviceConfigVersionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_device_config_versions(name: nil, num_versions: nil) -> ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse
Pass arguments to list_device_config_versions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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 (::Integer) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest.new

# Call the list_device_config_versions method.
result = client.list_device_config_versions request

# The returned object is of type Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse.
p result

#list_device_registries

def list_device_registries(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>
def list_device_registries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>

Lists device registries.

Overloads
def list_device_registries(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>
Pass arguments to list_device_registries via a request object, either of type ListDeviceRegistriesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::ListDeviceRegistriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_device_registries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>
Pass arguments to list_device_registries via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The project and cloud region path. For example, projects/example-project/locations/us-central1.
  • page_size (::Integer) — The maximum number of registries to return in the response. If this value is zero, the service will select a default size. A call may return fewer objects than requested. A non-empty next_page_token in the response indicates that more data is available.
  • page_token (::String) — The value returned by the last ListDeviceRegistriesResponse; indicates that this is a continuation of a prior ListDeviceRegistries call and the system should return the next page of data.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::ListDeviceRegistriesRequest.new

# Call the list_device_registries method.
result = client.list_device_registries request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Iot::V1::DeviceRegistry.
  p item
end

#list_device_states

def list_device_states(request, options = nil) -> ::Google::Cloud::Iot::V1::ListDeviceStatesResponse
def list_device_states(name: nil, num_states: nil) -> ::Google::Cloud::Iot::V1::ListDeviceStatesResponse

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

Overloads
def list_device_states(request, options = nil) -> ::Google::Cloud::Iot::V1::ListDeviceStatesResponse
Pass arguments to list_device_states via a request object, either of type ListDeviceStatesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::ListDeviceStatesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_device_states(name: nil, num_states: nil) -> ::Google::Cloud::Iot::V1::ListDeviceStatesResponse
Pass arguments to list_device_states via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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 (::Integer) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::ListDeviceStatesRequest.new

# Call the list_device_states method.
result = client.list_device_states request

# The returned object is of type Google::Cloud::Iot::V1::ListDeviceStatesResponse.
p result

#list_devices

def list_devices(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>
def list_devices(parent: nil, device_num_ids: nil, device_ids: nil, field_mask: nil, gateway_list_options: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>

List devices in a device registry.

Overloads
def list_devices(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>
Pass arguments to list_devices via a request object, either of type ListDevicesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::ListDevicesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_devices(parent: nil, device_num_ids: nil, device_ids: nil, field_mask: nil, gateway_list_options: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>
Pass arguments to list_devices via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The device registry path. Required. For example, projects/my-project/locations/us-central1/registries/my-registry.
  • device_num_ids (::Array<::Integer>) — A list of device numeric IDs. If empty, this field is ignored. Maximum IDs: 10,000.
  • device_ids (::Array<::String>) — A list of device string IDs. For example, ['device0', 'device12']. If empty, this field is ignored. Maximum IDs: 10,000
  • field_mask (::Google::Protobuf::FieldMask, ::Hash) — 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 in snake_case format, for example: last_heartbeat_time.
  • gateway_list_options (::Google::Cloud::Iot::V1::GatewayListOptions, ::Hash) — Options related to gateways.
  • page_size (::Integer) — The maximum number of devices to return in the response. If this value is zero, the service will select a default size. A call may return fewer objects than requested. A non-empty next_page_token in the response indicates that more data is available.
  • page_token (::String) — The value returned by the last ListDevicesResponse; indicates that this is a continuation of a prior ListDevices call and the system should return the next page of data.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::ListDevicesRequest.new

# Call the list_devices method.
result = client.list_devices request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Iot::V1::Device.
  p item
end

#modify_cloud_to_device_config

def modify_cloud_to_device_config(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceConfig
def modify_cloud_to_device_config(name: nil, version_to_update: nil, binary_data: nil) -> ::Google::Cloud::Iot::V1::DeviceConfig

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

Overloads
def modify_cloud_to_device_config(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceConfig
Pass arguments to modify_cloud_to_device_config via a request object, either of type ModifyCloudToDeviceConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def modify_cloud_to_device_config(name: nil, version_to_update: nil, binary_data: nil) -> ::Google::Cloud::Iot::V1::DeviceConfig
Pass arguments to modify_cloud_to_device_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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}.
  • version_to_update (::Integer) — 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.
  • binary_data (::String) — Required. The configuration data for the device.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest.new

# Call the modify_cloud_to_device_config method.
result = client.modify_cloud_to_device_config request

# The returned object is of type Google::Cloud::Iot::V1::DeviceConfig.
p result

#send_command_to_device

def send_command_to_device(request, options = nil) -> ::Google::Cloud::Iot::V1::SendCommandToDeviceResponse
def send_command_to_device(name: nil, binary_data: nil, subfolder: nil) -> ::Google::Cloud::Iot::V1::SendCommandToDeviceResponse

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.

Overloads
def send_command_to_device(request, options = nil) -> ::Google::Cloud::Iot::V1::SendCommandToDeviceResponse
Pass arguments to send_command_to_device via a request object, either of type SendCommandToDeviceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::SendCommandToDeviceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def send_command_to_device(name: nil, binary_data: nil, subfolder: nil) -> ::Google::Cloud::Iot::V1::SendCommandToDeviceResponse
Pass arguments to send_command_to_device via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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 (::String) — Required. The command data to send to the device.
  • subfolder (::String) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::SendCommandToDeviceRequest.new

# Call the send_command_to_device method.
result = client.send_command_to_device request

# The returned object is of type Google::Cloud::Iot::V1::SendCommandToDeviceResponse.
p result

#set_iam_policy

def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

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

Overloads
def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via a request object, either of type Iam::V1::SetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::SetIamPolicyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — 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, ::Hash) — 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.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:

    paths: "bindings, etag"

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

#test_iam_permissions

def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

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.

Overloads
def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via a request object, either of type Iam::V1::TestIamPermissionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::TestIamPermissionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
  • permissions (::Array<::String>) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result

#unbind_device_from_gateway

def unbind_device_from_gateway(request, options = nil) -> ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse
def unbind_device_from_gateway(parent: nil, gateway_id: nil, device_id: nil) -> ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse

Deletes the association between the device and the gateway.

Overloads
def unbind_device_from_gateway(request, options = nil) -> ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse
Pass arguments to unbind_device_from_gateway via a request object, either of type UnbindDeviceFromGatewayRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def unbind_device_from_gateway(parent: nil, gateway_id: nil, device_id: nil) -> ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse
Pass arguments to unbind_device_from_gateway via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the registry. For example, projects/example-project/locations/us-central1/registries/my-registry.
  • gateway_id (::String) — Required. The value of gateway_id can be either the device numeric ID or the user-defined device identifier.
  • device_id (::String) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest.new

# Call the unbind_device_from_gateway method.
result = client.unbind_device_from_gateway request

# The returned object is of type Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse.
p result

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_device

def update_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
def update_device(device: nil, update_mask: nil) -> ::Google::Cloud::Iot::V1::Device

Updates a device.

Overloads
def update_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
Pass arguments to update_device via a request object, either of type UpdateDeviceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::UpdateDeviceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_device(device: nil, update_mask: nil) -> ::Google::Cloud::Iot::V1::Device
Pass arguments to update_device via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • device (::Google::Cloud::Iot::V1::Device, ::Hash) — 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, ::Hash) — 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
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::UpdateDeviceRequest.new

# Call the update_device method.
result = client.update_device request

# The returned object is of type Google::Cloud::Iot::V1::Device.
p result

#update_device_registry

def update_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
def update_device_registry(device_registry: nil, update_mask: nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry

Updates a device registry configuration.

Overloads
def update_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
Pass arguments to update_device_registry via a request object, either of type UpdateDeviceRegistryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_device_registry(device_registry: nil, update_mask: nil) -> ::Google::Cloud::Iot::V1::DeviceRegistry
Pass arguments to update_device_registry via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • device_registry (::Google::Cloud::Iot::V1::DeviceRegistry, ::Hash) — 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, ::Hash) — 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/iot/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Iot::V1::DeviceManager::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest.new

# Call the update_device_registry method.
result = client.update_device_registry request

# The returned object is of type Google::Cloud::Iot::V1::DeviceRegistry.
p result