google-cloud-network_management-v1 1.3.0 → 1.5.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 (26) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/network_management/v1/reachability_service/client.rb +34 -7
  4. data/lib/google/cloud/network_management/v1/reachability_service/operations.rb +9 -5
  5. data/lib/google/cloud/network_management/v1/reachability_service/rest/client.rb +33 -7
  6. data/lib/google/cloud/network_management/v1/reachability_service/rest/operations.rb +40 -28
  7. data/lib/google/cloud/network_management/v1/reachability_service/rest/service_stub.rb +62 -38
  8. data/lib/google/cloud/network_management/v1/rest.rb +1 -0
  9. data/lib/google/cloud/network_management/v1/version.rb +1 -1
  10. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/client.rb +949 -0
  11. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/credentials.rb +47 -0
  12. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/operations.rb +806 -0
  13. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/paths.rb +69 -0
  14. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest/client.rb +895 -0
  15. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest/operations.rb +907 -0
  16. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest/service_stub.rb +388 -0
  17. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service/rest.rb +56 -0
  18. data/lib/google/cloud/network_management/v1/vpc_flow_logs_service.rb +58 -0
  19. data/lib/google/cloud/network_management/v1.rb +1 -0
  20. data/lib/google/cloud/networkmanagement/v1/vpc_flow_logs_config_pb.rb +51 -0
  21. data/lib/google/cloud/networkmanagement/v1/vpc_flow_logs_pb.rb +59 -0
  22. data/lib/google/cloud/networkmanagement/v1/vpc_flow_logs_services_pb.rb +83 -0
  23. data/proto_docs/google/api/client.rb +19 -0
  24. data/proto_docs/google/cloud/networkmanagement/v1/vpc_flow_logs.rb +115 -0
  25. data/proto_docs/google/cloud/networkmanagement/v1/vpc_flow_logs_config.rb +163 -0
  26. metadata +19 -8
@@ -0,0 +1,895 @@
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
+ # @return [::Object]
743
+ # @!attribute [rw] scope
744
+ # The OAuth scopes
745
+ # @return [::Array<::String>]
746
+ # @!attribute [rw] lib_name
747
+ # The library name as recorded in instrumentation and logging
748
+ # @return [::String]
749
+ # @!attribute [rw] lib_version
750
+ # The library version as recorded in instrumentation and logging
751
+ # @return [::String]
752
+ # @!attribute [rw] timeout
753
+ # The call timeout in seconds.
754
+ # @return [::Numeric]
755
+ # @!attribute [rw] metadata
756
+ # Additional headers to be sent with the call.
757
+ # @return [::Hash{::Symbol=>::String}]
758
+ # @!attribute [rw] retry_policy
759
+ # The retry policy. The value is a hash with the following keys:
760
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
761
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
762
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
763
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
764
+ # trigger a retry.
765
+ # @return [::Hash]
766
+ # @!attribute [rw] quota_project
767
+ # A separate project against which to charge quota.
768
+ # @return [::String]
769
+ # @!attribute [rw] universe_domain
770
+ # The universe domain within which to make requests. This determines the
771
+ # default endpoint URL. The default value of nil uses the environment
772
+ # universe (usually the default "googleapis.com" universe).
773
+ # @return [::String,nil]
774
+ # @!attribute [rw] logger
775
+ # A custom logger to use for request/response debug logging, or the value
776
+ # `:default` (the default) to construct a default logger, or `nil` to
777
+ # explicitly disable logging.
778
+ # @return [::Logger,:default,nil]
779
+ #
780
+ class Configuration
781
+ extend ::Gapic::Config
782
+
783
+ # @private
784
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
785
+ DEFAULT_ENDPOINT = "networkmanagement.googleapis.com"
786
+
787
+ config_attr :endpoint, nil, ::String, nil
788
+ config_attr :credentials, nil do |value|
789
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
790
+ allowed.any? { |klass| klass === value }
791
+ end
792
+ config_attr :scope, nil, ::String, ::Array, nil
793
+ config_attr :lib_name, nil, ::String, nil
794
+ config_attr :lib_version, nil, ::String, nil
795
+ config_attr :timeout, nil, ::Numeric, nil
796
+ config_attr :metadata, nil, ::Hash, nil
797
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
798
+ config_attr :quota_project, nil, ::String, nil
799
+ config_attr :universe_domain, nil, ::String, nil
800
+
801
+ # @private
802
+ # Overrides for http bindings for the RPCs of this service
803
+ # are only used when this service is used as mixin, and only
804
+ # by the host service.
805
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
806
+ config_attr :bindings_override, {}, ::Hash, nil
807
+ config_attr :logger, :default, ::Logger, nil, :default
808
+
809
+ # @private
810
+ def initialize parent_config = nil
811
+ @parent_config = parent_config unless parent_config.nil?
812
+
813
+ yield self if block_given?
814
+ end
815
+
816
+ ##
817
+ # Configurations for individual RPCs
818
+ # @return [Rpcs]
819
+ #
820
+ def rpcs
821
+ @rpcs ||= begin
822
+ parent_rpcs = nil
823
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
824
+ Rpcs.new parent_rpcs
825
+ end
826
+ end
827
+
828
+ ##
829
+ # Configuration RPC class for the VpcFlowLogsService API.
830
+ #
831
+ # Includes fields providing the configuration for each RPC in this service.
832
+ # Each configuration object is of type `Gapic::Config::Method` and includes
833
+ # the following configuration fields:
834
+ #
835
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
836
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
837
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
838
+ # include the following keys:
839
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
840
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
841
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
842
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
843
+ # trigger a retry.
844
+ #
845
+ class Rpcs
846
+ ##
847
+ # RPC-specific configuration for `list_vpc_flow_logs_configs`
848
+ # @return [::Gapic::Config::Method]
849
+ #
850
+ attr_reader :list_vpc_flow_logs_configs
851
+ ##
852
+ # RPC-specific configuration for `get_vpc_flow_logs_config`
853
+ # @return [::Gapic::Config::Method]
854
+ #
855
+ attr_reader :get_vpc_flow_logs_config
856
+ ##
857
+ # RPC-specific configuration for `create_vpc_flow_logs_config`
858
+ # @return [::Gapic::Config::Method]
859
+ #
860
+ attr_reader :create_vpc_flow_logs_config
861
+ ##
862
+ # RPC-specific configuration for `update_vpc_flow_logs_config`
863
+ # @return [::Gapic::Config::Method]
864
+ #
865
+ attr_reader :update_vpc_flow_logs_config
866
+ ##
867
+ # RPC-specific configuration for `delete_vpc_flow_logs_config`
868
+ # @return [::Gapic::Config::Method]
869
+ #
870
+ attr_reader :delete_vpc_flow_logs_config
871
+
872
+ # @private
873
+ def initialize parent_rpcs = nil
874
+ list_vpc_flow_logs_configs_config = parent_rpcs.list_vpc_flow_logs_configs if parent_rpcs.respond_to? :list_vpc_flow_logs_configs
875
+ @list_vpc_flow_logs_configs = ::Gapic::Config::Method.new list_vpc_flow_logs_configs_config
876
+ get_vpc_flow_logs_config_config = parent_rpcs.get_vpc_flow_logs_config if parent_rpcs.respond_to? :get_vpc_flow_logs_config
877
+ @get_vpc_flow_logs_config = ::Gapic::Config::Method.new get_vpc_flow_logs_config_config
878
+ create_vpc_flow_logs_config_config = parent_rpcs.create_vpc_flow_logs_config if parent_rpcs.respond_to? :create_vpc_flow_logs_config
879
+ @create_vpc_flow_logs_config = ::Gapic::Config::Method.new create_vpc_flow_logs_config_config
880
+ update_vpc_flow_logs_config_config = parent_rpcs.update_vpc_flow_logs_config if parent_rpcs.respond_to? :update_vpc_flow_logs_config
881
+ @update_vpc_flow_logs_config = ::Gapic::Config::Method.new update_vpc_flow_logs_config_config
882
+ delete_vpc_flow_logs_config_config = parent_rpcs.delete_vpc_flow_logs_config if parent_rpcs.respond_to? :delete_vpc_flow_logs_config
883
+ @delete_vpc_flow_logs_config = ::Gapic::Config::Method.new delete_vpc_flow_logs_config_config
884
+
885
+ yield self if block_given?
886
+ end
887
+ end
888
+ end
889
+ end
890
+ end
891
+ end
892
+ end
893
+ end
894
+ end
895
+ end