google-cloud-privileged_access_manager-v1 0.a → 0.1.0

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