google-cloud-os_config-v1 0.5.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/os_config/v1/os_config_service/client.rb +198 -27
  3. data/lib/google/cloud/os_config/v1/os_config_zonal_service/client.rb +1628 -0
  4. data/lib/google/cloud/os_config/v1/os_config_zonal_service/credentials.rb +51 -0
  5. data/lib/google/cloud/os_config/v1/os_config_zonal_service/operations.rb +767 -0
  6. data/lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb +192 -0
  7. data/lib/google/cloud/os_config/v1/os_config_zonal_service.rb +53 -0
  8. data/lib/google/cloud/os_config/v1/version.rb +1 -1
  9. data/lib/google/cloud/os_config/v1.rb +1 -0
  10. data/lib/google/cloud/osconfig/v1/inventory_pb.rb +37 -9
  11. data/lib/google/cloud/osconfig/v1/os_policy_assignment_reports_pb.rb +92 -0
  12. data/lib/google/cloud/osconfig/v1/os_policy_assignments_pb.rb +134 -0
  13. data/lib/google/cloud/osconfig/v1/os_policy_pb.rb +204 -0
  14. data/lib/google/cloud/osconfig/v1/osconfig_service_pb.rb +2 -2
  15. data/lib/google/cloud/osconfig/v1/osconfig_service_services_pb.rb +1 -1
  16. data/lib/google/cloud/osconfig/v1/osconfig_zonal_service_pb.rb +25 -0
  17. data/lib/google/cloud/osconfig/v1/osconfig_zonal_service_services_pb.rb +107 -0
  18. data/lib/google/cloud/osconfig/v1/patch_deployments_pb.rb +3 -2
  19. data/lib/google/cloud/osconfig/v1/patch_jobs_pb.rb +2 -2
  20. data/lib/google/cloud/osconfig/v1/vulnerability_pb.rb +127 -0
  21. data/proto_docs/google/cloud/osconfig/v1/inventory.rb +111 -20
  22. data/proto_docs/google/cloud/osconfig/v1/os_policy.rb +597 -0
  23. data/proto_docs/google/cloud/osconfig/v1/os_policy_assignment_reports.rb +293 -0
  24. data/proto_docs/google/cloud/osconfig/v1/os_policy_assignments.rb +392 -0
  25. data/proto_docs/google/cloud/osconfig/v1/patch_deployments.rb +4 -0
  26. data/proto_docs/google/cloud/osconfig/v1/vulnerability.rb +374 -0
  27. data/proto_docs/google/longrunning/operations.rb +164 -0
  28. data/proto_docs/google/protobuf/any.rb +141 -0
  29. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  30. data/proto_docs/google/rpc/status.rb +46 -0
  31. metadata +21 -2
@@ -0,0 +1,1628 @@
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
+ @operations_client = Operations.new do |config|
145
+ config.credentials = credentials
146
+ config.endpoint = @config.endpoint
147
+ end
148
+
149
+ @os_config_zonal_service_stub = ::Gapic::ServiceStub.new(
150
+ ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Stub,
151
+ credentials: credentials,
152
+ endpoint: @config.endpoint,
153
+ channel_args: @config.channel_args,
154
+ interceptors: @config.interceptors
155
+ )
156
+ end
157
+
158
+ ##
159
+ # Get the associated client for long-running operations.
160
+ #
161
+ # @return [::Google::Cloud::OsConfig::V1::OsConfigZonalService::Operations]
162
+ #
163
+ attr_reader :operations_client
164
+
165
+ # Service calls
166
+
167
+ ##
168
+ # Create an OS policy assignment.
169
+ #
170
+ # This method also creates the first revision of the OS policy assignment.
171
+ #
172
+ # This method returns a long running operation (LRO) that contains the
173
+ # rollout details. The rollout can be cancelled by cancelling the LRO.
174
+ #
175
+ # For more information, see [Method:
176
+ # projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).
177
+ #
178
+ # @overload create_os_policy_assignment(request, options = nil)
179
+ # Pass arguments to `create_os_policy_assignment` via a request object, either of type
180
+ # {::Google::Cloud::OsConfig::V1::CreateOSPolicyAssignmentRequest} or an equivalent Hash.
181
+ #
182
+ # @param request [::Google::Cloud::OsConfig::V1::CreateOSPolicyAssignmentRequest, ::Hash]
183
+ # A request object representing the call parameters. Required. To specify no
184
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
185
+ # @param options [::Gapic::CallOptions, ::Hash]
186
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
187
+ #
188
+ # @overload create_os_policy_assignment(parent: nil, os_policy_assignment: nil, os_policy_assignment_id: nil)
189
+ # Pass arguments to `create_os_policy_assignment` via keyword arguments. Note that at
190
+ # least one keyword argument is required. To specify no parameters, or to keep all
191
+ # the default parameter values, pass an empty Hash as a request object (see above).
192
+ #
193
+ # @param parent [::String]
194
+ # Required. The parent resource name in the form:
195
+ # projects/\\{project}/locations/\\{location}
196
+ # @param os_policy_assignment [::Google::Cloud::OsConfig::V1::OSPolicyAssignment, ::Hash]
197
+ # Required. The OS policy assignment to be created.
198
+ # @param os_policy_assignment_id [::String]
199
+ # Required. The logical name of the OS policy assignment in the project
200
+ # with the following restrictions:
201
+ #
202
+ # * Must contain only lowercase letters, numbers, and hyphens.
203
+ # * Must start with a letter.
204
+ # * Must be between 1-63 characters.
205
+ # * Must end with a number or a letter.
206
+ # * Must be unique within the project.
207
+ #
208
+ # @yield [response, operation] Access the result along with the RPC operation
209
+ # @yieldparam response [::Gapic::Operation]
210
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
211
+ #
212
+ # @return [::Gapic::Operation]
213
+ #
214
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
215
+ #
216
+ # @example Basic example
217
+ # require "google/cloud/os_config/v1"
218
+ #
219
+ # # Create a client object. The client can be reused for multiple calls.
220
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
221
+ #
222
+ # # Create a request. To set request fields, pass in keyword arguments.
223
+ # request = Google::Cloud::OsConfig::V1::CreateOSPolicyAssignmentRequest.new
224
+ #
225
+ # # Call the create_os_policy_assignment method.
226
+ # result = client.create_os_policy_assignment request
227
+ #
228
+ # # The returned object is of type Gapic::Operation. You can use this
229
+ # # object to check the status of an operation, cancel it, or wait
230
+ # # for results. Here is how to block until completion:
231
+ # result.wait_until_done! timeout: 60
232
+ # if result.response?
233
+ # p result.response
234
+ # else
235
+ # puts "Error!"
236
+ # end
237
+ #
238
+ def create_os_policy_assignment request, options = nil
239
+ raise ::ArgumentError, "request must be provided" if request.nil?
240
+
241
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::CreateOSPolicyAssignmentRequest
242
+
243
+ # Converts hash and nil to an options object
244
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
245
+
246
+ # Customize the options with defaults
247
+ metadata = @config.rpcs.create_os_policy_assignment.metadata.to_h
248
+
249
+ # Set x-goog-api-client and x-goog-user-project headers
250
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
251
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
252
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
253
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
254
+
255
+ header_params = {}
256
+ if request.parent
257
+ header_params["parent"] = request.parent
258
+ end
259
+
260
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
261
+ metadata[:"x-goog-request-params"] ||= request_params_header
262
+
263
+ options.apply_defaults timeout: @config.rpcs.create_os_policy_assignment.timeout,
264
+ metadata: metadata,
265
+ retry_policy: @config.rpcs.create_os_policy_assignment.retry_policy
266
+
267
+ options.apply_defaults timeout: @config.timeout,
268
+ metadata: @config.metadata,
269
+ retry_policy: @config.retry_policy
270
+
271
+ @os_config_zonal_service_stub.call_rpc :create_os_policy_assignment, request, options: options do |response, operation|
272
+ response = ::Gapic::Operation.new response, @operations_client, options: options
273
+ yield response, operation if block_given?
274
+ return response
275
+ end
276
+ rescue ::GRPC::BadStatus => e
277
+ raise ::Google::Cloud::Error.from_error(e)
278
+ end
279
+
280
+ ##
281
+ # Update an existing OS policy assignment.
282
+ #
283
+ # This method creates a new revision of the OS policy assignment.
284
+ #
285
+ # This method returns a long running operation (LRO) that contains the
286
+ # rollout details. The rollout can be cancelled by cancelling the LRO.
287
+ #
288
+ # For more information, see [Method:
289
+ # projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).
290
+ #
291
+ # @overload update_os_policy_assignment(request, options = nil)
292
+ # Pass arguments to `update_os_policy_assignment` via a request object, either of type
293
+ # {::Google::Cloud::OsConfig::V1::UpdateOSPolicyAssignmentRequest} or an equivalent Hash.
294
+ #
295
+ # @param request [::Google::Cloud::OsConfig::V1::UpdateOSPolicyAssignmentRequest, ::Hash]
296
+ # A request object representing the call parameters. Required. To specify no
297
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
298
+ # @param options [::Gapic::CallOptions, ::Hash]
299
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
300
+ #
301
+ # @overload update_os_policy_assignment(os_policy_assignment: nil, update_mask: nil)
302
+ # Pass arguments to `update_os_policy_assignment` via keyword arguments. Note that at
303
+ # least one keyword argument is required. To specify no parameters, or to keep all
304
+ # the default parameter values, pass an empty Hash as a request object (see above).
305
+ #
306
+ # @param os_policy_assignment [::Google::Cloud::OsConfig::V1::OSPolicyAssignment, ::Hash]
307
+ # Required. The updated OS policy assignment.
308
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
309
+ # Optional. Field mask that controls which fields of the assignment should be
310
+ # updated.
311
+ #
312
+ # @yield [response, operation] Access the result along with the RPC operation
313
+ # @yieldparam response [::Gapic::Operation]
314
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
315
+ #
316
+ # @return [::Gapic::Operation]
317
+ #
318
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
319
+ #
320
+ # @example Basic example
321
+ # require "google/cloud/os_config/v1"
322
+ #
323
+ # # Create a client object. The client can be reused for multiple calls.
324
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
325
+ #
326
+ # # Create a request. To set request fields, pass in keyword arguments.
327
+ # request = Google::Cloud::OsConfig::V1::UpdateOSPolicyAssignmentRequest.new
328
+ #
329
+ # # Call the update_os_policy_assignment method.
330
+ # result = client.update_os_policy_assignment request
331
+ #
332
+ # # The returned object is of type Gapic::Operation. You can use this
333
+ # # object to check the status of an operation, cancel it, or wait
334
+ # # for results. Here is how to block until completion:
335
+ # result.wait_until_done! timeout: 60
336
+ # if result.response?
337
+ # p result.response
338
+ # else
339
+ # puts "Error!"
340
+ # end
341
+ #
342
+ def update_os_policy_assignment request, options = nil
343
+ raise ::ArgumentError, "request must be provided" if request.nil?
344
+
345
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::UpdateOSPolicyAssignmentRequest
346
+
347
+ # Converts hash and nil to an options object
348
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
349
+
350
+ # Customize the options with defaults
351
+ metadata = @config.rpcs.update_os_policy_assignment.metadata.to_h
352
+
353
+ # Set x-goog-api-client and x-goog-user-project headers
354
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
355
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
356
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
357
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
+
359
+ header_params = {}
360
+ if request.os_policy_assignment&.name
361
+ header_params["os_policy_assignment.name"] = request.os_policy_assignment.name
362
+ end
363
+
364
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
365
+ metadata[:"x-goog-request-params"] ||= request_params_header
366
+
367
+ options.apply_defaults timeout: @config.rpcs.update_os_policy_assignment.timeout,
368
+ metadata: metadata,
369
+ retry_policy: @config.rpcs.update_os_policy_assignment.retry_policy
370
+
371
+ options.apply_defaults timeout: @config.timeout,
372
+ metadata: @config.metadata,
373
+ retry_policy: @config.retry_policy
374
+
375
+ @os_config_zonal_service_stub.call_rpc :update_os_policy_assignment, request, options: options do |response, operation|
376
+ response = ::Gapic::Operation.new response, @operations_client, options: options
377
+ yield response, operation if block_given?
378
+ return response
379
+ end
380
+ rescue ::GRPC::BadStatus => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Retrieve an existing OS policy assignment.
386
+ #
387
+ # This method always returns the latest revision. In order to retrieve a
388
+ # previous revision of the assignment, also provide the revision ID in the
389
+ # `name` parameter.
390
+ #
391
+ # @overload get_os_policy_assignment(request, options = nil)
392
+ # Pass arguments to `get_os_policy_assignment` via a request object, either of type
393
+ # {::Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentRequest} or an equivalent Hash.
394
+ #
395
+ # @param request [::Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentRequest, ::Hash]
396
+ # A request object representing the call parameters. Required. To specify no
397
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
398
+ # @param options [::Gapic::CallOptions, ::Hash]
399
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
400
+ #
401
+ # @overload get_os_policy_assignment(name: nil)
402
+ # Pass arguments to `get_os_policy_assignment` via keyword arguments. Note that at
403
+ # least one keyword argument is required. To specify no parameters, or to keep all
404
+ # the default parameter values, pass an empty Hash as a request object (see above).
405
+ #
406
+ # @param name [::String]
407
+ # Required. The resource name of OS policy assignment.
408
+ #
409
+ # Format:
410
+ # `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}`
411
+ #
412
+ # @yield [response, operation] Access the result along with the RPC operation
413
+ # @yieldparam response [::Google::Cloud::OsConfig::V1::OSPolicyAssignment]
414
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
415
+ #
416
+ # @return [::Google::Cloud::OsConfig::V1::OSPolicyAssignment]
417
+ #
418
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
419
+ #
420
+ # @example Basic example
421
+ # require "google/cloud/os_config/v1"
422
+ #
423
+ # # Create a client object. The client can be reused for multiple calls.
424
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
425
+ #
426
+ # # Create a request. To set request fields, pass in keyword arguments.
427
+ # request = Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentRequest.new
428
+ #
429
+ # # Call the get_os_policy_assignment method.
430
+ # result = client.get_os_policy_assignment request
431
+ #
432
+ # # The returned object is of type Google::Cloud::OsConfig::V1::OSPolicyAssignment.
433
+ # p result
434
+ #
435
+ def get_os_policy_assignment request, options = nil
436
+ raise ::ArgumentError, "request must be provided" if request.nil?
437
+
438
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentRequest
439
+
440
+ # Converts hash and nil to an options object
441
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
442
+
443
+ # Customize the options with defaults
444
+ metadata = @config.rpcs.get_os_policy_assignment.metadata.to_h
445
+
446
+ # Set x-goog-api-client and x-goog-user-project headers
447
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
448
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
449
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
450
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
451
+
452
+ header_params = {}
453
+ if request.name
454
+ header_params["name"] = request.name
455
+ end
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.get_os_policy_assignment.timeout,
461
+ metadata: metadata,
462
+ retry_policy: @config.rpcs.get_os_policy_assignment.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 :get_os_policy_assignment, request, options: options do |response, operation|
469
+ yield response, operation if block_given?
470
+ return response
471
+ end
472
+ rescue ::GRPC::BadStatus => e
473
+ raise ::Google::Cloud::Error.from_error(e)
474
+ end
475
+
476
+ ##
477
+ # List the OS policy assignments under the parent resource.
478
+ #
479
+ # For each OS policy assignment, the latest revision is returned.
480
+ #
481
+ # @overload list_os_policy_assignments(request, options = nil)
482
+ # Pass arguments to `list_os_policy_assignments` via a request object, either of type
483
+ # {::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentsRequest} or an equivalent Hash.
484
+ #
485
+ # @param request [::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentsRequest, ::Hash]
486
+ # A request object representing the call parameters. Required. To specify no
487
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
488
+ # @param options [::Gapic::CallOptions, ::Hash]
489
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
490
+ #
491
+ # @overload list_os_policy_assignments(parent: nil, page_size: nil, page_token: nil)
492
+ # Pass arguments to `list_os_policy_assignments` via keyword arguments. Note that at
493
+ # least one keyword argument is required. To specify no parameters, or to keep all
494
+ # the default parameter values, pass an empty Hash as a request object (see above).
495
+ #
496
+ # @param parent [::String]
497
+ # Required. The parent resource name.
498
+ # @param page_size [::Integer]
499
+ # The maximum number of assignments to return.
500
+ # @param page_token [::String]
501
+ # A pagination token returned from a previous call to
502
+ # `ListOSPolicyAssignments` that indicates where this listing should continue
503
+ # from.
504
+ #
505
+ # @yield [response, operation] Access the result along with the RPC operation
506
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignment>]
507
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
508
+ #
509
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignment>]
510
+ #
511
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
512
+ #
513
+ # @example Basic example
514
+ # require "google/cloud/os_config/v1"
515
+ #
516
+ # # Create a client object. The client can be reused for multiple calls.
517
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
518
+ #
519
+ # # Create a request. To set request fields, pass in keyword arguments.
520
+ # request = Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentsRequest.new
521
+ #
522
+ # # Call the list_os_policy_assignments method.
523
+ # result = client.list_os_policy_assignments request
524
+ #
525
+ # # The returned object is of type Gapic::PagedEnumerable. You can
526
+ # # iterate over all elements by calling #each, and the enumerable
527
+ # # will lazily make API calls to fetch subsequent pages. Other
528
+ # # methods are also available for managing paging directly.
529
+ # result.each do |response|
530
+ # # Each element is of type ::Google::Cloud::OsConfig::V1::OSPolicyAssignment.
531
+ # p response
532
+ # end
533
+ #
534
+ def list_os_policy_assignments request, options = nil
535
+ raise ::ArgumentError, "request must be provided" if request.nil?
536
+
537
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentsRequest
538
+
539
+ # Converts hash and nil to an options object
540
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
541
+
542
+ # Customize the options with defaults
543
+ metadata = @config.rpcs.list_os_policy_assignments.metadata.to_h
544
+
545
+ # Set x-goog-api-client and x-goog-user-project headers
546
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
547
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
548
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
549
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
550
+
551
+ header_params = {}
552
+ if request.parent
553
+ header_params["parent"] = request.parent
554
+ end
555
+
556
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
557
+ metadata[:"x-goog-request-params"] ||= request_params_header
558
+
559
+ options.apply_defaults timeout: @config.rpcs.list_os_policy_assignments.timeout,
560
+ metadata: metadata,
561
+ retry_policy: @config.rpcs.list_os_policy_assignments.retry_policy
562
+
563
+ options.apply_defaults timeout: @config.timeout,
564
+ metadata: @config.metadata,
565
+ retry_policy: @config.retry_policy
566
+
567
+ @os_config_zonal_service_stub.call_rpc :list_os_policy_assignments, request, options: options do |response, operation|
568
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignments, request, response, operation, options
569
+ yield response, operation if block_given?
570
+ return response
571
+ end
572
+ rescue ::GRPC::BadStatus => e
573
+ raise ::Google::Cloud::Error.from_error(e)
574
+ end
575
+
576
+ ##
577
+ # List the OS policy assignment revisions for a given OS policy assignment.
578
+ #
579
+ # @overload list_os_policy_assignment_revisions(request, options = nil)
580
+ # Pass arguments to `list_os_policy_assignment_revisions` via a request object, either of type
581
+ # {::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentRevisionsRequest} or an equivalent Hash.
582
+ #
583
+ # @param request [::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentRevisionsRequest, ::Hash]
584
+ # A request object representing the call parameters. Required. To specify no
585
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
586
+ # @param options [::Gapic::CallOptions, ::Hash]
587
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
588
+ #
589
+ # @overload list_os_policy_assignment_revisions(name: nil, page_size: nil, page_token: nil)
590
+ # Pass arguments to `list_os_policy_assignment_revisions` via keyword arguments. Note that at
591
+ # least one keyword argument is required. To specify no parameters, or to keep all
592
+ # the default parameter values, pass an empty Hash as a request object (see above).
593
+ #
594
+ # @param name [::String]
595
+ # Required. The name of the OS policy assignment to list revisions for.
596
+ # @param page_size [::Integer]
597
+ # The maximum number of revisions to return.
598
+ # @param page_token [::String]
599
+ # A pagination token returned from a previous call to
600
+ # `ListOSPolicyAssignmentRevisions` that indicates where this listing should
601
+ # continue from.
602
+ #
603
+ # @yield [response, operation] Access the result along with the RPC operation
604
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignment>]
605
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
606
+ #
607
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignment>]
608
+ #
609
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
610
+ #
611
+ # @example Basic example
612
+ # require "google/cloud/os_config/v1"
613
+ #
614
+ # # Create a client object. The client can be reused for multiple calls.
615
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
616
+ #
617
+ # # Create a request. To set request fields, pass in keyword arguments.
618
+ # request = Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentRevisionsRequest.new
619
+ #
620
+ # # Call the list_os_policy_assignment_revisions method.
621
+ # result = client.list_os_policy_assignment_revisions request
622
+ #
623
+ # # The returned object is of type Gapic::PagedEnumerable. You can
624
+ # # iterate over all elements by calling #each, and the enumerable
625
+ # # will lazily make API calls to fetch subsequent pages. Other
626
+ # # methods are also available for managing paging directly.
627
+ # result.each do |response|
628
+ # # Each element is of type ::Google::Cloud::OsConfig::V1::OSPolicyAssignment.
629
+ # p response
630
+ # end
631
+ #
632
+ def list_os_policy_assignment_revisions request, options = nil
633
+ raise ::ArgumentError, "request must be provided" if request.nil?
634
+
635
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentRevisionsRequest
636
+
637
+ # Converts hash and nil to an options object
638
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
639
+
640
+ # Customize the options with defaults
641
+ metadata = @config.rpcs.list_os_policy_assignment_revisions.metadata.to_h
642
+
643
+ # Set x-goog-api-client and x-goog-user-project headers
644
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
645
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
646
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
647
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
648
+
649
+ header_params = {}
650
+ if request.name
651
+ header_params["name"] = request.name
652
+ end
653
+
654
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
655
+ metadata[:"x-goog-request-params"] ||= request_params_header
656
+
657
+ options.apply_defaults timeout: @config.rpcs.list_os_policy_assignment_revisions.timeout,
658
+ metadata: metadata,
659
+ retry_policy: @config.rpcs.list_os_policy_assignment_revisions.retry_policy
660
+
661
+ options.apply_defaults timeout: @config.timeout,
662
+ metadata: @config.metadata,
663
+ retry_policy: @config.retry_policy
664
+
665
+ @os_config_zonal_service_stub.call_rpc :list_os_policy_assignment_revisions, request, options: options do |response, operation|
666
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_revisions, request, response, operation, options
667
+ yield response, operation if block_given?
668
+ return response
669
+ end
670
+ rescue ::GRPC::BadStatus => e
671
+ raise ::Google::Cloud::Error.from_error(e)
672
+ end
673
+
674
+ ##
675
+ # Delete the OS policy assignment.
676
+ #
677
+ # This method creates a new revision of the OS policy assignment.
678
+ #
679
+ # This method returns a long running operation (LRO) that contains the
680
+ # rollout details. The rollout can be cancelled by cancelling the LRO.
681
+ #
682
+ # If the LRO completes and is not cancelled, all revisions associated with
683
+ # the OS policy assignment are deleted.
684
+ #
685
+ # For more information, see [Method:
686
+ # projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).
687
+ #
688
+ # @overload delete_os_policy_assignment(request, options = nil)
689
+ # Pass arguments to `delete_os_policy_assignment` via a request object, either of type
690
+ # {::Google::Cloud::OsConfig::V1::DeleteOSPolicyAssignmentRequest} or an equivalent Hash.
691
+ #
692
+ # @param request [::Google::Cloud::OsConfig::V1::DeleteOSPolicyAssignmentRequest, ::Hash]
693
+ # A request object representing the call parameters. Required. To specify no
694
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
695
+ # @param options [::Gapic::CallOptions, ::Hash]
696
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
697
+ #
698
+ # @overload delete_os_policy_assignment(name: nil)
699
+ # Pass arguments to `delete_os_policy_assignment` via keyword arguments. Note that at
700
+ # least one keyword argument is required. To specify no parameters, or to keep all
701
+ # the default parameter values, pass an empty Hash as a request object (see above).
702
+ #
703
+ # @param name [::String]
704
+ # Required. The name of the OS policy assignment to be deleted
705
+ #
706
+ # @yield [response, operation] Access the result along with the RPC operation
707
+ # @yieldparam response [::Gapic::Operation]
708
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
709
+ #
710
+ # @return [::Gapic::Operation]
711
+ #
712
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
713
+ #
714
+ # @example Basic example
715
+ # require "google/cloud/os_config/v1"
716
+ #
717
+ # # Create a client object. The client can be reused for multiple calls.
718
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
719
+ #
720
+ # # Create a request. To set request fields, pass in keyword arguments.
721
+ # request = Google::Cloud::OsConfig::V1::DeleteOSPolicyAssignmentRequest.new
722
+ #
723
+ # # Call the delete_os_policy_assignment method.
724
+ # result = client.delete_os_policy_assignment request
725
+ #
726
+ # # The returned object is of type Gapic::Operation. You can use this
727
+ # # object to check the status of an operation, cancel it, or wait
728
+ # # for results. Here is how to block until completion:
729
+ # result.wait_until_done! timeout: 60
730
+ # if result.response?
731
+ # p result.response
732
+ # else
733
+ # puts "Error!"
734
+ # end
735
+ #
736
+ def delete_os_policy_assignment request, options = nil
737
+ raise ::ArgumentError, "request must be provided" if request.nil?
738
+
739
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::DeleteOSPolicyAssignmentRequest
740
+
741
+ # Converts hash and nil to an options object
742
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
743
+
744
+ # Customize the options with defaults
745
+ metadata = @config.rpcs.delete_os_policy_assignment.metadata.to_h
746
+
747
+ # Set x-goog-api-client and x-goog-user-project headers
748
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
749
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
750
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
751
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
752
+
753
+ header_params = {}
754
+ if request.name
755
+ header_params["name"] = request.name
756
+ end
757
+
758
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
759
+ metadata[:"x-goog-request-params"] ||= request_params_header
760
+
761
+ options.apply_defaults timeout: @config.rpcs.delete_os_policy_assignment.timeout,
762
+ metadata: metadata,
763
+ retry_policy: @config.rpcs.delete_os_policy_assignment.retry_policy
764
+
765
+ options.apply_defaults timeout: @config.timeout,
766
+ metadata: @config.metadata,
767
+ retry_policy: @config.retry_policy
768
+
769
+ @os_config_zonal_service_stub.call_rpc :delete_os_policy_assignment, request, options: options do |response, operation|
770
+ response = ::Gapic::Operation.new response, @operations_client, options: options
771
+ yield response, operation if block_given?
772
+ return response
773
+ end
774
+ rescue ::GRPC::BadStatus => e
775
+ raise ::Google::Cloud::Error.from_error(e)
776
+ end
777
+
778
+ ##
779
+ # Get the OS policy asssignment report for the specified Compute Engine VM
780
+ # instance.
781
+ #
782
+ # @overload get_os_policy_assignment_report(request, options = nil)
783
+ # Pass arguments to `get_os_policy_assignment_report` via a request object, either of type
784
+ # {::Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentReportRequest} or an equivalent Hash.
785
+ #
786
+ # @param request [::Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentReportRequest, ::Hash]
787
+ # A request object representing the call parameters. Required. To specify no
788
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
789
+ # @param options [::Gapic::CallOptions, ::Hash]
790
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
791
+ #
792
+ # @overload get_os_policy_assignment_report(name: nil)
793
+ # Pass arguments to `get_os_policy_assignment_report` via keyword arguments. Note that at
794
+ # least one keyword argument is required. To specify no parameters, or to keep all
795
+ # the default parameter values, pass an empty Hash as a request object (see above).
796
+ #
797
+ # @param name [::String]
798
+ # Required. API resource name for OS policy assignment report.
799
+ #
800
+ # Format:
801
+ # `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`
802
+ #
803
+ # For `{project}`, either `project-number` or `project-id` can be provided.
804
+ # For `{instance_id}`, either Compute Engine `instance-id` or `instance-name`
805
+ # can be provided.
806
+ # For `{assignment_id}`, the OSPolicyAssignment id must be provided.
807
+ #
808
+ # @yield [response, operation] Access the result along with the RPC operation
809
+ # @yieldparam response [::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport]
810
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
811
+ #
812
+ # @return [::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport]
813
+ #
814
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
815
+ #
816
+ # @example Basic example
817
+ # require "google/cloud/os_config/v1"
818
+ #
819
+ # # Create a client object. The client can be reused for multiple calls.
820
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
821
+ #
822
+ # # Create a request. To set request fields, pass in keyword arguments.
823
+ # request = Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentReportRequest.new
824
+ #
825
+ # # Call the get_os_policy_assignment_report method.
826
+ # result = client.get_os_policy_assignment_report request
827
+ #
828
+ # # The returned object is of type Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport.
829
+ # p result
830
+ #
831
+ def get_os_policy_assignment_report request, options = nil
832
+ raise ::ArgumentError, "request must be provided" if request.nil?
833
+
834
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetOSPolicyAssignmentReportRequest
835
+
836
+ # Converts hash and nil to an options object
837
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
838
+
839
+ # Customize the options with defaults
840
+ metadata = @config.rpcs.get_os_policy_assignment_report.metadata.to_h
841
+
842
+ # Set x-goog-api-client and x-goog-user-project headers
843
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
844
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
845
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
846
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
847
+
848
+ header_params = {}
849
+ if request.name
850
+ header_params["name"] = request.name
851
+ end
852
+
853
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
854
+ metadata[:"x-goog-request-params"] ||= request_params_header
855
+
856
+ options.apply_defaults timeout: @config.rpcs.get_os_policy_assignment_report.timeout,
857
+ metadata: metadata,
858
+ retry_policy: @config.rpcs.get_os_policy_assignment_report.retry_policy
859
+
860
+ options.apply_defaults timeout: @config.timeout,
861
+ metadata: @config.metadata,
862
+ retry_policy: @config.retry_policy
863
+
864
+ @os_config_zonal_service_stub.call_rpc :get_os_policy_assignment_report, request, options: options do |response, operation|
865
+ yield response, operation if block_given?
866
+ return response
867
+ end
868
+ rescue ::GRPC::BadStatus => e
869
+ raise ::Google::Cloud::Error.from_error(e)
870
+ end
871
+
872
+ ##
873
+ # List OS policy asssignment reports for all Compute Engine VM instances in
874
+ # the specified zone.
875
+ #
876
+ # @overload list_os_policy_assignment_reports(request, options = nil)
877
+ # Pass arguments to `list_os_policy_assignment_reports` via a request object, either of type
878
+ # {::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentReportsRequest} or an equivalent Hash.
879
+ #
880
+ # @param request [::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentReportsRequest, ::Hash]
881
+ # A request object representing the call parameters. Required. To specify no
882
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
883
+ # @param options [::Gapic::CallOptions, ::Hash]
884
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
885
+ #
886
+ # @overload list_os_policy_assignment_reports(parent: nil, page_size: nil, filter: nil, page_token: nil)
887
+ # Pass arguments to `list_os_policy_assignment_reports` via keyword arguments. Note that at
888
+ # least one keyword argument is required. To specify no parameters, or to keep all
889
+ # the default parameter values, pass an empty Hash as a request object (see above).
890
+ #
891
+ # @param parent [::String]
892
+ # Required. The parent resource name.
893
+ #
894
+ # Format:
895
+ # `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`
896
+ #
897
+ # For `{project}`, either `project-number` or `project-id` can be provided.
898
+ # For `{instance}`, either `instance-name`, `instance-id`, or `-` can be
899
+ # provided. If '-' is provided, the response will include
900
+ # OSPolicyAssignmentReports for all instances in the project/location.
901
+ # For `{assignment}`, either `assignment-id` or `-` can be provided. If '-'
902
+ # is provided, the response will include OSPolicyAssignmentReports for all
903
+ # OSPolicyAssignments in the project/location.
904
+ # Either \\{instance} or \\{assignment} must be `-`.
905
+ #
906
+ # For example:
907
+ # `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports`
908
+ # returns all reports for the instance
909
+ # `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports`
910
+ # returns all the reports for the given assignment across all instances.
911
+ # `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports`
912
+ # returns all the reports for all assignments across all instances.
913
+ # @param page_size [::Integer]
914
+ # The maximum number of results to return.
915
+ # @param filter [::String]
916
+ # If provided, this field specifies the criteria that must be met by the
917
+ # `OSPolicyAssignmentReport` API resource that is included in the response.
918
+ # @param page_token [::String]
919
+ # A pagination token returned from a previous call to the
920
+ # `ListOSPolicyAssignmentReports` method that indicates where this listing
921
+ # should continue from.
922
+ #
923
+ # @yield [response, operation] Access the result along with the RPC operation
924
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport>]
925
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
926
+ #
927
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport>]
928
+ #
929
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
930
+ #
931
+ # @example Basic example
932
+ # require "google/cloud/os_config/v1"
933
+ #
934
+ # # Create a client object. The client can be reused for multiple calls.
935
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
936
+ #
937
+ # # Create a request. To set request fields, pass in keyword arguments.
938
+ # request = Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentReportsRequest.new
939
+ #
940
+ # # Call the list_os_policy_assignment_reports method.
941
+ # result = client.list_os_policy_assignment_reports request
942
+ #
943
+ # # The returned object is of type Gapic::PagedEnumerable. You can
944
+ # # iterate over all elements by calling #each, and the enumerable
945
+ # # will lazily make API calls to fetch subsequent pages. Other
946
+ # # methods are also available for managing paging directly.
947
+ # result.each do |response|
948
+ # # Each element is of type ::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport.
949
+ # p response
950
+ # end
951
+ #
952
+ def list_os_policy_assignment_reports request, options = nil
953
+ raise ::ArgumentError, "request must be provided" if request.nil?
954
+
955
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListOSPolicyAssignmentReportsRequest
956
+
957
+ # Converts hash and nil to an options object
958
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
959
+
960
+ # Customize the options with defaults
961
+ metadata = @config.rpcs.list_os_policy_assignment_reports.metadata.to_h
962
+
963
+ # Set x-goog-api-client and x-goog-user-project headers
964
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
965
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
966
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
967
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
968
+
969
+ header_params = {}
970
+ if request.parent
971
+ header_params["parent"] = request.parent
972
+ end
973
+
974
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
975
+ metadata[:"x-goog-request-params"] ||= request_params_header
976
+
977
+ options.apply_defaults timeout: @config.rpcs.list_os_policy_assignment_reports.timeout,
978
+ metadata: metadata,
979
+ retry_policy: @config.rpcs.list_os_policy_assignment_reports.retry_policy
980
+
981
+ options.apply_defaults timeout: @config.timeout,
982
+ metadata: @config.metadata,
983
+ retry_policy: @config.retry_policy
984
+
985
+ @os_config_zonal_service_stub.call_rpc :list_os_policy_assignment_reports, request, options: options do |response, operation|
986
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_reports, request, response, operation, options
987
+ yield response, operation if block_given?
988
+ return response
989
+ end
990
+ rescue ::GRPC::BadStatus => e
991
+ raise ::Google::Cloud::Error.from_error(e)
992
+ end
993
+
994
+ ##
995
+ # Get inventory data for the specified VM instance. If the VM has no
996
+ # associated inventory, the message `NOT_FOUND` is returned.
997
+ #
998
+ # @overload get_inventory(request, options = nil)
999
+ # Pass arguments to `get_inventory` via a request object, either of type
1000
+ # {::Google::Cloud::OsConfig::V1::GetInventoryRequest} or an equivalent Hash.
1001
+ #
1002
+ # @param request [::Google::Cloud::OsConfig::V1::GetInventoryRequest, ::Hash]
1003
+ # A request object representing the call parameters. Required. To specify no
1004
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1005
+ # @param options [::Gapic::CallOptions, ::Hash]
1006
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1007
+ #
1008
+ # @overload get_inventory(name: nil, view: nil)
1009
+ # Pass arguments to `get_inventory` via keyword arguments. Note that at
1010
+ # least one keyword argument is required. To specify no parameters, or to keep all
1011
+ # the default parameter values, pass an empty Hash as a request object (see above).
1012
+ #
1013
+ # @param name [::String]
1014
+ # Required. API resource name for inventory resource.
1015
+ #
1016
+ # Format:
1017
+ # `projects/{project}/locations/{location}/instances/{instance}/inventory`
1018
+ #
1019
+ # For `{project}`, either `project-number` or `project-id` can be provided.
1020
+ # For `{instance}`, either Compute Engine `instance-id` or `instance-name`
1021
+ # can be provided.
1022
+ # @param view [::Google::Cloud::OsConfig::V1::InventoryView]
1023
+ # Inventory view indicating what information should be included in the
1024
+ # inventory resource. If unspecified, the default view is BASIC.
1025
+ #
1026
+ # @yield [response, operation] Access the result along with the RPC operation
1027
+ # @yieldparam response [::Google::Cloud::OsConfig::V1::Inventory]
1028
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1029
+ #
1030
+ # @return [::Google::Cloud::OsConfig::V1::Inventory]
1031
+ #
1032
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1033
+ #
1034
+ # @example Basic example
1035
+ # require "google/cloud/os_config/v1"
1036
+ #
1037
+ # # Create a client object. The client can be reused for multiple calls.
1038
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
1039
+ #
1040
+ # # Create a request. To set request fields, pass in keyword arguments.
1041
+ # request = Google::Cloud::OsConfig::V1::GetInventoryRequest.new
1042
+ #
1043
+ # # Call the get_inventory method.
1044
+ # result = client.get_inventory request
1045
+ #
1046
+ # # The returned object is of type Google::Cloud::OsConfig::V1::Inventory.
1047
+ # p result
1048
+ #
1049
+ def get_inventory request, options = nil
1050
+ raise ::ArgumentError, "request must be provided" if request.nil?
1051
+
1052
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetInventoryRequest
1053
+
1054
+ # Converts hash and nil to an options object
1055
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1056
+
1057
+ # Customize the options with defaults
1058
+ metadata = @config.rpcs.get_inventory.metadata.to_h
1059
+
1060
+ # Set x-goog-api-client and x-goog-user-project headers
1061
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1062
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1063
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
1064
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1065
+
1066
+ header_params = {}
1067
+ if request.name
1068
+ header_params["name"] = request.name
1069
+ end
1070
+
1071
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1072
+ metadata[:"x-goog-request-params"] ||= request_params_header
1073
+
1074
+ options.apply_defaults timeout: @config.rpcs.get_inventory.timeout,
1075
+ metadata: metadata,
1076
+ retry_policy: @config.rpcs.get_inventory.retry_policy
1077
+
1078
+ options.apply_defaults timeout: @config.timeout,
1079
+ metadata: @config.metadata,
1080
+ retry_policy: @config.retry_policy
1081
+
1082
+ @os_config_zonal_service_stub.call_rpc :get_inventory, request, options: options do |response, operation|
1083
+ yield response, operation if block_given?
1084
+ return response
1085
+ end
1086
+ rescue ::GRPC::BadStatus => e
1087
+ raise ::Google::Cloud::Error.from_error(e)
1088
+ end
1089
+
1090
+ ##
1091
+ # List inventory data for all VM instances in the specified zone.
1092
+ #
1093
+ # @overload list_inventories(request, options = nil)
1094
+ # Pass arguments to `list_inventories` via a request object, either of type
1095
+ # {::Google::Cloud::OsConfig::V1::ListInventoriesRequest} or an equivalent Hash.
1096
+ #
1097
+ # @param request [::Google::Cloud::OsConfig::V1::ListInventoriesRequest, ::Hash]
1098
+ # A request object representing the call parameters. Required. To specify no
1099
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1100
+ # @param options [::Gapic::CallOptions, ::Hash]
1101
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1102
+ #
1103
+ # @overload list_inventories(parent: nil, view: nil, page_size: nil, page_token: nil, filter: nil)
1104
+ # Pass arguments to `list_inventories` via keyword arguments. Note that at
1105
+ # least one keyword argument is required. To specify no parameters, or to keep all
1106
+ # the default parameter values, pass an empty Hash as a request object (see above).
1107
+ #
1108
+ # @param parent [::String]
1109
+ # Required. The parent resource name.
1110
+ #
1111
+ # Format: `projects/{project}/locations/{location}/instances/-`
1112
+ #
1113
+ # For `{project}`, either `project-number` or `project-id` can be provided.
1114
+ # @param view [::Google::Cloud::OsConfig::V1::InventoryView]
1115
+ # Inventory view indicating what information should be included in the
1116
+ # inventory resource. If unspecified, the default view is BASIC.
1117
+ # @param page_size [::Integer]
1118
+ # The maximum number of results to return.
1119
+ # @param page_token [::String]
1120
+ # A pagination token returned from a previous call to
1121
+ # `ListInventories` that indicates where this listing
1122
+ # should continue from.
1123
+ # @param filter [::String]
1124
+ # If provided, this field specifies the criteria that must be met by a
1125
+ # `Inventory` API resource to be included in the response.
1126
+ #
1127
+ # @yield [response, operation] Access the result along with the RPC operation
1128
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::Inventory>]
1129
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1130
+ #
1131
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::Inventory>]
1132
+ #
1133
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1134
+ #
1135
+ # @example Basic example
1136
+ # require "google/cloud/os_config/v1"
1137
+ #
1138
+ # # Create a client object. The client can be reused for multiple calls.
1139
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
1140
+ #
1141
+ # # Create a request. To set request fields, pass in keyword arguments.
1142
+ # request = Google::Cloud::OsConfig::V1::ListInventoriesRequest.new
1143
+ #
1144
+ # # Call the list_inventories method.
1145
+ # result = client.list_inventories request
1146
+ #
1147
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1148
+ # # iterate over all elements by calling #each, and the enumerable
1149
+ # # will lazily make API calls to fetch subsequent pages. Other
1150
+ # # methods are also available for managing paging directly.
1151
+ # result.each do |response|
1152
+ # # Each element is of type ::Google::Cloud::OsConfig::V1::Inventory.
1153
+ # p response
1154
+ # end
1155
+ #
1156
+ def list_inventories request, options = nil
1157
+ raise ::ArgumentError, "request must be provided" if request.nil?
1158
+
1159
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListInventoriesRequest
1160
+
1161
+ # Converts hash and nil to an options object
1162
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1163
+
1164
+ # Customize the options with defaults
1165
+ metadata = @config.rpcs.list_inventories.metadata.to_h
1166
+
1167
+ # Set x-goog-api-client and x-goog-user-project headers
1168
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1169
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1170
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
1171
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1172
+
1173
+ header_params = {}
1174
+ if request.parent
1175
+ header_params["parent"] = request.parent
1176
+ end
1177
+
1178
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1179
+ metadata[:"x-goog-request-params"] ||= request_params_header
1180
+
1181
+ options.apply_defaults timeout: @config.rpcs.list_inventories.timeout,
1182
+ metadata: metadata,
1183
+ retry_policy: @config.rpcs.list_inventories.retry_policy
1184
+
1185
+ options.apply_defaults timeout: @config.timeout,
1186
+ metadata: @config.metadata,
1187
+ retry_policy: @config.retry_policy
1188
+
1189
+ @os_config_zonal_service_stub.call_rpc :list_inventories, request, options: options do |response, operation|
1190
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_inventories, request, response, operation, options
1191
+ yield response, operation if block_given?
1192
+ return response
1193
+ end
1194
+ rescue ::GRPC::BadStatus => e
1195
+ raise ::Google::Cloud::Error.from_error(e)
1196
+ end
1197
+
1198
+ ##
1199
+ # Gets the vulnerability report for the specified VM instance. Only VMs with
1200
+ # inventory data have vulnerability reports associated with them.
1201
+ #
1202
+ # @overload get_vulnerability_report(request, options = nil)
1203
+ # Pass arguments to `get_vulnerability_report` via a request object, either of type
1204
+ # {::Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest} or an equivalent Hash.
1205
+ #
1206
+ # @param request [::Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest, ::Hash]
1207
+ # A request object representing the call parameters. Required. To specify no
1208
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1209
+ # @param options [::Gapic::CallOptions, ::Hash]
1210
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1211
+ #
1212
+ # @overload get_vulnerability_report(name: nil)
1213
+ # Pass arguments to `get_vulnerability_report` via keyword arguments. Note that at
1214
+ # least one keyword argument is required. To specify no parameters, or to keep all
1215
+ # the default parameter values, pass an empty Hash as a request object (see above).
1216
+ #
1217
+ # @param name [::String]
1218
+ # Required. API resource name for vulnerability resource.
1219
+ #
1220
+ # Format:
1221
+ # `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport`
1222
+ #
1223
+ # For `{project}`, either `project-number` or `project-id` can be provided.
1224
+ # For `{instance}`, either Compute Engine `instance-id` or `instance-name`
1225
+ # can be provided.
1226
+ #
1227
+ # @yield [response, operation] Access the result along with the RPC operation
1228
+ # @yieldparam response [::Google::Cloud::OsConfig::V1::VulnerabilityReport]
1229
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1230
+ #
1231
+ # @return [::Google::Cloud::OsConfig::V1::VulnerabilityReport]
1232
+ #
1233
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1234
+ #
1235
+ # @example Basic example
1236
+ # require "google/cloud/os_config/v1"
1237
+ #
1238
+ # # Create a client object. The client can be reused for multiple calls.
1239
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
1240
+ #
1241
+ # # Create a request. To set request fields, pass in keyword arguments.
1242
+ # request = Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest.new
1243
+ #
1244
+ # # Call the get_vulnerability_report method.
1245
+ # result = client.get_vulnerability_report request
1246
+ #
1247
+ # # The returned object is of type Google::Cloud::OsConfig::V1::VulnerabilityReport.
1248
+ # p result
1249
+ #
1250
+ def get_vulnerability_report request, options = nil
1251
+ raise ::ArgumentError, "request must be provided" if request.nil?
1252
+
1253
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::GetVulnerabilityReportRequest
1254
+
1255
+ # Converts hash and nil to an options object
1256
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1257
+
1258
+ # Customize the options with defaults
1259
+ metadata = @config.rpcs.get_vulnerability_report.metadata.to_h
1260
+
1261
+ # Set x-goog-api-client and x-goog-user-project headers
1262
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1263
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1264
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
1265
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1266
+
1267
+ header_params = {}
1268
+ if request.name
1269
+ header_params["name"] = request.name
1270
+ end
1271
+
1272
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1273
+ metadata[:"x-goog-request-params"] ||= request_params_header
1274
+
1275
+ options.apply_defaults timeout: @config.rpcs.get_vulnerability_report.timeout,
1276
+ metadata: metadata,
1277
+ retry_policy: @config.rpcs.get_vulnerability_report.retry_policy
1278
+
1279
+ options.apply_defaults timeout: @config.timeout,
1280
+ metadata: @config.metadata,
1281
+ retry_policy: @config.retry_policy
1282
+
1283
+ @os_config_zonal_service_stub.call_rpc :get_vulnerability_report, request, options: options do |response, operation|
1284
+ yield response, operation if block_given?
1285
+ return response
1286
+ end
1287
+ rescue ::GRPC::BadStatus => e
1288
+ raise ::Google::Cloud::Error.from_error(e)
1289
+ end
1290
+
1291
+ ##
1292
+ # List vulnerability reports for all VM instances in the specified zone.
1293
+ #
1294
+ # @overload list_vulnerability_reports(request, options = nil)
1295
+ # Pass arguments to `list_vulnerability_reports` via a request object, either of type
1296
+ # {::Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest} or an equivalent Hash.
1297
+ #
1298
+ # @param request [::Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest, ::Hash]
1299
+ # A request object representing the call parameters. Required. To specify no
1300
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1301
+ # @param options [::Gapic::CallOptions, ::Hash]
1302
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1303
+ #
1304
+ # @overload list_vulnerability_reports(parent: nil, page_size: nil, page_token: nil, filter: nil)
1305
+ # Pass arguments to `list_vulnerability_reports` via keyword arguments. Note that at
1306
+ # least one keyword argument is required. To specify no parameters, or to keep all
1307
+ # the default parameter values, pass an empty Hash as a request object (see above).
1308
+ #
1309
+ # @param parent [::String]
1310
+ # Required. The parent resource name.
1311
+ #
1312
+ # Format: `projects/{project}/locations/{location}/instances/-`
1313
+ #
1314
+ # For `{project}`, either `project-number` or `project-id` can be provided.
1315
+ # @param page_size [::Integer]
1316
+ # The maximum number of results to return.
1317
+ # @param page_token [::String]
1318
+ # A pagination token returned from a previous call to
1319
+ # `ListVulnerabilityReports` that indicates where this listing
1320
+ # should continue from.
1321
+ # @param filter [::String]
1322
+ # If provided, this field specifies the criteria that must be met by a
1323
+ # `vulnerabilityReport` API resource to be included in the response.
1324
+ #
1325
+ # @yield [response, operation] Access the result along with the RPC operation
1326
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::VulnerabilityReport>]
1327
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1328
+ #
1329
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::VulnerabilityReport>]
1330
+ #
1331
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1332
+ #
1333
+ # @example Basic example
1334
+ # require "google/cloud/os_config/v1"
1335
+ #
1336
+ # # Create a client object. The client can be reused for multiple calls.
1337
+ # client = Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new
1338
+ #
1339
+ # # Create a request. To set request fields, pass in keyword arguments.
1340
+ # request = Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest.new
1341
+ #
1342
+ # # Call the list_vulnerability_reports method.
1343
+ # result = client.list_vulnerability_reports request
1344
+ #
1345
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1346
+ # # iterate over all elements by calling #each, and the enumerable
1347
+ # # will lazily make API calls to fetch subsequent pages. Other
1348
+ # # methods are also available for managing paging directly.
1349
+ # result.each do |response|
1350
+ # # Each element is of type ::Google::Cloud::OsConfig::V1::VulnerabilityReport.
1351
+ # p response
1352
+ # end
1353
+ #
1354
+ def list_vulnerability_reports request, options = nil
1355
+ raise ::ArgumentError, "request must be provided" if request.nil?
1356
+
1357
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1::ListVulnerabilityReportsRequest
1358
+
1359
+ # Converts hash and nil to an options object
1360
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1361
+
1362
+ # Customize the options with defaults
1363
+ metadata = @config.rpcs.list_vulnerability_reports.metadata.to_h
1364
+
1365
+ # Set x-goog-api-client and x-goog-user-project headers
1366
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1367
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1368
+ gapic_version: ::Google::Cloud::OsConfig::V1::VERSION
1369
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1370
+
1371
+ header_params = {}
1372
+ if request.parent
1373
+ header_params["parent"] = request.parent
1374
+ end
1375
+
1376
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1377
+ metadata[:"x-goog-request-params"] ||= request_params_header
1378
+
1379
+ options.apply_defaults timeout: @config.rpcs.list_vulnerability_reports.timeout,
1380
+ metadata: metadata,
1381
+ retry_policy: @config.rpcs.list_vulnerability_reports.retry_policy
1382
+
1383
+ options.apply_defaults timeout: @config.timeout,
1384
+ metadata: @config.metadata,
1385
+ retry_policy: @config.retry_policy
1386
+
1387
+ @os_config_zonal_service_stub.call_rpc :list_vulnerability_reports, request, options: options do |response, operation|
1388
+ response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_vulnerability_reports, request, response, operation, options
1389
+ yield response, operation if block_given?
1390
+ return response
1391
+ end
1392
+ rescue ::GRPC::BadStatus => e
1393
+ raise ::Google::Cloud::Error.from_error(e)
1394
+ end
1395
+
1396
+ ##
1397
+ # Configuration class for the OsConfigZonalService API.
1398
+ #
1399
+ # This class represents the configuration for OsConfigZonalService,
1400
+ # providing control over timeouts, retry behavior, logging, transport
1401
+ # parameters, and other low-level controls. Certain parameters can also be
1402
+ # applied individually to specific RPCs. See
1403
+ # {::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client::Configuration::Rpcs}
1404
+ # for a list of RPCs that can be configured independently.
1405
+ #
1406
+ # Configuration can be applied globally to all clients, or to a single client
1407
+ # on construction.
1408
+ #
1409
+ # @example
1410
+ #
1411
+ # # Modify the global config, setting the timeout for
1412
+ # # create_os_policy_assignment to 20 seconds,
1413
+ # # and all remaining timeouts to 10 seconds.
1414
+ # ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.configure do |config|
1415
+ # config.timeout = 10.0
1416
+ # config.rpcs.create_os_policy_assignment.timeout = 20.0
1417
+ # end
1418
+ #
1419
+ # # Apply the above configuration only to a new client.
1420
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigZonalService::Client.new do |config|
1421
+ # config.timeout = 10.0
1422
+ # config.rpcs.create_os_policy_assignment.timeout = 20.0
1423
+ # end
1424
+ #
1425
+ # @!attribute [rw] endpoint
1426
+ # The hostname or hostname:port of the service endpoint.
1427
+ # Defaults to `"osconfig.googleapis.com"`.
1428
+ # @return [::String]
1429
+ # @!attribute [rw] credentials
1430
+ # Credentials to send with calls. You may provide any of the following types:
1431
+ # * (`String`) The path to a service account key file in JSON format
1432
+ # * (`Hash`) A service account key as a Hash
1433
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1434
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1435
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1436
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1437
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1438
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1439
+ # * (`nil`) indicating no credentials
1440
+ # @return [::Object]
1441
+ # @!attribute [rw] scope
1442
+ # The OAuth scopes
1443
+ # @return [::Array<::String>]
1444
+ # @!attribute [rw] lib_name
1445
+ # The library name as recorded in instrumentation and logging
1446
+ # @return [::String]
1447
+ # @!attribute [rw] lib_version
1448
+ # The library version as recorded in instrumentation and logging
1449
+ # @return [::String]
1450
+ # @!attribute [rw] channel_args
1451
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1452
+ # `GRPC::Core::Channel` object is provided as the credential.
1453
+ # @return [::Hash]
1454
+ # @!attribute [rw] interceptors
1455
+ # An array of interceptors that are run before calls are executed.
1456
+ # @return [::Array<::GRPC::ClientInterceptor>]
1457
+ # @!attribute [rw] timeout
1458
+ # The call timeout in seconds.
1459
+ # @return [::Numeric]
1460
+ # @!attribute [rw] metadata
1461
+ # Additional gRPC headers to be sent with the call.
1462
+ # @return [::Hash{::Symbol=>::String}]
1463
+ # @!attribute [rw] retry_policy
1464
+ # The retry policy. The value is a hash with the following keys:
1465
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1466
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1467
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1468
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1469
+ # trigger a retry.
1470
+ # @return [::Hash]
1471
+ # @!attribute [rw] quota_project
1472
+ # A separate project against which to charge quota.
1473
+ # @return [::String]
1474
+ #
1475
+ class Configuration
1476
+ extend ::Gapic::Config
1477
+
1478
+ config_attr :endpoint, "osconfig.googleapis.com", ::String
1479
+ config_attr :credentials, nil do |value|
1480
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1481
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1482
+ allowed.any? { |klass| klass === value }
1483
+ end
1484
+ config_attr :scope, nil, ::String, ::Array, nil
1485
+ config_attr :lib_name, nil, ::String, nil
1486
+ config_attr :lib_version, nil, ::String, nil
1487
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1488
+ config_attr :interceptors, nil, ::Array, nil
1489
+ config_attr :timeout, nil, ::Numeric, nil
1490
+ config_attr :metadata, nil, ::Hash, nil
1491
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1492
+ config_attr :quota_project, nil, ::String, nil
1493
+
1494
+ # @private
1495
+ def initialize parent_config = nil
1496
+ @parent_config = parent_config unless parent_config.nil?
1497
+
1498
+ yield self if block_given?
1499
+ end
1500
+
1501
+ ##
1502
+ # Configurations for individual RPCs
1503
+ # @return [Rpcs]
1504
+ #
1505
+ def rpcs
1506
+ @rpcs ||= begin
1507
+ parent_rpcs = nil
1508
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1509
+ Rpcs.new parent_rpcs
1510
+ end
1511
+ end
1512
+
1513
+ ##
1514
+ # Configuration RPC class for the OsConfigZonalService API.
1515
+ #
1516
+ # Includes fields providing the configuration for each RPC in this service.
1517
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1518
+ # the following configuration fields:
1519
+ #
1520
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1521
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1522
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1523
+ # include the following keys:
1524
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1525
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1526
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1527
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1528
+ # trigger a retry.
1529
+ #
1530
+ class Rpcs
1531
+ ##
1532
+ # RPC-specific configuration for `create_os_policy_assignment`
1533
+ # @return [::Gapic::Config::Method]
1534
+ #
1535
+ attr_reader :create_os_policy_assignment
1536
+ ##
1537
+ # RPC-specific configuration for `update_os_policy_assignment`
1538
+ # @return [::Gapic::Config::Method]
1539
+ #
1540
+ attr_reader :update_os_policy_assignment
1541
+ ##
1542
+ # RPC-specific configuration for `get_os_policy_assignment`
1543
+ # @return [::Gapic::Config::Method]
1544
+ #
1545
+ attr_reader :get_os_policy_assignment
1546
+ ##
1547
+ # RPC-specific configuration for `list_os_policy_assignments`
1548
+ # @return [::Gapic::Config::Method]
1549
+ #
1550
+ attr_reader :list_os_policy_assignments
1551
+ ##
1552
+ # RPC-specific configuration for `list_os_policy_assignment_revisions`
1553
+ # @return [::Gapic::Config::Method]
1554
+ #
1555
+ attr_reader :list_os_policy_assignment_revisions
1556
+ ##
1557
+ # RPC-specific configuration for `delete_os_policy_assignment`
1558
+ # @return [::Gapic::Config::Method]
1559
+ #
1560
+ attr_reader :delete_os_policy_assignment
1561
+ ##
1562
+ # RPC-specific configuration for `get_os_policy_assignment_report`
1563
+ # @return [::Gapic::Config::Method]
1564
+ #
1565
+ attr_reader :get_os_policy_assignment_report
1566
+ ##
1567
+ # RPC-specific configuration for `list_os_policy_assignment_reports`
1568
+ # @return [::Gapic::Config::Method]
1569
+ #
1570
+ attr_reader :list_os_policy_assignment_reports
1571
+ ##
1572
+ # RPC-specific configuration for `get_inventory`
1573
+ # @return [::Gapic::Config::Method]
1574
+ #
1575
+ attr_reader :get_inventory
1576
+ ##
1577
+ # RPC-specific configuration for `list_inventories`
1578
+ # @return [::Gapic::Config::Method]
1579
+ #
1580
+ attr_reader :list_inventories
1581
+ ##
1582
+ # RPC-specific configuration for `get_vulnerability_report`
1583
+ # @return [::Gapic::Config::Method]
1584
+ #
1585
+ attr_reader :get_vulnerability_report
1586
+ ##
1587
+ # RPC-specific configuration for `list_vulnerability_reports`
1588
+ # @return [::Gapic::Config::Method]
1589
+ #
1590
+ attr_reader :list_vulnerability_reports
1591
+
1592
+ # @private
1593
+ def initialize parent_rpcs = nil
1594
+ create_os_policy_assignment_config = parent_rpcs.create_os_policy_assignment if parent_rpcs.respond_to? :create_os_policy_assignment
1595
+ @create_os_policy_assignment = ::Gapic::Config::Method.new create_os_policy_assignment_config
1596
+ update_os_policy_assignment_config = parent_rpcs.update_os_policy_assignment if parent_rpcs.respond_to? :update_os_policy_assignment
1597
+ @update_os_policy_assignment = ::Gapic::Config::Method.new update_os_policy_assignment_config
1598
+ get_os_policy_assignment_config = parent_rpcs.get_os_policy_assignment if parent_rpcs.respond_to? :get_os_policy_assignment
1599
+ @get_os_policy_assignment = ::Gapic::Config::Method.new get_os_policy_assignment_config
1600
+ list_os_policy_assignments_config = parent_rpcs.list_os_policy_assignments if parent_rpcs.respond_to? :list_os_policy_assignments
1601
+ @list_os_policy_assignments = ::Gapic::Config::Method.new list_os_policy_assignments_config
1602
+ list_os_policy_assignment_revisions_config = parent_rpcs.list_os_policy_assignment_revisions if parent_rpcs.respond_to? :list_os_policy_assignment_revisions
1603
+ @list_os_policy_assignment_revisions = ::Gapic::Config::Method.new list_os_policy_assignment_revisions_config
1604
+ delete_os_policy_assignment_config = parent_rpcs.delete_os_policy_assignment if parent_rpcs.respond_to? :delete_os_policy_assignment
1605
+ @delete_os_policy_assignment = ::Gapic::Config::Method.new delete_os_policy_assignment_config
1606
+ get_os_policy_assignment_report_config = parent_rpcs.get_os_policy_assignment_report if parent_rpcs.respond_to? :get_os_policy_assignment_report
1607
+ @get_os_policy_assignment_report = ::Gapic::Config::Method.new get_os_policy_assignment_report_config
1608
+ list_os_policy_assignment_reports_config = parent_rpcs.list_os_policy_assignment_reports if parent_rpcs.respond_to? :list_os_policy_assignment_reports
1609
+ @list_os_policy_assignment_reports = ::Gapic::Config::Method.new list_os_policy_assignment_reports_config
1610
+ get_inventory_config = parent_rpcs.get_inventory if parent_rpcs.respond_to? :get_inventory
1611
+ @get_inventory = ::Gapic::Config::Method.new get_inventory_config
1612
+ list_inventories_config = parent_rpcs.list_inventories if parent_rpcs.respond_to? :list_inventories
1613
+ @list_inventories = ::Gapic::Config::Method.new list_inventories_config
1614
+ get_vulnerability_report_config = parent_rpcs.get_vulnerability_report if parent_rpcs.respond_to? :get_vulnerability_report
1615
+ @get_vulnerability_report = ::Gapic::Config::Method.new get_vulnerability_report_config
1616
+ list_vulnerability_reports_config = parent_rpcs.list_vulnerability_reports if parent_rpcs.respond_to? :list_vulnerability_reports
1617
+ @list_vulnerability_reports = ::Gapic::Config::Method.new list_vulnerability_reports_config
1618
+
1619
+ yield self if block_given?
1620
+ end
1621
+ end
1622
+ end
1623
+ end
1624
+ end
1625
+ end
1626
+ end
1627
+ end
1628
+ end