google-cloud-debugger-v2 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,693 @@
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/devtools/clouddebugger/v2/debugger_pb"
21
+ require "google/cloud/debugger/v2/debugger/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Debugger
26
+ module V2
27
+ module Debugger
28
+ module Rest
29
+ ##
30
+ # REST client for the Debugger service.
31
+ #
32
+ # The Debugger service provides the API that allows users to collect run-time
33
+ # information from a running application, without stopping or slowing it down
34
+ # and without modifying its state. An application may include one or
35
+ # more replicated processes performing the same work.
36
+ #
37
+ # A debugged application is represented using the Debuggee concept. The
38
+ # Debugger service provides a way to query for available debuggees, but does
39
+ # not provide a way to create one. A debuggee is created using the Controller
40
+ # service, usually by running a debugger agent with the application.
41
+ #
42
+ # The Debugger service enables the client to set one or more Breakpoints on a
43
+ # Debuggee and collect the results of the set Breakpoints.
44
+ #
45
+ class Client
46
+ # @private
47
+ attr_reader :debugger_stub
48
+
49
+ ##
50
+ # Configure the Debugger Client class.
51
+ #
52
+ # See {::Google::Cloud::Debugger::V2::Debugger::Rest::Client::Configuration}
53
+ # for a description of the configuration fields.
54
+ #
55
+ # @example
56
+ #
57
+ # # Modify the configuration for all Debugger clients
58
+ # ::Google::Cloud::Debugger::V2::Debugger::Rest::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
61
+ #
62
+ # @yield [config] Configure the Client client.
63
+ # @yieldparam config [Client::Configuration]
64
+ #
65
+ # @return [Client::Configuration]
66
+ #
67
+ def self.configure
68
+ @configure ||= begin
69
+ namespace = ["Google", "Cloud", "Debugger", "V2"]
70
+ parent_config = while namespace.any?
71
+ parent_name = namespace.join "::"
72
+ parent_const = const_get parent_name
73
+ break parent_const.configure if parent_const.respond_to? :configure
74
+ namespace.pop
75
+ end
76
+ default_config = Client::Configuration.new parent_config
77
+
78
+ default_config.rpcs.set_breakpoint.timeout = 600.0
79
+
80
+ default_config.rpcs.get_breakpoint.timeout = 600.0
81
+ default_config.rpcs.get_breakpoint.retry_policy = {
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
83
+ }
84
+
85
+ default_config.rpcs.delete_breakpoint.timeout = 600.0
86
+ default_config.rpcs.delete_breakpoint.retry_policy = {
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
88
+ }
89
+
90
+ default_config.rpcs.list_breakpoints.timeout = 600.0
91
+ default_config.rpcs.list_breakpoints.retry_policy = {
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
93
+ }
94
+
95
+ default_config.rpcs.list_debuggees.timeout = 600.0
96
+ default_config.rpcs.list_debuggees.retry_policy = {
97
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
98
+ }
99
+
100
+ default_config
101
+ end
102
+ yield @configure if block_given?
103
+ @configure
104
+ end
105
+
106
+ ##
107
+ # Configure the Debugger Client instance.
108
+ #
109
+ # The configuration is set to the derived mode, meaning that values can be changed,
110
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
111
+ # should be made on {Client.configure}.
112
+ #
113
+ # See {::Google::Cloud::Debugger::V2::Debugger::Rest::Client::Configuration}
114
+ # for a description of the configuration fields.
115
+ #
116
+ # @yield [config] Configure the Client client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ # @return [Client::Configuration]
120
+ #
121
+ def configure
122
+ yield @config if block_given?
123
+ @config
124
+ end
125
+
126
+ ##
127
+ # Create a new Debugger REST client object.
128
+ #
129
+ # @example
130
+ #
131
+ # # Create a client using the default configuration
132
+ # client = ::Google::Cloud::Debugger::V2::Debugger::Rest::Client.new
133
+ #
134
+ # # Create a client using a custom configuration
135
+ # client = ::Google::Cloud::Debugger::V2::Debugger::Rest::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
138
+ #
139
+ # @yield [config] Configure the Debugger client.
140
+ # @yieldparam config [Client::Configuration]
141
+ #
142
+ def initialize
143
+ # Create the configuration object
144
+ @config = Configuration.new Client.configure
145
+
146
+ # Yield the configuration if needed
147
+ yield @config if block_given?
148
+
149
+ # Create credentials
150
+ credentials = @config.credentials
151
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
154
+ !@config.endpoint.split(".").first.include?("-")
155
+ credentials ||= Credentials.default scope: @config.scope,
156
+ enable_self_signed_jwt: enable_self_signed_jwt
157
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
158
+ credentials = Credentials.new credentials, scope: @config.scope
159
+ end
160
+
161
+ @quota_project_id = @config.quota_project
162
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
163
+
164
+ @debugger_stub = ::Google::Cloud::Debugger::V2::Debugger::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
165
+ end
166
+
167
+ # Service calls
168
+
169
+ ##
170
+ # Sets the breakpoint to the debuggee.
171
+ #
172
+ # @overload set_breakpoint(request, options = nil)
173
+ # Pass arguments to `set_breakpoint` via a request object, either of type
174
+ # {::Google::Cloud::Debugger::V2::SetBreakpointRequest} or an equivalent Hash.
175
+ #
176
+ # @param request [::Google::Cloud::Debugger::V2::SetBreakpointRequest, ::Hash]
177
+ # A request object representing the call parameters. Required. To specify no
178
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
179
+ # @param options [::Gapic::CallOptions, ::Hash]
180
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
181
+ #
182
+ # @overload set_breakpoint(debuggee_id: nil, breakpoint: nil, client_version: nil)
183
+ # Pass arguments to `set_breakpoint` via keyword arguments. Note that at
184
+ # least one keyword argument is required. To specify no parameters, or to keep all
185
+ # the default parameter values, pass an empty Hash as a request object (see above).
186
+ #
187
+ # @param debuggee_id [::String]
188
+ # Required. ID of the debuggee where the breakpoint is to be set.
189
+ # @param breakpoint [::Google::Cloud::Debugger::V2::Breakpoint, ::Hash]
190
+ # Required. Breakpoint specification to set.
191
+ # The field `location` of the breakpoint must be set.
192
+ # @param client_version [::String]
193
+ # Required. The client version making the call.
194
+ # Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
195
+ # @yield [result, operation] Access the result along with the TransportOperation object
196
+ # @yieldparam result [::Google::Cloud::Debugger::V2::SetBreakpointResponse]
197
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
198
+ #
199
+ # @return [::Google::Cloud::Debugger::V2::SetBreakpointResponse]
200
+ #
201
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
202
+ def set_breakpoint request, options = nil
203
+ raise ::ArgumentError, "request must be provided" if request.nil?
204
+
205
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Debugger::V2::SetBreakpointRequest
206
+
207
+ # Converts hash and nil to an options object
208
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
209
+
210
+ # Customize the options with defaults
211
+ call_metadata = @config.rpcs.set_breakpoint.metadata.to_h
212
+
213
+ # Set x-goog-api-client and x-goog-user-project headers
214
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
215
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
216
+ gapic_version: ::Google::Cloud::Debugger::V2::VERSION,
217
+ transports_version_send: [:rest]
218
+
219
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
220
+
221
+ options.apply_defaults timeout: @config.rpcs.set_breakpoint.timeout,
222
+ metadata: call_metadata,
223
+ retry_policy: @config.rpcs.set_breakpoint.retry_policy
224
+
225
+ options.apply_defaults timeout: @config.timeout,
226
+ metadata: @config.metadata,
227
+ retry_policy: @config.retry_policy
228
+
229
+ @debugger_stub.set_breakpoint request, options do |result, operation|
230
+ yield result, operation if block_given?
231
+ return result
232
+ end
233
+ rescue ::Gapic::Rest::Error => e
234
+ raise ::Google::Cloud::Error.from_error(e)
235
+ end
236
+
237
+ ##
238
+ # Gets breakpoint information.
239
+ #
240
+ # @overload get_breakpoint(request, options = nil)
241
+ # Pass arguments to `get_breakpoint` via a request object, either of type
242
+ # {::Google::Cloud::Debugger::V2::GetBreakpointRequest} or an equivalent Hash.
243
+ #
244
+ # @param request [::Google::Cloud::Debugger::V2::GetBreakpointRequest, ::Hash]
245
+ # A request object representing the call parameters. Required. To specify no
246
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
247
+ # @param options [::Gapic::CallOptions, ::Hash]
248
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
249
+ #
250
+ # @overload get_breakpoint(debuggee_id: nil, breakpoint_id: nil, client_version: nil)
251
+ # Pass arguments to `get_breakpoint` via keyword arguments. Note that at
252
+ # least one keyword argument is required. To specify no parameters, or to keep all
253
+ # the default parameter values, pass an empty Hash as a request object (see above).
254
+ #
255
+ # @param debuggee_id [::String]
256
+ # Required. ID of the debuggee whose breakpoint to get.
257
+ # @param breakpoint_id [::String]
258
+ # Required. ID of the breakpoint to get.
259
+ # @param client_version [::String]
260
+ # Required. The client version making the call.
261
+ # Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
262
+ # @yield [result, operation] Access the result along with the TransportOperation object
263
+ # @yieldparam result [::Google::Cloud::Debugger::V2::GetBreakpointResponse]
264
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
265
+ #
266
+ # @return [::Google::Cloud::Debugger::V2::GetBreakpointResponse]
267
+ #
268
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
269
+ def get_breakpoint request, options = nil
270
+ raise ::ArgumentError, "request must be provided" if request.nil?
271
+
272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Debugger::V2::GetBreakpointRequest
273
+
274
+ # Converts hash and nil to an options object
275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
276
+
277
+ # Customize the options with defaults
278
+ call_metadata = @config.rpcs.get_breakpoint.metadata.to_h
279
+
280
+ # Set x-goog-api-client and x-goog-user-project headers
281
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
283
+ gapic_version: ::Google::Cloud::Debugger::V2::VERSION,
284
+ transports_version_send: [:rest]
285
+
286
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
+
288
+ options.apply_defaults timeout: @config.rpcs.get_breakpoint.timeout,
289
+ metadata: call_metadata,
290
+ retry_policy: @config.rpcs.get_breakpoint.retry_policy
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
294
+ retry_policy: @config.retry_policy
295
+
296
+ @debugger_stub.get_breakpoint request, options do |result, operation|
297
+ yield result, operation if block_given?
298
+ return result
299
+ end
300
+ rescue ::Gapic::Rest::Error => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Deletes the breakpoint from the debuggee.
306
+ #
307
+ # @overload delete_breakpoint(request, options = nil)
308
+ # Pass arguments to `delete_breakpoint` via a request object, either of type
309
+ # {::Google::Cloud::Debugger::V2::DeleteBreakpointRequest} or an equivalent Hash.
310
+ #
311
+ # @param request [::Google::Cloud::Debugger::V2::DeleteBreakpointRequest, ::Hash]
312
+ # A request object representing the call parameters. Required. To specify no
313
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
314
+ # @param options [::Gapic::CallOptions, ::Hash]
315
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
316
+ #
317
+ # @overload delete_breakpoint(debuggee_id: nil, breakpoint_id: nil, client_version: nil)
318
+ # Pass arguments to `delete_breakpoint` via keyword arguments. Note that at
319
+ # least one keyword argument is required. To specify no parameters, or to keep all
320
+ # the default parameter values, pass an empty Hash as a request object (see above).
321
+ #
322
+ # @param debuggee_id [::String]
323
+ # Required. ID of the debuggee whose breakpoint to delete.
324
+ # @param breakpoint_id [::String]
325
+ # Required. ID of the breakpoint to delete.
326
+ # @param client_version [::String]
327
+ # Required. The client version making the call.
328
+ # Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
329
+ # @yield [result, operation] Access the result along with the TransportOperation object
330
+ # @yieldparam result [::Google::Protobuf::Empty]
331
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
332
+ #
333
+ # @return [::Google::Protobuf::Empty]
334
+ #
335
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
336
+ def delete_breakpoint request, options = nil
337
+ raise ::ArgumentError, "request must be provided" if request.nil?
338
+
339
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Debugger::V2::DeleteBreakpointRequest
340
+
341
+ # Converts hash and nil to an options object
342
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
343
+
344
+ # Customize the options with defaults
345
+ call_metadata = @config.rpcs.delete_breakpoint.metadata.to_h
346
+
347
+ # Set x-goog-api-client and x-goog-user-project headers
348
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
349
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
350
+ gapic_version: ::Google::Cloud::Debugger::V2::VERSION,
351
+ transports_version_send: [:rest]
352
+
353
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
354
+
355
+ options.apply_defaults timeout: @config.rpcs.delete_breakpoint.timeout,
356
+ metadata: call_metadata,
357
+ retry_policy: @config.rpcs.delete_breakpoint.retry_policy
358
+
359
+ options.apply_defaults timeout: @config.timeout,
360
+ metadata: @config.metadata,
361
+ retry_policy: @config.retry_policy
362
+
363
+ @debugger_stub.delete_breakpoint request, options do |result, operation|
364
+ yield result, operation if block_given?
365
+ return result
366
+ end
367
+ rescue ::Gapic::Rest::Error => e
368
+ raise ::Google::Cloud::Error.from_error(e)
369
+ end
370
+
371
+ ##
372
+ # Lists all breakpoints for the debuggee.
373
+ #
374
+ # @overload list_breakpoints(request, options = nil)
375
+ # Pass arguments to `list_breakpoints` via a request object, either of type
376
+ # {::Google::Cloud::Debugger::V2::ListBreakpointsRequest} or an equivalent Hash.
377
+ #
378
+ # @param request [::Google::Cloud::Debugger::V2::ListBreakpointsRequest, ::Hash]
379
+ # A request object representing the call parameters. Required. To specify no
380
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
381
+ # @param options [::Gapic::CallOptions, ::Hash]
382
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
383
+ #
384
+ # @overload list_breakpoints(debuggee_id: nil, include_all_users: nil, include_inactive: nil, action: nil, strip_results: nil, wait_token: nil, client_version: nil)
385
+ # Pass arguments to `list_breakpoints` via keyword arguments. Note that at
386
+ # least one keyword argument is required. To specify no parameters, or to keep all
387
+ # the default parameter values, pass an empty Hash as a request object (see above).
388
+ #
389
+ # @param debuggee_id [::String]
390
+ # Required. ID of the debuggee whose breakpoints to list.
391
+ # @param include_all_users [::Boolean]
392
+ # When set to `true`, the response includes the list of breakpoints set by
393
+ # any user. Otherwise, it includes only breakpoints set by the caller.
394
+ # @param include_inactive [::Boolean]
395
+ # When set to `true`, the response includes active and inactive
396
+ # breakpoints. Otherwise, it includes only active breakpoints.
397
+ # @param action [::Google::Cloud::Debugger::V2::ListBreakpointsRequest::BreakpointActionValue, ::Hash]
398
+ # When set, the response includes only breakpoints with the specified action.
399
+ # @param strip_results [::Boolean]
400
+ # This field is deprecated. The following fields are always stripped out of
401
+ # the result: `stack_frames`, `evaluated_expressions` and `variable_table`.
402
+ # @param wait_token [::String]
403
+ # A wait token that, if specified, blocks the call until the breakpoints
404
+ # list has changed, or a server selected timeout has expired. The value
405
+ # should be set from the last response. The error code
406
+ # `google.rpc.Code.ABORTED` (RPC) is returned on wait timeout, which
407
+ # should be called again with the same `wait_token`.
408
+ # @param client_version [::String]
409
+ # Required. The client version making the call.
410
+ # Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
411
+ # @yield [result, operation] Access the result along with the TransportOperation object
412
+ # @yieldparam result [::Google::Cloud::Debugger::V2::ListBreakpointsResponse]
413
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
414
+ #
415
+ # @return [::Google::Cloud::Debugger::V2::ListBreakpointsResponse]
416
+ #
417
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
418
+ def list_breakpoints request, options = nil
419
+ raise ::ArgumentError, "request must be provided" if request.nil?
420
+
421
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Debugger::V2::ListBreakpointsRequest
422
+
423
+ # Converts hash and nil to an options object
424
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
425
+
426
+ # Customize the options with defaults
427
+ call_metadata = @config.rpcs.list_breakpoints.metadata.to_h
428
+
429
+ # Set x-goog-api-client and x-goog-user-project headers
430
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
431
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
432
+ gapic_version: ::Google::Cloud::Debugger::V2::VERSION,
433
+ transports_version_send: [:rest]
434
+
435
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
436
+
437
+ options.apply_defaults timeout: @config.rpcs.list_breakpoints.timeout,
438
+ metadata: call_metadata,
439
+ retry_policy: @config.rpcs.list_breakpoints.retry_policy
440
+
441
+ options.apply_defaults timeout: @config.timeout,
442
+ metadata: @config.metadata,
443
+ retry_policy: @config.retry_policy
444
+
445
+ @debugger_stub.list_breakpoints request, options do |result, operation|
446
+ yield result, operation if block_given?
447
+ return result
448
+ end
449
+ rescue ::Gapic::Rest::Error => e
450
+ raise ::Google::Cloud::Error.from_error(e)
451
+ end
452
+
453
+ ##
454
+ # Lists all the debuggees that the user has access to.
455
+ #
456
+ # @overload list_debuggees(request, options = nil)
457
+ # Pass arguments to `list_debuggees` via a request object, either of type
458
+ # {::Google::Cloud::Debugger::V2::ListDebuggeesRequest} or an equivalent Hash.
459
+ #
460
+ # @param request [::Google::Cloud::Debugger::V2::ListDebuggeesRequest, ::Hash]
461
+ # A request object representing the call parameters. Required. To specify no
462
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
463
+ # @param options [::Gapic::CallOptions, ::Hash]
464
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
465
+ #
466
+ # @overload list_debuggees(project: nil, include_inactive: nil, client_version: nil)
467
+ # Pass arguments to `list_debuggees` via keyword arguments. Note that at
468
+ # least one keyword argument is required. To specify no parameters, or to keep all
469
+ # the default parameter values, pass an empty Hash as a request object (see above).
470
+ #
471
+ # @param project [::String]
472
+ # Required. Project number of a Google Cloud project whose debuggees to list.
473
+ # @param include_inactive [::Boolean]
474
+ # When set to `true`, the result includes all debuggees. Otherwise, the
475
+ # result includes only debuggees that are active.
476
+ # @param client_version [::String]
477
+ # Required. The client version making the call.
478
+ # Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
479
+ # @yield [result, operation] Access the result along with the TransportOperation object
480
+ # @yieldparam result [::Google::Cloud::Debugger::V2::ListDebuggeesResponse]
481
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
482
+ #
483
+ # @return [::Google::Cloud::Debugger::V2::ListDebuggeesResponse]
484
+ #
485
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
486
+ def list_debuggees request, options = nil
487
+ raise ::ArgumentError, "request must be provided" if request.nil?
488
+
489
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Debugger::V2::ListDebuggeesRequest
490
+
491
+ # Converts hash and nil to an options object
492
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
493
+
494
+ # Customize the options with defaults
495
+ call_metadata = @config.rpcs.list_debuggees.metadata.to_h
496
+
497
+ # Set x-goog-api-client and x-goog-user-project headers
498
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
499
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
500
+ gapic_version: ::Google::Cloud::Debugger::V2::VERSION,
501
+ transports_version_send: [:rest]
502
+
503
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
504
+
505
+ options.apply_defaults timeout: @config.rpcs.list_debuggees.timeout,
506
+ metadata: call_metadata,
507
+ retry_policy: @config.rpcs.list_debuggees.retry_policy
508
+
509
+ options.apply_defaults timeout: @config.timeout,
510
+ metadata: @config.metadata,
511
+ retry_policy: @config.retry_policy
512
+
513
+ @debugger_stub.list_debuggees request, options do |result, operation|
514
+ yield result, operation if block_given?
515
+ return result
516
+ end
517
+ rescue ::Gapic::Rest::Error => e
518
+ raise ::Google::Cloud::Error.from_error(e)
519
+ end
520
+
521
+ ##
522
+ # Configuration class for the Debugger REST API.
523
+ #
524
+ # This class represents the configuration for Debugger REST,
525
+ # providing control over timeouts, retry behavior, logging, transport
526
+ # parameters, and other low-level controls. Certain parameters can also be
527
+ # applied individually to specific RPCs. See
528
+ # {::Google::Cloud::Debugger::V2::Debugger::Rest::Client::Configuration::Rpcs}
529
+ # for a list of RPCs that can be configured independently.
530
+ #
531
+ # Configuration can be applied globally to all clients, or to a single client
532
+ # on construction.
533
+ #
534
+ # @example
535
+ #
536
+ # # Modify the global config, setting the timeout for
537
+ # # set_breakpoint to 20 seconds,
538
+ # # and all remaining timeouts to 10 seconds.
539
+ # ::Google::Cloud::Debugger::V2::Debugger::Rest::Client.configure do |config|
540
+ # config.timeout = 10.0
541
+ # config.rpcs.set_breakpoint.timeout = 20.0
542
+ # end
543
+ #
544
+ # # Apply the above configuration only to a new client.
545
+ # client = ::Google::Cloud::Debugger::V2::Debugger::Rest::Client.new do |config|
546
+ # config.timeout = 10.0
547
+ # config.rpcs.set_breakpoint.timeout = 20.0
548
+ # end
549
+ #
550
+ # @!attribute [rw] endpoint
551
+ # The hostname or hostname:port of the service endpoint.
552
+ # Defaults to `"clouddebugger.googleapis.com"`.
553
+ # @return [::String]
554
+ # @!attribute [rw] credentials
555
+ # Credentials to send with calls. You may provide any of the following types:
556
+ # * (`String`) The path to a service account key file in JSON format
557
+ # * (`Hash`) A service account key as a Hash
558
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
559
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
560
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
561
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
562
+ # * (`nil`) indicating no credentials
563
+ # @return [::Object]
564
+ # @!attribute [rw] scope
565
+ # The OAuth scopes
566
+ # @return [::Array<::String>]
567
+ # @!attribute [rw] lib_name
568
+ # The library name as recorded in instrumentation and logging
569
+ # @return [::String]
570
+ # @!attribute [rw] lib_version
571
+ # The library version as recorded in instrumentation and logging
572
+ # @return [::String]
573
+ # @!attribute [rw] timeout
574
+ # The call timeout in seconds.
575
+ # @return [::Numeric]
576
+ # @!attribute [rw] metadata
577
+ # Additional headers to be sent with the call.
578
+ # @return [::Hash{::Symbol=>::String}]
579
+ # @!attribute [rw] retry_policy
580
+ # The retry policy. The value is a hash with the following keys:
581
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
582
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
583
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
584
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
585
+ # trigger a retry.
586
+ # @return [::Hash]
587
+ # @!attribute [rw] quota_project
588
+ # A separate project against which to charge quota.
589
+ # @return [::String]
590
+ #
591
+ class Configuration
592
+ extend ::Gapic::Config
593
+
594
+ config_attr :endpoint, "clouddebugger.googleapis.com", ::String
595
+ config_attr :credentials, nil do |value|
596
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
597
+ allowed.any? { |klass| klass === value }
598
+ end
599
+ config_attr :scope, nil, ::String, ::Array, nil
600
+ config_attr :lib_name, nil, ::String, nil
601
+ config_attr :lib_version, nil, ::String, nil
602
+ config_attr :timeout, nil, ::Numeric, nil
603
+ config_attr :metadata, nil, ::Hash, nil
604
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
605
+ config_attr :quota_project, nil, ::String, nil
606
+
607
+ # @private
608
+ def initialize parent_config = nil
609
+ @parent_config = parent_config unless parent_config.nil?
610
+
611
+ yield self if block_given?
612
+ end
613
+
614
+ ##
615
+ # Configurations for individual RPCs
616
+ # @return [Rpcs]
617
+ #
618
+ def rpcs
619
+ @rpcs ||= begin
620
+ parent_rpcs = nil
621
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
622
+ Rpcs.new parent_rpcs
623
+ end
624
+ end
625
+
626
+ ##
627
+ # Configuration RPC class for the Debugger API.
628
+ #
629
+ # Includes fields providing the configuration for each RPC in this service.
630
+ # Each configuration object is of type `Gapic::Config::Method` and includes
631
+ # the following configuration fields:
632
+ #
633
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
634
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
635
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
636
+ # include the following keys:
637
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
638
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
639
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
640
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
641
+ # trigger a retry.
642
+ #
643
+ class Rpcs
644
+ ##
645
+ # RPC-specific configuration for `set_breakpoint`
646
+ # @return [::Gapic::Config::Method]
647
+ #
648
+ attr_reader :set_breakpoint
649
+ ##
650
+ # RPC-specific configuration for `get_breakpoint`
651
+ # @return [::Gapic::Config::Method]
652
+ #
653
+ attr_reader :get_breakpoint
654
+ ##
655
+ # RPC-specific configuration for `delete_breakpoint`
656
+ # @return [::Gapic::Config::Method]
657
+ #
658
+ attr_reader :delete_breakpoint
659
+ ##
660
+ # RPC-specific configuration for `list_breakpoints`
661
+ # @return [::Gapic::Config::Method]
662
+ #
663
+ attr_reader :list_breakpoints
664
+ ##
665
+ # RPC-specific configuration for `list_debuggees`
666
+ # @return [::Gapic::Config::Method]
667
+ #
668
+ attr_reader :list_debuggees
669
+
670
+ # @private
671
+ def initialize parent_rpcs = nil
672
+ set_breakpoint_config = parent_rpcs.set_breakpoint if parent_rpcs.respond_to? :set_breakpoint
673
+ @set_breakpoint = ::Gapic::Config::Method.new set_breakpoint_config
674
+ get_breakpoint_config = parent_rpcs.get_breakpoint if parent_rpcs.respond_to? :get_breakpoint
675
+ @get_breakpoint = ::Gapic::Config::Method.new get_breakpoint_config
676
+ delete_breakpoint_config = parent_rpcs.delete_breakpoint if parent_rpcs.respond_to? :delete_breakpoint
677
+ @delete_breakpoint = ::Gapic::Config::Method.new delete_breakpoint_config
678
+ list_breakpoints_config = parent_rpcs.list_breakpoints if parent_rpcs.respond_to? :list_breakpoints
679
+ @list_breakpoints = ::Gapic::Config::Method.new list_breakpoints_config
680
+ list_debuggees_config = parent_rpcs.list_debuggees if parent_rpcs.respond_to? :list_debuggees
681
+ @list_debuggees = ::Gapic::Config::Method.new list_debuggees_config
682
+
683
+ yield self if block_given?
684
+ end
685
+ end
686
+ end
687
+ end
688
+ end
689
+ end
690
+ end
691
+ end
692
+ end
693
+ end