xref: /aosp_15_r20/external/googleapis/google/cloud/servicedirectory/v1/lookup_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.servicedirectory.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/servicedirectory/v1/service.proto";
24
25option cc_enable_arenas = true;
26option csharp_namespace = "Google.Cloud.ServiceDirectory.V1";
27option go_package = "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb;servicedirectorypb";
28option java_multiple_files = true;
29option java_outer_classname = "LookupServiceProto";
30option java_package = "com.google.cloud.servicedirectory.v1";
31option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1";
32option ruby_package = "Google::Cloud::ServiceDirectory::V1";
33
34// Service Directory API for looking up service data at runtime.
35service LookupService {
36  option (google.api.default_host) = "servicedirectory.googleapis.com";
37  option (google.api.oauth_scopes) =
38      "https://www.googleapis.com/auth/cloud-platform";
39
40  // Returns a [service][google.cloud.servicedirectory.v1.Service] and its
41  // associated endpoints.
42  // Resolving a service is not considered an active developer method.
43  rpc ResolveService(ResolveServiceRequest) returns (ResolveServiceResponse) {
44    option (google.api.http) = {
45      post: "/v1/{name=projects/*/locations/*/namespaces/*/services/*}:resolve"
46      body: "*"
47    };
48  }
49}
50
51// The request message for
52// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService].
53// Looks up a service by its name, returns the service and its endpoints.
54message ResolveServiceRequest {
55  // Required. The name of the service to resolve.
56  string name = 1 [
57    (google.api.field_behavior) = REQUIRED,
58    (google.api.resource_reference) = {
59      type: "servicedirectory.googleapis.com/Service"
60    }
61  ];
62
63  // Optional. The maximum number of endpoints to return. Defaults to 25.
64  // Maximum is 100. If a value less than one is specified, the Default is used.
65  // If a value greater than the Maximum is specified, the Maximum is used.
66  int32 max_endpoints = 2 [(google.api.field_behavior) = OPTIONAL];
67
68  // Optional. The filter applied to the endpoints of the resolved service.
69  //
70  // General `filter` string syntax:
71  // `<field> <operator> <value> (<logical connector>)`
72  //
73  // *   `<field>` can be `name`, `address`, `port`, or `annotations.<key>` for
74  //     map field
75  // *   `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
76  //     means `HAS`, and is roughly the same as `=`
77  // *   `<value>` must be the same data type as field
78  // *   `<logical connector>` can be `AND`, `OR`, `NOT`
79  //
80  // Examples of valid filters:
81  //
82  // *   `annotations.owner` returns endpoints that have a annotation with the
83  //     key `owner`, this is the same as `annotations:owner`
84  // *   `annotations.protocol=gRPC` returns endpoints that have key/value
85  //     `protocol=gRPC`
86  // *   `address=192.108.1.105` returns endpoints that have this address
87  // *   `port>8080` returns endpoints that have port number larger than 8080
88  // *
89  // `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
90  //     returns endpoints that have name that is alphabetically later than the
91  //     string, so "endpoint-e" is returned but "endpoint-a" is not
92  // *
93  // `name=projects/my-project/locations/us-central1/namespaces/my-namespace/services/my-service/endpoints/ep-1`
94  //      returns the endpoint that has an endpoint_id equal to `ep-1`
95  // *   `annotations.owner!=sd AND annotations.foo=bar` returns endpoints that
96  //     have `owner` in annotation key but value is not `sd` AND have
97  //     key/value `foo=bar`
98  // *   `doesnotexist.foo=bar` returns an empty list. Note that endpoint
99  //     doesn't have a field called "doesnotexist". Since the filter does not
100  //     match any endpoint, it returns no results
101  //
102  // For more information about filtering, see
103  // [API Filtering](https://aip.dev/160).
104  string endpoint_filter = 3 [(google.api.field_behavior) = OPTIONAL];
105}
106
107// The response message for
108// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService].
109message ResolveServiceResponse {
110  Service service = 1;
111}
112