google-cloud-service_directory-v1 0.7.0 → 0.8.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.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/service_directory/v1/bindings_override.rb +102 -0
  3. data/lib/google/cloud/service_directory/v1/lookup_service/client.rb +50 -16
  4. data/lib/google/cloud/service_directory/v1/lookup_service/rest/client.rb +58 -16
  5. data/lib/google/cloud/service_directory/v1/lookup_service/rest/service_stub.rb +1 -1
  6. data/lib/google/cloud/service_directory/v1/lookup_service/rest.rb +1 -0
  7. data/lib/google/cloud/service_directory/v1/registration_service/client.rb +138 -83
  8. data/lib/google/cloud/service_directory/v1/registration_service/paths.rb +17 -0
  9. data/lib/google/cloud/service_directory/v1/registration_service/rest/client.rb +147 -84
  10. data/lib/google/cloud/service_directory/v1/registration_service/rest/service_stub.rb +18 -18
  11. data/lib/google/cloud/service_directory/v1/registration_service/rest.rb +1 -0
  12. data/lib/google/cloud/service_directory/v1/rest.rb +1 -0
  13. data/lib/google/cloud/service_directory/v1/version.rb +1 -1
  14. data/lib/google/cloud/servicedirectory/v1/endpoint_pb.rb +1 -1
  15. data/lib/google/cloud/servicedirectory/v1/namespace_pb.rb +1 -1
  16. data/lib/google/cloud/servicedirectory/v1/registration_service_services_pb.rb +6 -6
  17. data/lib/google/cloud/servicedirectory/v1/service_pb.rb +1 -1
  18. data/proto_docs/google/cloud/servicedirectory/v1/endpoint.rb +40 -25
  19. data/proto_docs/google/cloud/servicedirectory/v1/lookup_service.rb +32 -14
  20. data/proto_docs/google/cloud/servicedirectory/v1/namespace.rb +6 -2
  21. data/proto_docs/google/cloud/servicedirectory/v1/registration_service.rb +116 -77
  22. data/proto_docs/google/cloud/servicedirectory/v1/service.rb +22 -18
  23. data/proto_docs/google/protobuf/any.rb +144 -0
  24. metadata +26 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b65e971f67d733d365f1bc416763d3c39cccc62a9ffc5c44c008e27294d32f04
4
- data.tar.gz: f87388da9ef3283e42c8a852376e45d97ebaeea13bc0b3fcc3662a7177e87b8b
3
+ metadata.gz: eb7347a1fe5c67d04d998a4266ffbda679f9c694f33ff7a2d0d7c24220930b1a
4
+ data.tar.gz: b0f5b0db819fbdf152ff72716242f0932869da6d4defe662c61c89fe7a01cd42
5
5
  SHA512:
6
- metadata.gz: 0b02fea76e236f99dadd271bc11450fc6a484d0621789a99e6aaf5495315b94f625dd6255cdda8ab3a7964cbc316fd0fbeca9cc9278eba88a75d62a58140382f
7
- data.tar.gz: 9c452ac4f0f2252e061d78beb61576821ec49d6dae3658ecec08188d2eb1d66c31578af22995dfed37e76ffbac359f606cd09a3e92fbfebc5bf554cdddb6ea67
6
+ metadata.gz: 4baabb7351990bfae900bac4402d4c05ee3432c7aaf480270945fcc11dc2c4a9fdefe41be51870e9cdbca80492a42b8716c4afabc519e95ffc7b8ae925113a53
7
+ data.tar.gz: da32f7379aa9d81c103cd4eeffbc11ca60399e901a8ea9976e86ca9a5dad6f608b661aeb95451910b48e9ac195af35e922d947fb318c7fd32529eb6081ae7473
@@ -0,0 +1,102 @@
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/config"
20
+
21
+ module Google
22
+ module Cloud
23
+ module ServiceDirectory
24
+ ##
25
+ # @example Loading just the REST part of this package, including all its services, and instantiating a REST client
26
+ #
27
+ # require "google/cloud/service_directory/v1/rest"
28
+ # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Rest::Client.new
29
+ #
30
+ module V1
31
+ ##
32
+ # @private
33
+ # Initialize the mixin bindings configuration
34
+ #
35
+ def self.configure
36
+ @configure ||= begin
37
+ namespace = ["Google", "Cloud", "ServiceDirectory"]
38
+ parent_config = while namespace.any?
39
+ parent_name = namespace.join "::"
40
+ parent_const = const_get parent_name
41
+ break parent_const.configure if parent_const.respond_to? :configure
42
+ namespace.pop
43
+ end
44
+
45
+ default_config = Configuration.new parent_config
46
+ default_config.bindings_override["google.cloud.location.Locations.GetLocation"] = [
47
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
48
+ uri_method: :get,
49
+ uri_template: "/v1/{name}",
50
+ matches: [
51
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
52
+ ],
53
+ body: nil
54
+ )
55
+ ]
56
+ default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [
57
+
58
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
59
+ uri_method: :get,
60
+ uri_template: "/v1/{name}/locations",
61
+ matches: [
62
+ ["name", %r{^projects/[^/]+/?$}, false]
63
+ ],
64
+ body: nil
65
+ )
66
+ ]
67
+ default_config
68
+ end
69
+ yield @configure if block_given?
70
+ @configure
71
+ end
72
+
73
+ ##
74
+ # @private
75
+ # Configuration class for the google.cloud.servicedirectory.v1 package.
76
+ #
77
+ # This class contains common configuration for all services
78
+ # of the google.cloud.servicedirectory.v1 package.
79
+ #
80
+ # This configuration is for internal use of the client library classes,
81
+ # and it is not intended that the end-users will read or change it.
82
+ #
83
+ class Configuration
84
+ extend ::Gapic::Config
85
+
86
+ # @private
87
+ # Overrides for http bindings for the RPC of the mixins for this package.
88
+ # Services in this package should use these when creating clients for the mixin services.
89
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
90
+ config_attr :bindings_override, {}, ::Hash, nil
91
+
92
+ # @private
93
+ def initialize parent_config = nil
94
+ @parent_config = parent_config unless parent_config.nil?
95
+
96
+ yield self if block_given?
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/servicedirectory/v1/lookup_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -128,7 +129,7 @@ module Google
128
129
  credentials = @config.credentials
129
130
  # Use self-signed JWT if the endpoint is unchanged from default,
130
131
  # but only if the default endpoint does not have a region prefix.
131
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
132
133
  !@config.endpoint.split(".").first.include?("-")
133
134
  credentials ||= Credentials.default scope: @config.scope,
134
135
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -138,6 +139,12 @@ module Google
138
139
  @quota_project_id = @config.quota_project
139
140
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
141
 
142
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
143
+ config.credentials = credentials
144
+ config.quota_project = @quota_project_id
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
141
148
  @lookup_service_stub = ::Gapic::ServiceStub.new(
142
149
  ::Google::Cloud::ServiceDirectory::V1::LookupService::Stub,
143
150
  credentials: credentials,
@@ -147,6 +154,13 @@ module Google
147
154
  )
148
155
  end
149
156
 
157
+ ##
158
+ # Get the associated client for mix-in of the Locations.
159
+ #
160
+ # @return [Google::Cloud::Location::Locations::Client]
161
+ #
162
+ attr_reader :location_client
163
+
150
164
  # Service calls
151
165
 
152
166
  ##
@@ -178,22 +192,40 @@ module Google
178
192
  # @param endpoint_filter [::String]
179
193
  # Optional. The filter applied to the endpoints of the resolved service.
180
194
  #
181
- # General filter string syntax:
182
- # <field> <operator> <value> (<logical connector>)
183
- # <field> can be "name" or "metadata.<key>" for map field.
184
- # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS and is
185
- # roughly the same as "=".
186
- # <value> must be the same data type as the field.
187
- # <logical connector> can be "AND, OR, NOT".
195
+ # General `filter` string syntax:
196
+ # `<field> <operator> <value> (<logical connector>)`
197
+ #
198
+ # * `<field>` can be `name`, `address`, `port`, or `annotations.<key>` for
199
+ # map field
200
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
201
+ # means `HAS`, and is roughly the same as `=`
202
+ # * `<value>` must be the same data type as field
203
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
188
204
  #
189
205
  # Examples of valid filters:
190
- # * "metadata.owner" returns Endpoints that have a label with the
191
- # key "owner", this is the same as "metadata:owner"
192
- # * "metadata.protocol=gRPC" returns Endpoints that have key/value
193
- # "protocol=gRPC"
194
- # * "metadata.owner!=sd AND metadata.foo=bar" returns
195
- # Endpoints that have "owner" field in metadata with a value that is not
196
- # "sd" AND have the key/value foo=bar.
206
+ #
207
+ # * `annotations.owner` returns endpoints that have a annotation with the
208
+ # key `owner`, this is the same as `annotations:owner`
209
+ # * `annotations.protocol=gRPC` returns endpoints that have key/value
210
+ # `protocol=gRPC`
211
+ # * `address=192.108.1.105` returns endpoints that have this address
212
+ # * `port>8080` returns endpoints that have port number larger than 8080
213
+ # *
214
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
215
+ # returns endpoints that have name that is alphabetically later than the
216
+ # string, so "endpoint-e" is returned but "endpoint-a" is not
217
+ # *
218
+ # `name=projects/my-project/locations/us-central1/namespaces/my-namespace/services/my-service/endpoints/ep-1`
219
+ # returns the endpoint that has an endpoint_id equal to `ep-1`
220
+ # * `annotations.owner!=sd AND annotations.foo=bar` returns endpoints that
221
+ # have `owner` in annotation key but value is not `sd` AND have
222
+ # key/value `foo=bar`
223
+ # * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
224
+ # doesn't have a field called "doesnotexist". Since the filter does not
225
+ # match any endpoint, it returns no results
226
+ #
227
+ # For more information about filtering, see
228
+ # [API Filtering](https://aip.dev/160).
197
229
  #
198
230
  # @yield [response, operation] Access the result along with the RPC operation
199
231
  # @yieldparam response [::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse]
@@ -341,7 +373,9 @@ module Google
341
373
  class Configuration
342
374
  extend ::Gapic::Config
343
375
 
344
- config_attr :endpoint, "servicedirectory.googleapis.com", ::String
376
+ DEFAULT_ENDPOINT = "servicedirectory.googleapis.com"
377
+
378
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
345
379
  config_attr :credentials, nil do |value|
346
380
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
347
381
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/servicedirectory/v1/lookup_service_pb"
21
21
  require "google/cloud/service_directory/v1/lookup_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -124,7 +125,7 @@ module Google
124
125
  credentials = @config.credentials
125
126
  # Use self-signed JWT if the endpoint is unchanged from default,
126
127
  # but only if the default endpoint does not have a region prefix.
127
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
128
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
128
129
  !@config.endpoint.split(".").first.include?("-")
129
130
  credentials ||= Credentials.default scope: @config.scope,
130
131
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -135,9 +136,23 @@ module Google
135
136
  @quota_project_id = @config.quota_project
136
137
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
138
 
139
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ config.bindings_override = @config.bindings_override
144
+ end
145
+
138
146
  @lookup_service_stub = ::Google::Cloud::ServiceDirectory::V1::LookupService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
139
147
  end
140
148
 
149
+ ##
150
+ # Get the associated client for mix-in of the Locations.
151
+ #
152
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
153
+ #
154
+ attr_reader :location_client
155
+
141
156
  # Service calls
142
157
 
143
158
  ##
@@ -169,22 +184,40 @@ module Google
169
184
  # @param endpoint_filter [::String]
170
185
  # Optional. The filter applied to the endpoints of the resolved service.
171
186
  #
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".
187
+ # General `filter` string syntax:
188
+ # `<field> <operator> <value> (<logical connector>)`
189
+ #
190
+ # * `<field>` can be `name`, `address`, `port`, or `annotations.<key>` for
191
+ # map field
192
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
193
+ # means `HAS`, and is roughly the same as `=`
194
+ # * `<value>` must be the same data type as field
195
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
179
196
  #
180
197
  # 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.
198
+ #
199
+ # * `annotations.owner` returns endpoints that have a annotation with the
200
+ # key `owner`, this is the same as `annotations:owner`
201
+ # * `annotations.protocol=gRPC` returns endpoints that have key/value
202
+ # `protocol=gRPC`
203
+ # * `address=192.108.1.105` returns endpoints that have this address
204
+ # * `port>8080` returns endpoints that have port number larger than 8080
205
+ # *
206
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
207
+ # returns endpoints that have name that is alphabetically later than the
208
+ # string, so "endpoint-e" is returned but "endpoint-a" is not
209
+ # *
210
+ # `name=projects/my-project/locations/us-central1/namespaces/my-namespace/services/my-service/endpoints/ep-1`
211
+ # returns the endpoint that has an endpoint_id equal to `ep-1`
212
+ # * `annotations.owner!=sd AND annotations.foo=bar` returns endpoints that
213
+ # have `owner` in annotation key but value is not `sd` AND have
214
+ # key/value `foo=bar`
215
+ # * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
216
+ # doesn't have a field called "doesnotexist". Since the filter does not
217
+ # match any endpoint, it returns no results
218
+ #
219
+ # For more information about filtering, see
220
+ # [API Filtering](https://aip.dev/160).
188
221
  # @yield [result, operation] Access the result along with the TransportOperation object
189
222
  # @yieldparam result [::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse]
190
223
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -300,7 +333,9 @@ module Google
300
333
  class Configuration
301
334
  extend ::Gapic::Config
302
335
 
303
- config_attr :endpoint, "servicedirectory.googleapis.com", ::String
336
+ DEFAULT_ENDPOINT = "servicedirectory.googleapis.com"
337
+
338
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
304
339
  config_attr :credentials, nil do |value|
305
340
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
306
341
  allowed.any? { |klass| klass === value }
@@ -313,6 +348,13 @@ module Google
313
348
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
314
349
  config_attr :quota_project, nil, ::String, nil
315
350
 
351
+ # @private
352
+ # Overrides for http bindings for the RPCs of this service
353
+ # are only used when this service is used as mixin, and only
354
+ # by the host service.
355
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
356
+ config_attr :bindings_override, {}, ::Hash, nil
357
+
316
358
  # @private
317
359
  def initialize parent_config = nil
318
360
  @parent_config = parent_config unless parent_config.nil?
@@ -59,7 +59,7 @@ module Google
59
59
 
60
60
  verb, uri, query_string_params, body = ServiceStub.transcode_resolve_service_request request_pb
61
61
  query_string_params = if query_string_params.any?
62
- query_string_params.to_h { |p| p.split("=", 2) }
62
+ query_string_params.to_h { |p| p.split "=", 2 }
63
63
  else
64
64
  {}
65
65
  end
@@ -21,6 +21,7 @@ require "gapic/config"
21
21
  require "gapic/config/method"
22
22
 
23
23
  require "google/cloud/service_directory/v1/version"
24
+ require "google/cloud/service_directory/v1/bindings_override"
24
25
 
25
26
  require "google/cloud/service_directory/v1/lookup_service/credentials"
26
27
  require "google/cloud/service_directory/v1/lookup_service/paths"