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,841 @@
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
+ require "google/longrunning/operations_pb"
21
+
22
+ module Google
23
+ module Iam
24
+ module V3beta
25
+ module AccessPolicies
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
+ # These require statements are intentionally placed here to initialize
85
+ # the gRPC module only when it's required.
86
+ # See https://github.com/googleapis/toolkit/issues/446
87
+ require "gapic/grpc"
88
+ require "google/longrunning/operations_services_pb"
89
+
90
+ # Create the configuration object
91
+ @config = Configuration.new Operations.configure
92
+
93
+ # Yield the configuration if needed
94
+ yield @config if block_given?
95
+
96
+ # Create credentials
97
+ credentials = @config.credentials
98
+ credentials ||= Credentials.default scope: @config.scope
99
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
100
+ credentials = Credentials.new credentials, scope: @config.scope
101
+ end
102
+ @quota_project_id = @config.quota_project
103
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
104
+
105
+ @operations_stub = ::Gapic::ServiceStub.new(
106
+ ::Google::Longrunning::Operations::Stub,
107
+ credentials: credentials,
108
+ endpoint: @config.endpoint,
109
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
110
+ universe_domain: @config.universe_domain,
111
+ channel_args: @config.channel_args,
112
+ interceptors: @config.interceptors,
113
+ channel_pool_config: @config.channel_pool
114
+ )
115
+
116
+ # Used by an LRO wrapper for some methods of this service
117
+ @operations_client = self
118
+ end
119
+
120
+ # Service calls
121
+
122
+ ##
123
+ # Lists operations that match the specified filter in the request. If the
124
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
125
+ #
126
+ # @overload list_operations(request, options = nil)
127
+ # Pass arguments to `list_operations` via a request object, either of type
128
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
129
+ #
130
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
131
+ # A request object representing the call parameters. Required. To specify no
132
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
133
+ # @param options [::Gapic::CallOptions, ::Hash]
134
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
135
+ #
136
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil)
137
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
138
+ # least one keyword argument is required. To specify no parameters, or to keep all
139
+ # the default parameter values, pass an empty Hash as a request object (see above).
140
+ #
141
+ # @param name [::String]
142
+ # The name of the operation's parent resource.
143
+ # @param filter [::String]
144
+ # The standard list filter.
145
+ # @param page_size [::Integer]
146
+ # The standard list page size.
147
+ # @param page_token [::String]
148
+ # The standard list page token.
149
+ # @param return_partial_success [::Boolean]
150
+ # When set to `true`, operations that are reachable are returned as normal,
151
+ # and those that are unreachable are returned in the
152
+ # [ListOperationsResponse.unreachable] field.
153
+ #
154
+ # This can only be `true` when reading across collections e.g. when `parent`
155
+ # is set to `"projects/example/locations/-"`.
156
+ #
157
+ # This field is not by default supported and will result in an
158
+ # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in
159
+ # service or product specific documentation.
160
+ #
161
+ # @yield [response, operation] Access the result along with the RPC operation
162
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
163
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
164
+ #
165
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
166
+ #
167
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
168
+ #
169
+ # @example Basic example
170
+ # require "google/longrunning"
171
+ #
172
+ # # Create a client object. The client can be reused for multiple calls.
173
+ # client = Google::Longrunning::Operations::Client.new
174
+ #
175
+ # # Create a request. To set request fields, pass in keyword arguments.
176
+ # request = Google::Longrunning::ListOperationsRequest.new
177
+ #
178
+ # # Call the list_operations method.
179
+ # result = client.list_operations request
180
+ #
181
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
182
+ # # over elements, and API calls will be issued to fetch pages as needed.
183
+ # result.each do |item|
184
+ # # Each element is of type ::Google::Longrunning::Operation.
185
+ # p item
186
+ # end
187
+ #
188
+ def list_operations request, options = nil
189
+ raise ::ArgumentError, "request must be provided" if request.nil?
190
+
191
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
192
+
193
+ # Converts hash and nil to an options object
194
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
195
+
196
+ # Customize the options with defaults
197
+ metadata = @config.rpcs.list_operations.metadata.to_h
198
+
199
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
200
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
201
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
202
+ gapic_version: ::Google::Iam::V3beta::VERSION
203
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
204
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
205
+
206
+ header_params = {}
207
+ if request.name
208
+ header_params["name"] = request.name
209
+ end
210
+
211
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
212
+ metadata[:"x-goog-request-params"] ||= request_params_header
213
+
214
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
215
+ metadata: metadata,
216
+ retry_policy: @config.rpcs.list_operations.retry_policy
217
+
218
+ options.apply_defaults timeout: @config.timeout,
219
+ metadata: @config.metadata,
220
+ retry_policy: @config.retry_policy
221
+
222
+ @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
223
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
224
+ response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
225
+ yield response, operation if block_given?
226
+ throw :response, response
227
+ end
228
+ rescue ::GRPC::BadStatus => e
229
+ raise ::Google::Cloud::Error.from_error(e)
230
+ end
231
+
232
+ ##
233
+ # Gets the latest state of a long-running operation. Clients can use this
234
+ # method to poll the operation result at intervals as recommended by the API
235
+ # service.
236
+ #
237
+ # @overload get_operation(request, options = nil)
238
+ # Pass arguments to `get_operation` via a request object, either of type
239
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
240
+ #
241
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
242
+ # A request object representing the call parameters. Required. To specify no
243
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
244
+ # @param options [::Gapic::CallOptions, ::Hash]
245
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
246
+ #
247
+ # @overload get_operation(name: nil)
248
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
249
+ # least one keyword argument is required. To specify no parameters, or to keep all
250
+ # the default parameter values, pass an empty Hash as a request object (see above).
251
+ #
252
+ # @param name [::String]
253
+ # The name of the operation resource.
254
+ #
255
+ # @yield [response, operation] Access the result along with the RPC operation
256
+ # @yieldparam response [::Gapic::Operation]
257
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
258
+ #
259
+ # @return [::Gapic::Operation]
260
+ #
261
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
262
+ #
263
+ # @example Basic example
264
+ # require "google/longrunning"
265
+ #
266
+ # # Create a client object. The client can be reused for multiple calls.
267
+ # client = Google::Longrunning::Operations::Client.new
268
+ #
269
+ # # Create a request. To set request fields, pass in keyword arguments.
270
+ # request = Google::Longrunning::GetOperationRequest.new
271
+ #
272
+ # # Call the get_operation method.
273
+ # result = client.get_operation request
274
+ #
275
+ # # The returned object is of type Gapic::Operation. You can use it to
276
+ # # check the status of an operation, cancel it, or wait for results.
277
+ # # Here is how to wait for a response.
278
+ # result.wait_until_done! timeout: 60
279
+ # if result.response?
280
+ # p result.response
281
+ # else
282
+ # puts "No response received."
283
+ # end
284
+ #
285
+ def get_operation request, options = nil
286
+ raise ::ArgumentError, "request must be provided" if request.nil?
287
+
288
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
289
+
290
+ # Converts hash and nil to an options object
291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
292
+
293
+ # Customize the options with defaults
294
+ metadata = @config.rpcs.get_operation.metadata.to_h
295
+
296
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
297
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
299
+ gapic_version: ::Google::Iam::V3beta::VERSION
300
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
301
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ header_params = {}
304
+ if request.name
305
+ header_params["name"] = request.name
306
+ end
307
+
308
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
309
+ metadata[:"x-goog-request-params"] ||= request_params_header
310
+
311
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
312
+ metadata: metadata,
313
+ retry_policy: @config.rpcs.get_operation.retry_policy
314
+
315
+ options.apply_defaults timeout: @config.timeout,
316
+ metadata: @config.metadata,
317
+ retry_policy: @config.retry_policy
318
+
319
+ @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
320
+ response = ::Gapic::Operation.new response, @operations_client, options: options
321
+ yield response, operation if block_given?
322
+ throw :response, response
323
+ end
324
+ rescue ::GRPC::BadStatus => e
325
+ raise ::Google::Cloud::Error.from_error(e)
326
+ end
327
+
328
+ ##
329
+ # Deletes a long-running operation. This method indicates that the client is
330
+ # no longer interested in the operation result. It does not cancel the
331
+ # operation. If the server doesn't support this method, it returns
332
+ # `google.rpc.Code.UNIMPLEMENTED`.
333
+ #
334
+ # @overload delete_operation(request, options = nil)
335
+ # Pass arguments to `delete_operation` via a request object, either of type
336
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
337
+ #
338
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
339
+ # A request object representing the call parameters. Required. To specify no
340
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
341
+ # @param options [::Gapic::CallOptions, ::Hash]
342
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
343
+ #
344
+ # @overload delete_operation(name: nil)
345
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
346
+ # least one keyword argument is required. To specify no parameters, or to keep all
347
+ # the default parameter values, pass an empty Hash as a request object (see above).
348
+ #
349
+ # @param name [::String]
350
+ # The name of the operation resource to be deleted.
351
+ #
352
+ # @yield [response, operation] Access the result along with the RPC operation
353
+ # @yieldparam response [::Google::Protobuf::Empty]
354
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
355
+ #
356
+ # @return [::Google::Protobuf::Empty]
357
+ #
358
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
359
+ #
360
+ # @example Basic example
361
+ # require "google/longrunning"
362
+ #
363
+ # # Create a client object. The client can be reused for multiple calls.
364
+ # client = Google::Longrunning::Operations::Client.new
365
+ #
366
+ # # Create a request. To set request fields, pass in keyword arguments.
367
+ # request = Google::Longrunning::DeleteOperationRequest.new
368
+ #
369
+ # # Call the delete_operation method.
370
+ # result = client.delete_operation request
371
+ #
372
+ # # The returned object is of type Google::Protobuf::Empty.
373
+ # p result
374
+ #
375
+ def delete_operation request, options = nil
376
+ raise ::ArgumentError, "request must be provided" if request.nil?
377
+
378
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
379
+
380
+ # Converts hash and nil to an options object
381
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
382
+
383
+ # Customize the options with defaults
384
+ metadata = @config.rpcs.delete_operation.metadata.to_h
385
+
386
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
387
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
388
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
389
+ gapic_version: ::Google::Iam::V3beta::VERSION
390
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
391
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
392
+
393
+ header_params = {}
394
+ if request.name
395
+ header_params["name"] = request.name
396
+ end
397
+
398
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
399
+ metadata[:"x-goog-request-params"] ||= request_params_header
400
+
401
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
402
+ metadata: metadata,
403
+ retry_policy: @config.rpcs.delete_operation.retry_policy
404
+
405
+ options.apply_defaults timeout: @config.timeout,
406
+ metadata: @config.metadata,
407
+ retry_policy: @config.retry_policy
408
+
409
+ @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
410
+ yield response, operation if block_given?
411
+ end
412
+ rescue ::GRPC::BadStatus => e
413
+ raise ::Google::Cloud::Error.from_error(e)
414
+ end
415
+
416
+ ##
417
+ # Starts asynchronous cancellation on a long-running operation. The server
418
+ # makes a best effort to cancel the operation, but success is not
419
+ # guaranteed. If the server doesn't support this method, it returns
420
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
421
+ # Operations.GetOperation or
422
+ # other methods to check whether the cancellation succeeded or whether the
423
+ # operation completed despite cancellation. On successful cancellation,
424
+ # the operation is not deleted; instead, it becomes an operation with
425
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
426
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
427
+ # `Code.CANCELLED`.
428
+ #
429
+ # @overload cancel_operation(request, options = nil)
430
+ # Pass arguments to `cancel_operation` via a request object, either of type
431
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
432
+ #
433
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
434
+ # A request object representing the call parameters. Required. To specify no
435
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
436
+ # @param options [::Gapic::CallOptions, ::Hash]
437
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
438
+ #
439
+ # @overload cancel_operation(name: nil)
440
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
441
+ # least one keyword argument is required. To specify no parameters, or to keep all
442
+ # the default parameter values, pass an empty Hash as a request object (see above).
443
+ #
444
+ # @param name [::String]
445
+ # The name of the operation resource to be cancelled.
446
+ #
447
+ # @yield [response, operation] Access the result along with the RPC operation
448
+ # @yieldparam response [::Google::Protobuf::Empty]
449
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
450
+ #
451
+ # @return [::Google::Protobuf::Empty]
452
+ #
453
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
454
+ #
455
+ # @example Basic example
456
+ # require "google/longrunning"
457
+ #
458
+ # # Create a client object. The client can be reused for multiple calls.
459
+ # client = Google::Longrunning::Operations::Client.new
460
+ #
461
+ # # Create a request. To set request fields, pass in keyword arguments.
462
+ # request = Google::Longrunning::CancelOperationRequest.new
463
+ #
464
+ # # Call the cancel_operation method.
465
+ # result = client.cancel_operation request
466
+ #
467
+ # # The returned object is of type Google::Protobuf::Empty.
468
+ # p result
469
+ #
470
+ def cancel_operation request, options = nil
471
+ raise ::ArgumentError, "request must be provided" if request.nil?
472
+
473
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
474
+
475
+ # Converts hash and nil to an options object
476
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
477
+
478
+ # Customize the options with defaults
479
+ metadata = @config.rpcs.cancel_operation.metadata.to_h
480
+
481
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
482
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
483
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
484
+ gapic_version: ::Google::Iam::V3beta::VERSION
485
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
486
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
487
+
488
+ header_params = {}
489
+ if request.name
490
+ header_params["name"] = request.name
491
+ end
492
+
493
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
494
+ metadata[:"x-goog-request-params"] ||= request_params_header
495
+
496
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
497
+ metadata: metadata,
498
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
499
+
500
+ options.apply_defaults timeout: @config.timeout,
501
+ metadata: @config.metadata,
502
+ retry_policy: @config.retry_policy
503
+
504
+ @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
505
+ yield response, operation if block_given?
506
+ end
507
+ rescue ::GRPC::BadStatus => e
508
+ raise ::Google::Cloud::Error.from_error(e)
509
+ end
510
+
511
+ ##
512
+ # Waits until the specified long-running operation is done or reaches at most
513
+ # a specified timeout, returning the latest state. If the operation is
514
+ # already done, the latest state is immediately returned. If the timeout
515
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
516
+ # timeout is used. If the server does not support this method, it returns
517
+ # `google.rpc.Code.UNIMPLEMENTED`.
518
+ # Note that this method is on a best-effort basis. It may return the latest
519
+ # state before the specified timeout (including immediately), meaning even an
520
+ # immediate response is no guarantee that the operation is done.
521
+ #
522
+ # @overload wait_operation(request, options = nil)
523
+ # Pass arguments to `wait_operation` via a request object, either of type
524
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
525
+ #
526
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
527
+ # A request object representing the call parameters. Required. To specify no
528
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
529
+ # @param options [::Gapic::CallOptions, ::Hash]
530
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
531
+ #
532
+ # @overload wait_operation(name: nil, timeout: nil)
533
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
534
+ # least one keyword argument is required. To specify no parameters, or to keep all
535
+ # the default parameter values, pass an empty Hash as a request object (see above).
536
+ #
537
+ # @param name [::String]
538
+ # The name of the operation resource to wait on.
539
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
540
+ # The maximum duration to wait before timing out. If left blank, the wait
541
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
542
+ # If RPC context deadline is also specified, the shorter one will be used.
543
+ #
544
+ # @yield [response, operation] Access the result along with the RPC operation
545
+ # @yieldparam response [::Gapic::Operation]
546
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
547
+ #
548
+ # @return [::Gapic::Operation]
549
+ #
550
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
551
+ #
552
+ # @example Basic example
553
+ # require "google/longrunning"
554
+ #
555
+ # # Create a client object. The client can be reused for multiple calls.
556
+ # client = Google::Longrunning::Operations::Client.new
557
+ #
558
+ # # Create a request. To set request fields, pass in keyword arguments.
559
+ # request = Google::Longrunning::WaitOperationRequest.new
560
+ #
561
+ # # Call the wait_operation method.
562
+ # result = client.wait_operation request
563
+ #
564
+ # # The returned object is of type Gapic::Operation. You can use it to
565
+ # # check the status of an operation, cancel it, or wait for results.
566
+ # # Here is how to wait for a response.
567
+ # result.wait_until_done! timeout: 60
568
+ # if result.response?
569
+ # p result.response
570
+ # else
571
+ # puts "No response received."
572
+ # end
573
+ #
574
+ def wait_operation request, options = nil
575
+ raise ::ArgumentError, "request must be provided" if request.nil?
576
+
577
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
578
+
579
+ # Converts hash and nil to an options object
580
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
581
+
582
+ # Customize the options with defaults
583
+ metadata = @config.rpcs.wait_operation.metadata.to_h
584
+
585
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
586
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
587
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
588
+ gapic_version: ::Google::Iam::V3beta::VERSION
589
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
590
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
591
+
592
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
593
+ metadata: metadata,
594
+ retry_policy: @config.rpcs.wait_operation.retry_policy
595
+
596
+ options.apply_defaults timeout: @config.timeout,
597
+ metadata: @config.metadata,
598
+ retry_policy: @config.retry_policy
599
+
600
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
601
+ response = ::Gapic::Operation.new response, @operations_client, options: options
602
+ yield response, operation if block_given?
603
+ throw :response, response
604
+ end
605
+ rescue ::GRPC::BadStatus => e
606
+ raise ::Google::Cloud::Error.from_error(e)
607
+ end
608
+
609
+ ##
610
+ # Configuration class for the Operations API.
611
+ #
612
+ # This class represents the configuration for Operations,
613
+ # providing control over timeouts, retry behavior, logging, transport
614
+ # parameters, and other low-level controls. Certain parameters can also be
615
+ # applied individually to specific RPCs. See
616
+ # {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
617
+ # for a list of RPCs that can be configured independently.
618
+ #
619
+ # Configuration can be applied globally to all clients, or to a single client
620
+ # on construction.
621
+ #
622
+ # @example
623
+ #
624
+ # # Modify the global config, setting the timeout for
625
+ # # list_operations to 20 seconds,
626
+ # # and all remaining timeouts to 10 seconds.
627
+ # ::Google::Longrunning::Operations::Client.configure do |config|
628
+ # config.timeout = 10.0
629
+ # config.rpcs.list_operations.timeout = 20.0
630
+ # end
631
+ #
632
+ # # Apply the above configuration only to a new client.
633
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
634
+ # config.timeout = 10.0
635
+ # config.rpcs.list_operations.timeout = 20.0
636
+ # end
637
+ #
638
+ # @!attribute [rw] endpoint
639
+ # A custom service endpoint, as a hostname or hostname:port. The default is
640
+ # nil, indicating to use the default endpoint in the current universe domain.
641
+ # @return [::String,nil]
642
+ # @!attribute [rw] credentials
643
+ # Credentials to send with calls. You may provide any of the following types:
644
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
645
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
646
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
647
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
648
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
649
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
650
+ # * (`nil`) indicating no credentials
651
+ #
652
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
653
+ # is deprecated. Providing an unvalidated credential configuration to
654
+ # Google APIs can compromise the security of your systems and data.
655
+ #
656
+ # @example
657
+ #
658
+ # # The recommended way to provide credentials is to use the `make_creds` method
659
+ # # on the appropriate credentials class for your environment.
660
+ #
661
+ # require "googleauth"
662
+ #
663
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
664
+ # json_key_io: ::File.open("/path/to/keyfile.json")
665
+ # )
666
+ #
667
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
668
+ # config.credentials = credentials
669
+ # end
670
+ #
671
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
672
+ # external source for authentication to Google Cloud, you must validate it before
673
+ # providing it to a Google API client library. Providing an unvalidated credential
674
+ # configuration to Google APIs can compromise the security of your systems and data.
675
+ # For more information, refer to [Validate credential configurations from external
676
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
677
+ # @return [::Object]
678
+ # @!attribute [rw] scope
679
+ # The OAuth scopes
680
+ # @return [::Array<::String>]
681
+ # @!attribute [rw] lib_name
682
+ # The library name as recorded in instrumentation and logging
683
+ # @return [::String]
684
+ # @!attribute [rw] lib_version
685
+ # The library version as recorded in instrumentation and logging
686
+ # @return [::String]
687
+ # @!attribute [rw] channel_args
688
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
689
+ # `GRPC::Core::Channel` object is provided as the credential.
690
+ # @return [::Hash]
691
+ # @!attribute [rw] interceptors
692
+ # An array of interceptors that are run before calls are executed.
693
+ # @return [::Array<::GRPC::ClientInterceptor>]
694
+ # @!attribute [rw] timeout
695
+ # The call timeout in seconds.
696
+ # @return [::Numeric]
697
+ # @!attribute [rw] metadata
698
+ # Additional gRPC headers to be sent with the call.
699
+ # @return [::Hash{::Symbol=>::String}]
700
+ # @!attribute [rw] retry_policy
701
+ # The retry policy. The value is a hash with the following keys:
702
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
703
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
704
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
705
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
706
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
707
+ # trigger a retry.
708
+ # @return [::Hash]
709
+ # @!attribute [rw] quota_project
710
+ # A separate project against which to charge quota.
711
+ # @return [::String]
712
+ # @!attribute [rw] universe_domain
713
+ # The universe domain within which to make requests. This determines the
714
+ # default endpoint URL. The default value of nil uses the environment
715
+ # universe (usually the default "googleapis.com" universe).
716
+ # @return [::String,nil]
717
+ # @!attribute [rw] logger
718
+ # A custom logger to use for request/response debug logging, or the value
719
+ # `:default` (the default) to construct a default logger, or `nil` to
720
+ # explicitly disable logging.
721
+ # @return [::Logger,:default,nil]
722
+ #
723
+ class Configuration
724
+ extend ::Gapic::Config
725
+
726
+ # @private
727
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
728
+ DEFAULT_ENDPOINT = "iam.googleapis.com"
729
+
730
+ config_attr :endpoint, nil, ::String, nil
731
+ config_attr :credentials, nil do |value|
732
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
733
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
734
+ allowed.any? { |klass| klass === value }
735
+ end
736
+ config_attr :scope, nil, ::String, ::Array, nil
737
+ config_attr :lib_name, nil, ::String, nil
738
+ config_attr :lib_version, nil, ::String, nil
739
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
740
+ config_attr :interceptors, nil, ::Array, nil
741
+ config_attr :timeout, nil, ::Numeric, nil
742
+ config_attr :metadata, nil, ::Hash, nil
743
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
744
+ config_attr :quota_project, nil, ::String, nil
745
+ config_attr :universe_domain, nil, ::String, nil
746
+ config_attr :logger, :default, ::Logger, nil, :default
747
+
748
+ # @private
749
+ def initialize parent_config = nil
750
+ @parent_config = parent_config unless parent_config.nil?
751
+
752
+ yield self if block_given?
753
+ end
754
+
755
+ ##
756
+ # Configurations for individual RPCs
757
+ # @return [Rpcs]
758
+ #
759
+ def rpcs
760
+ @rpcs ||= begin
761
+ parent_rpcs = nil
762
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
763
+ Rpcs.new parent_rpcs
764
+ end
765
+ end
766
+
767
+ ##
768
+ # Configuration for the channel pool
769
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
770
+ #
771
+ def channel_pool
772
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
773
+ end
774
+
775
+ ##
776
+ # Configuration RPC class for the Operations API.
777
+ #
778
+ # Includes fields providing the configuration for each RPC in this service.
779
+ # Each configuration object is of type `Gapic::Config::Method` and includes
780
+ # the following configuration fields:
781
+ #
782
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
783
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
784
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
785
+ # include the following keys:
786
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
787
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
788
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
789
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
790
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
791
+ # trigger a retry.
792
+ #
793
+ class Rpcs
794
+ ##
795
+ # RPC-specific configuration for `list_operations`
796
+ # @return [::Gapic::Config::Method]
797
+ #
798
+ attr_reader :list_operations
799
+ ##
800
+ # RPC-specific configuration for `get_operation`
801
+ # @return [::Gapic::Config::Method]
802
+ #
803
+ attr_reader :get_operation
804
+ ##
805
+ # RPC-specific configuration for `delete_operation`
806
+ # @return [::Gapic::Config::Method]
807
+ #
808
+ attr_reader :delete_operation
809
+ ##
810
+ # RPC-specific configuration for `cancel_operation`
811
+ # @return [::Gapic::Config::Method]
812
+ #
813
+ attr_reader :cancel_operation
814
+ ##
815
+ # RPC-specific configuration for `wait_operation`
816
+ # @return [::Gapic::Config::Method]
817
+ #
818
+ attr_reader :wait_operation
819
+
820
+ # @private
821
+ def initialize parent_rpcs = nil
822
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
823
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
824
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
825
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
826
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
827
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
828
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
829
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
830
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
831
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
832
+
833
+ yield self if block_given?
834
+ end
835
+ end
836
+ end
837
+ end
838
+ end
839
+ end
840
+ end
841
+ end