lookup_service.proto 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.servicedirectory.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/api/resource.proto";
  19. import "google/cloud/servicedirectory/v1beta1/service.proto";
  20. import "google/api/client.proto";
  21. option cc_enable_arenas = true;
  22. option csharp_namespace = "Google.Cloud.ServiceDirectory.V1Beta1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1;servicedirectory";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "LookupServiceProto";
  26. option java_package = "com.google.cloud.servicedirectory.v1beta1";
  27. option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1beta1";
  28. option ruby_package = "Google::Cloud::ServiceDirectory::V1beta1";
  29. // Service Directory API for looking up service data at runtime.
  30. service LookupService {
  31. option (google.api.default_host) = "servicedirectory.googleapis.com";
  32. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  33. // Returns a [service][google.cloud.servicedirectory.v1beta1.Service] and its
  34. // associated endpoints.
  35. // Resolving a service is not considered an active developer method.
  36. rpc ResolveService(ResolveServiceRequest) returns (ResolveServiceResponse) {
  37. option (google.api.http) = {
  38. post: "/v1beta1/{name=projects/*/locations/*/namespaces/*/services/*}:resolve"
  39. body: "*"
  40. };
  41. }
  42. }
  43. // The request message for [LookupService.ResolveService][google.cloud.servicedirectory.v1beta1.LookupService.ResolveService].
  44. // Looks up a service by its name, returns the service and its endpoints.
  45. message ResolveServiceRequest {
  46. // Required. The name of the service to resolve.
  47. string name = 1 [
  48. (google.api.field_behavior) = REQUIRED,
  49. (google.api.resource_reference) = {
  50. type: "servicedirectory.googleapis.com/Service"
  51. }
  52. ];
  53. // Optional. The maximum number of endpoints to return. Defaults to 25. Maximum is 100.
  54. // If a value less than one is specified, the Default is used.
  55. // If a value greater than the Maximum is specified, the Maximum is used.
  56. int32 max_endpoints = 2 [(google.api.field_behavior) = OPTIONAL];
  57. // Optional. The filter applied to the endpoints of the resolved service.
  58. //
  59. // General `filter` string syntax:
  60. // `<field> <operator> <value> (<logical connector>)`
  61. //
  62. // * `<field>` can be `name`, `address`, `port`, or `metadata.<key>` for
  63. // map field
  64. // * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
  65. // means `HAS`, and is roughly the same as `=`
  66. // * `<value>` must be the same data type as field
  67. // * `<logical connector>` can be `AND`, `OR`, `NOT`
  68. //
  69. // Examples of valid filters:
  70. //
  71. // * `metadata.owner` returns endpoints that have a annotation with the key
  72. // `owner`, this is the same as `metadata:owner`
  73. // * `metadata.protocol=gRPC` returns endpoints that have key/value
  74. // `protocol=gRPC`
  75. // * `address=192.108.1.105` returns endpoints that have this address
  76. // * `port>8080` returns endpoints that have port number larger than 8080
  77. // *
  78. // `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
  79. // returns endpoints that have name that is alphabetically later than the
  80. // string, so "endpoint-e" is returned but "endpoint-a" is not
  81. // * `metadata.owner!=sd AND metadata.foo=bar` returns endpoints that have
  82. // `owner` in annotation key but value is not `sd` AND have key/value
  83. // `foo=bar`
  84. // * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
  85. // doesn't have a field called "doesnotexist". Since the filter does not
  86. // match any endpoint, it returns no results
  87. //
  88. // For more information about filtering, see
  89. // [API Filtering](https://aip.dev/160).
  90. string endpoint_filter = 3 [(google.api.field_behavior) = OPTIONAL];
  91. }
  92. // The response message for [LookupService.ResolveService][google.cloud.servicedirectory.v1beta1.LookupService.ResolveService].
  93. message ResolveServiceResponse {
  94. Service service = 1;
  95. }