google-cloud-assured_workloads-v1beta1 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1a7f16f11752933c4bf50751f4515f9a98f78870822e14d8e9ceacec71a8b8b
4
- data.tar.gz: 0dc49f9f11791399c08584be899504afec018b6d294039ce9260a47af8222fd8
3
+ metadata.gz: 420619ba63e75c57346b0d5c7df5248730eefaa435e2decbad5d8a0c7f79f0ef
4
+ data.tar.gz: 6404ae2320dc116bc51b0dc4a951c898277a8307a28feae0f7402d4fedae4474
5
5
  SHA512:
6
- metadata.gz: 3c500164e781fdc222a05b4f4d0fb01862cb134d206dcde2e5b9f484525d89eef0ae4ff72d16d4ffa2f8e1ea133d7e8e252e2ffcf40bfc2dd44e814db1ca9728
7
- data.tar.gz: 40f7f58f897631e35facdb45e746a341a99a17fc743e5ea8f78f149d851e053d1140d39f9b6a2a3d137698aef967c7659537255ba3c3940979a0aa5fd9b1c7db
6
+ metadata.gz: ea0b076dc3f9d64392ae1aa0ca7d1fac2825502e18538fbca7af6585b4e59cc0b8c8d3cdf021dc42fa29c462fc410072a85ed272e217b99d7bec63f33a4e96ba
7
+ data.tar.gz: '069a8e5361c8516cc5592b58d2e555ac6543be7a30b58fadddfc8e02283a8c846b0deece61b72755a6040676e5d4736f0fe7c235421b6447a88875a4449e5eab'
data/README.md CHANGED
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -230,14 +230,14 @@ module Google
230
230
  # # Call the create_workload method.
231
231
  # result = client.create_workload request
232
232
  #
233
- # # The returned object is of type Gapic::Operation. You can use this
234
- # # object to check the status of an operation, cancel it, or wait
235
- # # for results. Here is how to block until completion:
233
+ # # The returned object is of type Gapic::Operation. You can use it to
234
+ # # check the status of an operation, cancel it, or wait for results.
235
+ # # Here is how to wait for a response.
236
236
  # result.wait_until_done! timeout: 60
237
237
  # if result.response?
238
238
  # p result.response
239
239
  # else
240
- # puts "Error!"
240
+ # puts "No response received."
241
241
  # end
242
242
  #
243
243
  def create_workload request, options = nil
@@ -786,13 +786,11 @@ module Google
786
786
  # # Call the list_workloads method.
787
787
  # result = client.list_workloads request
788
788
  #
789
- # # The returned object is of type Gapic::PagedEnumerable. You can
790
- # # iterate over all elements by calling #each, and the enumerable
791
- # # will lazily make API calls to fetch subsequent pages. Other
792
- # # methods are also available for managing paging directly.
793
- # result.each do |response|
789
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
790
+ # # over elements, and API calls will be issued to fetch pages as needed.
791
+ # result.each do |item|
794
792
  # # Each element is of type ::Google::Cloud::AssuredWorkloads::V1beta1::Workload.
795
- # p response
793
+ # p item
796
794
  # end
797
795
  #
798
796
  def list_workloads request, options = nil
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil
@@ -0,0 +1,532 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/assuredworkloads/v1beta1/assuredworkloads_service_pb"
21
+ require "google/cloud/assured_workloads/v1beta1/assured_workloads_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module AssuredWorkloads
26
+ module V1beta1
27
+ module AssuredWorkloadsService
28
+ module Rest
29
+ ##
30
+ # REST client for the AssuredWorkloadsService service.
31
+ #
32
+ # Service to manage AssuredWorkloads.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :assured_workloads_service_stub
39
+
40
+ ##
41
+ # Configure the AssuredWorkloadsService Client class.
42
+ #
43
+ # See {::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all AssuredWorkloadsService clients
49
+ # ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "AssuredWorkloads", "V1beta1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.create_workload.timeout = 60.0
70
+
71
+ default_config.rpcs.delete_workload.timeout = 60.0
72
+ default_config.rpcs.delete_workload.retry_policy = {
73
+ initial_delay: 0.2, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the AssuredWorkloadsService Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new AssuredWorkloadsService REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the AssuredWorkloadsService client.
116
+ # @yieldparam config [Client::Configuration]
117
+ #
118
+ def initialize
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+
137
+ @quota_project_id = @config.quota_project
138
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
139
+
140
+ @operations_client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Operations.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ end
145
+
146
+ @assured_workloads_service_stub = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
147
+ end
148
+
149
+ ##
150
+ # Get the associated client for long-running operations.
151
+ #
152
+ # @return [::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Operations]
153
+ #
154
+ attr_reader :operations_client
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Creates Assured Workload.
160
+ #
161
+ # @overload create_workload(request, options = nil)
162
+ # Pass arguments to `create_workload` via a request object, either of type
163
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
170
+ #
171
+ # @overload create_workload(parent: nil, workload: nil, external_id: nil)
172
+ # Pass arguments to `create_workload` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param parent [::String]
177
+ # Required. The resource name of the new Workload's parent.
178
+ # Must be of the form `organizations/{org_id}/locations/{location_id}`.
179
+ # @param workload [::Google::Cloud::AssuredWorkloads::V1beta1::Workload, ::Hash]
180
+ # Required. Assured Workload to create
181
+ # @param external_id [::String]
182
+ # Optional. A identifier associated with the workload and underlying projects which
183
+ # allows for the break down of billing costs for a workload. The value
184
+ # provided for the identifier will add a label to the workload and contained
185
+ # projects with the identifier as the value.
186
+ # @yield [result, operation] Access the result along with the TransportOperation object
187
+ # @yieldparam result [::Gapic::Operation]
188
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
189
+ #
190
+ # @return [::Gapic::Operation]
191
+ #
192
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
193
+ def create_workload request, options = nil
194
+ raise ::ArgumentError, "request must be provided" if request.nil?
195
+
196
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest
197
+
198
+ # Converts hash and nil to an options object
199
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
200
+
201
+ # Customize the options with defaults
202
+ call_metadata = @config.rpcs.create_workload.metadata.to_h
203
+
204
+ # Set x-goog-api-client and x-goog-user-project headers
205
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
206
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
207
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION,
208
+ transports_version_send: [:rest]
209
+
210
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ options.apply_defaults timeout: @config.rpcs.create_workload.timeout,
213
+ metadata: call_metadata,
214
+ retry_policy: @config.rpcs.create_workload.retry_policy
215
+
216
+ options.apply_defaults timeout: @config.timeout,
217
+ metadata: @config.metadata,
218
+ retry_policy: @config.retry_policy
219
+
220
+ @assured_workloads_service_stub.create_workload request, options do |result, operation|
221
+ result = ::Gapic::Operation.new result, @operations_client, options: options
222
+ yield result, operation if block_given?
223
+ return result
224
+ end
225
+ rescue ::Gapic::Rest::Error => e
226
+ raise ::Google::Cloud::Error.from_error(e)
227
+ end
228
+
229
+ ##
230
+ # Restrict the list of resources allowed in the Workload environment.
231
+ # The current list of allowed products can be found at
232
+ # https://cloud.google.com/assured-workloads/docs/supported-products
233
+ # In addition to assuredworkloads.workload.update permission, the user should
234
+ # also have orgpolicy.policy.set permission on the folder resource
235
+ # to use this functionality.
236
+ #
237
+ # @overload restrict_allowed_resources(request, options = nil)
238
+ # Pass arguments to `restrict_allowed_resources` via a request object, either of type
239
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest} or an equivalent Hash.
240
+ #
241
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest, ::Hash]
242
+ # A request object representing the call parameters. Required. To specify no
243
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
244
+ # @param options [::Gapic::CallOptions, ::Hash]
245
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
246
+ #
247
+ # @overload restrict_allowed_resources(name: nil, restriction_type: nil)
248
+ # Pass arguments to `restrict_allowed_resources` via keyword arguments. Note that at
249
+ # least one keyword argument is required. To specify no parameters, or to keep all
250
+ # the default parameter values, pass an empty Hash as a request object (see above).
251
+ #
252
+ # @param name [::String]
253
+ # Required. The resource name of the Workload. This is the workloads's
254
+ # relative path in the API, formatted as
255
+ # "organizations/\\{organization_id}/locations/\\{location_id}/workloads/\\{workload_id}".
256
+ # For example,
257
+ # "organizations/123/locations/us-east1/workloads/assured-workload-1".
258
+ # @param restriction_type [::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest::RestrictionType]
259
+ # Required. The type of restriction for using gcp products in the Workload environment.
260
+ # @yield [result, operation] Access the result along with the TransportOperation object
261
+ # @yieldparam result [::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse]
262
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
263
+ #
264
+ # @return [::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse]
265
+ #
266
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
267
+ def restrict_allowed_resources request, options = nil
268
+ raise ::ArgumentError, "request must be provided" if request.nil?
269
+
270
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest
271
+
272
+ # Converts hash and nil to an options object
273
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
274
+
275
+ # Customize the options with defaults
276
+ call_metadata = @config.rpcs.restrict_allowed_resources.metadata.to_h
277
+
278
+ # Set x-goog-api-client and x-goog-user-project headers
279
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
280
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
281
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION,
282
+ transports_version_send: [:rest]
283
+
284
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
+
286
+ options.apply_defaults timeout: @config.rpcs.restrict_allowed_resources.timeout,
287
+ metadata: call_metadata,
288
+ retry_policy: @config.rpcs.restrict_allowed_resources.retry_policy
289
+
290
+ options.apply_defaults timeout: @config.timeout,
291
+ metadata: @config.metadata,
292
+ retry_policy: @config.retry_policy
293
+
294
+ @assured_workloads_service_stub.restrict_allowed_resources request, options do |result, operation|
295
+ yield result, operation if block_given?
296
+ return result
297
+ end
298
+ rescue ::Gapic::Rest::Error => e
299
+ raise ::Google::Cloud::Error.from_error(e)
300
+ end
301
+
302
+ ##
303
+ # Deletes the workload. Make sure that workload's direct children are already
304
+ # in a deleted state, otherwise the request will fail with a
305
+ # FAILED_PRECONDITION error.
306
+ # In addition to assuredworkloads.workload.delete permission, the user should
307
+ # also have orgpolicy.policy.set permission on the deleted folder to remove
308
+ # Assured Workloads OrgPolicies.
309
+ #
310
+ # @overload delete_workload(request, options = nil)
311
+ # Pass arguments to `delete_workload` via a request object, either of type
312
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest} or an equivalent Hash.
313
+ #
314
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest, ::Hash]
315
+ # A request object representing the call parameters. Required. To specify no
316
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
317
+ # @param options [::Gapic::CallOptions, ::Hash]
318
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
319
+ #
320
+ # @overload delete_workload(name: nil, etag: nil)
321
+ # Pass arguments to `delete_workload` via keyword arguments. Note that at
322
+ # least one keyword argument is required. To specify no parameters, or to keep all
323
+ # the default parameter values, pass an empty Hash as a request object (see above).
324
+ #
325
+ # @param name [::String]
326
+ # Required. The `name` field is used to identify the workload.
327
+ # Format:
328
+ # organizations/\\{org_id}/locations/\\{location_id}/workloads/\\{workload_id}
329
+ # @param etag [::String]
330
+ # Optional. The etag of the workload.
331
+ # If this is provided, it must match the server's etag.
332
+ # @yield [result, operation] Access the result along with the TransportOperation object
333
+ # @yieldparam result [::Google::Protobuf::Empty]
334
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
335
+ #
336
+ # @return [::Google::Protobuf::Empty]
337
+ #
338
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
339
+ def delete_workload request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ call_metadata = @config.rpcs.delete_workload.metadata.to_h
349
+
350
+ # Set x-goog-api-client and x-goog-user-project headers
351
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION,
354
+ transports_version_send: [:rest]
355
+
356
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
357
+
358
+ options.apply_defaults timeout: @config.rpcs.delete_workload.timeout,
359
+ metadata: call_metadata,
360
+ retry_policy: @config.rpcs.delete_workload.retry_policy
361
+
362
+ options.apply_defaults timeout: @config.timeout,
363
+ metadata: @config.metadata,
364
+ retry_policy: @config.retry_policy
365
+
366
+ @assured_workloads_service_stub.delete_workload request, options do |result, operation|
367
+ yield result, operation if block_given?
368
+ return result
369
+ end
370
+ rescue ::Gapic::Rest::Error => e
371
+ raise ::Google::Cloud::Error.from_error(e)
372
+ end
373
+
374
+ ##
375
+ # Configuration class for the AssuredWorkloadsService REST API.
376
+ #
377
+ # This class represents the configuration for AssuredWorkloadsService REST,
378
+ # providing control over timeouts, retry behavior, logging, transport
379
+ # parameters, and other low-level controls. Certain parameters can also be
380
+ # applied individually to specific RPCs. See
381
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client::Configuration::Rpcs}
382
+ # for a list of RPCs that can be configured independently.
383
+ #
384
+ # Configuration can be applied globally to all clients, or to a single client
385
+ # on construction.
386
+ #
387
+ # @example
388
+ #
389
+ # # Modify the global config, setting the timeout for
390
+ # # create_workload to 20 seconds,
391
+ # # and all remaining timeouts to 10 seconds.
392
+ # ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.configure do |config|
393
+ # config.timeout = 10.0
394
+ # config.rpcs.create_workload.timeout = 20.0
395
+ # end
396
+ #
397
+ # # Apply the above configuration only to a new client.
398
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new do |config|
399
+ # config.timeout = 10.0
400
+ # config.rpcs.create_workload.timeout = 20.0
401
+ # end
402
+ #
403
+ # @!attribute [rw] endpoint
404
+ # The hostname or hostname:port of the service endpoint.
405
+ # Defaults to `"assuredworkloads.googleapis.com"`.
406
+ # @return [::String]
407
+ # @!attribute [rw] credentials
408
+ # Credentials to send with calls. You may provide any of the following types:
409
+ # * (`String`) The path to a service account key file in JSON format
410
+ # * (`Hash`) A service account key as a Hash
411
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
412
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
413
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
414
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
415
+ # * (`nil`) indicating no credentials
416
+ # @return [::Object]
417
+ # @!attribute [rw] scope
418
+ # The OAuth scopes
419
+ # @return [::Array<::String>]
420
+ # @!attribute [rw] lib_name
421
+ # The library name as recorded in instrumentation and logging
422
+ # @return [::String]
423
+ # @!attribute [rw] lib_version
424
+ # The library version as recorded in instrumentation and logging
425
+ # @return [::String]
426
+ # @!attribute [rw] timeout
427
+ # The call timeout in seconds.
428
+ # @return [::Numeric]
429
+ # @!attribute [rw] metadata
430
+ # Additional headers to be sent with the call.
431
+ # @return [::Hash{::Symbol=>::String}]
432
+ # @!attribute [rw] retry_policy
433
+ # The retry policy. The value is a hash with the following keys:
434
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
435
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
436
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
437
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
438
+ # trigger a retry.
439
+ # @return [::Hash]
440
+ # @!attribute [rw] quota_project
441
+ # A separate project against which to charge quota.
442
+ # @return [::String]
443
+ #
444
+ class Configuration
445
+ extend ::Gapic::Config
446
+
447
+ config_attr :endpoint, "assuredworkloads.googleapis.com", ::String
448
+ config_attr :credentials, nil do |value|
449
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
450
+ allowed.any? { |klass| klass === value }
451
+ end
452
+ config_attr :scope, nil, ::String, ::Array, nil
453
+ config_attr :lib_name, nil, ::String, nil
454
+ config_attr :lib_version, nil, ::String, nil
455
+ config_attr :timeout, nil, ::Numeric, nil
456
+ config_attr :metadata, nil, ::Hash, nil
457
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
458
+ config_attr :quota_project, nil, ::String, nil
459
+
460
+ # @private
461
+ def initialize parent_config = nil
462
+ @parent_config = parent_config unless parent_config.nil?
463
+
464
+ yield self if block_given?
465
+ end
466
+
467
+ ##
468
+ # Configurations for individual RPCs
469
+ # @return [Rpcs]
470
+ #
471
+ def rpcs
472
+ @rpcs ||= begin
473
+ parent_rpcs = nil
474
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
475
+ Rpcs.new parent_rpcs
476
+ end
477
+ end
478
+
479
+ ##
480
+ # Configuration RPC class for the AssuredWorkloadsService API.
481
+ #
482
+ # Includes fields providing the configuration for each RPC in this service.
483
+ # Each configuration object is of type `Gapic::Config::Method` and includes
484
+ # the following configuration fields:
485
+ #
486
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
487
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
488
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
489
+ # include the following keys:
490
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
491
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
492
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
493
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
494
+ # trigger a retry.
495
+ #
496
+ class Rpcs
497
+ ##
498
+ # RPC-specific configuration for `create_workload`
499
+ # @return [::Gapic::Config::Method]
500
+ #
501
+ attr_reader :create_workload
502
+ ##
503
+ # RPC-specific configuration for `restrict_allowed_resources`
504
+ # @return [::Gapic::Config::Method]
505
+ #
506
+ attr_reader :restrict_allowed_resources
507
+ ##
508
+ # RPC-specific configuration for `delete_workload`
509
+ # @return [::Gapic::Config::Method]
510
+ #
511
+ attr_reader :delete_workload
512
+
513
+ # @private
514
+ def initialize parent_rpcs = nil
515
+ create_workload_config = parent_rpcs.create_workload if parent_rpcs.respond_to? :create_workload
516
+ @create_workload = ::Gapic::Config::Method.new create_workload_config
517
+ restrict_allowed_resources_config = parent_rpcs.restrict_allowed_resources if parent_rpcs.respond_to? :restrict_allowed_resources
518
+ @restrict_allowed_resources = ::Gapic::Config::Method.new restrict_allowed_resources_config
519
+ delete_workload_config = parent_rpcs.delete_workload if parent_rpcs.respond_to? :delete_workload
520
+ @delete_workload = ::Gapic::Config::Method.new delete_workload_config
521
+
522
+ yield self if block_given?
523
+ end
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end
531
+ end
532
+ end