google-cloud-os_config-v1 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d9187f869fcaaca31c9ca726624e3e13ada724a95067cb08d04991e18593f77
4
- data.tar.gz: 0c610a02c6eeab23bc6bfa93c72b5f3d4449d99758e2d2785401de0b3e11b41a
3
+ metadata.gz: d742eb250c9190770302ad81e788f8355d3f3d475541419db5b0b33bc44ec993
4
+ data.tar.gz: b61528b8fc1cc2ec3809ad41e8112e5590bfc69dcc2cf59574320bebbc80c8b0
5
5
  SHA512:
6
- metadata.gz: cf9a8a77ee20dd0a749e4c9623902b30506eb2903d4676700fd009eabca8fee14d4327834aa817edbfab8567e39ae93445435d58dd9177b6568c97073cb977d8
7
- data.tar.gz: 953f3ea969b89b46830773b5e4846700e930365484a5b63953506d2b3c3633d99f33ff549336006c0eda476530b9931b2d2e68ee16ef28c7b98728d3f45b7347
6
+ metadata.gz: cc1dc25179cf9872022527036c3243a9c943cd25b4ea70b6ded00028d81c7ea629f30378d8cf7b62cc011a29d665f9afc555e2b29c06bd8cdaf395c7e92e0cf6
7
+ data.tar.gz: abdb2e8b31439af6c0ca1071203c045e0d2f7c1b59b8c72ad8bb71272fedcd0c8e77e85b3239d8ea653a71c82d735e10d0247c8b38ca2c85ae4c2bfab051e0cf
@@ -0,0 +1,653 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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_zonal_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module OsConfig
25
+ module V1
26
+ module OsConfigZonalService
27
+ ##
28
+ # Client for the OsConfigZonalService service.
29
+ #
30
+ # Zonal OS Config API
31
+ #
32
+ # The OS Config service is the server-side component that allows users to
33
+ # manage package installations and patch jobs for Compute Engine VM instances.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :os_config_zonal_service_stub
40
+
41
+ ##
42
+ # Configure the OsConfigZonalService Client class.
43
+ #
44
+ # See {::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all OsConfigZonalService clients
50
+ # ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "OsConfig", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the OsConfigZonalService Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # Create a new OsConfigZonalService client object.
103
+ #
104
+ # @example
105
+ #
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
108
+ #
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the OsConfigZonalService client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # These require statements are intentionally placed here to initialize
119
+ # the gRPC module only when it's required.
120
+ # See https://github.com/googleapis/toolkit/issues/446
121
+ require "gapic/grpc"
122
+ require "google/cloud/osconfig/v1/osconfig_zonal_service_services_pb"
123
+
124
+ # Create the configuration object
125
+ @config = Configuration.new Client.configure
126
+
127
+ # Yield the configuration if needed
128
+ yield @config if block_given?
129
+
130
+ # Create credentials
131
+ credentials = @config.credentials
132
+ # Use self-signed JWT if the endpoint is unchanged from default,
133
+ # but only if the default endpoint does not have a region prefix.
134
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
135
+ !@config.endpoint.split(".").first.include?("-")
136
+ credentials ||= Credentials.default scope: @config.scope,
137
+ enable_self_signed_jwt: enable_self_signed_jwt
138
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
139
+ credentials = Credentials.new credentials, scope: @config.scope
140
+ end
141
+ @quota_project_id = @config.quota_project
142
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
143
+
144
+ @os_config_zonal_service_stub = ::Gapic::ServiceStub.new(
145
+ ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Stub,
146
+ credentials: credentials,
147
+ endpoint: @config.endpoint,
148
+ channel_args: @config.channel_args,
149
+ interceptors: @config.interceptors
150
+ )
151
+ end
152
+
153
+ # Service calls
154
+
155
+ ##
156
+ # Get inventory data for the specified VM instance. If the VM has no
157
+ # associated inventory, the message `NOT_FOUND` is returned.
158
+ #
159
+ # @overload get_inventory(request, options = nil)
160
+ # Pass arguments to `get_inventory` via a request object, either of type
161
+ # {::Google::Cloud::OsConfig::V1::GetInventoryRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::OsConfig::V1::GetInventoryRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
168
+ #
169
+ # @overload get_inventory(name: nil, view: nil)
170
+ # Pass arguments to `get_inventory` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param name [::String]
175
+ # Required. API resource name for inventory resource.
176
+ #
177
+ # Format:
178
+ # `projects/{project}/locations/{location}/instances/{instance}/inventory`
179
+ #
180
+ # For `{project}`, either `project-number` or `project-id` can be provided.
181
+ # For `{instance}`, either Compute Engine `instance-id` or `instance-name`
182
+ # can be provided.
183
+ # @param view [::Google::Cloud::OsConfig::V1::InventoryView]
184
+ # Inventory view indicating what information should be included in the
185
+ # inventory resource. If unspecified, the default view is BASIC.
186
+ #
187
+ # @yield [response, operation] Access the result along with the RPC operation
188
+ # @yieldparam response [::Google::Cloud::OsConfig::V1::Inventory]
189
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
190
+ #
191
+ # @return [::Google::Cloud::OsConfig::V1::Inventory]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
194
+ #
195
+ def get_inventory request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetInventoryRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ metadata = @config.rpcs.get_inventory.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
210
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ header_params = {
213
+ "name" => request.name
214
+ }
215
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
216
+ metadata[:"x-goog-request-params"] ||= request_params_header
217
+
218
+ options.apply_defaults timeout: @config.rpcs.get_inventory.timeout,
219
+ metadata: metadata,
220
+ retry_policy: @config.rpcs.get_inventory.retry_policy
221
+
222
+ options.apply_defaults timeout: @config.timeout,
223
+ metadata: @config.metadata,
224
+ retry_policy: @config.retry_policy
225
+
226
+ @os_config_zonal_service_stub.call_rpc :get_inventory, request, options: options do |response, operation|
227
+ yield response, operation if block_given?
228
+ return response
229
+ end
230
+ rescue ::GRPC::BadStatus => e
231
+ raise ::Google::Cloud::Error.from_error(e)
232
+ end
233
+
234
+ ##
235
+ # List inventory data for all VM instances in the specified zone.
236
+ #
237
+ # @overload list_inventories(request, options = nil)
238
+ # Pass arguments to `list_inventories` via a request object, either of type
239
+ # {::Google::Cloud::OsConfig::V1::ListInventoriesRequest} or an equivalent Hash.
240
+ #
241
+ # @param request [::Google::Cloud::OsConfig::V1::ListInventoriesRequest, ::Hash]
242
+ # A request object representing the call parameters. Required. To specify no
243
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
244
+ # @param options [::Gapic::CallOptions, ::Hash]
245
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
246
+ #
247
+ # @overload list_inventories(parent: nil, view: nil, page_size: nil, page_token: nil, filter: nil)
248
+ # Pass arguments to `list_inventories` via keyword arguments. Note that at
249
+ # least one keyword argument is required. To specify no parameters, or to keep all
250
+ # the default parameter values, pass an empty Hash as a request object (see above).
251
+ #
252
+ # @param parent [::String]
253
+ # Required. The parent resource name.
254
+ #
255
+ # Format: `projects/{project}/locations/{location}/instances/-`
256
+ #
257
+ # For `{project}`, either `project-number` or `project-id` can be provided.
258
+ # @param view [::Google::Cloud::OsConfig::V1::InventoryView]
259
+ # Inventory view indicating what information should be included in the
260
+ # inventory resource. If unspecified, the default view is BASIC.
261
+ # @param page_size [::Integer]
262
+ # The maximum number of results to return.
263
+ # @param page_token [::String]
264
+ # A pagination token returned from a previous call to
265
+ # `ListInventories` that indicates where this listing
266
+ # should continue from.
267
+ # @param filter [::String]
268
+ # If provided, this field specifies the criteria that must be met by a
269
+ # `Inventory` API resource to be included in the response.
270
+ #
271
+ # @yield [response, operation] Access the result along with the RPC operation
272
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::Inventory>]
273
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
274
+ #
275
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::Inventory>]
276
+ #
277
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
278
+ #
279
+ def list_inventories request, options = nil
280
+ raise ::ArgumentError, "request must be provided" if request.nil?
281
+
282
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListInventoriesRequest
283
+
284
+ # Converts hash and nil to an options object
285
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
286
+
287
+ # Customize the options with defaults
288
+ metadata = @config.rpcs.list_inventories.metadata.to_h
289
+
290
+ # Set x-goog-api-client and x-goog-user-project headers
291
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
293
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
294
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
+
296
+ header_params = {
297
+ "parent" => request.parent
298
+ }
299
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
300
+ metadata[:"x-goog-request-params"] ||= request_params_header
301
+
302
+ options.apply_defaults timeout: @config.rpcs.list_inventories.timeout,
303
+ metadata: metadata,
304
+ retry_policy: @config.rpcs.list_inventories.retry_policy
305
+
306
+ options.apply_defaults timeout: @config.timeout,
307
+ metadata: @config.metadata,
308
+ retry_policy: @config.retry_policy
309
+
310
+ @os_config_zonal_service_stub.call_rpc :list_inventories, request, options: options do |response, operation|
311
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_inventories, request, response, operation, options
312
+ yield response, operation if block_given?
313
+ return response
314
+ end
315
+ rescue ::GRPC::BadStatus => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Gets the vulnerability report for the specified VM instance. Only VMs with
321
+ # inventory data have vulnerability reports associated with them.
322
+ #
323
+ # @overload get_vulnerability_report(request, options = nil)
324
+ # Pass arguments to `get_vulnerability_report` via a request object, either of type
325
+ # {::Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest} or an equivalent Hash.
326
+ #
327
+ # @param request [::Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest, ::Hash]
328
+ # A request object representing the call parameters. Required. To specify no
329
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
330
+ # @param options [::Gapic::CallOptions, ::Hash]
331
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
332
+ #
333
+ # @overload get_vulnerability_report(name: nil)
334
+ # Pass arguments to `get_vulnerability_report` via keyword arguments. Note that at
335
+ # least one keyword argument is required. To specify no parameters, or to keep all
336
+ # the default parameter values, pass an empty Hash as a request object (see above).
337
+ #
338
+ # @param name [::String]
339
+ # Required. API resource name for vulnerability resource.
340
+ #
341
+ # Format:
342
+ # `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport`
343
+ #
344
+ # For `{project}`, either `project-number` or `project-id` can be provided.
345
+ # For `{instance}`, either Compute Engine `instance-id` or `instance-name`
346
+ # can be provided.
347
+ #
348
+ # @yield [response, operation] Access the result along with the RPC operation
349
+ # @yieldparam response [::Google::Cloud::OsConfig::V1::VulnerabilityReport]
350
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
351
+ #
352
+ # @return [::Google::Cloud::OsConfig::V1::VulnerabilityReport]
353
+ #
354
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
355
+ #
356
+ def get_vulnerability_report request, options = nil
357
+ raise ::ArgumentError, "request must be provided" if request.nil?
358
+
359
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest
360
+
361
+ # Converts hash and nil to an options object
362
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
363
+
364
+ # Customize the options with defaults
365
+ metadata = @config.rpcs.get_vulnerability_report.metadata.to_h
366
+
367
+ # Set x-goog-api-client and x-goog-user-project headers
368
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
369
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
370
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
371
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
372
+
373
+ header_params = {
374
+ "name" => request.name
375
+ }
376
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
377
+ metadata[:"x-goog-request-params"] ||= request_params_header
378
+
379
+ options.apply_defaults timeout: @config.rpcs.get_vulnerability_report.timeout,
380
+ metadata: metadata,
381
+ retry_policy: @config.rpcs.get_vulnerability_report.retry_policy
382
+
383
+ options.apply_defaults timeout: @config.timeout,
384
+ metadata: @config.metadata,
385
+ retry_policy: @config.retry_policy
386
+
387
+ @os_config_zonal_service_stub.call_rpc :get_vulnerability_report, request, options: options do |response, operation|
388
+ yield response, operation if block_given?
389
+ return response
390
+ end
391
+ rescue ::GRPC::BadStatus => e
392
+ raise ::Google::Cloud::Error.from_error(e)
393
+ end
394
+
395
+ ##
396
+ # List vulnerability reports for all VM instances in the specified zone.
397
+ #
398
+ # @overload list_vulnerability_reports(request, options = nil)
399
+ # Pass arguments to `list_vulnerability_reports` via a request object, either of type
400
+ # {::Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest} or an equivalent Hash.
401
+ #
402
+ # @param request [::Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest, ::Hash]
403
+ # A request object representing the call parameters. Required. To specify no
404
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
405
+ # @param options [::Gapic::CallOptions, ::Hash]
406
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
407
+ #
408
+ # @overload list_vulnerability_reports(parent: nil, page_size: nil, page_token: nil, filter: nil)
409
+ # Pass arguments to `list_vulnerability_reports` via keyword arguments. Note that at
410
+ # least one keyword argument is required. To specify no parameters, or to keep all
411
+ # the default parameter values, pass an empty Hash as a request object (see above).
412
+ #
413
+ # @param parent [::String]
414
+ # Required. The parent resource name.
415
+ #
416
+ # Format: `projects/{project}/locations/{location}/instances/-`
417
+ #
418
+ # For `{project}`, either `project-number` or `project-id` can be provided.
419
+ # @param page_size [::Integer]
420
+ # The maximum number of results to return.
421
+ # @param page_token [::String]
422
+ # A pagination token returned from a previous call to
423
+ # `ListVulnerabilityReports` that indicates where this listing
424
+ # should continue from.
425
+ # @param filter [::String]
426
+ # If provided, this field specifies the criteria that must be met by a
427
+ # `vulnerabilityReport` API resource to be included in the response.
428
+ #
429
+ # @yield [response, operation] Access the result along with the RPC operation
430
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::VulnerabilityReport>]
431
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
432
+ #
433
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::VulnerabilityReport>]
434
+ #
435
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
436
+ #
437
+ def list_vulnerability_reports request, options = nil
438
+ raise ::ArgumentError, "request must be provided" if request.nil?
439
+
440
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest
441
+
442
+ # Converts hash and nil to an options object
443
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
444
+
445
+ # Customize the options with defaults
446
+ metadata = @config.rpcs.list_vulnerability_reports.metadata.to_h
447
+
448
+ # Set x-goog-api-client and x-goog-user-project headers
449
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
450
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
451
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
452
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
453
+
454
+ header_params = {
455
+ "parent" => request.parent
456
+ }
457
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
458
+ metadata[:"x-goog-request-params"] ||= request_params_header
459
+
460
+ options.apply_defaults timeout: @config.rpcs.list_vulnerability_reports.timeout,
461
+ metadata: metadata,
462
+ retry_policy: @config.rpcs.list_vulnerability_reports.retry_policy
463
+
464
+ options.apply_defaults timeout: @config.timeout,
465
+ metadata: @config.metadata,
466
+ retry_policy: @config.retry_policy
467
+
468
+ @os_config_zonal_service_stub.call_rpc :list_vulnerability_reports, request, options: options do |response, operation|
469
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_vulnerability_reports, request, response, operation, options
470
+ yield response, operation if block_given?
471
+ return response
472
+ end
473
+ rescue ::GRPC::BadStatus => e
474
+ raise ::Google::Cloud::Error.from_error(e)
475
+ end
476
+
477
+ ##
478
+ # Configuration class for the OsConfigZonalService API.
479
+ #
480
+ # This class represents the configuration for OsConfigZonalService,
481
+ # providing control over timeouts, retry behavior, logging, transport
482
+ # parameters, and other low-level controls. Certain parameters can also be
483
+ # applied individually to specific RPCs. See
484
+ # {::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client::Configuration::Rpcs}
485
+ # for a list of RPCs that can be configured independently.
486
+ #
487
+ # Configuration can be applied globally to all clients, or to a single client
488
+ # on construction.
489
+ #
490
+ # @example
491
+ #
492
+ # # Modify the global config, setting the timeout for
493
+ # # get_inventory to 20 seconds,
494
+ # # and all remaining timeouts to 10 seconds.
495
+ # ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.configure do |config|
496
+ # config.timeout = 10.0
497
+ # config.rpcs.get_inventory.timeout = 20.0
498
+ # end
499
+ #
500
+ # # Apply the above configuration only to a new client.
501
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new do |config|
502
+ # config.timeout = 10.0
503
+ # config.rpcs.get_inventory.timeout = 20.0
504
+ # end
505
+ #
506
+ # @!attribute [rw] endpoint
507
+ # The hostname or hostname:port of the service endpoint.
508
+ # Defaults to `"osconfig.googleapis.com"`.
509
+ # @return [::String]
510
+ # @!attribute [rw] credentials
511
+ # Credentials to send with calls. You may provide any of the following types:
512
+ # * (`String`) The path to a service account key file in JSON format
513
+ # * (`Hash`) A service account key as a Hash
514
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
515
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
516
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
517
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
518
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
519
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
520
+ # * (`nil`) indicating no credentials
521
+ # @return [::Object]
522
+ # @!attribute [rw] scope
523
+ # The OAuth scopes
524
+ # @return [::Array<::String>]
525
+ # @!attribute [rw] lib_name
526
+ # The library name as recorded in instrumentation and logging
527
+ # @return [::String]
528
+ # @!attribute [rw] lib_version
529
+ # The library version as recorded in instrumentation and logging
530
+ # @return [::String]
531
+ # @!attribute [rw] channel_args
532
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
533
+ # `GRPC::Core::Channel` object is provided as the credential.
534
+ # @return [::Hash]
535
+ # @!attribute [rw] interceptors
536
+ # An array of interceptors that are run before calls are executed.
537
+ # @return [::Array<::GRPC::ClientInterceptor>]
538
+ # @!attribute [rw] timeout
539
+ # The call timeout in seconds.
540
+ # @return [::Numeric]
541
+ # @!attribute [rw] metadata
542
+ # Additional gRPC headers to be sent with the call.
543
+ # @return [::Hash{::Symbol=>::String}]
544
+ # @!attribute [rw] retry_policy
545
+ # The retry policy. The value is a hash with the following keys:
546
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
547
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
548
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
549
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
550
+ # trigger a retry.
551
+ # @return [::Hash]
552
+ # @!attribute [rw] quota_project
553
+ # A separate project against which to charge quota.
554
+ # @return [::String]
555
+ #
556
+ class Configuration
557
+ extend ::Gapic::Config
558
+
559
+ config_attr :endpoint, "osconfig.googleapis.com", ::String
560
+ config_attr :credentials, nil do |value|
561
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
562
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
563
+ allowed.any? { |klass| klass === value }
564
+ end
565
+ config_attr :scope, nil, ::String, ::Array, nil
566
+ config_attr :lib_name, nil, ::String, nil
567
+ config_attr :lib_version, nil, ::String, nil
568
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
569
+ config_attr :interceptors, nil, ::Array, nil
570
+ config_attr :timeout, nil, ::Numeric, nil
571
+ config_attr :metadata, nil, ::Hash, nil
572
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
573
+ config_attr :quota_project, nil, ::String, nil
574
+
575
+ # @private
576
+ def initialize parent_config = nil
577
+ @parent_config = parent_config unless parent_config.nil?
578
+
579
+ yield self if block_given?
580
+ end
581
+
582
+ ##
583
+ # Configurations for individual RPCs
584
+ # @return [Rpcs]
585
+ #
586
+ def rpcs
587
+ @rpcs ||= begin
588
+ parent_rpcs = nil
589
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
590
+ Rpcs.new parent_rpcs
591
+ end
592
+ end
593
+
594
+ ##
595
+ # Configuration RPC class for the OsConfigZonalService API.
596
+ #
597
+ # Includes fields providing the configuration for each RPC in this service.
598
+ # Each configuration object is of type `Gapic::Config::Method` and includes
599
+ # the following configuration fields:
600
+ #
601
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
602
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
603
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
604
+ # include the following keys:
605
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
606
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
607
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
608
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
609
+ # trigger a retry.
610
+ #
611
+ class Rpcs
612
+ ##
613
+ # RPC-specific configuration for `get_inventory`
614
+ # @return [::Gapic::Config::Method]
615
+ #
616
+ attr_reader :get_inventory
617
+ ##
618
+ # RPC-specific configuration for `list_inventories`
619
+ # @return [::Gapic::Config::Method]
620
+ #
621
+ attr_reader :list_inventories
622
+ ##
623
+ # RPC-specific configuration for `get_vulnerability_report`
624
+ # @return [::Gapic::Config::Method]
625
+ #
626
+ attr_reader :get_vulnerability_report
627
+ ##
628
+ # RPC-specific configuration for `list_vulnerability_reports`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :list_vulnerability_reports
632
+
633
+ # @private
634
+ def initialize parent_rpcs = nil
635
+ get_inventory_config = parent_rpcs.get_inventory if parent_rpcs.respond_to? :get_inventory
636
+ @get_inventory = ::Gapic::Config::Method.new get_inventory_config
637
+ list_inventories_config = parent_rpcs.list_inventories if parent_rpcs.respond_to? :list_inventories
638
+ @list_inventories = ::Gapic::Config::Method.new list_inventories_config
639
+ get_vulnerability_report_config = parent_rpcs.get_vulnerability_report if parent_rpcs.respond_to? :get_vulnerability_report
640
+ @get_vulnerability_report = ::Gapic::Config::Method.new get_vulnerability_report_config
641
+ list_vulnerability_reports_config = parent_rpcs.list_vulnerability_reports if parent_rpcs.respond_to? :list_vulnerability_reports
642
+ @list_vulnerability_reports = ::Gapic::Config::Method.new list_vulnerability_reports_config
643
+
644
+ yield self if block_given?
645
+ end
646
+ end
647
+ end
648
+ end
649
+ end
650
+ end
651
+ end
652
+ end
653
+ end