google-cloud-service_directory-v1beta1 0.9.0 → 0.11.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/AUTHENTICATION.md +1 -1
- data/README.md +3 -3
- data/lib/google/cloud/service_directory/v1beta1/lookup_service/client.rb +2 -2
- data/lib/google/cloud/service_directory/v1beta1/lookup_service/rest/client.rb +389 -0
- data/lib/google/cloud/service_directory/v1beta1/lookup_service/rest/service_stub.rb +108 -0
- data/lib/google/cloud/service_directory/v1beta1/lookup_service/rest.rb +52 -0
- data/lib/google/cloud/service_directory/v1beta1/lookup_service.rb +7 -1
- data/lib/google/cloud/service_directory/v1beta1/registration_service/client.rb +14 -20
- data/lib/google/cloud/service_directory/v1beta1/registration_service/rest/client.rb +1743 -0
- data/lib/google/cloud/service_directory/v1beta1/registration_service/rest/service_stub.rb +1143 -0
- data/lib/google/cloud/service_directory/v1beta1/registration_service/rest.rb +66 -0
- data/lib/google/cloud/service_directory/v1beta1/registration_service.rb +7 -1
- data/lib/google/cloud/service_directory/v1beta1/rest.rb +38 -0
- data/lib/google/cloud/service_directory/v1beta1/version.rb +1 -1
- data/lib/google/cloud/service_directory/v1beta1.rb +7 -2
- data/lib/google/cloud/servicedirectory/v1beta1/endpoint_pb.rb +25 -11
- data/lib/google/cloud/servicedirectory/v1beta1/lookup_service_pb.rb +25 -9
- data/lib/google/cloud/servicedirectory/v1beta1/namespace_pb.rb +25 -8
- data/lib/google/cloud/servicedirectory/v1beta1/registration_service_pb.rb +28 -79
- data/lib/google/cloud/servicedirectory/v1beta1/service_pb.rb +26 -9
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/iam/v1/policy.rb +8 -4
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/protobuf/timestamp.rb +1 -3
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dff6673b7c2a5318ddc2f9bc5210bc7a03a206026b027f1ddae19a8a01ee846
|
4
|
+
data.tar.gz: f24bdf536d9127afb4e64bf323829a07c8c9673cb931cf3e436c775abf144e48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a777ea7d1a788613f20a06ee10ab903442db0aa552b7b2e9940182052ca14ff3df30b3bb758bbfaa73d654167fde1b02454338be12334e732427e6a384a3850e
|
7
|
+
data.tar.gz: 55977ef7d33b2dd1af4558919eb0785b191a805a8cf88079d433fe6d48dc0794d582da13fa11d6382ab747eb00bebf0c76c7c001a7b45fe4efc074ec4297a56e
|
data/AUTHENTICATION.md
CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
|
|
114
114
|
To configure your system for this, simply:
|
115
115
|
|
116
116
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
117
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
118
118
|
3. Write code as if already authenticated.
|
119
119
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ruby Client for the Service Directory V1beta1 API
|
2
2
|
|
3
|
-
|
3
|
+
Service Directory is a platform for discovering, publishing, and connecting services.
|
4
4
|
|
5
5
|
Service directory is the single place to register, browse, and resolve application services.
|
6
6
|
|
@@ -46,8 +46,8 @@ for general usage information.
|
|
46
46
|
## Enabling Logging
|
47
47
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
50
|
-
or a [`Google::Cloud::Logging::Logger`](https://
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
50
|
+
or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
53
53
|
|
@@ -312,9 +312,9 @@ module Google
|
|
312
312
|
# * (`String`) The path to a service account key file in JSON format
|
313
313
|
# * (`Hash`) A service account key as a Hash
|
314
314
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
315
|
-
# (see the [googleauth docs](https://
|
315
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
316
316
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
317
|
-
# (see the [signet docs](https://
|
317
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
318
318
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
319
319
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
320
320
|
# * (`nil`) indicating no credentials
|
@@ -0,0 +1,389 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/servicedirectory/v1beta1/lookup_service_pb"
|
21
|
+
require "google/cloud/service_directory/v1beta1/lookup_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module ServiceDirectory
|
26
|
+
module V1beta1
|
27
|
+
module LookupService
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the LookupService service.
|
31
|
+
#
|
32
|
+
# Service Directory API for looking up service data at runtime.
|
33
|
+
#
|
34
|
+
class Client
|
35
|
+
include Paths
|
36
|
+
|
37
|
+
# @private
|
38
|
+
attr_reader :lookup_service_stub
|
39
|
+
|
40
|
+
##
|
41
|
+
# Configure the LookupService Client class.
|
42
|
+
#
|
43
|
+
# See {::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client::Configuration}
|
44
|
+
# for a description of the configuration fields.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
#
|
48
|
+
# # Modify the configuration for all LookupService clients
|
49
|
+
# ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Client client.
|
54
|
+
# @yieldparam config [Client::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Client::Configuration]
|
57
|
+
#
|
58
|
+
def self.configure
|
59
|
+
@configure ||= begin
|
60
|
+
namespace = ["Google", "Cloud", "ServiceDirectory", "V1beta1"]
|
61
|
+
parent_config = while namespace.any?
|
62
|
+
parent_name = namespace.join "::"
|
63
|
+
parent_const = const_get parent_name
|
64
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
65
|
+
namespace.pop
|
66
|
+
end
|
67
|
+
default_config = Client::Configuration.new parent_config
|
68
|
+
|
69
|
+
default_config.timeout = 15.0
|
70
|
+
default_config.retry_policy = {
|
71
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2]
|
72
|
+
}
|
73
|
+
|
74
|
+
default_config
|
75
|
+
end
|
76
|
+
yield @configure if block_given?
|
77
|
+
@configure
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Configure the LookupService Client instance.
|
82
|
+
#
|
83
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
84
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
85
|
+
# should be made on {Client.configure}.
|
86
|
+
#
|
87
|
+
# See {::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client::Configuration}
|
88
|
+
# for a description of the configuration fields.
|
89
|
+
#
|
90
|
+
# @yield [config] Configure the Client client.
|
91
|
+
# @yieldparam config [Client::Configuration]
|
92
|
+
#
|
93
|
+
# @return [Client::Configuration]
|
94
|
+
#
|
95
|
+
def configure
|
96
|
+
yield @config if block_given?
|
97
|
+
@config
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Create a new LookupService REST client object.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
#
|
105
|
+
# # Create a client using the default configuration
|
106
|
+
# client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.new
|
107
|
+
#
|
108
|
+
# # Create a client using a custom configuration
|
109
|
+
# client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.new do |config|
|
110
|
+
# config.timeout = 10.0
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# @yield [config] Configure the LookupService client.
|
114
|
+
# @yieldparam config [Client::Configuration]
|
115
|
+
#
|
116
|
+
def initialize
|
117
|
+
# Create the configuration object
|
118
|
+
@config = Configuration.new Client.configure
|
119
|
+
|
120
|
+
# Yield the configuration if needed
|
121
|
+
yield @config if block_given?
|
122
|
+
|
123
|
+
# Create credentials
|
124
|
+
credentials = @config.credentials
|
125
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
126
|
+
# but only if the default endpoint does not have a region prefix.
|
127
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
128
|
+
!@config.endpoint.split(".").first.include?("-")
|
129
|
+
credentials ||= Credentials.default scope: @config.scope,
|
130
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
131
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
132
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
133
|
+
end
|
134
|
+
|
135
|
+
@quota_project_id = @config.quota_project
|
136
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
137
|
+
|
138
|
+
@lookup_service_stub = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
139
|
+
end
|
140
|
+
|
141
|
+
# Service calls
|
142
|
+
|
143
|
+
##
|
144
|
+
# Returns a {::Google::Cloud::ServiceDirectory::V1beta1::Service service} and its
|
145
|
+
# associated endpoints.
|
146
|
+
# Resolving a service is not considered an active developer method.
|
147
|
+
#
|
148
|
+
# @overload resolve_service(request, options = nil)
|
149
|
+
# Pass arguments to `resolve_service` via a request object, either of type
|
150
|
+
# {::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest} or an equivalent Hash.
|
151
|
+
#
|
152
|
+
# @param request [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest, ::Hash]
|
153
|
+
# A request object representing the call parameters. Required. To specify no
|
154
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
155
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
156
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
157
|
+
#
|
158
|
+
# @overload resolve_service(name: nil, max_endpoints: nil, endpoint_filter: nil)
|
159
|
+
# Pass arguments to `resolve_service` via keyword arguments. Note that at
|
160
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
161
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
162
|
+
#
|
163
|
+
# @param name [::String]
|
164
|
+
# Required. The name of the service to resolve.
|
165
|
+
# @param max_endpoints [::Integer]
|
166
|
+
# Optional. The maximum number of endpoints to return. Defaults to 25. Maximum is 100.
|
167
|
+
# If a value less than one is specified, the Default is used.
|
168
|
+
# If a value greater than the Maximum is specified, the Maximum is used.
|
169
|
+
# @param endpoint_filter [::String]
|
170
|
+
# Optional. The filter applied to the endpoints of the resolved service.
|
171
|
+
#
|
172
|
+
# General `filter` string syntax:
|
173
|
+
# `<field> <operator> <value> (<logical connector>)`
|
174
|
+
#
|
175
|
+
# * `<field>` can be `name`, `address`, `port`, or `metadata.<key>` for
|
176
|
+
# map field
|
177
|
+
# * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
|
178
|
+
# means `HAS`, and is roughly the same as `=`
|
179
|
+
# * `<value>` must be the same data type as field
|
180
|
+
# * `<logical connector>` can be `AND`, `OR`, `NOT`
|
181
|
+
#
|
182
|
+
# Examples of valid filters:
|
183
|
+
#
|
184
|
+
# * `metadata.owner` returns endpoints that have a annotation with the key
|
185
|
+
# `owner`, this is the same as `metadata:owner`
|
186
|
+
# * `metadata.protocol=gRPC` returns endpoints that have key/value
|
187
|
+
# `protocol=gRPC`
|
188
|
+
# * `address=192.108.1.105` returns endpoints that have this address
|
189
|
+
# * `port>8080` returns endpoints that have port number larger than 8080
|
190
|
+
# *
|
191
|
+
# `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
|
192
|
+
# returns endpoints that have name that is alphabetically later than the
|
193
|
+
# string, so "endpoint-e" is returned but "endpoint-a" is not
|
194
|
+
# * `metadata.owner!=sd AND metadata.foo=bar` returns endpoints that have
|
195
|
+
# `owner` in annotation key but value is not `sd` AND have key/value
|
196
|
+
# `foo=bar`
|
197
|
+
# * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
|
198
|
+
# doesn't have a field called "doesnotexist". Since the filter does not
|
199
|
+
# match any endpoint, it returns no results
|
200
|
+
#
|
201
|
+
# For more information about filtering, see
|
202
|
+
# [API Filtering](https://aip.dev/160).
|
203
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
204
|
+
# @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
|
205
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
206
|
+
#
|
207
|
+
# @return [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
|
208
|
+
#
|
209
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
210
|
+
def resolve_service request, options = nil
|
211
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
212
|
+
|
213
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest
|
214
|
+
|
215
|
+
# Converts hash and nil to an options object
|
216
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
217
|
+
|
218
|
+
# Customize the options with defaults
|
219
|
+
call_metadata = @config.rpcs.resolve_service.metadata.to_h
|
220
|
+
|
221
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
222
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
223
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
224
|
+
gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION,
|
225
|
+
transports_version_send: [:rest]
|
226
|
+
|
227
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
228
|
+
|
229
|
+
options.apply_defaults timeout: @config.rpcs.resolve_service.timeout,
|
230
|
+
metadata: call_metadata,
|
231
|
+
retry_policy: @config.rpcs.resolve_service.retry_policy
|
232
|
+
|
233
|
+
options.apply_defaults timeout: @config.timeout,
|
234
|
+
metadata: @config.metadata,
|
235
|
+
retry_policy: @config.retry_policy
|
236
|
+
|
237
|
+
@lookup_service_stub.resolve_service request, options do |result, operation|
|
238
|
+
yield result, operation if block_given?
|
239
|
+
return result
|
240
|
+
end
|
241
|
+
rescue ::Gapic::Rest::Error => e
|
242
|
+
raise ::Google::Cloud::Error.from_error(e)
|
243
|
+
end
|
244
|
+
|
245
|
+
##
|
246
|
+
# Configuration class for the LookupService REST API.
|
247
|
+
#
|
248
|
+
# This class represents the configuration for LookupService REST,
|
249
|
+
# providing control over timeouts, retry behavior, logging, transport
|
250
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
251
|
+
# applied individually to specific RPCs. See
|
252
|
+
# {::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client::Configuration::Rpcs}
|
253
|
+
# for a list of RPCs that can be configured independently.
|
254
|
+
#
|
255
|
+
# Configuration can be applied globally to all clients, or to a single client
|
256
|
+
# on construction.
|
257
|
+
#
|
258
|
+
# @example
|
259
|
+
#
|
260
|
+
# # Modify the global config, setting the timeout for
|
261
|
+
# # resolve_service to 20 seconds,
|
262
|
+
# # and all remaining timeouts to 10 seconds.
|
263
|
+
# ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.configure do |config|
|
264
|
+
# config.timeout = 10.0
|
265
|
+
# config.rpcs.resolve_service.timeout = 20.0
|
266
|
+
# end
|
267
|
+
#
|
268
|
+
# # Apply the above configuration only to a new client.
|
269
|
+
# client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.new do |config|
|
270
|
+
# config.timeout = 10.0
|
271
|
+
# config.rpcs.resolve_service.timeout = 20.0
|
272
|
+
# end
|
273
|
+
#
|
274
|
+
# @!attribute [rw] endpoint
|
275
|
+
# The hostname or hostname:port of the service endpoint.
|
276
|
+
# Defaults to `"servicedirectory.googleapis.com"`.
|
277
|
+
# @return [::String]
|
278
|
+
# @!attribute [rw] credentials
|
279
|
+
# Credentials to send with calls. You may provide any of the following types:
|
280
|
+
# * (`String`) The path to a service account key file in JSON format
|
281
|
+
# * (`Hash`) A service account key as a Hash
|
282
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
283
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
284
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
285
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
286
|
+
# * (`nil`) indicating no credentials
|
287
|
+
# @return [::Object]
|
288
|
+
# @!attribute [rw] scope
|
289
|
+
# The OAuth scopes
|
290
|
+
# @return [::Array<::String>]
|
291
|
+
# @!attribute [rw] lib_name
|
292
|
+
# The library name as recorded in instrumentation and logging
|
293
|
+
# @return [::String]
|
294
|
+
# @!attribute [rw] lib_version
|
295
|
+
# The library version as recorded in instrumentation and logging
|
296
|
+
# @return [::String]
|
297
|
+
# @!attribute [rw] timeout
|
298
|
+
# The call timeout in seconds.
|
299
|
+
# @return [::Numeric]
|
300
|
+
# @!attribute [rw] metadata
|
301
|
+
# Additional headers to be sent with the call.
|
302
|
+
# @return [::Hash{::Symbol=>::String}]
|
303
|
+
# @!attribute [rw] retry_policy
|
304
|
+
# The retry policy. The value is a hash with the following keys:
|
305
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
306
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
307
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
308
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
309
|
+
# trigger a retry.
|
310
|
+
# @return [::Hash]
|
311
|
+
# @!attribute [rw] quota_project
|
312
|
+
# A separate project against which to charge quota.
|
313
|
+
# @return [::String]
|
314
|
+
#
|
315
|
+
class Configuration
|
316
|
+
extend ::Gapic::Config
|
317
|
+
|
318
|
+
config_attr :endpoint, "servicedirectory.googleapis.com", ::String
|
319
|
+
config_attr :credentials, nil do |value|
|
320
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
321
|
+
allowed.any? { |klass| klass === value }
|
322
|
+
end
|
323
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
324
|
+
config_attr :lib_name, nil, ::String, nil
|
325
|
+
config_attr :lib_version, nil, ::String, nil
|
326
|
+
config_attr :timeout, nil, ::Numeric, nil
|
327
|
+
config_attr :metadata, nil, ::Hash, nil
|
328
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
329
|
+
config_attr :quota_project, nil, ::String, nil
|
330
|
+
|
331
|
+
# @private
|
332
|
+
def initialize parent_config = nil
|
333
|
+
@parent_config = parent_config unless parent_config.nil?
|
334
|
+
|
335
|
+
yield self if block_given?
|
336
|
+
end
|
337
|
+
|
338
|
+
##
|
339
|
+
# Configurations for individual RPCs
|
340
|
+
# @return [Rpcs]
|
341
|
+
#
|
342
|
+
def rpcs
|
343
|
+
@rpcs ||= begin
|
344
|
+
parent_rpcs = nil
|
345
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
346
|
+
Rpcs.new parent_rpcs
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
##
|
351
|
+
# Configuration RPC class for the LookupService API.
|
352
|
+
#
|
353
|
+
# Includes fields providing the configuration for each RPC in this service.
|
354
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
355
|
+
# the following configuration fields:
|
356
|
+
#
|
357
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
358
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
359
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
360
|
+
# include the following keys:
|
361
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
362
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
363
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
364
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
365
|
+
# trigger a retry.
|
366
|
+
#
|
367
|
+
class Rpcs
|
368
|
+
##
|
369
|
+
# RPC-specific configuration for `resolve_service`
|
370
|
+
# @return [::Gapic::Config::Method]
|
371
|
+
#
|
372
|
+
attr_reader :resolve_service
|
373
|
+
|
374
|
+
# @private
|
375
|
+
def initialize parent_rpcs = nil
|
376
|
+
resolve_service_config = parent_rpcs.resolve_service if parent_rpcs.respond_to? :resolve_service
|
377
|
+
@resolve_service = ::Gapic::Config::Method.new resolve_service_config
|
378
|
+
|
379
|
+
yield self if block_given?
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/servicedirectory/v1beta1/lookup_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module ServiceDirectory
|
24
|
+
module V1beta1
|
25
|
+
module LookupService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the LookupService service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
def initialize endpoint:, credentials:
|
34
|
+
# These require statements are intentionally placed here to initialize
|
35
|
+
# the REST modules only when it's required.
|
36
|
+
require "gapic/rest"
|
37
|
+
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
39
|
+
numeric_enums: true,
|
40
|
+
raise_faraday_errors: false
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Baseline implementation for the resolve_service REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest]
|
47
|
+
# A request object representing the call parameters. Required.
|
48
|
+
# @param options [::Gapic::CallOptions]
|
49
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
50
|
+
#
|
51
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
52
|
+
# @yieldparam result [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def resolve_service request_pb, options = nil
|
58
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
59
|
+
|
60
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_resolve_service_request request_pb
|
61
|
+
query_string_params = if query_string_params.any?
|
62
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
response = @client_stub.make_http_request(
|
68
|
+
verb,
|
69
|
+
uri: uri,
|
70
|
+
body: body || "",
|
71
|
+
params: query_string_params,
|
72
|
+
options: options
|
73
|
+
)
|
74
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
75
|
+
result = ::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# @private
|
83
|
+
#
|
84
|
+
# GRPC transcoding helper method for the resolve_service REST call
|
85
|
+
#
|
86
|
+
# @param request_pb [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest]
|
87
|
+
# A request object representing the call parameters. Required.
|
88
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
89
|
+
# Uri, Body, Query string parameters
|
90
|
+
def self.transcode_resolve_service_request request_pb
|
91
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
92
|
+
.with_bindings(
|
93
|
+
uri_method: :post,
|
94
|
+
uri_template: "/v1beta1/{name}:resolve",
|
95
|
+
body: "*",
|
96
|
+
matches: [
|
97
|
+
["name", %r{^projects/[^/]+/locations/[^/]+/namespaces/[^/]+/services/[^/]+/?$}, false]
|
98
|
+
]
|
99
|
+
)
|
100
|
+
transcoder.transcode request_pb
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/service_directory/v1beta1/version"
|
24
|
+
|
25
|
+
require "google/cloud/service_directory/v1beta1/lookup_service/credentials"
|
26
|
+
require "google/cloud/service_directory/v1beta1/lookup_service/paths"
|
27
|
+
require "google/cloud/service_directory/v1beta1/lookup_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module ServiceDirectory
|
32
|
+
module V1beta1
|
33
|
+
##
|
34
|
+
# Service Directory API for looking up service data at runtime.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a REST client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/service_directory/v1beta1/lookup_service/rest"
|
39
|
+
# client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.new
|
40
|
+
#
|
41
|
+
module LookupService
|
42
|
+
# Client for the REST transport
|
43
|
+
module Rest
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
52
|
+
require "google/cloud/service_directory/v1beta1/lookup_service/rest/helpers" if ::File.file? helper_path
|
@@ -25,6 +25,7 @@ require "google/cloud/service_directory/v1beta1/version"
|
|
25
25
|
require "google/cloud/service_directory/v1beta1/lookup_service/credentials"
|
26
26
|
require "google/cloud/service_directory/v1beta1/lookup_service/paths"
|
27
27
|
require "google/cloud/service_directory/v1beta1/lookup_service/client"
|
28
|
+
require "google/cloud/service_directory/v1beta1/lookup_service/rest"
|
28
29
|
|
29
30
|
module Google
|
30
31
|
module Cloud
|
@@ -33,11 +34,16 @@ module Google
|
|
33
34
|
##
|
34
35
|
# Service Directory API for looking up service data at runtime.
|
35
36
|
#
|
36
|
-
#
|
37
|
+
# @example Load this service and instantiate a gRPC client
|
37
38
|
#
|
38
39
|
# require "google/cloud/service_directory/v1beta1/lookup_service"
|
39
40
|
# client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
|
40
41
|
#
|
42
|
+
# @example Load this service and instantiate a REST client
|
43
|
+
#
|
44
|
+
# require "google/cloud/service_directory/v1beta1/lookup_service/rest"
|
45
|
+
# client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Rest::Client.new
|
46
|
+
#
|
41
47
|
module LookupService
|
42
48
|
end
|
43
49
|
end
|