google-iam-v3beta 0.a → 0.1.0

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