google-cloud-cloud_security_compliance-v1 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +4 -4
  4. data/lib/google/cloud/cloud_security_compliance/v1/audit/client.rb +859 -0
  5. data/lib/google/cloud/cloud_security_compliance/v1/audit/credentials.rb +47 -0
  6. data/lib/google/cloud/cloud_security_compliance/v1/audit/operations.rb +841 -0
  7. data/lib/google/cloud/cloud_security_compliance/v1/audit/paths.rb +110 -0
  8. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest/client.rb +796 -0
  9. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest/operations.rb +925 -0
  10. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest/service_stub.rb +387 -0
  11. data/lib/google/cloud/cloud_security_compliance/v1/audit/rest.rb +54 -0
  12. data/lib/google/cloud/cloud_security_compliance/v1/audit.rb +56 -0
  13. data/lib/google/cloud/cloud_security_compliance/v1/bindings_override.rb +1 -1
  14. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/client.rb +608 -0
  15. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/credentials.rb +47 -0
  16. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/paths.rb +72 -0
  17. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/rest/client.rb +559 -0
  18. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/rest/service_stub.rb +234 -0
  19. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service/rest.rb +54 -0
  20. data/lib/google/cloud/cloud_security_compliance/v1/cm_enrollment_service.rb +56 -0
  21. data/lib/google/cloud/cloud_security_compliance/v1/config/client.rb +133 -102
  22. data/lib/google/cloud/cloud_security_compliance/v1/config/rest/client.rb +113 -99
  23. data/lib/google/cloud/cloud_security_compliance/v1/deployment/client.rb +80 -41
  24. data/lib/google/cloud/cloud_security_compliance/v1/deployment/operations.rb +20 -3
  25. data/lib/google/cloud/cloud_security_compliance/v1/deployment/rest/client.rb +60 -38
  26. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/client.rb +940 -0
  27. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/credentials.rb +47 -0
  28. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/paths.rb +142 -0
  29. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/rest/client.rb +870 -0
  30. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/rest/service_stub.rb +456 -0
  31. data/lib/google/cloud/cloud_security_compliance/v1/monitoring/rest.rb +53 -0
  32. data/lib/google/cloud/cloud_security_compliance/v1/monitoring.rb +55 -0
  33. data/lib/google/cloud/cloud_security_compliance/v1/rest.rb +4 -1
  34. data/lib/google/cloud/cloud_security_compliance/v1/version.rb +1 -1
  35. data/lib/google/cloud/cloud_security_compliance/v1.rb +5 -2
  36. data/lib/google/cloud/cloudsecuritycompliance/v1/audit_pb.rb +70 -0
  37. data/lib/google/cloud/cloudsecuritycompliance/v1/audit_services_pb.rb +51 -0
  38. data/lib/google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service_pb.rb +54 -0
  39. data/lib/google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service_services_pb.rb +54 -0
  40. data/lib/google/cloud/cloudsecuritycompliance/v1/common_pb.rb +4 -1
  41. data/lib/google/cloud/cloudsecuritycompliance/v1/config_pb.rb +1 -1
  42. data/lib/google/cloud/cloudsecuritycompliance/v1/config_services_pb.rb +58 -55
  43. data/lib/google/cloud/cloudsecuritycompliance/v1/deployment_services_pb.rb +9 -6
  44. data/lib/google/cloud/cloudsecuritycompliance/v1/monitoring_pb.rb +74 -0
  45. data/lib/google/cloud/cloudsecuritycompliance/v1/monitoring_services_pb.rb +53 -0
  46. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/audit.rb +413 -0
  47. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/cm_enrollment_service.rb +108 -0
  48. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/common.rb +210 -181
  49. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/config.rb +69 -57
  50. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/deployment.rb +180 -139
  51. data/proto_docs/google/cloud/cloudsecuritycompliance/v1/monitoring.rb +527 -0
  52. data/proto_docs/google/type/interval.rb +45 -0
  53. metadata +34 -1
@@ -0,0 +1,841 @@
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 Audit
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 Audit 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 Audit 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
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
646
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
647
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
648
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
649
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
650
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
651
+ # * (`nil`) indicating no credentials
652
+ #
653
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
654
+ # is deprecated. Providing an unvalidated credential configuration to
655
+ # Google APIs can compromise the security of your systems and data.
656
+ #
657
+ # @example
658
+ #
659
+ # # The recommended way to provide credentials is to use the `make_creds` method
660
+ # # on the appropriate credentials class for your environment.
661
+ #
662
+ # require "googleauth"
663
+ #
664
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
665
+ # json_key_io: ::File.open("/path/to/keyfile.json")
666
+ # )
667
+ #
668
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
669
+ # config.credentials = credentials
670
+ # end
671
+ #
672
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
673
+ # external source for authentication to Google Cloud, you must validate it before
674
+ # providing it to a Google API client library. Providing an unvalidated credential
675
+ # configuration to Google APIs can compromise the security of your systems and data.
676
+ # For more information, refer to [Validate credential configurations from external
677
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
678
+ # @return [::Object]
679
+ # @!attribute [rw] scope
680
+ # The OAuth scopes
681
+ # @return [::Array<::String>]
682
+ # @!attribute [rw] lib_name
683
+ # The library name as recorded in instrumentation and logging
684
+ # @return [::String]
685
+ # @!attribute [rw] lib_version
686
+ # The library version as recorded in instrumentation and logging
687
+ # @return [::String]
688
+ # @!attribute [rw] channel_args
689
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
690
+ # `GRPC::Core::Channel` object is provided as the credential.
691
+ # @return [::Hash]
692
+ # @!attribute [rw] interceptors
693
+ # An array of interceptors that are run before calls are executed.
694
+ # @return [::Array<::GRPC::ClientInterceptor>]
695
+ # @!attribute [rw] timeout
696
+ # The call timeout in seconds.
697
+ # @return [::Numeric]
698
+ # @!attribute [rw] metadata
699
+ # Additional gRPC headers to be sent with the call.
700
+ # @return [::Hash{::Symbol=>::String}]
701
+ # @!attribute [rw] retry_policy
702
+ # The retry policy. The value is a hash with the following keys:
703
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
704
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
705
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
706
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
707
+ # trigger a retry.
708
+ # @return [::Hash]
709
+ # @!attribute [rw] quota_project
710
+ # A separate project against which to charge quota.
711
+ # @return [::String]
712
+ # @!attribute [rw] universe_domain
713
+ # The universe domain within which to make requests. This determines the
714
+ # default endpoint URL. The default value of nil uses the environment
715
+ # universe (usually the default "googleapis.com" universe).
716
+ # @return [::String,nil]
717
+ # @!attribute [rw] logger
718
+ # A custom logger to use for request/response debug logging, or the value
719
+ # `:default` (the default) to construct a default logger, or `nil` to
720
+ # explicitly disable logging.
721
+ # @return [::Logger,:default,nil]
722
+ #
723
+ class Configuration
724
+ extend ::Gapic::Config
725
+
726
+ # @private
727
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
728
+ DEFAULT_ENDPOINT = "cloudsecuritycompliance.googleapis.com"
729
+
730
+ config_attr :endpoint, nil, ::String, nil
731
+ config_attr :credentials, nil do |value|
732
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
733
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
734
+ allowed.any? { |klass| klass === value }
735
+ end
736
+ config_attr :scope, nil, ::String, ::Array, nil
737
+ config_attr :lib_name, nil, ::String, nil
738
+ config_attr :lib_version, nil, ::String, nil
739
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
740
+ config_attr :interceptors, nil, ::Array, nil
741
+ config_attr :timeout, nil, ::Numeric, nil
742
+ config_attr :metadata, nil, ::Hash, nil
743
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
744
+ config_attr :quota_project, nil, ::String, nil
745
+ config_attr :universe_domain, nil, ::String, nil
746
+ config_attr :logger, :default, ::Logger, nil, :default
747
+
748
+ # @private
749
+ def initialize parent_config = nil
750
+ @parent_config = parent_config unless parent_config.nil?
751
+
752
+ yield self if block_given?
753
+ end
754
+
755
+ ##
756
+ # Configurations for individual RPCs
757
+ # @return [Rpcs]
758
+ #
759
+ def rpcs
760
+ @rpcs ||= begin
761
+ parent_rpcs = nil
762
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
763
+ Rpcs.new parent_rpcs
764
+ end
765
+ end
766
+
767
+ ##
768
+ # Configuration for the channel pool
769
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
770
+ #
771
+ def channel_pool
772
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
773
+ end
774
+
775
+ ##
776
+ # Configuration RPC class for the Operations API.
777
+ #
778
+ # Includes fields providing the configuration for each RPC in this service.
779
+ # Each configuration object is of type `Gapic::Config::Method` and includes
780
+ # the following configuration fields:
781
+ #
782
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
783
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
784
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
785
+ # include the following keys:
786
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
787
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
788
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
789
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
790
+ # trigger a retry.
791
+ #
792
+ class Rpcs
793
+ ##
794
+ # RPC-specific configuration for `list_operations`
795
+ # @return [::Gapic::Config::Method]
796
+ #
797
+ attr_reader :list_operations
798
+ ##
799
+ # RPC-specific configuration for `get_operation`
800
+ # @return [::Gapic::Config::Method]
801
+ #
802
+ attr_reader :get_operation
803
+ ##
804
+ # RPC-specific configuration for `delete_operation`
805
+ # @return [::Gapic::Config::Method]
806
+ #
807
+ attr_reader :delete_operation
808
+ ##
809
+ # RPC-specific configuration for `cancel_operation`
810
+ # @return [::Gapic::Config::Method]
811
+ #
812
+ attr_reader :cancel_operation
813
+ ##
814
+ # RPC-specific configuration for `wait_operation`
815
+ # @return [::Gapic::Config::Method]
816
+ #
817
+ attr_reader :wait_operation
818
+
819
+ # @private
820
+ def initialize parent_rpcs = nil
821
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
822
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
823
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
824
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
825
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
826
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
827
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
828
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
829
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
830
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
831
+
832
+ yield self if block_given?
833
+ end
834
+ end
835
+ end
836
+ end
837
+ end
838
+ end
839
+ end
840
+ end
841
+ end