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