google-cloud-service_directory-v1 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/servicedirectory/v1/registration_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -142,7 +143,7 @@ module Google
142
143
  credentials = @config.credentials
143
144
  # Use self-signed JWT if the endpoint is unchanged from default,
144
145
  # but only if the default endpoint does not have a region prefix.
145
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
146
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
147
  !@config.endpoint.split(".").first.include?("-")
147
148
  credentials ||= Credentials.default scope: @config.scope,
148
149
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -152,6 +153,12 @@ module Google
152
153
  @quota_project_id = @config.quota_project
153
154
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
155
 
156
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
157
+ config.credentials = credentials
158
+ config.quota_project = @quota_project_id
159
+ config.endpoint = @config.endpoint
160
+ end
161
+
155
162
  @registration_service_stub = ::Gapic::ServiceStub.new(
156
163
  ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Stub,
157
164
  credentials: credentials,
@@ -161,10 +168,17 @@ module Google
161
168
  )
162
169
  end
163
170
 
171
+ ##
172
+ # Get the associated client for mix-in of the Locations.
173
+ #
174
+ # @return [Google::Cloud::Location::Locations::Client]
175
+ #
176
+ attr_reader :location_client
177
+
164
178
  # Service calls
165
179
 
166
180
  ##
167
- # Creates a namespace, and returns the new Namespace.
181
+ # Creates a namespace, and returns the new namespace.
168
182
  #
169
183
  # @overload create_namespace(request, options = nil)
170
184
  # Pass arguments to `create_namespace` via a request object, either of type
@@ -279,46 +293,52 @@ module Google
279
293
  #
280
294
  # @param parent [::String]
281
295
  # Required. The resource name of the project and location whose namespaces
282
- # we'd like to list.
296
+ # you'd like to list.
283
297
  # @param page_size [::Integer]
284
298
  # Optional. The maximum number of items to return.
285
299
  # @param page_token [::String]
286
300
  # Optional. The next_page_token value returned from a previous List request,
287
301
  # if any.
288
302
  # @param filter [::String]
289
- # Optional. The filter to list result by.
303
+ # Optional. The filter to list results by.
290
304
  #
291
- # General filter string syntax:
292
- # <field> <operator> <value> (<logical connector>)
293
- # <field> can be "name", or "labels.<key>" for map field.
294
- # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS, and
295
- # is roughly the same as "=".
296
- # <value> must be the same data type as field.
297
- # <logical connector> can be "AND, OR, NOT".
305
+ # General `filter` string syntax:
306
+ # `<field> <operator> <value> (<logical connector>)`
307
+ #
308
+ # * `<field>` can be `name` or `labels.<key>` for map field
309
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
310
+ # means `HAS`, and is roughly the same as `=`
311
+ # * `<value>` must be the same data type as field
312
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
298
313
  #
299
314
  # Examples of valid filters:
300
- # * "labels.owner" returns Namespaces that have a label with the key "owner"
301
- # this is the same as "labels:owner".
302
- # * "labels.protocol=gRPC" returns Namespaces that have key/value
303
- # "protocol=gRPC".
304
- # * "name>projects/my-project/locations/us-east/namespaces/namespace-c"
305
- # returns Namespaces that have name that is alphabetically later than the
306
- # string, so "namespace-e" will be returned but "namespace-a" will not be.
307
- # * "labels.owner!=sd AND labels.foo=bar" returns Namespaces that have
308
- # "owner" in label key but value is not "sd" AND have key/value foo=bar.
309
- # * "doesnotexist.foo=bar" returns an empty list. Note that Namespace doesn't
310
- # have a field called "doesnotexist". Since the filter does not match any
311
- # Namespaces, it returns no results.
315
+ #
316
+ # * `labels.owner` returns namespaces that have a label with the key
317
+ # `owner`, this is the same as `labels:owner`
318
+ # * `labels.owner=sd` returns namespaces that have key/value
319
+ # `owner=sd`
320
+ # * `name>projects/my-project/locations/us-east1/namespaces/namespace-c`
321
+ # returns namespaces that have name that is alphabetically later than the
322
+ # string, so "namespace-e" is returned but "namespace-a" is not
323
+ # * `labels.owner!=sd AND labels.foo=bar` returns namespaces that have
324
+ # `owner` in label key but value is not `sd` AND have key/value `foo=bar`
325
+ # * `doesnotexist.foo=bar` returns an empty list. Note that namespace
326
+ # doesn't have a field called "doesnotexist". Since the filter does not
327
+ # match any namespaces, it returns no results
328
+ #
329
+ # For more information about filtering, see
330
+ # [API Filtering](https://aip.dev/160).
312
331
  # @param order_by [::String]
313
- # Optional. The order to list result by.
332
+ # Optional. The order to list results by.
333
+ #
334
+ # General `order_by` string syntax: `<field> (<asc|desc>) (,)`
314
335
  #
315
- # General order by string syntax:
316
- # <field> (<asc|desc>) (,)
317
- # <field> allows values \\{"name"}
318
- # <asc/desc> ascending or descending order by <field>. If this is left
319
- # blank, "asc" is used.
320
- # Note that an empty order_by string result in default order, which is order
321
- # by name in ascending order.
336
+ # * `<field>` allows value: `name`
337
+ # * `<asc|desc>` ascending or descending order by `<field>`. If this is
338
+ # left blank, `asc` is used
339
+ #
340
+ # Note that an empty `order_by` string results in default order, which is
341
+ # order by `name` in ascending order.
322
342
  #
323
343
  # @yield [response, operation] Access the result along with the RPC operation
324
344
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Namespace>]
@@ -648,7 +668,7 @@ module Google
648
668
  end
649
669
 
650
670
  ##
651
- # Creates a service, and returns the new Service.
671
+ # Creates a service, and returns the new service.
652
672
  #
653
673
  # @overload create_service(request, options = nil)
654
674
  # Pass arguments to `create_service` via a request object, either of type
@@ -761,7 +781,7 @@ module Google
761
781
  # the default parameter values, pass an empty Hash as a request object (see above).
762
782
  #
763
783
  # @param parent [::String]
764
- # Required. The resource name of the namespace whose services we'd
784
+ # Required. The resource name of the namespace whose services you'd
765
785
  # like to list.
766
786
  # @param page_size [::Integer]
767
787
  # Optional. The maximum number of items to return.
@@ -769,31 +789,47 @@ module Google
769
789
  # Optional. The next_page_token value returned from a previous List request,
770
790
  # if any.
771
791
  # @param filter [::String]
772
- # Optional. The filter to list result by.
792
+ # Optional. The filter to list results by.
793
+ #
794
+ # General `filter` string syntax:
795
+ # `<field> <operator> <value> (<logical connector>)`
773
796
  #
774
- # General filter string syntax:
775
- # <field> <operator> <value> (<logical connector>)
776
- # <field> can be "name", or "metadata.<key>" for map field.
777
- # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS, and
778
- # is roughly the same as "=".
779
- # <value> must be the same data type as field.
780
- # <logical connector> can be "AND, OR, NOT".
797
+ # * `<field>` can be `name` or `annotations.<key>` for map field
798
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
799
+ # means `HAS`, and is roughly the same as `=`
800
+ # * `<value>` must be the same data type as field
801
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
781
802
  #
782
803
  # Examples of valid filters:
783
- # * "metadata.owner" returns Services that have a label with the key "owner"
784
- # this is the same as "metadata:owner".
785
- # * "metadata.protocol=gRPC" returns Services that have key/value
786
- # "protocol=gRPC".
787
- # * "name>projects/my-project/locations/us-east/namespaces/my-namespace/services/service-c"
788
- # returns Services that have name that is alphabetically later than the
789
- # string, so "service-e" will be returned but "service-a" will not be.
790
- # * "metadata.owner!=sd AND metadata.foo=bar" returns Services that have
791
- # "owner" in label key but value is not "sd" AND have key/value foo=bar.
792
- # * "doesnotexist.foo=bar" returns an empty list. Note that Service doesn't
793
- # have a field called "doesnotexist". Since the filter does not match any
794
- # Services, it returns no results.
804
+ #
805
+ # * `annotations.owner` returns services that have a annotation with the
806
+ # key `owner`, this is the same as `annotations:owner`
807
+ # * `annotations.protocol=gRPC` returns services that have key/value
808
+ # `protocol=gRPC`
809
+ # *
810
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/service-c`
811
+ # returns services that have name that is alphabetically later than the
812
+ # string, so "service-e" is returned but "service-a" is not
813
+ # * `annotations.owner!=sd AND annotations.foo=bar` returns services that
814
+ # have `owner` in annotation key but value is not `sd` AND have
815
+ # key/value `foo=bar`
816
+ # * `doesnotexist.foo=bar` returns an empty list. Note that service
817
+ # doesn't have a field called "doesnotexist". Since the filter does not
818
+ # match any services, it returns no results
819
+ #
820
+ # For more information about filtering, see
821
+ # [API Filtering](https://aip.dev/160).
795
822
  # @param order_by [::String]
796
- # Optional. The order to list result by.
823
+ # Optional. The order to list results by.
824
+ #
825
+ # General `order_by` string syntax: `<field> (<asc|desc>) (,)`
826
+ #
827
+ # * `<field>` allows value: `name`
828
+ # * `<asc|desc>` ascending or descending order by `<field>`. If this is
829
+ # left blank, `asc` is used
830
+ #
831
+ # Note that an empty `order_by` string results in default order, which is
832
+ # order by `name` in ascending order.
797
833
  #
798
834
  # @yield [response, operation] Access the result along with the RPC operation
799
835
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Service>]
@@ -1123,7 +1159,7 @@ module Google
1123
1159
  end
1124
1160
 
1125
1161
  ##
1126
- # Creates a endpoint, and returns the new Endpoint.
1162
+ # Creates an endpoint, and returns the new endpoint.
1127
1163
  #
1128
1164
  # @overload create_endpoint(request, options = nil)
1129
1165
  # Pass arguments to `create_endpoint` via a request object, either of type
@@ -1236,7 +1272,7 @@ module Google
1236
1272
  # the default parameter values, pass an empty Hash as a request object (see above).
1237
1273
  #
1238
1274
  # @param parent [::String]
1239
- # Required. The resource name of the service whose endpoints we'd like to
1275
+ # Required. The resource name of the service whose endpoints you'd like to
1240
1276
  # list.
1241
1277
  # @param page_size [::Integer]
1242
1278
  # Optional. The maximum number of items to return.
@@ -1244,33 +1280,50 @@ module Google
1244
1280
  # Optional. The next_page_token value returned from a previous List request,
1245
1281
  # if any.
1246
1282
  # @param filter [::String]
1247
- # Optional. The filter to list result by.
1283
+ # Optional. The filter to list results by.
1284
+ #
1285
+ # General `filter` string syntax:
1286
+ # `<field> <operator> <value> (<logical connector>)`
1248
1287
  #
1249
- # General filter string syntax:
1250
- # <field> <operator> <value> (<logical connector>)
1251
- # <field> can be "name", "address", "port" or "metadata.<key>" for map field.
1252
- # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS, and
1253
- # is roughly the same as "=".
1254
- # <value> must be the same data type as field.
1255
- # <logical connector> can be "AND, OR, NOT".
1288
+ # * `<field>` can be `name`, `address`, `port`, or `annotations.<key>` for
1289
+ # map field
1290
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
1291
+ # means `HAS`, and is roughly the same as `=`
1292
+ # * `<value>` must be the same data type as field
1293
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
1256
1294
  #
1257
1295
  # Examples of valid filters:
1258
- # * "metadata.owner" returns Endpoints that have a label with the key "owner"
1259
- # this is the same as "metadata:owner".
1260
- # * "metadata.protocol=gRPC" returns Endpoints that have key/value
1261
- # "protocol=gRPC".
1262
- # * "address=192.108.1.105" returns Endpoints that have this address.
1263
- # * "port>8080" returns Endpoints that have port number larger than 8080.
1264
- # * "name>projects/my-project/locations/us-east/namespaces/my-namespace/services/my-service/endpoints/endpoint-c"
1265
- # returns Endpoints that have name that is alphabetically later than the
1266
- # string, so "endpoint-e" will be returned but "endpoint-a" will not be.
1267
- # * "metadata.owner!=sd AND metadata.foo=bar" returns Endpoints that have
1268
- # "owner" in label key but value is not "sd" AND have key/value foo=bar.
1269
- # * "doesnotexist.foo=bar" returns an empty list. Note that Endpoint doesn't
1270
- # have a field called "doesnotexist". Since the filter does not match any
1271
- # Endpoints, it returns no results.
1296
+ #
1297
+ # * `annotations.owner` returns endpoints that have a annotation with the
1298
+ # key `owner`, this is the same as `annotations:owner`
1299
+ # * `annotations.protocol=gRPC` returns endpoints that have key/value
1300
+ # `protocol=gRPC`
1301
+ # * `address=192.108.1.105` returns endpoints that have this address
1302
+ # * `port>8080` returns endpoints that have port number larger than 8080
1303
+ # *
1304
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
1305
+ # returns endpoints that have name that is alphabetically later than the
1306
+ # string, so "endpoint-e" is returned but "endpoint-a" is not
1307
+ # * `annotations.owner!=sd AND annotations.foo=bar` returns endpoints that
1308
+ # have `owner` in annotation key but value is not `sd` AND have
1309
+ # key/value `foo=bar`
1310
+ # * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
1311
+ # doesn't have a field called "doesnotexist". Since the filter does not
1312
+ # match any endpoints, it returns no results
1313
+ #
1314
+ # For more information about filtering, see
1315
+ # [API Filtering](https://aip.dev/160).
1272
1316
  # @param order_by [::String]
1273
- # Optional. The order to list result by.
1317
+ # Optional. The order to list results by.
1318
+ #
1319
+ # General `order_by` string syntax: `<field> (<asc|desc>) (,)`
1320
+ #
1321
+ # * `<field>` allows values: `name`, `address`, `port`
1322
+ # * `<asc|desc>` ascending or descending order by `<field>`. If this is
1323
+ # left blank, `asc` is used
1324
+ #
1325
+ # Note that an empty `order_by` string results in default order, which is
1326
+ # order by `name` in ascending order.
1274
1327
  #
1275
1328
  # @yield [response, operation] Access the result along with the RPC operation
1276
1329
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Endpoint>]
@@ -1342,7 +1395,7 @@ module Google
1342
1395
  end
1343
1396
 
1344
1397
  ##
1345
- # Gets a endpoint.
1398
+ # Gets an endpoint.
1346
1399
  #
1347
1400
  # @overload get_endpoint(request, options = nil)
1348
1401
  # Pass arguments to `get_endpoint` via a request object, either of type
@@ -1427,7 +1480,7 @@ module Google
1427
1480
  end
1428
1481
 
1429
1482
  ##
1430
- # Updates a endpoint.
1483
+ # Updates an endpoint.
1431
1484
  #
1432
1485
  # @overload update_endpoint(request, options = nil)
1433
1486
  # Pass arguments to `update_endpoint` via a request object, either of type
@@ -1514,7 +1567,7 @@ module Google
1514
1567
  end
1515
1568
 
1516
1569
  ##
1517
- # Deletes a endpoint.
1570
+ # Deletes an endpoint.
1518
1571
  #
1519
1572
  # @overload delete_endpoint(request, options = nil)
1520
1573
  # Pass arguments to `delete_endpoint` via a request object, either of type
@@ -1957,7 +2010,9 @@ module Google
1957
2010
  class Configuration
1958
2011
  extend ::Gapic::Config
1959
2012
 
1960
- config_attr :endpoint, "servicedirectory.googleapis.com", ::String
2013
+ DEFAULT_ENDPOINT = "servicedirectory.googleapis.com"
2014
+
2015
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1961
2016
  config_attr :credentials, nil do |value|
1962
2017
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1963
2018
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -83,6 +83,23 @@ module Google
83
83
  "projects/#{project}/locations/#{location}/namespaces/#{namespace}"
84
84
  end
85
85
 
86
+ ##
87
+ # Create a fully-qualified Network resource string.
88
+ #
89
+ # The resource will be in the following format:
90
+ #
91
+ # `projects/{project}/locations/global/networks/{network}`
92
+ #
93
+ # @param project [String]
94
+ # @param network [String]
95
+ #
96
+ # @return [::String]
97
+ def network_path project:, network:
98
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
99
+
100
+ "projects/#{project}/locations/global/networks/#{network}"
101
+ end
102
+
86
103
  ##
87
104
  # Create a fully-qualified Service resource string.
88
105
  #