github.com/Kong/go-pdk@v0.11.0/server/kong_plugin_protocol/pluginsocket.proto (about) 1 syntax = "proto3"; 2 package kong_plugin_protocol; 3 option go_package = "./kong_plugin_protocol"; 4 5 import "google/protobuf/descriptor.proto"; 6 import "google/protobuf/empty.proto"; 7 import "google/protobuf/struct.proto"; 8 9 // RPC 10 11 message CmdGetPluginNames {} 12 13 message CmdGetPluginInfo { 14 string name = 1; 15 } 16 17 message CmdStartInstance { 18 string name = 1; 19 bytes config = 2; 20 } 21 22 message CmdGetInstanceStatus { 23 int32 instance_id = 1; 24 } 25 26 message CmdCloseInstance { 27 int32 instance_id = 1; 28 } 29 30 message CmdHandleEvent { 31 int32 instance_id = 1; 32 string event_name = 2; 33 } 34 35 message RpcCall { 36 int64 sequence = 1; 37 oneof call { 38 CmdGetPluginNames cmd_get_plugin_names = 31; 39 CmdGetPluginInfo cmd_get_plugin_info = 32; 40 CmdStartInstance cmd_start_instance = 33; 41 CmdGetInstanceStatus cmd_get_instance_status = 34; 42 CmdCloseInstance cmd_close_instance = 35; 43 CmdHandleEvent cmd_handle_event = 36; 44 }; 45 } 46 47 message PluginNames { 48 repeated string names = 1; 49 } 50 51 message PluginInfo { 52 string name = 1; 53 int64 updated_at = 2; 54 int64 loaded_at = 3; 55 repeated string phases = 4; 56 string version = 5; 57 int32 priority = 6; 58 string schema = 7; 59 } 60 61 message InstanceStatus { 62 string name = 1; 63 int32 instance_id = 2; 64 google.protobuf.Value config = 3; 65 int64 started_at = 4; 66 } 67 68 message RpcReturn { 69 int64 sequence = 1; 70 oneof return { 71 PluginNames plugin_names = 31; 72 PluginInfo plugin_info = 32; 73 InstanceStatus instance_status = 33; 74 } 75 } 76 77 // PDK 78 79 //message Empty {} 80 81 message KV { 82 string k = 1; 83 google.protobuf.Value v = 2; 84 } 85 86 message Bool { 87 bool v = 1; 88 } 89 90 message Int { 91 int32 v = 1; 92 } 93 94 message Number { 95 double v = 1; 96 } 97 98 message String { 99 string v = 1; 100 } 101 102 message ByteString { 103 bytes v = 1; 104 } 105 106 message ExitArgs { 107 int32 status = 1; 108 bytes body = 2; 109 google.protobuf.Struct headers = 3; 110 } 111 112 message ServiceKey { 113 string id = 1; 114 } 115 116 message CertificateKey { 117 string id = 1; 118 } 119 120 message RawBodyResult { 121 oneof kind { 122 bytes content = 1; 123 string body_filepath = 2; 124 string error = 3; 125 } 126 } 127 128 message UriCapturesResult { 129 // array part 130 repeated bytes unnamed = 1; 131 // map part, named captures 132 map<string, bytes> named = 2; 133 } 134 135 message Route { 136 string id = 1; 137 int64 created_at = 2; 138 int64 updated_at = 3; 139 string name = 4; 140 repeated string protocols = 5; 141 repeated string methods = 6; 142 repeated string hosts = 7; 143 repeated string paths = 8; 144 repeated string headers = 9; 145 int32 https_redirect_status_code = 10; 146 int32 regex_priority = 11; 147 bool strip_path = 12; 148 bool preserve_host = 13; 149 repeated string snis = 14; 150 repeated string sources = 15; 151 repeated string destinations = 16; 152 repeated string tags = 17; 153 ServiceKey service = 18; 154 } 155 156 message Service { 157 string id = 1; 158 int64 created_at = 2; 159 int64 updated_at = 3; 160 string name = 4; 161 int32 retries = 5; 162 string protocol = 6; 163 string host = 7; 164 int32 port = 8; 165 string path = 9; 166 int32 connect_timeout = 10; 167 int32 write_timeout = 11; 168 int32 read_timeout = 12; 169 repeated string tags = 13; 170 CertificateKey client_certificate = 14; 171 } 172 173 message Target { 174 string host = 1; 175 int32 port = 2; 176 } 177 178 message ConsumerSpec { 179 string id = 1; 180 bool by_username = 2; 181 } 182 183 message Consumer { 184 string id = 1; 185 int64 created_at = 2; 186 string username = 3; 187 string custom_id = 4; 188 repeated string tags = 5; 189 } 190 191 message AuthenticatedCredential { 192 string id = 1; 193 string consumer_id = 2; 194 } 195 196 message AuthenticateArgs { 197 Consumer consumer = 1; 198 AuthenticatedCredential credential = 2; 199 } 200 201 message MemoryStats { 202 message LuaSharedDicts { 203 message DictStats { 204 int64 allocated_slabs = 1; 205 int64 capacity = 2; 206 } 207 DictStats kong = 1; 208 DictStats kong_db_cache = 2; 209 } 210 message WorkerLuaVm { 211 int64 http_allocated_gc = 1; 212 int64 pid = 2; 213 } 214 LuaSharedDicts lua_shared_dicts = 1; 215 repeated WorkerLuaVm workers_lua_vms = 2; 216 } 217 218 message StringMap { 219 map<string, string> m = 1; 220 } 221 222 message PdkArg { 223 oneof data { 224 bool b = 31; 225 int64 i = 32; 226 double f = 33; 227 string s = 34; 228 StringMap m = 35; 229 230 string error = 36; 231 232 AuthenticatedCredential credential = 40; 233 Route route = 41; 234 Service service = 42; 235 Consumer consumer = 43; 236 MemoryStats memory_stats = 44; 237 } 238 } 239 240 241 message PdkCall { 242 int64 sequence = 1; 243 int64 event_id = 2; 244 string cmd = 3; 245 246 repeated PdkArg args = 31; 247 } 248 249 message PdkReturn { 250 int64 sequence = 1; 251 int64 event_id = 2; 252 string cmd = 3; 253 254 PdkArg arg = 31; 255 } 256 257 258 extend google.protobuf.MethodOptions { 259 string MethodName = 50007; 260 } 261 262 263 service Kong { 264 rpc Client_GetIp(google.protobuf.Empty) returns (String); 265 rpc Client_GetForwardedIp(google.protobuf.Empty) returns (String); 266 rpc Client_GetPort(google.protobuf.Empty) returns (Int); 267 rpc Client_GetForwardedPort(google.protobuf.Empty) returns (Int); 268 rpc Client_GetCredential(google.protobuf.Empty) returns (AuthenticatedCredential); 269 rpc Client_LoadConsumer(ConsumerSpec) returns (Consumer); 270 rpc Client_GetConsumer(google.protobuf.Empty) returns (Consumer); 271 rpc Client_Authenticate(AuthenticateArgs) returns (google.protobuf.Empty); 272 rpc Client_GetProtocol(Bool) returns (String); 273 274 rpc Ctx_SetShared(KV) returns (google.protobuf.Empty) { option (MethodName) = "kong.ctx.shared.set"; }; 275 rpc Ctx_GetShared(String) returns (google.protobuf.Value) { option (MethodName) = "kong.ctx.shared.get"; }; 276 277 rpc Ip_IsTrusted(String) returns (Bool); 278 279 rpc Log_Alert(google.protobuf.ListValue) returns (google.protobuf.Empty); 280 rpc Log_Crit(google.protobuf.ListValue) returns (google.protobuf.Empty); 281 rpc Log_Err(google.protobuf.ListValue) returns (google.protobuf.Empty); 282 rpc Log_Warn(google.protobuf.ListValue) returns (google.protobuf.Empty); 283 rpc Log_Notice(google.protobuf.ListValue) returns (google.protobuf.Empty); 284 rpc Log_Info(google.protobuf.ListValue) returns (google.protobuf.Empty); 285 rpc Log_Debug(google.protobuf.ListValue) returns (google.protobuf.Empty); 286 rpc Log_SetSerializeValue(KV) returns (google.protobuf.Empty); 287 rpc Log_Serialize(google.protobuf.Empty) returns (String); 288 289 rpc Nginx_GetVar(String) returns (String); 290 rpc Nginx_GetTls1VersionStr(google.protobuf.Empty) returns (String); 291 rpc Nginx_SetCtx(KV) returns (String); 292 rpc Nginx_GetCtx(String) returns (google.protobuf.Value); 293 rpc Nginx_ReqStartTime(google.protobuf.Empty) returns (Number); 294 rpc Nginx_GetSubsystem(google.protobuf.Empty) returns (String); 295 296 rpc Node_GetId(google.protobuf.Empty) returns (String); 297 rpc Node_GetMemoryStats(google.protobuf.Empty) returns (MemoryStats); 298 299 rpc Request_GetScheme(google.protobuf.Empty) returns (String); 300 rpc Request_GetHost(google.protobuf.Empty) returns (String); 301 rpc Request_GetPort(google.protobuf.Empty) returns (Int); 302 rpc Request_GetForwardedScheme(google.protobuf.Empty) returns (String); 303 rpc Request_GetForwardedHost(google.protobuf.Empty) returns (String); 304 rpc Request_GetForwardedPort(google.protobuf.Empty) returns (Int); 305 rpc Request_GetHttpVersion(google.protobuf.Empty) returns (Number); 306 rpc Request_GetMethod(google.protobuf.Empty) returns (String); 307 rpc Request_GetPath(google.protobuf.Empty) returns (String); 308 rpc Request_GetPathWithQuery(google.protobuf.Empty) returns (String); 309 rpc Request_GetRawQuery(google.protobuf.Empty) returns (String); 310 rpc Request_GetQueryArg(String) returns (String); 311 rpc Request_GetQuery(Int) returns (google.protobuf.Struct); 312 rpc Request_GetHeader(String) returns (String); 313 rpc Request_GetHeaders(Int) returns (google.protobuf.Struct); 314 rpc Request_GetRawBody(google.protobuf.Empty) returns (RawBodyResult); 315 rpc Request_GetUriCaptures(google.protobuf.Empty) returns (UriCapturesResult); 316 317 rpc Response_GetStatus(google.protobuf.Empty) returns (Int); 318 rpc Response_GetHeader(String) returns (String); 319 rpc Response_GetHeaders(Int) returns (google.protobuf.Struct); 320 rpc Response_GetSource(google.protobuf.Empty) returns (String); 321 rpc Response_SetStatus(Int) returns (google.protobuf.Empty); 322 rpc Response_SetHeader(KV) returns (google.protobuf.Empty); 323 rpc Response_AddHeader(KV) returns (google.protobuf.Empty); 324 rpc Response_ClearHeader(String) returns (google.protobuf.Empty); 325 rpc Response_SetHeaders(google.protobuf.Struct) returns (google.protobuf.Empty); 326 rpc Response_Exit(ExitArgs) returns (google.protobuf.Empty); 327 328 rpc Router_GetRoute(google.protobuf.Empty) returns (Route); 329 rpc Router_GetService(google.protobuf.Empty) returns (Service); 330 331 rpc Service_SetUpstream(String) returns (Bool); 332 rpc Service_SetTarget(Target) returns (google.protobuf.Empty); 333 334 rpc Service_Request_SetScheme(String) returns (google.protobuf.Empty); 335 rpc Service_Request_SetPath(String) returns (google.protobuf.Empty); 336 rpc Service_Request_SetRawQuery(String) returns (google.protobuf.Empty); 337 rpc Service_Request_SetMethod(String) returns (google.protobuf.Empty); 338 rpc Service_Request_SetQuery(google.protobuf.Struct) returns (google.protobuf.Empty); 339 rpc Service_Request_SetHeader(KV) returns (google.protobuf.Empty); 340 rpc Service_Request_AddHeader(KV) returns (google.protobuf.Empty); 341 rpc Service_Request_ClearHeader(String) returns (google.protobuf.Empty); 342 rpc Service_Request_SetHeaders(google.protobuf.Struct) returns (google.protobuf.Empty); 343 rpc Service_Request_SetRawBody(ByteString) returns (google.protobuf.Empty); 344 345 rpc Service_Response_GetStatus(google.protobuf.Empty) returns (Int); 346 rpc Service_Response_GetHeader(String) returns (String); 347 rpc Service_Response_GetHeaders(Int) returns (google.protobuf.Struct); 348 rpc Service_Response_GetRawBody(google.protobuf.Empty) returns (ByteString); 349 }