google-cloud-netapp-v1 0.a → 0.2.0

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