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