google-cloud-os_config-v1 0.4.1 → 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: 818d06ac84b6929d933a1699f4bba5b1872d82839f338dc70225afb3267d9aac
4
- data.tar.gz: 95df03f87ab1dc9e926ec8ff33c975b2155e5b593420e3aee7a4ec7f450e6d29
3
+ metadata.gz: d742eb250c9190770302ad81e788f8355d3f3d475541419db5b0b33bc44ec993
4
+ data.tar.gz: b61528b8fc1cc2ec3809ad41e8112e5590bfc69dcc2cf59574320bebbc80c8b0
5
5
  SHA512:
6
- metadata.gz: 0b21a4187a14b98269193b6a96bcd9c756cd7f03f8dc27383cd0c4f5a14d256ffd5969c758d393e4b8f0cddca22d3564c550feea47cbcfa30612d7127cd00910
7
- data.tar.gz: ef4f4006ce56ba4d42fdcee0b57b0b5205574ba77a6ec1f1e4fdeb896a4cea37780c2dd71ddf798184d6d32083ecc14b731737ecbd96f00feb65066e8b73a4c4
6
+ metadata.gz: cc1dc25179cf9872022527036c3243a9c943cd25b4ea70b6ded00028d81c7ea629f30378d8cf7b62cc011a29d665f9afc555e2b29c06bd8cdaf395c7e92e0cf6
7
+ data.tar.gz: abdb2e8b31439af6c0ca1071203c045e0d2f7c1b59b8c72ad8bb71272fedcd0c8e77e85b3239d8ea653a71c82d735e10d0247c8b38ca2c85ae4c2bfab051e0cf
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-os_config-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::OsConfig::V1::OsConfigService::Credentials}):
68
68
 
69
- 1. `OS_CONFIG_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `OS_CONFIG_KEYFILE` - Path to JSON file, or JSON contents
71
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
69
+ * `OS_CONFIG_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `OS_CONFIG_KEYFILE` - Path to JSON file, or JSON contents
71
+ * `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
+ * `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
+ * `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/os_config/v1"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new
82
82
 
83
83
  ### Configuration
84
84
 
85
- The **Credentials JSON** can be configured instead of placing them in
86
- environment variables. Either on an individual client initialization:
85
+ The path to the **Credentials JSON** file can be configured instead of storing
86
+ it in an environment variable. Either on an individual client initialization:
87
87
 
88
88
  ```ruby
89
89
  require "google/cloud/os_config/v1"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new do |config|
93
93
  end
94
94
  ```
95
95
 
96
- Or configured globally for all clients:
96
+ Or globally for all clients:
97
97
 
98
98
  ```ruby
99
99
  require "google/cloud/os_config/v1"
data/README.md CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/os_config/v1"
34
34
 
35
35
  client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::OsConfig::V1::ExecutePatchJobRequest.new # (request fields as keyword arguments...)
37
37
  response = client.execute_patch_job request
38
38
  ```
39
39
 
@@ -44,13 +44,12 @@ module Google
44
44
  # See {::Google::Cloud::OsConfig::V1::OsConfigService::Client::Configuration}
45
45
  # for a description of the configuration fields.
46
46
  #
47
- # ## Example
47
+ # @example
48
48
  #
49
- # To modify the configuration for all OsConfigService clients:
50
- #
51
- # ::Google::Cloud::OsConfig::V1::OsConfigService::Client.configure do |config|
52
- # config.timeout = 10.0
53
- # end
49
+ # # Modify the configuration for all OsConfigService clients
50
+ # ::Google::Cloud::OsConfig::V1::OsConfigService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
54
53
  #
55
54
  # @yield [config] Configure the Client client.
56
55
  # @yieldparam config [Client::Configuration]
@@ -70,10 +69,7 @@ module Google
70
69
 
71
70
  default_config.timeout = 60.0
72
71
  default_config.retry_policy = {
73
- initial_delay: 1.0,
74
- max_delay: 60.0,
75
- multiplier: 1.3,
76
- retry_codes: [14]
72
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
77
73
  }
78
74
 
79
75
  default_config
@@ -105,19 +101,15 @@ module Google
105
101
  ##
106
102
  # Create a new OsConfigService client object.
107
103
  #
108
- # ## Examples
109
- #
110
- # To create a new OsConfigService client with the default
111
- # configuration:
104
+ # @example
112
105
  #
113
- # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new
114
108
  #
115
- # To create a new OsConfigService client with a custom
116
- # configuration:
117
- #
118
- # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new do |config|
119
- # config.timeout = 10.0
120
- # end
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
121
113
  #
122
114
  # @yield [config] Configure the OsConfigService client.
123
115
  # @yieldparam config [Client::Configuration]
@@ -137,14 +129,13 @@ module Google
137
129
 
138
130
  # Create credentials
139
131
  credentials = @config.credentials
140
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
132
+ # Use self-signed JWT if the endpoint is unchanged from default,
141
133
  # but only if the default endpoint does not have a region prefix.
142
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
143
- @config.endpoint == Client.configure.endpoint &&
134
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
144
135
  !@config.endpoint.split(".").first.include?("-")
145
136
  credentials ||= Credentials.default scope: @config.scope,
146
137
  enable_self_signed_jwt: enable_self_signed_jwt
147
- if credentials.is_a?(String) || credentials.is_a?(Hash)
138
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
148
139
  credentials = Credentials.new credentials, scope: @config.scope
149
140
  end
150
141
  @quota_project_id = @config.quota_project
@@ -235,7 +226,9 @@ module Google
235
226
  options.apply_defaults timeout: @config.rpcs.execute_patch_job.timeout,
236
227
  metadata: metadata,
237
228
  retry_policy: @config.rpcs.execute_patch_job.retry_policy
238
- options.apply_defaults metadata: @config.metadata,
229
+
230
+ options.apply_defaults timeout: @config.timeout,
231
+ metadata: @config.metadata,
239
232
  retry_policy: @config.retry_policy
240
233
 
241
234
  @os_config_service_stub.call_rpc :execute_patch_job, request, options: options do |response, operation|
@@ -302,7 +295,9 @@ module Google
302
295
  options.apply_defaults timeout: @config.rpcs.get_patch_job.timeout,
303
296
  metadata: metadata,
304
297
  retry_policy: @config.rpcs.get_patch_job.retry_policy
305
- options.apply_defaults metadata: @config.metadata,
298
+
299
+ options.apply_defaults timeout: @config.timeout,
300
+ metadata: @config.metadata,
306
301
  retry_policy: @config.retry_policy
307
302
 
308
303
  @os_config_service_stub.call_rpc :get_patch_job, request, options: options do |response, operation|
@@ -369,7 +364,9 @@ module Google
369
364
  options.apply_defaults timeout: @config.rpcs.cancel_patch_job.timeout,
370
365
  metadata: metadata,
371
366
  retry_policy: @config.rpcs.cancel_patch_job.retry_policy
372
- options.apply_defaults metadata: @config.metadata,
367
+
368
+ options.apply_defaults timeout: @config.timeout,
369
+ metadata: @config.metadata,
373
370
  retry_policy: @config.retry_policy
374
371
 
375
372
  @os_config_service_stub.call_rpc :cancel_patch_job, request, options: options do |response, operation|
@@ -444,7 +441,9 @@ module Google
444
441
  options.apply_defaults timeout: @config.rpcs.list_patch_jobs.timeout,
445
442
  metadata: metadata,
446
443
  retry_policy: @config.rpcs.list_patch_jobs.retry_policy
447
- options.apply_defaults metadata: @config.metadata,
444
+
445
+ options.apply_defaults timeout: @config.timeout,
446
+ metadata: @config.metadata,
448
447
  retry_policy: @config.retry_policy
449
448
 
450
449
  @os_config_service_stub.call_rpc :list_patch_jobs, request, options: options do |response, operation|
@@ -521,7 +520,9 @@ module Google
521
520
  options.apply_defaults timeout: @config.rpcs.list_patch_job_instance_details.timeout,
522
521
  metadata: metadata,
523
522
  retry_policy: @config.rpcs.list_patch_job_instance_details.retry_policy
524
- options.apply_defaults metadata: @config.metadata,
523
+
524
+ options.apply_defaults timeout: @config.timeout,
525
+ metadata: @config.metadata,
525
526
  retry_policy: @config.retry_policy
526
527
 
527
528
  @os_config_service_stub.call_rpc :list_patch_job_instance_details, request, options: options do |response, operation|
@@ -599,7 +600,9 @@ module Google
599
600
  options.apply_defaults timeout: @config.rpcs.create_patch_deployment.timeout,
600
601
  metadata: metadata,
601
602
  retry_policy: @config.rpcs.create_patch_deployment.retry_policy
602
- options.apply_defaults metadata: @config.metadata,
603
+
604
+ options.apply_defaults timeout: @config.timeout,
605
+ metadata: @config.metadata,
603
606
  retry_policy: @config.retry_policy
604
607
 
605
608
  @os_config_service_stub.call_rpc :create_patch_deployment, request, options: options do |response, operation|
@@ -666,7 +669,9 @@ module Google
666
669
  options.apply_defaults timeout: @config.rpcs.get_patch_deployment.timeout,
667
670
  metadata: metadata,
668
671
  retry_policy: @config.rpcs.get_patch_deployment.retry_policy
669
- options.apply_defaults metadata: @config.metadata,
672
+
673
+ options.apply_defaults timeout: @config.timeout,
674
+ metadata: @config.metadata,
670
675
  retry_policy: @config.retry_policy
671
676
 
672
677
  @os_config_service_stub.call_rpc :get_patch_deployment, request, options: options do |response, operation|
@@ -739,7 +744,9 @@ module Google
739
744
  options.apply_defaults timeout: @config.rpcs.list_patch_deployments.timeout,
740
745
  metadata: metadata,
741
746
  retry_policy: @config.rpcs.list_patch_deployments.retry_policy
742
- options.apply_defaults metadata: @config.metadata,
747
+
748
+ options.apply_defaults timeout: @config.timeout,
749
+ metadata: @config.metadata,
743
750
  retry_policy: @config.retry_policy
744
751
 
745
752
  @os_config_service_stub.call_rpc :list_patch_deployments, request, options: options do |response, operation|
@@ -807,7 +814,9 @@ module Google
807
814
  options.apply_defaults timeout: @config.rpcs.delete_patch_deployment.timeout,
808
815
  metadata: metadata,
809
816
  retry_policy: @config.rpcs.delete_patch_deployment.retry_policy
810
- options.apply_defaults metadata: @config.metadata,
817
+
818
+ options.apply_defaults timeout: @config.timeout,
819
+ metadata: @config.metadata,
811
820
  retry_policy: @config.retry_policy
812
821
 
813
822
  @os_config_service_stub.call_rpc :delete_patch_deployment, request, options: options do |response, operation|
@@ -831,22 +840,21 @@ module Google
831
840
  # Configuration can be applied globally to all clients, or to a single client
832
841
  # on construction.
833
842
  #
834
- # # Examples
835
- #
836
- # To modify the global config, setting the timeout for execute_patch_job
837
- # to 20 seconds, and all remaining timeouts to 10 seconds:
838
- #
839
- # ::Google::Cloud::OsConfig::V1::OsConfigService::Client.configure do |config|
840
- # config.timeout = 10.0
841
- # config.rpcs.execute_patch_job.timeout = 20.0
842
- # end
843
- #
844
- # To apply the above configuration only to a new client:
845
- #
846
- # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new do |config|
847
- # config.timeout = 10.0
848
- # config.rpcs.execute_patch_job.timeout = 20.0
849
- # end
843
+ # @example
844
+ #
845
+ # # Modify the global config, setting the timeout for
846
+ # # execute_patch_job to 20 seconds,
847
+ # # and all remaining timeouts to 10 seconds.
848
+ # ::Google::Cloud::OsConfig::V1::OsConfigService::Client.configure do |config|
849
+ # config.timeout = 10.0
850
+ # config.rpcs.execute_patch_job.timeout = 20.0
851
+ # end
852
+ #
853
+ # # Apply the above configuration only to a new client.
854
+ # client = ::Google::Cloud::OsConfig::V1::OsConfigService::Client.new do |config|
855
+ # config.timeout = 10.0
856
+ # config.rpcs.execute_patch_job.timeout = 20.0
857
+ # end
850
858
  #
851
859
  # @!attribute [rw] endpoint
852
860
  # The hostname or hostname:port of the service endpoint.
@@ -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