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