google-cloud-service_directory-v1 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ceed32a3d84dbe4401c3d6458e7e39943ab85d25f93dba276ded979020c74f7e
4
- data.tar.gz: 772696fddb1404f7db2565db2e3cfe2f94deece0f0cb4d51db5e0f7e11b79f2c
3
+ metadata.gz: 6df887a3a09eba284365b796173a6e9718e0db70311220b886066332a6005642
4
+ data.tar.gz: d1129a3229209eb151ec8eb82d60e108ea76536c3ed355bec1a46d3eb57651dc
5
5
  SHA512:
6
- metadata.gz: ee9173bf439823c2ade30387cec358c5eaf5525713ebc44df92e9a8b27fe4a7b3dafa8f715697362946c2e329ab55f87b5b8954a276cc598cd597ca41a9ecf15
7
- data.tar.gz: de081af2ca2661cd320e6dda3ba570803e11ccc0ece73605cb4ce20b254f4b4fe1e698b93260f2451ea250c38ee2c55f38d50f4f7db537a0512a37069bbd9fa6
6
+ metadata.gz: 51231b5a58a7186ed74bfd4b7e498804d26d247885bf9537338c5c83149d8da23704b8bfdb4764987c903a1af085f58caba7441136cbf4f5d0b2054ccecd97fa
7
+ data.tar.gz: 3f840fbbda355f623d290b4123f7a47a4100bb420f15f65ef2404bd54cc8dc684136737d875cab83c46a91e1a1f8097e7180ec9e4fd1b8dc789b7970471a6111
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 V1 API
2
2
 
3
- API Client library for the Service Directory V1 API
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,7 +46,7 @@ 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/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
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
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/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.
@@ -0,0 +1,374 @@
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/v1/lookup_service_pb"
21
+ require "google/cloud/service_directory/v1/lookup_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ServiceDirectory
26
+ module V1
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::V1::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::V1::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", "V1"]
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::V1::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::V1::LookupService::Rest::Client.new
107
+ #
108
+ # # Create a client using a custom configuration
109
+ # client = ::Google::Cloud::ServiceDirectory::V1::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::V1::LookupService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
139
+ end
140
+
141
+ # Service calls
142
+
143
+ ##
144
+ # Returns a {::Google::Cloud::ServiceDirectory::V1::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::V1::ResolveServiceRequest} or an equivalent Hash.
151
+ #
152
+ # @param request [::Google::Cloud::ServiceDirectory::V1::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.
167
+ # Maximum is 100. 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
+ # <field> can be "name" or "metadata.<key>" for map field.
175
+ # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS and is
176
+ # roughly the same as "=".
177
+ # <value> must be the same data type as the field.
178
+ # <logical connector> can be "AND, OR, NOT".
179
+ #
180
+ # Examples of valid filters:
181
+ # * "metadata.owner" returns Endpoints that have a label with the
182
+ # key "owner", this is the same as "metadata:owner"
183
+ # * "metadata.protocol=gRPC" returns Endpoints that have key/value
184
+ # "protocol=gRPC"
185
+ # * "metadata.owner!=sd AND metadata.foo=bar" returns
186
+ # Endpoints that have "owner" field in metadata with a value that is not
187
+ # "sd" AND have the key/value foo=bar.
188
+ # @yield [result, operation] Access the result along with the TransportOperation object
189
+ # @yieldparam result [::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse]
190
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
191
+ #
192
+ # @return [::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse]
193
+ #
194
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
195
+ def resolve_service request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::ResolveServiceRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ call_metadata = @config.rpcs.resolve_service.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION,
210
+ transports_version_send: [:rest]
211
+
212
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
213
+
214
+ options.apply_defaults timeout: @config.rpcs.resolve_service.timeout,
215
+ metadata: call_metadata,
216
+ retry_policy: @config.rpcs.resolve_service.retry_policy
217
+
218
+ options.apply_defaults timeout: @config.timeout,
219
+ metadata: @config.metadata,
220
+ retry_policy: @config.retry_policy
221
+
222
+ @lookup_service_stub.resolve_service request, options do |result, operation|
223
+ yield result, operation if block_given?
224
+ return result
225
+ end
226
+ rescue ::Gapic::Rest::Error => e
227
+ raise ::Google::Cloud::Error.from_error(e)
228
+ end
229
+
230
+ ##
231
+ # Configuration class for the LookupService REST API.
232
+ #
233
+ # This class represents the configuration for LookupService REST,
234
+ # providing control over timeouts, retry behavior, logging, transport
235
+ # parameters, and other low-level controls. Certain parameters can also be
236
+ # applied individually to specific RPCs. See
237
+ # {::Google::Cloud::ServiceDirectory::V1::LookupService::Rest::Client::Configuration::Rpcs}
238
+ # for a list of RPCs that can be configured independently.
239
+ #
240
+ # Configuration can be applied globally to all clients, or to a single client
241
+ # on construction.
242
+ #
243
+ # @example
244
+ #
245
+ # # Modify the global config, setting the timeout for
246
+ # # resolve_service to 20 seconds,
247
+ # # and all remaining timeouts to 10 seconds.
248
+ # ::Google::Cloud::ServiceDirectory::V1::LookupService::Rest::Client.configure do |config|
249
+ # config.timeout = 10.0
250
+ # config.rpcs.resolve_service.timeout = 20.0
251
+ # end
252
+ #
253
+ # # Apply the above configuration only to a new client.
254
+ # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Rest::Client.new do |config|
255
+ # config.timeout = 10.0
256
+ # config.rpcs.resolve_service.timeout = 20.0
257
+ # end
258
+ #
259
+ # @!attribute [rw] endpoint
260
+ # The hostname or hostname:port of the service endpoint.
261
+ # Defaults to `"servicedirectory.googleapis.com"`.
262
+ # @return [::String]
263
+ # @!attribute [rw] credentials
264
+ # Credentials to send with calls. You may provide any of the following types:
265
+ # * (`String`) The path to a service account key file in JSON format
266
+ # * (`Hash`) A service account key as a Hash
267
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
268
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
269
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
270
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
271
+ # * (`nil`) indicating no credentials
272
+ # @return [::Object]
273
+ # @!attribute [rw] scope
274
+ # The OAuth scopes
275
+ # @return [::Array<::String>]
276
+ # @!attribute [rw] lib_name
277
+ # The library name as recorded in instrumentation and logging
278
+ # @return [::String]
279
+ # @!attribute [rw] lib_version
280
+ # The library version as recorded in instrumentation and logging
281
+ # @return [::String]
282
+ # @!attribute [rw] timeout
283
+ # The call timeout in seconds.
284
+ # @return [::Numeric]
285
+ # @!attribute [rw] metadata
286
+ # Additional headers to be sent with the call.
287
+ # @return [::Hash{::Symbol=>::String}]
288
+ # @!attribute [rw] retry_policy
289
+ # The retry policy. The value is a hash with the following keys:
290
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
291
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
292
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
293
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
294
+ # trigger a retry.
295
+ # @return [::Hash]
296
+ # @!attribute [rw] quota_project
297
+ # A separate project against which to charge quota.
298
+ # @return [::String]
299
+ #
300
+ class Configuration
301
+ extend ::Gapic::Config
302
+
303
+ config_attr :endpoint, "servicedirectory.googleapis.com", ::String
304
+ config_attr :credentials, nil do |value|
305
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
306
+ allowed.any? { |klass| klass === value }
307
+ end
308
+ config_attr :scope, nil, ::String, ::Array, nil
309
+ config_attr :lib_name, nil, ::String, nil
310
+ config_attr :lib_version, nil, ::String, nil
311
+ config_attr :timeout, nil, ::Numeric, nil
312
+ config_attr :metadata, nil, ::Hash, nil
313
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
314
+ config_attr :quota_project, nil, ::String, nil
315
+
316
+ # @private
317
+ def initialize parent_config = nil
318
+ @parent_config = parent_config unless parent_config.nil?
319
+
320
+ yield self if block_given?
321
+ end
322
+
323
+ ##
324
+ # Configurations for individual RPCs
325
+ # @return [Rpcs]
326
+ #
327
+ def rpcs
328
+ @rpcs ||= begin
329
+ parent_rpcs = nil
330
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
331
+ Rpcs.new parent_rpcs
332
+ end
333
+ end
334
+
335
+ ##
336
+ # Configuration RPC class for the LookupService API.
337
+ #
338
+ # Includes fields providing the configuration for each RPC in this service.
339
+ # Each configuration object is of type `Gapic::Config::Method` and includes
340
+ # the following configuration fields:
341
+ #
342
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
343
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
344
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
345
+ # include the following keys:
346
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
347
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
348
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
349
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
350
+ # trigger a retry.
351
+ #
352
+ class Rpcs
353
+ ##
354
+ # RPC-specific configuration for `resolve_service`
355
+ # @return [::Gapic::Config::Method]
356
+ #
357
+ attr_reader :resolve_service
358
+
359
+ # @private
360
+ def initialize parent_rpcs = nil
361
+ resolve_service_config = parent_rpcs.resolve_service if parent_rpcs.respond_to? :resolve_service
362
+ @resolve_service = ::Gapic::Config::Method.new resolve_service_config
363
+
364
+ yield self if block_given?
365
+ end
366
+ end
367
+ end
368
+ end
369
+ end
370
+ end
371
+ end
372
+ end
373
+ end
374
+ 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/v1/lookup_service_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module ServiceDirectory
24
+ module V1
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::V1::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::V1::ResolveServiceResponse]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::ServiceDirectory::V1::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::V1::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::V1::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: "/v1/{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/v1/version"
24
+
25
+ require "google/cloud/service_directory/v1/lookup_service/credentials"
26
+ require "google/cloud/service_directory/v1/lookup_service/paths"
27
+ require "google/cloud/service_directory/v1/lookup_service/rest/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module ServiceDirectory
32
+ module V1
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/v1/lookup_service/rest"
39
+ # client = ::Google::Cloud::ServiceDirectory::V1::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/v1/lookup_service/rest/helpers" if ::File.file? helper_path
@@ -25,6 +25,7 @@ require "google/cloud/service_directory/v1/version"
25
25
  require "google/cloud/service_directory/v1/lookup_service/credentials"
26
26
  require "google/cloud/service_directory/v1/lookup_service/paths"
27
27
  require "google/cloud/service_directory/v1/lookup_service/client"
28
+ require "google/cloud/service_directory/v1/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
- # To load this service and instantiate a client:
37
+ # @example Load this service and instantiate a gRPC client
37
38
  #
38
39
  # require "google/cloud/service_directory/v1/lookup_service"
39
40
  # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.new
40
41
  #
42
+ # @example Load this service and instantiate a REST client
43
+ #
44
+ # require "google/cloud/service_directory/v1/lookup_service/rest"
45
+ # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Rest::Client.new
46
+ #
41
47
  module LookupService
42
48
  end
43
49
  end
@@ -340,13 +340,11 @@ module Google
340
340
  # # Call the list_namespaces method.
341
341
  # result = client.list_namespaces request
342
342
  #
343
- # # The returned object is of type Gapic::PagedEnumerable. You can
344
- # # iterate over all elements by calling #each, and the enumerable
345
- # # will lazily make API calls to fetch subsequent pages. Other
346
- # # methods are also available for managing paging directly.
347
- # result.each do |response|
343
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
344
+ # # over elements, and API calls will be issued to fetch pages as needed.
345
+ # result.each do |item|
348
346
  # # Each element is of type ::Google::Cloud::ServiceDirectory::V1::Namespace.
349
- # p response
347
+ # p item
350
348
  # end
351
349
  #
352
350
  def list_namespaces request, options = nil
@@ -817,13 +815,11 @@ module Google
817
815
  # # Call the list_services method.
818
816
  # result = client.list_services request
819
817
  #
820
- # # The returned object is of type Gapic::PagedEnumerable. You can
821
- # # iterate over all elements by calling #each, and the enumerable
822
- # # will lazily make API calls to fetch subsequent pages. Other
823
- # # methods are also available for managing paging directly.
824
- # result.each do |response|
818
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
819
+ # # over elements, and API calls will be issued to fetch pages as needed.
820
+ # result.each do |item|
825
821
  # # Each element is of type ::Google::Cloud::ServiceDirectory::V1::Service.
826
- # p response
822
+ # p item
827
823
  # end
828
824
  #
829
825
  def list_services request, options = nil
@@ -1296,13 +1292,11 @@ module Google
1296
1292
  # # Call the list_endpoints method.
1297
1293
  # result = client.list_endpoints request
1298
1294
  #
1299
- # # The returned object is of type Gapic::PagedEnumerable. You can
1300
- # # iterate over all elements by calling #each, and the enumerable
1301
- # # will lazily make API calls to fetch subsequent pages. Other
1302
- # # methods are also available for managing paging directly.
1303
- # result.each do |response|
1295
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1296
+ # # over elements, and API calls will be issued to fetch pages as needed.
1297
+ # result.each do |item|
1304
1298
  # # Each element is of type ::Google::Cloud::ServiceDirectory::V1::Endpoint.
1305
- # p response
1299
+ # p item
1306
1300
  # end
1307
1301
  #
1308
1302
  def list_endpoints request, options = nil