google-identity-access_context_manager-v1 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 (38) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +167 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/identity/access_context_manager/v1/access_context_manager/client.rb +2358 -0
  7. data/lib/google/identity/access_context_manager/v1/access_context_manager/credentials.rb +47 -0
  8. data/lib/google/identity/access_context_manager/v1/access_context_manager/operations.rb +664 -0
  9. data/lib/google/identity/access_context_manager/v1/access_context_manager/paths.rb +112 -0
  10. data/lib/google/identity/access_context_manager/v1/access_context_manager.rb +60 -0
  11. data/lib/google/identity/access_context_manager/v1/version.rb +28 -0
  12. data/lib/google/identity/access_context_manager/v1.rb +38 -0
  13. data/lib/google/identity/accesscontextmanager/type/device_resources_pb.rb +43 -0
  14. data/lib/google/identity/accesscontextmanager/v1/access_context_manager_pb.rb +182 -0
  15. data/lib/google/identity/accesscontextmanager/v1/access_context_manager_services_pb.rb +224 -0
  16. data/lib/google/identity/accesscontextmanager/v1/access_level_pb.rb +73 -0
  17. data/lib/google/identity/accesscontextmanager/v1/access_policy_pb.rb +30 -0
  18. data/lib/google/identity/accesscontextmanager/v1/gcp_user_access_binding_pb.rb +27 -0
  19. data/lib/google/identity/accesscontextmanager/v1/service_perimeter_pb.rb +109 -0
  20. data/lib/google-identity-access_context_manager-v1.rb +21 -0
  21. data/proto_docs/README.md +4 -0
  22. data/proto_docs/google/api/field_behavior.rb +71 -0
  23. data/proto_docs/google/api/resource.rb +283 -0
  24. data/proto_docs/google/identity/accesscontextmanager/type/device_resources.rb +84 -0
  25. data/proto_docs/google/identity/accesscontextmanager/v1/access_context_manager.rb +539 -0
  26. data/proto_docs/google/identity/accesscontextmanager/v1/access_level.rb +197 -0
  27. data/proto_docs/google/identity/accesscontextmanager/v1/access_policy.rb +60 -0
  28. data/proto_docs/google/identity/accesscontextmanager/v1/gcp_user_access_binding.rb +55 -0
  29. data/proto_docs/google/identity/accesscontextmanager/v1/service_perimeter.rb +484 -0
  30. data/proto_docs/google/longrunning/operations.rb +164 -0
  31. data/proto_docs/google/protobuf/any.rb +141 -0
  32. data/proto_docs/google/protobuf/duration.rb +98 -0
  33. data/proto_docs/google/protobuf/empty.rb +36 -0
  34. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  35. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  36. data/proto_docs/google/rpc/status.rb +46 -0
  37. data/proto_docs/google/type/expr.rb +75 -0
  38. metadata +228 -0
@@ -0,0 +1,664 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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 Identity
24
+ module AccessContextManager
25
+ module V1
26
+ module AccessContextManager
27
+ # Service that implements Longrunning Operations API.
28
+ class Operations
29
+ # @private
30
+ attr_reader :operations_stub
31
+
32
+ ##
33
+ # Configuration for the AccessContextManager Operations API.
34
+ #
35
+ # @yield [config] Configure the Operations client.
36
+ # @yieldparam config [Operations::Configuration]
37
+ #
38
+ # @return [Operations::Configuration]
39
+ #
40
+ def self.configure
41
+ @configure ||= Operations::Configuration.new
42
+ yield @configure if block_given?
43
+ @configure
44
+ end
45
+
46
+ ##
47
+ # Configure the AccessContextManager Operations instance.
48
+ #
49
+ # The configuration is set to the derived mode, meaning that values can be changed,
50
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
51
+ # should be made on {Operations.configure}.
52
+ #
53
+ # @yield [config] Configure the Operations client.
54
+ # @yieldparam config [Operations::Configuration]
55
+ #
56
+ # @return [Operations::Configuration]
57
+ #
58
+ def configure
59
+ yield @config if block_given?
60
+ @config
61
+ end
62
+
63
+ ##
64
+ # Create a new Operations client object.
65
+ #
66
+ # @yield [config] Configure the Client client.
67
+ # @yieldparam config [Operations::Configuration]
68
+ #
69
+ def initialize
70
+ # These require statements are intentionally placed here to initialize
71
+ # the gRPC module only when it's required.
72
+ # See https://github.com/googleapis/toolkit/issues/446
73
+ require "gapic/grpc"
74
+ require "google/longrunning/operations_services_pb"
75
+
76
+ # Create the configuration object
77
+ @config = Configuration.new Operations.configure
78
+
79
+ # Yield the configuration if needed
80
+ yield @config if block_given?
81
+
82
+ # Create credentials
83
+ credentials = @config.credentials
84
+ credentials ||= Credentials.default scope: @config.scope
85
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
86
+ credentials = Credentials.new credentials, scope: @config.scope
87
+ end
88
+ @quota_project_id = @config.quota_project
89
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
90
+
91
+ @operations_stub = ::Gapic::ServiceStub.new(
92
+ ::Google::Longrunning::Operations::Stub,
93
+ credentials: credentials,
94
+ endpoint: @config.endpoint,
95
+ channel_args: @config.channel_args,
96
+ interceptors: @config.interceptors
97
+ )
98
+ end
99
+
100
+ # Service calls
101
+
102
+ ##
103
+ # Lists operations that match the specified filter in the request. If the
104
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
105
+ #
106
+ # NOTE: the `name` binding allows API services to override the binding
107
+ # to use different resource name schemes, such as `users/*/operations`. To
108
+ # override the binding, API services can add a binding such as
109
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
110
+ # For backwards compatibility, the default name includes the operations
111
+ # collection id, however overriding users must ensure the name binding
112
+ # is the parent resource, without the operations collection id.
113
+ #
114
+ # @overload list_operations(request, options = nil)
115
+ # Pass arguments to `list_operations` via a request object, either of type
116
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
117
+ #
118
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
119
+ # A request object representing the call parameters. Required. To specify no
120
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
121
+ # @param options [::Gapic::CallOptions, ::Hash]
122
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
123
+ #
124
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
125
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
126
+ # least one keyword argument is required. To specify no parameters, or to keep all
127
+ # the default parameter values, pass an empty Hash as a request object (see above).
128
+ #
129
+ # @param name [::String]
130
+ # The name of the operation's parent resource.
131
+ # @param filter [::String]
132
+ # The standard list filter.
133
+ # @param page_size [::Integer]
134
+ # The standard list page size.
135
+ # @param page_token [::String]
136
+ # The standard list page token.
137
+ #
138
+ # @yield [response, operation] Access the result along with the RPC operation
139
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
140
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
141
+ #
142
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
143
+ #
144
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
145
+ #
146
+ def list_operations request, options = nil
147
+ raise ::ArgumentError, "request must be provided" if request.nil?
148
+
149
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
150
+
151
+ # Converts hash and nil to an options object
152
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
153
+
154
+ # Customize the options with defaults
155
+ metadata = @config.rpcs.list_operations.metadata.to_h
156
+
157
+ # Set x-goog-api-client and x-goog-user-project headers
158
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
159
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
160
+ gapic_version: ::Google::Identity::AccessContextManager::V1::VERSION
161
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
162
+
163
+ header_params = {
164
+ "name" => request.name
165
+ }
166
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
167
+ metadata[:"x-goog-request-params"] ||= request_params_header
168
+
169
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
170
+ metadata: metadata,
171
+ retry_policy: @config.rpcs.list_operations.retry_policy
172
+
173
+ options.apply_defaults timeout: @config.timeout,
174
+ metadata: @config.metadata,
175
+ retry_policy: @config.retry_policy
176
+
177
+ @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
178
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
179
+ response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
180
+ yield response, operation if block_given?
181
+ return response
182
+ end
183
+ rescue ::GRPC::BadStatus => e
184
+ raise ::Google::Cloud::Error.from_error(e)
185
+ end
186
+
187
+ ##
188
+ # Gets the latest state of a long-running operation. Clients can use this
189
+ # method to poll the operation result at intervals as recommended by the API
190
+ # service.
191
+ #
192
+ # @overload get_operation(request, options = nil)
193
+ # Pass arguments to `get_operation` via a request object, either of type
194
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
195
+ #
196
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
197
+ # A request object representing the call parameters. Required. To specify no
198
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
199
+ # @param options [::Gapic::CallOptions, ::Hash]
200
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
201
+ #
202
+ # @overload get_operation(name: nil)
203
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
204
+ # least one keyword argument is required. To specify no parameters, or to keep all
205
+ # the default parameter values, pass an empty Hash as a request object (see above).
206
+ #
207
+ # @param name [::String]
208
+ # The name of the operation resource.
209
+ #
210
+ # @yield [response, operation] Access the result along with the RPC operation
211
+ # @yieldparam response [::Gapic::Operation]
212
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
213
+ #
214
+ # @return [::Gapic::Operation]
215
+ #
216
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
+ #
218
+ def get_operation request, options = nil
219
+ raise ::ArgumentError, "request must be provided" if request.nil?
220
+
221
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
222
+
223
+ # Converts hash and nil to an options object
224
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
225
+
226
+ # Customize the options with defaults
227
+ metadata = @config.rpcs.get_operation.metadata.to_h
228
+
229
+ # Set x-goog-api-client and x-goog-user-project headers
230
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
231
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
232
+ gapic_version: ::Google::Identity::AccessContextManager::V1::VERSION
233
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
+
235
+ header_params = {
236
+ "name" => request.name
237
+ }
238
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
+ metadata[:"x-goog-request-params"] ||= request_params_header
240
+
241
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
242
+ metadata: metadata,
243
+ retry_policy: @config.rpcs.get_operation.retry_policy
244
+
245
+ options.apply_defaults timeout: @config.timeout,
246
+ metadata: @config.metadata,
247
+ retry_policy: @config.retry_policy
248
+
249
+ @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
250
+ response = ::Gapic::Operation.new response, @operations_client, options: options
251
+ yield response, operation if block_given?
252
+ return response
253
+ end
254
+ rescue ::GRPC::BadStatus => e
255
+ raise ::Google::Cloud::Error.from_error(e)
256
+ end
257
+
258
+ ##
259
+ # Deletes a long-running operation. This method indicates that the client is
260
+ # no longer interested in the operation result. It does not cancel the
261
+ # operation. If the server doesn't support this method, it returns
262
+ # `google.rpc.Code.UNIMPLEMENTED`.
263
+ #
264
+ # @overload delete_operation(request, options = nil)
265
+ # Pass arguments to `delete_operation` via a request object, either of type
266
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
267
+ #
268
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
269
+ # A request object representing the call parameters. Required. To specify no
270
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
271
+ # @param options [::Gapic::CallOptions, ::Hash]
272
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
273
+ #
274
+ # @overload delete_operation(name: nil)
275
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
276
+ # least one keyword argument is required. To specify no parameters, or to keep all
277
+ # the default parameter values, pass an empty Hash as a request object (see above).
278
+ #
279
+ # @param name [::String]
280
+ # The name of the operation resource to be deleted.
281
+ #
282
+ # @yield [response, operation] Access the result along with the RPC operation
283
+ # @yieldparam response [::Google::Protobuf::Empty]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
285
+ #
286
+ # @return [::Google::Protobuf::Empty]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
+ #
290
+ def delete_operation request, options = nil
291
+ raise ::ArgumentError, "request must be provided" if request.nil?
292
+
293
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
294
+
295
+ # Converts hash and nil to an options object
296
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
297
+
298
+ # Customize the options with defaults
299
+ metadata = @config.rpcs.delete_operation.metadata.to_h
300
+
301
+ # Set x-goog-api-client and x-goog-user-project headers
302
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
303
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
304
+ gapic_version: ::Google::Identity::AccessContextManager::V1::VERSION
305
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
+
307
+ header_params = {
308
+ "name" => request.name
309
+ }
310
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
+ metadata[:"x-goog-request-params"] ||= request_params_header
312
+
313
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
314
+ metadata: metadata,
315
+ retry_policy: @config.rpcs.delete_operation.retry_policy
316
+
317
+ options.apply_defaults timeout: @config.timeout,
318
+ metadata: @config.metadata,
319
+ retry_policy: @config.retry_policy
320
+
321
+ @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
322
+ yield response, operation if block_given?
323
+ return response
324
+ end
325
+ rescue ::GRPC::BadStatus => e
326
+ raise ::Google::Cloud::Error.from_error(e)
327
+ end
328
+
329
+ ##
330
+ # Starts asynchronous cancellation on a long-running operation. The server
331
+ # makes a best effort to cancel the operation, but success is not
332
+ # guaranteed. If the server doesn't support this method, it returns
333
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
334
+ # Operations.GetOperation or
335
+ # other methods to check whether the cancellation succeeded or whether the
336
+ # operation completed despite cancellation. On successful cancellation,
337
+ # the operation is not deleted; instead, it becomes an operation with
338
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
339
+ # corresponding to `Code.CANCELLED`.
340
+ #
341
+ # @overload cancel_operation(request, options = nil)
342
+ # Pass arguments to `cancel_operation` via a request object, either of type
343
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
344
+ #
345
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
346
+ # A request object representing the call parameters. Required. To specify no
347
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
348
+ # @param options [::Gapic::CallOptions, ::Hash]
349
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
350
+ #
351
+ # @overload cancel_operation(name: nil)
352
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
353
+ # least one keyword argument is required. To specify no parameters, or to keep all
354
+ # the default parameter values, pass an empty Hash as a request object (see above).
355
+ #
356
+ # @param name [::String]
357
+ # The name of the operation resource to be cancelled.
358
+ #
359
+ # @yield [response, operation] Access the result along with the RPC operation
360
+ # @yieldparam response [::Google::Protobuf::Empty]
361
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
362
+ #
363
+ # @return [::Google::Protobuf::Empty]
364
+ #
365
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
366
+ #
367
+ def cancel_operation request, options = nil
368
+ raise ::ArgumentError, "request must be provided" if request.nil?
369
+
370
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
371
+
372
+ # Converts hash and nil to an options object
373
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
374
+
375
+ # Customize the options with defaults
376
+ metadata = @config.rpcs.cancel_operation.metadata.to_h
377
+
378
+ # Set x-goog-api-client and x-goog-user-project headers
379
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
380
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
381
+ gapic_version: ::Google::Identity::AccessContextManager::V1::VERSION
382
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
+
384
+ header_params = {
385
+ "name" => request.name
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.cancel_operation.timeout,
391
+ metadata: metadata,
392
+ retry_policy: @config.rpcs.cancel_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 :cancel_operation, request, options: options do |response, operation|
399
+ yield response, operation if block_given?
400
+ return response
401
+ end
402
+ rescue ::GRPC::BadStatus => e
403
+ raise ::Google::Cloud::Error.from_error(e)
404
+ end
405
+
406
+ ##
407
+ # Waits until the specified long-running operation is done or reaches at most
408
+ # a specified timeout, returning the latest state. If the operation is
409
+ # already done, the latest state is immediately returned. If the timeout
410
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
411
+ # timeout is used. If the server does not support this method, it returns
412
+ # `google.rpc.Code.UNIMPLEMENTED`.
413
+ # Note that this method is on a best-effort basis. It may return the latest
414
+ # state before the specified timeout (including immediately), meaning even an
415
+ # immediate response is no guarantee that the operation is done.
416
+ #
417
+ # @overload wait_operation(request, options = nil)
418
+ # Pass arguments to `wait_operation` via a request object, either of type
419
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
420
+ #
421
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
422
+ # A request object representing the call parameters. Required. To specify no
423
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
424
+ # @param options [::Gapic::CallOptions, ::Hash]
425
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
426
+ #
427
+ # @overload wait_operation(name: nil, timeout: nil)
428
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
429
+ # least one keyword argument is required. To specify no parameters, or to keep all
430
+ # the default parameter values, pass an empty Hash as a request object (see above).
431
+ #
432
+ # @param name [::String]
433
+ # The name of the operation resource to wait on.
434
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
435
+ # The maximum duration to wait before timing out. If left blank, the wait
436
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
437
+ # If RPC context deadline is also specified, the shorter one will be used.
438
+ #
439
+ # @yield [response, operation] Access the result along with the RPC operation
440
+ # @yieldparam response [::Gapic::Operation]
441
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
442
+ #
443
+ # @return [::Gapic::Operation]
444
+ #
445
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
+ #
447
+ def wait_operation request, options = nil
448
+ raise ::ArgumentError, "request must be provided" if request.nil?
449
+
450
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
451
+
452
+ # Converts hash and nil to an options object
453
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
454
+
455
+ # Customize the options with defaults
456
+ metadata = @config.rpcs.wait_operation.metadata.to_h
457
+
458
+ # Set x-goog-api-client and x-goog-user-project headers
459
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
460
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
461
+ gapic_version: ::Google::Identity::AccessContextManager::V1::VERSION
462
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
463
+
464
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
465
+ metadata: metadata,
466
+ retry_policy: @config.rpcs.wait_operation.retry_policy
467
+
468
+ options.apply_defaults timeout: @config.timeout,
469
+ metadata: @config.metadata,
470
+ retry_policy: @config.retry_policy
471
+
472
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
473
+ response = ::Gapic::Operation.new response, @operations_client, options: options
474
+ yield response, operation if block_given?
475
+ return response
476
+ end
477
+ rescue ::GRPC::BadStatus => e
478
+ raise ::Google::Cloud::Error.from_error(e)
479
+ end
480
+
481
+ ##
482
+ # Configuration class for the Operations API.
483
+ #
484
+ # This class represents the configuration for Operations,
485
+ # providing control over timeouts, retry behavior, logging, transport
486
+ # parameters, and other low-level controls. Certain parameters can also be
487
+ # applied individually to specific RPCs. See
488
+ # {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
489
+ # for a list of RPCs that can be configured independently.
490
+ #
491
+ # Configuration can be applied globally to all clients, or to a single client
492
+ # on construction.
493
+ #
494
+ # @example
495
+ #
496
+ # # Modify the global config, setting the timeout for
497
+ # # list_operations to 20 seconds,
498
+ # # and all remaining timeouts to 10 seconds.
499
+ # ::Google::Longrunning::Operations::Client.configure do |config|
500
+ # config.timeout = 10.0
501
+ # config.rpcs.list_operations.timeout = 20.0
502
+ # end
503
+ #
504
+ # # Apply the above configuration only to a new client.
505
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
506
+ # config.timeout = 10.0
507
+ # config.rpcs.list_operations.timeout = 20.0
508
+ # end
509
+ #
510
+ # @!attribute [rw] endpoint
511
+ # The hostname or hostname:port of the service endpoint.
512
+ # Defaults to `"accesscontextmanager.googleapis.com"`.
513
+ # @return [::String]
514
+ # @!attribute [rw] credentials
515
+ # Credentials to send with calls. You may provide any of the following types:
516
+ # * (`String`) The path to a service account key file in JSON format
517
+ # * (`Hash`) A service account key as a Hash
518
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
519
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
520
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
521
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
522
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
523
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
524
+ # * (`nil`) indicating no credentials
525
+ # @return [::Object]
526
+ # @!attribute [rw] scope
527
+ # The OAuth scopes
528
+ # @return [::Array<::String>]
529
+ # @!attribute [rw] lib_name
530
+ # The library name as recorded in instrumentation and logging
531
+ # @return [::String]
532
+ # @!attribute [rw] lib_version
533
+ # The library version as recorded in instrumentation and logging
534
+ # @return [::String]
535
+ # @!attribute [rw] channel_args
536
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
537
+ # `GRPC::Core::Channel` object is provided as the credential.
538
+ # @return [::Hash]
539
+ # @!attribute [rw] interceptors
540
+ # An array of interceptors that are run before calls are executed.
541
+ # @return [::Array<::GRPC::ClientInterceptor>]
542
+ # @!attribute [rw] timeout
543
+ # The call timeout in seconds.
544
+ # @return [::Numeric]
545
+ # @!attribute [rw] metadata
546
+ # Additional gRPC headers to be sent with the call.
547
+ # @return [::Hash{::Symbol=>::String}]
548
+ # @!attribute [rw] retry_policy
549
+ # The retry policy. The value is a hash with the following keys:
550
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
551
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
552
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
553
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
554
+ # trigger a retry.
555
+ # @return [::Hash]
556
+ # @!attribute [rw] quota_project
557
+ # A separate project against which to charge quota.
558
+ # @return [::String]
559
+ #
560
+ class Configuration
561
+ extend ::Gapic::Config
562
+
563
+ config_attr :endpoint, "accesscontextmanager.googleapis.com", ::String
564
+ config_attr :credentials, nil do |value|
565
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
566
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
567
+ allowed.any? { |klass| klass === value }
568
+ end
569
+ config_attr :scope, nil, ::String, ::Array, nil
570
+ config_attr :lib_name, nil, ::String, nil
571
+ config_attr :lib_version, nil, ::String, nil
572
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
573
+ config_attr :interceptors, nil, ::Array, nil
574
+ config_attr :timeout, nil, ::Numeric, nil
575
+ config_attr :metadata, nil, ::Hash, nil
576
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
577
+ config_attr :quota_project, nil, ::String, nil
578
+
579
+ # @private
580
+ def initialize parent_config = nil
581
+ @parent_config = parent_config unless parent_config.nil?
582
+
583
+ yield self if block_given?
584
+ end
585
+
586
+ ##
587
+ # Configurations for individual RPCs
588
+ # @return [Rpcs]
589
+ #
590
+ def rpcs
591
+ @rpcs ||= begin
592
+ parent_rpcs = nil
593
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
594
+ Rpcs.new parent_rpcs
595
+ end
596
+ end
597
+
598
+ ##
599
+ # Configuration RPC class for the Operations API.
600
+ #
601
+ # Includes fields providing the configuration for each RPC in this service.
602
+ # Each configuration object is of type `Gapic::Config::Method` and includes
603
+ # the following configuration fields:
604
+ #
605
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
606
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
607
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
608
+ # include the following keys:
609
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
610
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
611
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
612
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
613
+ # trigger a retry.
614
+ #
615
+ class Rpcs
616
+ ##
617
+ # RPC-specific configuration for `list_operations`
618
+ # @return [::Gapic::Config::Method]
619
+ #
620
+ attr_reader :list_operations
621
+ ##
622
+ # RPC-specific configuration for `get_operation`
623
+ # @return [::Gapic::Config::Method]
624
+ #
625
+ attr_reader :get_operation
626
+ ##
627
+ # RPC-specific configuration for `delete_operation`
628
+ # @return [::Gapic::Config::Method]
629
+ #
630
+ attr_reader :delete_operation
631
+ ##
632
+ # RPC-specific configuration for `cancel_operation`
633
+ # @return [::Gapic::Config::Method]
634
+ #
635
+ attr_reader :cancel_operation
636
+ ##
637
+ # RPC-specific configuration for `wait_operation`
638
+ # @return [::Gapic::Config::Method]
639
+ #
640
+ attr_reader :wait_operation
641
+
642
+ # @private
643
+ def initialize parent_rpcs = nil
644
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
645
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
646
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
647
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
648
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
649
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
650
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
651
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
652
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
653
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
654
+
655
+ yield self if block_given?
656
+ end
657
+ end
658
+ end
659
+ end
660
+ end
661
+ end
662
+ end
663
+ end
664
+ end