google-cloud-iot-v1 0.9.2 → 1.0.0

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