google-cloud-location 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +167 -0
- data/LICENSE.md +201 -0
- data/README.md +15 -0
- data/lib/google/cloud/location/locations/client.rb +450 -0
- data/lib/google/cloud/location/locations/credentials.rb +45 -0
- data/lib/google/cloud/location/locations.rb +48 -0
- data/lib/google/cloud/location/locations_pb.rb +43 -0
- data/lib/google/cloud/location/locations_services_pb.rb +47 -0
- data/lib/google/cloud/location/version.rb +26 -0
- data/lib/google/cloud/location.rb +36 -0
- data/lib/google-cloud-location.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/location/locations.rb +98 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- metadata +205 -0
@@ -0,0 +1,450 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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/location/locations_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Location
|
25
|
+
module Locations
|
26
|
+
##
|
27
|
+
# Client for the Locations service.
|
28
|
+
#
|
29
|
+
# An abstract interface that provides location-related information for
|
30
|
+
# a service. Service-specific metadata is provided through the
|
31
|
+
# {::Google::Cloud::Location::Location#metadata Location.metadata} field.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
attr_reader :locations_stub
|
36
|
+
|
37
|
+
##
|
38
|
+
# Configure the Locations Client class.
|
39
|
+
#
|
40
|
+
# See {::Google::Cloud::Location::Locations::Client::Configuration}
|
41
|
+
# for a description of the configuration fields.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
#
|
45
|
+
# # Modify the configuration for all Locations clients
|
46
|
+
# ::Google::Cloud::Location::Locations::Client.configure do |config|
|
47
|
+
# config.timeout = 10.0
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# @yield [config] Configure the Client client.
|
51
|
+
# @yieldparam config [Client::Configuration]
|
52
|
+
#
|
53
|
+
# @return [Client::Configuration]
|
54
|
+
#
|
55
|
+
def self.configure
|
56
|
+
@configure ||= begin
|
57
|
+
namespace = ["Google", "Cloud", "Location"]
|
58
|
+
parent_config = while namespace.any?
|
59
|
+
parent_name = namespace.join "::"
|
60
|
+
parent_const = const_get parent_name
|
61
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
62
|
+
namespace.pop
|
63
|
+
end
|
64
|
+
default_config = Client::Configuration.new parent_config
|
65
|
+
|
66
|
+
default_config
|
67
|
+
end
|
68
|
+
yield @configure if block_given?
|
69
|
+
@configure
|
70
|
+
end
|
71
|
+
|
72
|
+
##
|
73
|
+
# Configure the Locations Client instance.
|
74
|
+
#
|
75
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
76
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
77
|
+
# should be made on {Client.configure}.
|
78
|
+
#
|
79
|
+
# See {::Google::Cloud::Location::Locations::Client::Configuration}
|
80
|
+
# for a description of the configuration fields.
|
81
|
+
#
|
82
|
+
# @yield [config] Configure the Client client.
|
83
|
+
# @yieldparam config [Client::Configuration]
|
84
|
+
#
|
85
|
+
# @return [Client::Configuration]
|
86
|
+
#
|
87
|
+
def configure
|
88
|
+
yield @config if block_given?
|
89
|
+
@config
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Create a new Locations client object.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
#
|
97
|
+
# # Create a client using the default configuration
|
98
|
+
# client = ::Google::Cloud::Location::Locations::Client.new
|
99
|
+
#
|
100
|
+
# # Create a client using a custom configuration
|
101
|
+
# client = ::Google::Cloud::Location::Locations::Client.new do |config|
|
102
|
+
# config.timeout = 10.0
|
103
|
+
# end
|
104
|
+
#
|
105
|
+
# @yield [config] Configure the Locations client.
|
106
|
+
# @yieldparam config [Client::Configuration]
|
107
|
+
#
|
108
|
+
def initialize
|
109
|
+
# These require statements are intentionally placed here to initialize
|
110
|
+
# the gRPC module only when it's required.
|
111
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
112
|
+
require "gapic/grpc"
|
113
|
+
require "google/cloud/location/locations_services_pb"
|
114
|
+
|
115
|
+
# Create the configuration object
|
116
|
+
@config = Configuration.new Client.configure
|
117
|
+
|
118
|
+
# Yield the configuration if needed
|
119
|
+
yield @config if block_given?
|
120
|
+
|
121
|
+
# Create credentials
|
122
|
+
credentials = @config.credentials
|
123
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
124
|
+
# but only if the default endpoint does not have a region prefix.
|
125
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
126
|
+
!@config.endpoint.split(".").first.include?("-")
|
127
|
+
credentials ||= Credentials.default scope: @config.scope,
|
128
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
129
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
130
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
131
|
+
end
|
132
|
+
@quota_project_id = @config.quota_project
|
133
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
134
|
+
|
135
|
+
@locations_stub = ::Gapic::ServiceStub.new(
|
136
|
+
::Google::Cloud::Location::Locations::Stub,
|
137
|
+
credentials: credentials,
|
138
|
+
endpoint: @config.endpoint,
|
139
|
+
channel_args: @config.channel_args,
|
140
|
+
interceptors: @config.interceptors
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Service calls
|
145
|
+
|
146
|
+
##
|
147
|
+
# Lists information about the supported locations for this service.
|
148
|
+
#
|
149
|
+
# @overload list_locations(request, options = nil)
|
150
|
+
# Pass arguments to `list_locations` via a request object, either of type
|
151
|
+
# {::Google::Cloud::Location::ListLocationsRequest} or an equivalent Hash.
|
152
|
+
#
|
153
|
+
# @param request [::Google::Cloud::Location::ListLocationsRequest, ::Hash]
|
154
|
+
# A request object representing the call parameters. Required. To specify no
|
155
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
156
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
157
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
158
|
+
#
|
159
|
+
# @overload list_locations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
160
|
+
# Pass arguments to `list_locations` via keyword arguments. Note that at
|
161
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
162
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
163
|
+
#
|
164
|
+
# @param name [::String]
|
165
|
+
# The resource that owns the locations collection, if applicable.
|
166
|
+
# @param filter [::String]
|
167
|
+
# The standard list filter.
|
168
|
+
# @param page_size [::Integer]
|
169
|
+
# The standard list page size.
|
170
|
+
# @param page_token [::String]
|
171
|
+
# The standard list page token.
|
172
|
+
#
|
173
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
174
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Location::Location>]
|
175
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
176
|
+
#
|
177
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Location::Location>]
|
178
|
+
#
|
179
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
180
|
+
#
|
181
|
+
def list_locations request, options = nil
|
182
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
183
|
+
|
184
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Location::ListLocationsRequest
|
185
|
+
|
186
|
+
# Converts hash and nil to an options object
|
187
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
188
|
+
|
189
|
+
# Customize the options with defaults
|
190
|
+
metadata = @config.rpcs.list_locations.metadata.to_h
|
191
|
+
|
192
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
193
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
194
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
195
|
+
gapic_version: ::Google::Cloud::Location::VERSION
|
196
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
197
|
+
|
198
|
+
header_params = {
|
199
|
+
"name" => request.name
|
200
|
+
}
|
201
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
202
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
203
|
+
|
204
|
+
options.apply_defaults timeout: @config.rpcs.list_locations.timeout,
|
205
|
+
metadata: metadata,
|
206
|
+
retry_policy: @config.rpcs.list_locations.retry_policy
|
207
|
+
|
208
|
+
options.apply_defaults timeout: @config.timeout,
|
209
|
+
metadata: @config.metadata,
|
210
|
+
retry_policy: @config.retry_policy
|
211
|
+
|
212
|
+
@locations_stub.call_rpc :list_locations, request, options: options do |response, operation|
|
213
|
+
response = ::Gapic::PagedEnumerable.new @locations_stub, :list_locations, request, response, operation, options
|
214
|
+
yield response, operation if block_given?
|
215
|
+
return response
|
216
|
+
end
|
217
|
+
rescue ::GRPC::BadStatus => e
|
218
|
+
raise ::Google::Cloud::Error.from_error(e)
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# Gets information about a location.
|
223
|
+
#
|
224
|
+
# @overload get_location(request, options = nil)
|
225
|
+
# Pass arguments to `get_location` via a request object, either of type
|
226
|
+
# {::Google::Cloud::Location::GetLocationRequest} or an equivalent Hash.
|
227
|
+
#
|
228
|
+
# @param request [::Google::Cloud::Location::GetLocationRequest, ::Hash]
|
229
|
+
# A request object representing the call parameters. Required. To specify no
|
230
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
231
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
232
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
233
|
+
#
|
234
|
+
# @overload get_location(name: nil)
|
235
|
+
# Pass arguments to `get_location` via keyword arguments. Note that at
|
236
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
237
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
238
|
+
#
|
239
|
+
# @param name [::String]
|
240
|
+
# Resource name for the location.
|
241
|
+
#
|
242
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
243
|
+
# @yieldparam response [::Google::Cloud::Location::Location]
|
244
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
245
|
+
#
|
246
|
+
# @return [::Google::Cloud::Location::Location]
|
247
|
+
#
|
248
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
249
|
+
#
|
250
|
+
def get_location request, options = nil
|
251
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
252
|
+
|
253
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Location::GetLocationRequest
|
254
|
+
|
255
|
+
# Converts hash and nil to an options object
|
256
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
257
|
+
|
258
|
+
# Customize the options with defaults
|
259
|
+
metadata = @config.rpcs.get_location.metadata.to_h
|
260
|
+
|
261
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
262
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
263
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
264
|
+
gapic_version: ::Google::Cloud::Location::VERSION
|
265
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
266
|
+
|
267
|
+
header_params = {
|
268
|
+
"name" => request.name
|
269
|
+
}
|
270
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
271
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
272
|
+
|
273
|
+
options.apply_defaults timeout: @config.rpcs.get_location.timeout,
|
274
|
+
metadata: metadata,
|
275
|
+
retry_policy: @config.rpcs.get_location.retry_policy
|
276
|
+
|
277
|
+
options.apply_defaults timeout: @config.timeout,
|
278
|
+
metadata: @config.metadata,
|
279
|
+
retry_policy: @config.retry_policy
|
280
|
+
|
281
|
+
@locations_stub.call_rpc :get_location, request, options: options do |response, operation|
|
282
|
+
yield response, operation if block_given?
|
283
|
+
return response
|
284
|
+
end
|
285
|
+
rescue ::GRPC::BadStatus => e
|
286
|
+
raise ::Google::Cloud::Error.from_error(e)
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# Configuration class for the Locations API.
|
291
|
+
#
|
292
|
+
# This class represents the configuration for Locations,
|
293
|
+
# providing control over timeouts, retry behavior, logging, transport
|
294
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
295
|
+
# applied individually to specific RPCs. See
|
296
|
+
# {::Google::Cloud::Location::Locations::Client::Configuration::Rpcs}
|
297
|
+
# for a list of RPCs that can be configured independently.
|
298
|
+
#
|
299
|
+
# Configuration can be applied globally to all clients, or to a single client
|
300
|
+
# on construction.
|
301
|
+
#
|
302
|
+
# @example
|
303
|
+
#
|
304
|
+
# # Modify the global config, setting the timeout for
|
305
|
+
# # list_locations to 20 seconds,
|
306
|
+
# # and all remaining timeouts to 10 seconds.
|
307
|
+
# ::Google::Cloud::Location::Locations::Client.configure do |config|
|
308
|
+
# config.timeout = 10.0
|
309
|
+
# config.rpcs.list_locations.timeout = 20.0
|
310
|
+
# end
|
311
|
+
#
|
312
|
+
# # Apply the above configuration only to a new client.
|
313
|
+
# client = ::Google::Cloud::Location::Locations::Client.new do |config|
|
314
|
+
# config.timeout = 10.0
|
315
|
+
# config.rpcs.list_locations.timeout = 20.0
|
316
|
+
# end
|
317
|
+
#
|
318
|
+
# @!attribute [rw] endpoint
|
319
|
+
# The hostname or hostname:port of the service endpoint.
|
320
|
+
# Defaults to `"cloud.googleapis.com"`.
|
321
|
+
# @return [::String]
|
322
|
+
# @!attribute [rw] credentials
|
323
|
+
# Credentials to send with calls. You may provide any of the following types:
|
324
|
+
# * (`String`) The path to a service account key file in JSON format
|
325
|
+
# * (`Hash`) A service account key as a Hash
|
326
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
327
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
328
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
329
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
330
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
331
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
332
|
+
# * (`nil`) indicating no credentials
|
333
|
+
# @return [::Object]
|
334
|
+
# @!attribute [rw] scope
|
335
|
+
# The OAuth scopes
|
336
|
+
# @return [::Array<::String>]
|
337
|
+
# @!attribute [rw] lib_name
|
338
|
+
# The library name as recorded in instrumentation and logging
|
339
|
+
# @return [::String]
|
340
|
+
# @!attribute [rw] lib_version
|
341
|
+
# The library version as recorded in instrumentation and logging
|
342
|
+
# @return [::String]
|
343
|
+
# @!attribute [rw] channel_args
|
344
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
345
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
346
|
+
# @return [::Hash]
|
347
|
+
# @!attribute [rw] interceptors
|
348
|
+
# An array of interceptors that are run before calls are executed.
|
349
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
350
|
+
# @!attribute [rw] timeout
|
351
|
+
# The call timeout in seconds.
|
352
|
+
# @return [::Numeric]
|
353
|
+
# @!attribute [rw] metadata
|
354
|
+
# Additional gRPC headers to be sent with the call.
|
355
|
+
# @return [::Hash{::Symbol=>::String}]
|
356
|
+
# @!attribute [rw] retry_policy
|
357
|
+
# The retry policy. The value is a hash with the following keys:
|
358
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
359
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
360
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
361
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
362
|
+
# trigger a retry.
|
363
|
+
# @return [::Hash]
|
364
|
+
# @!attribute [rw] quota_project
|
365
|
+
# A separate project against which to charge quota.
|
366
|
+
# @return [::String]
|
367
|
+
#
|
368
|
+
class Configuration
|
369
|
+
extend ::Gapic::Config
|
370
|
+
|
371
|
+
config_attr :endpoint, "cloud.googleapis.com", ::String
|
372
|
+
config_attr :credentials, nil do |value|
|
373
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
374
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
375
|
+
allowed.any? { |klass| klass === value }
|
376
|
+
end
|
377
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
378
|
+
config_attr :lib_name, nil, ::String, nil
|
379
|
+
config_attr :lib_version, nil, ::String, nil
|
380
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
381
|
+
config_attr :interceptors, nil, ::Array, nil
|
382
|
+
config_attr :timeout, nil, ::Numeric, nil
|
383
|
+
config_attr :metadata, nil, ::Hash, nil
|
384
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
385
|
+
config_attr :quota_project, nil, ::String, nil
|
386
|
+
|
387
|
+
# @private
|
388
|
+
def initialize parent_config = nil
|
389
|
+
@parent_config = parent_config unless parent_config.nil?
|
390
|
+
|
391
|
+
yield self if block_given?
|
392
|
+
end
|
393
|
+
|
394
|
+
##
|
395
|
+
# Configurations for individual RPCs
|
396
|
+
# @return [Rpcs]
|
397
|
+
#
|
398
|
+
def rpcs
|
399
|
+
@rpcs ||= begin
|
400
|
+
parent_rpcs = nil
|
401
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
402
|
+
Rpcs.new parent_rpcs
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
##
|
407
|
+
# Configuration RPC class for the Locations API.
|
408
|
+
#
|
409
|
+
# Includes fields providing the configuration for each RPC in this service.
|
410
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
411
|
+
# the following configuration fields:
|
412
|
+
#
|
413
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
414
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
415
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
416
|
+
# include the following keys:
|
417
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
418
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
419
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
420
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
421
|
+
# trigger a retry.
|
422
|
+
#
|
423
|
+
class Rpcs
|
424
|
+
##
|
425
|
+
# RPC-specific configuration for `list_locations`
|
426
|
+
# @return [::Gapic::Config::Method]
|
427
|
+
#
|
428
|
+
attr_reader :list_locations
|
429
|
+
##
|
430
|
+
# RPC-specific configuration for `get_location`
|
431
|
+
# @return [::Gapic::Config::Method]
|
432
|
+
#
|
433
|
+
attr_reader :get_location
|
434
|
+
|
435
|
+
# @private
|
436
|
+
def initialize parent_rpcs = nil
|
437
|
+
list_locations_config = parent_rpcs.list_locations if parent_rpcs.respond_to? :list_locations
|
438
|
+
@list_locations = ::Gapic::Config::Method.new list_locations_config
|
439
|
+
get_location_config = parent_rpcs.get_location if parent_rpcs.respond_to? :get_location
|
440
|
+
@get_location = ::Gapic::Config::Method.new get_location_config
|
441
|
+
|
442
|
+
yield self if block_given?
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Location
|
24
|
+
module Locations
|
25
|
+
# Credentials for the Locations API.
|
26
|
+
class Credentials < ::Google::Auth::Credentials
|
27
|
+
self.scope = [
|
28
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
29
|
+
]
|
30
|
+
self.env_vars = [
|
31
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
32
|
+
"GOOGLE_CLOUD_KEYFILE",
|
33
|
+
"GCLOUD_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
36
|
+
"GCLOUD_KEYFILE_JSON"
|
37
|
+
]
|
38
|
+
self.paths = [
|
39
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
40
|
+
]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/location/version"
|
24
|
+
|
25
|
+
require "google/cloud/location/locations/credentials"
|
26
|
+
require "google/cloud/location/locations/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module Location
|
31
|
+
##
|
32
|
+
# An abstract interface that provides location-related information for
|
33
|
+
# a service. Service-specific metadata is provided through the
|
34
|
+
# {::Google::Cloud::Location::Location#metadata Location.metadata} field.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/location/locations"
|
39
|
+
# client = ::Google::Cloud::Location::Locations::Client.new
|
40
|
+
#
|
41
|
+
module Locations
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
helper_path = ::File.join __dir__, "locations", "helpers.rb"
|
48
|
+
require "google/cloud/location/locations/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/location/locations.proto
|
3
|
+
|
4
|
+
require 'google/api/annotations_pb'
|
5
|
+
require 'google/protobuf/any_pb'
|
6
|
+
require 'google/api/client_pb'
|
7
|
+
require 'google/protobuf'
|
8
|
+
|
9
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
+
add_file("google/cloud/location/locations.proto", :syntax => :proto3) do
|
11
|
+
add_message "google.cloud.location.ListLocationsRequest" do
|
12
|
+
optional :name, :string, 1
|
13
|
+
optional :filter, :string, 2
|
14
|
+
optional :page_size, :int32, 3
|
15
|
+
optional :page_token, :string, 4
|
16
|
+
end
|
17
|
+
add_message "google.cloud.location.ListLocationsResponse" do
|
18
|
+
repeated :locations, :message, 1, "google.cloud.location.Location"
|
19
|
+
optional :next_page_token, :string, 2
|
20
|
+
end
|
21
|
+
add_message "google.cloud.location.GetLocationRequest" do
|
22
|
+
optional :name, :string, 1
|
23
|
+
end
|
24
|
+
add_message "google.cloud.location.Location" do
|
25
|
+
optional :name, :string, 1
|
26
|
+
optional :location_id, :string, 4
|
27
|
+
optional :display_name, :string, 5
|
28
|
+
map :labels, :string, :string, 2
|
29
|
+
optional :metadata, :message, 3, "google.protobuf.Any"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module Google
|
35
|
+
module Cloud
|
36
|
+
module Location
|
37
|
+
ListLocationsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.location.ListLocationsRequest").msgclass
|
38
|
+
ListLocationsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.location.ListLocationsResponse").msgclass
|
39
|
+
GetLocationRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.location.GetLocationRequest").msgclass
|
40
|
+
Location = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.location.Location").msgclass
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/location/locations.proto for package 'google.cloud.location'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2020 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/location/locations_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Location
|
25
|
+
module Locations
|
26
|
+
# An abstract interface that provides location-related information for
|
27
|
+
# a service. Service-specific metadata is provided through the
|
28
|
+
# [Location.metadata][google.cloud.location.Location.metadata] field.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include ::GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.location.Locations'
|
36
|
+
|
37
|
+
# Lists information about the supported locations for this service.
|
38
|
+
rpc :ListLocations, ::Google::Cloud::Location::ListLocationsRequest, ::Google::Cloud::Location::ListLocationsResponse
|
39
|
+
# Gets information about a location.
|
40
|
+
rpc :GetLocation, ::Google::Cloud::Location::GetLocationRequest, ::Google::Cloud::Location::Location
|
41
|
+
end
|
42
|
+
|
43
|
+
Stub = Service.rpc_stub_class
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Location
|
23
|
+
VERSION = "0.1.0"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|