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