google-cloud-network_connectivity-v1 1.6.0 → 1.7.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.
@@ -0,0 +1,983 @@
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/networkconnectivity/v1/internal_range_pb"
21
+ require "google/cloud/location"
22
+ require "google/iam/v1"
23
+
24
+ module Google
25
+ module Cloud
26
+ module NetworkConnectivity
27
+ module V1
28
+ module InternalRangeService
29
+ ##
30
+ # Client for the InternalRangeService service.
31
+ #
32
+ # The CLH-based service for internal range resources used to perform IPAM
33
+ # operations within a VPC network.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "networkconnectivity.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :internal_range_service_stub
46
+
47
+ ##
48
+ # Configure the InternalRangeService Client class.
49
+ #
50
+ # See {::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all InternalRangeService clients
56
+ # ::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "NetworkConnectivity", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.list_internal_ranges.timeout = 60.0
82
+
83
+ default_config.rpcs.get_internal_range.timeout = 60.0
84
+
85
+ default_config.rpcs.create_internal_range.timeout = 60.0
86
+
87
+ default_config.rpcs.update_internal_range.timeout = 60.0
88
+
89
+ default_config.rpcs.delete_internal_range.timeout = 60.0
90
+
91
+ default_config
92
+ end
93
+ yield @configure if block_given?
94
+ @configure
95
+ end
96
+
97
+ ##
98
+ # Configure the InternalRangeService Client instance.
99
+ #
100
+ # The configuration is set to the derived mode, meaning that values can be changed,
101
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
102
+ # should be made on {Client.configure}.
103
+ #
104
+ # See {::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client::Configuration}
105
+ # for a description of the configuration fields.
106
+ #
107
+ # @yield [config] Configure the Client client.
108
+ # @yieldparam config [Client::Configuration]
109
+ #
110
+ # @return [Client::Configuration]
111
+ #
112
+ def configure
113
+ yield @config if block_given?
114
+ @config
115
+ end
116
+
117
+ ##
118
+ # The effective universe domain
119
+ #
120
+ # @return [String]
121
+ #
122
+ def universe_domain
123
+ @internal_range_service_stub.universe_domain
124
+ end
125
+
126
+ ##
127
+ # Create a new InternalRangeService client object.
128
+ #
129
+ # @example
130
+ #
131
+ # # Create a client using the default configuration
132
+ # client = ::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new
133
+ #
134
+ # # Create a client using a custom configuration
135
+ # client = ::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
138
+ #
139
+ # @yield [config] Configure the InternalRangeService client.
140
+ # @yieldparam config [Client::Configuration]
141
+ #
142
+ def initialize
143
+ # These require statements are intentionally placed here to initialize
144
+ # the gRPC module only when it's required.
145
+ # See https://github.com/googleapis/toolkit/issues/446
146
+ require "gapic/grpc"
147
+ require "google/cloud/networkconnectivity/v1/internal_range_services_pb"
148
+
149
+ # Create the configuration object
150
+ @config = Configuration.new Client.configure
151
+
152
+ # Yield the configuration if needed
153
+ yield @config if block_given?
154
+
155
+ # Create credentials
156
+ credentials = @config.credentials
157
+ # Use self-signed JWT if the endpoint is unchanged from default,
158
+ # but only if the default endpoint does not have a region prefix.
159
+ enable_self_signed_jwt = @config.endpoint.nil? ||
160
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
161
+ !@config.endpoint.split(".").first.include?("-"))
162
+ credentials ||= Credentials.default scope: @config.scope,
163
+ enable_self_signed_jwt: enable_self_signed_jwt
164
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
165
+ credentials = Credentials.new credentials, scope: @config.scope
166
+ end
167
+ @quota_project_id = @config.quota_project
168
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
169
+
170
+ @operations_client = Operations.new do |config|
171
+ config.credentials = credentials
172
+ config.quota_project = @quota_project_id
173
+ config.endpoint = @config.endpoint
174
+ config.universe_domain = @config.universe_domain
175
+ end
176
+
177
+ @internal_range_service_stub = ::Gapic::ServiceStub.new(
178
+ ::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Stub,
179
+ credentials: credentials,
180
+ endpoint: @config.endpoint,
181
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
182
+ universe_domain: @config.universe_domain,
183
+ channel_args: @config.channel_args,
184
+ interceptors: @config.interceptors,
185
+ channel_pool_config: @config.channel_pool,
186
+ logger: @config.logger
187
+ )
188
+
189
+ @internal_range_service_stub.stub_logger&.info do |entry|
190
+ entry.set_system_name
191
+ entry.set_service
192
+ entry.message = "Created client for #{entry.service}"
193
+ entry.set_credentials_fields credentials
194
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
195
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
196
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
197
+ end
198
+
199
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
200
+ config.credentials = credentials
201
+ config.quota_project = @quota_project_id
202
+ config.endpoint = @internal_range_service_stub.endpoint
203
+ config.universe_domain = @internal_range_service_stub.universe_domain
204
+ config.logger = @internal_range_service_stub.logger if config.respond_to? :logger=
205
+ end
206
+
207
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
208
+ config.credentials = credentials
209
+ config.quota_project = @quota_project_id
210
+ config.endpoint = @internal_range_service_stub.endpoint
211
+ config.universe_domain = @internal_range_service_stub.universe_domain
212
+ config.logger = @internal_range_service_stub.logger if config.respond_to? :logger=
213
+ end
214
+ end
215
+
216
+ ##
217
+ # Get the associated client for long-running operations.
218
+ #
219
+ # @return [::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Operations]
220
+ #
221
+ attr_reader :operations_client
222
+
223
+ ##
224
+ # Get the associated client for mix-in of the Locations.
225
+ #
226
+ # @return [Google::Cloud::Location::Locations::Client]
227
+ #
228
+ attr_reader :location_client
229
+
230
+ ##
231
+ # Get the associated client for mix-in of the IAMPolicy.
232
+ #
233
+ # @return [Google::Iam::V1::IAMPolicy::Client]
234
+ #
235
+ attr_reader :iam_policy_client
236
+
237
+ ##
238
+ # The logger used for request/response debug logging.
239
+ #
240
+ # @return [Logger]
241
+ #
242
+ def logger
243
+ @internal_range_service_stub.logger
244
+ end
245
+
246
+ # Service calls
247
+
248
+ ##
249
+ # Lists internal ranges in a given project and location.
250
+ #
251
+ # @overload list_internal_ranges(request, options = nil)
252
+ # Pass arguments to `list_internal_ranges` via a request object, either of type
253
+ # {::Google::Cloud::NetworkConnectivity::V1::ListInternalRangesRequest} or an equivalent Hash.
254
+ #
255
+ # @param request [::Google::Cloud::NetworkConnectivity::V1::ListInternalRangesRequest, ::Hash]
256
+ # A request object representing the call parameters. Required. To specify no
257
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
258
+ # @param options [::Gapic::CallOptions, ::Hash]
259
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
260
+ #
261
+ # @overload list_internal_ranges(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
262
+ # Pass arguments to `list_internal_ranges` via keyword arguments. Note that at
263
+ # least one keyword argument is required. To specify no parameters, or to keep all
264
+ # the default parameter values, pass an empty Hash as a request object (see above).
265
+ #
266
+ # @param parent [::String]
267
+ # Required. The parent resource's name.
268
+ # @param page_size [::Integer]
269
+ # The maximum number of results per page that should be returned.
270
+ # @param page_token [::String]
271
+ # The page token.
272
+ # @param filter [::String]
273
+ # A filter expression that filters the results listed in the response.
274
+ # @param order_by [::String]
275
+ # Sort the results by a certain order.
276
+ #
277
+ # @yield [response, operation] Access the result along with the RPC operation
278
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1::InternalRange>]
279
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
280
+ #
281
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1::InternalRange>]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
284
+ #
285
+ # @example Basic example
286
+ # require "google/cloud/network_connectivity/v1"
287
+ #
288
+ # # Create a client object. The client can be reused for multiple calls.
289
+ # client = Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new
290
+ #
291
+ # # Create a request. To set request fields, pass in keyword arguments.
292
+ # request = Google::Cloud::NetworkConnectivity::V1::ListInternalRangesRequest.new
293
+ #
294
+ # # Call the list_internal_ranges method.
295
+ # result = client.list_internal_ranges request
296
+ #
297
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
298
+ # # over elements, and API calls will be issued to fetch pages as needed.
299
+ # result.each do |item|
300
+ # # Each element is of type ::Google::Cloud::NetworkConnectivity::V1::InternalRange.
301
+ # p item
302
+ # end
303
+ #
304
+ def list_internal_ranges request, options = nil
305
+ raise ::ArgumentError, "request must be provided" if request.nil?
306
+
307
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::ListInternalRangesRequest
308
+
309
+ # Converts hash and nil to an options object
310
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
311
+
312
+ # Customize the options with defaults
313
+ metadata = @config.rpcs.list_internal_ranges.metadata.to_h
314
+
315
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
316
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
317
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
318
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
319
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
320
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
321
+
322
+ header_params = {}
323
+ if request.parent
324
+ header_params["parent"] = request.parent
325
+ end
326
+
327
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
328
+ metadata[:"x-goog-request-params"] ||= request_params_header
329
+
330
+ options.apply_defaults timeout: @config.rpcs.list_internal_ranges.timeout,
331
+ metadata: metadata,
332
+ retry_policy: @config.rpcs.list_internal_ranges.retry_policy
333
+
334
+ options.apply_defaults timeout: @config.timeout,
335
+ metadata: @config.metadata,
336
+ retry_policy: @config.retry_policy
337
+
338
+ @internal_range_service_stub.call_rpc :list_internal_ranges, request, options: options do |response, operation|
339
+ response = ::Gapic::PagedEnumerable.new @internal_range_service_stub, :list_internal_ranges, request, response, operation, options
340
+ yield response, operation if block_given?
341
+ throw :response, response
342
+ end
343
+ rescue ::GRPC::BadStatus => e
344
+ raise ::Google::Cloud::Error.from_error(e)
345
+ end
346
+
347
+ ##
348
+ # Gets details of a single internal range.
349
+ #
350
+ # @overload get_internal_range(request, options = nil)
351
+ # Pass arguments to `get_internal_range` via a request object, either of type
352
+ # {::Google::Cloud::NetworkConnectivity::V1::GetInternalRangeRequest} or an equivalent Hash.
353
+ #
354
+ # @param request [::Google::Cloud::NetworkConnectivity::V1::GetInternalRangeRequest, ::Hash]
355
+ # A request object representing the call parameters. Required. To specify no
356
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
357
+ # @param options [::Gapic::CallOptions, ::Hash]
358
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
359
+ #
360
+ # @overload get_internal_range(name: nil)
361
+ # Pass arguments to `get_internal_range` via keyword arguments. Note that at
362
+ # least one keyword argument is required. To specify no parameters, or to keep all
363
+ # the default parameter values, pass an empty Hash as a request object (see above).
364
+ #
365
+ # @param name [::String]
366
+ # Required. Name of the InternalRange to get.
367
+ #
368
+ # @yield [response, operation] Access the result along with the RPC operation
369
+ # @yieldparam response [::Google::Cloud::NetworkConnectivity::V1::InternalRange]
370
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
371
+ #
372
+ # @return [::Google::Cloud::NetworkConnectivity::V1::InternalRange]
373
+ #
374
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
375
+ #
376
+ # @example Basic example
377
+ # require "google/cloud/network_connectivity/v1"
378
+ #
379
+ # # Create a client object. The client can be reused for multiple calls.
380
+ # client = Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new
381
+ #
382
+ # # Create a request. To set request fields, pass in keyword arguments.
383
+ # request = Google::Cloud::NetworkConnectivity::V1::GetInternalRangeRequest.new
384
+ #
385
+ # # Call the get_internal_range method.
386
+ # result = client.get_internal_range request
387
+ #
388
+ # # The returned object is of type Google::Cloud::NetworkConnectivity::V1::InternalRange.
389
+ # p result
390
+ #
391
+ def get_internal_range request, options = nil
392
+ raise ::ArgumentError, "request must be provided" if request.nil?
393
+
394
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::GetInternalRangeRequest
395
+
396
+ # Converts hash and nil to an options object
397
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
398
+
399
+ # Customize the options with defaults
400
+ metadata = @config.rpcs.get_internal_range.metadata.to_h
401
+
402
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
403
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
404
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
405
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
406
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
407
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
408
+
409
+ header_params = {}
410
+ if request.name
411
+ header_params["name"] = request.name
412
+ end
413
+
414
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
415
+ metadata[:"x-goog-request-params"] ||= request_params_header
416
+
417
+ options.apply_defaults timeout: @config.rpcs.get_internal_range.timeout,
418
+ metadata: metadata,
419
+ retry_policy: @config.rpcs.get_internal_range.retry_policy
420
+
421
+ options.apply_defaults timeout: @config.timeout,
422
+ metadata: @config.metadata,
423
+ retry_policy: @config.retry_policy
424
+
425
+ @internal_range_service_stub.call_rpc :get_internal_range, request, options: options do |response, operation|
426
+ yield response, operation if block_given?
427
+ end
428
+ rescue ::GRPC::BadStatus => e
429
+ raise ::Google::Cloud::Error.from_error(e)
430
+ end
431
+
432
+ ##
433
+ # Creates a new internal range in a given project and location.
434
+ #
435
+ # @overload create_internal_range(request, options = nil)
436
+ # Pass arguments to `create_internal_range` via a request object, either of type
437
+ # {::Google::Cloud::NetworkConnectivity::V1::CreateInternalRangeRequest} or an equivalent Hash.
438
+ #
439
+ # @param request [::Google::Cloud::NetworkConnectivity::V1::CreateInternalRangeRequest, ::Hash]
440
+ # A request object representing the call parameters. Required. To specify no
441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
442
+ # @param options [::Gapic::CallOptions, ::Hash]
443
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
444
+ #
445
+ # @overload create_internal_range(parent: nil, internal_range_id: nil, internal_range: nil, request_id: nil)
446
+ # Pass arguments to `create_internal_range` via keyword arguments. Note that at
447
+ # least one keyword argument is required. To specify no parameters, or to keep all
448
+ # the default parameter values, pass an empty Hash as a request object (see above).
449
+ #
450
+ # @param parent [::String]
451
+ # Required. The parent resource's name of the internal range.
452
+ # @param internal_range_id [::String]
453
+ # Optional. Resource ID
454
+ # (i.e. 'foo' in '[...]/projects/p/locations/l/internalRanges/foo')
455
+ # See https://google.aip.dev/122#resource-id-segments
456
+ # Unique per location.
457
+ # @param internal_range [::Google::Cloud::NetworkConnectivity::V1::InternalRange, ::Hash]
458
+ # Required. Initial values for a new internal range
459
+ # @param request_id [::String]
460
+ # Optional. An optional request ID to identify requests. Specify a unique
461
+ # request ID so that if you must retry your request, the server will know to
462
+ # ignore the request if it has already been completed. The server will
463
+ # guarantee that for at least 60 minutes since the first request.
464
+ #
465
+ # For example, consider a situation where you make an initial request and
466
+ # the request times out. If you make the request again with the same request
467
+ # ID, the server can check if original operation with the same request ID
468
+ # was received, and if so, will ignore the second request. This prevents
469
+ # clients from accidentally creating duplicate commitments.
470
+ #
471
+ # The request ID must be a valid UUID with the exception that zero UUID is
472
+ # not supported (00000000-0000-0000-0000-000000000000).
473
+ #
474
+ # @yield [response, operation] Access the result along with the RPC operation
475
+ # @yieldparam response [::Gapic::Operation]
476
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
477
+ #
478
+ # @return [::Gapic::Operation]
479
+ #
480
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
481
+ #
482
+ # @example Basic example
483
+ # require "google/cloud/network_connectivity/v1"
484
+ #
485
+ # # Create a client object. The client can be reused for multiple calls.
486
+ # client = Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new
487
+ #
488
+ # # Create a request. To set request fields, pass in keyword arguments.
489
+ # request = Google::Cloud::NetworkConnectivity::V1::CreateInternalRangeRequest.new
490
+ #
491
+ # # Call the create_internal_range method.
492
+ # result = client.create_internal_range request
493
+ #
494
+ # # The returned object is of type Gapic::Operation. You can use it to
495
+ # # check the status of an operation, cancel it, or wait for results.
496
+ # # Here is how to wait for a response.
497
+ # result.wait_until_done! timeout: 60
498
+ # if result.response?
499
+ # p result.response
500
+ # else
501
+ # puts "No response received."
502
+ # end
503
+ #
504
+ def create_internal_range request, options = nil
505
+ raise ::ArgumentError, "request must be provided" if request.nil?
506
+
507
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::CreateInternalRangeRequest
508
+
509
+ # Converts hash and nil to an options object
510
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
511
+
512
+ # Customize the options with defaults
513
+ metadata = @config.rpcs.create_internal_range.metadata.to_h
514
+
515
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
516
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
517
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
518
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
519
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
520
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
521
+
522
+ header_params = {}
523
+ if request.parent
524
+ header_params["parent"] = request.parent
525
+ end
526
+
527
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
528
+ metadata[:"x-goog-request-params"] ||= request_params_header
529
+
530
+ options.apply_defaults timeout: @config.rpcs.create_internal_range.timeout,
531
+ metadata: metadata,
532
+ retry_policy: @config.rpcs.create_internal_range.retry_policy
533
+
534
+ options.apply_defaults timeout: @config.timeout,
535
+ metadata: @config.metadata,
536
+ retry_policy: @config.retry_policy
537
+
538
+ @internal_range_service_stub.call_rpc :create_internal_range, request, options: options do |response, operation|
539
+ response = ::Gapic::Operation.new response, @operations_client, options: options
540
+ yield response, operation if block_given?
541
+ throw :response, response
542
+ end
543
+ rescue ::GRPC::BadStatus => e
544
+ raise ::Google::Cloud::Error.from_error(e)
545
+ end
546
+
547
+ ##
548
+ # Updates the parameters of a single internal range.
549
+ #
550
+ # @overload update_internal_range(request, options = nil)
551
+ # Pass arguments to `update_internal_range` via a request object, either of type
552
+ # {::Google::Cloud::NetworkConnectivity::V1::UpdateInternalRangeRequest} or an equivalent Hash.
553
+ #
554
+ # @param request [::Google::Cloud::NetworkConnectivity::V1::UpdateInternalRangeRequest, ::Hash]
555
+ # A request object representing the call parameters. Required. To specify no
556
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
557
+ # @param options [::Gapic::CallOptions, ::Hash]
558
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
559
+ #
560
+ # @overload update_internal_range(update_mask: nil, internal_range: nil, request_id: nil)
561
+ # Pass arguments to `update_internal_range` via keyword arguments. Note that at
562
+ # least one keyword argument is required. To specify no parameters, or to keep all
563
+ # the default parameter values, pass an empty Hash as a request object (see above).
564
+ #
565
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
566
+ # Optional. Field mask is used to specify the fields to be overwritten in the
567
+ # InternalRange resource by the update.
568
+ # The fields specified in the update_mask are relative to the resource, not
569
+ # the full request. A field will be overwritten if it is in the mask. If the
570
+ # user does not provide a mask then all fields will be overwritten.
571
+ # @param internal_range [::Google::Cloud::NetworkConnectivity::V1::InternalRange, ::Hash]
572
+ # Required. New values to be patched into the resource.
573
+ # @param request_id [::String]
574
+ # Optional. An optional request ID to identify requests. Specify a unique
575
+ # request ID so that if you must retry your request, the server will know to
576
+ # ignore the request if it has already been completed. The server will
577
+ # guarantee that for at least 60 minutes since the first request.
578
+ #
579
+ # For example, consider a situation where you make an initial request and
580
+ # the request times out. If you make the request again with the same request
581
+ # ID, the server can check if original operation with the same request ID
582
+ # was received, and if so, will ignore the second request. This prevents
583
+ # clients from accidentally creating duplicate commitments.
584
+ #
585
+ # The request ID must be a valid UUID with the exception that zero UUID is
586
+ # not supported (00000000-0000-0000-0000-000000000000).
587
+ #
588
+ # @yield [response, operation] Access the result along with the RPC operation
589
+ # @yieldparam response [::Gapic::Operation]
590
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
591
+ #
592
+ # @return [::Gapic::Operation]
593
+ #
594
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
595
+ #
596
+ # @example Basic example
597
+ # require "google/cloud/network_connectivity/v1"
598
+ #
599
+ # # Create a client object. The client can be reused for multiple calls.
600
+ # client = Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new
601
+ #
602
+ # # Create a request. To set request fields, pass in keyword arguments.
603
+ # request = Google::Cloud::NetworkConnectivity::V1::UpdateInternalRangeRequest.new
604
+ #
605
+ # # Call the update_internal_range method.
606
+ # result = client.update_internal_range request
607
+ #
608
+ # # The returned object is of type Gapic::Operation. You can use it to
609
+ # # check the status of an operation, cancel it, or wait for results.
610
+ # # Here is how to wait for a response.
611
+ # result.wait_until_done! timeout: 60
612
+ # if result.response?
613
+ # p result.response
614
+ # else
615
+ # puts "No response received."
616
+ # end
617
+ #
618
+ def update_internal_range request, options = nil
619
+ raise ::ArgumentError, "request must be provided" if request.nil?
620
+
621
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::UpdateInternalRangeRequest
622
+
623
+ # Converts hash and nil to an options object
624
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
625
+
626
+ # Customize the options with defaults
627
+ metadata = @config.rpcs.update_internal_range.metadata.to_h
628
+
629
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
630
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
631
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
632
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
633
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
634
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
635
+
636
+ header_params = {}
637
+ if request.internal_range&.name
638
+ header_params["internal_range.name"] = request.internal_range.name
639
+ end
640
+
641
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
642
+ metadata[:"x-goog-request-params"] ||= request_params_header
643
+
644
+ options.apply_defaults timeout: @config.rpcs.update_internal_range.timeout,
645
+ metadata: metadata,
646
+ retry_policy: @config.rpcs.update_internal_range.retry_policy
647
+
648
+ options.apply_defaults timeout: @config.timeout,
649
+ metadata: @config.metadata,
650
+ retry_policy: @config.retry_policy
651
+
652
+ @internal_range_service_stub.call_rpc :update_internal_range, request, options: options do |response, operation|
653
+ response = ::Gapic::Operation.new response, @operations_client, options: options
654
+ yield response, operation if block_given?
655
+ throw :response, response
656
+ end
657
+ rescue ::GRPC::BadStatus => e
658
+ raise ::Google::Cloud::Error.from_error(e)
659
+ end
660
+
661
+ ##
662
+ # Deletes a single internal range.
663
+ #
664
+ # @overload delete_internal_range(request, options = nil)
665
+ # Pass arguments to `delete_internal_range` via a request object, either of type
666
+ # {::Google::Cloud::NetworkConnectivity::V1::DeleteInternalRangeRequest} or an equivalent Hash.
667
+ #
668
+ # @param request [::Google::Cloud::NetworkConnectivity::V1::DeleteInternalRangeRequest, ::Hash]
669
+ # A request object representing the call parameters. Required. To specify no
670
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
671
+ # @param options [::Gapic::CallOptions, ::Hash]
672
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
673
+ #
674
+ # @overload delete_internal_range(name: nil, request_id: nil)
675
+ # Pass arguments to `delete_internal_range` via keyword arguments. Note that at
676
+ # least one keyword argument is required. To specify no parameters, or to keep all
677
+ # the default parameter values, pass an empty Hash as a request object (see above).
678
+ #
679
+ # @param name [::String]
680
+ # Required. The name of the internal range to delete.
681
+ # @param request_id [::String]
682
+ # Optional. An optional request ID to identify requests. Specify a unique
683
+ # request ID so that if you must retry your request, the server will know to
684
+ # ignore the request if it has already been completed. The server will
685
+ # guarantee that for at least 60 minutes after the first request.
686
+ #
687
+ # For example, consider a situation where you make an initial request and
688
+ # the request times out. If you make the request again with the same request
689
+ # ID, the server can check if original operation with the same request ID
690
+ # was received, and if so, will ignore the second request. This prevents
691
+ # clients from accidentally creating duplicate commitments.
692
+ #
693
+ # The request ID must be a valid UUID with the exception that zero UUID is
694
+ # not supported (00000000-0000-0000-0000-000000000000).
695
+ #
696
+ # @yield [response, operation] Access the result along with the RPC operation
697
+ # @yieldparam response [::Gapic::Operation]
698
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
699
+ #
700
+ # @return [::Gapic::Operation]
701
+ #
702
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
703
+ #
704
+ # @example Basic example
705
+ # require "google/cloud/network_connectivity/v1"
706
+ #
707
+ # # Create a client object. The client can be reused for multiple calls.
708
+ # client = Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new
709
+ #
710
+ # # Create a request. To set request fields, pass in keyword arguments.
711
+ # request = Google::Cloud::NetworkConnectivity::V1::DeleteInternalRangeRequest.new
712
+ #
713
+ # # Call the delete_internal_range method.
714
+ # result = client.delete_internal_range request
715
+ #
716
+ # # The returned object is of type Gapic::Operation. You can use it to
717
+ # # check the status of an operation, cancel it, or wait for results.
718
+ # # Here is how to wait for a response.
719
+ # result.wait_until_done! timeout: 60
720
+ # if result.response?
721
+ # p result.response
722
+ # else
723
+ # puts "No response received."
724
+ # end
725
+ #
726
+ def delete_internal_range request, options = nil
727
+ raise ::ArgumentError, "request must be provided" if request.nil?
728
+
729
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1::DeleteInternalRangeRequest
730
+
731
+ # Converts hash and nil to an options object
732
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
733
+
734
+ # Customize the options with defaults
735
+ metadata = @config.rpcs.delete_internal_range.metadata.to_h
736
+
737
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
738
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
739
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
740
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1::VERSION
741
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
742
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
743
+
744
+ header_params = {}
745
+ if request.name
746
+ header_params["name"] = request.name
747
+ end
748
+
749
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
750
+ metadata[:"x-goog-request-params"] ||= request_params_header
751
+
752
+ options.apply_defaults timeout: @config.rpcs.delete_internal_range.timeout,
753
+ metadata: metadata,
754
+ retry_policy: @config.rpcs.delete_internal_range.retry_policy
755
+
756
+ options.apply_defaults timeout: @config.timeout,
757
+ metadata: @config.metadata,
758
+ retry_policy: @config.retry_policy
759
+
760
+ @internal_range_service_stub.call_rpc :delete_internal_range, request, options: options do |response, operation|
761
+ response = ::Gapic::Operation.new response, @operations_client, options: options
762
+ yield response, operation if block_given?
763
+ throw :response, response
764
+ end
765
+ rescue ::GRPC::BadStatus => e
766
+ raise ::Google::Cloud::Error.from_error(e)
767
+ end
768
+
769
+ ##
770
+ # Configuration class for the InternalRangeService API.
771
+ #
772
+ # This class represents the configuration for InternalRangeService,
773
+ # providing control over timeouts, retry behavior, logging, transport
774
+ # parameters, and other low-level controls. Certain parameters can also be
775
+ # applied individually to specific RPCs. See
776
+ # {::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client::Configuration::Rpcs}
777
+ # for a list of RPCs that can be configured independently.
778
+ #
779
+ # Configuration can be applied globally to all clients, or to a single client
780
+ # on construction.
781
+ #
782
+ # @example
783
+ #
784
+ # # Modify the global config, setting the timeout for
785
+ # # list_internal_ranges to 20 seconds,
786
+ # # and all remaining timeouts to 10 seconds.
787
+ # ::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.configure do |config|
788
+ # config.timeout = 10.0
789
+ # config.rpcs.list_internal_ranges.timeout = 20.0
790
+ # end
791
+ #
792
+ # # Apply the above configuration only to a new client.
793
+ # client = ::Google::Cloud::NetworkConnectivity::V1::InternalRangeService::Client.new do |config|
794
+ # config.timeout = 10.0
795
+ # config.rpcs.list_internal_ranges.timeout = 20.0
796
+ # end
797
+ #
798
+ # @!attribute [rw] endpoint
799
+ # A custom service endpoint, as a hostname or hostname:port. The default is
800
+ # nil, indicating to use the default endpoint in the current universe domain.
801
+ # @return [::String,nil]
802
+ # @!attribute [rw] credentials
803
+ # Credentials to send with calls. You may provide any of the following types:
804
+ # * (`String`) The path to a service account key file in JSON format
805
+ # * (`Hash`) A service account key as a Hash
806
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
807
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
808
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
809
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
810
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
811
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
812
+ # * (`nil`) indicating no credentials
813
+ #
814
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
815
+ # external source for authentication to Google Cloud, you must validate it before
816
+ # providing it to a Google API client library. Providing an unvalidated credential
817
+ # configuration to Google APIs can compromise the security of your systems and data.
818
+ # For more information, refer to [Validate credential configurations from external
819
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
820
+ # @return [::Object]
821
+ # @!attribute [rw] scope
822
+ # The OAuth scopes
823
+ # @return [::Array<::String>]
824
+ # @!attribute [rw] lib_name
825
+ # The library name as recorded in instrumentation and logging
826
+ # @return [::String]
827
+ # @!attribute [rw] lib_version
828
+ # The library version as recorded in instrumentation and logging
829
+ # @return [::String]
830
+ # @!attribute [rw] channel_args
831
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
832
+ # `GRPC::Core::Channel` object is provided as the credential.
833
+ # @return [::Hash]
834
+ # @!attribute [rw] interceptors
835
+ # An array of interceptors that are run before calls are executed.
836
+ # @return [::Array<::GRPC::ClientInterceptor>]
837
+ # @!attribute [rw] timeout
838
+ # The call timeout in seconds.
839
+ # @return [::Numeric]
840
+ # @!attribute [rw] metadata
841
+ # Additional gRPC headers to be sent with the call.
842
+ # @return [::Hash{::Symbol=>::String}]
843
+ # @!attribute [rw] retry_policy
844
+ # The retry policy. The value is a hash with the following keys:
845
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
846
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
847
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
848
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
849
+ # trigger a retry.
850
+ # @return [::Hash]
851
+ # @!attribute [rw] quota_project
852
+ # A separate project against which to charge quota.
853
+ # @return [::String]
854
+ # @!attribute [rw] universe_domain
855
+ # The universe domain within which to make requests. This determines the
856
+ # default endpoint URL. The default value of nil uses the environment
857
+ # universe (usually the default "googleapis.com" universe).
858
+ # @return [::String,nil]
859
+ # @!attribute [rw] logger
860
+ # A custom logger to use for request/response debug logging, or the value
861
+ # `:default` (the default) to construct a default logger, or `nil` to
862
+ # explicitly disable logging.
863
+ # @return [::Logger,:default,nil]
864
+ #
865
+ class Configuration
866
+ extend ::Gapic::Config
867
+
868
+ # @private
869
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
870
+ DEFAULT_ENDPOINT = "networkconnectivity.googleapis.com"
871
+
872
+ config_attr :endpoint, nil, ::String, nil
873
+ config_attr :credentials, nil do |value|
874
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
875
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
876
+ allowed.any? { |klass| klass === value }
877
+ end
878
+ config_attr :scope, nil, ::String, ::Array, nil
879
+ config_attr :lib_name, nil, ::String, nil
880
+ config_attr :lib_version, nil, ::String, nil
881
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
882
+ config_attr :interceptors, nil, ::Array, nil
883
+ config_attr :timeout, nil, ::Numeric, nil
884
+ config_attr :metadata, nil, ::Hash, nil
885
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
886
+ config_attr :quota_project, nil, ::String, nil
887
+ config_attr :universe_domain, nil, ::String, nil
888
+ config_attr :logger, :default, ::Logger, nil, :default
889
+
890
+ # @private
891
+ def initialize parent_config = nil
892
+ @parent_config = parent_config unless parent_config.nil?
893
+
894
+ yield self if block_given?
895
+ end
896
+
897
+ ##
898
+ # Configurations for individual RPCs
899
+ # @return [Rpcs]
900
+ #
901
+ def rpcs
902
+ @rpcs ||= begin
903
+ parent_rpcs = nil
904
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
905
+ Rpcs.new parent_rpcs
906
+ end
907
+ end
908
+
909
+ ##
910
+ # Configuration for the channel pool
911
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
912
+ #
913
+ def channel_pool
914
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
915
+ end
916
+
917
+ ##
918
+ # Configuration RPC class for the InternalRangeService API.
919
+ #
920
+ # Includes fields providing the configuration for each RPC in this service.
921
+ # Each configuration object is of type `Gapic::Config::Method` and includes
922
+ # the following configuration fields:
923
+ #
924
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
925
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
926
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
927
+ # include the following keys:
928
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
929
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
930
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
931
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
932
+ # trigger a retry.
933
+ #
934
+ class Rpcs
935
+ ##
936
+ # RPC-specific configuration for `list_internal_ranges`
937
+ # @return [::Gapic::Config::Method]
938
+ #
939
+ attr_reader :list_internal_ranges
940
+ ##
941
+ # RPC-specific configuration for `get_internal_range`
942
+ # @return [::Gapic::Config::Method]
943
+ #
944
+ attr_reader :get_internal_range
945
+ ##
946
+ # RPC-specific configuration for `create_internal_range`
947
+ # @return [::Gapic::Config::Method]
948
+ #
949
+ attr_reader :create_internal_range
950
+ ##
951
+ # RPC-specific configuration for `update_internal_range`
952
+ # @return [::Gapic::Config::Method]
953
+ #
954
+ attr_reader :update_internal_range
955
+ ##
956
+ # RPC-specific configuration for `delete_internal_range`
957
+ # @return [::Gapic::Config::Method]
958
+ #
959
+ attr_reader :delete_internal_range
960
+
961
+ # @private
962
+ def initialize parent_rpcs = nil
963
+ list_internal_ranges_config = parent_rpcs.list_internal_ranges if parent_rpcs.respond_to? :list_internal_ranges
964
+ @list_internal_ranges = ::Gapic::Config::Method.new list_internal_ranges_config
965
+ get_internal_range_config = parent_rpcs.get_internal_range if parent_rpcs.respond_to? :get_internal_range
966
+ @get_internal_range = ::Gapic::Config::Method.new get_internal_range_config
967
+ create_internal_range_config = parent_rpcs.create_internal_range if parent_rpcs.respond_to? :create_internal_range
968
+ @create_internal_range = ::Gapic::Config::Method.new create_internal_range_config
969
+ update_internal_range_config = parent_rpcs.update_internal_range if parent_rpcs.respond_to? :update_internal_range
970
+ @update_internal_range = ::Gapic::Config::Method.new update_internal_range_config
971
+ delete_internal_range_config = parent_rpcs.delete_internal_range if parent_rpcs.respond_to? :delete_internal_range
972
+ @delete_internal_range = ::Gapic::Config::Method.new delete_internal_range_config
973
+
974
+ yield self if block_given?
975
+ end
976
+ end
977
+ end
978
+ end
979
+ end
980
+ end
981
+ end
982
+ end
983
+ end