google-cloud-assured_workloads-v1beta1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +75 -0
  6. data/lib/google-cloud-assured_workloads-v1beta1.rb +21 -0
  7. data/lib/google/cloud/assured_workloads/v1beta1.rb +35 -0
  8. data/lib/google/cloud/assured_workloads/v1beta1/assured_workloads_service.rb +50 -0
  9. data/lib/google/cloud/assured_workloads/v1beta1/assured_workloads_service/client.rb +740 -0
  10. data/lib/google/cloud/assured_workloads/v1beta1/assured_workloads_service/credentials.rb +51 -0
  11. data/lib/google/cloud/assured_workloads/v1beta1/assured_workloads_service/operations.rb +570 -0
  12. data/lib/google/cloud/assured_workloads/v1beta1/assured_workloads_service/paths.rb +69 -0
  13. data/lib/google/cloud/assured_workloads/v1beta1/version.rb +28 -0
  14. data/lib/google/cloud/assuredworkloads/v1beta1/assuredworkloads_v1beta1_pb.rb +123 -0
  15. data/lib/google/cloud/assuredworkloads/v1beta1/assuredworkloads_v1beta1_services_pb.rb +58 -0
  16. data/proto_docs/README.md +4 -0
  17. data/proto_docs/google/api/field_behavior.rb +59 -0
  18. data/proto_docs/google/api/resource.rb +283 -0
  19. data/proto_docs/google/cloud/assuredworkloads/v1beta1/assuredworkloads_v1beta1.rb +307 -0
  20. data/proto_docs/google/longrunning/operations.rb +150 -0
  21. data/proto_docs/google/protobuf/any.rb +138 -0
  22. data/proto_docs/google/protobuf/duration.rb +98 -0
  23. data/proto_docs/google/protobuf/empty.rb +36 -0
  24. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  25. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  26. data/proto_docs/google/rpc/status.rb +46 -0
  27. metadata +208 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/assured_workloads/v1beta1"
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/assured_workloads/v1beta1/assured_workloads_service"
20
+ require "google/cloud/assured_workloads/v1beta1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module AssuredWorkloads
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/assured_workloads/v1beta1"
29
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.new
30
+ #
31
+ module V1beta1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/assured_workloads/v1beta1/version"
24
+
25
+ require "google/cloud/assured_workloads/v1beta1/assured_workloads_service/credentials"
26
+ require "google/cloud/assured_workloads/v1beta1/assured_workloads_service/paths"
27
+ require "google/cloud/assured_workloads/v1beta1/assured_workloads_service/operations"
28
+ require "google/cloud/assured_workloads/v1beta1/assured_workloads_service/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module AssuredWorkloads
33
+ module V1beta1
34
+ ##
35
+ # Service to manage AssuredWorkloads.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/assured_workloads/v1beta1/assured_workloads_service"
40
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.new
41
+ #
42
+ module AssuredWorkloadsService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "assured_workloads_service", "helpers.rb"
50
+ require "google/cloud/assured_workloads/v1beta1/assured_workloads_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,740 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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_v1beta1_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module AssuredWorkloads
25
+ module V1beta1
26
+ module AssuredWorkloadsService
27
+ ##
28
+ # Client for the AssuredWorkloadsService service.
29
+ #
30
+ # Service to manage AssuredWorkloads.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :assured_workloads_service_stub
37
+
38
+ ##
39
+ # Configure the AssuredWorkloadsService Client class.
40
+ #
41
+ # See {::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all AssuredWorkloadsService clients:
47
+ #
48
+ # ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "AssuredWorkloads", "V1beta1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const&.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.create_workload.timeout = 60.0
69
+
70
+ default_config.rpcs.update_workload.timeout = 60.0
71
+
72
+ default_config.rpcs.delete_workload.timeout = 60.0
73
+ default_config.rpcs.delete_workload.retry_policy = {
74
+ initial_delay: 0.2,
75
+ max_delay: 30.0,
76
+ multiplier: 1.3,
77
+ retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.get_workload.timeout = 60.0
81
+ default_config.rpcs.get_workload.retry_policy = {
82
+ initial_delay: 0.2,
83
+ max_delay: 30.0,
84
+ multiplier: 1.3,
85
+ retry_codes: [14]
86
+ }
87
+
88
+ default_config.rpcs.list_workloads.timeout = 60.0
89
+ default_config.rpcs.list_workloads.retry_policy = {
90
+ initial_delay: 0.2,
91
+ max_delay: 30.0,
92
+ multiplier: 1.3,
93
+ retry_codes: [14]
94
+ }
95
+
96
+ default_config
97
+ end
98
+ yield @configure if block_given?
99
+ @configure
100
+ end
101
+
102
+ ##
103
+ # Configure the AssuredWorkloadsService Client instance.
104
+ #
105
+ # The configuration is set to the derived mode, meaning that values can be changed,
106
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
107
+ # should be made on {Client.configure}.
108
+ #
109
+ # See {::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client::Configuration}
110
+ # for a description of the configuration fields.
111
+ #
112
+ # @yield [config] Configure the Client client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ # @return [Client::Configuration]
116
+ #
117
+ def configure
118
+ yield @config if block_given?
119
+ @config
120
+ end
121
+
122
+ ##
123
+ # Create a new AssuredWorkloadsService client object.
124
+ #
125
+ # ## Examples
126
+ #
127
+ # To create a new AssuredWorkloadsService client with the default
128
+ # configuration:
129
+ #
130
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.new
131
+ #
132
+ # To create a new AssuredWorkloadsService client with a custom
133
+ # configuration:
134
+ #
135
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
138
+ #
139
+ # @yield [config] Configure the AssuredWorkloadsService client.
140
+ # @yieldparam config [Client::Configuration]
141
+ #
142
+ def initialize
143
+ # These require statements are intentionally placed here to initialize
144
+ # the gRPC module only when it's required.
145
+ # See https://github.com/googleapis/toolkit/issues/446
146
+ require "gapic/grpc"
147
+ require "google/cloud/assuredworkloads/v1beta1/assuredworkloads_v1beta1_services_pb"
148
+
149
+ # Create the configuration object
150
+ @config = Configuration.new Client.configure
151
+
152
+ # Yield the configuration if needed
153
+ yield @config if block_given?
154
+
155
+ # Create credentials
156
+ credentials = @config.credentials
157
+ credentials ||= Credentials.default scope: @config.scope
158
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
159
+ credentials = Credentials.new credentials, scope: @config.scope
160
+ end
161
+ @quota_project_id = @config.quota_project
162
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
163
+
164
+ @operations_client = Operations.new do |config|
165
+ config.credentials = credentials
166
+ config.endpoint = @config.endpoint
167
+ end
168
+
169
+ @assured_workloads_service_stub = ::Gapic::ServiceStub.new(
170
+ ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Stub,
171
+ credentials: credentials,
172
+ endpoint: @config.endpoint,
173
+ channel_args: @config.channel_args,
174
+ interceptors: @config.interceptors
175
+ )
176
+ end
177
+
178
+ ##
179
+ # Get the associated client for long-running operations.
180
+ #
181
+ # @return [::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Operations]
182
+ #
183
+ attr_reader :operations_client
184
+
185
+ # Service calls
186
+
187
+ ##
188
+ # Creates Assured Workload.
189
+ #
190
+ # @overload create_workload(request, options = nil)
191
+ # Pass arguments to `create_workload` via a request object, either of type
192
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest} or an equivalent Hash.
193
+ #
194
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest, ::Hash]
195
+ # A request object representing the call parameters. Required. To specify no
196
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
197
+ # @param options [::Gapic::CallOptions, ::Hash]
198
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
199
+ #
200
+ # @overload create_workload(parent: nil, workload: nil, external_id: nil)
201
+ # Pass arguments to `create_workload` via keyword arguments. Note that at
202
+ # least one keyword argument is required. To specify no parameters, or to keep all
203
+ # the default parameter values, pass an empty Hash as a request object (see above).
204
+ #
205
+ # @param parent [::String]
206
+ # Required. The resource name of the new Workload's parent.
207
+ # Must be of the form `organizations/{org_id}/locations/{location_id}`.
208
+ # @param workload [::Google::Cloud::AssuredWorkloads::V1beta1::Workload, ::Hash]
209
+ # Required. Assured Workload to create
210
+ # @param external_id [::String]
211
+ # Optional. A identifier associated with the workload and underlying projects which
212
+ # allows for the break down of billing costs for a workload. The value
213
+ # provided for the identifier will add a label to the workload and contained
214
+ # projects with the identifier as the value.
215
+ #
216
+ # @yield [response, operation] Access the result along with the RPC operation
217
+ # @yieldparam response [::Gapic::Operation]
218
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
219
+ #
220
+ # @return [::Gapic::Operation]
221
+ #
222
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
223
+ #
224
+ def create_workload request, options = nil
225
+ raise ::ArgumentError, "request must be provided" if request.nil?
226
+
227
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest
228
+
229
+ # Converts hash and nil to an options object
230
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
231
+
232
+ # Customize the options with defaults
233
+ metadata = @config.rpcs.create_workload.metadata.to_h
234
+
235
+ # Set x-goog-api-client and x-goog-user-project headers
236
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
237
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
238
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION
239
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
240
+
241
+ header_params = {
242
+ "parent" => request.parent
243
+ }
244
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
245
+ metadata[:"x-goog-request-params"] ||= request_params_header
246
+
247
+ options.apply_defaults timeout: @config.rpcs.create_workload.timeout,
248
+ metadata: metadata,
249
+ retry_policy: @config.rpcs.create_workload.retry_policy
250
+ options.apply_defaults metadata: @config.metadata,
251
+ retry_policy: @config.retry_policy
252
+
253
+ @assured_workloads_service_stub.call_rpc :create_workload, request, options: options do |response, operation|
254
+ response = ::Gapic::Operation.new response, @operations_client, options: options
255
+ yield response, operation if block_given?
256
+ return response
257
+ end
258
+ rescue ::GRPC::BadStatus => e
259
+ raise ::Google::Cloud::Error.from_error(e)
260
+ end
261
+
262
+ ##
263
+ # Updates an existing workload.
264
+ # Currently allows updating of workload display_name and labels.
265
+ # For force updates don't set etag field in the Workload.
266
+ # Only one update operation per workload can be in progress.
267
+ #
268
+ # @overload update_workload(request, options = nil)
269
+ # Pass arguments to `update_workload` via a request object, either of type
270
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::UpdateWorkloadRequest} or an equivalent Hash.
271
+ #
272
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::UpdateWorkloadRequest, ::Hash]
273
+ # A request object representing the call parameters. Required. To specify no
274
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
275
+ # @param options [::Gapic::CallOptions, ::Hash]
276
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
277
+ #
278
+ # @overload update_workload(workload: nil, update_mask: nil)
279
+ # Pass arguments to `update_workload` via keyword arguments. Note that at
280
+ # least one keyword argument is required. To specify no parameters, or to keep all
281
+ # the default parameter values, pass an empty Hash as a request object (see above).
282
+ #
283
+ # @param workload [::Google::Cloud::AssuredWorkloads::V1beta1::Workload, ::Hash]
284
+ # Required. The workload to update.
285
+ # The workload’s `name` field is used to identify the workload to be updated.
286
+ # Format:
287
+ # organizations/\\{org_id}/locations/\\{location_id}/workloads/\\{workload_id}
288
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
289
+ # Required. The list of fields to be updated.
290
+ #
291
+ # @yield [response, operation] Access the result along with the RPC operation
292
+ # @yieldparam response [::Google::Cloud::AssuredWorkloads::V1beta1::Workload]
293
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
294
+ #
295
+ # @return [::Google::Cloud::AssuredWorkloads::V1beta1::Workload]
296
+ #
297
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
298
+ #
299
+ def update_workload request, options = nil
300
+ raise ::ArgumentError, "request must be provided" if request.nil?
301
+
302
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::UpdateWorkloadRequest
303
+
304
+ # Converts hash and nil to an options object
305
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
306
+
307
+ # Customize the options with defaults
308
+ metadata = @config.rpcs.update_workload.metadata.to_h
309
+
310
+ # Set x-goog-api-client and x-goog-user-project headers
311
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
312
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
313
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION
314
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
315
+
316
+ header_params = {
317
+ "workload.name" => request.workload.name
318
+ }
319
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
320
+ metadata[:"x-goog-request-params"] ||= request_params_header
321
+
322
+ options.apply_defaults timeout: @config.rpcs.update_workload.timeout,
323
+ metadata: metadata,
324
+ retry_policy: @config.rpcs.update_workload.retry_policy
325
+ options.apply_defaults metadata: @config.metadata,
326
+ retry_policy: @config.retry_policy
327
+
328
+ @assured_workloads_service_stub.call_rpc :update_workload, request, options: options do |response, operation|
329
+ yield response, operation if block_given?
330
+ return response
331
+ end
332
+ rescue ::GRPC::BadStatus => e
333
+ raise ::Google::Cloud::Error.from_error(e)
334
+ end
335
+
336
+ ##
337
+ # Deletes the workload. Make sure that workload's direct children are already
338
+ # in a deleted state, otherwise the request will fail with a
339
+ # FAILED_PRECONDITION error.
340
+ #
341
+ # @overload delete_workload(request, options = nil)
342
+ # Pass arguments to `delete_workload` via a request object, either of type
343
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest} or an equivalent Hash.
344
+ #
345
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest, ::Hash]
346
+ # A request object representing the call parameters. Required. To specify no
347
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
348
+ # @param options [::Gapic::CallOptions, ::Hash]
349
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
350
+ #
351
+ # @overload delete_workload(name: nil, etag: nil)
352
+ # Pass arguments to `delete_workload` via keyword arguments. Note that at
353
+ # least one keyword argument is required. To specify no parameters, or to keep all
354
+ # the default parameter values, pass an empty Hash as a request object (see above).
355
+ #
356
+ # @param name [::String]
357
+ # Required. The `name` field is used to identify the workload.
358
+ # Format:
359
+ # organizations/\\{org_id}/locations/\\{location_id}/workloads/\\{workload_id}
360
+ # @param etag [::String]
361
+ # Optional. The etag of the workload.
362
+ # If this is provided, it must match the server's etag.
363
+ #
364
+ # @yield [response, operation] Access the result along with the RPC operation
365
+ # @yieldparam response [::Google::Protobuf::Empty]
366
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
367
+ #
368
+ # @return [::Google::Protobuf::Empty]
369
+ #
370
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
371
+ #
372
+ def delete_workload request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ metadata = @config.rpcs.delete_workload.metadata.to_h
382
+
383
+ # Set x-goog-api-client and x-goog-user-project headers
384
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION
387
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
388
+
389
+ header_params = {
390
+ "name" => request.name
391
+ }
392
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
393
+ metadata[:"x-goog-request-params"] ||= request_params_header
394
+
395
+ options.apply_defaults timeout: @config.rpcs.delete_workload.timeout,
396
+ metadata: metadata,
397
+ retry_policy: @config.rpcs.delete_workload.retry_policy
398
+ options.apply_defaults metadata: @config.metadata,
399
+ retry_policy: @config.retry_policy
400
+
401
+ @assured_workloads_service_stub.call_rpc :delete_workload, request, options: options do |response, operation|
402
+ yield response, operation if block_given?
403
+ return response
404
+ end
405
+ rescue ::GRPC::BadStatus => e
406
+ raise ::Google::Cloud::Error.from_error(e)
407
+ end
408
+
409
+ ##
410
+ # Gets Assured Workload associated with a CRM Node
411
+ #
412
+ # @overload get_workload(request, options = nil)
413
+ # Pass arguments to `get_workload` via a request object, either of type
414
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::GetWorkloadRequest} or an equivalent Hash.
415
+ #
416
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::GetWorkloadRequest, ::Hash]
417
+ # A request object representing the call parameters. Required. To specify no
418
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
419
+ # @param options [::Gapic::CallOptions, ::Hash]
420
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
421
+ #
422
+ # @overload get_workload(name: nil)
423
+ # Pass arguments to `get_workload` via keyword arguments. Note that at
424
+ # least one keyword argument is required. To specify no parameters, or to keep all
425
+ # the default parameter values, pass an empty Hash as a request object (see above).
426
+ #
427
+ # @param name [::String]
428
+ # Required. The resource name of the Workload to fetch. This is the workloads's
429
+ # relative path in the API, formatted as
430
+ # "organizations/\\{organization_id}/locations/\\{location_id}/workloads/\\{workload_id}".
431
+ # For example,
432
+ # "organizations/123/locations/us-east1/workloads/assured-workload-1".
433
+ #
434
+ # @yield [response, operation] Access the result along with the RPC operation
435
+ # @yieldparam response [::Google::Cloud::AssuredWorkloads::V1beta1::Workload]
436
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
437
+ #
438
+ # @return [::Google::Cloud::AssuredWorkloads::V1beta1::Workload]
439
+ #
440
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
441
+ #
442
+ def get_workload request, options = nil
443
+ raise ::ArgumentError, "request must be provided" if request.nil?
444
+
445
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::GetWorkloadRequest
446
+
447
+ # Converts hash and nil to an options object
448
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
449
+
450
+ # Customize the options with defaults
451
+ metadata = @config.rpcs.get_workload.metadata.to_h
452
+
453
+ # Set x-goog-api-client and x-goog-user-project headers
454
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
455
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
456
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION
457
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
+
459
+ header_params = {
460
+ "name" => request.name
461
+ }
462
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
463
+ metadata[:"x-goog-request-params"] ||= request_params_header
464
+
465
+ options.apply_defaults timeout: @config.rpcs.get_workload.timeout,
466
+ metadata: metadata,
467
+ retry_policy: @config.rpcs.get_workload.retry_policy
468
+ options.apply_defaults metadata: @config.metadata,
469
+ retry_policy: @config.retry_policy
470
+
471
+ @assured_workloads_service_stub.call_rpc :get_workload, request, options: options do |response, operation|
472
+ yield response, operation if block_given?
473
+ return response
474
+ end
475
+ rescue ::GRPC::BadStatus => e
476
+ raise ::Google::Cloud::Error.from_error(e)
477
+ end
478
+
479
+ ##
480
+ # Lists Assured Workloads under a CRM Node.
481
+ #
482
+ # @overload list_workloads(request, options = nil)
483
+ # Pass arguments to `list_workloads` via a request object, either of type
484
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::ListWorkloadsRequest} or an equivalent Hash.
485
+ #
486
+ # @param request [::Google::Cloud::AssuredWorkloads::V1beta1::ListWorkloadsRequest, ::Hash]
487
+ # A request object representing the call parameters. Required. To specify no
488
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
489
+ # @param options [::Gapic::CallOptions, ::Hash]
490
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
491
+ #
492
+ # @overload list_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil)
493
+ # Pass arguments to `list_workloads` via keyword arguments. Note that at
494
+ # least one keyword argument is required. To specify no parameters, or to keep all
495
+ # the default parameter values, pass an empty Hash as a request object (see above).
496
+ #
497
+ # @param parent [::String]
498
+ # Required. Parent Resource to list workloads from.
499
+ # Must be of the form `organizations/{org_id}/locations/{location}`.
500
+ # @param page_size [::Integer]
501
+ # Page size.
502
+ # @param page_token [::String]
503
+ # Page token returned from previous request. Page token contains context from
504
+ # previous request. Page token needs to be passed in the second and following
505
+ # requests.
506
+ # @param filter [::String]
507
+ # A custom filter for filtering by properties of a workload. At this time,
508
+ # only filtering by labels is supported.
509
+ #
510
+ # @yield [response, operation] Access the result along with the RPC operation
511
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1beta1::Workload>]
512
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
513
+ #
514
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1beta1::Workload>]
515
+ #
516
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
517
+ #
518
+ def list_workloads request, options = nil
519
+ raise ::ArgumentError, "request must be provided" if request.nil?
520
+
521
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AssuredWorkloads::V1beta1::ListWorkloadsRequest
522
+
523
+ # Converts hash and nil to an options object
524
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
525
+
526
+ # Customize the options with defaults
527
+ metadata = @config.rpcs.list_workloads.metadata.to_h
528
+
529
+ # Set x-goog-api-client and x-goog-user-project headers
530
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
531
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
532
+ gapic_version: ::Google::Cloud::AssuredWorkloads::V1beta1::VERSION
533
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
534
+
535
+ header_params = {
536
+ "parent" => request.parent
537
+ }
538
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
539
+ metadata[:"x-goog-request-params"] ||= request_params_header
540
+
541
+ options.apply_defaults timeout: @config.rpcs.list_workloads.timeout,
542
+ metadata: metadata,
543
+ retry_policy: @config.rpcs.list_workloads.retry_policy
544
+ options.apply_defaults metadata: @config.metadata,
545
+ retry_policy: @config.retry_policy
546
+
547
+ @assured_workloads_service_stub.call_rpc :list_workloads, request, options: options do |response, operation|
548
+ response = ::Gapic::PagedEnumerable.new @assured_workloads_service_stub, :list_workloads, request, response, operation, options
549
+ yield response, operation if block_given?
550
+ return response
551
+ end
552
+ rescue ::GRPC::BadStatus => e
553
+ raise ::Google::Cloud::Error.from_error(e)
554
+ end
555
+
556
+ ##
557
+ # Configuration class for the AssuredWorkloadsService API.
558
+ #
559
+ # This class represents the configuration for AssuredWorkloadsService,
560
+ # providing control over timeouts, retry behavior, logging, transport
561
+ # parameters, and other low-level controls. Certain parameters can also be
562
+ # applied individually to specific RPCs. See
563
+ # {::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client::Configuration::Rpcs}
564
+ # for a list of RPCs that can be configured independently.
565
+ #
566
+ # Configuration can be applied globally to all clients, or to a single client
567
+ # on construction.
568
+ #
569
+ # # Examples
570
+ #
571
+ # To modify the global config, setting the timeout for create_workload
572
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
573
+ #
574
+ # ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.configure do |config|
575
+ # config.timeout = 10.0
576
+ # config.rpcs.create_workload.timeout = 20.0
577
+ # end
578
+ #
579
+ # To apply the above configuration only to a new client:
580
+ #
581
+ # client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Client.new do |config|
582
+ # config.timeout = 10.0
583
+ # config.rpcs.create_workload.timeout = 20.0
584
+ # end
585
+ #
586
+ # @!attribute [rw] endpoint
587
+ # The hostname or hostname:port of the service endpoint.
588
+ # Defaults to `"assuredworkloads.googleapis.com"`.
589
+ # @return [::String]
590
+ # @!attribute [rw] credentials
591
+ # Credentials to send with calls. You may provide any of the following types:
592
+ # * (`String`) The path to a service account key file in JSON format
593
+ # * (`Hash`) A service account key as a Hash
594
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
595
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
596
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
597
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
598
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
599
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
600
+ # * (`nil`) indicating no credentials
601
+ # @return [::Object]
602
+ # @!attribute [rw] scope
603
+ # The OAuth scopes
604
+ # @return [::Array<::String>]
605
+ # @!attribute [rw] lib_name
606
+ # The library name as recorded in instrumentation and logging
607
+ # @return [::String]
608
+ # @!attribute [rw] lib_version
609
+ # The library version as recorded in instrumentation and logging
610
+ # @return [::String]
611
+ # @!attribute [rw] channel_args
612
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
613
+ # `GRPC::Core::Channel` object is provided as the credential.
614
+ # @return [::Hash]
615
+ # @!attribute [rw] interceptors
616
+ # An array of interceptors that are run before calls are executed.
617
+ # @return [::Array<::GRPC::ClientInterceptor>]
618
+ # @!attribute [rw] timeout
619
+ # The call timeout in seconds.
620
+ # @return [::Numeric]
621
+ # @!attribute [rw] metadata
622
+ # Additional gRPC headers to be sent with the call.
623
+ # @return [::Hash{::Symbol=>::String}]
624
+ # @!attribute [rw] retry_policy
625
+ # The retry policy. The value is a hash with the following keys:
626
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
627
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
628
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
629
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
630
+ # trigger a retry.
631
+ # @return [::Hash]
632
+ # @!attribute [rw] quota_project
633
+ # A separate project against which to charge quota.
634
+ # @return [::String]
635
+ #
636
+ class Configuration
637
+ extend ::Gapic::Config
638
+
639
+ config_attr :endpoint, "assuredworkloads.googleapis.com", ::String
640
+ config_attr :credentials, nil do |value|
641
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
642
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
643
+ allowed.any? { |klass| klass === value }
644
+ end
645
+ config_attr :scope, nil, ::String, ::Array, nil
646
+ config_attr :lib_name, nil, ::String, nil
647
+ config_attr :lib_version, nil, ::String, nil
648
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
649
+ config_attr :interceptors, nil, ::Array, nil
650
+ config_attr :timeout, nil, ::Numeric, nil
651
+ config_attr :metadata, nil, ::Hash, nil
652
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
653
+ config_attr :quota_project, nil, ::String, nil
654
+
655
+ # @private
656
+ def initialize parent_config = nil
657
+ @parent_config = parent_config unless parent_config.nil?
658
+
659
+ yield self if block_given?
660
+ end
661
+
662
+ ##
663
+ # Configurations for individual RPCs
664
+ # @return [Rpcs]
665
+ #
666
+ def rpcs
667
+ @rpcs ||= begin
668
+ parent_rpcs = nil
669
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
670
+ Rpcs.new parent_rpcs
671
+ end
672
+ end
673
+
674
+ ##
675
+ # Configuration RPC class for the AssuredWorkloadsService API.
676
+ #
677
+ # Includes fields providing the configuration for each RPC in this service.
678
+ # Each configuration object is of type `Gapic::Config::Method` and includes
679
+ # the following configuration fields:
680
+ #
681
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
682
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
683
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
684
+ # include the following keys:
685
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
686
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
687
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
688
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
689
+ # trigger a retry.
690
+ #
691
+ class Rpcs
692
+ ##
693
+ # RPC-specific configuration for `create_workload`
694
+ # @return [::Gapic::Config::Method]
695
+ #
696
+ attr_reader :create_workload
697
+ ##
698
+ # RPC-specific configuration for `update_workload`
699
+ # @return [::Gapic::Config::Method]
700
+ #
701
+ attr_reader :update_workload
702
+ ##
703
+ # RPC-specific configuration for `delete_workload`
704
+ # @return [::Gapic::Config::Method]
705
+ #
706
+ attr_reader :delete_workload
707
+ ##
708
+ # RPC-specific configuration for `get_workload`
709
+ # @return [::Gapic::Config::Method]
710
+ #
711
+ attr_reader :get_workload
712
+ ##
713
+ # RPC-specific configuration for `list_workloads`
714
+ # @return [::Gapic::Config::Method]
715
+ #
716
+ attr_reader :list_workloads
717
+
718
+ # @private
719
+ def initialize parent_rpcs = nil
720
+ create_workload_config = parent_rpcs&.create_workload if parent_rpcs&.respond_to? :create_workload
721
+ @create_workload = ::Gapic::Config::Method.new create_workload_config
722
+ update_workload_config = parent_rpcs&.update_workload if parent_rpcs&.respond_to? :update_workload
723
+ @update_workload = ::Gapic::Config::Method.new update_workload_config
724
+ delete_workload_config = parent_rpcs&.delete_workload if parent_rpcs&.respond_to? :delete_workload
725
+ @delete_workload = ::Gapic::Config::Method.new delete_workload_config
726
+ get_workload_config = parent_rpcs&.get_workload if parent_rpcs&.respond_to? :get_workload
727
+ @get_workload = ::Gapic::Config::Method.new get_workload_config
728
+ list_workloads_config = parent_rpcs&.list_workloads if parent_rpcs&.respond_to? :list_workloads
729
+ @list_workloads = ::Gapic::Config::Method.new list_workloads_config
730
+
731
+ yield self if block_given?
732
+ end
733
+ end
734
+ end
735
+ end
736
+ end
737
+ end
738
+ end
739
+ end
740
+ end