google-cloud-workload_manager-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 (34) 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/workload_manager/v1/bindings_override.rb +75 -0
  6. data/lib/google/cloud/workload_manager/v1/rest.rb +38 -0
  7. data/lib/google/cloud/workload_manager/v1/version.rb +7 -2
  8. data/lib/google/cloud/workload_manager/v1/workload_manager/client.rb +1772 -0
  9. data/lib/google/cloud/workload_manager/v1/workload_manager/credentials.rb +47 -0
  10. data/lib/google/cloud/workload_manager/v1/workload_manager/operations.rb +841 -0
  11. data/lib/google/cloud/workload_manager/v1/workload_manager/paths.rb +111 -0
  12. data/lib/google/cloud/workload_manager/v1/workload_manager/rest/client.rb +1653 -0
  13. data/lib/google/cloud/workload_manager/v1/workload_manager/rest/operations.rb +925 -0
  14. data/lib/google/cloud/workload_manager/v1/workload_manager/rest/service_stub.rb +816 -0
  15. data/lib/google/cloud/workload_manager/v1/workload_manager/rest.rb +55 -0
  16. data/lib/google/cloud/workload_manager/v1/workload_manager.rb +57 -0
  17. data/lib/google/cloud/workload_manager/v1.rb +45 -0
  18. data/lib/google/cloud/workloadmanager/v1/service_pb.rb +75 -0
  19. data/lib/google/cloud/workloadmanager/v1/service_services_pb.rb +68 -0
  20. data/lib/google-cloud-workload_manager-v1.rb +21 -0
  21. data/proto_docs/README.md +4 -0
  22. data/proto_docs/google/api/client.rb +593 -0
  23. data/proto_docs/google/api/field_behavior.rb +85 -0
  24. data/proto_docs/google/api/launch_stage.rb +71 -0
  25. data/proto_docs/google/api/resource.rb +227 -0
  26. data/proto_docs/google/cloud/workloadmanager/v1/service.rb +991 -0
  27. data/proto_docs/google/longrunning/operations.rb +191 -0
  28. data/proto_docs/google/protobuf/any.rb +145 -0
  29. data/proto_docs/google/protobuf/duration.rb +98 -0
  30. data/proto_docs/google/protobuf/empty.rb +34 -0
  31. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  32. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  33. data/proto_docs/google/rpc/status.rb +48 -0
  34. metadata +83 -9
@@ -0,0 +1,1653 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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 "google/cloud/errors"
20
+ require "google/cloud/workloadmanager/v1/service_pb"
21
+ require "google/cloud/workload_manager/v1/workload_manager/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module WorkloadManager
27
+ module V1
28
+ module WorkloadManager
29
+ module Rest
30
+ ##
31
+ # REST client for the WorkloadManager service.
32
+ #
33
+ # The Workload Manager provides various tools to deploy, validate and observe
34
+ # your workloads running on Google Cloud.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "workloadmanager.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :workload_manager_stub
47
+
48
+ ##
49
+ # Configure the WorkloadManager Client class.
50
+ #
51
+ # See {::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all WorkloadManager clients
57
+ # ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "WorkloadManager", "V1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.rpcs.list_evaluations.timeout = 60.0
78
+ default_config.rpcs.list_evaluations.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.get_evaluation.timeout = 60.0
83
+ default_config.rpcs.get_evaluation.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
85
+ }
86
+
87
+ default_config.rpcs.create_evaluation.timeout = 60.0
88
+
89
+ default_config.rpcs.update_evaluation.timeout = 60.0
90
+
91
+ default_config.rpcs.delete_evaluation.timeout = 60.0
92
+
93
+ default_config.rpcs.list_executions.timeout = 60.0
94
+ default_config.rpcs.list_executions.retry_policy = {
95
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
96
+ }
97
+
98
+ default_config.rpcs.get_execution.timeout = 60.0
99
+ default_config.rpcs.get_execution.retry_policy = {
100
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config.rpcs.run_evaluation.timeout = 60.0
104
+
105
+ default_config.rpcs.delete_execution.timeout = 60.0
106
+
107
+ default_config.rpcs.list_execution_results.timeout = 60.0
108
+ default_config.rpcs.list_execution_results.retry_policy = {
109
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
110
+ }
111
+
112
+ default_config.rpcs.list_rules.timeout = 60.0
113
+ default_config.rpcs.list_rules.retry_policy = {
114
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
115
+ }
116
+
117
+ default_config.rpcs.list_scanned_resources.timeout = 60.0
118
+ default_config.rpcs.list_scanned_resources.retry_policy = {
119
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
120
+ }
121
+
122
+ default_config
123
+ end
124
+ yield @configure if block_given?
125
+ @configure
126
+ end
127
+
128
+ ##
129
+ # Configure the WorkloadManager Client instance.
130
+ #
131
+ # The configuration is set to the derived mode, meaning that values can be changed,
132
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
133
+ # should be made on {Client.configure}.
134
+ #
135
+ # See {::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client::Configuration}
136
+ # for a description of the configuration fields.
137
+ #
138
+ # @yield [config] Configure the Client client.
139
+ # @yieldparam config [Client::Configuration]
140
+ #
141
+ # @return [Client::Configuration]
142
+ #
143
+ def configure
144
+ yield @config if block_given?
145
+ @config
146
+ end
147
+
148
+ ##
149
+ # The effective universe domain
150
+ #
151
+ # @return [String]
152
+ #
153
+ def universe_domain
154
+ @workload_manager_stub.universe_domain
155
+ end
156
+
157
+ ##
158
+ # Create a new WorkloadManager REST client object.
159
+ #
160
+ # @example
161
+ #
162
+ # # Create a client using the default configuration
163
+ # client = ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
164
+ #
165
+ # # Create a client using a custom configuration
166
+ # client = ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new do |config|
167
+ # config.timeout = 10.0
168
+ # end
169
+ #
170
+ # @yield [config] Configure the WorkloadManager client.
171
+ # @yieldparam config [Client::Configuration]
172
+ #
173
+ def initialize
174
+ # Create the configuration object
175
+ @config = Configuration.new Client.configure
176
+
177
+ # Yield the configuration if needed
178
+ yield @config if block_given?
179
+
180
+ # Create credentials
181
+ credentials = @config.credentials
182
+ # Use self-signed JWT if the endpoint is unchanged from default,
183
+ # but only if the default endpoint does not have a region prefix.
184
+ enable_self_signed_jwt = @config.endpoint.nil? ||
185
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
186
+ !@config.endpoint.split(".").first.include?("-"))
187
+ credentials ||= Credentials.default scope: @config.scope,
188
+ enable_self_signed_jwt: enable_self_signed_jwt
189
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
190
+ credentials = Credentials.new credentials, scope: @config.scope
191
+ end
192
+
193
+ @quota_project_id = @config.quota_project
194
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
195
+
196
+ @operations_client = ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Operations.new do |config|
197
+ config.credentials = credentials
198
+ config.quota_project = @quota_project_id
199
+ config.endpoint = @config.endpoint
200
+ config.universe_domain = @config.universe_domain
201
+ end
202
+
203
+ @workload_manager_stub = ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::ServiceStub.new(
204
+ endpoint: @config.endpoint,
205
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
206
+ universe_domain: @config.universe_domain,
207
+ credentials: credentials,
208
+ logger: @config.logger
209
+ )
210
+
211
+ @workload_manager_stub.logger(stub: true)&.info do |entry|
212
+ entry.set_system_name
213
+ entry.set_service
214
+ entry.message = "Created client for #{entry.service}"
215
+ entry.set_credentials_fields credentials
216
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
217
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
218
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
219
+ end
220
+
221
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
222
+ config.credentials = credentials
223
+ config.quota_project = @quota_project_id
224
+ config.endpoint = @workload_manager_stub.endpoint
225
+ config.universe_domain = @workload_manager_stub.universe_domain
226
+ config.bindings_override = @config.bindings_override
227
+ config.logger = @workload_manager_stub.logger if config.respond_to? :logger=
228
+ end
229
+ end
230
+
231
+ ##
232
+ # Get the associated client for long-running operations.
233
+ #
234
+ # @return [::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Operations]
235
+ #
236
+ attr_reader :operations_client
237
+
238
+ ##
239
+ # Get the associated client for mix-in of the Locations.
240
+ #
241
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
242
+ #
243
+ attr_reader :location_client
244
+
245
+ ##
246
+ # The logger used for request/response debug logging.
247
+ #
248
+ # @return [Logger]
249
+ #
250
+ def logger
251
+ @workload_manager_stub.logger
252
+ end
253
+
254
+ # Service calls
255
+
256
+ ##
257
+ # Lists Evaluations in a given project and location.
258
+ #
259
+ # @overload list_evaluations(request, options = nil)
260
+ # Pass arguments to `list_evaluations` via a request object, either of type
261
+ # {::Google::Cloud::WorkloadManager::V1::ListEvaluationsRequest} or an equivalent Hash.
262
+ #
263
+ # @param request [::Google::Cloud::WorkloadManager::V1::ListEvaluationsRequest, ::Hash]
264
+ # A request object representing the call parameters. Required. To specify no
265
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
266
+ # @param options [::Gapic::CallOptions, ::Hash]
267
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
268
+ #
269
+ # @overload list_evaluations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
270
+ # Pass arguments to `list_evaluations` via keyword arguments. Note that at
271
+ # least one keyword argument is required. To specify no parameters, or to keep all
272
+ # the default parameter values, pass an empty Hash as a request object (see above).
273
+ #
274
+ # @param parent [::String]
275
+ # Required. Parent value for ListEvaluationsRequest.
276
+ # @param page_size [::Integer]
277
+ # Requested page size. Server may return fewer items than requested.
278
+ # If unspecified, server will pick an appropriate default.
279
+ # @param page_token [::String]
280
+ # A token identifying a page of results the server should return.
281
+ # @param filter [::String]
282
+ # Filter to be applied when listing the evaluation results.
283
+ # @param order_by [::String]
284
+ # Hint for how to order the results.
285
+ # @yield [result, operation] Access the result along with the TransportOperation object
286
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::Evaluation>]
287
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
288
+ #
289
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::Evaluation>]
290
+ #
291
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
292
+ #
293
+ # @example Basic example
294
+ # require "google/cloud/workload_manager/v1"
295
+ #
296
+ # # Create a client object. The client can be reused for multiple calls.
297
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
298
+ #
299
+ # # Create a request. To set request fields, pass in keyword arguments.
300
+ # request = Google::Cloud::WorkloadManager::V1::ListEvaluationsRequest.new
301
+ #
302
+ # # Call the list_evaluations method.
303
+ # result = client.list_evaluations request
304
+ #
305
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
306
+ # # over elements, and API calls will be issued to fetch pages as needed.
307
+ # result.each do |item|
308
+ # # Each element is of type ::Google::Cloud::WorkloadManager::V1::Evaluation.
309
+ # p item
310
+ # end
311
+ #
312
+ def list_evaluations request, options = nil
313
+ raise ::ArgumentError, "request must be provided" if request.nil?
314
+
315
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::ListEvaluationsRequest
316
+
317
+ # Converts hash and nil to an options object
318
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
319
+
320
+ # Customize the options with defaults
321
+ call_metadata = @config.rpcs.list_evaluations.metadata.to_h
322
+
323
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
324
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
325
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
326
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
327
+ transports_version_send: [:rest]
328
+
329
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
330
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
331
+
332
+ options.apply_defaults timeout: @config.rpcs.list_evaluations.timeout,
333
+ metadata: call_metadata,
334
+ retry_policy: @config.rpcs.list_evaluations.retry_policy
335
+
336
+ options.apply_defaults timeout: @config.timeout,
337
+ metadata: @config.metadata,
338
+ retry_policy: @config.retry_policy
339
+
340
+ @workload_manager_stub.list_evaluations request, options do |result, operation|
341
+ result = ::Gapic::Rest::PagedEnumerable.new @workload_manager_stub, :list_evaluations, "evaluations", request, result, options
342
+ yield result, operation if block_given?
343
+ throw :response, result
344
+ end
345
+ rescue ::Gapic::Rest::Error => e
346
+ raise ::Google::Cloud::Error.from_error(e)
347
+ end
348
+
349
+ ##
350
+ # Gets details of a single Evaluation.
351
+ #
352
+ # @overload get_evaluation(request, options = nil)
353
+ # Pass arguments to `get_evaluation` via a request object, either of type
354
+ # {::Google::Cloud::WorkloadManager::V1::GetEvaluationRequest} or an equivalent Hash.
355
+ #
356
+ # @param request [::Google::Cloud::WorkloadManager::V1::GetEvaluationRequest, ::Hash]
357
+ # A request object representing the call parameters. Required. To specify no
358
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
359
+ # @param options [::Gapic::CallOptions, ::Hash]
360
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
361
+ #
362
+ # @overload get_evaluation(name: nil)
363
+ # Pass arguments to `get_evaluation` via keyword arguments. Note that at
364
+ # least one keyword argument is required. To specify no parameters, or to keep all
365
+ # the default parameter values, pass an empty Hash as a request object (see above).
366
+ #
367
+ # @param name [::String]
368
+ # Required. Name of the resource.
369
+ # @yield [result, operation] Access the result along with the TransportOperation object
370
+ # @yieldparam result [::Google::Cloud::WorkloadManager::V1::Evaluation]
371
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
372
+ #
373
+ # @return [::Google::Cloud::WorkloadManager::V1::Evaluation]
374
+ #
375
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
376
+ #
377
+ # @example Basic example
378
+ # require "google/cloud/workload_manager/v1"
379
+ #
380
+ # # Create a client object. The client can be reused for multiple calls.
381
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
382
+ #
383
+ # # Create a request. To set request fields, pass in keyword arguments.
384
+ # request = Google::Cloud::WorkloadManager::V1::GetEvaluationRequest.new
385
+ #
386
+ # # Call the get_evaluation method.
387
+ # result = client.get_evaluation request
388
+ #
389
+ # # The returned object is of type Google::Cloud::WorkloadManager::V1::Evaluation.
390
+ # p result
391
+ #
392
+ def get_evaluation request, options = nil
393
+ raise ::ArgumentError, "request must be provided" if request.nil?
394
+
395
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::GetEvaluationRequest
396
+
397
+ # Converts hash and nil to an options object
398
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
399
+
400
+ # Customize the options with defaults
401
+ call_metadata = @config.rpcs.get_evaluation.metadata.to_h
402
+
403
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
404
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
405
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
406
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
407
+ transports_version_send: [:rest]
408
+
409
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
410
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
411
+
412
+ options.apply_defaults timeout: @config.rpcs.get_evaluation.timeout,
413
+ metadata: call_metadata,
414
+ retry_policy: @config.rpcs.get_evaluation.retry_policy
415
+
416
+ options.apply_defaults timeout: @config.timeout,
417
+ metadata: @config.metadata,
418
+ retry_policy: @config.retry_policy
419
+
420
+ @workload_manager_stub.get_evaluation request, options do |result, operation|
421
+ yield result, operation if block_given?
422
+ end
423
+ rescue ::Gapic::Rest::Error => e
424
+ raise ::Google::Cloud::Error.from_error(e)
425
+ end
426
+
427
+ ##
428
+ # Creates a new Evaluation in a given project and location.
429
+ #
430
+ # @overload create_evaluation(request, options = nil)
431
+ # Pass arguments to `create_evaluation` via a request object, either of type
432
+ # {::Google::Cloud::WorkloadManager::V1::CreateEvaluationRequest} or an equivalent Hash.
433
+ #
434
+ # @param request [::Google::Cloud::WorkloadManager::V1::CreateEvaluationRequest, ::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 create_evaluation(parent: nil, evaluation_id: nil, evaluation: nil, request_id: nil)
441
+ # Pass arguments to `create_evaluation` 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 parent [::String]
446
+ # Required. The resource prefix of the evaluation location using the form:
447
+ # `projects/{project_id}/locations/{location_id}`.
448
+ # @param evaluation_id [::String]
449
+ # Required. Id of the requesting object.
450
+ # @param evaluation [::Google::Cloud::WorkloadManager::V1::Evaluation, ::Hash]
451
+ # Required. The resource being created.
452
+ # @param request_id [::String]
453
+ # Optional. An optional request ID to identify requests. Specify a unique
454
+ # request ID so that if you must retry your request, the server will know to
455
+ # ignore the request if it has already been completed. The server will
456
+ # guarantee that for at least 60 minutes since the first request.
457
+ #
458
+ # For example, consider a situation where you make an initial request and
459
+ # the request times out. If you make the request again with the same request
460
+ # ID, the server can check if original operation with the same request ID
461
+ # was received, and if so, will ignore the second request. This prevents
462
+ # clients from accidentally creating duplicate commitments.
463
+ #
464
+ # The request ID must be a valid UUID with the exception that zero UUID is
465
+ # not supported (00000000-0000-0000-0000-000000000000).
466
+ # @yield [result, operation] Access the result along with the TransportOperation object
467
+ # @yieldparam result [::Gapic::Operation]
468
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
469
+ #
470
+ # @return [::Gapic::Operation]
471
+ #
472
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
473
+ #
474
+ # @example Basic example
475
+ # require "google/cloud/workload_manager/v1"
476
+ #
477
+ # # Create a client object. The client can be reused for multiple calls.
478
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
479
+ #
480
+ # # Create a request. To set request fields, pass in keyword arguments.
481
+ # request = Google::Cloud::WorkloadManager::V1::CreateEvaluationRequest.new
482
+ #
483
+ # # Call the create_evaluation method.
484
+ # result = client.create_evaluation request
485
+ #
486
+ # # The returned object is of type Gapic::Operation. You can use it to
487
+ # # check the status of an operation, cancel it, or wait for results.
488
+ # # Here is how to wait for a response.
489
+ # result.wait_until_done! timeout: 60
490
+ # if result.response?
491
+ # p result.response
492
+ # else
493
+ # puts "No response received."
494
+ # end
495
+ #
496
+ def create_evaluation request, options = nil
497
+ raise ::ArgumentError, "request must be provided" if request.nil?
498
+
499
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::CreateEvaluationRequest
500
+
501
+ # Converts hash and nil to an options object
502
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
503
+
504
+ # Customize the options with defaults
505
+ call_metadata = @config.rpcs.create_evaluation.metadata.to_h
506
+
507
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
508
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
509
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
510
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
511
+ transports_version_send: [:rest]
512
+
513
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
514
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
515
+
516
+ options.apply_defaults timeout: @config.rpcs.create_evaluation.timeout,
517
+ metadata: call_metadata,
518
+ retry_policy: @config.rpcs.create_evaluation.retry_policy
519
+
520
+ options.apply_defaults timeout: @config.timeout,
521
+ metadata: @config.metadata,
522
+ retry_policy: @config.retry_policy
523
+
524
+ @workload_manager_stub.create_evaluation request, options do |result, operation|
525
+ result = ::Gapic::Operation.new result, @operations_client, options: options
526
+ yield result, operation if block_given?
527
+ throw :response, result
528
+ end
529
+ rescue ::Gapic::Rest::Error => e
530
+ raise ::Google::Cloud::Error.from_error(e)
531
+ end
532
+
533
+ ##
534
+ # Updates the parameters of a single Evaluation.
535
+ #
536
+ # @overload update_evaluation(request, options = nil)
537
+ # Pass arguments to `update_evaluation` via a request object, either of type
538
+ # {::Google::Cloud::WorkloadManager::V1::UpdateEvaluationRequest} or an equivalent Hash.
539
+ #
540
+ # @param request [::Google::Cloud::WorkloadManager::V1::UpdateEvaluationRequest, ::Hash]
541
+ # A request object representing the call parameters. Required. To specify no
542
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
543
+ # @param options [::Gapic::CallOptions, ::Hash]
544
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
545
+ #
546
+ # @overload update_evaluation(update_mask: nil, evaluation: nil, request_id: nil)
547
+ # Pass arguments to `update_evaluation` via keyword arguments. Note that at
548
+ # least one keyword argument is required. To specify no parameters, or to keep all
549
+ # the default parameter values, pass an empty Hash as a request object (see above).
550
+ #
551
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
552
+ # Required. Field mask is used to specify the fields to be overwritten in the
553
+ # Evaluation resource by the update.
554
+ # The fields specified in the update_mask are relative to the resource, not
555
+ # the full request. A field will be overwritten if it is in the mask.
556
+ # @param evaluation [::Google::Cloud::WorkloadManager::V1::Evaluation, ::Hash]
557
+ # Required. The resource being updated.
558
+ # @param request_id [::String]
559
+ # Optional. An optional request ID to identify requests. Specify a unique
560
+ # request ID so that if you must retry your request, the server will know to
561
+ # ignore the request if it has already been completed. The server will
562
+ # guarantee that for at least 60 minutes since the first request.
563
+ #
564
+ # For example, consider a situation where you make an initial request and
565
+ # the request times out. If you make the request again with the same request
566
+ # ID, the server can check if original operation with the same request ID
567
+ # was received, and if so, will ignore the second request. This prevents
568
+ # clients from accidentally creating duplicate commitments.
569
+ #
570
+ # The request ID must be a valid UUID with the exception that zero UUID is
571
+ # not supported (00000000-0000-0000-0000-000000000000).
572
+ # @yield [result, operation] Access the result along with the TransportOperation object
573
+ # @yieldparam result [::Gapic::Operation]
574
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
575
+ #
576
+ # @return [::Gapic::Operation]
577
+ #
578
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
579
+ #
580
+ # @example Basic example
581
+ # require "google/cloud/workload_manager/v1"
582
+ #
583
+ # # Create a client object. The client can be reused for multiple calls.
584
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
585
+ #
586
+ # # Create a request. To set request fields, pass in keyword arguments.
587
+ # request = Google::Cloud::WorkloadManager::V1::UpdateEvaluationRequest.new
588
+ #
589
+ # # Call the update_evaluation method.
590
+ # result = client.update_evaluation request
591
+ #
592
+ # # The returned object is of type Gapic::Operation. You can use it to
593
+ # # check the status of an operation, cancel it, or wait for results.
594
+ # # Here is how to wait for a response.
595
+ # result.wait_until_done! timeout: 60
596
+ # if result.response?
597
+ # p result.response
598
+ # else
599
+ # puts "No response received."
600
+ # end
601
+ #
602
+ def update_evaluation request, options = nil
603
+ raise ::ArgumentError, "request must be provided" if request.nil?
604
+
605
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::UpdateEvaluationRequest
606
+
607
+ # Converts hash and nil to an options object
608
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
609
+
610
+ # Customize the options with defaults
611
+ call_metadata = @config.rpcs.update_evaluation.metadata.to_h
612
+
613
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
614
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
615
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
616
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
617
+ transports_version_send: [:rest]
618
+
619
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
620
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
621
+
622
+ options.apply_defaults timeout: @config.rpcs.update_evaluation.timeout,
623
+ metadata: call_metadata,
624
+ retry_policy: @config.rpcs.update_evaluation.retry_policy
625
+
626
+ options.apply_defaults timeout: @config.timeout,
627
+ metadata: @config.metadata,
628
+ retry_policy: @config.retry_policy
629
+
630
+ @workload_manager_stub.update_evaluation request, options do |result, operation|
631
+ result = ::Gapic::Operation.new result, @operations_client, options: options
632
+ yield result, operation if block_given?
633
+ throw :response, result
634
+ end
635
+ rescue ::Gapic::Rest::Error => e
636
+ raise ::Google::Cloud::Error.from_error(e)
637
+ end
638
+
639
+ ##
640
+ # Deletes a single Evaluation.
641
+ #
642
+ # @overload delete_evaluation(request, options = nil)
643
+ # Pass arguments to `delete_evaluation` via a request object, either of type
644
+ # {::Google::Cloud::WorkloadManager::V1::DeleteEvaluationRequest} or an equivalent Hash.
645
+ #
646
+ # @param request [::Google::Cloud::WorkloadManager::V1::DeleteEvaluationRequest, ::Hash]
647
+ # A request object representing the call parameters. Required. To specify no
648
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
649
+ # @param options [::Gapic::CallOptions, ::Hash]
650
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
651
+ #
652
+ # @overload delete_evaluation(name: nil, request_id: nil, force: nil)
653
+ # Pass arguments to `delete_evaluation` via keyword arguments. Note that at
654
+ # least one keyword argument is required. To specify no parameters, or to keep all
655
+ # the default parameter values, pass an empty Hash as a request object (see above).
656
+ #
657
+ # @param name [::String]
658
+ # Required. Name of the resource.
659
+ # @param request_id [::String]
660
+ # Optional. An optional request ID to identify requests. Specify a unique
661
+ # request ID so that if you must retry your request, the server will know to
662
+ # ignore the request if it has already been completed. The server will
663
+ # guarantee that for at least 60 minutes after the first request.
664
+ #
665
+ # For example, consider a situation where you make an initial request and
666
+ # the request times out. If you make the request again with the same request
667
+ # ID, the server can check if original operation with the same request ID
668
+ # was received, and if so, will ignore the second request. This prevents
669
+ # clients from accidentally creating duplicate commitments.
670
+ #
671
+ # The request ID must be a valid UUID with the exception that zero UUID is
672
+ # not supported (00000000-0000-0000-0000-000000000000).
673
+ # @param force [::Boolean]
674
+ # Optional. Followed the best practice from
675
+ # https://aip.dev/135#cascading-delete.
676
+ # @yield [result, operation] Access the result along with the TransportOperation object
677
+ # @yieldparam result [::Gapic::Operation]
678
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
679
+ #
680
+ # @return [::Gapic::Operation]
681
+ #
682
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
683
+ #
684
+ # @example Basic example
685
+ # require "google/cloud/workload_manager/v1"
686
+ #
687
+ # # Create a client object. The client can be reused for multiple calls.
688
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
689
+ #
690
+ # # Create a request. To set request fields, pass in keyword arguments.
691
+ # request = Google::Cloud::WorkloadManager::V1::DeleteEvaluationRequest.new
692
+ #
693
+ # # Call the delete_evaluation method.
694
+ # result = client.delete_evaluation request
695
+ #
696
+ # # The returned object is of type Gapic::Operation. You can use it to
697
+ # # check the status of an operation, cancel it, or wait for results.
698
+ # # Here is how to wait for a response.
699
+ # result.wait_until_done! timeout: 60
700
+ # if result.response?
701
+ # p result.response
702
+ # else
703
+ # puts "No response received."
704
+ # end
705
+ #
706
+ def delete_evaluation request, options = nil
707
+ raise ::ArgumentError, "request must be provided" if request.nil?
708
+
709
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::DeleteEvaluationRequest
710
+
711
+ # Converts hash and nil to an options object
712
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
713
+
714
+ # Customize the options with defaults
715
+ call_metadata = @config.rpcs.delete_evaluation.metadata.to_h
716
+
717
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
718
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
719
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
720
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
721
+ transports_version_send: [:rest]
722
+
723
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
724
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
725
+
726
+ options.apply_defaults timeout: @config.rpcs.delete_evaluation.timeout,
727
+ metadata: call_metadata,
728
+ retry_policy: @config.rpcs.delete_evaluation.retry_policy
729
+
730
+ options.apply_defaults timeout: @config.timeout,
731
+ metadata: @config.metadata,
732
+ retry_policy: @config.retry_policy
733
+
734
+ @workload_manager_stub.delete_evaluation request, options do |result, operation|
735
+ result = ::Gapic::Operation.new result, @operations_client, options: options
736
+ yield result, operation if block_given?
737
+ throw :response, result
738
+ end
739
+ rescue ::Gapic::Rest::Error => e
740
+ raise ::Google::Cloud::Error.from_error(e)
741
+ end
742
+
743
+ ##
744
+ # Lists Executions in a given project and location.
745
+ #
746
+ # @overload list_executions(request, options = nil)
747
+ # Pass arguments to `list_executions` via a request object, either of type
748
+ # {::Google::Cloud::WorkloadManager::V1::ListExecutionsRequest} or an equivalent Hash.
749
+ #
750
+ # @param request [::Google::Cloud::WorkloadManager::V1::ListExecutionsRequest, ::Hash]
751
+ # A request object representing the call parameters. Required. To specify no
752
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
753
+ # @param options [::Gapic::CallOptions, ::Hash]
754
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
755
+ #
756
+ # @overload list_executions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
757
+ # Pass arguments to `list_executions` via keyword arguments. Note that at
758
+ # least one keyword argument is required. To specify no parameters, or to keep all
759
+ # the default parameter values, pass an empty Hash as a request object (see above).
760
+ #
761
+ # @param parent [::String]
762
+ # Required. The resource prefix of the Execution using the form:
763
+ # `projects/{project}/locations/{location}/evaluations/{evaluation}`.
764
+ # @param page_size [::Integer]
765
+ # Requested page size. Server may return fewer items than requested.
766
+ # If unspecified, server will pick an appropriate default.
767
+ # @param page_token [::String]
768
+ # A token identifying a page of results the server should return.
769
+ # @param filter [::String]
770
+ # Filtering results.
771
+ # @param order_by [::String]
772
+ # Field to sort by. See https://google.aip.dev/132#ordering for more details.
773
+ # @yield [result, operation] Access the result along with the TransportOperation object
774
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::Execution>]
775
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
776
+ #
777
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::Execution>]
778
+ #
779
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
780
+ #
781
+ # @example Basic example
782
+ # require "google/cloud/workload_manager/v1"
783
+ #
784
+ # # Create a client object. The client can be reused for multiple calls.
785
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
786
+ #
787
+ # # Create a request. To set request fields, pass in keyword arguments.
788
+ # request = Google::Cloud::WorkloadManager::V1::ListExecutionsRequest.new
789
+ #
790
+ # # Call the list_executions method.
791
+ # result = client.list_executions request
792
+ #
793
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
794
+ # # over elements, and API calls will be issued to fetch pages as needed.
795
+ # result.each do |item|
796
+ # # Each element is of type ::Google::Cloud::WorkloadManager::V1::Execution.
797
+ # p item
798
+ # end
799
+ #
800
+ def list_executions request, options = nil
801
+ raise ::ArgumentError, "request must be provided" if request.nil?
802
+
803
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::ListExecutionsRequest
804
+
805
+ # Converts hash and nil to an options object
806
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
807
+
808
+ # Customize the options with defaults
809
+ call_metadata = @config.rpcs.list_executions.metadata.to_h
810
+
811
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
812
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
813
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
814
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
815
+ transports_version_send: [:rest]
816
+
817
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
818
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
819
+
820
+ options.apply_defaults timeout: @config.rpcs.list_executions.timeout,
821
+ metadata: call_metadata,
822
+ retry_policy: @config.rpcs.list_executions.retry_policy
823
+
824
+ options.apply_defaults timeout: @config.timeout,
825
+ metadata: @config.metadata,
826
+ retry_policy: @config.retry_policy
827
+
828
+ @workload_manager_stub.list_executions request, options do |result, operation|
829
+ result = ::Gapic::Rest::PagedEnumerable.new @workload_manager_stub, :list_executions, "executions", request, result, options
830
+ yield result, operation if block_given?
831
+ throw :response, result
832
+ end
833
+ rescue ::Gapic::Rest::Error => e
834
+ raise ::Google::Cloud::Error.from_error(e)
835
+ end
836
+
837
+ ##
838
+ # Gets details of a single Execution.
839
+ #
840
+ # @overload get_execution(request, options = nil)
841
+ # Pass arguments to `get_execution` via a request object, either of type
842
+ # {::Google::Cloud::WorkloadManager::V1::GetExecutionRequest} or an equivalent Hash.
843
+ #
844
+ # @param request [::Google::Cloud::WorkloadManager::V1::GetExecutionRequest, ::Hash]
845
+ # A request object representing the call parameters. Required. To specify no
846
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
847
+ # @param options [::Gapic::CallOptions, ::Hash]
848
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
849
+ #
850
+ # @overload get_execution(name: nil)
851
+ # Pass arguments to `get_execution` via keyword arguments. Note that at
852
+ # least one keyword argument is required. To specify no parameters, or to keep all
853
+ # the default parameter values, pass an empty Hash as a request object (see above).
854
+ #
855
+ # @param name [::String]
856
+ # Required. Name of the resource.
857
+ # @yield [result, operation] Access the result along with the TransportOperation object
858
+ # @yieldparam result [::Google::Cloud::WorkloadManager::V1::Execution]
859
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
860
+ #
861
+ # @return [::Google::Cloud::WorkloadManager::V1::Execution]
862
+ #
863
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
864
+ #
865
+ # @example Basic example
866
+ # require "google/cloud/workload_manager/v1"
867
+ #
868
+ # # Create a client object. The client can be reused for multiple calls.
869
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
870
+ #
871
+ # # Create a request. To set request fields, pass in keyword arguments.
872
+ # request = Google::Cloud::WorkloadManager::V1::GetExecutionRequest.new
873
+ #
874
+ # # Call the get_execution method.
875
+ # result = client.get_execution request
876
+ #
877
+ # # The returned object is of type Google::Cloud::WorkloadManager::V1::Execution.
878
+ # p result
879
+ #
880
+ def get_execution request, options = nil
881
+ raise ::ArgumentError, "request must be provided" if request.nil?
882
+
883
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::GetExecutionRequest
884
+
885
+ # Converts hash and nil to an options object
886
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
887
+
888
+ # Customize the options with defaults
889
+ call_metadata = @config.rpcs.get_execution.metadata.to_h
890
+
891
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
892
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
893
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
894
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
895
+ transports_version_send: [:rest]
896
+
897
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
898
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
899
+
900
+ options.apply_defaults timeout: @config.rpcs.get_execution.timeout,
901
+ metadata: call_metadata,
902
+ retry_policy: @config.rpcs.get_execution.retry_policy
903
+
904
+ options.apply_defaults timeout: @config.timeout,
905
+ metadata: @config.metadata,
906
+ retry_policy: @config.retry_policy
907
+
908
+ @workload_manager_stub.get_execution request, options do |result, operation|
909
+ yield result, operation if block_given?
910
+ end
911
+ rescue ::Gapic::Rest::Error => e
912
+ raise ::Google::Cloud::Error.from_error(e)
913
+ end
914
+
915
+ ##
916
+ # Creates a new Execution in a given project and location.
917
+ #
918
+ # @overload run_evaluation(request, options = nil)
919
+ # Pass arguments to `run_evaluation` via a request object, either of type
920
+ # {::Google::Cloud::WorkloadManager::V1::RunEvaluationRequest} or an equivalent Hash.
921
+ #
922
+ # @param request [::Google::Cloud::WorkloadManager::V1::RunEvaluationRequest, ::Hash]
923
+ # A request object representing the call parameters. Required. To specify no
924
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
925
+ # @param options [::Gapic::CallOptions, ::Hash]
926
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
927
+ #
928
+ # @overload run_evaluation(name: nil, execution_id: nil, execution: nil, request_id: nil)
929
+ # Pass arguments to `run_evaluation` via keyword arguments. Note that at
930
+ # least one keyword argument is required. To specify no parameters, or to keep all
931
+ # the default parameter values, pass an empty Hash as a request object (see above).
932
+ #
933
+ # @param name [::String]
934
+ # Required. The resource name of the Evaluation using the form:
935
+ # `projects/{project}/locations/{location}/evaluations/{evaluation}`.
936
+ # @param execution_id [::String]
937
+ # Required. ID of the execution which will be created.
938
+ # @param execution [::Google::Cloud::WorkloadManager::V1::Execution, ::Hash]
939
+ # Required. The resource being created.
940
+ # @param request_id [::String]
941
+ # Optional. An optional request ID to identify requests. Specify a unique
942
+ # request ID so that if you must retry your request, the server will know to
943
+ # ignore the request if it has already been completed. The server will
944
+ # guarantee that for at least 60 minutes since the first request.
945
+ #
946
+ # For example, consider a situation where you make an initial request and
947
+ # the request times out. If you make the request again with the same request
948
+ # ID, the server can check if original operation with the same request ID
949
+ # was received, and if so, will ignore the second request. This prevents
950
+ # clients from accidentally creating duplicate commitments.
951
+ #
952
+ # The request ID must be a valid UUID with the exception that zero UUID is
953
+ # not supported (00000000-0000-0000-0000-000000000000).
954
+ # @yield [result, operation] Access the result along with the TransportOperation object
955
+ # @yieldparam result [::Gapic::Operation]
956
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
957
+ #
958
+ # @return [::Gapic::Operation]
959
+ #
960
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
961
+ #
962
+ # @example Basic example
963
+ # require "google/cloud/workload_manager/v1"
964
+ #
965
+ # # Create a client object. The client can be reused for multiple calls.
966
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
967
+ #
968
+ # # Create a request. To set request fields, pass in keyword arguments.
969
+ # request = Google::Cloud::WorkloadManager::V1::RunEvaluationRequest.new
970
+ #
971
+ # # Call the run_evaluation method.
972
+ # result = client.run_evaluation request
973
+ #
974
+ # # The returned object is of type Gapic::Operation. You can use it to
975
+ # # check the status of an operation, cancel it, or wait for results.
976
+ # # Here is how to wait for a response.
977
+ # result.wait_until_done! timeout: 60
978
+ # if result.response?
979
+ # p result.response
980
+ # else
981
+ # puts "No response received."
982
+ # end
983
+ #
984
+ def run_evaluation request, options = nil
985
+ raise ::ArgumentError, "request must be provided" if request.nil?
986
+
987
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::RunEvaluationRequest
988
+
989
+ # Converts hash and nil to an options object
990
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
991
+
992
+ # Customize the options with defaults
993
+ call_metadata = @config.rpcs.run_evaluation.metadata.to_h
994
+
995
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
996
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
997
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
998
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
999
+ transports_version_send: [:rest]
1000
+
1001
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1002
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1003
+
1004
+ options.apply_defaults timeout: @config.rpcs.run_evaluation.timeout,
1005
+ metadata: call_metadata,
1006
+ retry_policy: @config.rpcs.run_evaluation.retry_policy
1007
+
1008
+ options.apply_defaults timeout: @config.timeout,
1009
+ metadata: @config.metadata,
1010
+ retry_policy: @config.retry_policy
1011
+
1012
+ @workload_manager_stub.run_evaluation request, options do |result, operation|
1013
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1014
+ yield result, operation if block_given?
1015
+ throw :response, result
1016
+ end
1017
+ rescue ::Gapic::Rest::Error => e
1018
+ raise ::Google::Cloud::Error.from_error(e)
1019
+ end
1020
+
1021
+ ##
1022
+ # Deletes a single Execution.
1023
+ #
1024
+ # @overload delete_execution(request, options = nil)
1025
+ # Pass arguments to `delete_execution` via a request object, either of type
1026
+ # {::Google::Cloud::WorkloadManager::V1::DeleteExecutionRequest} or an equivalent Hash.
1027
+ #
1028
+ # @param request [::Google::Cloud::WorkloadManager::V1::DeleteExecutionRequest, ::Hash]
1029
+ # A request object representing the call parameters. Required. To specify no
1030
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1031
+ # @param options [::Gapic::CallOptions, ::Hash]
1032
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1033
+ #
1034
+ # @overload delete_execution(name: nil, request_id: nil)
1035
+ # Pass arguments to `delete_execution` via keyword arguments. Note that at
1036
+ # least one keyword argument is required. To specify no parameters, or to keep all
1037
+ # the default parameter values, pass an empty Hash as a request object (see above).
1038
+ #
1039
+ # @param name [::String]
1040
+ # Required. Name of the resource.
1041
+ # @param request_id [::String]
1042
+ # Optional. An optional request ID to identify requests. Specify a unique
1043
+ # request ID so that if you must retry your request, the server will know to
1044
+ # ignore the request if it has already been completed. The server will
1045
+ # guarantee that for at least 60 minutes after the first request.
1046
+ #
1047
+ # For example, consider a situation where you make an initial request and
1048
+ # the request times out. If you make the request again with the same request
1049
+ # ID, the server can check if original operation with the same request ID
1050
+ # was received, and if so, will ignore the second request. This prevents
1051
+ # clients from accidentally creating duplicate commitments.
1052
+ #
1053
+ # The request ID must be a valid UUID with the exception that zero UUID is
1054
+ # not supported (00000000-0000-0000-0000-000000000000).
1055
+ # @yield [result, operation] Access the result along with the TransportOperation object
1056
+ # @yieldparam result [::Gapic::Operation]
1057
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1058
+ #
1059
+ # @return [::Gapic::Operation]
1060
+ #
1061
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1062
+ #
1063
+ # @example Basic example
1064
+ # require "google/cloud/workload_manager/v1"
1065
+ #
1066
+ # # Create a client object. The client can be reused for multiple calls.
1067
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
1068
+ #
1069
+ # # Create a request. To set request fields, pass in keyword arguments.
1070
+ # request = Google::Cloud::WorkloadManager::V1::DeleteExecutionRequest.new
1071
+ #
1072
+ # # Call the delete_execution method.
1073
+ # result = client.delete_execution request
1074
+ #
1075
+ # # The returned object is of type Gapic::Operation. You can use it to
1076
+ # # check the status of an operation, cancel it, or wait for results.
1077
+ # # Here is how to wait for a response.
1078
+ # result.wait_until_done! timeout: 60
1079
+ # if result.response?
1080
+ # p result.response
1081
+ # else
1082
+ # puts "No response received."
1083
+ # end
1084
+ #
1085
+ def delete_execution request, options = nil
1086
+ raise ::ArgumentError, "request must be provided" if request.nil?
1087
+
1088
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::DeleteExecutionRequest
1089
+
1090
+ # Converts hash and nil to an options object
1091
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1092
+
1093
+ # Customize the options with defaults
1094
+ call_metadata = @config.rpcs.delete_execution.metadata.to_h
1095
+
1096
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1097
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1098
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1099
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
1100
+ transports_version_send: [:rest]
1101
+
1102
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1103
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1104
+
1105
+ options.apply_defaults timeout: @config.rpcs.delete_execution.timeout,
1106
+ metadata: call_metadata,
1107
+ retry_policy: @config.rpcs.delete_execution.retry_policy
1108
+
1109
+ options.apply_defaults timeout: @config.timeout,
1110
+ metadata: @config.metadata,
1111
+ retry_policy: @config.retry_policy
1112
+
1113
+ @workload_manager_stub.delete_execution request, options do |result, operation|
1114
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1115
+ yield result, operation if block_given?
1116
+ throw :response, result
1117
+ end
1118
+ rescue ::Gapic::Rest::Error => e
1119
+ raise ::Google::Cloud::Error.from_error(e)
1120
+ end
1121
+
1122
+ ##
1123
+ # Lists the result of a single evaluation.
1124
+ #
1125
+ # @overload list_execution_results(request, options = nil)
1126
+ # Pass arguments to `list_execution_results` via a request object, either of type
1127
+ # {::Google::Cloud::WorkloadManager::V1::ListExecutionResultsRequest} or an equivalent Hash.
1128
+ #
1129
+ # @param request [::Google::Cloud::WorkloadManager::V1::ListExecutionResultsRequest, ::Hash]
1130
+ # A request object representing the call parameters. Required. To specify no
1131
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1132
+ # @param options [::Gapic::CallOptions, ::Hash]
1133
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1134
+ #
1135
+ # @overload list_execution_results(parent: nil, page_size: nil, page_token: nil, filter: nil)
1136
+ # Pass arguments to `list_execution_results` via keyword arguments. Note that at
1137
+ # least one keyword argument is required. To specify no parameters, or to keep all
1138
+ # the default parameter values, pass an empty Hash as a request object (see above).
1139
+ #
1140
+ # @param parent [::String]
1141
+ # Required. The execution results.
1142
+ # Format: \\{parent}/evaluations/*/executions/*/results.
1143
+ # @param page_size [::Integer]
1144
+ # Requested page size. Server may return fewer items than requested.
1145
+ # If unspecified, server will pick an appropriate default.
1146
+ # @param page_token [::String]
1147
+ # A token identifying a page of results the server should return.
1148
+ # @param filter [::String]
1149
+ # Filtering results.
1150
+ # @yield [result, operation] Access the result along with the TransportOperation object
1151
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::ExecutionResult>]
1152
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1153
+ #
1154
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::ExecutionResult>]
1155
+ #
1156
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1157
+ #
1158
+ # @example Basic example
1159
+ # require "google/cloud/workload_manager/v1"
1160
+ #
1161
+ # # Create a client object. The client can be reused for multiple calls.
1162
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
1163
+ #
1164
+ # # Create a request. To set request fields, pass in keyword arguments.
1165
+ # request = Google::Cloud::WorkloadManager::V1::ListExecutionResultsRequest.new
1166
+ #
1167
+ # # Call the list_execution_results method.
1168
+ # result = client.list_execution_results request
1169
+ #
1170
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1171
+ # # over elements, and API calls will be issued to fetch pages as needed.
1172
+ # result.each do |item|
1173
+ # # Each element is of type ::Google::Cloud::WorkloadManager::V1::ExecutionResult.
1174
+ # p item
1175
+ # end
1176
+ #
1177
+ def list_execution_results request, options = nil
1178
+ raise ::ArgumentError, "request must be provided" if request.nil?
1179
+
1180
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::ListExecutionResultsRequest
1181
+
1182
+ # Converts hash and nil to an options object
1183
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1184
+
1185
+ # Customize the options with defaults
1186
+ call_metadata = @config.rpcs.list_execution_results.metadata.to_h
1187
+
1188
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1189
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1190
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1191
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
1192
+ transports_version_send: [:rest]
1193
+
1194
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1195
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1196
+
1197
+ options.apply_defaults timeout: @config.rpcs.list_execution_results.timeout,
1198
+ metadata: call_metadata,
1199
+ retry_policy: @config.rpcs.list_execution_results.retry_policy
1200
+
1201
+ options.apply_defaults timeout: @config.timeout,
1202
+ metadata: @config.metadata,
1203
+ retry_policy: @config.retry_policy
1204
+
1205
+ @workload_manager_stub.list_execution_results request, options do |result, operation|
1206
+ result = ::Gapic::Rest::PagedEnumerable.new @workload_manager_stub, :list_execution_results, "execution_results", request, result, options
1207
+ yield result, operation if block_given?
1208
+ throw :response, result
1209
+ end
1210
+ rescue ::Gapic::Rest::Error => e
1211
+ raise ::Google::Cloud::Error.from_error(e)
1212
+ end
1213
+
1214
+ ##
1215
+ # Lists rules in a given project.
1216
+ #
1217
+ # @overload list_rules(request, options = nil)
1218
+ # Pass arguments to `list_rules` via a request object, either of type
1219
+ # {::Google::Cloud::WorkloadManager::V1::ListRulesRequest} or an equivalent Hash.
1220
+ #
1221
+ # @param request [::Google::Cloud::WorkloadManager::V1::ListRulesRequest, ::Hash]
1222
+ # A request object representing the call parameters. Required. To specify no
1223
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1224
+ # @param options [::Gapic::CallOptions, ::Hash]
1225
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1226
+ #
1227
+ # @overload list_rules(parent: nil, page_size: nil, page_token: nil, filter: nil, custom_rules_bucket: nil, evaluation_type: nil)
1228
+ # Pass arguments to `list_rules` via keyword arguments. Note that at
1229
+ # least one keyword argument is required. To specify no parameters, or to keep all
1230
+ # the default parameter values, pass an empty Hash as a request object (see above).
1231
+ #
1232
+ # @param parent [::String]
1233
+ # Required. The [project] on which to execute the request. The format is:
1234
+ # projects/\\{project_id}/locations/\\{location}
1235
+ # Currently, the pre-defined rules are global available to all projects and
1236
+ # all regions.
1237
+ # @param page_size [::Integer]
1238
+ # Requested page size. Server may return fewer items than requested.
1239
+ # If unspecified, server will pick an appropriate default.
1240
+ # @param page_token [::String]
1241
+ # A token identifying a page of results the server should return.
1242
+ # @param filter [::String]
1243
+ # Filter based on primary_category, secondary_category.
1244
+ # @param custom_rules_bucket [::String]
1245
+ # The Cloud Storage bucket name for custom rules.
1246
+ # @param evaluation_type [::Google::Cloud::WorkloadManager::V1::Evaluation::EvaluationType]
1247
+ # Optional. The evaluation type of the rules will be applied to.
1248
+ # The Cloud Storage bucket name for custom rules.
1249
+ # @yield [result, operation] Access the result along with the TransportOperation object
1250
+ # @yieldparam result [::Google::Cloud::WorkloadManager::V1::ListRulesResponse]
1251
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1252
+ #
1253
+ # @return [::Google::Cloud::WorkloadManager::V1::ListRulesResponse]
1254
+ #
1255
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1256
+ #
1257
+ # @example Basic example
1258
+ # require "google/cloud/workload_manager/v1"
1259
+ #
1260
+ # # Create a client object. The client can be reused for multiple calls.
1261
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
1262
+ #
1263
+ # # Create a request. To set request fields, pass in keyword arguments.
1264
+ # request = Google::Cloud::WorkloadManager::V1::ListRulesRequest.new
1265
+ #
1266
+ # # Call the list_rules method.
1267
+ # result = client.list_rules request
1268
+ #
1269
+ # # The returned object is of type Google::Cloud::WorkloadManager::V1::ListRulesResponse.
1270
+ # p result
1271
+ #
1272
+ def list_rules request, options = nil
1273
+ raise ::ArgumentError, "request must be provided" if request.nil?
1274
+
1275
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::ListRulesRequest
1276
+
1277
+ # Converts hash and nil to an options object
1278
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1279
+
1280
+ # Customize the options with defaults
1281
+ call_metadata = @config.rpcs.list_rules.metadata.to_h
1282
+
1283
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1284
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1285
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1286
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
1287
+ transports_version_send: [:rest]
1288
+
1289
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1290
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1291
+
1292
+ options.apply_defaults timeout: @config.rpcs.list_rules.timeout,
1293
+ metadata: call_metadata,
1294
+ retry_policy: @config.rpcs.list_rules.retry_policy
1295
+
1296
+ options.apply_defaults timeout: @config.timeout,
1297
+ metadata: @config.metadata,
1298
+ retry_policy: @config.retry_policy
1299
+
1300
+ @workload_manager_stub.list_rules request, options do |result, operation|
1301
+ yield result, operation if block_given?
1302
+ end
1303
+ rescue ::Gapic::Rest::Error => e
1304
+ raise ::Google::Cloud::Error.from_error(e)
1305
+ end
1306
+
1307
+ ##
1308
+ # List all scanned resources for a single Execution.
1309
+ #
1310
+ # @overload list_scanned_resources(request, options = nil)
1311
+ # Pass arguments to `list_scanned_resources` via a request object, either of type
1312
+ # {::Google::Cloud::WorkloadManager::V1::ListScannedResourcesRequest} or an equivalent Hash.
1313
+ #
1314
+ # @param request [::Google::Cloud::WorkloadManager::V1::ListScannedResourcesRequest, ::Hash]
1315
+ # A request object representing the call parameters. Required. To specify no
1316
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1317
+ # @param options [::Gapic::CallOptions, ::Hash]
1318
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1319
+ #
1320
+ # @overload list_scanned_resources(parent: nil, rule: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1321
+ # Pass arguments to `list_scanned_resources` via keyword arguments. Note that at
1322
+ # least one keyword argument is required. To specify no parameters, or to keep all
1323
+ # the default parameter values, pass an empty Hash as a request object (see above).
1324
+ #
1325
+ # @param parent [::String]
1326
+ # Required. Parent for ListScannedResourcesRequest.
1327
+ # @param rule [::String]
1328
+ # Rule name.
1329
+ # @param page_size [::Integer]
1330
+ # Requested page size. Server may return fewer items than requested.
1331
+ # If unspecified, server will pick an appropriate default.
1332
+ # @param page_token [::String]
1333
+ # A token identifying a page of results the server should return.
1334
+ # @param filter [::String]
1335
+ # Filtering results.
1336
+ # @param order_by [::String]
1337
+ # Field to sort by. See https://google.aip.dev/132#ordering for more details.
1338
+ # @yield [result, operation] Access the result along with the TransportOperation object
1339
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::ScannedResource>]
1340
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1341
+ #
1342
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WorkloadManager::V1::ScannedResource>]
1343
+ #
1344
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1345
+ #
1346
+ # @example Basic example
1347
+ # require "google/cloud/workload_manager/v1"
1348
+ #
1349
+ # # Create a client object. The client can be reused for multiple calls.
1350
+ # client = Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new
1351
+ #
1352
+ # # Create a request. To set request fields, pass in keyword arguments.
1353
+ # request = Google::Cloud::WorkloadManager::V1::ListScannedResourcesRequest.new
1354
+ #
1355
+ # # Call the list_scanned_resources method.
1356
+ # result = client.list_scanned_resources request
1357
+ #
1358
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1359
+ # # over elements, and API calls will be issued to fetch pages as needed.
1360
+ # result.each do |item|
1361
+ # # Each element is of type ::Google::Cloud::WorkloadManager::V1::ScannedResource.
1362
+ # p item
1363
+ # end
1364
+ #
1365
+ def list_scanned_resources request, options = nil
1366
+ raise ::ArgumentError, "request must be provided" if request.nil?
1367
+
1368
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WorkloadManager::V1::ListScannedResourcesRequest
1369
+
1370
+ # Converts hash and nil to an options object
1371
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1372
+
1373
+ # Customize the options with defaults
1374
+ call_metadata = @config.rpcs.list_scanned_resources.metadata.to_h
1375
+
1376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1377
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1378
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1379
+ gapic_version: ::Google::Cloud::WorkloadManager::V1::VERSION,
1380
+ transports_version_send: [:rest]
1381
+
1382
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1383
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1384
+
1385
+ options.apply_defaults timeout: @config.rpcs.list_scanned_resources.timeout,
1386
+ metadata: call_metadata,
1387
+ retry_policy: @config.rpcs.list_scanned_resources.retry_policy
1388
+
1389
+ options.apply_defaults timeout: @config.timeout,
1390
+ metadata: @config.metadata,
1391
+ retry_policy: @config.retry_policy
1392
+
1393
+ @workload_manager_stub.list_scanned_resources request, options do |result, operation|
1394
+ result = ::Gapic::Rest::PagedEnumerable.new @workload_manager_stub, :list_scanned_resources, "scanned_resources", request, result, options
1395
+ yield result, operation if block_given?
1396
+ throw :response, result
1397
+ end
1398
+ rescue ::Gapic::Rest::Error => e
1399
+ raise ::Google::Cloud::Error.from_error(e)
1400
+ end
1401
+
1402
+ ##
1403
+ # Configuration class for the WorkloadManager REST API.
1404
+ #
1405
+ # This class represents the configuration for WorkloadManager REST,
1406
+ # providing control over timeouts, retry behavior, logging, transport
1407
+ # parameters, and other low-level controls. Certain parameters can also be
1408
+ # applied individually to specific RPCs. See
1409
+ # {::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client::Configuration::Rpcs}
1410
+ # for a list of RPCs that can be configured independently.
1411
+ #
1412
+ # Configuration can be applied globally to all clients, or to a single client
1413
+ # on construction.
1414
+ #
1415
+ # @example
1416
+ #
1417
+ # # Modify the global config, setting the timeout for
1418
+ # # list_evaluations to 20 seconds,
1419
+ # # and all remaining timeouts to 10 seconds.
1420
+ # ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.configure do |config|
1421
+ # config.timeout = 10.0
1422
+ # config.rpcs.list_evaluations.timeout = 20.0
1423
+ # end
1424
+ #
1425
+ # # Apply the above configuration only to a new client.
1426
+ # client = ::Google::Cloud::WorkloadManager::V1::WorkloadManager::Rest::Client.new do |config|
1427
+ # config.timeout = 10.0
1428
+ # config.rpcs.list_evaluations.timeout = 20.0
1429
+ # end
1430
+ #
1431
+ # @!attribute [rw] endpoint
1432
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1433
+ # nil, indicating to use the default endpoint in the current universe domain.
1434
+ # @return [::String,nil]
1435
+ # @!attribute [rw] credentials
1436
+ # Credentials to send with calls. You may provide any of the following types:
1437
+ # * (`String`) The path to a service account key file in JSON format
1438
+ # * (`Hash`) A service account key as a Hash
1439
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1440
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1441
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1442
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1443
+ # * (`nil`) indicating no credentials
1444
+ #
1445
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1446
+ # external source for authentication to Google Cloud, you must validate it before
1447
+ # providing it to a Google API client library. Providing an unvalidated credential
1448
+ # configuration to Google APIs can compromise the security of your systems and data.
1449
+ # For more information, refer to [Validate credential configurations from external
1450
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1451
+ # @return [::Object]
1452
+ # @!attribute [rw] scope
1453
+ # The OAuth scopes
1454
+ # @return [::Array<::String>]
1455
+ # @!attribute [rw] lib_name
1456
+ # The library name as recorded in instrumentation and logging
1457
+ # @return [::String]
1458
+ # @!attribute [rw] lib_version
1459
+ # The library version as recorded in instrumentation and logging
1460
+ # @return [::String]
1461
+ # @!attribute [rw] timeout
1462
+ # The call timeout in seconds.
1463
+ # @return [::Numeric]
1464
+ # @!attribute [rw] metadata
1465
+ # Additional headers to be sent with the call.
1466
+ # @return [::Hash{::Symbol=>::String}]
1467
+ # @!attribute [rw] retry_policy
1468
+ # The retry policy. The value is a hash with the following keys:
1469
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1470
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1471
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1472
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1473
+ # trigger a retry.
1474
+ # @return [::Hash]
1475
+ # @!attribute [rw] quota_project
1476
+ # A separate project against which to charge quota.
1477
+ # @return [::String]
1478
+ # @!attribute [rw] universe_domain
1479
+ # The universe domain within which to make requests. This determines the
1480
+ # default endpoint URL. The default value of nil uses the environment
1481
+ # universe (usually the default "googleapis.com" universe).
1482
+ # @return [::String,nil]
1483
+ # @!attribute [rw] logger
1484
+ # A custom logger to use for request/response debug logging, or the value
1485
+ # `:default` (the default) to construct a default logger, or `nil` to
1486
+ # explicitly disable logging.
1487
+ # @return [::Logger,:default,nil]
1488
+ #
1489
+ class Configuration
1490
+ extend ::Gapic::Config
1491
+
1492
+ # @private
1493
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1494
+ DEFAULT_ENDPOINT = "workloadmanager.googleapis.com"
1495
+
1496
+ config_attr :endpoint, nil, ::String, nil
1497
+ config_attr :credentials, nil do |value|
1498
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1499
+ allowed.any? { |klass| klass === value }
1500
+ end
1501
+ config_attr :scope, nil, ::String, ::Array, nil
1502
+ config_attr :lib_name, nil, ::String, nil
1503
+ config_attr :lib_version, nil, ::String, nil
1504
+ config_attr :timeout, nil, ::Numeric, nil
1505
+ config_attr :metadata, nil, ::Hash, nil
1506
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1507
+ config_attr :quota_project, nil, ::String, nil
1508
+ config_attr :universe_domain, nil, ::String, nil
1509
+
1510
+ # @private
1511
+ # Overrides for http bindings for the RPCs of this service
1512
+ # are only used when this service is used as mixin, and only
1513
+ # by the host service.
1514
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1515
+ config_attr :bindings_override, {}, ::Hash, nil
1516
+ config_attr :logger, :default, ::Logger, nil, :default
1517
+
1518
+ # @private
1519
+ def initialize parent_config = nil
1520
+ @parent_config = parent_config unless parent_config.nil?
1521
+
1522
+ yield self if block_given?
1523
+ end
1524
+
1525
+ ##
1526
+ # Configurations for individual RPCs
1527
+ # @return [Rpcs]
1528
+ #
1529
+ def rpcs
1530
+ @rpcs ||= begin
1531
+ parent_rpcs = nil
1532
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1533
+ Rpcs.new parent_rpcs
1534
+ end
1535
+ end
1536
+
1537
+ ##
1538
+ # Configuration RPC class for the WorkloadManager API.
1539
+ #
1540
+ # Includes fields providing the configuration for each RPC in this service.
1541
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1542
+ # the following configuration fields:
1543
+ #
1544
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1545
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1546
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1547
+ # include the following keys:
1548
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1549
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1550
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1551
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1552
+ # trigger a retry.
1553
+ #
1554
+ class Rpcs
1555
+ ##
1556
+ # RPC-specific configuration for `list_evaluations`
1557
+ # @return [::Gapic::Config::Method]
1558
+ #
1559
+ attr_reader :list_evaluations
1560
+ ##
1561
+ # RPC-specific configuration for `get_evaluation`
1562
+ # @return [::Gapic::Config::Method]
1563
+ #
1564
+ attr_reader :get_evaluation
1565
+ ##
1566
+ # RPC-specific configuration for `create_evaluation`
1567
+ # @return [::Gapic::Config::Method]
1568
+ #
1569
+ attr_reader :create_evaluation
1570
+ ##
1571
+ # RPC-specific configuration for `update_evaluation`
1572
+ # @return [::Gapic::Config::Method]
1573
+ #
1574
+ attr_reader :update_evaluation
1575
+ ##
1576
+ # RPC-specific configuration for `delete_evaluation`
1577
+ # @return [::Gapic::Config::Method]
1578
+ #
1579
+ attr_reader :delete_evaluation
1580
+ ##
1581
+ # RPC-specific configuration for `list_executions`
1582
+ # @return [::Gapic::Config::Method]
1583
+ #
1584
+ attr_reader :list_executions
1585
+ ##
1586
+ # RPC-specific configuration for `get_execution`
1587
+ # @return [::Gapic::Config::Method]
1588
+ #
1589
+ attr_reader :get_execution
1590
+ ##
1591
+ # RPC-specific configuration for `run_evaluation`
1592
+ # @return [::Gapic::Config::Method]
1593
+ #
1594
+ attr_reader :run_evaluation
1595
+ ##
1596
+ # RPC-specific configuration for `delete_execution`
1597
+ # @return [::Gapic::Config::Method]
1598
+ #
1599
+ attr_reader :delete_execution
1600
+ ##
1601
+ # RPC-specific configuration for `list_execution_results`
1602
+ # @return [::Gapic::Config::Method]
1603
+ #
1604
+ attr_reader :list_execution_results
1605
+ ##
1606
+ # RPC-specific configuration for `list_rules`
1607
+ # @return [::Gapic::Config::Method]
1608
+ #
1609
+ attr_reader :list_rules
1610
+ ##
1611
+ # RPC-specific configuration for `list_scanned_resources`
1612
+ # @return [::Gapic::Config::Method]
1613
+ #
1614
+ attr_reader :list_scanned_resources
1615
+
1616
+ # @private
1617
+ def initialize parent_rpcs = nil
1618
+ list_evaluations_config = parent_rpcs.list_evaluations if parent_rpcs.respond_to? :list_evaluations
1619
+ @list_evaluations = ::Gapic::Config::Method.new list_evaluations_config
1620
+ get_evaluation_config = parent_rpcs.get_evaluation if parent_rpcs.respond_to? :get_evaluation
1621
+ @get_evaluation = ::Gapic::Config::Method.new get_evaluation_config
1622
+ create_evaluation_config = parent_rpcs.create_evaluation if parent_rpcs.respond_to? :create_evaluation
1623
+ @create_evaluation = ::Gapic::Config::Method.new create_evaluation_config
1624
+ update_evaluation_config = parent_rpcs.update_evaluation if parent_rpcs.respond_to? :update_evaluation
1625
+ @update_evaluation = ::Gapic::Config::Method.new update_evaluation_config
1626
+ delete_evaluation_config = parent_rpcs.delete_evaluation if parent_rpcs.respond_to? :delete_evaluation
1627
+ @delete_evaluation = ::Gapic::Config::Method.new delete_evaluation_config
1628
+ list_executions_config = parent_rpcs.list_executions if parent_rpcs.respond_to? :list_executions
1629
+ @list_executions = ::Gapic::Config::Method.new list_executions_config
1630
+ get_execution_config = parent_rpcs.get_execution if parent_rpcs.respond_to? :get_execution
1631
+ @get_execution = ::Gapic::Config::Method.new get_execution_config
1632
+ run_evaluation_config = parent_rpcs.run_evaluation if parent_rpcs.respond_to? :run_evaluation
1633
+ @run_evaluation = ::Gapic::Config::Method.new run_evaluation_config
1634
+ delete_execution_config = parent_rpcs.delete_execution if parent_rpcs.respond_to? :delete_execution
1635
+ @delete_execution = ::Gapic::Config::Method.new delete_execution_config
1636
+ list_execution_results_config = parent_rpcs.list_execution_results if parent_rpcs.respond_to? :list_execution_results
1637
+ @list_execution_results = ::Gapic::Config::Method.new list_execution_results_config
1638
+ list_rules_config = parent_rpcs.list_rules if parent_rpcs.respond_to? :list_rules
1639
+ @list_rules = ::Gapic::Config::Method.new list_rules_config
1640
+ list_scanned_resources_config = parent_rpcs.list_scanned_resources if parent_rpcs.respond_to? :list_scanned_resources
1641
+ @list_scanned_resources = ::Gapic::Config::Method.new list_scanned_resources_config
1642
+
1643
+ yield self if block_given?
1644
+ end
1645
+ end
1646
+ end
1647
+ end
1648
+ end
1649
+ end
1650
+ end
1651
+ end
1652
+ end
1653
+ end