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

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