google-cloud-managed_kafka-v1 1.0.1 → 1.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.
@@ -0,0 +1,914 @@
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 "gapic/operation"
20
+
21
+ module Google
22
+ module Cloud
23
+ module ManagedKafka
24
+ module V1
25
+ module ManagedKafkaConnect
26
+ module Rest
27
+ # Service that implements Longrunning Operations API.
28
+ class Operations
29
+ # @private
30
+ API_VERSION = ""
31
+
32
+ # @private
33
+ DEFAULT_ENDPOINT_TEMPLATE = "managedkafka.$UNIVERSE_DOMAIN$"
34
+
35
+ # @private
36
+ attr_reader :operations_stub
37
+
38
+ ##
39
+ # Configuration for the ManagedKafkaConnect Operations API.
40
+ #
41
+ # @yield [config] Configure the Operations client.
42
+ # @yieldparam config [Operations::Configuration]
43
+ #
44
+ # @return [Operations::Configuration]
45
+ #
46
+ def self.configure
47
+ @configure ||= Operations::Configuration.new
48
+ yield @configure if block_given?
49
+ @configure
50
+ end
51
+
52
+ ##
53
+ # Configure the ManagedKafkaConnect Operations instance.
54
+ #
55
+ # The configuration is set to the derived mode, meaning that values can be changed,
56
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
57
+ # should be made on {Operations.configure}.
58
+ #
59
+ # @yield [config] Configure the Operations client.
60
+ # @yieldparam config [Operations::Configuration]
61
+ #
62
+ # @return [Operations::Configuration]
63
+ #
64
+ def configure
65
+ yield @config if block_given?
66
+ @config
67
+ end
68
+
69
+ ##
70
+ # The effective universe domain
71
+ #
72
+ # @return [String]
73
+ #
74
+ def universe_domain
75
+ @operations_stub.universe_domain
76
+ end
77
+
78
+ ##
79
+ # Create a new Operations client object.
80
+ #
81
+ # @yield [config] Configure the Client client.
82
+ # @yieldparam config [Operations::Configuration]
83
+ #
84
+ def initialize
85
+ # Create the configuration object
86
+ @config = Configuration.new Operations.configure
87
+
88
+ # Yield the configuration if needed
89
+ yield @config if block_given?
90
+
91
+ # Create credentials
92
+ credentials = @config.credentials
93
+ credentials ||= Credentials.default scope: @config.scope
94
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
95
+ credentials = Credentials.new credentials, scope: @config.scope
96
+ end
97
+
98
+ @quota_project_id = @config.quota_project
99
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
100
+
101
+ @operations_stub = OperationsServiceStub.new(
102
+ endpoint: @config.endpoint,
103
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
104
+ universe_domain: @config.universe_domain,
105
+ credentials: credentials
106
+ )
107
+
108
+ # Used by an LRO wrapper for some methods of this service
109
+ @operations_client = self
110
+ end
111
+
112
+ # Service calls
113
+
114
+ ##
115
+ # Lists operations that match the specified filter in the request. If the
116
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
+ #
118
+ # @overload list_operations(request, options = nil)
119
+ # Pass arguments to `list_operations` via a request object, either of type
120
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
121
+ #
122
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
123
+ # A request object representing the call parameters. Required. To specify no
124
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
125
+ # @param options [::Gapic::CallOptions, ::Hash]
126
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
127
+ #
128
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
129
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
130
+ # least one keyword argument is required. To specify no parameters, or to keep all
131
+ # the default parameter values, pass an empty Hash as a request object (see above).
132
+ #
133
+ # @param name [::String]
134
+ # The name of the operation's parent resource.
135
+ # @param filter [::String]
136
+ # The standard list filter.
137
+ # @param page_size [::Integer]
138
+ # The standard list page size.
139
+ # @param page_token [::String]
140
+ # The standard list page token.
141
+ # @yield [result, operation] Access the result along with the TransportOperation object
142
+ # @yieldparam result [::Gapic::Operation]
143
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
144
+ #
145
+ # @return [::Gapic::Operation]
146
+ #
147
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
148
+ #
149
+ # @example Basic example
150
+ # require "google/longrunning"
151
+ #
152
+ # # Create a client object. The client can be reused for multiple calls.
153
+ # client = Google::Longrunning::Operations::Rest::Client.new
154
+ #
155
+ # # Create a request. To set request fields, pass in keyword arguments.
156
+ # request = Google::Longrunning::ListOperationsRequest.new
157
+ #
158
+ # # Call the list_operations method.
159
+ # result = client.list_operations request
160
+ #
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
164
+ # # Each element is of type ::Google::Longrunning::Operation.
165
+ # p item
166
+ # end
167
+ #
168
+ def list_operations request, options = nil
169
+ raise ::ArgumentError, "request must be provided" if request.nil?
170
+
171
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
172
+
173
+ # Converts hash and nil to an options object
174
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
175
+
176
+ # Customize the options with defaults
177
+ call_metadata = @config.rpcs.list_operations.metadata.to_h
178
+
179
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
180
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
181
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
182
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
183
+ transports_version_send: [:rest]
184
+
185
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
186
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
187
+
188
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
189
+ metadata: call_metadata,
190
+ retry_policy: @config.rpcs.list_operations.retry_policy
191
+
192
+ options.apply_defaults timeout: @config.timeout,
193
+ metadata: @config.metadata,
194
+ retry_policy: @config.retry_policy
195
+
196
+ @operations_stub.list_operations request, options do |result, operation|
197
+ result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
+ yield result, operation if block_given?
199
+ throw :response, result
200
+ end
201
+ rescue ::Gapic::Rest::Error => e
202
+ raise ::Google::Cloud::Error.from_error(e)
203
+ end
204
+
205
+ ##
206
+ # Gets the latest state of a long-running operation. Clients can use this
207
+ # method to poll the operation result at intervals as recommended by the API
208
+ # service.
209
+ #
210
+ # @overload get_operation(request, options = nil)
211
+ # Pass arguments to `get_operation` via a request object, either of type
212
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
213
+ #
214
+ # @param request [::Google::Longrunning::GetOperationRequest, ::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 get_operation(name: nil)
221
+ # Pass arguments to `get_operation` 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 name [::String]
226
+ # The name of the operation resource.
227
+ # @yield [result, operation] Access the result along with the TransportOperation object
228
+ # @yieldparam result [::Gapic::Operation]
229
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
230
+ #
231
+ # @return [::Gapic::Operation]
232
+ #
233
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
234
+ #
235
+ # @example Basic example
236
+ # require "google/longrunning"
237
+ #
238
+ # # Create a client object. The client can be reused for multiple calls.
239
+ # client = Google::Longrunning::Operations::Rest::Client.new
240
+ #
241
+ # # Create a request. To set request fields, pass in keyword arguments.
242
+ # request = Google::Longrunning::GetOperationRequest.new
243
+ #
244
+ # # Call the get_operation method.
245
+ # result = client.get_operation request
246
+ #
247
+ # # The returned object is of type Gapic::Operation. You can use it to
248
+ # # check the status of an operation, cancel it, or wait for results.
249
+ # # Here is how to wait for a response.
250
+ # result.wait_until_done! timeout: 60
251
+ # if result.response?
252
+ # p result.response
253
+ # else
254
+ # puts "No response received."
255
+ # end
256
+ #
257
+ def get_operation request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ call_metadata = @config.rpcs.get_operation.metadata.to_h
267
+
268
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
272
+ transports_version_send: [:rest]
273
+
274
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
275
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
276
+
277
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
278
+ metadata: call_metadata,
279
+ retry_policy: @config.rpcs.get_operation.retry_policy
280
+
281
+ options.apply_defaults timeout: @config.timeout,
282
+ metadata: @config.metadata,
283
+ retry_policy: @config.retry_policy
284
+
285
+ @operations_stub.get_operation request, options do |result, operation|
286
+ result = ::Gapic::Operation.new result, @operations_client, options: options
287
+ yield result, operation if block_given?
288
+ throw :response, result
289
+ end
290
+ rescue ::Gapic::Rest::Error => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Deletes a long-running operation. This method indicates that the client is
296
+ # no longer interested in the operation result. It does not cancel the
297
+ # operation. If the server doesn't support this method, it returns
298
+ # `google.rpc.Code.UNIMPLEMENTED`.
299
+ #
300
+ # @overload delete_operation(request, options = nil)
301
+ # Pass arguments to `delete_operation` via a request object, either of type
302
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
303
+ #
304
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
305
+ # A request object representing the call parameters. Required. To specify no
306
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
307
+ # @param options [::Gapic::CallOptions, ::Hash]
308
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
309
+ #
310
+ # @overload delete_operation(name: nil)
311
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
312
+ # least one keyword argument is required. To specify no parameters, or to keep all
313
+ # the default parameter values, pass an empty Hash as a request object (see above).
314
+ #
315
+ # @param name [::String]
316
+ # The name of the operation resource to be deleted.
317
+ # @yield [result, operation] Access the result along with the TransportOperation object
318
+ # @yieldparam result [::Google::Protobuf::Empty]
319
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
320
+ #
321
+ # @return [::Google::Protobuf::Empty]
322
+ #
323
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
324
+ #
325
+ # @example Basic example
326
+ # require "google/longrunning"
327
+ #
328
+ # # Create a client object. The client can be reused for multiple calls.
329
+ # client = Google::Longrunning::Operations::Rest::Client.new
330
+ #
331
+ # # Create a request. To set request fields, pass in keyword arguments.
332
+ # request = Google::Longrunning::DeleteOperationRequest.new
333
+ #
334
+ # # Call the delete_operation method.
335
+ # result = client.delete_operation request
336
+ #
337
+ # # The returned object is of type Google::Protobuf::Empty.
338
+ # p result
339
+ #
340
+ def delete_operation request, options = nil
341
+ raise ::ArgumentError, "request must be provided" if request.nil?
342
+
343
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
344
+
345
+ # Converts hash and nil to an options object
346
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
347
+
348
+ # Customize the options with defaults
349
+ call_metadata = @config.rpcs.delete_operation.metadata.to_h
350
+
351
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
352
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
353
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
354
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
355
+ transports_version_send: [:rest]
356
+
357
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
358
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
359
+
360
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
361
+ metadata: call_metadata,
362
+ retry_policy: @config.rpcs.delete_operation.retry_policy
363
+
364
+ options.apply_defaults timeout: @config.timeout,
365
+ metadata: @config.metadata,
366
+ retry_policy: @config.retry_policy
367
+
368
+ @operations_stub.delete_operation request, options do |result, operation|
369
+ yield result, operation if block_given?
370
+ end
371
+ rescue ::Gapic::Rest::Error => e
372
+ raise ::Google::Cloud::Error.from_error(e)
373
+ end
374
+
375
+ ##
376
+ # Starts asynchronous cancellation on a long-running operation. The server
377
+ # makes a best effort to cancel the operation, but success is not
378
+ # guaranteed. If the server doesn't support this method, it returns
379
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
380
+ # Operations.GetOperation or
381
+ # other methods to check whether the cancellation succeeded or whether the
382
+ # operation completed despite cancellation. On successful cancellation,
383
+ # the operation is not deleted; instead, it becomes an operation with
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
387
+ #
388
+ # @overload cancel_operation(request, options = nil)
389
+ # Pass arguments to `cancel_operation` via a request object, either of type
390
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
391
+ #
392
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
393
+ # A request object representing the call parameters. Required. To specify no
394
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
395
+ # @param options [::Gapic::CallOptions, ::Hash]
396
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
397
+ #
398
+ # @overload cancel_operation(name: nil)
399
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
400
+ # least one keyword argument is required. To specify no parameters, or to keep all
401
+ # the default parameter values, pass an empty Hash as a request object (see above).
402
+ #
403
+ # @param name [::String]
404
+ # The name of the operation resource to be cancelled.
405
+ # @yield [result, operation] Access the result along with the TransportOperation object
406
+ # @yieldparam result [::Google::Protobuf::Empty]
407
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
408
+ #
409
+ # @return [::Google::Protobuf::Empty]
410
+ #
411
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
412
+ #
413
+ # @example Basic example
414
+ # require "google/longrunning"
415
+ #
416
+ # # Create a client object. The client can be reused for multiple calls.
417
+ # client = Google::Longrunning::Operations::Rest::Client.new
418
+ #
419
+ # # Create a request. To set request fields, pass in keyword arguments.
420
+ # request = Google::Longrunning::CancelOperationRequest.new
421
+ #
422
+ # # Call the cancel_operation method.
423
+ # result = client.cancel_operation request
424
+ #
425
+ # # The returned object is of type Google::Protobuf::Empty.
426
+ # p result
427
+ #
428
+ def cancel_operation request, options = nil
429
+ raise ::ArgumentError, "request must be provided" if request.nil?
430
+
431
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
432
+
433
+ # Converts hash and nil to an options object
434
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
435
+
436
+ # Customize the options with defaults
437
+ call_metadata = @config.rpcs.cancel_operation.metadata.to_h
438
+
439
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
440
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
441
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
442
+ gapic_version: ::Google::Cloud::ManagedKafka::V1::VERSION,
443
+ transports_version_send: [:rest]
444
+
445
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
446
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
447
+
448
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
449
+ metadata: call_metadata,
450
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
451
+
452
+ options.apply_defaults timeout: @config.timeout,
453
+ metadata: @config.metadata,
454
+ retry_policy: @config.retry_policy
455
+
456
+ @operations_stub.cancel_operation request, options do |result, operation|
457
+ yield result, operation if block_given?
458
+ end
459
+ rescue ::Gapic::Rest::Error => e
460
+ raise ::Google::Cloud::Error.from_error(e)
461
+ end
462
+
463
+ ##
464
+ # Configuration class for the Operations REST API.
465
+ #
466
+ # This class represents the configuration for Operations REST,
467
+ # providing control over timeouts, retry behavior, logging, transport
468
+ # parameters, and other low-level controls. Certain parameters can also be
469
+ # applied individually to specific RPCs. See
470
+ # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
471
+ # for a list of RPCs that can be configured independently.
472
+ #
473
+ # Configuration can be applied globally to all clients, or to a single client
474
+ # on construction.
475
+ #
476
+ # @example
477
+ #
478
+ # # Modify the global config, setting the timeout for
479
+ # # list_operations to 20 seconds,
480
+ # # and all remaining timeouts to 10 seconds.
481
+ # ::Google::Longrunning::Operations::Rest::Client.configure do |config|
482
+ # config.timeout = 10.0
483
+ # config.rpcs.list_operations.timeout = 20.0
484
+ # end
485
+ #
486
+ # # Apply the above configuration only to a new client.
487
+ # client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
488
+ # config.timeout = 10.0
489
+ # config.rpcs.list_operations.timeout = 20.0
490
+ # end
491
+ #
492
+ # @!attribute [rw] endpoint
493
+ # A custom service endpoint, as a hostname or hostname:port. The default is
494
+ # nil, indicating to use the default endpoint in the current universe domain.
495
+ # @return [::String,nil]
496
+ # @!attribute [rw] credentials
497
+ # Credentials to send with calls. You may provide any of the following types:
498
+ # * (`String`) The path to a service account key file in JSON format
499
+ # * (`Hash`) A service account key as a Hash
500
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
501
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
502
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
503
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
504
+ # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
512
+ # @return [::Object]
513
+ # @!attribute [rw] scope
514
+ # The OAuth scopes
515
+ # @return [::Array<::String>]
516
+ # @!attribute [rw] lib_name
517
+ # The library name as recorded in instrumentation and logging
518
+ # @return [::String]
519
+ # @!attribute [rw] lib_version
520
+ # The library version as recorded in instrumentation and logging
521
+ # @return [::String]
522
+ # @!attribute [rw] timeout
523
+ # The call timeout in seconds.
524
+ # @return [::Numeric]
525
+ # @!attribute [rw] metadata
526
+ # Additional headers to be sent with the call.
527
+ # @return [::Hash{::Symbol=>::String}]
528
+ # @!attribute [rw] retry_policy
529
+ # The retry policy. The value is a hash with the following keys:
530
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
531
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
532
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
533
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
534
+ # trigger a retry.
535
+ # @return [::Hash]
536
+ # @!attribute [rw] quota_project
537
+ # A separate project against which to charge quota.
538
+ # @return [::String]
539
+ # @!attribute [rw] universe_domain
540
+ # The universe domain within which to make requests. This determines the
541
+ # default endpoint URL. The default value of nil uses the environment
542
+ # universe (usually the default "googleapis.com" universe).
543
+ # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
549
+ #
550
+ class Configuration
551
+ extend ::Gapic::Config
552
+
553
+ # @private
554
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
555
+ DEFAULT_ENDPOINT = "managedkafka.googleapis.com"
556
+
557
+ config_attr :endpoint, nil, ::String, nil
558
+ config_attr :credentials, nil do |value|
559
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
560
+ allowed.any? { |klass| klass === value }
561
+ end
562
+ config_attr :scope, nil, ::String, ::Array, nil
563
+ config_attr :lib_name, nil, ::String, nil
564
+ config_attr :lib_version, nil, ::String, nil
565
+ config_attr :timeout, nil, ::Numeric, nil
566
+ config_attr :metadata, nil, ::Hash, nil
567
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
568
+ config_attr :quota_project, nil, ::String, nil
569
+ config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
571
+
572
+ # @private
573
+ def initialize parent_config = nil
574
+ @parent_config = parent_config unless parent_config.nil?
575
+
576
+ yield self if block_given?
577
+ end
578
+
579
+ ##
580
+ # Configurations for individual RPCs
581
+ # @return [Rpcs]
582
+ #
583
+ def rpcs
584
+ @rpcs ||= begin
585
+ parent_rpcs = nil
586
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
587
+ Rpcs.new parent_rpcs
588
+ end
589
+ end
590
+
591
+ ##
592
+ # Configuration RPC class for the Operations API.
593
+ #
594
+ # Includes fields providing the configuration for each RPC in this service.
595
+ # Each configuration object is of type `Gapic::Config::Method` and includes
596
+ # the following configuration fields:
597
+ #
598
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
599
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
600
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
601
+ # include the following keys:
602
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
603
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
604
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
605
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
606
+ # trigger a retry.
607
+ #
608
+ class Rpcs
609
+ ##
610
+ # RPC-specific configuration for `list_operations`
611
+ # @return [::Gapic::Config::Method]
612
+ #
613
+ attr_reader :list_operations
614
+ ##
615
+ # RPC-specific configuration for `get_operation`
616
+ # @return [::Gapic::Config::Method]
617
+ #
618
+ attr_reader :get_operation
619
+ ##
620
+ # RPC-specific configuration for `delete_operation`
621
+ # @return [::Gapic::Config::Method]
622
+ #
623
+ attr_reader :delete_operation
624
+ ##
625
+ # RPC-specific configuration for `cancel_operation`
626
+ # @return [::Gapic::Config::Method]
627
+ #
628
+ attr_reader :cancel_operation
629
+
630
+ # @private
631
+ def initialize parent_rpcs = nil
632
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
633
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
634
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
635
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
636
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
637
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
638
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
639
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
640
+
641
+ yield self if block_given?
642
+ end
643
+ end
644
+ end
645
+ end
646
+
647
+ ##
648
+ # @private
649
+ # REST service stub for the Longrunning Operations API.
650
+ # Service stub contains baseline method implementations
651
+ # including transcoding, making the REST call, and deserialing the response.
652
+ class OperationsServiceStub
653
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
654
+ # These require statements are intentionally placed here to initialize
655
+ # the REST modules only when it's required.
656
+ require "gapic/rest"
657
+
658
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
659
+ endpoint_template: endpoint_template,
660
+ universe_domain: universe_domain,
661
+ credentials: credentials
662
+ end
663
+
664
+ ##
665
+ # Baseline implementation for the list_operations REST call
666
+ #
667
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
668
+ # A request object representing the call parameters. Required.
669
+ # @param options [::Gapic::CallOptions]
670
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
671
+ #
672
+ # @yield [result, operation] Access the result along with the TransportOperation object
673
+ # @yieldparam result [::Google::Longrunning::ListOperationsResponse]
674
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
675
+ #
676
+ # @return [::Google::Longrunning::ListOperationsResponse]
677
+ # A result object deserialized from the server's reply
678
+ def list_operations request_pb, options = nil
679
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
680
+
681
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
682
+ query_string_params = if query_string_params.any?
683
+ query_string_params.to_h { |p| p.split "=", 2 }
684
+ else
685
+ {}
686
+ end
687
+
688
+ response = @client_stub.make_http_request(
689
+ verb,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
694
+ options: options
695
+ )
696
+ operation = ::Gapic::Rest::TransportOperation.new response
697
+ result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
702
+ end
703
+
704
+ ##
705
+ # Baseline implementation for the get_operation REST call
706
+ #
707
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
708
+ # A request object representing the call parameters. Required.
709
+ # @param options [::Gapic::CallOptions]
710
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
711
+ #
712
+ # @yield [result, operation] Access the result along with the TransportOperation object
713
+ # @yieldparam result [::Google::Longrunning::Operation]
714
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
715
+ #
716
+ # @return [::Google::Longrunning::Operation]
717
+ # A result object deserialized from the server's reply
718
+ def get_operation request_pb, options = nil
719
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
720
+
721
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
722
+ query_string_params = if query_string_params.any?
723
+ query_string_params.to_h { |p| p.split "=", 2 }
724
+ else
725
+ {}
726
+ end
727
+
728
+ response = @client_stub.make_http_request(
729
+ verb,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
734
+ options: options
735
+ )
736
+ operation = ::Gapic::Rest::TransportOperation.new response
737
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
742
+ end
743
+
744
+ ##
745
+ # Baseline implementation for the delete_operation REST call
746
+ #
747
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
748
+ # A request object representing the call parameters. Required.
749
+ # @param options [::Gapic::CallOptions]
750
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
751
+ #
752
+ # @yield [result, operation] Access the result along with the TransportOperation object
753
+ # @yieldparam result [::Google::Protobuf::Empty]
754
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
755
+ #
756
+ # @return [::Google::Protobuf::Empty]
757
+ # A result object deserialized from the server's reply
758
+ def delete_operation request_pb, options = nil
759
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
760
+
761
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
762
+ query_string_params = if query_string_params.any?
763
+ query_string_params.to_h { |p| p.split "=", 2 }
764
+ else
765
+ {}
766
+ end
767
+
768
+ response = @client_stub.make_http_request(
769
+ verb,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
774
+ options: options
775
+ )
776
+ operation = ::Gapic::Rest::TransportOperation.new response
777
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
782
+ end
783
+
784
+ ##
785
+ # Baseline implementation for the cancel_operation REST call
786
+ #
787
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
788
+ # A request object representing the call parameters. Required.
789
+ # @param options [::Gapic::CallOptions]
790
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
791
+ #
792
+ # @yield [result, operation] Access the result along with the TransportOperation object
793
+ # @yieldparam result [::Google::Protobuf::Empty]
794
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
795
+ #
796
+ # @return [::Google::Protobuf::Empty]
797
+ # A result object deserialized from the server's reply
798
+ def cancel_operation request_pb, options = nil
799
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
800
+
801
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
802
+ query_string_params = if query_string_params.any?
803
+ query_string_params.to_h { |p| p.split "=", 2 }
804
+ else
805
+ {}
806
+ end
807
+
808
+ response = @client_stub.make_http_request(
809
+ verb,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
814
+ options: options
815
+ )
816
+ operation = ::Gapic::Rest::TransportOperation.new response
817
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
822
+ end
823
+
824
+ ##
825
+ # @private
826
+ #
827
+ # GRPC transcoding helper method for the list_operations REST call
828
+ #
829
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
830
+ # A request object representing the call parameters. Required.
831
+ # @return [Array(String, [String, nil], Hash{String => String})]
832
+ # Uri, Body, Query string parameters
833
+ def self.transcode_list_operations_request request_pb
834
+ transcoder = Gapic::Rest::GrpcTranscoder.new
835
+ .with_bindings(
836
+ uri_method: :get,
837
+ uri_template: "/v1/{name}/operations",
838
+ matches: [
839
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
840
+ ]
841
+ )
842
+ transcoder.transcode request_pb
843
+ end
844
+
845
+ ##
846
+ # @private
847
+ #
848
+ # GRPC transcoding helper method for the get_operation REST call
849
+ #
850
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
851
+ # A request object representing the call parameters. Required.
852
+ # @return [Array(String, [String, nil], Hash{String => String})]
853
+ # Uri, Body, Query string parameters
854
+ def self.transcode_get_operation_request request_pb
855
+ transcoder = Gapic::Rest::GrpcTranscoder.new
856
+ .with_bindings(
857
+ uri_method: :get,
858
+ uri_template: "/v1/{name}",
859
+ matches: [
860
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
861
+ ]
862
+ )
863
+ transcoder.transcode request_pb
864
+ end
865
+
866
+ ##
867
+ # @private
868
+ #
869
+ # GRPC transcoding helper method for the delete_operation REST call
870
+ #
871
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
872
+ # A request object representing the call parameters. Required.
873
+ # @return [Array(String, [String, nil], Hash{String => String})]
874
+ # Uri, Body, Query string parameters
875
+ def self.transcode_delete_operation_request request_pb
876
+ transcoder = Gapic::Rest::GrpcTranscoder.new
877
+ .with_bindings(
878
+ uri_method: :delete,
879
+ uri_template: "/v1/{name}",
880
+ matches: [
881
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
882
+ ]
883
+ )
884
+ transcoder.transcode request_pb
885
+ end
886
+
887
+ ##
888
+ # @private
889
+ #
890
+ # GRPC transcoding helper method for the cancel_operation REST call
891
+ #
892
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
893
+ # A request object representing the call parameters. Required.
894
+ # @return [Array(String, [String, nil], Hash{String => String})]
895
+ # Uri, Body, Query string parameters
896
+ def self.transcode_cancel_operation_request request_pb
897
+ transcoder = Gapic::Rest::GrpcTranscoder.new
898
+ .with_bindings(
899
+ uri_method: :post,
900
+ uri_template: "/v1/{name}:cancel",
901
+ body: "*",
902
+ matches: [
903
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
904
+ ]
905
+ )
906
+ transcoder.transcode request_pb
907
+ end
908
+ end
909
+ end
910
+ end
911
+ end
912
+ end
913
+ end
914
+ end