google-cloud-device_streaming-v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +153 -0
  6. data/lib/google/cloud/device_streaming/v1/direct_access_service/client.rb +978 -0
  7. data/lib/google/cloud/device_streaming/v1/direct_access_service/credentials.rb +47 -0
  8. data/lib/google/cloud/device_streaming/v1/direct_access_service/paths.rb +64 -0
  9. data/lib/google/cloud/device_streaming/v1/direct_access_service/rest/client.rb +827 -0
  10. data/lib/google/cloud/device_streaming/v1/direct_access_service/rest/service_stub.rb +389 -0
  11. data/lib/google/cloud/device_streaming/v1/direct_access_service/rest.rb +61 -0
  12. data/lib/google/cloud/device_streaming/v1/direct_access_service.rb +64 -0
  13. data/lib/google/cloud/device_streaming/v1/rest.rb +37 -0
  14. data/lib/google/cloud/device_streaming/v1/version.rb +28 -0
  15. data/lib/google/cloud/device_streaming/v1.rb +45 -0
  16. data/lib/google/cloud/devicestreaming/v1/adb_service_pb.rb +53 -0
  17. data/lib/google/cloud/devicestreaming/v1/service_pb.rb +64 -0
  18. data/lib/google/cloud/devicestreaming/v1/service_services_pb.rb +74 -0
  19. data/lib/google-cloud-device_streaming-v1.rb +21 -0
  20. data/proto_docs/README.md +4 -0
  21. data/proto_docs/google/api/client.rb +473 -0
  22. data/proto_docs/google/api/field_behavior.rb +85 -0
  23. data/proto_docs/google/api/launch_stage.rb +71 -0
  24. data/proto_docs/google/api/resource.rb +227 -0
  25. data/proto_docs/google/cloud/devicestreaming/v1/adb_service.rb +192 -0
  26. data/proto_docs/google/cloud/devicestreaming/v1/service.rb +234 -0
  27. data/proto_docs/google/protobuf/duration.rb +98 -0
  28. data/proto_docs/google/protobuf/empty.rb +34 -0
  29. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  30. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  31. metadata +99 -0
@@ -0,0 +1,827 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/devicestreaming/v1/service_pb"
21
+ require "google/cloud/device_streaming/v1/direct_access_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DeviceStreaming
26
+ module V1
27
+ module DirectAccessService
28
+ module Rest
29
+ ##
30
+ # REST client for the DirectAccessService service.
31
+ #
32
+ # A service for allocating Android devices and interacting with the
33
+ # live-allocated devices.
34
+ #
35
+ # Each Session will wait for available capacity, at a higher
36
+ # priority over Test Execution. When allocated, the session will be exposed
37
+ # through a stream for integration.
38
+ #
39
+ # DirectAccessService is currently available as a preview to select developers.
40
+ # You can register today on behalf of you and your team at
41
+ # https://developer.android.com/studio/preview/android-device-streaming
42
+ #
43
+ class Client
44
+ # @private
45
+ API_VERSION = ""
46
+
47
+ # @private
48
+ DEFAULT_ENDPOINT_TEMPLATE = "devicestreaming.$UNIVERSE_DOMAIN$"
49
+
50
+ include Paths
51
+
52
+ # @private
53
+ attr_reader :direct_access_service_stub
54
+
55
+ ##
56
+ # Configure the DirectAccessService Client class.
57
+ #
58
+ # See {::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client::Configuration}
59
+ # for a description of the configuration fields.
60
+ #
61
+ # @example
62
+ #
63
+ # # Modify the configuration for all DirectAccessService clients
64
+ # ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.configure do |config|
65
+ # config.timeout = 10.0
66
+ # end
67
+ #
68
+ # @yield [config] Configure the Client client.
69
+ # @yieldparam config [Client::Configuration]
70
+ #
71
+ # @return [Client::Configuration]
72
+ #
73
+ def self.configure
74
+ @configure ||= begin
75
+ namespace = ["Google", "Cloud", "DeviceStreaming", "V1"]
76
+ parent_config = while namespace.any?
77
+ parent_name = namespace.join "::"
78
+ parent_const = const_get parent_name
79
+ break parent_const.configure if parent_const.respond_to? :configure
80
+ namespace.pop
81
+ end
82
+ default_config = Client::Configuration.new parent_config
83
+
84
+ default_config.rpcs.create_device_session.timeout = 20.0
85
+
86
+ default_config.rpcs.list_device_sessions.timeout = 20.0
87
+ default_config.rpcs.list_device_sessions.retry_policy = {
88
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
89
+ }
90
+
91
+ default_config.rpcs.get_device_session.timeout = 20.0
92
+ default_config.rpcs.get_device_session.retry_policy = {
93
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
94
+ }
95
+
96
+ default_config.rpcs.cancel_device_session.timeout = 20.0
97
+ default_config.rpcs.cancel_device_session.retry_policy = {
98
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
99
+ }
100
+
101
+ default_config.rpcs.update_device_session.timeout = 20.0
102
+
103
+ default_config
104
+ end
105
+ yield @configure if block_given?
106
+ @configure
107
+ end
108
+
109
+ ##
110
+ # Configure the DirectAccessService Client instance.
111
+ #
112
+ # The configuration is set to the derived mode, meaning that values can be changed,
113
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
114
+ # should be made on {Client.configure}.
115
+ #
116
+ # See {::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client::Configuration}
117
+ # for a description of the configuration fields.
118
+ #
119
+ # @yield [config] Configure the Client client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ # @return [Client::Configuration]
123
+ #
124
+ def configure
125
+ yield @config if block_given?
126
+ @config
127
+ end
128
+
129
+ ##
130
+ # The effective universe domain
131
+ #
132
+ # @return [String]
133
+ #
134
+ def universe_domain
135
+ @direct_access_service_stub.universe_domain
136
+ end
137
+
138
+ ##
139
+ # Create a new DirectAccessService REST client object.
140
+ #
141
+ # @example
142
+ #
143
+ # # Create a client using the default configuration
144
+ # client = ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new
145
+ #
146
+ # # Create a client using a custom configuration
147
+ # client = ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new do |config|
148
+ # config.timeout = 10.0
149
+ # end
150
+ #
151
+ # @yield [config] Configure the DirectAccessService client.
152
+ # @yieldparam config [Client::Configuration]
153
+ #
154
+ def initialize
155
+ # Create the configuration object
156
+ @config = Configuration.new Client.configure
157
+
158
+ # Yield the configuration if needed
159
+ yield @config if block_given?
160
+
161
+ # Create credentials
162
+ credentials = @config.credentials
163
+ # Use self-signed JWT if the endpoint is unchanged from default,
164
+ # but only if the default endpoint does not have a region prefix.
165
+ enable_self_signed_jwt = @config.endpoint.nil? ||
166
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
167
+ !@config.endpoint.split(".").first.include?("-"))
168
+ credentials ||= Credentials.default scope: @config.scope,
169
+ enable_self_signed_jwt: enable_self_signed_jwt
170
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
171
+ credentials = Credentials.new credentials, scope: @config.scope
172
+ end
173
+
174
+ @quota_project_id = @config.quota_project
175
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
176
+
177
+ @direct_access_service_stub = ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::ServiceStub.new(
178
+ endpoint: @config.endpoint,
179
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
180
+ universe_domain: @config.universe_domain,
181
+ credentials: credentials,
182
+ logger: @config.logger
183
+ )
184
+
185
+ @direct_access_service_stub.logger(stub: true)&.info do |entry|
186
+ entry.set_system_name
187
+ entry.set_service
188
+ entry.message = "Created client for #{entry.service}"
189
+ entry.set_credentials_fields credentials
190
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
191
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
192
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
193
+ end
194
+ end
195
+
196
+ ##
197
+ # The logger used for request/response debug logging.
198
+ #
199
+ # @return [Logger]
200
+ #
201
+ def logger
202
+ @direct_access_service_stub.logger
203
+ end
204
+
205
+ # Service calls
206
+
207
+ ##
208
+ # Creates a DeviceSession.
209
+ #
210
+ # @overload create_device_session(request, options = nil)
211
+ # Pass arguments to `create_device_session` via a request object, either of type
212
+ # {::Google::Cloud::DeviceStreaming::V1::CreateDeviceSessionRequest} or an equivalent Hash.
213
+ #
214
+ # @param request [::Google::Cloud::DeviceStreaming::V1::CreateDeviceSessionRequest, ::Hash]
215
+ # A request object representing the call parameters. Required. To specify no
216
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
217
+ # @param options [::Gapic::CallOptions, ::Hash]
218
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
219
+ #
220
+ # @overload create_device_session(parent: nil, device_session: nil, device_session_id: nil)
221
+ # Pass arguments to `create_device_session` via keyword arguments. Note that at
222
+ # least one keyword argument is required. To specify no parameters, or to keep all
223
+ # the default parameter values, pass an empty Hash as a request object (see above).
224
+ #
225
+ # @param parent [::String]
226
+ # Required. The Compute Engine project under which this device will be
227
+ # allocated. "projects/\\{project_id}"
228
+ # @param device_session [::Google::Cloud::DeviceStreaming::V1::DeviceSession, ::Hash]
229
+ # Required. A DeviceSession to create.
230
+ # @param device_session_id [::String]
231
+ # Optional. The ID to use for the DeviceSession, which will become the final
232
+ # component of the DeviceSession's resource name.
233
+ #
234
+ # This value should be 4-63 characters, and valid characters
235
+ # are /[a-z][0-9]-/.
236
+ # @yield [result, operation] Access the result along with the TransportOperation object
237
+ # @yieldparam result [::Google::Cloud::DeviceStreaming::V1::DeviceSession]
238
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
239
+ #
240
+ # @return [::Google::Cloud::DeviceStreaming::V1::DeviceSession]
241
+ #
242
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
243
+ #
244
+ # @example Basic example
245
+ # require "google/cloud/device_streaming/v1"
246
+ #
247
+ # # Create a client object. The client can be reused for multiple calls.
248
+ # client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new
249
+ #
250
+ # # Create a request. To set request fields, pass in keyword arguments.
251
+ # request = Google::Cloud::DeviceStreaming::V1::CreateDeviceSessionRequest.new
252
+ #
253
+ # # Call the create_device_session method.
254
+ # result = client.create_device_session request
255
+ #
256
+ # # The returned object is of type Google::Cloud::DeviceStreaming::V1::DeviceSession.
257
+ # p result
258
+ #
259
+ def create_device_session request, options = nil
260
+ raise ::ArgumentError, "request must be provided" if request.nil?
261
+
262
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeviceStreaming::V1::CreateDeviceSessionRequest
263
+
264
+ # Converts hash and nil to an options object
265
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
266
+
267
+ # Customize the options with defaults
268
+ call_metadata = @config.rpcs.create_device_session.metadata.to_h
269
+
270
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
271
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
272
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
273
+ gapic_version: ::Google::Cloud::DeviceStreaming::V1::VERSION,
274
+ transports_version_send: [:rest]
275
+
276
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
277
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
278
+
279
+ options.apply_defaults timeout: @config.rpcs.create_device_session.timeout,
280
+ metadata: call_metadata,
281
+ retry_policy: @config.rpcs.create_device_session.retry_policy
282
+
283
+ options.apply_defaults timeout: @config.timeout,
284
+ metadata: @config.metadata,
285
+ retry_policy: @config.retry_policy
286
+
287
+ @direct_access_service_stub.create_device_session request, options do |result, operation|
288
+ yield result, operation if block_given?
289
+ end
290
+ rescue ::Gapic::Rest::Error => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Lists DeviceSessions owned by the project user.
296
+ #
297
+ # @overload list_device_sessions(request, options = nil)
298
+ # Pass arguments to `list_device_sessions` via a request object, either of type
299
+ # {::Google::Cloud::DeviceStreaming::V1::ListDeviceSessionsRequest} or an equivalent Hash.
300
+ #
301
+ # @param request [::Google::Cloud::DeviceStreaming::V1::ListDeviceSessionsRequest, ::Hash]
302
+ # A request object representing the call parameters. Required. To specify no
303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
304
+ # @param options [::Gapic::CallOptions, ::Hash]
305
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
306
+ #
307
+ # @overload list_device_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil)
308
+ # Pass arguments to `list_device_sessions` via keyword arguments. Note that at
309
+ # least one keyword argument is required. To specify no parameters, or to keep all
310
+ # the default parameter values, pass an empty Hash as a request object (see above).
311
+ #
312
+ # @param parent [::String]
313
+ # Required. The name of the parent to request, e.g. "projects/\\{project_id}"
314
+ # @param page_size [::Integer]
315
+ # Optional. The maximum number of DeviceSessions to return.
316
+ # @param page_token [::String]
317
+ # Optional. A continuation token for paging.
318
+ # @param filter [::String]
319
+ # Optional. If specified, responses will be filtered by the given filter.
320
+ # Allowed fields are: session_state.
321
+ # @yield [result, operation] Access the result along with the TransportOperation object
322
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DeviceStreaming::V1::DeviceSession>]
323
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
324
+ #
325
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DeviceStreaming::V1::DeviceSession>]
326
+ #
327
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
328
+ #
329
+ # @example Basic example
330
+ # require "google/cloud/device_streaming/v1"
331
+ #
332
+ # # Create a client object. The client can be reused for multiple calls.
333
+ # client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new
334
+ #
335
+ # # Create a request. To set request fields, pass in keyword arguments.
336
+ # request = Google::Cloud::DeviceStreaming::V1::ListDeviceSessionsRequest.new
337
+ #
338
+ # # Call the list_device_sessions method.
339
+ # result = client.list_device_sessions request
340
+ #
341
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
342
+ # # over elements, and API calls will be issued to fetch pages as needed.
343
+ # result.each do |item|
344
+ # # Each element is of type ::Google::Cloud::DeviceStreaming::V1::DeviceSession.
345
+ # p item
346
+ # end
347
+ #
348
+ def list_device_sessions request, options = nil
349
+ raise ::ArgumentError, "request must be provided" if request.nil?
350
+
351
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeviceStreaming::V1::ListDeviceSessionsRequest
352
+
353
+ # Converts hash and nil to an options object
354
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
355
+
356
+ # Customize the options with defaults
357
+ call_metadata = @config.rpcs.list_device_sessions.metadata.to_h
358
+
359
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
360
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
361
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
362
+ gapic_version: ::Google::Cloud::DeviceStreaming::V1::VERSION,
363
+ transports_version_send: [:rest]
364
+
365
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
366
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
367
+
368
+ options.apply_defaults timeout: @config.rpcs.list_device_sessions.timeout,
369
+ metadata: call_metadata,
370
+ retry_policy: @config.rpcs.list_device_sessions.retry_policy
371
+
372
+ options.apply_defaults timeout: @config.timeout,
373
+ metadata: @config.metadata,
374
+ retry_policy: @config.retry_policy
375
+
376
+ @direct_access_service_stub.list_device_sessions request, options do |result, operation|
377
+ result = ::Gapic::Rest::PagedEnumerable.new @direct_access_service_stub, :list_device_sessions, "device_sessions", request, result, options
378
+ yield result, operation if block_given?
379
+ throw :response, result
380
+ end
381
+ rescue ::Gapic::Rest::Error => e
382
+ raise ::Google::Cloud::Error.from_error(e)
383
+ end
384
+
385
+ ##
386
+ # Gets a DeviceSession, which documents the allocation status and
387
+ # whether the device is allocated. Clients making requests from this API
388
+ # must poll GetDeviceSession.
389
+ #
390
+ # @overload get_device_session(request, options = nil)
391
+ # Pass arguments to `get_device_session` via a request object, either of type
392
+ # {::Google::Cloud::DeviceStreaming::V1::GetDeviceSessionRequest} or an equivalent Hash.
393
+ #
394
+ # @param request [::Google::Cloud::DeviceStreaming::V1::GetDeviceSessionRequest, ::Hash]
395
+ # A request object representing the call parameters. Required. To specify no
396
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
397
+ # @param options [::Gapic::CallOptions, ::Hash]
398
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
399
+ #
400
+ # @overload get_device_session(name: nil)
401
+ # Pass arguments to `get_device_session` via keyword arguments. Note that at
402
+ # least one keyword argument is required. To specify no parameters, or to keep all
403
+ # the default parameter values, pass an empty Hash as a request object (see above).
404
+ #
405
+ # @param name [::String]
406
+ # Required. Name of the DeviceSession, e.g.
407
+ # "projects/\\{project_id}/deviceSessions/\\{session_id}"
408
+ # @yield [result, operation] Access the result along with the TransportOperation object
409
+ # @yieldparam result [::Google::Cloud::DeviceStreaming::V1::DeviceSession]
410
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
411
+ #
412
+ # @return [::Google::Cloud::DeviceStreaming::V1::DeviceSession]
413
+ #
414
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
415
+ #
416
+ # @example Basic example
417
+ # require "google/cloud/device_streaming/v1"
418
+ #
419
+ # # Create a client object. The client can be reused for multiple calls.
420
+ # client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new
421
+ #
422
+ # # Create a request. To set request fields, pass in keyword arguments.
423
+ # request = Google::Cloud::DeviceStreaming::V1::GetDeviceSessionRequest.new
424
+ #
425
+ # # Call the get_device_session method.
426
+ # result = client.get_device_session request
427
+ #
428
+ # # The returned object is of type Google::Cloud::DeviceStreaming::V1::DeviceSession.
429
+ # p result
430
+ #
431
+ def get_device_session request, options = nil
432
+ raise ::ArgumentError, "request must be provided" if request.nil?
433
+
434
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeviceStreaming::V1::GetDeviceSessionRequest
435
+
436
+ # Converts hash and nil to an options object
437
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
438
+
439
+ # Customize the options with defaults
440
+ call_metadata = @config.rpcs.get_device_session.metadata.to_h
441
+
442
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
443
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
444
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
445
+ gapic_version: ::Google::Cloud::DeviceStreaming::V1::VERSION,
446
+ transports_version_send: [:rest]
447
+
448
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
449
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
450
+
451
+ options.apply_defaults timeout: @config.rpcs.get_device_session.timeout,
452
+ metadata: call_metadata,
453
+ retry_policy: @config.rpcs.get_device_session.retry_policy
454
+
455
+ options.apply_defaults timeout: @config.timeout,
456
+ metadata: @config.metadata,
457
+ retry_policy: @config.retry_policy
458
+
459
+ @direct_access_service_stub.get_device_session request, options do |result, operation|
460
+ yield result, operation if block_given?
461
+ end
462
+ rescue ::Gapic::Rest::Error => e
463
+ raise ::Google::Cloud::Error.from_error(e)
464
+ end
465
+
466
+ ##
467
+ # Cancel a DeviceSession.
468
+ # This RPC changes the DeviceSession to state FINISHED and terminates all
469
+ # connections.
470
+ # Canceled sessions are not deleted and can be retrieved or
471
+ # listed by the user until they expire based on the 28 day deletion policy.
472
+ #
473
+ # @overload cancel_device_session(request, options = nil)
474
+ # Pass arguments to `cancel_device_session` via a request object, either of type
475
+ # {::Google::Cloud::DeviceStreaming::V1::CancelDeviceSessionRequest} or an equivalent Hash.
476
+ #
477
+ # @param request [::Google::Cloud::DeviceStreaming::V1::CancelDeviceSessionRequest, ::Hash]
478
+ # A request object representing the call parameters. Required. To specify no
479
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
480
+ # @param options [::Gapic::CallOptions, ::Hash]
481
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
482
+ #
483
+ # @overload cancel_device_session(name: nil)
484
+ # Pass arguments to `cancel_device_session` via keyword arguments. Note that at
485
+ # least one keyword argument is required. To specify no parameters, or to keep all
486
+ # the default parameter values, pass an empty Hash as a request object (see above).
487
+ #
488
+ # @param name [::String]
489
+ # Required. Name of the DeviceSession, e.g.
490
+ # "projects/\\{project_id}/deviceSessions/\\{session_id}"
491
+ # @yield [result, operation] Access the result along with the TransportOperation object
492
+ # @yieldparam result [::Google::Protobuf::Empty]
493
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
494
+ #
495
+ # @return [::Google::Protobuf::Empty]
496
+ #
497
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
498
+ #
499
+ # @example Basic example
500
+ # require "google/cloud/device_streaming/v1"
501
+ #
502
+ # # Create a client object. The client can be reused for multiple calls.
503
+ # client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new
504
+ #
505
+ # # Create a request. To set request fields, pass in keyword arguments.
506
+ # request = Google::Cloud::DeviceStreaming::V1::CancelDeviceSessionRequest.new
507
+ #
508
+ # # Call the cancel_device_session method.
509
+ # result = client.cancel_device_session request
510
+ #
511
+ # # The returned object is of type Google::Protobuf::Empty.
512
+ # p result
513
+ #
514
+ def cancel_device_session request, options = nil
515
+ raise ::ArgumentError, "request must be provided" if request.nil?
516
+
517
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeviceStreaming::V1::CancelDeviceSessionRequest
518
+
519
+ # Converts hash and nil to an options object
520
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
521
+
522
+ # Customize the options with defaults
523
+ call_metadata = @config.rpcs.cancel_device_session.metadata.to_h
524
+
525
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
526
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
527
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
528
+ gapic_version: ::Google::Cloud::DeviceStreaming::V1::VERSION,
529
+ transports_version_send: [:rest]
530
+
531
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
532
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
533
+
534
+ options.apply_defaults timeout: @config.rpcs.cancel_device_session.timeout,
535
+ metadata: call_metadata,
536
+ retry_policy: @config.rpcs.cancel_device_session.retry_policy
537
+
538
+ options.apply_defaults timeout: @config.timeout,
539
+ metadata: @config.metadata,
540
+ retry_policy: @config.retry_policy
541
+
542
+ @direct_access_service_stub.cancel_device_session request, options do |result, operation|
543
+ yield result, operation if block_given?
544
+ end
545
+ rescue ::Gapic::Rest::Error => e
546
+ raise ::Google::Cloud::Error.from_error(e)
547
+ end
548
+
549
+ ##
550
+ # Updates the current DeviceSession to the fields described by the
551
+ # update_mask.
552
+ #
553
+ # @overload update_device_session(request, options = nil)
554
+ # Pass arguments to `update_device_session` via a request object, either of type
555
+ # {::Google::Cloud::DeviceStreaming::V1::UpdateDeviceSessionRequest} or an equivalent Hash.
556
+ #
557
+ # @param request [::Google::Cloud::DeviceStreaming::V1::UpdateDeviceSessionRequest, ::Hash]
558
+ # A request object representing the call parameters. Required. To specify no
559
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
560
+ # @param options [::Gapic::CallOptions, ::Hash]
561
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
562
+ #
563
+ # @overload update_device_session(device_session: nil, update_mask: nil)
564
+ # Pass arguments to `update_device_session` via keyword arguments. Note that at
565
+ # least one keyword argument is required. To specify no parameters, or to keep all
566
+ # the default parameter values, pass an empty Hash as a request object (see above).
567
+ #
568
+ # @param device_session [::Google::Cloud::DeviceStreaming::V1::DeviceSession, ::Hash]
569
+ # Required. DeviceSession to update.
570
+ # The DeviceSession's `name` field is used to identify the session to update
571
+ # "projects/\\{project_id}/deviceSessions/\\{session_id}"
572
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
573
+ # Optional. The list of fields to update.
574
+ # @yield [result, operation] Access the result along with the TransportOperation object
575
+ # @yieldparam result [::Google::Cloud::DeviceStreaming::V1::DeviceSession]
576
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
577
+ #
578
+ # @return [::Google::Cloud::DeviceStreaming::V1::DeviceSession]
579
+ #
580
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
581
+ #
582
+ # @example Basic example
583
+ # require "google/cloud/device_streaming/v1"
584
+ #
585
+ # # Create a client object. The client can be reused for multiple calls.
586
+ # client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new
587
+ #
588
+ # # Create a request. To set request fields, pass in keyword arguments.
589
+ # request = Google::Cloud::DeviceStreaming::V1::UpdateDeviceSessionRequest.new
590
+ #
591
+ # # Call the update_device_session method.
592
+ # result = client.update_device_session request
593
+ #
594
+ # # The returned object is of type Google::Cloud::DeviceStreaming::V1::DeviceSession.
595
+ # p result
596
+ #
597
+ def update_device_session request, options = nil
598
+ raise ::ArgumentError, "request must be provided" if request.nil?
599
+
600
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DeviceStreaming::V1::UpdateDeviceSessionRequest
601
+
602
+ # Converts hash and nil to an options object
603
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
604
+
605
+ # Customize the options with defaults
606
+ call_metadata = @config.rpcs.update_device_session.metadata.to_h
607
+
608
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
609
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
610
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
611
+ gapic_version: ::Google::Cloud::DeviceStreaming::V1::VERSION,
612
+ transports_version_send: [:rest]
613
+
614
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
615
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
616
+
617
+ options.apply_defaults timeout: @config.rpcs.update_device_session.timeout,
618
+ metadata: call_metadata,
619
+ retry_policy: @config.rpcs.update_device_session.retry_policy
620
+
621
+ options.apply_defaults timeout: @config.timeout,
622
+ metadata: @config.metadata,
623
+ retry_policy: @config.retry_policy
624
+
625
+ @direct_access_service_stub.update_device_session request, options do |result, operation|
626
+ yield result, operation if block_given?
627
+ end
628
+ rescue ::Gapic::Rest::Error => e
629
+ raise ::Google::Cloud::Error.from_error(e)
630
+ end
631
+
632
+ ##
633
+ # Configuration class for the DirectAccessService REST API.
634
+ #
635
+ # This class represents the configuration for DirectAccessService REST,
636
+ # providing control over timeouts, retry behavior, logging, transport
637
+ # parameters, and other low-level controls. Certain parameters can also be
638
+ # applied individually to specific RPCs. See
639
+ # {::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client::Configuration::Rpcs}
640
+ # for a list of RPCs that can be configured independently.
641
+ #
642
+ # Configuration can be applied globally to all clients, or to a single client
643
+ # on construction.
644
+ #
645
+ # @example
646
+ #
647
+ # # Modify the global config, setting the timeout for
648
+ # # create_device_session to 20 seconds,
649
+ # # and all remaining timeouts to 10 seconds.
650
+ # ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.configure do |config|
651
+ # config.timeout = 10.0
652
+ # config.rpcs.create_device_session.timeout = 20.0
653
+ # end
654
+ #
655
+ # # Apply the above configuration only to a new client.
656
+ # client = ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new do |config|
657
+ # config.timeout = 10.0
658
+ # config.rpcs.create_device_session.timeout = 20.0
659
+ # end
660
+ #
661
+ # @!attribute [rw] endpoint
662
+ # A custom service endpoint, as a hostname or hostname:port. The default is
663
+ # nil, indicating to use the default endpoint in the current universe domain.
664
+ # @return [::String,nil]
665
+ # @!attribute [rw] credentials
666
+ # Credentials to send with calls. You may provide any of the following types:
667
+ # * (`String`) The path to a service account key file in JSON format
668
+ # * (`Hash`) A service account key as a Hash
669
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
670
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
671
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
672
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
673
+ # * (`nil`) indicating no credentials
674
+ #
675
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
676
+ # external source for authentication to Google Cloud, you must validate it before
677
+ # providing it to a Google API client library. Providing an unvalidated credential
678
+ # configuration to Google APIs can compromise the security of your systems and data.
679
+ # For more information, refer to [Validate credential configurations from external
680
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
681
+ # @return [::Object]
682
+ # @!attribute [rw] scope
683
+ # The OAuth scopes
684
+ # @return [::Array<::String>]
685
+ # @!attribute [rw] lib_name
686
+ # The library name as recorded in instrumentation and logging
687
+ # @return [::String]
688
+ # @!attribute [rw] lib_version
689
+ # The library version as recorded in instrumentation and logging
690
+ # @return [::String]
691
+ # @!attribute [rw] timeout
692
+ # The call timeout in seconds.
693
+ # @return [::Numeric]
694
+ # @!attribute [rw] metadata
695
+ # Additional headers to be sent with the call.
696
+ # @return [::Hash{::Symbol=>::String}]
697
+ # @!attribute [rw] retry_policy
698
+ # The retry policy. The value is a hash with the following keys:
699
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
700
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
701
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
702
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
703
+ # trigger a retry.
704
+ # @return [::Hash]
705
+ # @!attribute [rw] quota_project
706
+ # A separate project against which to charge quota.
707
+ # @return [::String]
708
+ # @!attribute [rw] universe_domain
709
+ # The universe domain within which to make requests. This determines the
710
+ # default endpoint URL. The default value of nil uses the environment
711
+ # universe (usually the default "googleapis.com" universe).
712
+ # @return [::String,nil]
713
+ # @!attribute [rw] logger
714
+ # A custom logger to use for request/response debug logging, or the value
715
+ # `:default` (the default) to construct a default logger, or `nil` to
716
+ # explicitly disable logging.
717
+ # @return [::Logger,:default,nil]
718
+ #
719
+ class Configuration
720
+ extend ::Gapic::Config
721
+
722
+ # @private
723
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
724
+ DEFAULT_ENDPOINT = "devicestreaming.googleapis.com"
725
+
726
+ config_attr :endpoint, nil, ::String, nil
727
+ config_attr :credentials, nil do |value|
728
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
729
+ allowed.any? { |klass| klass === value }
730
+ end
731
+ config_attr :scope, nil, ::String, ::Array, nil
732
+ config_attr :lib_name, nil, ::String, nil
733
+ config_attr :lib_version, nil, ::String, nil
734
+ config_attr :timeout, nil, ::Numeric, nil
735
+ config_attr :metadata, nil, ::Hash, nil
736
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
737
+ config_attr :quota_project, nil, ::String, nil
738
+ config_attr :universe_domain, nil, ::String, nil
739
+ config_attr :logger, :default, ::Logger, nil, :default
740
+
741
+ # @private
742
+ def initialize parent_config = nil
743
+ @parent_config = parent_config unless parent_config.nil?
744
+
745
+ yield self if block_given?
746
+ end
747
+
748
+ ##
749
+ # Configurations for individual RPCs
750
+ # @return [Rpcs]
751
+ #
752
+ def rpcs
753
+ @rpcs ||= begin
754
+ parent_rpcs = nil
755
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
756
+ Rpcs.new parent_rpcs
757
+ end
758
+ end
759
+
760
+ ##
761
+ # Configuration RPC class for the DirectAccessService API.
762
+ #
763
+ # Includes fields providing the configuration for each RPC in this service.
764
+ # Each configuration object is of type `Gapic::Config::Method` and includes
765
+ # the following configuration fields:
766
+ #
767
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
768
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
769
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
770
+ # include the following keys:
771
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
772
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
773
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
774
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
775
+ # trigger a retry.
776
+ #
777
+ class Rpcs
778
+ ##
779
+ # RPC-specific configuration for `create_device_session`
780
+ # @return [::Gapic::Config::Method]
781
+ #
782
+ attr_reader :create_device_session
783
+ ##
784
+ # RPC-specific configuration for `list_device_sessions`
785
+ # @return [::Gapic::Config::Method]
786
+ #
787
+ attr_reader :list_device_sessions
788
+ ##
789
+ # RPC-specific configuration for `get_device_session`
790
+ # @return [::Gapic::Config::Method]
791
+ #
792
+ attr_reader :get_device_session
793
+ ##
794
+ # RPC-specific configuration for `cancel_device_session`
795
+ # @return [::Gapic::Config::Method]
796
+ #
797
+ attr_reader :cancel_device_session
798
+ ##
799
+ # RPC-specific configuration for `update_device_session`
800
+ # @return [::Gapic::Config::Method]
801
+ #
802
+ attr_reader :update_device_session
803
+
804
+ # @private
805
+ def initialize parent_rpcs = nil
806
+ create_device_session_config = parent_rpcs.create_device_session if parent_rpcs.respond_to? :create_device_session
807
+ @create_device_session = ::Gapic::Config::Method.new create_device_session_config
808
+ list_device_sessions_config = parent_rpcs.list_device_sessions if parent_rpcs.respond_to? :list_device_sessions
809
+ @list_device_sessions = ::Gapic::Config::Method.new list_device_sessions_config
810
+ get_device_session_config = parent_rpcs.get_device_session if parent_rpcs.respond_to? :get_device_session
811
+ @get_device_session = ::Gapic::Config::Method.new get_device_session_config
812
+ cancel_device_session_config = parent_rpcs.cancel_device_session if parent_rpcs.respond_to? :cancel_device_session
813
+ @cancel_device_session = ::Gapic::Config::Method.new cancel_device_session_config
814
+ update_device_session_config = parent_rpcs.update_device_session if parent_rpcs.respond_to? :update_device_session
815
+ @update_device_session = ::Gapic::Config::Method.new update_device_session_config
816
+
817
+ yield self if block_given?
818
+ end
819
+ end
820
+ end
821
+ end
822
+ end
823
+ end
824
+ end
825
+ end
826
+ end
827
+ end