google-cloud-iot-v1 0.9.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -143
- data/lib/google/cloud/iot/v1/version.rb +3 -8
- metadata +15 -203
- data/.yardopts +0 -12
- data/AUTHENTICATION.md +0 -122
- data/lib/google/cloud/iot/v1/device_manager/client.rb +0 -2316
- data/lib/google/cloud/iot/v1/device_manager/credentials.rb +0 -52
- data/lib/google/cloud/iot/v1/device_manager/paths.rb +0 -90
- data/lib/google/cloud/iot/v1/device_manager/rest/client.rb +0 -2157
- data/lib/google/cloud/iot/v1/device_manager/rest/service_stub.rb +0 -1293
- data/lib/google/cloud/iot/v1/device_manager/rest.rb +0 -52
- data/lib/google/cloud/iot/v1/device_manager.rb +0 -55
- data/lib/google/cloud/iot/v1/device_manager_pb.rb +0 -77
- data/lib/google/cloud/iot/v1/device_manager_services_pb.rb +0 -102
- data/lib/google/cloud/iot/v1/resources_pb.rb +0 -68
- data/lib/google/cloud/iot/v1/rest.rb +0 -37
- data/lib/google/cloud/iot/v1.rb +0 -45
- data/lib/google-cloud-iot-v1.rb +0 -21
- data/proto_docs/README.md +0 -4
- data/proto_docs/google/api/client.rb +0 -395
- data/proto_docs/google/api/field_behavior.rb +0 -85
- data/proto_docs/google/api/launch_stage.rb +0 -71
- data/proto_docs/google/api/resource.rb +0 -222
- data/proto_docs/google/cloud/iot/v1/device_manager.rb +0 -399
- data/proto_docs/google/cloud/iot/v1/resources.rb +0 -517
- data/proto_docs/google/iam/v1/iam_policy.rb +0 -87
- data/proto_docs/google/iam/v1/options.rb +0 -50
- data/proto_docs/google/iam/v1/policy.rb +0 -426
- data/proto_docs/google/protobuf/any.rb +0 -144
- data/proto_docs/google/protobuf/duration.rb +0 -98
- data/proto_docs/google/protobuf/empty.rb +0 -34
- data/proto_docs/google/protobuf/field_mask.rb +0 -229
- data/proto_docs/google/protobuf/timestamp.rb +0 -127
- data/proto_docs/google/rpc/status.rb +0 -48
- data/proto_docs/google/type/expr.rb +0 -75
@@ -1,2316 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2020 Google LLC
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
-
|
19
|
-
require "google/cloud/errors"
|
20
|
-
require "google/cloud/iot/v1/device_manager_pb"
|
21
|
-
|
22
|
-
module Google
|
23
|
-
module Cloud
|
24
|
-
module Iot
|
25
|
-
module V1
|
26
|
-
module DeviceManager
|
27
|
-
##
|
28
|
-
# Client for the DeviceManager service.
|
29
|
-
#
|
30
|
-
# Internet of Things (IoT) service. Securely connect and manage IoT devices.
|
31
|
-
#
|
32
|
-
class Client
|
33
|
-
# @private
|
34
|
-
DEFAULT_ENDPOINT_TEMPLATE = "cloudiot.$UNIVERSE_DOMAIN$"
|
35
|
-
|
36
|
-
include Paths
|
37
|
-
|
38
|
-
# @private
|
39
|
-
attr_reader :device_manager_stub
|
40
|
-
|
41
|
-
##
|
42
|
-
# Configure the DeviceManager Client class.
|
43
|
-
#
|
44
|
-
# See {::Google::Cloud::Iot::V1::DeviceManager::Client::Configuration}
|
45
|
-
# for a description of the configuration fields.
|
46
|
-
#
|
47
|
-
# @example
|
48
|
-
#
|
49
|
-
# # Modify the configuration for all DeviceManager clients
|
50
|
-
# ::Google::Cloud::Iot::V1::DeviceManager::Client.configure do |config|
|
51
|
-
# config.timeout = 10.0
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
# @yield [config] Configure the Client client.
|
55
|
-
# @yieldparam config [Client::Configuration]
|
56
|
-
#
|
57
|
-
# @return [Client::Configuration]
|
58
|
-
#
|
59
|
-
def self.configure
|
60
|
-
@configure ||= begin
|
61
|
-
namespace = ["Google", "Cloud", "Iot", "V1"]
|
62
|
-
parent_config = while namespace.any?
|
63
|
-
parent_name = namespace.join "::"
|
64
|
-
parent_const = const_get parent_name
|
65
|
-
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
-
namespace.pop
|
67
|
-
end
|
68
|
-
default_config = Client::Configuration.new parent_config
|
69
|
-
|
70
|
-
default_config.rpcs.create_device_registry.timeout = 120.0
|
71
|
-
|
72
|
-
default_config.rpcs.get_device_registry.timeout = 120.0
|
73
|
-
default_config.rpcs.get_device_registry.retry_policy = {
|
74
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
75
|
-
}
|
76
|
-
|
77
|
-
default_config.rpcs.update_device_registry.timeout = 120.0
|
78
|
-
|
79
|
-
default_config.rpcs.delete_device_registry.timeout = 120.0
|
80
|
-
default_config.rpcs.delete_device_registry.retry_policy = {
|
81
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
82
|
-
}
|
83
|
-
|
84
|
-
default_config.rpcs.list_device_registries.timeout = 120.0
|
85
|
-
default_config.rpcs.list_device_registries.retry_policy = {
|
86
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
87
|
-
}
|
88
|
-
|
89
|
-
default_config.rpcs.create_device.timeout = 120.0
|
90
|
-
|
91
|
-
default_config.rpcs.get_device.timeout = 120.0
|
92
|
-
default_config.rpcs.get_device.retry_policy = {
|
93
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
94
|
-
}
|
95
|
-
|
96
|
-
default_config.rpcs.update_device.timeout = 120.0
|
97
|
-
|
98
|
-
default_config.rpcs.delete_device.timeout = 120.0
|
99
|
-
default_config.rpcs.delete_device.retry_policy = {
|
100
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
101
|
-
}
|
102
|
-
|
103
|
-
default_config.rpcs.list_devices.timeout = 120.0
|
104
|
-
default_config.rpcs.list_devices.retry_policy = {
|
105
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
106
|
-
}
|
107
|
-
|
108
|
-
default_config.rpcs.modify_cloud_to_device_config.timeout = 120.0
|
109
|
-
default_config.rpcs.modify_cloud_to_device_config.retry_policy = {
|
110
|
-
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4, 8]
|
111
|
-
}
|
112
|
-
|
113
|
-
default_config.rpcs.list_device_config_versions.timeout = 120.0
|
114
|
-
default_config.rpcs.list_device_config_versions.retry_policy = {
|
115
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
116
|
-
}
|
117
|
-
|
118
|
-
default_config.rpcs.list_device_states.timeout = 120.0
|
119
|
-
default_config.rpcs.list_device_states.retry_policy = {
|
120
|
-
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
121
|
-
}
|
122
|
-
|
123
|
-
default_config.rpcs.set_iam_policy.timeout = 120.0
|
124
|
-
|
125
|
-
default_config.rpcs.get_iam_policy.timeout = 120.0
|
126
|
-
|
127
|
-
default_config.rpcs.test_iam_permissions.timeout = 120.0
|
128
|
-
|
129
|
-
default_config.rpcs.send_command_to_device.timeout = 120.0
|
130
|
-
default_config.rpcs.send_command_to_device.retry_policy = {
|
131
|
-
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4, 8]
|
132
|
-
}
|
133
|
-
|
134
|
-
default_config.rpcs.bind_device_to_gateway.timeout = 120.0
|
135
|
-
|
136
|
-
default_config.rpcs.unbind_device_from_gateway.timeout = 120.0
|
137
|
-
|
138
|
-
default_config
|
139
|
-
end
|
140
|
-
yield @configure if block_given?
|
141
|
-
@configure
|
142
|
-
end
|
143
|
-
|
144
|
-
##
|
145
|
-
# Configure the DeviceManager Client instance.
|
146
|
-
#
|
147
|
-
# The configuration is set to the derived mode, meaning that values can be changed,
|
148
|
-
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
149
|
-
# should be made on {Client.configure}.
|
150
|
-
#
|
151
|
-
# See {::Google::Cloud::Iot::V1::DeviceManager::Client::Configuration}
|
152
|
-
# for a description of the configuration fields.
|
153
|
-
#
|
154
|
-
# @yield [config] Configure the Client client.
|
155
|
-
# @yieldparam config [Client::Configuration]
|
156
|
-
#
|
157
|
-
# @return [Client::Configuration]
|
158
|
-
#
|
159
|
-
def configure
|
160
|
-
yield @config if block_given?
|
161
|
-
@config
|
162
|
-
end
|
163
|
-
|
164
|
-
##
|
165
|
-
# The effective universe domain
|
166
|
-
#
|
167
|
-
# @return [String]
|
168
|
-
#
|
169
|
-
def universe_domain
|
170
|
-
@device_manager_stub.universe_domain
|
171
|
-
end
|
172
|
-
|
173
|
-
##
|
174
|
-
# Create a new DeviceManager client object.
|
175
|
-
#
|
176
|
-
# @example
|
177
|
-
#
|
178
|
-
# # Create a client using the default configuration
|
179
|
-
# client = ::Google::Cloud::Iot::V1::DeviceManager::Client.new
|
180
|
-
#
|
181
|
-
# # Create a client using a custom configuration
|
182
|
-
# client = ::Google::Cloud::Iot::V1::DeviceManager::Client.new do |config|
|
183
|
-
# config.timeout = 10.0
|
184
|
-
# end
|
185
|
-
#
|
186
|
-
# @yield [config] Configure the DeviceManager client.
|
187
|
-
# @yieldparam config [Client::Configuration]
|
188
|
-
#
|
189
|
-
def initialize
|
190
|
-
# These require statements are intentionally placed here to initialize
|
191
|
-
# the gRPC module only when it's required.
|
192
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
193
|
-
require "gapic/grpc"
|
194
|
-
require "google/cloud/iot/v1/device_manager_services_pb"
|
195
|
-
|
196
|
-
# Create the configuration object
|
197
|
-
@config = Configuration.new Client.configure
|
198
|
-
|
199
|
-
# Yield the configuration if needed
|
200
|
-
yield @config if block_given?
|
201
|
-
|
202
|
-
# Create credentials
|
203
|
-
credentials = @config.credentials
|
204
|
-
# Use self-signed JWT if the endpoint is unchanged from default,
|
205
|
-
# but only if the default endpoint does not have a region prefix.
|
206
|
-
enable_self_signed_jwt = @config.endpoint.nil? ||
|
207
|
-
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
208
|
-
!@config.endpoint.split(".").first.include?("-"))
|
209
|
-
credentials ||= Credentials.default scope: @config.scope,
|
210
|
-
enable_self_signed_jwt: enable_self_signed_jwt
|
211
|
-
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
212
|
-
credentials = Credentials.new credentials, scope: @config.scope
|
213
|
-
end
|
214
|
-
@quota_project_id = @config.quota_project
|
215
|
-
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
216
|
-
|
217
|
-
@device_manager_stub = ::Gapic::ServiceStub.new(
|
218
|
-
::Google::Cloud::Iot::V1::DeviceManager::Stub,
|
219
|
-
credentials: credentials,
|
220
|
-
endpoint: @config.endpoint,
|
221
|
-
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
222
|
-
universe_domain: @config.universe_domain,
|
223
|
-
channel_args: @config.channel_args,
|
224
|
-
interceptors: @config.interceptors,
|
225
|
-
channel_pool_config: @config.channel_pool
|
226
|
-
)
|
227
|
-
end
|
228
|
-
|
229
|
-
# Service calls
|
230
|
-
|
231
|
-
##
|
232
|
-
# Creates a device registry that contains devices.
|
233
|
-
#
|
234
|
-
# @overload create_device_registry(request, options = nil)
|
235
|
-
# Pass arguments to `create_device_registry` via a request object, either of type
|
236
|
-
# {::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest} or an equivalent Hash.
|
237
|
-
#
|
238
|
-
# @param request [::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest, ::Hash]
|
239
|
-
# A request object representing the call parameters. Required. To specify no
|
240
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
241
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
242
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
243
|
-
#
|
244
|
-
# @overload create_device_registry(parent: nil, device_registry: nil)
|
245
|
-
# Pass arguments to `create_device_registry` via keyword arguments. Note that at
|
246
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
247
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
248
|
-
#
|
249
|
-
# @param parent [::String]
|
250
|
-
# Required. The project and cloud region where this device registry must be created.
|
251
|
-
# For example, `projects/example-project/locations/us-central1`.
|
252
|
-
# @param device_registry [::Google::Cloud::Iot::V1::DeviceRegistry, ::Hash]
|
253
|
-
# Required. The device registry. The field `name` must be empty. The server will
|
254
|
-
# generate that field from the device registry `id` provided and the
|
255
|
-
# `parent` field.
|
256
|
-
#
|
257
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
258
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::DeviceRegistry]
|
259
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
260
|
-
#
|
261
|
-
# @return [::Google::Cloud::Iot::V1::DeviceRegistry]
|
262
|
-
#
|
263
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
264
|
-
#
|
265
|
-
# @example Basic example
|
266
|
-
# require "google/cloud/iot/v1"
|
267
|
-
#
|
268
|
-
# # Create a client object. The client can be reused for multiple calls.
|
269
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
270
|
-
#
|
271
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
272
|
-
# request = Google::Cloud::Iot::V1::CreateDeviceRegistryRequest.new
|
273
|
-
#
|
274
|
-
# # Call the create_device_registry method.
|
275
|
-
# result = client.create_device_registry request
|
276
|
-
#
|
277
|
-
# # The returned object is of type Google::Cloud::Iot::V1::DeviceRegistry.
|
278
|
-
# p result
|
279
|
-
#
|
280
|
-
def create_device_registry request, options = nil
|
281
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
282
|
-
|
283
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest
|
284
|
-
|
285
|
-
# Converts hash and nil to an options object
|
286
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
287
|
-
|
288
|
-
# Customize the options with defaults
|
289
|
-
metadata = @config.rpcs.create_device_registry.metadata.to_h
|
290
|
-
|
291
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
292
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
293
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
294
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
295
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
296
|
-
|
297
|
-
header_params = {}
|
298
|
-
if request.parent
|
299
|
-
header_params["parent"] = request.parent
|
300
|
-
end
|
301
|
-
|
302
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
303
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
304
|
-
|
305
|
-
options.apply_defaults timeout: @config.rpcs.create_device_registry.timeout,
|
306
|
-
metadata: metadata,
|
307
|
-
retry_policy: @config.rpcs.create_device_registry.retry_policy
|
308
|
-
|
309
|
-
options.apply_defaults timeout: @config.timeout,
|
310
|
-
metadata: @config.metadata,
|
311
|
-
retry_policy: @config.retry_policy
|
312
|
-
|
313
|
-
@device_manager_stub.call_rpc :create_device_registry, request, options: options do |response, operation|
|
314
|
-
yield response, operation if block_given?
|
315
|
-
return response
|
316
|
-
end
|
317
|
-
rescue ::GRPC::BadStatus => e
|
318
|
-
raise ::Google::Cloud::Error.from_error(e)
|
319
|
-
end
|
320
|
-
|
321
|
-
##
|
322
|
-
# Gets a device registry configuration.
|
323
|
-
#
|
324
|
-
# @overload get_device_registry(request, options = nil)
|
325
|
-
# Pass arguments to `get_device_registry` via a request object, either of type
|
326
|
-
# {::Google::Cloud::Iot::V1::GetDeviceRegistryRequest} or an equivalent Hash.
|
327
|
-
#
|
328
|
-
# @param request [::Google::Cloud::Iot::V1::GetDeviceRegistryRequest, ::Hash]
|
329
|
-
# A request object representing the call parameters. Required. To specify no
|
330
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
331
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
332
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
333
|
-
#
|
334
|
-
# @overload get_device_registry(name: nil)
|
335
|
-
# Pass arguments to `get_device_registry` via keyword arguments. Note that at
|
336
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
337
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
338
|
-
#
|
339
|
-
# @param name [::String]
|
340
|
-
# Required. The name of the device registry. For example,
|
341
|
-
# `projects/example-project/locations/us-central1/registries/my-registry`.
|
342
|
-
#
|
343
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
344
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::DeviceRegistry]
|
345
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
346
|
-
#
|
347
|
-
# @return [::Google::Cloud::Iot::V1::DeviceRegistry]
|
348
|
-
#
|
349
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
350
|
-
#
|
351
|
-
# @example Basic example
|
352
|
-
# require "google/cloud/iot/v1"
|
353
|
-
#
|
354
|
-
# # Create a client object. The client can be reused for multiple calls.
|
355
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
356
|
-
#
|
357
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
358
|
-
# request = Google::Cloud::Iot::V1::GetDeviceRegistryRequest.new
|
359
|
-
#
|
360
|
-
# # Call the get_device_registry method.
|
361
|
-
# result = client.get_device_registry request
|
362
|
-
#
|
363
|
-
# # The returned object is of type Google::Cloud::Iot::V1::DeviceRegistry.
|
364
|
-
# p result
|
365
|
-
#
|
366
|
-
def get_device_registry request, options = nil
|
367
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
368
|
-
|
369
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::GetDeviceRegistryRequest
|
370
|
-
|
371
|
-
# Converts hash and nil to an options object
|
372
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
373
|
-
|
374
|
-
# Customize the options with defaults
|
375
|
-
metadata = @config.rpcs.get_device_registry.metadata.to_h
|
376
|
-
|
377
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
378
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
379
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
380
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
381
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
382
|
-
|
383
|
-
header_params = {}
|
384
|
-
if request.name
|
385
|
-
header_params["name"] = request.name
|
386
|
-
end
|
387
|
-
|
388
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
389
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
390
|
-
|
391
|
-
options.apply_defaults timeout: @config.rpcs.get_device_registry.timeout,
|
392
|
-
metadata: metadata,
|
393
|
-
retry_policy: @config.rpcs.get_device_registry.retry_policy
|
394
|
-
|
395
|
-
options.apply_defaults timeout: @config.timeout,
|
396
|
-
metadata: @config.metadata,
|
397
|
-
retry_policy: @config.retry_policy
|
398
|
-
|
399
|
-
@device_manager_stub.call_rpc :get_device_registry, request, options: options do |response, operation|
|
400
|
-
yield response, operation if block_given?
|
401
|
-
return response
|
402
|
-
end
|
403
|
-
rescue ::GRPC::BadStatus => e
|
404
|
-
raise ::Google::Cloud::Error.from_error(e)
|
405
|
-
end
|
406
|
-
|
407
|
-
##
|
408
|
-
# Updates a device registry configuration.
|
409
|
-
#
|
410
|
-
# @overload update_device_registry(request, options = nil)
|
411
|
-
# Pass arguments to `update_device_registry` via a request object, either of type
|
412
|
-
# {::Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest} or an equivalent Hash.
|
413
|
-
#
|
414
|
-
# @param request [::Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest, ::Hash]
|
415
|
-
# A request object representing the call parameters. Required. To specify no
|
416
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
417
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
418
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
419
|
-
#
|
420
|
-
# @overload update_device_registry(device_registry: nil, update_mask: nil)
|
421
|
-
# Pass arguments to `update_device_registry` via keyword arguments. Note that at
|
422
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
423
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
424
|
-
#
|
425
|
-
# @param device_registry [::Google::Cloud::Iot::V1::DeviceRegistry, ::Hash]
|
426
|
-
# Required. The new values for the device registry. The `id` field must be empty, and
|
427
|
-
# the `name` field must indicate the path of the resource. For example,
|
428
|
-
# `projects/example-project/locations/us-central1/registries/my-registry`.
|
429
|
-
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
430
|
-
# Required. Only updates the `device_registry` fields indicated by this mask.
|
431
|
-
# The field mask must not be empty, and it must not contain fields that
|
432
|
-
# are immutable or only set by the server.
|
433
|
-
# Mutable top-level fields: `event_notification_config`, `http_config`,
|
434
|
-
# `mqtt_config`, and `state_notification_config`.
|
435
|
-
#
|
436
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
437
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::DeviceRegistry]
|
438
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
439
|
-
#
|
440
|
-
# @return [::Google::Cloud::Iot::V1::DeviceRegistry]
|
441
|
-
#
|
442
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
443
|
-
#
|
444
|
-
# @example Basic example
|
445
|
-
# require "google/cloud/iot/v1"
|
446
|
-
#
|
447
|
-
# # Create a client object. The client can be reused for multiple calls.
|
448
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
449
|
-
#
|
450
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
451
|
-
# request = Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest.new
|
452
|
-
#
|
453
|
-
# # Call the update_device_registry method.
|
454
|
-
# result = client.update_device_registry request
|
455
|
-
#
|
456
|
-
# # The returned object is of type Google::Cloud::Iot::V1::DeviceRegistry.
|
457
|
-
# p result
|
458
|
-
#
|
459
|
-
def update_device_registry request, options = nil
|
460
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
461
|
-
|
462
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::UpdateDeviceRegistryRequest
|
463
|
-
|
464
|
-
# Converts hash and nil to an options object
|
465
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
466
|
-
|
467
|
-
# Customize the options with defaults
|
468
|
-
metadata = @config.rpcs.update_device_registry.metadata.to_h
|
469
|
-
|
470
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
471
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
472
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
473
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
474
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
475
|
-
|
476
|
-
header_params = {}
|
477
|
-
if request.device_registry&.name
|
478
|
-
header_params["device_registry.name"] = request.device_registry.name
|
479
|
-
end
|
480
|
-
|
481
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
482
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
483
|
-
|
484
|
-
options.apply_defaults timeout: @config.rpcs.update_device_registry.timeout,
|
485
|
-
metadata: metadata,
|
486
|
-
retry_policy: @config.rpcs.update_device_registry.retry_policy
|
487
|
-
|
488
|
-
options.apply_defaults timeout: @config.timeout,
|
489
|
-
metadata: @config.metadata,
|
490
|
-
retry_policy: @config.retry_policy
|
491
|
-
|
492
|
-
@device_manager_stub.call_rpc :update_device_registry, request, options: options do |response, operation|
|
493
|
-
yield response, operation if block_given?
|
494
|
-
return response
|
495
|
-
end
|
496
|
-
rescue ::GRPC::BadStatus => e
|
497
|
-
raise ::Google::Cloud::Error.from_error(e)
|
498
|
-
end
|
499
|
-
|
500
|
-
##
|
501
|
-
# Deletes a device registry configuration.
|
502
|
-
#
|
503
|
-
# @overload delete_device_registry(request, options = nil)
|
504
|
-
# Pass arguments to `delete_device_registry` via a request object, either of type
|
505
|
-
# {::Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest} or an equivalent Hash.
|
506
|
-
#
|
507
|
-
# @param request [::Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest, ::Hash]
|
508
|
-
# A request object representing the call parameters. Required. To specify no
|
509
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
510
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
511
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
512
|
-
#
|
513
|
-
# @overload delete_device_registry(name: nil)
|
514
|
-
# Pass arguments to `delete_device_registry` via keyword arguments. Note that at
|
515
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
516
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
517
|
-
#
|
518
|
-
# @param name [::String]
|
519
|
-
# Required. The name of the device registry. For example,
|
520
|
-
# `projects/example-project/locations/us-central1/registries/my-registry`.
|
521
|
-
#
|
522
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
523
|
-
# @yieldparam response [::Google::Protobuf::Empty]
|
524
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
525
|
-
#
|
526
|
-
# @return [::Google::Protobuf::Empty]
|
527
|
-
#
|
528
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
529
|
-
#
|
530
|
-
# @example Basic example
|
531
|
-
# require "google/cloud/iot/v1"
|
532
|
-
#
|
533
|
-
# # Create a client object. The client can be reused for multiple calls.
|
534
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
535
|
-
#
|
536
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
537
|
-
# request = Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest.new
|
538
|
-
#
|
539
|
-
# # Call the delete_device_registry method.
|
540
|
-
# result = client.delete_device_registry request
|
541
|
-
#
|
542
|
-
# # The returned object is of type Google::Protobuf::Empty.
|
543
|
-
# p result
|
544
|
-
#
|
545
|
-
def delete_device_registry request, options = nil
|
546
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
547
|
-
|
548
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::DeleteDeviceRegistryRequest
|
549
|
-
|
550
|
-
# Converts hash and nil to an options object
|
551
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
552
|
-
|
553
|
-
# Customize the options with defaults
|
554
|
-
metadata = @config.rpcs.delete_device_registry.metadata.to_h
|
555
|
-
|
556
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
557
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
558
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
559
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
560
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
561
|
-
|
562
|
-
header_params = {}
|
563
|
-
if request.name
|
564
|
-
header_params["name"] = request.name
|
565
|
-
end
|
566
|
-
|
567
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
568
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
569
|
-
|
570
|
-
options.apply_defaults timeout: @config.rpcs.delete_device_registry.timeout,
|
571
|
-
metadata: metadata,
|
572
|
-
retry_policy: @config.rpcs.delete_device_registry.retry_policy
|
573
|
-
|
574
|
-
options.apply_defaults timeout: @config.timeout,
|
575
|
-
metadata: @config.metadata,
|
576
|
-
retry_policy: @config.retry_policy
|
577
|
-
|
578
|
-
@device_manager_stub.call_rpc :delete_device_registry, request, options: options do |response, operation|
|
579
|
-
yield response, operation if block_given?
|
580
|
-
return response
|
581
|
-
end
|
582
|
-
rescue ::GRPC::BadStatus => e
|
583
|
-
raise ::Google::Cloud::Error.from_error(e)
|
584
|
-
end
|
585
|
-
|
586
|
-
##
|
587
|
-
# Lists device registries.
|
588
|
-
#
|
589
|
-
# @overload list_device_registries(request, options = nil)
|
590
|
-
# Pass arguments to `list_device_registries` via a request object, either of type
|
591
|
-
# {::Google::Cloud::Iot::V1::ListDeviceRegistriesRequest} or an equivalent Hash.
|
592
|
-
#
|
593
|
-
# @param request [::Google::Cloud::Iot::V1::ListDeviceRegistriesRequest, ::Hash]
|
594
|
-
# A request object representing the call parameters. Required. To specify no
|
595
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
596
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
597
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
598
|
-
#
|
599
|
-
# @overload list_device_registries(parent: nil, page_size: nil, page_token: nil)
|
600
|
-
# Pass arguments to `list_device_registries` via keyword arguments. Note that at
|
601
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
602
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
603
|
-
#
|
604
|
-
# @param parent [::String]
|
605
|
-
# Required. The project and cloud region path. For example,
|
606
|
-
# `projects/example-project/locations/us-central1`.
|
607
|
-
# @param page_size [::Integer]
|
608
|
-
# The maximum number of registries to return in the response. If this value
|
609
|
-
# is zero, the service will select a default size. A call may return fewer
|
610
|
-
# objects than requested. A non-empty `next_page_token` in the response
|
611
|
-
# indicates that more data is available.
|
612
|
-
# @param page_token [::String]
|
613
|
-
# The value returned by the last `ListDeviceRegistriesResponse`; indicates
|
614
|
-
# that this is a continuation of a prior `ListDeviceRegistries` call and
|
615
|
-
# the system should return the next page of data.
|
616
|
-
#
|
617
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
618
|
-
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>]
|
619
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
620
|
-
#
|
621
|
-
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::DeviceRegistry>]
|
622
|
-
#
|
623
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
624
|
-
#
|
625
|
-
# @example Basic example
|
626
|
-
# require "google/cloud/iot/v1"
|
627
|
-
#
|
628
|
-
# # Create a client object. The client can be reused for multiple calls.
|
629
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
630
|
-
#
|
631
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
632
|
-
# request = Google::Cloud::Iot::V1::ListDeviceRegistriesRequest.new
|
633
|
-
#
|
634
|
-
# # Call the list_device_registries method.
|
635
|
-
# result = client.list_device_registries request
|
636
|
-
#
|
637
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
638
|
-
# # over elements, and API calls will be issued to fetch pages as needed.
|
639
|
-
# result.each do |item|
|
640
|
-
# # Each element is of type ::Google::Cloud::Iot::V1::DeviceRegistry.
|
641
|
-
# p item
|
642
|
-
# end
|
643
|
-
#
|
644
|
-
def list_device_registries request, options = nil
|
645
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
646
|
-
|
647
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDeviceRegistriesRequest
|
648
|
-
|
649
|
-
# Converts hash and nil to an options object
|
650
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
651
|
-
|
652
|
-
# Customize the options with defaults
|
653
|
-
metadata = @config.rpcs.list_device_registries.metadata.to_h
|
654
|
-
|
655
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
656
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
657
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
658
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
659
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
660
|
-
|
661
|
-
header_params = {}
|
662
|
-
if request.parent
|
663
|
-
header_params["parent"] = request.parent
|
664
|
-
end
|
665
|
-
|
666
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
667
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
668
|
-
|
669
|
-
options.apply_defaults timeout: @config.rpcs.list_device_registries.timeout,
|
670
|
-
metadata: metadata,
|
671
|
-
retry_policy: @config.rpcs.list_device_registries.retry_policy
|
672
|
-
|
673
|
-
options.apply_defaults timeout: @config.timeout,
|
674
|
-
metadata: @config.metadata,
|
675
|
-
retry_policy: @config.retry_policy
|
676
|
-
|
677
|
-
@device_manager_stub.call_rpc :list_device_registries, request, options: options do |response, operation|
|
678
|
-
response = ::Gapic::PagedEnumerable.new @device_manager_stub, :list_device_registries, request, response, operation, options
|
679
|
-
yield response, operation if block_given?
|
680
|
-
return response
|
681
|
-
end
|
682
|
-
rescue ::GRPC::BadStatus => e
|
683
|
-
raise ::Google::Cloud::Error.from_error(e)
|
684
|
-
end
|
685
|
-
|
686
|
-
##
|
687
|
-
# Creates a device in a device registry.
|
688
|
-
#
|
689
|
-
# @overload create_device(request, options = nil)
|
690
|
-
# Pass arguments to `create_device` via a request object, either of type
|
691
|
-
# {::Google::Cloud::Iot::V1::CreateDeviceRequest} or an equivalent Hash.
|
692
|
-
#
|
693
|
-
# @param request [::Google::Cloud::Iot::V1::CreateDeviceRequest, ::Hash]
|
694
|
-
# A request object representing the call parameters. Required. To specify no
|
695
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
696
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
697
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
698
|
-
#
|
699
|
-
# @overload create_device(parent: nil, device: nil)
|
700
|
-
# Pass arguments to `create_device` via keyword arguments. Note that at
|
701
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
702
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
703
|
-
#
|
704
|
-
# @param parent [::String]
|
705
|
-
# Required. The name of the device registry where this device should be created.
|
706
|
-
# For example,
|
707
|
-
# `projects/example-project/locations/us-central1/registries/my-registry`.
|
708
|
-
# @param device [::Google::Cloud::Iot::V1::Device, ::Hash]
|
709
|
-
# Required. The device registration details. The field `name` must be empty. The server
|
710
|
-
# generates `name` from the device registry `id` and the
|
711
|
-
# `parent` field.
|
712
|
-
#
|
713
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
714
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::Device]
|
715
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
716
|
-
#
|
717
|
-
# @return [::Google::Cloud::Iot::V1::Device]
|
718
|
-
#
|
719
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
720
|
-
#
|
721
|
-
# @example Basic example
|
722
|
-
# require "google/cloud/iot/v1"
|
723
|
-
#
|
724
|
-
# # Create a client object. The client can be reused for multiple calls.
|
725
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
726
|
-
#
|
727
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
728
|
-
# request = Google::Cloud::Iot::V1::CreateDeviceRequest.new
|
729
|
-
#
|
730
|
-
# # Call the create_device method.
|
731
|
-
# result = client.create_device request
|
732
|
-
#
|
733
|
-
# # The returned object is of type Google::Cloud::Iot::V1::Device.
|
734
|
-
# p result
|
735
|
-
#
|
736
|
-
def create_device request, options = nil
|
737
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
738
|
-
|
739
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::CreateDeviceRequest
|
740
|
-
|
741
|
-
# Converts hash and nil to an options object
|
742
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
743
|
-
|
744
|
-
# Customize the options with defaults
|
745
|
-
metadata = @config.rpcs.create_device.metadata.to_h
|
746
|
-
|
747
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
748
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
749
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
750
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
751
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
752
|
-
|
753
|
-
header_params = {}
|
754
|
-
if request.parent
|
755
|
-
header_params["parent"] = request.parent
|
756
|
-
end
|
757
|
-
|
758
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
759
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
760
|
-
|
761
|
-
options.apply_defaults timeout: @config.rpcs.create_device.timeout,
|
762
|
-
metadata: metadata,
|
763
|
-
retry_policy: @config.rpcs.create_device.retry_policy
|
764
|
-
|
765
|
-
options.apply_defaults timeout: @config.timeout,
|
766
|
-
metadata: @config.metadata,
|
767
|
-
retry_policy: @config.retry_policy
|
768
|
-
|
769
|
-
@device_manager_stub.call_rpc :create_device, request, options: options do |response, operation|
|
770
|
-
yield response, operation if block_given?
|
771
|
-
return response
|
772
|
-
end
|
773
|
-
rescue ::GRPC::BadStatus => e
|
774
|
-
raise ::Google::Cloud::Error.from_error(e)
|
775
|
-
end
|
776
|
-
|
777
|
-
##
|
778
|
-
# Gets details about a device.
|
779
|
-
#
|
780
|
-
# @overload get_device(request, options = nil)
|
781
|
-
# Pass arguments to `get_device` via a request object, either of type
|
782
|
-
# {::Google::Cloud::Iot::V1::GetDeviceRequest} or an equivalent Hash.
|
783
|
-
#
|
784
|
-
# @param request [::Google::Cloud::Iot::V1::GetDeviceRequest, ::Hash]
|
785
|
-
# A request object representing the call parameters. Required. To specify no
|
786
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
787
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
788
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
789
|
-
#
|
790
|
-
# @overload get_device(name: nil, field_mask: nil)
|
791
|
-
# Pass arguments to `get_device` via keyword arguments. Note that at
|
792
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
793
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
794
|
-
#
|
795
|
-
# @param name [::String]
|
796
|
-
# Required. The name of the device. For example,
|
797
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
|
798
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
799
|
-
# @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
|
800
|
-
# The fields of the `Device` resource to be returned in the response. If the
|
801
|
-
# field mask is unset or empty, all fields are returned. Fields have to be
|
802
|
-
# provided in snake_case format, for example: `last_heartbeat_time`.
|
803
|
-
#
|
804
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
805
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::Device]
|
806
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
807
|
-
#
|
808
|
-
# @return [::Google::Cloud::Iot::V1::Device]
|
809
|
-
#
|
810
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
811
|
-
#
|
812
|
-
# @example Basic example
|
813
|
-
# require "google/cloud/iot/v1"
|
814
|
-
#
|
815
|
-
# # Create a client object. The client can be reused for multiple calls.
|
816
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
817
|
-
#
|
818
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
819
|
-
# request = Google::Cloud::Iot::V1::GetDeviceRequest.new
|
820
|
-
#
|
821
|
-
# # Call the get_device method.
|
822
|
-
# result = client.get_device request
|
823
|
-
#
|
824
|
-
# # The returned object is of type Google::Cloud::Iot::V1::Device.
|
825
|
-
# p result
|
826
|
-
#
|
827
|
-
def get_device request, options = nil
|
828
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
829
|
-
|
830
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::GetDeviceRequest
|
831
|
-
|
832
|
-
# Converts hash and nil to an options object
|
833
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
834
|
-
|
835
|
-
# Customize the options with defaults
|
836
|
-
metadata = @config.rpcs.get_device.metadata.to_h
|
837
|
-
|
838
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
839
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
840
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
841
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
842
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
843
|
-
|
844
|
-
header_params = {}
|
845
|
-
if request.name
|
846
|
-
header_params["name"] = request.name
|
847
|
-
end
|
848
|
-
|
849
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
850
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
851
|
-
|
852
|
-
options.apply_defaults timeout: @config.rpcs.get_device.timeout,
|
853
|
-
metadata: metadata,
|
854
|
-
retry_policy: @config.rpcs.get_device.retry_policy
|
855
|
-
|
856
|
-
options.apply_defaults timeout: @config.timeout,
|
857
|
-
metadata: @config.metadata,
|
858
|
-
retry_policy: @config.retry_policy
|
859
|
-
|
860
|
-
@device_manager_stub.call_rpc :get_device, request, options: options do |response, operation|
|
861
|
-
yield response, operation if block_given?
|
862
|
-
return response
|
863
|
-
end
|
864
|
-
rescue ::GRPC::BadStatus => e
|
865
|
-
raise ::Google::Cloud::Error.from_error(e)
|
866
|
-
end
|
867
|
-
|
868
|
-
##
|
869
|
-
# Updates a device.
|
870
|
-
#
|
871
|
-
# @overload update_device(request, options = nil)
|
872
|
-
# Pass arguments to `update_device` via a request object, either of type
|
873
|
-
# {::Google::Cloud::Iot::V1::UpdateDeviceRequest} or an equivalent Hash.
|
874
|
-
#
|
875
|
-
# @param request [::Google::Cloud::Iot::V1::UpdateDeviceRequest, ::Hash]
|
876
|
-
# A request object representing the call parameters. Required. To specify no
|
877
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
878
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
879
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
880
|
-
#
|
881
|
-
# @overload update_device(device: nil, update_mask: nil)
|
882
|
-
# Pass arguments to `update_device` via keyword arguments. Note that at
|
883
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
884
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
885
|
-
#
|
886
|
-
# @param device [::Google::Cloud::Iot::V1::Device, ::Hash]
|
887
|
-
# Required. The new values for the device. The `id` and `num_id` fields must
|
888
|
-
# be empty, and the field `name` must specify the name path. For example,
|
889
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
|
890
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
891
|
-
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
892
|
-
# Required. Only updates the `device` fields indicated by this mask.
|
893
|
-
# The field mask must not be empty, and it must not contain fields that
|
894
|
-
# are immutable or only set by the server.
|
895
|
-
# Mutable top-level fields: `credentials`, `blocked`, and `metadata`
|
896
|
-
#
|
897
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
898
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::Device]
|
899
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
900
|
-
#
|
901
|
-
# @return [::Google::Cloud::Iot::V1::Device]
|
902
|
-
#
|
903
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
904
|
-
#
|
905
|
-
# @example Basic example
|
906
|
-
# require "google/cloud/iot/v1"
|
907
|
-
#
|
908
|
-
# # Create a client object. The client can be reused for multiple calls.
|
909
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
910
|
-
#
|
911
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
912
|
-
# request = Google::Cloud::Iot::V1::UpdateDeviceRequest.new
|
913
|
-
#
|
914
|
-
# # Call the update_device method.
|
915
|
-
# result = client.update_device request
|
916
|
-
#
|
917
|
-
# # The returned object is of type Google::Cloud::Iot::V1::Device.
|
918
|
-
# p result
|
919
|
-
#
|
920
|
-
def update_device request, options = nil
|
921
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
922
|
-
|
923
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::UpdateDeviceRequest
|
924
|
-
|
925
|
-
# Converts hash and nil to an options object
|
926
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
927
|
-
|
928
|
-
# Customize the options with defaults
|
929
|
-
metadata = @config.rpcs.update_device.metadata.to_h
|
930
|
-
|
931
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
932
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
933
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
934
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
935
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
936
|
-
|
937
|
-
header_params = {}
|
938
|
-
if request.device&.name
|
939
|
-
header_params["device.name"] = request.device.name
|
940
|
-
end
|
941
|
-
|
942
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
943
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
944
|
-
|
945
|
-
options.apply_defaults timeout: @config.rpcs.update_device.timeout,
|
946
|
-
metadata: metadata,
|
947
|
-
retry_policy: @config.rpcs.update_device.retry_policy
|
948
|
-
|
949
|
-
options.apply_defaults timeout: @config.timeout,
|
950
|
-
metadata: @config.metadata,
|
951
|
-
retry_policy: @config.retry_policy
|
952
|
-
|
953
|
-
@device_manager_stub.call_rpc :update_device, request, options: options do |response, operation|
|
954
|
-
yield response, operation if block_given?
|
955
|
-
return response
|
956
|
-
end
|
957
|
-
rescue ::GRPC::BadStatus => e
|
958
|
-
raise ::Google::Cloud::Error.from_error(e)
|
959
|
-
end
|
960
|
-
|
961
|
-
##
|
962
|
-
# Deletes a device.
|
963
|
-
#
|
964
|
-
# @overload delete_device(request, options = nil)
|
965
|
-
# Pass arguments to `delete_device` via a request object, either of type
|
966
|
-
# {::Google::Cloud::Iot::V1::DeleteDeviceRequest} or an equivalent Hash.
|
967
|
-
#
|
968
|
-
# @param request [::Google::Cloud::Iot::V1::DeleteDeviceRequest, ::Hash]
|
969
|
-
# A request object representing the call parameters. Required. To specify no
|
970
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
971
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
972
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
973
|
-
#
|
974
|
-
# @overload delete_device(name: nil)
|
975
|
-
# Pass arguments to `delete_device` via keyword arguments. Note that at
|
976
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
977
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
978
|
-
#
|
979
|
-
# @param name [::String]
|
980
|
-
# Required. The name of the device. For example,
|
981
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
|
982
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
983
|
-
#
|
984
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
985
|
-
# @yieldparam response [::Google::Protobuf::Empty]
|
986
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
987
|
-
#
|
988
|
-
# @return [::Google::Protobuf::Empty]
|
989
|
-
#
|
990
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
991
|
-
#
|
992
|
-
# @example Basic example
|
993
|
-
# require "google/cloud/iot/v1"
|
994
|
-
#
|
995
|
-
# # Create a client object. The client can be reused for multiple calls.
|
996
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
997
|
-
#
|
998
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
999
|
-
# request = Google::Cloud::Iot::V1::DeleteDeviceRequest.new
|
1000
|
-
#
|
1001
|
-
# # Call the delete_device method.
|
1002
|
-
# result = client.delete_device request
|
1003
|
-
#
|
1004
|
-
# # The returned object is of type Google::Protobuf::Empty.
|
1005
|
-
# p result
|
1006
|
-
#
|
1007
|
-
def delete_device request, options = nil
|
1008
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1009
|
-
|
1010
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::DeleteDeviceRequest
|
1011
|
-
|
1012
|
-
# Converts hash and nil to an options object
|
1013
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1014
|
-
|
1015
|
-
# Customize the options with defaults
|
1016
|
-
metadata = @config.rpcs.delete_device.metadata.to_h
|
1017
|
-
|
1018
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1019
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1020
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1021
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1022
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1023
|
-
|
1024
|
-
header_params = {}
|
1025
|
-
if request.name
|
1026
|
-
header_params["name"] = request.name
|
1027
|
-
end
|
1028
|
-
|
1029
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1030
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1031
|
-
|
1032
|
-
options.apply_defaults timeout: @config.rpcs.delete_device.timeout,
|
1033
|
-
metadata: metadata,
|
1034
|
-
retry_policy: @config.rpcs.delete_device.retry_policy
|
1035
|
-
|
1036
|
-
options.apply_defaults timeout: @config.timeout,
|
1037
|
-
metadata: @config.metadata,
|
1038
|
-
retry_policy: @config.retry_policy
|
1039
|
-
|
1040
|
-
@device_manager_stub.call_rpc :delete_device, request, options: options do |response, operation|
|
1041
|
-
yield response, operation if block_given?
|
1042
|
-
return response
|
1043
|
-
end
|
1044
|
-
rescue ::GRPC::BadStatus => e
|
1045
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1046
|
-
end
|
1047
|
-
|
1048
|
-
##
|
1049
|
-
# List devices in a device registry.
|
1050
|
-
#
|
1051
|
-
# @overload list_devices(request, options = nil)
|
1052
|
-
# Pass arguments to `list_devices` via a request object, either of type
|
1053
|
-
# {::Google::Cloud::Iot::V1::ListDevicesRequest} or an equivalent Hash.
|
1054
|
-
#
|
1055
|
-
# @param request [::Google::Cloud::Iot::V1::ListDevicesRequest, ::Hash]
|
1056
|
-
# A request object representing the call parameters. Required. To specify no
|
1057
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1058
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1059
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1060
|
-
#
|
1061
|
-
# @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)
|
1062
|
-
# Pass arguments to `list_devices` via keyword arguments. Note that at
|
1063
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1064
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1065
|
-
#
|
1066
|
-
# @param parent [::String]
|
1067
|
-
# Required. The device registry path. Required. For example,
|
1068
|
-
# `projects/my-project/locations/us-central1/registries/my-registry`.
|
1069
|
-
# @param device_num_ids [::Array<::Integer>]
|
1070
|
-
# A list of device numeric IDs. If empty, this field is ignored. Maximum
|
1071
|
-
# IDs: 10,000.
|
1072
|
-
# @param device_ids [::Array<::String>]
|
1073
|
-
# A list of device string IDs. For example, `['device0', 'device12']`.
|
1074
|
-
# If empty, this field is ignored. Maximum IDs: 10,000
|
1075
|
-
# @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1076
|
-
# The fields of the `Device` resource to be returned in the response. The
|
1077
|
-
# fields `id` and `num_id` are always returned, along with any
|
1078
|
-
# other fields specified in snake_case format, for example:
|
1079
|
-
# `last_heartbeat_time`.
|
1080
|
-
# @param gateway_list_options [::Google::Cloud::Iot::V1::GatewayListOptions, ::Hash]
|
1081
|
-
# Options related to gateways.
|
1082
|
-
# @param page_size [::Integer]
|
1083
|
-
# The maximum number of devices to return in the response. If this value
|
1084
|
-
# is zero, the service will select a default size. A call may return fewer
|
1085
|
-
# objects than requested. A non-empty `next_page_token` in the response
|
1086
|
-
# indicates that more data is available.
|
1087
|
-
# @param page_token [::String]
|
1088
|
-
# The value returned by the last `ListDevicesResponse`; indicates
|
1089
|
-
# that this is a continuation of a prior `ListDevices` call and
|
1090
|
-
# the system should return the next page of data.
|
1091
|
-
#
|
1092
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1093
|
-
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>]
|
1094
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1095
|
-
#
|
1096
|
-
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Iot::V1::Device>]
|
1097
|
-
#
|
1098
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1099
|
-
#
|
1100
|
-
# @example Basic example
|
1101
|
-
# require "google/cloud/iot/v1"
|
1102
|
-
#
|
1103
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1104
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1105
|
-
#
|
1106
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1107
|
-
# request = Google::Cloud::Iot::V1::ListDevicesRequest.new
|
1108
|
-
#
|
1109
|
-
# # Call the list_devices method.
|
1110
|
-
# result = client.list_devices request
|
1111
|
-
#
|
1112
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1113
|
-
# # over elements, and API calls will be issued to fetch pages as needed.
|
1114
|
-
# result.each do |item|
|
1115
|
-
# # Each element is of type ::Google::Cloud::Iot::V1::Device.
|
1116
|
-
# p item
|
1117
|
-
# end
|
1118
|
-
#
|
1119
|
-
def list_devices request, options = nil
|
1120
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1121
|
-
|
1122
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDevicesRequest
|
1123
|
-
|
1124
|
-
# Converts hash and nil to an options object
|
1125
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1126
|
-
|
1127
|
-
# Customize the options with defaults
|
1128
|
-
metadata = @config.rpcs.list_devices.metadata.to_h
|
1129
|
-
|
1130
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1131
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1132
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1133
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1134
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1135
|
-
|
1136
|
-
header_params = {}
|
1137
|
-
if request.parent
|
1138
|
-
header_params["parent"] = request.parent
|
1139
|
-
end
|
1140
|
-
|
1141
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1142
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1143
|
-
|
1144
|
-
options.apply_defaults timeout: @config.rpcs.list_devices.timeout,
|
1145
|
-
metadata: metadata,
|
1146
|
-
retry_policy: @config.rpcs.list_devices.retry_policy
|
1147
|
-
|
1148
|
-
options.apply_defaults timeout: @config.timeout,
|
1149
|
-
metadata: @config.metadata,
|
1150
|
-
retry_policy: @config.retry_policy
|
1151
|
-
|
1152
|
-
@device_manager_stub.call_rpc :list_devices, request, options: options do |response, operation|
|
1153
|
-
response = ::Gapic::PagedEnumerable.new @device_manager_stub, :list_devices, request, response, operation, options
|
1154
|
-
yield response, operation if block_given?
|
1155
|
-
return response
|
1156
|
-
end
|
1157
|
-
rescue ::GRPC::BadStatus => e
|
1158
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
##
|
1162
|
-
# Modifies the configuration for the device, which is eventually sent from
|
1163
|
-
# the Cloud IoT Core servers. Returns the modified configuration version and
|
1164
|
-
# its metadata.
|
1165
|
-
#
|
1166
|
-
# @overload modify_cloud_to_device_config(request, options = nil)
|
1167
|
-
# Pass arguments to `modify_cloud_to_device_config` via a request object, either of type
|
1168
|
-
# {::Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest} or an equivalent Hash.
|
1169
|
-
#
|
1170
|
-
# @param request [::Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest, ::Hash]
|
1171
|
-
# A request object representing the call parameters. Required. To specify no
|
1172
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1173
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1174
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1175
|
-
#
|
1176
|
-
# @overload modify_cloud_to_device_config(name: nil, version_to_update: nil, binary_data: nil)
|
1177
|
-
# Pass arguments to `modify_cloud_to_device_config` via keyword arguments. Note that at
|
1178
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1179
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1180
|
-
#
|
1181
|
-
# @param name [::String]
|
1182
|
-
# Required. The name of the device. For example,
|
1183
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
|
1184
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
1185
|
-
# @param version_to_update [::Integer]
|
1186
|
-
# The version number to update. If this value is zero, it will not check the
|
1187
|
-
# version number of the server and will always update the current version;
|
1188
|
-
# otherwise, this update will fail if the version number found on the server
|
1189
|
-
# does not match this version number. This is used to support multiple
|
1190
|
-
# simultaneous updates without losing data.
|
1191
|
-
# @param binary_data [::String]
|
1192
|
-
# Required. The configuration data for the device.
|
1193
|
-
#
|
1194
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1195
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::DeviceConfig]
|
1196
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1197
|
-
#
|
1198
|
-
# @return [::Google::Cloud::Iot::V1::DeviceConfig]
|
1199
|
-
#
|
1200
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1201
|
-
#
|
1202
|
-
# @example Basic example
|
1203
|
-
# require "google/cloud/iot/v1"
|
1204
|
-
#
|
1205
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1206
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1207
|
-
#
|
1208
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1209
|
-
# request = Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest.new
|
1210
|
-
#
|
1211
|
-
# # Call the modify_cloud_to_device_config method.
|
1212
|
-
# result = client.modify_cloud_to_device_config request
|
1213
|
-
#
|
1214
|
-
# # The returned object is of type Google::Cloud::Iot::V1::DeviceConfig.
|
1215
|
-
# p result
|
1216
|
-
#
|
1217
|
-
def modify_cloud_to_device_config request, options = nil
|
1218
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1219
|
-
|
1220
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ModifyCloudToDeviceConfigRequest
|
1221
|
-
|
1222
|
-
# Converts hash and nil to an options object
|
1223
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1224
|
-
|
1225
|
-
# Customize the options with defaults
|
1226
|
-
metadata = @config.rpcs.modify_cloud_to_device_config.metadata.to_h
|
1227
|
-
|
1228
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1229
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1230
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1231
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1232
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1233
|
-
|
1234
|
-
header_params = {}
|
1235
|
-
if request.name
|
1236
|
-
header_params["name"] = request.name
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1240
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1241
|
-
|
1242
|
-
options.apply_defaults timeout: @config.rpcs.modify_cloud_to_device_config.timeout,
|
1243
|
-
metadata: metadata,
|
1244
|
-
retry_policy: @config.rpcs.modify_cloud_to_device_config.retry_policy
|
1245
|
-
|
1246
|
-
options.apply_defaults timeout: @config.timeout,
|
1247
|
-
metadata: @config.metadata,
|
1248
|
-
retry_policy: @config.retry_policy
|
1249
|
-
|
1250
|
-
@device_manager_stub.call_rpc :modify_cloud_to_device_config, request, options: options do |response, operation|
|
1251
|
-
yield response, operation if block_given?
|
1252
|
-
return response
|
1253
|
-
end
|
1254
|
-
rescue ::GRPC::BadStatus => e
|
1255
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1256
|
-
end
|
1257
|
-
|
1258
|
-
##
|
1259
|
-
# Lists the last few versions of the device configuration in descending
|
1260
|
-
# order (i.e.: newest first).
|
1261
|
-
#
|
1262
|
-
# @overload list_device_config_versions(request, options = nil)
|
1263
|
-
# Pass arguments to `list_device_config_versions` via a request object, either of type
|
1264
|
-
# {::Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest} or an equivalent Hash.
|
1265
|
-
#
|
1266
|
-
# @param request [::Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest, ::Hash]
|
1267
|
-
# A request object representing the call parameters. Required. To specify no
|
1268
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1269
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1270
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1271
|
-
#
|
1272
|
-
# @overload list_device_config_versions(name: nil, num_versions: nil)
|
1273
|
-
# Pass arguments to `list_device_config_versions` via keyword arguments. Note that at
|
1274
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1275
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1276
|
-
#
|
1277
|
-
# @param name [::String]
|
1278
|
-
# Required. The name of the device. For example,
|
1279
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
|
1280
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
1281
|
-
# @param num_versions [::Integer]
|
1282
|
-
# The number of versions to list. Versions are listed in decreasing order of
|
1283
|
-
# the version number. The maximum number of versions retained is 10. If this
|
1284
|
-
# value is zero, it will return all the versions available.
|
1285
|
-
#
|
1286
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1287
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse]
|
1288
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1289
|
-
#
|
1290
|
-
# @return [::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse]
|
1291
|
-
#
|
1292
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1293
|
-
#
|
1294
|
-
# @example Basic example
|
1295
|
-
# require "google/cloud/iot/v1"
|
1296
|
-
#
|
1297
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1298
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1299
|
-
#
|
1300
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1301
|
-
# request = Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest.new
|
1302
|
-
#
|
1303
|
-
# # Call the list_device_config_versions method.
|
1304
|
-
# result = client.list_device_config_versions request
|
1305
|
-
#
|
1306
|
-
# # The returned object is of type Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse.
|
1307
|
-
# p result
|
1308
|
-
#
|
1309
|
-
def list_device_config_versions request, options = nil
|
1310
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1311
|
-
|
1312
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsRequest
|
1313
|
-
|
1314
|
-
# Converts hash and nil to an options object
|
1315
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1316
|
-
|
1317
|
-
# Customize the options with defaults
|
1318
|
-
metadata = @config.rpcs.list_device_config_versions.metadata.to_h
|
1319
|
-
|
1320
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1321
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1322
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1323
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1324
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1325
|
-
|
1326
|
-
header_params = {}
|
1327
|
-
if request.name
|
1328
|
-
header_params["name"] = request.name
|
1329
|
-
end
|
1330
|
-
|
1331
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1332
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1333
|
-
|
1334
|
-
options.apply_defaults timeout: @config.rpcs.list_device_config_versions.timeout,
|
1335
|
-
metadata: metadata,
|
1336
|
-
retry_policy: @config.rpcs.list_device_config_versions.retry_policy
|
1337
|
-
|
1338
|
-
options.apply_defaults timeout: @config.timeout,
|
1339
|
-
metadata: @config.metadata,
|
1340
|
-
retry_policy: @config.retry_policy
|
1341
|
-
|
1342
|
-
@device_manager_stub.call_rpc :list_device_config_versions, request, options: options do |response, operation|
|
1343
|
-
yield response, operation if block_given?
|
1344
|
-
return response
|
1345
|
-
end
|
1346
|
-
rescue ::GRPC::BadStatus => e
|
1347
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1348
|
-
end
|
1349
|
-
|
1350
|
-
##
|
1351
|
-
# Lists the last few versions of the device state in descending order (i.e.:
|
1352
|
-
# newest first).
|
1353
|
-
#
|
1354
|
-
# @overload list_device_states(request, options = nil)
|
1355
|
-
# Pass arguments to `list_device_states` via a request object, either of type
|
1356
|
-
# {::Google::Cloud::Iot::V1::ListDeviceStatesRequest} or an equivalent Hash.
|
1357
|
-
#
|
1358
|
-
# @param request [::Google::Cloud::Iot::V1::ListDeviceStatesRequest, ::Hash]
|
1359
|
-
# A request object representing the call parameters. Required. To specify no
|
1360
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1361
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1362
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1363
|
-
#
|
1364
|
-
# @overload list_device_states(name: nil, num_states: nil)
|
1365
|
-
# Pass arguments to `list_device_states` via keyword arguments. Note that at
|
1366
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1367
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1368
|
-
#
|
1369
|
-
# @param name [::String]
|
1370
|
-
# Required. The name of the device. For example,
|
1371
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
|
1372
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
1373
|
-
# @param num_states [::Integer]
|
1374
|
-
# The number of states to list. States are listed in descending order of
|
1375
|
-
# update time. The maximum number of states retained is 10. If this
|
1376
|
-
# value is zero, it will return all the states available.
|
1377
|
-
#
|
1378
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1379
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::ListDeviceStatesResponse]
|
1380
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1381
|
-
#
|
1382
|
-
# @return [::Google::Cloud::Iot::V1::ListDeviceStatesResponse]
|
1383
|
-
#
|
1384
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1385
|
-
#
|
1386
|
-
# @example Basic example
|
1387
|
-
# require "google/cloud/iot/v1"
|
1388
|
-
#
|
1389
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1390
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1391
|
-
#
|
1392
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1393
|
-
# request = Google::Cloud::Iot::V1::ListDeviceStatesRequest.new
|
1394
|
-
#
|
1395
|
-
# # Call the list_device_states method.
|
1396
|
-
# result = client.list_device_states request
|
1397
|
-
#
|
1398
|
-
# # The returned object is of type Google::Cloud::Iot::V1::ListDeviceStatesResponse.
|
1399
|
-
# p result
|
1400
|
-
#
|
1401
|
-
def list_device_states request, options = nil
|
1402
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1403
|
-
|
1404
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::ListDeviceStatesRequest
|
1405
|
-
|
1406
|
-
# Converts hash and nil to an options object
|
1407
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1408
|
-
|
1409
|
-
# Customize the options with defaults
|
1410
|
-
metadata = @config.rpcs.list_device_states.metadata.to_h
|
1411
|
-
|
1412
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1413
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1414
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1415
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1416
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1417
|
-
|
1418
|
-
header_params = {}
|
1419
|
-
if request.name
|
1420
|
-
header_params["name"] = request.name
|
1421
|
-
end
|
1422
|
-
|
1423
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1424
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1425
|
-
|
1426
|
-
options.apply_defaults timeout: @config.rpcs.list_device_states.timeout,
|
1427
|
-
metadata: metadata,
|
1428
|
-
retry_policy: @config.rpcs.list_device_states.retry_policy
|
1429
|
-
|
1430
|
-
options.apply_defaults timeout: @config.timeout,
|
1431
|
-
metadata: @config.metadata,
|
1432
|
-
retry_policy: @config.retry_policy
|
1433
|
-
|
1434
|
-
@device_manager_stub.call_rpc :list_device_states, request, options: options do |response, operation|
|
1435
|
-
yield response, operation if block_given?
|
1436
|
-
return response
|
1437
|
-
end
|
1438
|
-
rescue ::GRPC::BadStatus => e
|
1439
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1440
|
-
end
|
1441
|
-
|
1442
|
-
##
|
1443
|
-
# Sets the access control policy on the specified resource. Replaces any
|
1444
|
-
# existing policy.
|
1445
|
-
#
|
1446
|
-
# @overload set_iam_policy(request, options = nil)
|
1447
|
-
# Pass arguments to `set_iam_policy` via a request object, either of type
|
1448
|
-
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
1449
|
-
#
|
1450
|
-
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
1451
|
-
# A request object representing the call parameters. Required. To specify no
|
1452
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1453
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1454
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1455
|
-
#
|
1456
|
-
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
1457
|
-
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
1458
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1459
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1460
|
-
#
|
1461
|
-
# @param resource [::String]
|
1462
|
-
# REQUIRED: The resource for which the policy is being specified.
|
1463
|
-
# See the operation documentation for the appropriate value for this field.
|
1464
|
-
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
1465
|
-
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
1466
|
-
# the policy is limited to a few 10s of KB. An empty policy is a
|
1467
|
-
# valid policy but certain Cloud Platform services (such as Projects)
|
1468
|
-
# might reject them.
|
1469
|
-
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1470
|
-
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
1471
|
-
# the fields in the mask will be modified. If no mask is provided, the
|
1472
|
-
# following default mask is used:
|
1473
|
-
#
|
1474
|
-
# `paths: "bindings, etag"`
|
1475
|
-
#
|
1476
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1477
|
-
# @yieldparam response [::Google::Iam::V1::Policy]
|
1478
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1479
|
-
#
|
1480
|
-
# @return [::Google::Iam::V1::Policy]
|
1481
|
-
#
|
1482
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1483
|
-
#
|
1484
|
-
# @example Basic example
|
1485
|
-
# require "google/cloud/iot/v1"
|
1486
|
-
#
|
1487
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1488
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1489
|
-
#
|
1490
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1491
|
-
# request = Google::Iam::V1::SetIamPolicyRequest.new
|
1492
|
-
#
|
1493
|
-
# # Call the set_iam_policy method.
|
1494
|
-
# result = client.set_iam_policy request
|
1495
|
-
#
|
1496
|
-
# # The returned object is of type Google::Iam::V1::Policy.
|
1497
|
-
# p result
|
1498
|
-
#
|
1499
|
-
def set_iam_policy request, options = nil
|
1500
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1501
|
-
|
1502
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
1503
|
-
|
1504
|
-
# Converts hash and nil to an options object
|
1505
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1506
|
-
|
1507
|
-
# Customize the options with defaults
|
1508
|
-
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
1509
|
-
|
1510
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1511
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1512
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1513
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1514
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1515
|
-
|
1516
|
-
header_params = {}
|
1517
|
-
if request.resource
|
1518
|
-
header_params["resource"] = request.resource
|
1519
|
-
end
|
1520
|
-
|
1521
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1522
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1523
|
-
|
1524
|
-
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
1525
|
-
metadata: metadata,
|
1526
|
-
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
1527
|
-
|
1528
|
-
options.apply_defaults timeout: @config.timeout,
|
1529
|
-
metadata: @config.metadata,
|
1530
|
-
retry_policy: @config.retry_policy
|
1531
|
-
|
1532
|
-
@device_manager_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
|
1533
|
-
yield response, operation if block_given?
|
1534
|
-
return response
|
1535
|
-
end
|
1536
|
-
rescue ::GRPC::BadStatus => e
|
1537
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1538
|
-
end
|
1539
|
-
|
1540
|
-
##
|
1541
|
-
# Gets the access control policy for a resource.
|
1542
|
-
# Returns an empty policy if the resource exists and does not have a policy
|
1543
|
-
# set.
|
1544
|
-
#
|
1545
|
-
# @overload get_iam_policy(request, options = nil)
|
1546
|
-
# Pass arguments to `get_iam_policy` via a request object, either of type
|
1547
|
-
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
1548
|
-
#
|
1549
|
-
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
1550
|
-
# A request object representing the call parameters. Required. To specify no
|
1551
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1552
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1553
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1554
|
-
#
|
1555
|
-
# @overload get_iam_policy(resource: nil, options: nil)
|
1556
|
-
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
1557
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1558
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1559
|
-
#
|
1560
|
-
# @param resource [::String]
|
1561
|
-
# REQUIRED: The resource for which the policy is being requested.
|
1562
|
-
# See the operation documentation for the appropriate value for this field.
|
1563
|
-
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
1564
|
-
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
1565
|
-
# `GetIamPolicy`.
|
1566
|
-
#
|
1567
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1568
|
-
# @yieldparam response [::Google::Iam::V1::Policy]
|
1569
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1570
|
-
#
|
1571
|
-
# @return [::Google::Iam::V1::Policy]
|
1572
|
-
#
|
1573
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1574
|
-
#
|
1575
|
-
# @example Basic example
|
1576
|
-
# require "google/cloud/iot/v1"
|
1577
|
-
#
|
1578
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1579
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1580
|
-
#
|
1581
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1582
|
-
# request = Google::Iam::V1::GetIamPolicyRequest.new
|
1583
|
-
#
|
1584
|
-
# # Call the get_iam_policy method.
|
1585
|
-
# result = client.get_iam_policy request
|
1586
|
-
#
|
1587
|
-
# # The returned object is of type Google::Iam::V1::Policy.
|
1588
|
-
# p result
|
1589
|
-
#
|
1590
|
-
def get_iam_policy request, options = nil
|
1591
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1592
|
-
|
1593
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
1594
|
-
|
1595
|
-
# Converts hash and nil to an options object
|
1596
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1597
|
-
|
1598
|
-
# Customize the options with defaults
|
1599
|
-
metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
1600
|
-
|
1601
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1602
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1603
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1604
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1605
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1606
|
-
|
1607
|
-
header_params = {}
|
1608
|
-
if request.resource
|
1609
|
-
header_params["resource"] = request.resource
|
1610
|
-
end
|
1611
|
-
|
1612
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1613
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1614
|
-
|
1615
|
-
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
1616
|
-
metadata: metadata,
|
1617
|
-
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
1618
|
-
|
1619
|
-
options.apply_defaults timeout: @config.timeout,
|
1620
|
-
metadata: @config.metadata,
|
1621
|
-
retry_policy: @config.retry_policy
|
1622
|
-
|
1623
|
-
@device_manager_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
|
1624
|
-
yield response, operation if block_given?
|
1625
|
-
return response
|
1626
|
-
end
|
1627
|
-
rescue ::GRPC::BadStatus => e
|
1628
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1629
|
-
end
|
1630
|
-
|
1631
|
-
##
|
1632
|
-
# Returns permissions that a caller has on the specified resource.
|
1633
|
-
# If the resource does not exist, this will return an empty set of
|
1634
|
-
# permissions, not a NOT_FOUND error.
|
1635
|
-
#
|
1636
|
-
# @overload test_iam_permissions(request, options = nil)
|
1637
|
-
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
1638
|
-
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
1639
|
-
#
|
1640
|
-
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
1641
|
-
# A request object representing the call parameters. Required. To specify no
|
1642
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1643
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1644
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1645
|
-
#
|
1646
|
-
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
1647
|
-
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
1648
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1649
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1650
|
-
#
|
1651
|
-
# @param resource [::String]
|
1652
|
-
# REQUIRED: The resource for which the policy detail is being requested.
|
1653
|
-
# See the operation documentation for the appropriate value for this field.
|
1654
|
-
# @param permissions [::Array<::String>]
|
1655
|
-
# The set of permissions to check for the `resource`. Permissions with
|
1656
|
-
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
1657
|
-
# information see
|
1658
|
-
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
1659
|
-
#
|
1660
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1661
|
-
# @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
|
1662
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1663
|
-
#
|
1664
|
-
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
1665
|
-
#
|
1666
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1667
|
-
#
|
1668
|
-
# @example Basic example
|
1669
|
-
# require "google/cloud/iot/v1"
|
1670
|
-
#
|
1671
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1672
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1673
|
-
#
|
1674
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1675
|
-
# request = Google::Iam::V1::TestIamPermissionsRequest.new
|
1676
|
-
#
|
1677
|
-
# # Call the test_iam_permissions method.
|
1678
|
-
# result = client.test_iam_permissions request
|
1679
|
-
#
|
1680
|
-
# # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
|
1681
|
-
# p result
|
1682
|
-
#
|
1683
|
-
def test_iam_permissions request, options = nil
|
1684
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1685
|
-
|
1686
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
1687
|
-
|
1688
|
-
# Converts hash and nil to an options object
|
1689
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1690
|
-
|
1691
|
-
# Customize the options with defaults
|
1692
|
-
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
1693
|
-
|
1694
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1695
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1696
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1697
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1698
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1699
|
-
|
1700
|
-
header_params = {}
|
1701
|
-
if request.resource
|
1702
|
-
header_params["resource"] = request.resource
|
1703
|
-
end
|
1704
|
-
|
1705
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1706
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1707
|
-
|
1708
|
-
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
1709
|
-
metadata: metadata,
|
1710
|
-
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
1711
|
-
|
1712
|
-
options.apply_defaults timeout: @config.timeout,
|
1713
|
-
metadata: @config.metadata,
|
1714
|
-
retry_policy: @config.retry_policy
|
1715
|
-
|
1716
|
-
@device_manager_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
|
1717
|
-
yield response, operation if block_given?
|
1718
|
-
return response
|
1719
|
-
end
|
1720
|
-
rescue ::GRPC::BadStatus => e
|
1721
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1722
|
-
end
|
1723
|
-
|
1724
|
-
##
|
1725
|
-
# Sends a command to the specified device. In order for a device to be able
|
1726
|
-
# to receive commands, it must:
|
1727
|
-
# 1) be connected to Cloud IoT Core using the MQTT protocol, and
|
1728
|
-
# 2) be subscribed to the group of MQTT topics specified by
|
1729
|
-
# /devices/\\{device-id}/commands/#. This subscription will receive commands
|
1730
|
-
# at the top-level topic /devices/\\{device-id}/commands as well as commands
|
1731
|
-
# for subfolders, like /devices/\\{device-id}/commands/subfolder.
|
1732
|
-
# Note that subscribing to specific subfolders is not supported.
|
1733
|
-
# If the command could not be delivered to the device, this method will
|
1734
|
-
# return an error; in particular, if the device is not subscribed, this
|
1735
|
-
# method will return FAILED_PRECONDITION. Otherwise, this method will
|
1736
|
-
# return OK. If the subscription is QoS 1, at least once delivery will be
|
1737
|
-
# guaranteed; for QoS 0, no acknowledgment will be expected from the device.
|
1738
|
-
#
|
1739
|
-
# @overload send_command_to_device(request, options = nil)
|
1740
|
-
# Pass arguments to `send_command_to_device` via a request object, either of type
|
1741
|
-
# {::Google::Cloud::Iot::V1::SendCommandToDeviceRequest} or an equivalent Hash.
|
1742
|
-
#
|
1743
|
-
# @param request [::Google::Cloud::Iot::V1::SendCommandToDeviceRequest, ::Hash]
|
1744
|
-
# A request object representing the call parameters. Required. To specify no
|
1745
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1746
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1747
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1748
|
-
#
|
1749
|
-
# @overload send_command_to_device(name: nil, binary_data: nil, subfolder: nil)
|
1750
|
-
# Pass arguments to `send_command_to_device` via keyword arguments. Note that at
|
1751
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1752
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1753
|
-
#
|
1754
|
-
# @param name [::String]
|
1755
|
-
# Required. The name of the device. For example,
|
1756
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
|
1757
|
-
# `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
|
1758
|
-
# @param binary_data [::String]
|
1759
|
-
# Required. The command data to send to the device.
|
1760
|
-
# @param subfolder [::String]
|
1761
|
-
# Optional subfolder for the command. If empty, the command will be delivered
|
1762
|
-
# to the /devices/\\{device-id}/commands topic, otherwise it will be delivered
|
1763
|
-
# to the /devices/\\{device-id}/commands/\\{subfolder} topic. Multi-level
|
1764
|
-
# subfolders are allowed. This field must not have more than 256 characters,
|
1765
|
-
# and must not contain any MQTT wildcards ("+" or "#") or null characters.
|
1766
|
-
#
|
1767
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1768
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::SendCommandToDeviceResponse]
|
1769
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1770
|
-
#
|
1771
|
-
# @return [::Google::Cloud::Iot::V1::SendCommandToDeviceResponse]
|
1772
|
-
#
|
1773
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1774
|
-
#
|
1775
|
-
# @example Basic example
|
1776
|
-
# require "google/cloud/iot/v1"
|
1777
|
-
#
|
1778
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1779
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1780
|
-
#
|
1781
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1782
|
-
# request = Google::Cloud::Iot::V1::SendCommandToDeviceRequest.new
|
1783
|
-
#
|
1784
|
-
# # Call the send_command_to_device method.
|
1785
|
-
# result = client.send_command_to_device request
|
1786
|
-
#
|
1787
|
-
# # The returned object is of type Google::Cloud::Iot::V1::SendCommandToDeviceResponse.
|
1788
|
-
# p result
|
1789
|
-
#
|
1790
|
-
def send_command_to_device request, options = nil
|
1791
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1792
|
-
|
1793
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::SendCommandToDeviceRequest
|
1794
|
-
|
1795
|
-
# Converts hash and nil to an options object
|
1796
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1797
|
-
|
1798
|
-
# Customize the options with defaults
|
1799
|
-
metadata = @config.rpcs.send_command_to_device.metadata.to_h
|
1800
|
-
|
1801
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1802
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1803
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1804
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1805
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1806
|
-
|
1807
|
-
header_params = {}
|
1808
|
-
if request.name
|
1809
|
-
header_params["name"] = request.name
|
1810
|
-
end
|
1811
|
-
|
1812
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1813
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1814
|
-
|
1815
|
-
options.apply_defaults timeout: @config.rpcs.send_command_to_device.timeout,
|
1816
|
-
metadata: metadata,
|
1817
|
-
retry_policy: @config.rpcs.send_command_to_device.retry_policy
|
1818
|
-
|
1819
|
-
options.apply_defaults timeout: @config.timeout,
|
1820
|
-
metadata: @config.metadata,
|
1821
|
-
retry_policy: @config.retry_policy
|
1822
|
-
|
1823
|
-
@device_manager_stub.call_rpc :send_command_to_device, request, options: options do |response, operation|
|
1824
|
-
yield response, operation if block_given?
|
1825
|
-
return response
|
1826
|
-
end
|
1827
|
-
rescue ::GRPC::BadStatus => e
|
1828
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1829
|
-
end
|
1830
|
-
|
1831
|
-
##
|
1832
|
-
# Associates the device with the gateway.
|
1833
|
-
#
|
1834
|
-
# @overload bind_device_to_gateway(request, options = nil)
|
1835
|
-
# Pass arguments to `bind_device_to_gateway` via a request object, either of type
|
1836
|
-
# {::Google::Cloud::Iot::V1::BindDeviceToGatewayRequest} or an equivalent Hash.
|
1837
|
-
#
|
1838
|
-
# @param request [::Google::Cloud::Iot::V1::BindDeviceToGatewayRequest, ::Hash]
|
1839
|
-
# A request object representing the call parameters. Required. To specify no
|
1840
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1841
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1842
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1843
|
-
#
|
1844
|
-
# @overload bind_device_to_gateway(parent: nil, gateway_id: nil, device_id: nil)
|
1845
|
-
# Pass arguments to `bind_device_to_gateway` via keyword arguments. Note that at
|
1846
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1847
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1848
|
-
#
|
1849
|
-
# @param parent [::String]
|
1850
|
-
# Required. The name of the registry. For example,
|
1851
|
-
# `projects/example-project/locations/us-central1/registries/my-registry`.
|
1852
|
-
# @param gateway_id [::String]
|
1853
|
-
# Required. The value of `gateway_id` can be either the device numeric ID or the
|
1854
|
-
# user-defined device identifier.
|
1855
|
-
# @param device_id [::String]
|
1856
|
-
# Required. The device to associate with the specified gateway. The value of
|
1857
|
-
# `device_id` can be either the device numeric ID or the user-defined device
|
1858
|
-
# identifier.
|
1859
|
-
#
|
1860
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1861
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse]
|
1862
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1863
|
-
#
|
1864
|
-
# @return [::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse]
|
1865
|
-
#
|
1866
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1867
|
-
#
|
1868
|
-
# @example Basic example
|
1869
|
-
# require "google/cloud/iot/v1"
|
1870
|
-
#
|
1871
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1872
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1873
|
-
#
|
1874
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1875
|
-
# request = Google::Cloud::Iot::V1::BindDeviceToGatewayRequest.new
|
1876
|
-
#
|
1877
|
-
# # Call the bind_device_to_gateway method.
|
1878
|
-
# result = client.bind_device_to_gateway request
|
1879
|
-
#
|
1880
|
-
# # The returned object is of type Google::Cloud::Iot::V1::BindDeviceToGatewayResponse.
|
1881
|
-
# p result
|
1882
|
-
#
|
1883
|
-
def bind_device_to_gateway request, options = nil
|
1884
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1885
|
-
|
1886
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::BindDeviceToGatewayRequest
|
1887
|
-
|
1888
|
-
# Converts hash and nil to an options object
|
1889
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1890
|
-
|
1891
|
-
# Customize the options with defaults
|
1892
|
-
metadata = @config.rpcs.bind_device_to_gateway.metadata.to_h
|
1893
|
-
|
1894
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1895
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1896
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1897
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1898
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1899
|
-
|
1900
|
-
header_params = {}
|
1901
|
-
if request.parent
|
1902
|
-
header_params["parent"] = request.parent
|
1903
|
-
end
|
1904
|
-
|
1905
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1906
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
1907
|
-
|
1908
|
-
options.apply_defaults timeout: @config.rpcs.bind_device_to_gateway.timeout,
|
1909
|
-
metadata: metadata,
|
1910
|
-
retry_policy: @config.rpcs.bind_device_to_gateway.retry_policy
|
1911
|
-
|
1912
|
-
options.apply_defaults timeout: @config.timeout,
|
1913
|
-
metadata: @config.metadata,
|
1914
|
-
retry_policy: @config.retry_policy
|
1915
|
-
|
1916
|
-
@device_manager_stub.call_rpc :bind_device_to_gateway, request, options: options do |response, operation|
|
1917
|
-
yield response, operation if block_given?
|
1918
|
-
return response
|
1919
|
-
end
|
1920
|
-
rescue ::GRPC::BadStatus => e
|
1921
|
-
raise ::Google::Cloud::Error.from_error(e)
|
1922
|
-
end
|
1923
|
-
|
1924
|
-
##
|
1925
|
-
# Deletes the association between the device and the gateway.
|
1926
|
-
#
|
1927
|
-
# @overload unbind_device_from_gateway(request, options = nil)
|
1928
|
-
# Pass arguments to `unbind_device_from_gateway` via a request object, either of type
|
1929
|
-
# {::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest} or an equivalent Hash.
|
1930
|
-
#
|
1931
|
-
# @param request [::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest, ::Hash]
|
1932
|
-
# A request object representing the call parameters. Required. To specify no
|
1933
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1934
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
1935
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1936
|
-
#
|
1937
|
-
# @overload unbind_device_from_gateway(parent: nil, gateway_id: nil, device_id: nil)
|
1938
|
-
# Pass arguments to `unbind_device_from_gateway` via keyword arguments. Note that at
|
1939
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
1940
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
1941
|
-
#
|
1942
|
-
# @param parent [::String]
|
1943
|
-
# Required. The name of the registry. For example,
|
1944
|
-
# `projects/example-project/locations/us-central1/registries/my-registry`.
|
1945
|
-
# @param gateway_id [::String]
|
1946
|
-
# Required. The value of `gateway_id` can be either the device numeric ID or the
|
1947
|
-
# user-defined device identifier.
|
1948
|
-
# @param device_id [::String]
|
1949
|
-
# Required. The device to disassociate from the specified gateway. The value of
|
1950
|
-
# `device_id` can be either the device numeric ID or the user-defined device
|
1951
|
-
# identifier.
|
1952
|
-
#
|
1953
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
1954
|
-
# @yieldparam response [::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse]
|
1955
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1956
|
-
#
|
1957
|
-
# @return [::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse]
|
1958
|
-
#
|
1959
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1960
|
-
#
|
1961
|
-
# @example Basic example
|
1962
|
-
# require "google/cloud/iot/v1"
|
1963
|
-
#
|
1964
|
-
# # Create a client object. The client can be reused for multiple calls.
|
1965
|
-
# client = Google::Cloud::Iot::V1::DeviceManager::Client.new
|
1966
|
-
#
|
1967
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
1968
|
-
# request = Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest.new
|
1969
|
-
#
|
1970
|
-
# # Call the unbind_device_from_gateway method.
|
1971
|
-
# result = client.unbind_device_from_gateway request
|
1972
|
-
#
|
1973
|
-
# # The returned object is of type Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse.
|
1974
|
-
# p result
|
1975
|
-
#
|
1976
|
-
def unbind_device_from_gateway request, options = nil
|
1977
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
1978
|
-
|
1979
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayRequest
|
1980
|
-
|
1981
|
-
# Converts hash and nil to an options object
|
1982
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1983
|
-
|
1984
|
-
# Customize the options with defaults
|
1985
|
-
metadata = @config.rpcs.unbind_device_from_gateway.metadata.to_h
|
1986
|
-
|
1987
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
1988
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1989
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1990
|
-
gapic_version: ::Google::Cloud::Iot::V1::VERSION
|
1991
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1992
|
-
|
1993
|
-
header_params = {}
|
1994
|
-
if request.parent
|
1995
|
-
header_params["parent"] = request.parent
|
1996
|
-
end
|
1997
|
-
|
1998
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1999
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
2000
|
-
|
2001
|
-
options.apply_defaults timeout: @config.rpcs.unbind_device_from_gateway.timeout,
|
2002
|
-
metadata: metadata,
|
2003
|
-
retry_policy: @config.rpcs.unbind_device_from_gateway.retry_policy
|
2004
|
-
|
2005
|
-
options.apply_defaults timeout: @config.timeout,
|
2006
|
-
metadata: @config.metadata,
|
2007
|
-
retry_policy: @config.retry_policy
|
2008
|
-
|
2009
|
-
@device_manager_stub.call_rpc :unbind_device_from_gateway, request, options: options do |response, operation|
|
2010
|
-
yield response, operation if block_given?
|
2011
|
-
return response
|
2012
|
-
end
|
2013
|
-
rescue ::GRPC::BadStatus => e
|
2014
|
-
raise ::Google::Cloud::Error.from_error(e)
|
2015
|
-
end
|
2016
|
-
|
2017
|
-
##
|
2018
|
-
# Configuration class for the DeviceManager API.
|
2019
|
-
#
|
2020
|
-
# This class represents the configuration for DeviceManager,
|
2021
|
-
# providing control over timeouts, retry behavior, logging, transport
|
2022
|
-
# parameters, and other low-level controls. Certain parameters can also be
|
2023
|
-
# applied individually to specific RPCs. See
|
2024
|
-
# {::Google::Cloud::Iot::V1::DeviceManager::Client::Configuration::Rpcs}
|
2025
|
-
# for a list of RPCs that can be configured independently.
|
2026
|
-
#
|
2027
|
-
# Configuration can be applied globally to all clients, or to a single client
|
2028
|
-
# on construction.
|
2029
|
-
#
|
2030
|
-
# @example
|
2031
|
-
#
|
2032
|
-
# # Modify the global config, setting the timeout for
|
2033
|
-
# # create_device_registry to 20 seconds,
|
2034
|
-
# # and all remaining timeouts to 10 seconds.
|
2035
|
-
# ::Google::Cloud::Iot::V1::DeviceManager::Client.configure do |config|
|
2036
|
-
# config.timeout = 10.0
|
2037
|
-
# config.rpcs.create_device_registry.timeout = 20.0
|
2038
|
-
# end
|
2039
|
-
#
|
2040
|
-
# # Apply the above configuration only to a new client.
|
2041
|
-
# client = ::Google::Cloud::Iot::V1::DeviceManager::Client.new do |config|
|
2042
|
-
# config.timeout = 10.0
|
2043
|
-
# config.rpcs.create_device_registry.timeout = 20.0
|
2044
|
-
# end
|
2045
|
-
#
|
2046
|
-
# @!attribute [rw] endpoint
|
2047
|
-
# A custom service endpoint, as a hostname or hostname:port. The default is
|
2048
|
-
# nil, indicating to use the default endpoint in the current universe domain.
|
2049
|
-
# @return [::String,nil]
|
2050
|
-
# @!attribute [rw] credentials
|
2051
|
-
# Credentials to send with calls. You may provide any of the following types:
|
2052
|
-
# * (`String`) The path to a service account key file in JSON format
|
2053
|
-
# * (`Hash`) A service account key as a Hash
|
2054
|
-
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
2055
|
-
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
2056
|
-
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
2057
|
-
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
2058
|
-
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
2059
|
-
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
2060
|
-
# * (`nil`) indicating no credentials
|
2061
|
-
# @return [::Object]
|
2062
|
-
# @!attribute [rw] scope
|
2063
|
-
# The OAuth scopes
|
2064
|
-
# @return [::Array<::String>]
|
2065
|
-
# @!attribute [rw] lib_name
|
2066
|
-
# The library name as recorded in instrumentation and logging
|
2067
|
-
# @return [::String]
|
2068
|
-
# @!attribute [rw] lib_version
|
2069
|
-
# The library version as recorded in instrumentation and logging
|
2070
|
-
# @return [::String]
|
2071
|
-
# @!attribute [rw] channel_args
|
2072
|
-
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
2073
|
-
# `GRPC::Core::Channel` object is provided as the credential.
|
2074
|
-
# @return [::Hash]
|
2075
|
-
# @!attribute [rw] interceptors
|
2076
|
-
# An array of interceptors that are run before calls are executed.
|
2077
|
-
# @return [::Array<::GRPC::ClientInterceptor>]
|
2078
|
-
# @!attribute [rw] timeout
|
2079
|
-
# The call timeout in seconds.
|
2080
|
-
# @return [::Numeric]
|
2081
|
-
# @!attribute [rw] metadata
|
2082
|
-
# Additional gRPC headers to be sent with the call.
|
2083
|
-
# @return [::Hash{::Symbol=>::String}]
|
2084
|
-
# @!attribute [rw] retry_policy
|
2085
|
-
# The retry policy. The value is a hash with the following keys:
|
2086
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2087
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2088
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2089
|
-
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2090
|
-
# trigger a retry.
|
2091
|
-
# @return [::Hash]
|
2092
|
-
# @!attribute [rw] quota_project
|
2093
|
-
# A separate project against which to charge quota.
|
2094
|
-
# @return [::String]
|
2095
|
-
# @!attribute [rw] universe_domain
|
2096
|
-
# The universe domain within which to make requests. This determines the
|
2097
|
-
# default endpoint URL. The default value of nil uses the environment
|
2098
|
-
# universe (usually the default "googleapis.com" universe).
|
2099
|
-
# @return [::String,nil]
|
2100
|
-
#
|
2101
|
-
class Configuration
|
2102
|
-
extend ::Gapic::Config
|
2103
|
-
|
2104
|
-
# @private
|
2105
|
-
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
2106
|
-
DEFAULT_ENDPOINT = "cloudiot.googleapis.com"
|
2107
|
-
|
2108
|
-
config_attr :endpoint, nil, ::String, nil
|
2109
|
-
config_attr :credentials, nil do |value|
|
2110
|
-
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
2111
|
-
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
2112
|
-
allowed.any? { |klass| klass === value }
|
2113
|
-
end
|
2114
|
-
config_attr :scope, nil, ::String, ::Array, nil
|
2115
|
-
config_attr :lib_name, nil, ::String, nil
|
2116
|
-
config_attr :lib_version, nil, ::String, nil
|
2117
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
2118
|
-
config_attr :interceptors, nil, ::Array, nil
|
2119
|
-
config_attr :timeout, nil, ::Numeric, nil
|
2120
|
-
config_attr :metadata, nil, ::Hash, nil
|
2121
|
-
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
2122
|
-
config_attr :quota_project, nil, ::String, nil
|
2123
|
-
config_attr :universe_domain, nil, ::String, nil
|
2124
|
-
|
2125
|
-
# @private
|
2126
|
-
def initialize parent_config = nil
|
2127
|
-
@parent_config = parent_config unless parent_config.nil?
|
2128
|
-
|
2129
|
-
yield self if block_given?
|
2130
|
-
end
|
2131
|
-
|
2132
|
-
##
|
2133
|
-
# Configurations for individual RPCs
|
2134
|
-
# @return [Rpcs]
|
2135
|
-
#
|
2136
|
-
def rpcs
|
2137
|
-
@rpcs ||= begin
|
2138
|
-
parent_rpcs = nil
|
2139
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
2140
|
-
Rpcs.new parent_rpcs
|
2141
|
-
end
|
2142
|
-
end
|
2143
|
-
|
2144
|
-
##
|
2145
|
-
# Configuration for the channel pool
|
2146
|
-
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
2147
|
-
#
|
2148
|
-
def channel_pool
|
2149
|
-
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
2150
|
-
end
|
2151
|
-
|
2152
|
-
##
|
2153
|
-
# Configuration RPC class for the DeviceManager API.
|
2154
|
-
#
|
2155
|
-
# Includes fields providing the configuration for each RPC in this service.
|
2156
|
-
# Each configuration object is of type `Gapic::Config::Method` and includes
|
2157
|
-
# the following configuration fields:
|
2158
|
-
#
|
2159
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
2160
|
-
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
2161
|
-
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
2162
|
-
# include the following keys:
|
2163
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2164
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2165
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2166
|
-
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2167
|
-
# trigger a retry.
|
2168
|
-
#
|
2169
|
-
class Rpcs
|
2170
|
-
##
|
2171
|
-
# RPC-specific configuration for `create_device_registry`
|
2172
|
-
# @return [::Gapic::Config::Method]
|
2173
|
-
#
|
2174
|
-
attr_reader :create_device_registry
|
2175
|
-
##
|
2176
|
-
# RPC-specific configuration for `get_device_registry`
|
2177
|
-
# @return [::Gapic::Config::Method]
|
2178
|
-
#
|
2179
|
-
attr_reader :get_device_registry
|
2180
|
-
##
|
2181
|
-
# RPC-specific configuration for `update_device_registry`
|
2182
|
-
# @return [::Gapic::Config::Method]
|
2183
|
-
#
|
2184
|
-
attr_reader :update_device_registry
|
2185
|
-
##
|
2186
|
-
# RPC-specific configuration for `delete_device_registry`
|
2187
|
-
# @return [::Gapic::Config::Method]
|
2188
|
-
#
|
2189
|
-
attr_reader :delete_device_registry
|
2190
|
-
##
|
2191
|
-
# RPC-specific configuration for `list_device_registries`
|
2192
|
-
# @return [::Gapic::Config::Method]
|
2193
|
-
#
|
2194
|
-
attr_reader :list_device_registries
|
2195
|
-
##
|
2196
|
-
# RPC-specific configuration for `create_device`
|
2197
|
-
# @return [::Gapic::Config::Method]
|
2198
|
-
#
|
2199
|
-
attr_reader :create_device
|
2200
|
-
##
|
2201
|
-
# RPC-specific configuration for `get_device`
|
2202
|
-
# @return [::Gapic::Config::Method]
|
2203
|
-
#
|
2204
|
-
attr_reader :get_device
|
2205
|
-
##
|
2206
|
-
# RPC-specific configuration for `update_device`
|
2207
|
-
# @return [::Gapic::Config::Method]
|
2208
|
-
#
|
2209
|
-
attr_reader :update_device
|
2210
|
-
##
|
2211
|
-
# RPC-specific configuration for `delete_device`
|
2212
|
-
# @return [::Gapic::Config::Method]
|
2213
|
-
#
|
2214
|
-
attr_reader :delete_device
|
2215
|
-
##
|
2216
|
-
# RPC-specific configuration for `list_devices`
|
2217
|
-
# @return [::Gapic::Config::Method]
|
2218
|
-
#
|
2219
|
-
attr_reader :list_devices
|
2220
|
-
##
|
2221
|
-
# RPC-specific configuration for `modify_cloud_to_device_config`
|
2222
|
-
# @return [::Gapic::Config::Method]
|
2223
|
-
#
|
2224
|
-
attr_reader :modify_cloud_to_device_config
|
2225
|
-
##
|
2226
|
-
# RPC-specific configuration for `list_device_config_versions`
|
2227
|
-
# @return [::Gapic::Config::Method]
|
2228
|
-
#
|
2229
|
-
attr_reader :list_device_config_versions
|
2230
|
-
##
|
2231
|
-
# RPC-specific configuration for `list_device_states`
|
2232
|
-
# @return [::Gapic::Config::Method]
|
2233
|
-
#
|
2234
|
-
attr_reader :list_device_states
|
2235
|
-
##
|
2236
|
-
# RPC-specific configuration for `set_iam_policy`
|
2237
|
-
# @return [::Gapic::Config::Method]
|
2238
|
-
#
|
2239
|
-
attr_reader :set_iam_policy
|
2240
|
-
##
|
2241
|
-
# RPC-specific configuration for `get_iam_policy`
|
2242
|
-
# @return [::Gapic::Config::Method]
|
2243
|
-
#
|
2244
|
-
attr_reader :get_iam_policy
|
2245
|
-
##
|
2246
|
-
# RPC-specific configuration for `test_iam_permissions`
|
2247
|
-
# @return [::Gapic::Config::Method]
|
2248
|
-
#
|
2249
|
-
attr_reader :test_iam_permissions
|
2250
|
-
##
|
2251
|
-
# RPC-specific configuration for `send_command_to_device`
|
2252
|
-
# @return [::Gapic::Config::Method]
|
2253
|
-
#
|
2254
|
-
attr_reader :send_command_to_device
|
2255
|
-
##
|
2256
|
-
# RPC-specific configuration for `bind_device_to_gateway`
|
2257
|
-
# @return [::Gapic::Config::Method]
|
2258
|
-
#
|
2259
|
-
attr_reader :bind_device_to_gateway
|
2260
|
-
##
|
2261
|
-
# RPC-specific configuration for `unbind_device_from_gateway`
|
2262
|
-
# @return [::Gapic::Config::Method]
|
2263
|
-
#
|
2264
|
-
attr_reader :unbind_device_from_gateway
|
2265
|
-
|
2266
|
-
# @private
|
2267
|
-
def initialize parent_rpcs = nil
|
2268
|
-
create_device_registry_config = parent_rpcs.create_device_registry if parent_rpcs.respond_to? :create_device_registry
|
2269
|
-
@create_device_registry = ::Gapic::Config::Method.new create_device_registry_config
|
2270
|
-
get_device_registry_config = parent_rpcs.get_device_registry if parent_rpcs.respond_to? :get_device_registry
|
2271
|
-
@get_device_registry = ::Gapic::Config::Method.new get_device_registry_config
|
2272
|
-
update_device_registry_config = parent_rpcs.update_device_registry if parent_rpcs.respond_to? :update_device_registry
|
2273
|
-
@update_device_registry = ::Gapic::Config::Method.new update_device_registry_config
|
2274
|
-
delete_device_registry_config = parent_rpcs.delete_device_registry if parent_rpcs.respond_to? :delete_device_registry
|
2275
|
-
@delete_device_registry = ::Gapic::Config::Method.new delete_device_registry_config
|
2276
|
-
list_device_registries_config = parent_rpcs.list_device_registries if parent_rpcs.respond_to? :list_device_registries
|
2277
|
-
@list_device_registries = ::Gapic::Config::Method.new list_device_registries_config
|
2278
|
-
create_device_config = parent_rpcs.create_device if parent_rpcs.respond_to? :create_device
|
2279
|
-
@create_device = ::Gapic::Config::Method.new create_device_config
|
2280
|
-
get_device_config = parent_rpcs.get_device if parent_rpcs.respond_to? :get_device
|
2281
|
-
@get_device = ::Gapic::Config::Method.new get_device_config
|
2282
|
-
update_device_config = parent_rpcs.update_device if parent_rpcs.respond_to? :update_device
|
2283
|
-
@update_device = ::Gapic::Config::Method.new update_device_config
|
2284
|
-
delete_device_config = parent_rpcs.delete_device if parent_rpcs.respond_to? :delete_device
|
2285
|
-
@delete_device = ::Gapic::Config::Method.new delete_device_config
|
2286
|
-
list_devices_config = parent_rpcs.list_devices if parent_rpcs.respond_to? :list_devices
|
2287
|
-
@list_devices = ::Gapic::Config::Method.new list_devices_config
|
2288
|
-
modify_cloud_to_device_config_config = parent_rpcs.modify_cloud_to_device_config if parent_rpcs.respond_to? :modify_cloud_to_device_config
|
2289
|
-
@modify_cloud_to_device_config = ::Gapic::Config::Method.new modify_cloud_to_device_config_config
|
2290
|
-
list_device_config_versions_config = parent_rpcs.list_device_config_versions if parent_rpcs.respond_to? :list_device_config_versions
|
2291
|
-
@list_device_config_versions = ::Gapic::Config::Method.new list_device_config_versions_config
|
2292
|
-
list_device_states_config = parent_rpcs.list_device_states if parent_rpcs.respond_to? :list_device_states
|
2293
|
-
@list_device_states = ::Gapic::Config::Method.new list_device_states_config
|
2294
|
-
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
2295
|
-
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
2296
|
-
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
2297
|
-
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
2298
|
-
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
2299
|
-
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
2300
|
-
send_command_to_device_config = parent_rpcs.send_command_to_device if parent_rpcs.respond_to? :send_command_to_device
|
2301
|
-
@send_command_to_device = ::Gapic::Config::Method.new send_command_to_device_config
|
2302
|
-
bind_device_to_gateway_config = parent_rpcs.bind_device_to_gateway if parent_rpcs.respond_to? :bind_device_to_gateway
|
2303
|
-
@bind_device_to_gateway = ::Gapic::Config::Method.new bind_device_to_gateway_config
|
2304
|
-
unbind_device_from_gateway_config = parent_rpcs.unbind_device_from_gateway if parent_rpcs.respond_to? :unbind_device_from_gateway
|
2305
|
-
@unbind_device_from_gateway = ::Gapic::Config::Method.new unbind_device_from_gateway_config
|
2306
|
-
|
2307
|
-
yield self if block_given?
|
2308
|
-
end
|
2309
|
-
end
|
2310
|
-
end
|
2311
|
-
end
|
2312
|
-
end
|
2313
|
-
end
|
2314
|
-
end
|
2315
|
-
end
|
2316
|
-
end
|