class Google::Cloud::Iot::V1::DeviceManager::Client
Client
for the DeviceManager
service.
Internet of Things (IoT) service. Securely connect and manage IoT devices.
Attributes
@private
Public Class Methods
Configure the DeviceManager
Client
class.
See {::Google::Cloud::Iot::V1::DeviceManager::Client::Configuration} for a description of the configuration fields.
@example
# Modify the configuration for all DeviceManager clients ::Google::Cloud::Iot::V1::DeviceManager::Client.configure do |config| config.timeout = 10.0 end
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 56 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Iot", "V1"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.create_device_registry.timeout = 120.0 default_config.rpcs.get_device_registry.timeout = 120.0 default_config.rpcs.get_device_registry.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.update_device_registry.timeout = 120.0 default_config.rpcs.delete_device_registry.timeout = 120.0 default_config.rpcs.delete_device_registry.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.list_device_registries.timeout = 120.0 default_config.rpcs.list_device_registries.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.create_device.timeout = 120.0 default_config.rpcs.get_device.timeout = 120.0 default_config.rpcs.get_device.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.update_device.timeout = 120.0 default_config.rpcs.delete_device.timeout = 120.0 default_config.rpcs.delete_device.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.list_devices.timeout = 120.0 default_config.rpcs.list_devices.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.modify_cloud_to_device_config.timeout = 120.0 default_config.rpcs.modify_cloud_to_device_config.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4, 8] } default_config.rpcs.list_device_config_versions.timeout = 120.0 default_config.rpcs.list_device_config_versions.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.list_device_states.timeout = 120.0 default_config.rpcs.list_device_states.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.set_iam_policy.timeout = 120.0 default_config.rpcs.get_iam_policy.timeout = 120.0 default_config.rpcs.test_iam_permissions.timeout = 120.0 default_config.rpcs.send_command_to_device.timeout = 120.0 default_config.rpcs.send_command_to_device.retry_policy = { initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4, 8] } default_config.rpcs.bind_device_to_gateway.timeout = 120.0 default_config.rpcs.unbind_device_from_gateway.timeout = 120.0 default_config end yield @configure if block_given? @configure end
Create a new DeviceManager
client object.
@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
@yield [config] Configure the DeviceManager
client. @yieldparam config [Client::Configuration]
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 177 def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/cloud/iot/v1/device_manager_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @device_manager_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Iot::V1::DeviceManager::Stub, credentials: credentials, endpoint: @config.endpoint, channel_args: @config.channel_args, interceptors: @config.interceptors ) end
Public Instance Methods
Associates the device with the gateway.
@overload bind_device_to_gateway
(request, options = nil)
Pass arguments to `bind_device_to_gateway` via a request object, either of type {::Google::Cloud::Iot::V1::BindDeviceToGatewayRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload bind_device_to_gateway
(parent: nil, gateway_id: nil, device_id: nil)
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). @param parent [::String] Required. The name of the registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`. @param gateway_id [::String] Required. The value of `gateway_id` can be either the device numeric ID or the user-defined device identifier. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1549 def bind_device_to_gateway request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::BindDeviceToGatewayRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.bind_device_to_gateway.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.bind_device_to_gateway.timeout, metadata: metadata, retry_policy: @config.rpcs.bind_device_to_gateway.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :bind_device_to_gateway, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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 {::Google::Cloud::Iot::V1::DeviceManager::Client::Configuration} for a description of the configuration fields.
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 156 def configure yield @config if block_given? @config end
Creates a device in a device registry.
@overload create_device
(request, options = nil)
Pass arguments to `create_device` via a request object, either of type {::Google::Cloud::Iot::V1::CreateDeviceRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_device
(parent: nil, device: nil)
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). @param 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`. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::Device] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::Device]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 616 def create_device request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::CreateDeviceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_device.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_device.timeout, metadata: metadata, retry_policy: @config.rpcs.create_device.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :create_device, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Creates a device registry that contains devices.
@overload create_device_registry
(request, options = nil)
Pass arguments to `create_device_registry` via a request object, either of type {::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_device_registry
(parent: nil, device_registry: nil)
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). @param parent [::String] Required. The project and cloud region where this device registry must be created. For example, `projects/example-project/locations/us-central1`. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::DeviceRegistry] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::DeviceRegistry]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 249 def create_device_registry request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_device_registry.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_device_registry.timeout, metadata: metadata, retry_policy: @config.rpcs.create_device_registry.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :create_device_registry, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Deletes a device.
@overload delete_device
(request, options = nil)
Pass arguments to `delete_device` via a request object, either of type {::Google::Cloud::Iot::V1::DeleteDeviceRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_device
(name: nil)
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). @param 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}`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 836 def delete_device request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::DeleteDeviceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_device.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_device.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_device.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :delete_device, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Deletes a device registry configuration.
@overload delete_device_registry
(request, options = nil)
Pass arguments to `delete_device_registry` via a request object, either of type {::Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_device_registry
(name: nil)
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). @param name [::String] Required. The name of the device registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 463 def delete_device_registry request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_device_registry.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_device_registry.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_device_registry.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :delete_device_registry, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets details about a device.
@overload get_device
(request, options = nil)
Pass arguments to `get_device` via a request object, either of type {::Google::Cloud::Iot::V1::GetDeviceRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_device
(name: nil, field_mask: nil)
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). @param 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}`. @param 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`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::Device] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::Device]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 690 def get_device request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::GetDeviceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_device.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_device.timeout, metadata: metadata, retry_policy: @config.rpcs.get_device.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :get_device, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets a device registry configuration.
@overload get_device_registry
(request, options = nil)
Pass arguments to `get_device_registry` via a request object, either of type {::Google::Cloud::Iot::V1::GetDeviceRegistryRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_device_registry
(name: nil)
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). @param name [::String] Required. The name of the device registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::DeviceRegistry] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::DeviceRegistry]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 318 def get_device_registry request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::GetDeviceRegistryRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_device_registry.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_device_registry.timeout, metadata: metadata, retry_policy: @config.rpcs.get_device_registry.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :get_device_registry, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
@overload get_iam_policy
(request, options = nil)
Pass arguments to `get_iam_policy` via a request object, either of type {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_iam_policy
(resource: nil, options: nil)
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). @param resource [::String] REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash] OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. This field is only used by Cloud IAM.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Iam::V1::Policy] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Iam::V1::Policy]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1307 def get_iam_policy request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_iam_policy.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "resource" => request.resource } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout, metadata: metadata, retry_policy: @config.rpcs.get_iam_policy.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :get_iam_policy, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists the last few versions of the device configuration in descending order (i.e.: newest first).
@overload list_device_config_versions
(request, options = nil)
Pass arguments to `list_device_config_versions` via a request object, either of type {::Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_device_config_versions
(name: nil, num_versions: nil)
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). @param 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}`. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1083 def list_device_config_versions request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_device_config_versions.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_device_config_versions.timeout, metadata: metadata, retry_policy: @config.rpcs.list_device_config_versions.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :list_device_config_versions, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists device registries.
@overload list_device_registries
(request, options = nil)
Pass arguments to `list_device_registries` via a request object, either of type {::Google::Cloud::Iot::V1::ListDeviceRegistriesRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_device_registries
(parent: nil, page_size: nil, page_token: nil)
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). @param parent [::String] Required. The project and cloud region path. For example, `projects/example-project/locations/us-central1`. @param 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. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 541 def list_device_registries request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDeviceRegistriesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_device_registries.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_device_registries.timeout, metadata: metadata, retry_policy: @config.rpcs.list_device_registries.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :list_device_registries, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @device_manager_stub, :list_device_registries, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Lists the last few versions of the device state in descending order (i.e.: newest first).
@overload list_device_states
(request, options = nil)
Pass arguments to `list_device_states` via a request object, either of type {::Google::Cloud::Iot::V1::ListDeviceStatesRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_device_states
(name: nil, num_states: nil)
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). @param 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}`. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::ListDeviceStatesResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::ListDeviceStatesResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1158 def list_device_states request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDeviceStatesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_device_states.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_device_states.timeout, metadata: metadata, retry_policy: @config.rpcs.list_device_states.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :list_device_states, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
List devices in a device registry.
@overload list_devices
(request, options = nil)
Pass arguments to `list_devices` via a request object, either of type {::Google::Cloud::Iot::V1::ListDevicesRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_devices
(parent: nil, device_num_ids: nil, device_ids: nil, field_mask: nil, gateway_list_options: nil, page_size: nil, page_token: nil)
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). @param parent [::String] Required. The device registry path. Required. For example, `projects/my-project/locations/us-central1/registries/my-registry`. @param device_num_ids [::Array<::Integer>] A list of device numeric IDs. If empty, this field is ignored. Maximum IDs: 10,000. @param device_ids [::Array<::String>] A list of device string IDs. For example, `['device0', 'device12']`. If empty, this field is ignored. Maximum IDs: 10,000 @param 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`. @param gateway_list_options [::Google::Cloud::Iot::V1::GatewayListOptions, ::Hash] Options related to gateways. @param 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. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 927 def list_devices request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDevicesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_devices.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_devices.timeout, metadata: metadata, retry_policy: @config.rpcs.list_devices.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :list_devices, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @device_manager_stub, :list_devices, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Modifies the configuration for the device, which is eventually sent from the Cloud
IoT Core servers. Returns the modified configuration version and its metadata.
@overload modify_cloud_to_device_config
(request, options = nil)
Pass arguments to `modify_cloud_to_device_config` via a request object, either of type {::Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload modify_cloud_to_device_config
(name: nil, version_to_update: nil, binary_data: nil)
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). @param 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}`. @param 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. @param binary_data [::String] Required. The configuration data for the device.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::DeviceConfig] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::DeviceConfig]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1008 def modify_cloud_to_device_config request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.modify_cloud_to_device_config.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.modify_cloud_to_device_config.timeout, metadata: metadata, retry_policy: @config.rpcs.modify_cloud_to_device_config.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :modify_cloud_to_device_config, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload send_command_to_device
(request, options = nil)
Pass arguments to `send_command_to_device` via a request object, either of type {::Google::Cloud::Iot::V1::SendCommandToDeviceRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload send_command_to_device
(name: nil, binary_data: nil, subfolder: nil)
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). @param 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}`. @param binary_data [::String] Required. The command data to send to the device. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::SendCommandToDeviceResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::SendCommandToDeviceResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1473 def send_command_to_device request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::SendCommandToDeviceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.send_command_to_device.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.send_command_to_device.timeout, metadata: metadata, retry_policy: @config.rpcs.send_command_to_device.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :send_command_to_device, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Sets the access control policy on the specified resource. Replaces any existing policy.
@overload set_iam_policy
(request, options = nil)
Pass arguments to `set_iam_policy` via a request object, either of type {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload set_iam_policy
(resource: nil, policy: nil)
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). @param resource [::String] REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Iam::V1::Policy] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Iam::V1::Policy]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1233 def set_iam_policy request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.set_iam_policy.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "resource" => request.resource } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout, metadata: metadata, retry_policy: @config.rpcs.set_iam_policy.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :set_iam_policy, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
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.
@overload test_iam_permissions
(request, options = nil)
Pass arguments to `test_iam_permissions` via a request object, either of type {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload test_iam_permissions
(resource: nil, permissions: nil)
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). @param resource [::String] REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. @param 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](https://cloud.google.com/iam/docs/overview#permissions).
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Iam::V1::TestIamPermissionsResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1383 def test_iam_permissions request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.test_iam_permissions.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "resource" => request.resource } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout, metadata: metadata, retry_policy: @config.rpcs.test_iam_permissions.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Deletes the association between the device and the gateway.
@overload unbind_device_from_gateway
(request, options = nil)
Pass arguments to `unbind_device_from_gateway` via a request object, either of type {::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload unbind_device_from_gateway
(parent: nil, gateway_id: nil, device_id: nil)
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). @param parent [::String] Required. The name of the registry. For example, `projects/example-project/locations/us-central1/registries/my-registry`. @param gateway_id [::String] Required. The value of `gateway_id` can be either the device numeric ID or the user-defined device identifier. @param 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.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 1625 def unbind_device_from_gateway request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.unbind_device_from_gateway.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "parent" => request.parent } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.unbind_device_from_gateway.timeout, metadata: metadata, retry_policy: @config.rpcs.unbind_device_from_gateway.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :unbind_device_from_gateway, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Updates a device.
@overload update_device
(request, options = nil)
Pass arguments to `update_device` via a request object, either of type {::Google::Cloud::Iot::V1::UpdateDeviceRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload update_device
(device: nil, update_mask: nil)
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). @param 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/device0`or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. @param 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`
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::Device] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::Device]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 766 def update_device request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::UpdateDeviceRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.update_device.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "device.name" => request.device.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_device.timeout, metadata: metadata, retry_policy: @config.rpcs.update_device.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :update_device, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end
Updates a device registry configuration.
@overload update_device_registry
(request, options = nil)
Pass arguments to `update_device_registry` via a request object, either of type {::Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest} or an equivalent Hash. @param 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. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload update_device_registry
(device_registry: nil, update_mask: nil)
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). @param 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`. @param 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`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Iot::V1::DeviceRegistry] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Iot::V1::DeviceRegistry]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/iot/v1/device_manager/client.rb, line 394 def update_device_registry request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.update_device_registry.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Iot::V1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "device_registry.name" => request.device_registry.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_device_registry.timeout, metadata: metadata, retry_policy: @config.rpcs.update_device_registry.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @device_manager_stub.call_rpc :update_device_registry, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end