google-cloud-os_config-v1 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1181 @@
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/osconfig/v1/osconfig_service_pb"
21
+ require "google/cloud/os_config/v1/os_config_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module OsConfig
26
+ module V1
27
+ module OsConfigService
28
+ module Rest
29
+ ##
30
+ # REST client for the OsConfigService service.
31
+ #
32
+ # OS Config API
33
+ #
34
+ # The OS Config service is a server-side component that you can use to
35
+ # manage package installations and patch jobs for virtual machine instances.
36
+ #
37
+ class Client
38
+ include Paths
39
+
40
+ # @private
41
+ attr_reader :os_config_service_stub
42
+
43
+ ##
44
+ # Configure the OsConfigService Client class.
45
+ #
46
+ # See {::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client::Configuration}
47
+ # for a description of the configuration fields.
48
+ #
49
+ # @example
50
+ #
51
+ # # Modify the configuration for all OsConfigService clients
52
+ # ::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Cloud", "OsConfig", "V1"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.timeout = 60.0
73
+ default_config.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the OsConfigService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new OsConfigService REST client object.
105
+ #
106
+ # @example
107
+ #
108
+ # # Create a client using the default configuration
109
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client.new
110
+ #
111
+ # # Create a client using a custom configuration
112
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client.new do |config|
113
+ # config.timeout = 10.0
114
+ # end
115
+ #
116
+ # @yield [config] Configure the OsConfigService client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ def initialize
120
+ # Create the configuration object
121
+ @config = Configuration.new Client.configure
122
+
123
+ # Yield the configuration if needed
124
+ yield @config if block_given?
125
+
126
+ # Create credentials
127
+ credentials = @config.credentials
128
+ # Use self-signed JWT if the endpoint is unchanged from default,
129
+ # but only if the default endpoint does not have a region prefix.
130
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
131
+ !@config.endpoint.split(".").first.include?("-")
132
+ credentials ||= Credentials.default scope: @config.scope,
133
+ enable_self_signed_jwt: enable_self_signed_jwt
134
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
135
+ credentials = Credentials.new credentials, scope: @config.scope
136
+ end
137
+
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @os_config_service_stub = ::Google::Cloud::OsConfig::V1::OsConfigService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
142
+ end
143
+
144
+ # Service calls
145
+
146
+ ##
147
+ # Patch VM instances by creating and running a patch job.
148
+ #
149
+ # @overload execute_patch_job(request, options = nil)
150
+ # Pass arguments to `execute_patch_job` via a request object, either of type
151
+ # {::Google::Cloud::OsConfig::V1::ExecutePatchJobRequest} or an equivalent Hash.
152
+ #
153
+ # @param request [::Google::Cloud::OsConfig::V1::ExecutePatchJobRequest, ::Hash]
154
+ # A request object representing the call parameters. Required. To specify no
155
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
156
+ # @param options [::Gapic::CallOptions, ::Hash]
157
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
158
+ #
159
+ # @overload execute_patch_job(parent: nil, description: nil, instance_filter: nil, patch_config: nil, duration: nil, dry_run: nil, display_name: nil, rollout: nil)
160
+ # Pass arguments to `execute_patch_job` via keyword arguments. Note that at
161
+ # least one keyword argument is required. To specify no parameters, or to keep all
162
+ # the default parameter values, pass an empty Hash as a request object (see above).
163
+ #
164
+ # @param parent [::String]
165
+ # Required. The project in which to run this patch in the form `projects/*`
166
+ # @param description [::String]
167
+ # Description of the patch job. Length of the description is limited
168
+ # to 1024 characters.
169
+ # @param instance_filter [::Google::Cloud::OsConfig::V1::PatchInstanceFilter, ::Hash]
170
+ # Required. Instances to patch, either explicitly or filtered by some
171
+ # criteria such as zone or labels.
172
+ # @param patch_config [::Google::Cloud::OsConfig::V1::PatchConfig, ::Hash]
173
+ # Patch configuration being applied. If omitted, instances are
174
+ # patched using the default configurations.
175
+ # @param duration [::Google::Protobuf::Duration, ::Hash]
176
+ # Duration of the patch job. After the duration ends, the patch job
177
+ # times out.
178
+ # @param dry_run [::Boolean]
179
+ # If this patch is a dry-run only, instances are contacted but
180
+ # will do nothing.
181
+ # @param display_name [::String]
182
+ # Display name for this patch job. This does not have to be unique.
183
+ # @param rollout [::Google::Cloud::OsConfig::V1::PatchRollout, ::Hash]
184
+ # Rollout strategy of the patch job.
185
+ # @yield [result, operation] Access the result along with the TransportOperation object
186
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchJob]
187
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
188
+ #
189
+ # @return [::Google::Cloud::OsConfig::V1::PatchJob]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
192
+ def execute_patch_job request, options = nil
193
+ raise ::ArgumentError, "request must be provided" if request.nil?
194
+
195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ExecutePatchJobRequest
196
+
197
+ # Converts hash and nil to an options object
198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
199
+
200
+ # Customize the options with defaults
201
+ call_metadata = @config.rpcs.execute_patch_job.metadata.to_h
202
+
203
+ # Set x-goog-api-client and x-goog-user-project headers
204
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
206
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
207
+ transports_version_send: [:rest]
208
+
209
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
+
211
+ options.apply_defaults timeout: @config.rpcs.execute_patch_job.timeout,
212
+ metadata: call_metadata,
213
+ retry_policy: @config.rpcs.execute_patch_job.retry_policy
214
+
215
+ options.apply_defaults timeout: @config.timeout,
216
+ metadata: @config.metadata,
217
+ retry_policy: @config.retry_policy
218
+
219
+ @os_config_service_stub.execute_patch_job request, options do |result, operation|
220
+ yield result, operation if block_given?
221
+ return result
222
+ end
223
+ rescue ::Gapic::Rest::Error => e
224
+ raise ::Google::Cloud::Error.from_error(e)
225
+ end
226
+
227
+ ##
228
+ # Get the patch job. This can be used to track the progress of an
229
+ # ongoing patch job or review the details of completed jobs.
230
+ #
231
+ # @overload get_patch_job(request, options = nil)
232
+ # Pass arguments to `get_patch_job` via a request object, either of type
233
+ # {::Google::Cloud::OsConfig::V1::GetPatchJobRequest} or an equivalent Hash.
234
+ #
235
+ # @param request [::Google::Cloud::OsConfig::V1::GetPatchJobRequest, ::Hash]
236
+ # A request object representing the call parameters. Required. To specify no
237
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
238
+ # @param options [::Gapic::CallOptions, ::Hash]
239
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
240
+ #
241
+ # @overload get_patch_job(name: nil)
242
+ # Pass arguments to `get_patch_job` via keyword arguments. Note that at
243
+ # least one keyword argument is required. To specify no parameters, or to keep all
244
+ # the default parameter values, pass an empty Hash as a request object (see above).
245
+ #
246
+ # @param name [::String]
247
+ # Required. Name of the patch in the form `projects/*/patchJobs/*`
248
+ # @yield [result, operation] Access the result along with the TransportOperation object
249
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchJob]
250
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
251
+ #
252
+ # @return [::Google::Cloud::OsConfig::V1::PatchJob]
253
+ #
254
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
255
+ def get_patch_job request, options = nil
256
+ raise ::ArgumentError, "request must be provided" if request.nil?
257
+
258
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetPatchJobRequest
259
+
260
+ # Converts hash and nil to an options object
261
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
262
+
263
+ # Customize the options with defaults
264
+ call_metadata = @config.rpcs.get_patch_job.metadata.to_h
265
+
266
+ # Set x-goog-api-client and x-goog-user-project headers
267
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
268
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
269
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
270
+ transports_version_send: [:rest]
271
+
272
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
273
+
274
+ options.apply_defaults timeout: @config.rpcs.get_patch_job.timeout,
275
+ metadata: call_metadata,
276
+ retry_policy: @config.rpcs.get_patch_job.retry_policy
277
+
278
+ options.apply_defaults timeout: @config.timeout,
279
+ metadata: @config.metadata,
280
+ retry_policy: @config.retry_policy
281
+
282
+ @os_config_service_stub.get_patch_job request, options do |result, operation|
283
+ yield result, operation if block_given?
284
+ return result
285
+ end
286
+ rescue ::Gapic::Rest::Error => e
287
+ raise ::Google::Cloud::Error.from_error(e)
288
+ end
289
+
290
+ ##
291
+ # Cancel a patch job. The patch job must be active. Canceled patch jobs
292
+ # cannot be restarted.
293
+ #
294
+ # @overload cancel_patch_job(request, options = nil)
295
+ # Pass arguments to `cancel_patch_job` via a request object, either of type
296
+ # {::Google::Cloud::OsConfig::V1::CancelPatchJobRequest} or an equivalent Hash.
297
+ #
298
+ # @param request [::Google::Cloud::OsConfig::V1::CancelPatchJobRequest, ::Hash]
299
+ # A request object representing the call parameters. Required. To specify no
300
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
301
+ # @param options [::Gapic::CallOptions, ::Hash]
302
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
303
+ #
304
+ # @overload cancel_patch_job(name: nil)
305
+ # Pass arguments to `cancel_patch_job` via keyword arguments. Note that at
306
+ # least one keyword argument is required. To specify no parameters, or to keep all
307
+ # the default parameter values, pass an empty Hash as a request object (see above).
308
+ #
309
+ # @param name [::String]
310
+ # Required. Name of the patch in the form `projects/*/patchJobs/*`
311
+ # @yield [result, operation] Access the result along with the TransportOperation object
312
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchJob]
313
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
314
+ #
315
+ # @return [::Google::Cloud::OsConfig::V1::PatchJob]
316
+ #
317
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
318
+ def cancel_patch_job request, options = nil
319
+ raise ::ArgumentError, "request must be provided" if request.nil?
320
+
321
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::CancelPatchJobRequest
322
+
323
+ # Converts hash and nil to an options object
324
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
325
+
326
+ # Customize the options with defaults
327
+ call_metadata = @config.rpcs.cancel_patch_job.metadata.to_h
328
+
329
+ # Set x-goog-api-client and x-goog-user-project headers
330
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
331
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
332
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
333
+ transports_version_send: [:rest]
334
+
335
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
336
+
337
+ options.apply_defaults timeout: @config.rpcs.cancel_patch_job.timeout,
338
+ metadata: call_metadata,
339
+ retry_policy: @config.rpcs.cancel_patch_job.retry_policy
340
+
341
+ options.apply_defaults timeout: @config.timeout,
342
+ metadata: @config.metadata,
343
+ retry_policy: @config.retry_policy
344
+
345
+ @os_config_service_stub.cancel_patch_job request, options do |result, operation|
346
+ yield result, operation if block_given?
347
+ return result
348
+ end
349
+ rescue ::Gapic::Rest::Error => e
350
+ raise ::Google::Cloud::Error.from_error(e)
351
+ end
352
+
353
+ ##
354
+ # Get a list of patch jobs.
355
+ #
356
+ # @overload list_patch_jobs(request, options = nil)
357
+ # Pass arguments to `list_patch_jobs` via a request object, either of type
358
+ # {::Google::Cloud::OsConfig::V1::ListPatchJobsRequest} or an equivalent Hash.
359
+ #
360
+ # @param request [::Google::Cloud::OsConfig::V1::ListPatchJobsRequest, ::Hash]
361
+ # A request object representing the call parameters. Required. To specify no
362
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
363
+ # @param options [::Gapic::CallOptions, ::Hash]
364
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
365
+ #
366
+ # @overload list_patch_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil)
367
+ # Pass arguments to `list_patch_jobs` via keyword arguments. Note that at
368
+ # least one keyword argument is required. To specify no parameters, or to keep all
369
+ # the default parameter values, pass an empty Hash as a request object (see above).
370
+ #
371
+ # @param parent [::String]
372
+ # Required. In the form of `projects/*`
373
+ # @param page_size [::Integer]
374
+ # The maximum number of instance status to return.
375
+ # @param page_token [::String]
376
+ # A pagination token returned from a previous call
377
+ # that indicates where this listing should continue from.
378
+ # @param filter [::String]
379
+ # If provided, this field specifies the criteria that must be met by patch
380
+ # jobs to be included in the response.
381
+ # Currently, filtering is only available on the patch_deployment field.
382
+ # @yield [result, operation] Access the result along with the TransportOperation object
383
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJob>]
384
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
385
+ #
386
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJob>]
387
+ #
388
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
389
+ def list_patch_jobs request, options = nil
390
+ raise ::ArgumentError, "request must be provided" if request.nil?
391
+
392
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListPatchJobsRequest
393
+
394
+ # Converts hash and nil to an options object
395
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
396
+
397
+ # Customize the options with defaults
398
+ call_metadata = @config.rpcs.list_patch_jobs.metadata.to_h
399
+
400
+ # Set x-goog-api-client and x-goog-user-project headers
401
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
402
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
403
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
404
+ transports_version_send: [:rest]
405
+
406
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
407
+
408
+ options.apply_defaults timeout: @config.rpcs.list_patch_jobs.timeout,
409
+ metadata: call_metadata,
410
+ retry_policy: @config.rpcs.list_patch_jobs.retry_policy
411
+
412
+ options.apply_defaults timeout: @config.timeout,
413
+ metadata: @config.metadata,
414
+ retry_policy: @config.retry_policy
415
+
416
+ @os_config_service_stub.list_patch_jobs request, options do |result, operation|
417
+ result = ::Gapic::Rest::PagedEnumerable.new @os_config_service_stub, :list_patch_jobs, "patch_jobs", request, result, options
418
+ yield result, operation if block_given?
419
+ return result
420
+ end
421
+ rescue ::Gapic::Rest::Error => e
422
+ raise ::Google::Cloud::Error.from_error(e)
423
+ end
424
+
425
+ ##
426
+ # Get a list of instance details for a given patch job.
427
+ #
428
+ # @overload list_patch_job_instance_details(request, options = nil)
429
+ # Pass arguments to `list_patch_job_instance_details` via a request object, either of type
430
+ # {::Google::Cloud::OsConfig::V1::ListPatchJobInstanceDetailsRequest} or an equivalent Hash.
431
+ #
432
+ # @param request [::Google::Cloud::OsConfig::V1::ListPatchJobInstanceDetailsRequest, ::Hash]
433
+ # A request object representing the call parameters. Required. To specify no
434
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
435
+ # @param options [::Gapic::CallOptions, ::Hash]
436
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
437
+ #
438
+ # @overload list_patch_job_instance_details(parent: nil, page_size: nil, page_token: nil, filter: nil)
439
+ # Pass arguments to `list_patch_job_instance_details` via keyword arguments. Note that at
440
+ # least one keyword argument is required. To specify no parameters, or to keep all
441
+ # the default parameter values, pass an empty Hash as a request object (see above).
442
+ #
443
+ # @param parent [::String]
444
+ # Required. The parent for the instances are in the form of
445
+ # `projects/*/patchJobs/*`.
446
+ # @param page_size [::Integer]
447
+ # The maximum number of instance details records to return. Default is 100.
448
+ # @param page_token [::String]
449
+ # A pagination token returned from a previous call
450
+ # that indicates where this listing should continue from.
451
+ # @param filter [::String]
452
+ # A filter expression that filters results listed in the response. This
453
+ # field supports filtering results by instance zone, name, state, or
454
+ # `failure_reason`.
455
+ # @yield [result, operation] Access the result along with the TransportOperation object
456
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJobInstanceDetails>]
457
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
458
+ #
459
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJobInstanceDetails>]
460
+ #
461
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
462
+ def list_patch_job_instance_details request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListPatchJobInstanceDetailsRequest
466
+
467
+ # Converts hash and nil to an options object
468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
469
+
470
+ # Customize the options with defaults
471
+ call_metadata = @config.rpcs.list_patch_job_instance_details.metadata.to_h
472
+
473
+ # Set x-goog-api-client and x-goog-user-project headers
474
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
476
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
477
+ transports_version_send: [:rest]
478
+
479
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
480
+
481
+ options.apply_defaults timeout: @config.rpcs.list_patch_job_instance_details.timeout,
482
+ metadata: call_metadata,
483
+ retry_policy: @config.rpcs.list_patch_job_instance_details.retry_policy
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
487
+ retry_policy: @config.retry_policy
488
+
489
+ @os_config_service_stub.list_patch_job_instance_details request, options do |result, operation|
490
+ result = ::Gapic::Rest::PagedEnumerable.new @os_config_service_stub, :list_patch_job_instance_details, "patch_job_instance_details", request, result, options
491
+ yield result, operation if block_given?
492
+ return result
493
+ end
494
+ rescue ::Gapic::Rest::Error => e
495
+ raise ::Google::Cloud::Error.from_error(e)
496
+ end
497
+
498
+ ##
499
+ # Create an OS Config patch deployment.
500
+ #
501
+ # @overload create_patch_deployment(request, options = nil)
502
+ # Pass arguments to `create_patch_deployment` via a request object, either of type
503
+ # {::Google::Cloud::OsConfig::V1::CreatePatchDeploymentRequest} or an equivalent Hash.
504
+ #
505
+ # @param request [::Google::Cloud::OsConfig::V1::CreatePatchDeploymentRequest, ::Hash]
506
+ # A request object representing the call parameters. Required. To specify no
507
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
508
+ # @param options [::Gapic::CallOptions, ::Hash]
509
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
510
+ #
511
+ # @overload create_patch_deployment(parent: nil, patch_deployment_id: nil, patch_deployment: nil)
512
+ # Pass arguments to `create_patch_deployment` via keyword arguments. Note that at
513
+ # least one keyword argument is required. To specify no parameters, or to keep all
514
+ # the default parameter values, pass an empty Hash as a request object (see above).
515
+ #
516
+ # @param parent [::String]
517
+ # Required. The project to apply this patch deployment to in the form
518
+ # `projects/*`.
519
+ # @param patch_deployment_id [::String]
520
+ # Required. A name for the patch deployment in the project. When creating a
521
+ # name the following rules apply:
522
+ # * Must contain only lowercase letters, numbers, and hyphens.
523
+ # * Must start with a letter.
524
+ # * Must be between 1-63 characters.
525
+ # * Must end with a number or a letter.
526
+ # * Must be unique within the project.
527
+ # @param patch_deployment [::Google::Cloud::OsConfig::V1::PatchDeployment, ::Hash]
528
+ # Required. The patch deployment to create.
529
+ # @yield [result, operation] Access the result along with the TransportOperation object
530
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchDeployment]
531
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
532
+ #
533
+ # @return [::Google::Cloud::OsConfig::V1::PatchDeployment]
534
+ #
535
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
536
+ def create_patch_deployment request, options = nil
537
+ raise ::ArgumentError, "request must be provided" if request.nil?
538
+
539
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::CreatePatchDeploymentRequest
540
+
541
+ # Converts hash and nil to an options object
542
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
543
+
544
+ # Customize the options with defaults
545
+ call_metadata = @config.rpcs.create_patch_deployment.metadata.to_h
546
+
547
+ # Set x-goog-api-client and x-goog-user-project headers
548
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
549
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
550
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
551
+ transports_version_send: [:rest]
552
+
553
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
554
+
555
+ options.apply_defaults timeout: @config.rpcs.create_patch_deployment.timeout,
556
+ metadata: call_metadata,
557
+ retry_policy: @config.rpcs.create_patch_deployment.retry_policy
558
+
559
+ options.apply_defaults timeout: @config.timeout,
560
+ metadata: @config.metadata,
561
+ retry_policy: @config.retry_policy
562
+
563
+ @os_config_service_stub.create_patch_deployment request, options do |result, operation|
564
+ yield result, operation if block_given?
565
+ return result
566
+ end
567
+ rescue ::Gapic::Rest::Error => e
568
+ raise ::Google::Cloud::Error.from_error(e)
569
+ end
570
+
571
+ ##
572
+ # Get an OS Config patch deployment.
573
+ #
574
+ # @overload get_patch_deployment(request, options = nil)
575
+ # Pass arguments to `get_patch_deployment` via a request object, either of type
576
+ # {::Google::Cloud::OsConfig::V1::GetPatchDeploymentRequest} or an equivalent Hash.
577
+ #
578
+ # @param request [::Google::Cloud::OsConfig::V1::GetPatchDeploymentRequest, ::Hash]
579
+ # A request object representing the call parameters. Required. To specify no
580
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
581
+ # @param options [::Gapic::CallOptions, ::Hash]
582
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
583
+ #
584
+ # @overload get_patch_deployment(name: nil)
585
+ # Pass arguments to `get_patch_deployment` via keyword arguments. Note that at
586
+ # least one keyword argument is required. To specify no parameters, or to keep all
587
+ # the default parameter values, pass an empty Hash as a request object (see above).
588
+ #
589
+ # @param name [::String]
590
+ # Required. The resource name of the patch deployment in the form
591
+ # `projects/*/patchDeployments/*`.
592
+ # @yield [result, operation] Access the result along with the TransportOperation object
593
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchDeployment]
594
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
595
+ #
596
+ # @return [::Google::Cloud::OsConfig::V1::PatchDeployment]
597
+ #
598
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
599
+ def get_patch_deployment request, options = nil
600
+ raise ::ArgumentError, "request must be provided" if request.nil?
601
+
602
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetPatchDeploymentRequest
603
+
604
+ # Converts hash and nil to an options object
605
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
606
+
607
+ # Customize the options with defaults
608
+ call_metadata = @config.rpcs.get_patch_deployment.metadata.to_h
609
+
610
+ # Set x-goog-api-client and x-goog-user-project headers
611
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
612
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
613
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
614
+ transports_version_send: [:rest]
615
+
616
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
617
+
618
+ options.apply_defaults timeout: @config.rpcs.get_patch_deployment.timeout,
619
+ metadata: call_metadata,
620
+ retry_policy: @config.rpcs.get_patch_deployment.retry_policy
621
+
622
+ options.apply_defaults timeout: @config.timeout,
623
+ metadata: @config.metadata,
624
+ retry_policy: @config.retry_policy
625
+
626
+ @os_config_service_stub.get_patch_deployment request, options do |result, operation|
627
+ yield result, operation if block_given?
628
+ return result
629
+ end
630
+ rescue ::Gapic::Rest::Error => e
631
+ raise ::Google::Cloud::Error.from_error(e)
632
+ end
633
+
634
+ ##
635
+ # Get a page of OS Config patch deployments.
636
+ #
637
+ # @overload list_patch_deployments(request, options = nil)
638
+ # Pass arguments to `list_patch_deployments` via a request object, either of type
639
+ # {::Google::Cloud::OsConfig::V1::ListPatchDeploymentsRequest} or an equivalent Hash.
640
+ #
641
+ # @param request [::Google::Cloud::OsConfig::V1::ListPatchDeploymentsRequest, ::Hash]
642
+ # A request object representing the call parameters. Required. To specify no
643
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
644
+ # @param options [::Gapic::CallOptions, ::Hash]
645
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
646
+ #
647
+ # @overload list_patch_deployments(parent: nil, page_size: nil, page_token: nil)
648
+ # Pass arguments to `list_patch_deployments` via keyword arguments. Note that at
649
+ # least one keyword argument is required. To specify no parameters, or to keep all
650
+ # the default parameter values, pass an empty Hash as a request object (see above).
651
+ #
652
+ # @param parent [::String]
653
+ # Required. The resource name of the parent in the form `projects/*`.
654
+ # @param page_size [::Integer]
655
+ # Optional. The maximum number of patch deployments to return. Default is
656
+ # 100.
657
+ # @param page_token [::String]
658
+ # Optional. A pagination token returned from a previous call to
659
+ # ListPatchDeployments that indicates where this listing should continue
660
+ # from.
661
+ # @yield [result, operation] Access the result along with the TransportOperation object
662
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchDeployment>]
663
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
664
+ #
665
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchDeployment>]
666
+ #
667
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
668
+ def list_patch_deployments request, options = nil
669
+ raise ::ArgumentError, "request must be provided" if request.nil?
670
+
671
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListPatchDeploymentsRequest
672
+
673
+ # Converts hash and nil to an options object
674
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
675
+
676
+ # Customize the options with defaults
677
+ call_metadata = @config.rpcs.list_patch_deployments.metadata.to_h
678
+
679
+ # Set x-goog-api-client and x-goog-user-project headers
680
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
681
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
682
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
683
+ transports_version_send: [:rest]
684
+
685
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
686
+
687
+ options.apply_defaults timeout: @config.rpcs.list_patch_deployments.timeout,
688
+ metadata: call_metadata,
689
+ retry_policy: @config.rpcs.list_patch_deployments.retry_policy
690
+
691
+ options.apply_defaults timeout: @config.timeout,
692
+ metadata: @config.metadata,
693
+ retry_policy: @config.retry_policy
694
+
695
+ @os_config_service_stub.list_patch_deployments request, options do |result, operation|
696
+ result = ::Gapic::Rest::PagedEnumerable.new @os_config_service_stub, :list_patch_deployments, "patch_deployments", request, result, options
697
+ yield result, operation if block_given?
698
+ return result
699
+ end
700
+ rescue ::Gapic::Rest::Error => e
701
+ raise ::Google::Cloud::Error.from_error(e)
702
+ end
703
+
704
+ ##
705
+ # Delete an OS Config patch deployment.
706
+ #
707
+ # @overload delete_patch_deployment(request, options = nil)
708
+ # Pass arguments to `delete_patch_deployment` via a request object, either of type
709
+ # {::Google::Cloud::OsConfig::V1::DeletePatchDeploymentRequest} or an equivalent Hash.
710
+ #
711
+ # @param request [::Google::Cloud::OsConfig::V1::DeletePatchDeploymentRequest, ::Hash]
712
+ # A request object representing the call parameters. Required. To specify no
713
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
714
+ # @param options [::Gapic::CallOptions, ::Hash]
715
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
716
+ #
717
+ # @overload delete_patch_deployment(name: nil)
718
+ # Pass arguments to `delete_patch_deployment` via keyword arguments. Note that at
719
+ # least one keyword argument is required. To specify no parameters, or to keep all
720
+ # the default parameter values, pass an empty Hash as a request object (see above).
721
+ #
722
+ # @param name [::String]
723
+ # Required. The resource name of the patch deployment in the form
724
+ # `projects/*/patchDeployments/*`.
725
+ # @yield [result, operation] Access the result along with the TransportOperation object
726
+ # @yieldparam result [::Google::Protobuf::Empty]
727
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
728
+ #
729
+ # @return [::Google::Protobuf::Empty]
730
+ #
731
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
732
+ def delete_patch_deployment request, options = nil
733
+ raise ::ArgumentError, "request must be provided" if request.nil?
734
+
735
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::DeletePatchDeploymentRequest
736
+
737
+ # Converts hash and nil to an options object
738
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
739
+
740
+ # Customize the options with defaults
741
+ call_metadata = @config.rpcs.delete_patch_deployment.metadata.to_h
742
+
743
+ # Set x-goog-api-client and x-goog-user-project headers
744
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
745
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
746
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
747
+ transports_version_send: [:rest]
748
+
749
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
750
+
751
+ options.apply_defaults timeout: @config.rpcs.delete_patch_deployment.timeout,
752
+ metadata: call_metadata,
753
+ retry_policy: @config.rpcs.delete_patch_deployment.retry_policy
754
+
755
+ options.apply_defaults timeout: @config.timeout,
756
+ metadata: @config.metadata,
757
+ retry_policy: @config.retry_policy
758
+
759
+ @os_config_service_stub.delete_patch_deployment request, options do |result, operation|
760
+ yield result, operation if block_given?
761
+ return result
762
+ end
763
+ rescue ::Gapic::Rest::Error => e
764
+ raise ::Google::Cloud::Error.from_error(e)
765
+ end
766
+
767
+ ##
768
+ # Update an OS Config patch deployment.
769
+ #
770
+ # @overload update_patch_deployment(request, options = nil)
771
+ # Pass arguments to `update_patch_deployment` via a request object, either of type
772
+ # {::Google::Cloud::OsConfig::V1::UpdatePatchDeploymentRequest} or an equivalent Hash.
773
+ #
774
+ # @param request [::Google::Cloud::OsConfig::V1::UpdatePatchDeploymentRequest, ::Hash]
775
+ # A request object representing the call parameters. Required. To specify no
776
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
777
+ # @param options [::Gapic::CallOptions, ::Hash]
778
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
779
+ #
780
+ # @overload update_patch_deployment(patch_deployment: nil, update_mask: nil)
781
+ # Pass arguments to `update_patch_deployment` via keyword arguments. Note that at
782
+ # least one keyword argument is required. To specify no parameters, or to keep all
783
+ # the default parameter values, pass an empty Hash as a request object (see above).
784
+ #
785
+ # @param patch_deployment [::Google::Cloud::OsConfig::V1::PatchDeployment, ::Hash]
786
+ # Required. The patch deployment to Update.
787
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
788
+ # Optional. Field mask that controls which fields of the patch deployment
789
+ # should be updated.
790
+ # @yield [result, operation] Access the result along with the TransportOperation object
791
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchDeployment]
792
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
793
+ #
794
+ # @return [::Google::Cloud::OsConfig::V1::PatchDeployment]
795
+ #
796
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
797
+ def update_patch_deployment request, options = nil
798
+ raise ::ArgumentError, "request must be provided" if request.nil?
799
+
800
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::UpdatePatchDeploymentRequest
801
+
802
+ # Converts hash and nil to an options object
803
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
804
+
805
+ # Customize the options with defaults
806
+ call_metadata = @config.rpcs.update_patch_deployment.metadata.to_h
807
+
808
+ # Set x-goog-api-client and x-goog-user-project headers
809
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
810
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
811
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
812
+ transports_version_send: [:rest]
813
+
814
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
815
+
816
+ options.apply_defaults timeout: @config.rpcs.update_patch_deployment.timeout,
817
+ metadata: call_metadata,
818
+ retry_policy: @config.rpcs.update_patch_deployment.retry_policy
819
+
820
+ options.apply_defaults timeout: @config.timeout,
821
+ metadata: @config.metadata,
822
+ retry_policy: @config.retry_policy
823
+
824
+ @os_config_service_stub.update_patch_deployment request, options do |result, operation|
825
+ yield result, operation if block_given?
826
+ return result
827
+ end
828
+ rescue ::Gapic::Rest::Error => e
829
+ raise ::Google::Cloud::Error.from_error(e)
830
+ end
831
+
832
+ ##
833
+ # Change state of patch deployment to "PAUSED".
834
+ # Patch deployment in paused state doesn't generate patch jobs.
835
+ #
836
+ # @overload pause_patch_deployment(request, options = nil)
837
+ # Pass arguments to `pause_patch_deployment` via a request object, either of type
838
+ # {::Google::Cloud::OsConfig::V1::PausePatchDeploymentRequest} or an equivalent Hash.
839
+ #
840
+ # @param request [::Google::Cloud::OsConfig::V1::PausePatchDeploymentRequest, ::Hash]
841
+ # A request object representing the call parameters. Required. To specify no
842
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
843
+ # @param options [::Gapic::CallOptions, ::Hash]
844
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
845
+ #
846
+ # @overload pause_patch_deployment(name: nil)
847
+ # Pass arguments to `pause_patch_deployment` via keyword arguments. Note that at
848
+ # least one keyword argument is required. To specify no parameters, or to keep all
849
+ # the default parameter values, pass an empty Hash as a request object (see above).
850
+ #
851
+ # @param name [::String]
852
+ # Required. The resource name of the patch deployment in the form
853
+ # `projects/*/patchDeployments/*`.
854
+ # @yield [result, operation] Access the result along with the TransportOperation object
855
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchDeployment]
856
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
857
+ #
858
+ # @return [::Google::Cloud::OsConfig::V1::PatchDeployment]
859
+ #
860
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
861
+ def pause_patch_deployment request, options = nil
862
+ raise ::ArgumentError, "request must be provided" if request.nil?
863
+
864
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::PausePatchDeploymentRequest
865
+
866
+ # Converts hash and nil to an options object
867
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
868
+
869
+ # Customize the options with defaults
870
+ call_metadata = @config.rpcs.pause_patch_deployment.metadata.to_h
871
+
872
+ # Set x-goog-api-client and x-goog-user-project headers
873
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
874
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
875
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
876
+ transports_version_send: [:rest]
877
+
878
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
879
+
880
+ options.apply_defaults timeout: @config.rpcs.pause_patch_deployment.timeout,
881
+ metadata: call_metadata,
882
+ retry_policy: @config.rpcs.pause_patch_deployment.retry_policy
883
+
884
+ options.apply_defaults timeout: @config.timeout,
885
+ metadata: @config.metadata,
886
+ retry_policy: @config.retry_policy
887
+
888
+ @os_config_service_stub.pause_patch_deployment request, options do |result, operation|
889
+ yield result, operation if block_given?
890
+ return result
891
+ end
892
+ rescue ::Gapic::Rest::Error => e
893
+ raise ::Google::Cloud::Error.from_error(e)
894
+ end
895
+
896
+ ##
897
+ # Change state of patch deployment back to "ACTIVE".
898
+ # Patch deployment in active state continues to generate patch jobs.
899
+ #
900
+ # @overload resume_patch_deployment(request, options = nil)
901
+ # Pass arguments to `resume_patch_deployment` via a request object, either of type
902
+ # {::Google::Cloud::OsConfig::V1::ResumePatchDeploymentRequest} or an equivalent Hash.
903
+ #
904
+ # @param request [::Google::Cloud::OsConfig::V1::ResumePatchDeploymentRequest, ::Hash]
905
+ # A request object representing the call parameters. Required. To specify no
906
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
907
+ # @param options [::Gapic::CallOptions, ::Hash]
908
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
909
+ #
910
+ # @overload resume_patch_deployment(name: nil)
911
+ # Pass arguments to `resume_patch_deployment` via keyword arguments. Note that at
912
+ # least one keyword argument is required. To specify no parameters, or to keep all
913
+ # the default parameter values, pass an empty Hash as a request object (see above).
914
+ #
915
+ # @param name [::String]
916
+ # Required. The resource name of the patch deployment in the form
917
+ # `projects/*/patchDeployments/*`.
918
+ # @yield [result, operation] Access the result along with the TransportOperation object
919
+ # @yieldparam result [::Google::Cloud::OsConfig::V1::PatchDeployment]
920
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
921
+ #
922
+ # @return [::Google::Cloud::OsConfig::V1::PatchDeployment]
923
+ #
924
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
925
+ def resume_patch_deployment request, options = nil
926
+ raise ::ArgumentError, "request must be provided" if request.nil?
927
+
928
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ResumePatchDeploymentRequest
929
+
930
+ # Converts hash and nil to an options object
931
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
932
+
933
+ # Customize the options with defaults
934
+ call_metadata = @config.rpcs.resume_patch_deployment.metadata.to_h
935
+
936
+ # Set x-goog-api-client and x-goog-user-project headers
937
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
938
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
939
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION,
940
+ transports_version_send: [:rest]
941
+
942
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
943
+
944
+ options.apply_defaults timeout: @config.rpcs.resume_patch_deployment.timeout,
945
+ metadata: call_metadata,
946
+ retry_policy: @config.rpcs.resume_patch_deployment.retry_policy
947
+
948
+ options.apply_defaults timeout: @config.timeout,
949
+ metadata: @config.metadata,
950
+ retry_policy: @config.retry_policy
951
+
952
+ @os_config_service_stub.resume_patch_deployment request, options do |result, operation|
953
+ yield result, operation if block_given?
954
+ return result
955
+ end
956
+ rescue ::Gapic::Rest::Error => e
957
+ raise ::Google::Cloud::Error.from_error(e)
958
+ end
959
+
960
+ ##
961
+ # Configuration class for the OsConfigService REST API.
962
+ #
963
+ # This class represents the configuration for OsConfigService REST,
964
+ # providing control over timeouts, retry behavior, logging, transport
965
+ # parameters, and other low-level controls. Certain parameters can also be
966
+ # applied individually to specific RPCs. See
967
+ # {::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client::Configuration::Rpcs}
968
+ # for a list of RPCs that can be configured independently.
969
+ #
970
+ # Configuration can be applied globally to all clients, or to a single client
971
+ # on construction.
972
+ #
973
+ # @example
974
+ #
975
+ # # Modify the global config, setting the timeout for
976
+ # # execute_patch_job to 20 seconds,
977
+ # # and all remaining timeouts to 10 seconds.
978
+ # ::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client.configure do |config|
979
+ # config.timeout = 10.0
980
+ # config.rpcs.execute_patch_job.timeout = 20.0
981
+ # end
982
+ #
983
+ # # Apply the above configuration only to a new client.
984
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Rest::Client.new do |config|
985
+ # config.timeout = 10.0
986
+ # config.rpcs.execute_patch_job.timeout = 20.0
987
+ # end
988
+ #
989
+ # @!attribute [rw] endpoint
990
+ # The hostname or hostname:port of the service endpoint.
991
+ # Defaults to `"osconfig.googleapis.com"`.
992
+ # @return [::String]
993
+ # @!attribute [rw] credentials
994
+ # Credentials to send with calls. You may provide any of the following types:
995
+ # * (`String`) The path to a service account key file in JSON format
996
+ # * (`Hash`) A service account key as a Hash
997
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
998
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
999
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1000
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1001
+ # * (`nil`) indicating no credentials
1002
+ # @return [::Object]
1003
+ # @!attribute [rw] scope
1004
+ # The OAuth scopes
1005
+ # @return [::Array<::String>]
1006
+ # @!attribute [rw] lib_name
1007
+ # The library name as recorded in instrumentation and logging
1008
+ # @return [::String]
1009
+ # @!attribute [rw] lib_version
1010
+ # The library version as recorded in instrumentation and logging
1011
+ # @return [::String]
1012
+ # @!attribute [rw] timeout
1013
+ # The call timeout in seconds.
1014
+ # @return [::Numeric]
1015
+ # @!attribute [rw] metadata
1016
+ # Additional headers to be sent with the call.
1017
+ # @return [::Hash{::Symbol=>::String}]
1018
+ # @!attribute [rw] retry_policy
1019
+ # The retry policy. The value is a hash with the following keys:
1020
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1021
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1022
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1023
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1024
+ # trigger a retry.
1025
+ # @return [::Hash]
1026
+ # @!attribute [rw] quota_project
1027
+ # A separate project against which to charge quota.
1028
+ # @return [::String]
1029
+ #
1030
+ class Configuration
1031
+ extend ::Gapic::Config
1032
+
1033
+ config_attr :endpoint, "osconfig.googleapis.com", ::String
1034
+ config_attr :credentials, nil do |value|
1035
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1036
+ allowed.any? { |klass| klass === value }
1037
+ end
1038
+ config_attr :scope, nil, ::String, ::Array, nil
1039
+ config_attr :lib_name, nil, ::String, nil
1040
+ config_attr :lib_version, nil, ::String, nil
1041
+ config_attr :timeout, nil, ::Numeric, nil
1042
+ config_attr :metadata, nil, ::Hash, nil
1043
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1044
+ config_attr :quota_project, nil, ::String, nil
1045
+
1046
+ # @private
1047
+ def initialize parent_config = nil
1048
+ @parent_config = parent_config unless parent_config.nil?
1049
+
1050
+ yield self if block_given?
1051
+ end
1052
+
1053
+ ##
1054
+ # Configurations for individual RPCs
1055
+ # @return [Rpcs]
1056
+ #
1057
+ def rpcs
1058
+ @rpcs ||= begin
1059
+ parent_rpcs = nil
1060
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1061
+ Rpcs.new parent_rpcs
1062
+ end
1063
+ end
1064
+
1065
+ ##
1066
+ # Configuration RPC class for the OsConfigService API.
1067
+ #
1068
+ # Includes fields providing the configuration for each RPC in this service.
1069
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1070
+ # the following configuration fields:
1071
+ #
1072
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1073
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1074
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1075
+ # include the following keys:
1076
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1077
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1078
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1079
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1080
+ # trigger a retry.
1081
+ #
1082
+ class Rpcs
1083
+ ##
1084
+ # RPC-specific configuration for `execute_patch_job`
1085
+ # @return [::Gapic::Config::Method]
1086
+ #
1087
+ attr_reader :execute_patch_job
1088
+ ##
1089
+ # RPC-specific configuration for `get_patch_job`
1090
+ # @return [::Gapic::Config::Method]
1091
+ #
1092
+ attr_reader :get_patch_job
1093
+ ##
1094
+ # RPC-specific configuration for `cancel_patch_job`
1095
+ # @return [::Gapic::Config::Method]
1096
+ #
1097
+ attr_reader :cancel_patch_job
1098
+ ##
1099
+ # RPC-specific configuration for `list_patch_jobs`
1100
+ # @return [::Gapic::Config::Method]
1101
+ #
1102
+ attr_reader :list_patch_jobs
1103
+ ##
1104
+ # RPC-specific configuration for `list_patch_job_instance_details`
1105
+ # @return [::Gapic::Config::Method]
1106
+ #
1107
+ attr_reader :list_patch_job_instance_details
1108
+ ##
1109
+ # RPC-specific configuration for `create_patch_deployment`
1110
+ # @return [::Gapic::Config::Method]
1111
+ #
1112
+ attr_reader :create_patch_deployment
1113
+ ##
1114
+ # RPC-specific configuration for `get_patch_deployment`
1115
+ # @return [::Gapic::Config::Method]
1116
+ #
1117
+ attr_reader :get_patch_deployment
1118
+ ##
1119
+ # RPC-specific configuration for `list_patch_deployments`
1120
+ # @return [::Gapic::Config::Method]
1121
+ #
1122
+ attr_reader :list_patch_deployments
1123
+ ##
1124
+ # RPC-specific configuration for `delete_patch_deployment`
1125
+ # @return [::Gapic::Config::Method]
1126
+ #
1127
+ attr_reader :delete_patch_deployment
1128
+ ##
1129
+ # RPC-specific configuration for `update_patch_deployment`
1130
+ # @return [::Gapic::Config::Method]
1131
+ #
1132
+ attr_reader :update_patch_deployment
1133
+ ##
1134
+ # RPC-specific configuration for `pause_patch_deployment`
1135
+ # @return [::Gapic::Config::Method]
1136
+ #
1137
+ attr_reader :pause_patch_deployment
1138
+ ##
1139
+ # RPC-specific configuration for `resume_patch_deployment`
1140
+ # @return [::Gapic::Config::Method]
1141
+ #
1142
+ attr_reader :resume_patch_deployment
1143
+
1144
+ # @private
1145
+ def initialize parent_rpcs = nil
1146
+ execute_patch_job_config = parent_rpcs.execute_patch_job if parent_rpcs.respond_to? :execute_patch_job
1147
+ @execute_patch_job = ::Gapic::Config::Method.new execute_patch_job_config
1148
+ get_patch_job_config = parent_rpcs.get_patch_job if parent_rpcs.respond_to? :get_patch_job
1149
+ @get_patch_job = ::Gapic::Config::Method.new get_patch_job_config
1150
+ cancel_patch_job_config = parent_rpcs.cancel_patch_job if parent_rpcs.respond_to? :cancel_patch_job
1151
+ @cancel_patch_job = ::Gapic::Config::Method.new cancel_patch_job_config
1152
+ list_patch_jobs_config = parent_rpcs.list_patch_jobs if parent_rpcs.respond_to? :list_patch_jobs
1153
+ @list_patch_jobs = ::Gapic::Config::Method.new list_patch_jobs_config
1154
+ list_patch_job_instance_details_config = parent_rpcs.list_patch_job_instance_details if parent_rpcs.respond_to? :list_patch_job_instance_details
1155
+ @list_patch_job_instance_details = ::Gapic::Config::Method.new list_patch_job_instance_details_config
1156
+ create_patch_deployment_config = parent_rpcs.create_patch_deployment if parent_rpcs.respond_to? :create_patch_deployment
1157
+ @create_patch_deployment = ::Gapic::Config::Method.new create_patch_deployment_config
1158
+ get_patch_deployment_config = parent_rpcs.get_patch_deployment if parent_rpcs.respond_to? :get_patch_deployment
1159
+ @get_patch_deployment = ::Gapic::Config::Method.new get_patch_deployment_config
1160
+ list_patch_deployments_config = parent_rpcs.list_patch_deployments if parent_rpcs.respond_to? :list_patch_deployments
1161
+ @list_patch_deployments = ::Gapic::Config::Method.new list_patch_deployments_config
1162
+ delete_patch_deployment_config = parent_rpcs.delete_patch_deployment if parent_rpcs.respond_to? :delete_patch_deployment
1163
+ @delete_patch_deployment = ::Gapic::Config::Method.new delete_patch_deployment_config
1164
+ update_patch_deployment_config = parent_rpcs.update_patch_deployment if parent_rpcs.respond_to? :update_patch_deployment
1165
+ @update_patch_deployment = ::Gapic::Config::Method.new update_patch_deployment_config
1166
+ pause_patch_deployment_config = parent_rpcs.pause_patch_deployment if parent_rpcs.respond_to? :pause_patch_deployment
1167
+ @pause_patch_deployment = ::Gapic::Config::Method.new pause_patch_deployment_config
1168
+ resume_patch_deployment_config = parent_rpcs.resume_patch_deployment if parent_rpcs.respond_to? :resume_patch_deployment
1169
+ @resume_patch_deployment = ::Gapic::Config::Method.new resume_patch_deployment_config
1170
+
1171
+ yield self if block_given?
1172
+ end
1173
+ end
1174
+ end
1175
+ end
1176
+ end
1177
+ end
1178
+ end
1179
+ end
1180
+ end
1181
+ end