google-cloud-location_finder-v1 0.a → 0.1.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,722 @@
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/locationfinder/v1/service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module LocationFinder
26
+ module V1
27
+ module CloudLocationFinder
28
+ ##
29
+ # Client for the CloudLocationFinder service.
30
+ #
31
+ # Service describing handlers for resources
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudlocationfinder.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :cloud_location_finder_stub
44
+
45
+ ##
46
+ # Configure the CloudLocationFinder Client class.
47
+ #
48
+ # See {::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all CloudLocationFinder clients
54
+ # ::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "LocationFinder", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.rpcs.list_cloud_locations.timeout = 60.0
75
+ default_config.rpcs.list_cloud_locations.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config.rpcs.get_cloud_location.timeout = 60.0
80
+ default_config.rpcs.get_cloud_location.retry_policy = {
81
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
82
+ }
83
+
84
+ default_config.rpcs.search_cloud_locations.timeout = 60.0
85
+ default_config.rpcs.search_cloud_locations.retry_policy = {
86
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
87
+ }
88
+
89
+ default_config
90
+ end
91
+ yield @configure if block_given?
92
+ @configure
93
+ end
94
+
95
+ ##
96
+ # Configure the CloudLocationFinder Client instance.
97
+ #
98
+ # The configuration is set to the derived mode, meaning that values can be changed,
99
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
100
+ # should be made on {Client.configure}.
101
+ #
102
+ # See {::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client::Configuration}
103
+ # for a description of the configuration fields.
104
+ #
105
+ # @yield [config] Configure the Client client.
106
+ # @yieldparam config [Client::Configuration]
107
+ #
108
+ # @return [Client::Configuration]
109
+ #
110
+ def configure
111
+ yield @config if block_given?
112
+ @config
113
+ end
114
+
115
+ ##
116
+ # The effective universe domain
117
+ #
118
+ # @return [String]
119
+ #
120
+ def universe_domain
121
+ @cloud_location_finder_stub.universe_domain
122
+ end
123
+
124
+ ##
125
+ # Create a new CloudLocationFinder client object.
126
+ #
127
+ # @example
128
+ #
129
+ # # Create a client using the default configuration
130
+ # client = ::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.new
131
+ #
132
+ # # Create a client using a custom configuration
133
+ # client = ::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.new do |config|
134
+ # config.timeout = 10.0
135
+ # end
136
+ #
137
+ # @yield [config] Configure the CloudLocationFinder client.
138
+ # @yieldparam config [Client::Configuration]
139
+ #
140
+ def initialize
141
+ # These require statements are intentionally placed here to initialize
142
+ # the gRPC module only when it's required.
143
+ # See https://github.com/googleapis/toolkit/issues/446
144
+ require "gapic/grpc"
145
+ require "google/cloud/locationfinder/v1/service_services_pb"
146
+
147
+ # Create the configuration object
148
+ @config = Configuration.new Client.configure
149
+
150
+ # Yield the configuration if needed
151
+ yield @config if block_given?
152
+
153
+ # Create credentials
154
+ credentials = @config.credentials
155
+ # Use self-signed JWT if the endpoint is unchanged from default,
156
+ # but only if the default endpoint does not have a region prefix.
157
+ enable_self_signed_jwt = @config.endpoint.nil? ||
158
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
159
+ !@config.endpoint.split(".").first.include?("-"))
160
+ credentials ||= Credentials.default scope: @config.scope,
161
+ enable_self_signed_jwt: enable_self_signed_jwt
162
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
163
+ credentials = Credentials.new credentials, scope: @config.scope
164
+ end
165
+ @quota_project_id = @config.quota_project
166
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
167
+
168
+ @cloud_location_finder_stub = ::Gapic::ServiceStub.new(
169
+ ::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Stub,
170
+ credentials: credentials,
171
+ endpoint: @config.endpoint,
172
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
173
+ universe_domain: @config.universe_domain,
174
+ channel_args: @config.channel_args,
175
+ interceptors: @config.interceptors,
176
+ channel_pool_config: @config.channel_pool,
177
+ logger: @config.logger
178
+ )
179
+
180
+ @cloud_location_finder_stub.stub_logger&.info do |entry|
181
+ entry.set_system_name
182
+ entry.set_service
183
+ entry.message = "Created client for #{entry.service}"
184
+ entry.set_credentials_fields credentials
185
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
186
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
187
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
188
+ end
189
+
190
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
191
+ config.credentials = credentials
192
+ config.quota_project = @quota_project_id
193
+ config.endpoint = @cloud_location_finder_stub.endpoint
194
+ config.universe_domain = @cloud_location_finder_stub.universe_domain
195
+ config.logger = @cloud_location_finder_stub.logger if config.respond_to? :logger=
196
+ end
197
+ end
198
+
199
+ ##
200
+ # Get the associated client for mix-in of the Locations.
201
+ #
202
+ # @return [Google::Cloud::Location::Locations::Client]
203
+ #
204
+ attr_reader :location_client
205
+
206
+ ##
207
+ # The logger used for request/response debug logging.
208
+ #
209
+ # @return [Logger]
210
+ #
211
+ def logger
212
+ @cloud_location_finder_stub.logger
213
+ end
214
+
215
+ # Service calls
216
+
217
+ ##
218
+ # Lists cloud locations under a given project and location.
219
+ #
220
+ # @overload list_cloud_locations(request, options = nil)
221
+ # Pass arguments to `list_cloud_locations` via a request object, either of type
222
+ # {::Google::Cloud::LocationFinder::V1::ListCloudLocationsRequest} or an equivalent Hash.
223
+ #
224
+ # @param request [::Google::Cloud::LocationFinder::V1::ListCloudLocationsRequest, ::Hash]
225
+ # A request object representing the call parameters. Required. To specify no
226
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
227
+ # @param options [::Gapic::CallOptions, ::Hash]
228
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
229
+ #
230
+ # @overload list_cloud_locations(parent: nil, page_size: nil, page_token: nil, filter: nil)
231
+ # Pass arguments to `list_cloud_locations` via keyword arguments. Note that at
232
+ # least one keyword argument is required. To specify no parameters, or to keep all
233
+ # the default parameter values, pass an empty Hash as a request object (see above).
234
+ #
235
+ # @param parent [::String]
236
+ # Required. The parent, which owns this collection of cloud locations.
237
+ # Format: projects/\\{project}/locations/\\{location}
238
+ # @param page_size [::Integer]
239
+ # Optional. The maximum number of cloud locations to return per page. The
240
+ # service might return fewer cloud locations than this value. If unspecified,
241
+ # server will pick an appropriate default.
242
+ # @param page_token [::String]
243
+ # Optional. A token identifying a page of results the server should return.
244
+ # Provide page token returned by a previous 'ListCloudLocations' call to
245
+ # retrieve the next page of results. When paginating, all other parameters
246
+ # provided to 'ListCloudLocations' must match the call that provided the page
247
+ # token.
248
+ # @param filter [::String]
249
+ # Optional. A filter expression that filters resources listed in the
250
+ # response. The expression is in the form of field=value. For example,
251
+ # 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION'. Multiple filter queries
252
+ # are space-separated. For example,
253
+ # 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION territory_code="US"' By
254
+ # default, each expression is an AND expression. However, you can include AND
255
+ # and OR expressions explicitly.
256
+ #
257
+ # @yield [response, operation] Access the result along with the RPC operation
258
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::LocationFinder::V1::CloudLocation>]
259
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
260
+ #
261
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::LocationFinder::V1::CloudLocation>]
262
+ #
263
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
264
+ #
265
+ # @example Basic example
266
+ # require "google/cloud/location_finder/v1"
267
+ #
268
+ # # Create a client object. The client can be reused for multiple calls.
269
+ # client = Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.new
270
+ #
271
+ # # Create a request. To set request fields, pass in keyword arguments.
272
+ # request = Google::Cloud::LocationFinder::V1::ListCloudLocationsRequest.new
273
+ #
274
+ # # Call the list_cloud_locations method.
275
+ # result = client.list_cloud_locations request
276
+ #
277
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
278
+ # # over elements, and API calls will be issued to fetch pages as needed.
279
+ # result.each do |item|
280
+ # # Each element is of type ::Google::Cloud::LocationFinder::V1::CloudLocation.
281
+ # p item
282
+ # end
283
+ #
284
+ def list_cloud_locations request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LocationFinder::V1::ListCloudLocationsRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ metadata = @config.rpcs.list_cloud_locations.metadata.to_h
294
+
295
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
296
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::LocationFinder::V1::VERSION
299
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {}
303
+ if request.parent
304
+ header_params["parent"] = request.parent
305
+ end
306
+
307
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
308
+ metadata[:"x-goog-request-params"] ||= request_params_header
309
+
310
+ options.apply_defaults timeout: @config.rpcs.list_cloud_locations.timeout,
311
+ metadata: metadata,
312
+ retry_policy: @config.rpcs.list_cloud_locations.retry_policy
313
+
314
+ options.apply_defaults timeout: @config.timeout,
315
+ metadata: @config.metadata,
316
+ retry_policy: @config.retry_policy
317
+
318
+ @cloud_location_finder_stub.call_rpc :list_cloud_locations, request, options: options do |response, operation|
319
+ response = ::Gapic::PagedEnumerable.new @cloud_location_finder_stub, :list_cloud_locations, request, response, operation, options
320
+ yield response, operation if block_given?
321
+ throw :response, response
322
+ end
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Retrieves a resource containing information about a cloud location.
329
+ #
330
+ # @overload get_cloud_location(request, options = nil)
331
+ # Pass arguments to `get_cloud_location` via a request object, either of type
332
+ # {::Google::Cloud::LocationFinder::V1::GetCloudLocationRequest} or an equivalent Hash.
333
+ #
334
+ # @param request [::Google::Cloud::LocationFinder::V1::GetCloudLocationRequest, ::Hash]
335
+ # A request object representing the call parameters. Required. To specify no
336
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
337
+ # @param options [::Gapic::CallOptions, ::Hash]
338
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
339
+ #
340
+ # @overload get_cloud_location(name: nil)
341
+ # Pass arguments to `get_cloud_location` via keyword arguments. Note that at
342
+ # least one keyword argument is required. To specify no parameters, or to keep all
343
+ # the default parameter values, pass an empty Hash as a request object (see above).
344
+ #
345
+ # @param name [::String]
346
+ # Required. Name of the resource.
347
+ #
348
+ # @yield [response, operation] Access the result along with the RPC operation
349
+ # @yieldparam response [::Google::Cloud::LocationFinder::V1::CloudLocation]
350
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
351
+ #
352
+ # @return [::Google::Cloud::LocationFinder::V1::CloudLocation]
353
+ #
354
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
355
+ #
356
+ # @example Basic example
357
+ # require "google/cloud/location_finder/v1"
358
+ #
359
+ # # Create a client object. The client can be reused for multiple calls.
360
+ # client = Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.new
361
+ #
362
+ # # Create a request. To set request fields, pass in keyword arguments.
363
+ # request = Google::Cloud::LocationFinder::V1::GetCloudLocationRequest.new
364
+ #
365
+ # # Call the get_cloud_location method.
366
+ # result = client.get_cloud_location request
367
+ #
368
+ # # The returned object is of type Google::Cloud::LocationFinder::V1::CloudLocation.
369
+ # p result
370
+ #
371
+ def get_cloud_location request, options = nil
372
+ raise ::ArgumentError, "request must be provided" if request.nil?
373
+
374
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LocationFinder::V1::GetCloudLocationRequest
375
+
376
+ # Converts hash and nil to an options object
377
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
378
+
379
+ # Customize the options with defaults
380
+ metadata = @config.rpcs.get_cloud_location.metadata.to_h
381
+
382
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
383
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
384
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
385
+ gapic_version: ::Google::Cloud::LocationFinder::V1::VERSION
386
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
387
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
388
+
389
+ header_params = {}
390
+ if request.name
391
+ header_params["name"] = request.name
392
+ end
393
+
394
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
395
+ metadata[:"x-goog-request-params"] ||= request_params_header
396
+
397
+ options.apply_defaults timeout: @config.rpcs.get_cloud_location.timeout,
398
+ metadata: metadata,
399
+ retry_policy: @config.rpcs.get_cloud_location.retry_policy
400
+
401
+ options.apply_defaults timeout: @config.timeout,
402
+ metadata: @config.metadata,
403
+ retry_policy: @config.retry_policy
404
+
405
+ @cloud_location_finder_stub.call_rpc :get_cloud_location, request, options: options do |response, operation|
406
+ yield response, operation if block_given?
407
+ end
408
+ rescue ::GRPC::BadStatus => e
409
+ raise ::Google::Cloud::Error.from_error(e)
410
+ end
411
+
412
+ ##
413
+ # Searches for cloud locations from a given source location.
414
+ #
415
+ # @overload search_cloud_locations(request, options = nil)
416
+ # Pass arguments to `search_cloud_locations` via a request object, either of type
417
+ # {::Google::Cloud::LocationFinder::V1::SearchCloudLocationsRequest} or an equivalent Hash.
418
+ #
419
+ # @param request [::Google::Cloud::LocationFinder::V1::SearchCloudLocationsRequest, ::Hash]
420
+ # A request object representing the call parameters. Required. To specify no
421
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
422
+ # @param options [::Gapic::CallOptions, ::Hash]
423
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
424
+ #
425
+ # @overload search_cloud_locations(parent: nil, source_cloud_location: nil, page_size: nil, page_token: nil, query: nil)
426
+ # Pass arguments to `search_cloud_locations` via keyword arguments. Note that at
427
+ # least one keyword argument is required. To specify no parameters, or to keep all
428
+ # the default parameter values, pass an empty Hash as a request object (see above).
429
+ #
430
+ # @param parent [::String]
431
+ # Required. The parent, which owns this collection of cloud locations.
432
+ # Format: projects/\\{project}/locations/\\{location}
433
+ # @param source_cloud_location [::String]
434
+ # Required. The source cloud location to search from.
435
+ # Example search can be searching nearby cloud locations from the source
436
+ # cloud location by latency.
437
+ # @param page_size [::Integer]
438
+ # Optional. The maximum number of cloud locations to return. The service
439
+ # might return fewer cloud locations than this value. If unspecified, server
440
+ # will pick an appropriate default.
441
+ # @param page_token [::String]
442
+ # Optional. A token identifying a page of results the server should return.
443
+ # Provide Page token returned by a previous 'ListCloudLocations' call to
444
+ # retrieve the next page of results. When paginating, all other parameters
445
+ # provided to 'ListCloudLocations' must match the call that provided the page
446
+ # token.
447
+ # @param query [::String]
448
+ # Optional. The query string in search query syntax. While filter is used to
449
+ # filter the search results by attributes, query is used to specify the
450
+ # search requirements.
451
+ #
452
+ # @yield [response, operation] Access the result along with the RPC operation
453
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::LocationFinder::V1::CloudLocation>]
454
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
455
+ #
456
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::LocationFinder::V1::CloudLocation>]
457
+ #
458
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
459
+ #
460
+ # @example Basic example
461
+ # require "google/cloud/location_finder/v1"
462
+ #
463
+ # # Create a client object. The client can be reused for multiple calls.
464
+ # client = Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.new
465
+ #
466
+ # # Create a request. To set request fields, pass in keyword arguments.
467
+ # request = Google::Cloud::LocationFinder::V1::SearchCloudLocationsRequest.new
468
+ #
469
+ # # Call the search_cloud_locations method.
470
+ # result = client.search_cloud_locations request
471
+ #
472
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
473
+ # # over elements, and API calls will be issued to fetch pages as needed.
474
+ # result.each do |item|
475
+ # # Each element is of type ::Google::Cloud::LocationFinder::V1::CloudLocation.
476
+ # p item
477
+ # end
478
+ #
479
+ def search_cloud_locations request, options = nil
480
+ raise ::ArgumentError, "request must be provided" if request.nil?
481
+
482
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LocationFinder::V1::SearchCloudLocationsRequest
483
+
484
+ # Converts hash and nil to an options object
485
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
486
+
487
+ # Customize the options with defaults
488
+ metadata = @config.rpcs.search_cloud_locations.metadata.to_h
489
+
490
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
491
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
492
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
493
+ gapic_version: ::Google::Cloud::LocationFinder::V1::VERSION
494
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
495
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
496
+
497
+ header_params = {}
498
+ if request.parent
499
+ header_params["parent"] = request.parent
500
+ end
501
+
502
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
503
+ metadata[:"x-goog-request-params"] ||= request_params_header
504
+
505
+ options.apply_defaults timeout: @config.rpcs.search_cloud_locations.timeout,
506
+ metadata: metadata,
507
+ retry_policy: @config.rpcs.search_cloud_locations.retry_policy
508
+
509
+ options.apply_defaults timeout: @config.timeout,
510
+ metadata: @config.metadata,
511
+ retry_policy: @config.retry_policy
512
+
513
+ @cloud_location_finder_stub.call_rpc :search_cloud_locations, request, options: options do |response, operation|
514
+ response = ::Gapic::PagedEnumerable.new @cloud_location_finder_stub, :search_cloud_locations, request, response, operation, options
515
+ yield response, operation if block_given?
516
+ throw :response, response
517
+ end
518
+ rescue ::GRPC::BadStatus => e
519
+ raise ::Google::Cloud::Error.from_error(e)
520
+ end
521
+
522
+ ##
523
+ # Configuration class for the CloudLocationFinder API.
524
+ #
525
+ # This class represents the configuration for CloudLocationFinder,
526
+ # providing control over timeouts, retry behavior, logging, transport
527
+ # parameters, and other low-level controls. Certain parameters can also be
528
+ # applied individually to specific RPCs. See
529
+ # {::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client::Configuration::Rpcs}
530
+ # for a list of RPCs that can be configured independently.
531
+ #
532
+ # Configuration can be applied globally to all clients, or to a single client
533
+ # on construction.
534
+ #
535
+ # @example
536
+ #
537
+ # # Modify the global config, setting the timeout for
538
+ # # list_cloud_locations to 20 seconds,
539
+ # # and all remaining timeouts to 10 seconds.
540
+ # ::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.configure do |config|
541
+ # config.timeout = 10.0
542
+ # config.rpcs.list_cloud_locations.timeout = 20.0
543
+ # end
544
+ #
545
+ # # Apply the above configuration only to a new client.
546
+ # client = ::Google::Cloud::LocationFinder::V1::CloudLocationFinder::Client.new do |config|
547
+ # config.timeout = 10.0
548
+ # config.rpcs.list_cloud_locations.timeout = 20.0
549
+ # end
550
+ #
551
+ # @!attribute [rw] endpoint
552
+ # A custom service endpoint, as a hostname or hostname:port. The default is
553
+ # nil, indicating to use the default endpoint in the current universe domain.
554
+ # @return [::String,nil]
555
+ # @!attribute [rw] credentials
556
+ # Credentials to send with calls. You may provide any of the following types:
557
+ # * (`String`) The path to a service account key file in JSON format
558
+ # * (`Hash`) A service account key as a Hash
559
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
560
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
561
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
562
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
563
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
564
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
565
+ # * (`nil`) indicating no credentials
566
+ #
567
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
568
+ # external source for authentication to Google Cloud, you must validate it before
569
+ # providing it to a Google API client library. Providing an unvalidated credential
570
+ # configuration to Google APIs can compromise the security of your systems and data.
571
+ # For more information, refer to [Validate credential configurations from external
572
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
573
+ # @return [::Object]
574
+ # @!attribute [rw] scope
575
+ # The OAuth scopes
576
+ # @return [::Array<::String>]
577
+ # @!attribute [rw] lib_name
578
+ # The library name as recorded in instrumentation and logging
579
+ # @return [::String]
580
+ # @!attribute [rw] lib_version
581
+ # The library version as recorded in instrumentation and logging
582
+ # @return [::String]
583
+ # @!attribute [rw] channel_args
584
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
585
+ # `GRPC::Core::Channel` object is provided as the credential.
586
+ # @return [::Hash]
587
+ # @!attribute [rw] interceptors
588
+ # An array of interceptors that are run before calls are executed.
589
+ # @return [::Array<::GRPC::ClientInterceptor>]
590
+ # @!attribute [rw] timeout
591
+ # The call timeout in seconds.
592
+ # @return [::Numeric]
593
+ # @!attribute [rw] metadata
594
+ # Additional gRPC headers to be sent with the call.
595
+ # @return [::Hash{::Symbol=>::String}]
596
+ # @!attribute [rw] retry_policy
597
+ # The retry policy. The value is a hash with the following keys:
598
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
599
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
600
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
601
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
602
+ # trigger a retry.
603
+ # @return [::Hash]
604
+ # @!attribute [rw] quota_project
605
+ # A separate project against which to charge quota.
606
+ # @return [::String]
607
+ # @!attribute [rw] universe_domain
608
+ # The universe domain within which to make requests. This determines the
609
+ # default endpoint URL. The default value of nil uses the environment
610
+ # universe (usually the default "googleapis.com" universe).
611
+ # @return [::String,nil]
612
+ # @!attribute [rw] logger
613
+ # A custom logger to use for request/response debug logging, or the value
614
+ # `:default` (the default) to construct a default logger, or `nil` to
615
+ # explicitly disable logging.
616
+ # @return [::Logger,:default,nil]
617
+ #
618
+ class Configuration
619
+ extend ::Gapic::Config
620
+
621
+ # @private
622
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
623
+ DEFAULT_ENDPOINT = "cloudlocationfinder.googleapis.com"
624
+
625
+ config_attr :endpoint, nil, ::String, nil
626
+ config_attr :credentials, nil do |value|
627
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
628
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
629
+ allowed.any? { |klass| klass === value }
630
+ end
631
+ config_attr :scope, nil, ::String, ::Array, nil
632
+ config_attr :lib_name, nil, ::String, nil
633
+ config_attr :lib_version, nil, ::String, nil
634
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
635
+ config_attr :interceptors, nil, ::Array, nil
636
+ config_attr :timeout, nil, ::Numeric, nil
637
+ config_attr :metadata, nil, ::Hash, nil
638
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
639
+ config_attr :quota_project, nil, ::String, nil
640
+ config_attr :universe_domain, nil, ::String, nil
641
+ config_attr :logger, :default, ::Logger, nil, :default
642
+
643
+ # @private
644
+ def initialize parent_config = nil
645
+ @parent_config = parent_config unless parent_config.nil?
646
+
647
+ yield self if block_given?
648
+ end
649
+
650
+ ##
651
+ # Configurations for individual RPCs
652
+ # @return [Rpcs]
653
+ #
654
+ def rpcs
655
+ @rpcs ||= begin
656
+ parent_rpcs = nil
657
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
658
+ Rpcs.new parent_rpcs
659
+ end
660
+ end
661
+
662
+ ##
663
+ # Configuration for the channel pool
664
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
665
+ #
666
+ def channel_pool
667
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
668
+ end
669
+
670
+ ##
671
+ # Configuration RPC class for the CloudLocationFinder API.
672
+ #
673
+ # Includes fields providing the configuration for each RPC in this service.
674
+ # Each configuration object is of type `Gapic::Config::Method` and includes
675
+ # the following configuration fields:
676
+ #
677
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
678
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
679
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
680
+ # include the following keys:
681
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
682
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
683
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
684
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
685
+ # trigger a retry.
686
+ #
687
+ class Rpcs
688
+ ##
689
+ # RPC-specific configuration for `list_cloud_locations`
690
+ # @return [::Gapic::Config::Method]
691
+ #
692
+ attr_reader :list_cloud_locations
693
+ ##
694
+ # RPC-specific configuration for `get_cloud_location`
695
+ # @return [::Gapic::Config::Method]
696
+ #
697
+ attr_reader :get_cloud_location
698
+ ##
699
+ # RPC-specific configuration for `search_cloud_locations`
700
+ # @return [::Gapic::Config::Method]
701
+ #
702
+ attr_reader :search_cloud_locations
703
+
704
+ # @private
705
+ def initialize parent_rpcs = nil
706
+ list_cloud_locations_config = parent_rpcs.list_cloud_locations if parent_rpcs.respond_to? :list_cloud_locations
707
+ @list_cloud_locations = ::Gapic::Config::Method.new list_cloud_locations_config
708
+ get_cloud_location_config = parent_rpcs.get_cloud_location if parent_rpcs.respond_to? :get_cloud_location
709
+ @get_cloud_location = ::Gapic::Config::Method.new get_cloud_location_config
710
+ search_cloud_locations_config = parent_rpcs.search_cloud_locations if parent_rpcs.respond_to? :search_cloud_locations
711
+ @search_cloud_locations = ::Gapic::Config::Method.new search_cloud_locations_config
712
+
713
+ yield self if block_given?
714
+ end
715
+ end
716
+ end
717
+ end
718
+ end
719
+ end
720
+ end
721
+ end
722
+ end