Reference documentation and code samples for the Cloud IoT V1 API class Google::Cloud::Iot::V1::DeviceManager::Rest::Client.
REST 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::ConfigurationConfigure the DeviceManager Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all DeviceManager clients ::Google::Cloud::Iot::V1::DeviceManager::Rest::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::BindDeviceToGatewayResponseAssociates the device with the gateway.
def bind_device_to_gateway(request, options = nil) -> ::Google::Cloud::Iot::V1::BindDeviceToGatewayResponsebind_device_to_gateway via a request object, either of type
BindDeviceToGatewayRequest or an equivalent Hash.
- 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::BindDeviceToGatewayResponsebind_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).
-
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_idcan 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_idcan be either the device numeric ID or the user-defined device identifier.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::ConfigurationConfigure 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_device
def create_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Device
def create_device(parent: nil, device: nil) -> ::Google::Cloud::Iot::V1::DeviceCreates a device in a device registry.
def create_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Devicecreate_device via a request object, either of type
CreateDeviceRequest or an equivalent Hash.
- 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::Devicecreate_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).
-
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
namemust be empty. The server generatesnamefrom the device registryidand theparentfield.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::Device)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::DeviceRegistryCreates a device registry that contains devices.
def create_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistrycreate_device_registry via a request object, either of type
CreateDeviceRegistryRequest or an equivalent Hash.
- 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::DeviceRegistrycreate_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).
-
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
namemust be empty. The server will generate that field from the device registryidprovided and theparentfield.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::DeviceRegistry)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::EmptyDeletes a device.
def delete_device(request, options = nil) -> ::Google::Protobuf::Emptydelete_device via a request object, either of type
Google::Cloud::Iot::V1::DeleteDeviceRequest or an equivalent Hash.
- 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::Emptydelete_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).
-
name (::String) — Required. The name of the device. For example,
projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/p0/locations/us-central1/registries/registry0/devices/{num_id}.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::EmptyDeletes a device registry configuration.
def delete_device_registry(request, options = nil) -> ::Google::Protobuf::Emptydelete_device_registry via a request object, either of type
Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest or an equivalent Hash.
- 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::Emptydelete_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).
-
name (::String) — Required. The name of the device registry. For example,
projects/example-project/locations/us-central1/registries/my-registry.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::DeviceGets details about a device.
def get_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Deviceget_device via a request object, either of type
GetDeviceRequest or an equivalent Hash.
- 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::Deviceget_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).
-
name (::String) — Required. The name of the device. For example,
projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/p0/locations/us-central1/registries/registry0/devices/{num_id}. -
field_mask (::Google::Protobuf::FieldMask, ::Hash) — The fields of the
Deviceresource 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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::Device)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::DeviceRegistryGets a device registry configuration.
def get_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistryget_device_registry via a request object, either of type
GetDeviceRegistryRequest or an equivalent Hash.
- 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::DeviceRegistryget_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).
-
name (::String) — Required. The name of the device registry. For example,
projects/example-project/locations/us-central1/registries/my-registry.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::DeviceRegistry)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::PolicyGets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policyget_iam_policy via a request object, either of type
Iam::V1::GetIamPolicyRequest or an equivalent Hash.
- 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::Policyget_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).
- 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
GetPolicyOptionsobject for specifying options toGetIamPolicy.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Iam::V1::Policy)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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| ... } -> ClientCreate a new DeviceManager REST client object.
- (config) — Configure the DeviceManager client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Iot::V1::DeviceManager::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Iot::V1::DeviceManager::Rest::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::ListDeviceConfigVersionsResponseLists the last few versions of the device configuration in descending order (i.e.: newest first).
def list_device_config_versions(request, options = nil) -> ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponselist_device_config_versions via a request object, either of type
ListDeviceConfigVersionsRequest or an equivalent Hash.
- 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::ListDeviceConfigVersionsResponselist_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).
-
name (::String) — Required. The name of the device. For example,
projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>
def list_device_registries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>Lists device registries.
def list_device_registries(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>list_device_registries via a request object, either of type
ListDeviceRegistriesRequest or an equivalent Hash.
- 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::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>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).
-
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_tokenin 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 priorListDeviceRegistriescall and the system should return the next page of data.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::ListDeviceStatesResponseLists the last few versions of the device state in descending order (i.e.: newest first).
def list_device_states(request, options = nil) -> ::Google::Cloud::Iot::V1::ListDeviceStatesResponselist_device_states via a request object, either of type
ListDeviceStatesRequest or an equivalent Hash.
- 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::ListDeviceStatesResponselist_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).
-
name (::String) — Required. The name of the device. For example,
projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::ListDeviceStatesResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::Rest::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::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::Device>List devices in a device registry.
def list_devices(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::Device>list_devices via a request object, either of type
ListDevicesRequest or an equivalent Hash.
- 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::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::Device>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).
-
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
Deviceresource to be returned in the response. The fieldsidandnum_idare 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_tokenin 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 priorListDevicescall and the system should return the next page of data.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::Device>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iot::V1::Device>)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::DeviceConfigModifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata.
def modify_cloud_to_device_config(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceConfigmodify_cloud_to_device_config via a request object, either of type
ModifyCloudToDeviceConfigRequest or an equivalent Hash.
- 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::DeviceConfigmodify_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).
-
name (::String) — Required. The name of the device. For example,
projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::DeviceConfig)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::SendCommandToDeviceResponseSends 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.
def send_command_to_device(request, options = nil) -> ::Google::Cloud::Iot::V1::SendCommandToDeviceResponsesend_command_to_device via a request object, either of type
SendCommandToDeviceRequest or an equivalent Hash.
- 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::SendCommandToDeviceResponsesend_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).
-
name (::String) — Required. The name of the device. For example,
projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::SendCommandToDeviceResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::PolicySets the access control policy on the specified resource. Replaces any existing policy.
def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policyset_iam_policy via a request object, either of type
Iam::V1::SetIamPolicyRequest or an equivalent Hash.
- 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::Policyset_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).
- 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"
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Iam::V1::Policy)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::TestIamPermissionsResponseReturns 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.
def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponsetest_iam_permissions via a request object, either of type
Iam::V1::TestIamPermissionsRequest or an equivalent Hash.
- 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::TestIamPermissionsResponsetest_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).
- 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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Iam::V1::TestIamPermissionsResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::UnbindDeviceFromGatewayResponseDeletes the association between the device and the gateway.
def unbind_device_from_gateway(request, options = nil) -> ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponseunbind_device_from_gateway via a request object, either of type
UnbindDeviceFromGatewayRequest or an equivalent Hash.
- 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::UnbindDeviceFromGatewayResponseunbind_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).
-
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_idcan 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_idcan be either the device numeric ID or the user-defined device identifier.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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() -> StringThe effective universe domain
- (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::DeviceUpdates a device.
def update_device(request, options = nil) -> ::Google::Cloud::Iot::V1::Deviceupdate_device via a request object, either of type
UpdateDeviceRequest or an equivalent Hash.
- 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::Deviceupdate_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).
-
device (::Google::Cloud::Iot::V1::Device, ::Hash) — Required. The new values for the device. The
idandnum_idfields must be empty, and the fieldnamemust specify the name path. For example,projects/p0/locations/us-central1/registries/registry0/devices/device0orprojects/p0/locations/us-central1/registries/registry0/devices/{num_id}. -
update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. Only updates the
devicefields 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, andmetadata
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::Device)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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::DeviceRegistryUpdates a device registry configuration.
def update_device_registry(request, options = nil) -> ::Google::Cloud::Iot::V1::DeviceRegistryupdate_device_registry via a request object, either of type
UpdateDeviceRegistryRequest or an equivalent Hash.
- 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::DeviceRegistryupdate_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).
-
device_registry (::Google::Cloud::Iot::V1::DeviceRegistry, ::Hash) — Required. The new values for the device registry. The
idfield must be empty, and thenamefield 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_registryfields 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, andstate_notification_config.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Iot::V1::DeviceRegistry)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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