github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadget-service/api/api.proto (about) 1 // Copyright 2019-2023 The Inspektor Gadget authors 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 15 syntax = "proto3"; 16 17 option go_package = "github.com/inspektor-gadget/inspektor-gadget/pkg/gadget-service/api"; 18 19 package api; 20 21 message BuiltInGadgetRunRequest { 22 // name of the gadget as returned by gadgetDesc.Name() 23 string gadgetName = 1; 24 25 // category of the gadget as returned by gadgetDesc.Category() 26 string gadgetCategory = 2; 27 28 // params is a combined map of all params a gadget could need (including those 29 // of runtime and operators, which need specific prefixes, see implementation in 30 // pkg/runtime/grpc) 31 map<string, string> params = 3; 32 33 // args are all parameters which were not specified with a flag 34 repeated string args = 4; 35 36 // a list of nodes the gadget should run on; if not specified, it should run 37 // on all nodes 38 repeated string nodes = 10; 39 40 // if set to true, the gadget service should forward the request to each node 41 // from the nodes list (or each node it knows, if the list is empty) and combine 42 // their output 43 bool fanOut = 11; 44 45 // sets the requested log level (see pkg/logger/logger.go) 46 uint32 logLevel = 12; 47 48 // time that a gadget should run; use 0, if the gadget should run until it's being 49 // stopped or done; time is in nanoseconds and directly converted to time.Duration 50 int64 timeout = 13; 51 } 52 53 message GadgetRunRequest { 54 string imageName = 1; 55 56 // paramValues is a combined map of all params a gadget could need (including those 57 // of runtime and operators, which need specific prefixes, see implementation in 58 // pkg/runtime/grpc) 59 map<string, string> paramValues = 2; 60 61 // args are all parameters which were not specified with a flag 62 repeated string args = 3; 63 64 // used to inform the server about the expected protocol version 65 uint32 version = 4; 66 67 // sets the requested log level (see pkg/logger/logger.go) 68 uint32 logLevel = 12; 69 70 // time that a gadget should run; use 0, if the gadget should run until it's being 71 // stopped or done; time is in nanoseconds and directly converted to time.Duration 72 int64 timeout = 13; 73 } 74 75 message BuiltInGadgetStopRequest { 76 } 77 78 message GadgetEvent { 79 // Types are specified in consts.go. Upper 16 bits are used for log severity levels 80 uint32 type = 1; 81 uint32 seq = 2; 82 bytes payload = 3; 83 uint32 dataSourceID = 4; 84 } 85 86 message BuiltInGadgetControlRequest { 87 oneof Event { 88 BuiltInGadgetRunRequest runRequest = 1; 89 BuiltInGadgetStopRequest stopRequest = 2; 90 } 91 } 92 93 message GadgetStopRequest { 94 } 95 96 message GadgetControlRequest { 97 oneof Event { 98 GadgetRunRequest runRequest = 1; 99 GadgetStopRequest stopRequest = 2; 100 } 101 } 102 103 message InfoRequest { 104 string version = 1; 105 } 106 107 message InfoResponse { 108 string version = 1; 109 bytes catalog = 2; 110 bool experimental = 3; 111 string serverVersion = 4; 112 } 113 114 message GadgetData { 115 string node = 1; 116 uint32 seq = 2; 117 repeated bytes payload = 3; 118 } 119 120 message Param { 121 string key = 1; 122 string description = 2; 123 string defaultValue = 3; 124 string typeHint = 4; 125 string title = 5; 126 string alias = 6; 127 repeated string tags = 7; 128 string valueHint = 8; 129 repeated string possibleValues = 9; 130 bool isMandatory = 10; 131 string prefix = 11; 132 } 133 134 message GadgetInfo { 135 string name = 1; 136 string imageName = 2; 137 repeated DataSource dataSources = 4; 138 map<string, string> annotations = 5; 139 bytes metadata = 6; 140 repeated Param params = 7; 141 } 142 143 message DataSource { 144 uint32 id = 1; 145 string name = 2; 146 uint32 type = 3; 147 repeated Field fields = 4; 148 repeated string tags = 5; 149 map<string, string> annotations = 6; 150 uint32 flags = 7; 151 } 152 153 enum Kind { 154 Invalid = 0; 155 Bool = 1; 156 Int8 = 2; 157 Int16 = 3; 158 Int32 = 4; 159 Int64 = 5; 160 Uint8 = 6; 161 Uint16 = 7; 162 Uint32 = 8; 163 Uint64 = 9; 164 Float32 = 10; 165 Float64 = 11; 166 String = 12; 167 CString = 13; 168 } 169 170 message Field { 171 // name contains the plain field name 172 string name = 1; 173 174 // fullName contains a fully qualified field name 175 // e.g. when it is a sub field of another, it's called 176 // otherfieldsname.name 177 string fullName = 2; 178 179 // index holds the index to this field inside the 180 // field array of the DataSource 181 uint32 index = 3; 182 183 // payloadIndex describes in which payload this field 184 // is contained 185 uint32 payloadIndex = 4; 186 187 // offs is the offset of the fields' contents inside the 188 // payload specified by payloadIndex 189 uint32 offs = 5; 190 191 // size is (if fixed) the size of the fields' content 192 uint32 size = 6; 193 194 // flags describe different attributes of the field, like 195 // whether it has a parent, is virtual, etc. 196 uint32 flags = 7; 197 198 // kind describes how the content of the field should be 199 // handled 200 Kind kind = 8; 201 202 // tags can contain multiple tags that describe the contents 203 // of the field; they are used by operators to find 204 // interesting fields, for example 205 repeated string tags = 9; 206 207 // annotations are additional information that can be used 208 // by operators or third party consumers 209 map<string, string> annotations = 10; 210 211 // parent holds the index of the field that is considered 212 // this fields' parent; only true if the corresponding flag 213 // is set in flags 214 uint32 parent = 11; 215 216 // order determines the default position of this field when 217 // ordering multiple fields 218 int32 order = 12; 219 } 220 221 message GetGadgetInfoRequest { 222 // params are the gadget's parameters 223 map<string, string> paramValues = 1; 224 225 string imageName = 2; 226 227 // can be used to inform about the expected version of GadgetInfo 228 uint32 version = 3; 229 } 230 231 message GetGadgetInfoResponse { 232 GadgetInfo gadgetInfo = 1; 233 } 234 235 service BuiltInGadgetManager { 236 rpc GetInfo(InfoRequest) returns (InfoResponse) {} 237 rpc RunBuiltInGadget(stream BuiltInGadgetControlRequest) returns (stream GadgetEvent) {} 238 } 239 240 service GadgetManager { 241 rpc GetGadgetInfo(GetGadgetInfoRequest) returns (GetGadgetInfoResponse) {} 242 rpc RunGadget(stream GadgetControlRequest) returns (stream GadgetEvent) {} 243 }