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