google-cloud-network_management-v1 1.4.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/network_management/v1/reachability_service/client.rb +7 -0
  4. data/lib/google/cloud/network_management/v1/reachability_service/operations.rb +7 -0
  5. data/lib/google/cloud/network_management/v1/reachability_service/rest/client.rb +7 -0
  6. data/lib/google/cloud/network_management/v1/reachability_service/rest/operations.rb +7 -0
  7. data/lib/google/cloud/network_management/v1/rest.rb +1 -0
  8. data/lib/google/cloud/network_management/v1/version.rb +1 -1
  9. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/client.rb +956 -0
  10. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/credentials.rb +47 -0
  11. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/operations.rb +813 -0
  12. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/paths.rb +69 -0
  13. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest/client.rb +902 -0
  14. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest/operations.rb +914 -0
  15. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest/service_stub.rb +388 -0
  16. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest.rb +56 -0
  17. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service.rb +58 -0
  18. data/lib/google/cloud/network_management/v1.rb +1 -0
  19. data/lib/google/cloud/networkmanagement/v1/vpc_flow_logs_config_pb.rb +51 -0
  20. data/lib/google/cloud/networkmanagement/v1/vpc_flow_logs_pb.rb +59 -0
  21. data/lib/google/cloud/networkmanagement/v1/vpc_flow_logs_services_pb.rb +83 -0
  22. data/proto_docs/google/cloud/networkmanagement/v1/trace.rb +54 -0
  23. data/proto_docs/google/cloud/networkmanagement/v1/vpc_flow_logs.rb +115 -0
  24. data/proto_docs/google/cloud/networkmanagement/v1/vpc_flow_logs_config.rb +167 -0
  25. data/proto_docs/google/longrunning/operations.rb +4 -0
  26. metadata +20 -9
@@ -0,0 +1,902 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/networkmanagement/v1/vpc_flow_logs_pb"
21
+ require "google/cloud/network_management/v1/vpc_flow_logs_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module NetworkManagement
28
+ module V1
29
+ module VpcFlowLogsService
30
+ module Rest
31
+ ##
32
+ # REST client for the VpcFlowLogsService service.
33
+ #
34
+ # The VPC Flow Logs service in the Google Cloud Network Management API provides
35
+ # configurations that generate Flow Logs. The service and the configuration
36
+ # resources created using this service are global.
37
+ #
38
+ class Client
39
+ # @private
40
+ API_VERSION = ""
41
+
42
+ # @private
43
+ DEFAULT_ENDPOINT_TEMPLATE = "networkmanagement.$UNIVERSE_DOMAIN$"
44
+
45
+ include Paths
46
+
47
+ # @private
48
+ attr_reader :vpc_flow_logs_service_stub
49
+
50
+ ##
51
+ # Configure the VpcFlowLogsService Client class.
52
+ #
53
+ # See {::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client::Configuration}
54
+ # for a description of the configuration fields.
55
+ #
56
+ # @example
57
+ #
58
+ # # Modify the configuration for all VpcFlowLogsService clients
59
+ # ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.configure do |config|
60
+ # config.timeout = 10.0
61
+ # end
62
+ #
63
+ # @yield [config] Configure the Client client.
64
+ # @yieldparam config [Client::Configuration]
65
+ #
66
+ # @return [Client::Configuration]
67
+ #
68
+ def self.configure
69
+ @configure ||= begin
70
+ namespace = ["Google", "Cloud", "NetworkManagement", "V1"]
71
+ parent_config = while namespace.any?
72
+ parent_name = namespace.join "::"
73
+ parent_const = const_get parent_name
74
+ break parent_const.configure if parent_const.respond_to? :configure
75
+ namespace.pop
76
+ end
77
+ default_config = Client::Configuration.new parent_config
78
+
79
+ default_config
80
+ end
81
+ yield @configure if block_given?
82
+ @configure
83
+ end
84
+
85
+ ##
86
+ # Configure the VpcFlowLogsService Client instance.
87
+ #
88
+ # The configuration is set to the derived mode, meaning that values can be changed,
89
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
90
+ # should be made on {Client.configure}.
91
+ #
92
+ # See {::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client::Configuration}
93
+ # for a description of the configuration fields.
94
+ #
95
+ # @yield [config] Configure the Client client.
96
+ # @yieldparam config [Client::Configuration]
97
+ #
98
+ # @return [Client::Configuration]
99
+ #
100
+ def configure
101
+ yield @config if block_given?
102
+ @config
103
+ end
104
+
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @vpc_flow_logs_service_stub.universe_domain
112
+ end
113
+
114
+ ##
115
+ # Create a new VpcFlowLogsService REST client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the VpcFlowLogsService client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # Create the configuration object
132
+ @config = Configuration.new Client.configure
133
+
134
+ # Yield the configuration if needed
135
+ yield @config if block_given?
136
+
137
+ # Create credentials
138
+ credentials = @config.credentials
139
+ # Use self-signed JWT if the endpoint is unchanged from default,
140
+ # but only if the default endpoint does not have a region prefix.
141
+ enable_self_signed_jwt = @config.endpoint.nil? ||
142
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
143
+ !@config.endpoint.split(".").first.include?("-"))
144
+ credentials ||= Credentials.default scope: @config.scope,
145
+ enable_self_signed_jwt: enable_self_signed_jwt
146
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
147
+ credentials = Credentials.new credentials, scope: @config.scope
148
+ end
149
+
150
+ @quota_project_id = @config.quota_project
151
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
152
+
153
+ @operations_client = ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Operations.new do |config|
154
+ config.credentials = credentials
155
+ config.quota_project = @quota_project_id
156
+ config.endpoint = @config.endpoint
157
+ config.universe_domain = @config.universe_domain
158
+ end
159
+
160
+ @vpc_flow_logs_service_stub = ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::ServiceStub.new(
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ credentials: credentials,
165
+ logger: @config.logger
166
+ )
167
+
168
+ @vpc_flow_logs_service_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+
178
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
179
+ config.credentials = credentials
180
+ config.quota_project = @quota_project_id
181
+ config.endpoint = @vpc_flow_logs_service_stub.endpoint
182
+ config.universe_domain = @vpc_flow_logs_service_stub.universe_domain
183
+ config.bindings_override = @config.bindings_override
184
+ config.logger = @vpc_flow_logs_service_stub.logger if config.respond_to? :logger=
185
+ end
186
+
187
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
188
+ config.credentials = credentials
189
+ config.quota_project = @quota_project_id
190
+ config.endpoint = @vpc_flow_logs_service_stub.endpoint
191
+ config.universe_domain = @vpc_flow_logs_service_stub.universe_domain
192
+ config.bindings_override = @config.bindings_override
193
+ config.logger = @vpc_flow_logs_service_stub.logger if config.respond_to? :logger=
194
+ end
195
+ end
196
+
197
+ ##
198
+ # Get the associated client for long-running operations.
199
+ #
200
+ # @return [::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Operations]
201
+ #
202
+ attr_reader :operations_client
203
+
204
+ ##
205
+ # Get the associated client for mix-in of the Locations.
206
+ #
207
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
208
+ #
209
+ attr_reader :location_client
210
+
211
+ ##
212
+ # Get the associated client for mix-in of the IAMPolicy.
213
+ #
214
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
215
+ #
216
+ attr_reader :iam_policy_client
217
+
218
+ ##
219
+ # The logger used for request/response debug logging.
220
+ #
221
+ # @return [Logger]
222
+ #
223
+ def logger
224
+ @vpc_flow_logs_service_stub.logger
225
+ end
226
+
227
+ # Service calls
228
+
229
+ ##
230
+ # Lists all `VpcFlowLogsConfigs` in a given project.
231
+ #
232
+ # @overload list_vpc_flow_logs_configs(request, options = nil)
233
+ # Pass arguments to `list_vpc_flow_logs_configs` via a request object, either of type
234
+ # {::Google::Cloud::NetworkManagement::V1::ListVpcFlowLogsConfigsRequest} or an equivalent Hash.
235
+ #
236
+ # @param request [::Google::Cloud::NetworkManagement::V1::ListVpcFlowLogsConfigsRequest, ::Hash]
237
+ # A request object representing the call parameters. Required. To specify no
238
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
239
+ # @param options [::Gapic::CallOptions, ::Hash]
240
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
241
+ #
242
+ # @overload list_vpc_flow_logs_configs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
243
+ # Pass arguments to `list_vpc_flow_logs_configs` via keyword arguments. Note that at
244
+ # least one keyword argument is required. To specify no parameters, or to keep all
245
+ # the default parameter values, pass an empty Hash as a request object (see above).
246
+ #
247
+ # @param parent [::String]
248
+ # Required. The parent resource of the VpcFlowLogsConfig:
249
+ # `projects/{project_id}/locations/global`
250
+ # @param page_size [::Integer]
251
+ # Optional. Number of `VpcFlowLogsConfigs` to return.
252
+ # @param page_token [::String]
253
+ # Optional. Page token from an earlier query, as returned in
254
+ # `next_page_token`.
255
+ # @param filter [::String]
256
+ # Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression.
257
+ # A filter expression must use the supported [CEL logic operators]
258
+ # (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators).
259
+ # @param order_by [::String]
260
+ # Optional. Field to use to sort the list.
261
+ # @yield [result, operation] Access the result along with the TransportOperation object
262
+ # @yieldparam result [::Google::Cloud::NetworkManagement::V1::ListVpcFlowLogsConfigsResponse]
263
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
264
+ #
265
+ # @return [::Google::Cloud::NetworkManagement::V1::ListVpcFlowLogsConfigsResponse]
266
+ #
267
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
268
+ #
269
+ # @example Basic example
270
+ # require "google/cloud/network_management/v1"
271
+ #
272
+ # # Create a client object. The client can be reused for multiple calls.
273
+ # client = Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new
274
+ #
275
+ # # Create a request. To set request fields, pass in keyword arguments.
276
+ # request = Google::Cloud::NetworkManagement::V1::ListVpcFlowLogsConfigsRequest.new
277
+ #
278
+ # # Call the list_vpc_flow_logs_configs method.
279
+ # result = client.list_vpc_flow_logs_configs request
280
+ #
281
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
282
+ # # over elements, and API calls will be issued to fetch pages as needed.
283
+ # result.each do |item|
284
+ # # Each element is of type ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsConfig.
285
+ # p item
286
+ # end
287
+ #
288
+ def list_vpc_flow_logs_configs request, options = nil
289
+ raise ::ArgumentError, "request must be provided" if request.nil?
290
+
291
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::ListVpcFlowLogsConfigsRequest
292
+
293
+ # Converts hash and nil to an options object
294
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
295
+
296
+ # Customize the options with defaults
297
+ call_metadata = @config.rpcs.list_vpc_flow_logs_configs.metadata.to_h
298
+
299
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
300
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
301
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
302
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
303
+ transports_version_send: [:rest]
304
+
305
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
306
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
307
+
308
+ options.apply_defaults timeout: @config.rpcs.list_vpc_flow_logs_configs.timeout,
309
+ metadata: call_metadata,
310
+ retry_policy: @config.rpcs.list_vpc_flow_logs_configs.retry_policy
311
+
312
+ options.apply_defaults timeout: @config.timeout,
313
+ metadata: @config.metadata,
314
+ retry_policy: @config.retry_policy
315
+
316
+ @vpc_flow_logs_service_stub.list_vpc_flow_logs_configs request, options do |result, operation|
317
+ yield result, operation if block_given?
318
+ end
319
+ rescue ::Gapic::Rest::Error => e
320
+ raise ::Google::Cloud::Error.from_error(e)
321
+ end
322
+
323
+ ##
324
+ # Gets the details of a specific `VpcFlowLogsConfig`.
325
+ #
326
+ # @overload get_vpc_flow_logs_config(request, options = nil)
327
+ # Pass arguments to `get_vpc_flow_logs_config` via a request object, either of type
328
+ # {::Google::Cloud::NetworkManagement::V1::GetVpcFlowLogsConfigRequest} or an equivalent Hash.
329
+ #
330
+ # @param request [::Google::Cloud::NetworkManagement::V1::GetVpcFlowLogsConfigRequest, ::Hash]
331
+ # A request object representing the call parameters. Required. To specify no
332
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
333
+ # @param options [::Gapic::CallOptions, ::Hash]
334
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
335
+ #
336
+ # @overload get_vpc_flow_logs_config(name: nil)
337
+ # Pass arguments to `get_vpc_flow_logs_config` via keyword arguments. Note that at
338
+ # least one keyword argument is required. To specify no parameters, or to keep all
339
+ # the default parameter values, pass an empty Hash as a request object (see above).
340
+ #
341
+ # @param name [::String]
342
+ # Required. `VpcFlowLogsConfig` resource name using the form:
343
+ # `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}`
344
+ # @yield [result, operation] Access the result along with the TransportOperation object
345
+ # @yieldparam result [::Google::Cloud::NetworkManagement::V1::VpcFlowLogsConfig]
346
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
347
+ #
348
+ # @return [::Google::Cloud::NetworkManagement::V1::VpcFlowLogsConfig]
349
+ #
350
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
351
+ #
352
+ # @example Basic example
353
+ # require "google/cloud/network_management/v1"
354
+ #
355
+ # # Create a client object. The client can be reused for multiple calls.
356
+ # client = Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new
357
+ #
358
+ # # Create a request. To set request fields, pass in keyword arguments.
359
+ # request = Google::Cloud::NetworkManagement::V1::GetVpcFlowLogsConfigRequest.new
360
+ #
361
+ # # Call the get_vpc_flow_logs_config method.
362
+ # result = client.get_vpc_flow_logs_config request
363
+ #
364
+ # # The returned object is of type Google::Cloud::NetworkManagement::V1::VpcFlowLogsConfig.
365
+ # p result
366
+ #
367
+ def get_vpc_flow_logs_config request, options = nil
368
+ raise ::ArgumentError, "request must be provided" if request.nil?
369
+
370
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::GetVpcFlowLogsConfigRequest
371
+
372
+ # Converts hash and nil to an options object
373
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
374
+
375
+ # Customize the options with defaults
376
+ call_metadata = @config.rpcs.get_vpc_flow_logs_config.metadata.to_h
377
+
378
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
379
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
380
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
381
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
382
+ transports_version_send: [:rest]
383
+
384
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
385
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
386
+
387
+ options.apply_defaults timeout: @config.rpcs.get_vpc_flow_logs_config.timeout,
388
+ metadata: call_metadata,
389
+ retry_policy: @config.rpcs.get_vpc_flow_logs_config.retry_policy
390
+
391
+ options.apply_defaults timeout: @config.timeout,
392
+ metadata: @config.metadata,
393
+ retry_policy: @config.retry_policy
394
+
395
+ @vpc_flow_logs_service_stub.get_vpc_flow_logs_config request, options do |result, operation|
396
+ yield result, operation if block_given?
397
+ end
398
+ rescue ::Gapic::Rest::Error => e
399
+ raise ::Google::Cloud::Error.from_error(e)
400
+ end
401
+
402
+ ##
403
+ # Creates a new `VpcFlowLogsConfig`.
404
+ # If a configuration with the exact same settings already exists (even if the
405
+ # ID is different), the creation fails.
406
+ # Notes:
407
+ #
408
+ # 1. Creating a configuration with state=DISABLED will fail
409
+ # 2. The following fields are not considered as `settings` for the purpose
410
+ # of the check mentioned above, therefore - creating another configuration
411
+ # with the same fields but different values for the following fields will
412
+ # fail as well:
413
+ # * name
414
+ # * create_time
415
+ # * update_time
416
+ # * labels
417
+ # * description
418
+ #
419
+ # @overload create_vpc_flow_logs_config(request, options = nil)
420
+ # Pass arguments to `create_vpc_flow_logs_config` via a request object, either of type
421
+ # {::Google::Cloud::NetworkManagement::V1::CreateVpcFlowLogsConfigRequest} or an equivalent Hash.
422
+ #
423
+ # @param request [::Google::Cloud::NetworkManagement::V1::CreateVpcFlowLogsConfigRequest, ::Hash]
424
+ # A request object representing the call parameters. Required. To specify no
425
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
426
+ # @param options [::Gapic::CallOptions, ::Hash]
427
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
428
+ #
429
+ # @overload create_vpc_flow_logs_config(parent: nil, vpc_flow_logs_config_id: nil, vpc_flow_logs_config: nil)
430
+ # Pass arguments to `create_vpc_flow_logs_config` via keyword arguments. Note that at
431
+ # least one keyword argument is required. To specify no parameters, or to keep all
432
+ # the default parameter values, pass an empty Hash as a request object (see above).
433
+ #
434
+ # @param parent [::String]
435
+ # Required. The parent resource of the VPC Flow Logs configuration to create:
436
+ # `projects/{project_id}/locations/global`
437
+ # @param vpc_flow_logs_config_id [::String]
438
+ # Required. ID of the `VpcFlowLogsConfig`.
439
+ # @param vpc_flow_logs_config [::Google::Cloud::NetworkManagement::V1::VpcFlowLogsConfig, ::Hash]
440
+ # Required. A `VpcFlowLogsConfig` resource
441
+ # @yield [result, operation] Access the result along with the TransportOperation object
442
+ # @yieldparam result [::Gapic::Operation]
443
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
444
+ #
445
+ # @return [::Gapic::Operation]
446
+ #
447
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
448
+ #
449
+ # @example Basic example
450
+ # require "google/cloud/network_management/v1"
451
+ #
452
+ # # Create a client object. The client can be reused for multiple calls.
453
+ # client = Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new
454
+ #
455
+ # # Create a request. To set request fields, pass in keyword arguments.
456
+ # request = Google::Cloud::NetworkManagement::V1::CreateVpcFlowLogsConfigRequest.new
457
+ #
458
+ # # Call the create_vpc_flow_logs_config method.
459
+ # result = client.create_vpc_flow_logs_config request
460
+ #
461
+ # # The returned object is of type Gapic::Operation. You can use it to
462
+ # # check the status of an operation, cancel it, or wait for results.
463
+ # # Here is how to wait for a response.
464
+ # result.wait_until_done! timeout: 60
465
+ # if result.response?
466
+ # p result.response
467
+ # else
468
+ # puts "No response received."
469
+ # end
470
+ #
471
+ def create_vpc_flow_logs_config request, options = nil
472
+ raise ::ArgumentError, "request must be provided" if request.nil?
473
+
474
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::CreateVpcFlowLogsConfigRequest
475
+
476
+ # Converts hash and nil to an options object
477
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
478
+
479
+ # Customize the options with defaults
480
+ call_metadata = @config.rpcs.create_vpc_flow_logs_config.metadata.to_h
481
+
482
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
483
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
484
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
485
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
486
+ transports_version_send: [:rest]
487
+
488
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
489
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
490
+
491
+ options.apply_defaults timeout: @config.rpcs.create_vpc_flow_logs_config.timeout,
492
+ metadata: call_metadata,
493
+ retry_policy: @config.rpcs.create_vpc_flow_logs_config.retry_policy
494
+
495
+ options.apply_defaults timeout: @config.timeout,
496
+ metadata: @config.metadata,
497
+ retry_policy: @config.retry_policy
498
+
499
+ @vpc_flow_logs_service_stub.create_vpc_flow_logs_config request, options do |result, operation|
500
+ result = ::Gapic::Operation.new result, @operations_client, options: options
501
+ yield result, operation if block_given?
502
+ throw :response, result
503
+ end
504
+ rescue ::Gapic::Rest::Error => e
505
+ raise ::Google::Cloud::Error.from_error(e)
506
+ end
507
+
508
+ ##
509
+ # Updates an existing `VpcFlowLogsConfig`.
510
+ # If a configuration with the exact same settings already exists (even if the
511
+ # ID is different), the creation fails.
512
+ # Notes:
513
+ #
514
+ # 1. Updating a configuration with state=DISABLED will fail.
515
+ # 2. The following fields are not considered as `settings` for the purpose
516
+ # of the check mentioned above, therefore - updating another configuration
517
+ # with the same fields but different values for the following fields will
518
+ # fail as well:
519
+ # * name
520
+ # * create_time
521
+ # * update_time
522
+ # * labels
523
+ # * description
524
+ #
525
+ # @overload update_vpc_flow_logs_config(request, options = nil)
526
+ # Pass arguments to `update_vpc_flow_logs_config` via a request object, either of type
527
+ # {::Google::Cloud::NetworkManagement::V1::UpdateVpcFlowLogsConfigRequest} or an equivalent Hash.
528
+ #
529
+ # @param request [::Google::Cloud::NetworkManagement::V1::UpdateVpcFlowLogsConfigRequest, ::Hash]
530
+ # A request object representing the call parameters. Required. To specify no
531
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
532
+ # @param options [::Gapic::CallOptions, ::Hash]
533
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
534
+ #
535
+ # @overload update_vpc_flow_logs_config(update_mask: nil, vpc_flow_logs_config: nil)
536
+ # Pass arguments to `update_vpc_flow_logs_config` via keyword arguments. Note that at
537
+ # least one keyword argument is required. To specify no parameters, or to keep all
538
+ # the default parameter values, pass an empty Hash as a request object (see above).
539
+ #
540
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
541
+ # Required. Mask of fields to update. At least one path must be supplied in
542
+ # this field.
543
+ # @param vpc_flow_logs_config [::Google::Cloud::NetworkManagement::V1::VpcFlowLogsConfig, ::Hash]
544
+ # Required. Only fields specified in update_mask are updated.
545
+ # @yield [result, operation] Access the result along with the TransportOperation object
546
+ # @yieldparam result [::Gapic::Operation]
547
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
548
+ #
549
+ # @return [::Gapic::Operation]
550
+ #
551
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
552
+ #
553
+ # @example Basic example
554
+ # require "google/cloud/network_management/v1"
555
+ #
556
+ # # Create a client object. The client can be reused for multiple calls.
557
+ # client = Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new
558
+ #
559
+ # # Create a request. To set request fields, pass in keyword arguments.
560
+ # request = Google::Cloud::NetworkManagement::V1::UpdateVpcFlowLogsConfigRequest.new
561
+ #
562
+ # # Call the update_vpc_flow_logs_config method.
563
+ # result = client.update_vpc_flow_logs_config request
564
+ #
565
+ # # The returned object is of type Gapic::Operation. You can use it to
566
+ # # check the status of an operation, cancel it, or wait for results.
567
+ # # Here is how to wait for a response.
568
+ # result.wait_until_done! timeout: 60
569
+ # if result.response?
570
+ # p result.response
571
+ # else
572
+ # puts "No response received."
573
+ # end
574
+ #
575
+ def update_vpc_flow_logs_config request, options = nil
576
+ raise ::ArgumentError, "request must be provided" if request.nil?
577
+
578
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::UpdateVpcFlowLogsConfigRequest
579
+
580
+ # Converts hash and nil to an options object
581
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
582
+
583
+ # Customize the options with defaults
584
+ call_metadata = @config.rpcs.update_vpc_flow_logs_config.metadata.to_h
585
+
586
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
587
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
588
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
589
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
590
+ transports_version_send: [:rest]
591
+
592
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
593
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
594
+
595
+ options.apply_defaults timeout: @config.rpcs.update_vpc_flow_logs_config.timeout,
596
+ metadata: call_metadata,
597
+ retry_policy: @config.rpcs.update_vpc_flow_logs_config.retry_policy
598
+
599
+ options.apply_defaults timeout: @config.timeout,
600
+ metadata: @config.metadata,
601
+ retry_policy: @config.retry_policy
602
+
603
+ @vpc_flow_logs_service_stub.update_vpc_flow_logs_config request, options do |result, operation|
604
+ result = ::Gapic::Operation.new result, @operations_client, options: options
605
+ yield result, operation if block_given?
606
+ throw :response, result
607
+ end
608
+ rescue ::Gapic::Rest::Error => e
609
+ raise ::Google::Cloud::Error.from_error(e)
610
+ end
611
+
612
+ ##
613
+ # Deletes a specific `VpcFlowLogsConfig`.
614
+ #
615
+ # @overload delete_vpc_flow_logs_config(request, options = nil)
616
+ # Pass arguments to `delete_vpc_flow_logs_config` via a request object, either of type
617
+ # {::Google::Cloud::NetworkManagement::V1::DeleteVpcFlowLogsConfigRequest} or an equivalent Hash.
618
+ #
619
+ # @param request [::Google::Cloud::NetworkManagement::V1::DeleteVpcFlowLogsConfigRequest, ::Hash]
620
+ # A request object representing the call parameters. Required. To specify no
621
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
622
+ # @param options [::Gapic::CallOptions, ::Hash]
623
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
624
+ #
625
+ # @overload delete_vpc_flow_logs_config(name: nil)
626
+ # Pass arguments to `delete_vpc_flow_logs_config` via keyword arguments. Note that at
627
+ # least one keyword argument is required. To specify no parameters, or to keep all
628
+ # the default parameter values, pass an empty Hash as a request object (see above).
629
+ #
630
+ # @param name [::String]
631
+ # Required. `VpcFlowLogsConfig` resource name using the form:
632
+ # `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config}`
633
+ # @yield [result, operation] Access the result along with the TransportOperation object
634
+ # @yieldparam result [::Gapic::Operation]
635
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
636
+ #
637
+ # @return [::Gapic::Operation]
638
+ #
639
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
640
+ #
641
+ # @example Basic example
642
+ # require "google/cloud/network_management/v1"
643
+ #
644
+ # # Create a client object. The client can be reused for multiple calls.
645
+ # client = Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new
646
+ #
647
+ # # Create a request. To set request fields, pass in keyword arguments.
648
+ # request = Google::Cloud::NetworkManagement::V1::DeleteVpcFlowLogsConfigRequest.new
649
+ #
650
+ # # Call the delete_vpc_flow_logs_config method.
651
+ # result = client.delete_vpc_flow_logs_config request
652
+ #
653
+ # # The returned object is of type Gapic::Operation. You can use it to
654
+ # # check the status of an operation, cancel it, or wait for results.
655
+ # # Here is how to wait for a response.
656
+ # result.wait_until_done! timeout: 60
657
+ # if result.response?
658
+ # p result.response
659
+ # else
660
+ # puts "No response received."
661
+ # end
662
+ #
663
+ def delete_vpc_flow_logs_config request, options = nil
664
+ raise ::ArgumentError, "request must be provided" if request.nil?
665
+
666
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::DeleteVpcFlowLogsConfigRequest
667
+
668
+ # Converts hash and nil to an options object
669
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
670
+
671
+ # Customize the options with defaults
672
+ call_metadata = @config.rpcs.delete_vpc_flow_logs_config.metadata.to_h
673
+
674
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
675
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
676
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
677
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
678
+ transports_version_send: [:rest]
679
+
680
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
681
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
682
+
683
+ options.apply_defaults timeout: @config.rpcs.delete_vpc_flow_logs_config.timeout,
684
+ metadata: call_metadata,
685
+ retry_policy: @config.rpcs.delete_vpc_flow_logs_config.retry_policy
686
+
687
+ options.apply_defaults timeout: @config.timeout,
688
+ metadata: @config.metadata,
689
+ retry_policy: @config.retry_policy
690
+
691
+ @vpc_flow_logs_service_stub.delete_vpc_flow_logs_config request, options do |result, operation|
692
+ result = ::Gapic::Operation.new result, @operations_client, options: options
693
+ yield result, operation if block_given?
694
+ throw :response, result
695
+ end
696
+ rescue ::Gapic::Rest::Error => e
697
+ raise ::Google::Cloud::Error.from_error(e)
698
+ end
699
+
700
+ ##
701
+ # Configuration class for the VpcFlowLogsService REST API.
702
+ #
703
+ # This class represents the configuration for VpcFlowLogsService REST,
704
+ # providing control over timeouts, retry behavior, logging, transport
705
+ # parameters, and other low-level controls. Certain parameters can also be
706
+ # applied individually to specific RPCs. See
707
+ # {::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client::Configuration::Rpcs}
708
+ # for a list of RPCs that can be configured independently.
709
+ #
710
+ # Configuration can be applied globally to all clients, or to a single client
711
+ # on construction.
712
+ #
713
+ # @example
714
+ #
715
+ # # Modify the global config, setting the timeout for
716
+ # # list_vpc_flow_logs_configs to 20 seconds,
717
+ # # and all remaining timeouts to 10 seconds.
718
+ # ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.configure do |config|
719
+ # config.timeout = 10.0
720
+ # config.rpcs.list_vpc_flow_logs_configs.timeout = 20.0
721
+ # end
722
+ #
723
+ # # Apply the above configuration only to a new client.
724
+ # client = ::Google::Cloud::NetworkManagement::V1::VpcFlowLogsService::Rest::Client.new do |config|
725
+ # config.timeout = 10.0
726
+ # config.rpcs.list_vpc_flow_logs_configs.timeout = 20.0
727
+ # end
728
+ #
729
+ # @!attribute [rw] endpoint
730
+ # A custom service endpoint, as a hostname or hostname:port. The default is
731
+ # nil, indicating to use the default endpoint in the current universe domain.
732
+ # @return [::String,nil]
733
+ # @!attribute [rw] credentials
734
+ # Credentials to send with calls. You may provide any of the following types:
735
+ # * (`String`) The path to a service account key file in JSON format
736
+ # * (`Hash`) A service account key as a Hash
737
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
738
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
739
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
740
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
741
+ # * (`nil`) indicating no credentials
742
+ #
743
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
744
+ # external source for authentication to Google Cloud, you must validate it before
745
+ # providing it to a Google API client library. Providing an unvalidated credential
746
+ # configuration to Google APIs can compromise the security of your systems and data.
747
+ # For more information, refer to [Validate credential configurations from external
748
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
749
+ # @return [::Object]
750
+ # @!attribute [rw] scope
751
+ # The OAuth scopes
752
+ # @return [::Array<::String>]
753
+ # @!attribute [rw] lib_name
754
+ # The library name as recorded in instrumentation and logging
755
+ # @return [::String]
756
+ # @!attribute [rw] lib_version
757
+ # The library version as recorded in instrumentation and logging
758
+ # @return [::String]
759
+ # @!attribute [rw] timeout
760
+ # The call timeout in seconds.
761
+ # @return [::Numeric]
762
+ # @!attribute [rw] metadata
763
+ # Additional headers to be sent with the call.
764
+ # @return [::Hash{::Symbol=>::String}]
765
+ # @!attribute [rw] retry_policy
766
+ # The retry policy. The value is a hash with the following keys:
767
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
768
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
769
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
770
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
771
+ # trigger a retry.
772
+ # @return [::Hash]
773
+ # @!attribute [rw] quota_project
774
+ # A separate project against which to charge quota.
775
+ # @return [::String]
776
+ # @!attribute [rw] universe_domain
777
+ # The universe domain within which to make requests. This determines the
778
+ # default endpoint URL. The default value of nil uses the environment
779
+ # universe (usually the default "googleapis.com" universe).
780
+ # @return [::String,nil]
781
+ # @!attribute [rw] logger
782
+ # A custom logger to use for request/response debug logging, or the value
783
+ # `:default` (the default) to construct a default logger, or `nil` to
784
+ # explicitly disable logging.
785
+ # @return [::Logger,:default,nil]
786
+ #
787
+ class Configuration
788
+ extend ::Gapic::Config
789
+
790
+ # @private
791
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
792
+ DEFAULT_ENDPOINT = "networkmanagement.googleapis.com"
793
+
794
+ config_attr :endpoint, nil, ::String, nil
795
+ config_attr :credentials, nil do |value|
796
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
797
+ allowed.any? { |klass| klass === value }
798
+ end
799
+ config_attr :scope, nil, ::String, ::Array, nil
800
+ config_attr :lib_name, nil, ::String, nil
801
+ config_attr :lib_version, nil, ::String, nil
802
+ config_attr :timeout, nil, ::Numeric, nil
803
+ config_attr :metadata, nil, ::Hash, nil
804
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
805
+ config_attr :quota_project, nil, ::String, nil
806
+ config_attr :universe_domain, nil, ::String, nil
807
+
808
+ # @private
809
+ # Overrides for http bindings for the RPCs of this service
810
+ # are only used when this service is used as mixin, and only
811
+ # by the host service.
812
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
813
+ config_attr :bindings_override, {}, ::Hash, nil
814
+ config_attr :logger, :default, ::Logger, nil, :default
815
+
816
+ # @private
817
+ def initialize parent_config = nil
818
+ @parent_config = parent_config unless parent_config.nil?
819
+
820
+ yield self if block_given?
821
+ end
822
+
823
+ ##
824
+ # Configurations for individual RPCs
825
+ # @return [Rpcs]
826
+ #
827
+ def rpcs
828
+ @rpcs ||= begin
829
+ parent_rpcs = nil
830
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
831
+ Rpcs.new parent_rpcs
832
+ end
833
+ end
834
+
835
+ ##
836
+ # Configuration RPC class for the VpcFlowLogsService API.
837
+ #
838
+ # Includes fields providing the configuration for each RPC in this service.
839
+ # Each configuration object is of type `Gapic::Config::Method` and includes
840
+ # the following configuration fields:
841
+ #
842
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
843
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
844
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
845
+ # include the following keys:
846
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
847
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
848
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
849
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
850
+ # trigger a retry.
851
+ #
852
+ class Rpcs
853
+ ##
854
+ # RPC-specific configuration for `list_vpc_flow_logs_configs`
855
+ # @return [::Gapic::Config::Method]
856
+ #
857
+ attr_reader :list_vpc_flow_logs_configs
858
+ ##
859
+ # RPC-specific configuration for `get_vpc_flow_logs_config`
860
+ # @return [::Gapic::Config::Method]
861
+ #
862
+ attr_reader :get_vpc_flow_logs_config
863
+ ##
864
+ # RPC-specific configuration for `create_vpc_flow_logs_config`
865
+ # @return [::Gapic::Config::Method]
866
+ #
867
+ attr_reader :create_vpc_flow_logs_config
868
+ ##
869
+ # RPC-specific configuration for `update_vpc_flow_logs_config`
870
+ # @return [::Gapic::Config::Method]
871
+ #
872
+ attr_reader :update_vpc_flow_logs_config
873
+ ##
874
+ # RPC-specific configuration for `delete_vpc_flow_logs_config`
875
+ # @return [::Gapic::Config::Method]
876
+ #
877
+ attr_reader :delete_vpc_flow_logs_config
878
+
879
+ # @private
880
+ def initialize parent_rpcs = nil
881
+ list_vpc_flow_logs_configs_config = parent_rpcs.list_vpc_flow_logs_configs if parent_rpcs.respond_to? :list_vpc_flow_logs_configs
882
+ @list_vpc_flow_logs_configs = ::Gapic::Config::Method.new list_vpc_flow_logs_configs_config
883
+ get_vpc_flow_logs_config_config = parent_rpcs.get_vpc_flow_logs_config if parent_rpcs.respond_to? :get_vpc_flow_logs_config
884
+ @get_vpc_flow_logs_config = ::Gapic::Config::Method.new get_vpc_flow_logs_config_config
885
+ create_vpc_flow_logs_config_config = parent_rpcs.create_vpc_flow_logs_config if parent_rpcs.respond_to? :create_vpc_flow_logs_config
886
+ @create_vpc_flow_logs_config = ::Gapic::Config::Method.new create_vpc_flow_logs_config_config
887
+ update_vpc_flow_logs_config_config = parent_rpcs.update_vpc_flow_logs_config if parent_rpcs.respond_to? :update_vpc_flow_logs_config
888
+ @update_vpc_flow_logs_config = ::Gapic::Config::Method.new update_vpc_flow_logs_config_config
889
+ delete_vpc_flow_logs_config_config = parent_rpcs.delete_vpc_flow_logs_config if parent_rpcs.respond_to? :delete_vpc_flow_logs_config
890
+ @delete_vpc_flow_logs_config = ::Gapic::Config::Method.new delete_vpc_flow_logs_config_config
891
+
892
+ yield self if block_given?
893
+ end
894
+ end
895
+ end
896
+ end
897
+ end
898
+ end
899
+ end
900
+ end
901
+ end
902
+ end