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 15syntax = "proto3"; 16 17package google.cloud.apigeeconnect.v1; 18 19import "google/protobuf/duration.proto"; 20import "google/rpc/status.proto"; 21import "google/api/client.proto"; 22 23option csharp_namespace = "Google.Cloud.ApigeeConnect.V1"; 24option go_package = "cloud.google.com/go/apigeeconnect/apiv1/apigeeconnectpb;apigeeconnectpb"; 25option java_multiple_files = true; 26option java_outer_classname = "TetherProto"; 27option java_package = "com.google.cloud.apigeeconnect.v1"; 28option php_namespace = "Google\\Cloud\\ApigeeConnect\\V1"; 29option ruby_package = "Google::Cloud::ApigeeConnect::V1"; 30 31// Tether provides a way for the control plane to send HTTP API requests to 32// services in data planes that runs in a remote datacenter without 33// requiring customers to open firewalls on their runtime plane. 34service Tether { 35 option (google.api.default_host) = "apigeeconnect.googleapis.com"; 36 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; 37 38 // Egress streams egress requests and responses. Logically, this is not 39 // actually a streaming request, but uses streaming as a mechanism to flip 40 // the client-server relationship of gRPC so that the server can act as a 41 // client. 42 // The listener, the RPC server, accepts connections from the dialer, 43 // the RPC client. 44 // The listener streams http requests and the dialer streams http responses. 45 rpc Egress(stream EgressResponse) returns (stream EgressRequest) { 46 } 47} 48 49// gRPC request payload for tether. 50message EgressRequest { 51 // Unique identifier for the request. 52 string id = 1; 53 54 // Actual payload to send to agent. 55 Payload payload = 2; 56 57 // Tether Endpoint. 58 TetherEndpoint endpoint = 3; 59 60 // GCP Project. 61 // Format: `projects/{project_number}`. 62 string project = 4; 63 64 // Unique identifier for clients to trace their request/response. 65 string trace_id = 5; 66 67 // Timeout for the HTTP request. 68 google.protobuf.Duration timeout = 6; 69} 70 71// Payload for EgressRequest. 72message Payload { 73 // The kind of payload. 74 oneof kind { 75 // The HttpRequest proto. 76 HttpRequest http_request = 1; 77 78 // The information of stream. 79 StreamInfo stream_info = 2; 80 81 // The action taken by agent. 82 Action action = 3; 83 } 84} 85 86// The Information of bi-directional stream. 87message StreamInfo { 88 // Unique identifier for the stream. 89 string id = 1; 90} 91 92// The action taken by agent. 93enum Action { 94 // Unspecified Action. 95 ACTION_UNSPECIFIED = 0; 96 97 // Indicates that agent should open a new stream. 98 OPEN_NEW_STREAM = 1; 99} 100 101// gRPC response payload for tether. 102message EgressResponse { 103 // Unique identifier for the response. Matches the EgressRequest's id. 104 string id = 1; 105 106 // HttpResponse. 107 HttpResponse http_response = 2; 108 109 // Errors from application when handling the http request. 110 google.rpc.Status status = 3; 111 112 // GCP Project. 113 // Format: `projects/{project_number}`. 114 string project = 4; 115 116 // Unique identifier for clients to trace their request/response. Matches the 117 // EgressRequest's trace id 118 string trace_id = 5; 119 120 // Tether Endpoint. 121 TetherEndpoint endpoint = 6; 122 123 // Name is the full resource path of endpoint. 124 // Format: `projects/{project_number or project_id}/endpoints/{endpoint}` 125 string name = 7; 126} 127 128// Endpoint indicates where the messages will be delivered. 129enum TetherEndpoint { 130 // Unspecified tether endpoint. 131 TETHER_ENDPOINT_UNSPECIFIED = 0; 132 133 // Apigee MART endpoint. 134 APIGEE_MART = 1; 135 136 // Apigee Runtime endpoint. 137 APIGEE_RUNTIME = 2; 138 139 // Apigee Mint Rating endpoint. 140 APIGEE_MINT_RATING = 3; 141} 142 143// HTTP Scheme. 144enum Scheme { 145 // Unspecified scheme. 146 SCHEME_UNSPECIFIED = 0; 147 148 // HTTPS protocol. 149 HTTPS = 1; 150} 151 152// The proto definition of http request. 153message HttpRequest { 154 // A unique identifier for the request. 155 string id = 1; 156 157 // The HTTP request method. 158 // Valid methods: "GET", "HEAD", "POST", "PUT", "PATCH","DELETE". 159 string method = 2; 160 161 // The HTTP request URL. 162 Url url = 3; 163 164 // The HTTP request headers. 165 repeated Header headers = 4; 166 167 // HTTP request body. 168 bytes body = 5; 169} 170 171// The proto definition of url. 172// A url represents a URL and the general form represented is: 173// 174// `[scheme://][google.cloud.apigeeconnect.v1.Url.host][path]` 175message Url { 176 // Scheme. 177 Scheme scheme = 1; 178 179 // Host or Host:Port. 180 string host = 2; 181 182 // Path starts with `/`. 183 string path = 3; 184} 185 186// The http headers. 187message Header { 188 string key = 1; 189 190 repeated string values = 2; 191} 192 193// The proto definition of http response. 194message HttpResponse { 195 // A unique identifier that matches the request ID. 196 string id = 1; 197 198 // Status of http response, e.g. "200 OK". 199 string status = 2; 200 201 // Status code of http response, e.g. 200. 202 int32 status_code = 3; 203 204 // The HTTP 1.1 response body. 205 bytes body = 4; 206 207 // The HTTP response headers. 208 repeated Header headers = 5; 209 210 // Content length records the length of the associated content. The 211 // value -1 indicates that the length is unknown. Unless http method 212 // is "HEAD", values >= 0 indicate that the given number of bytes may 213 // be read from Body. 214 int64 content_length = 6; 215} 216