github.com/cloudwan/edgelq-sdk@v1.15.4/devices/proto/v1alpha2/broker_custom.proto (about) 1 syntax = "proto3"; 2 3 package ntt.devices.v1alpha2; 4 5 import "edgelq-sdk/devices/proto/v1alpha2/device.proto"; 6 import "edgelq-sdk/devices/proto/v1alpha2/device_change.proto"; 7 8 option go_package = "github.com/cloudwan/edgelq-sdk/devices/client/v1alpha2/broker;broker_client"; 9 option java_multiple_files = false; 10 option java_outer_classname = "BrokerCustomProto"; 11 option java_package = "com.ntt.devices.pb.v1alpha2"; 12 13 // Request message for method 14 // [ListenForConnections][ntt.devices.v1alpha2.ListenForConnections] Registers a 15 // new session listener (agent) to the endpoint. This method is used by agents 16 // on the device and not meant for use of users. 17 message ListenForConnectionsRequest { 18 oneof msg { 19 // This is a hello message from the agent with its name. 20 RegisterListener register_listener = 1; 21 22 // When the agent failed to open a requested channel, this message will be 23 // sent from the agent to the endpoint. 24 ChannelOpenError channel_open_error = 2; 25 26 // KeepAlive. 27 KeepAlive keep_alive = 3; 28 } 29 30 message RegisterListener { 31 // The self-declared device name, used for authentication/authorization. 32 string device = 1; 33 } 34 35 message ChannelOpenError { 36 // ID of the channel failed to open. 37 string channel = 1; 38 39 // Error message. 40 string message = 2; 41 } 42 43 message KeepAlive {} 44 } 45 46 // Response message for method 47 // [ListenForConnections][ntt.devices.v1alpha2.ListenForConnections] Responses 48 // from the endpoint to session agents. 49 message ListenForConnectionsResponse { 50 oneof msg { 51 // Notifies a new channel has been requested by a client. 52 ChannelRequested channel_requested = 1; 53 54 // Keepalive 55 KeepAlive keep_alive = 2; 56 } 57 58 message ChannelRequested { 59 // Channel ID 60 string channel = 1; 61 62 // Device service; 63 BrokerServiceType service = 2; 64 65 // Initial argument (optional) 66 string arg = 3; 67 } 68 69 message KeepAlive {} 70 } 71 72 // Request message for method 73 // [OpenConnectionChannelSocket][ntt.devices.v1alpha2.OpenConnectionChannelSocket] 74 // Opens a new socket for a session by agent at an endpoint. This session is 75 // usually initiated by the agent who received a `ChannelRequested` message on a 76 // ListenForConnection session. The session is used for data plane to transfer 77 // data for a channel between the endpoint and the agent. 78 message OpenConnectionChannelSocketRequest { 79 oneof msg { 80 // Registers a new socket on the endpoint. 81 RegisterSocket register_socket = 1; 82 83 // Data from the agent to the endpoint (client). 84 bytes data = 3; 85 86 // Error from the agent to the endpoint (client). 87 bytes error = 4; 88 89 // Ack from the agent to the endpoint (client) 90 Ack ack = 5; 91 } 92 93 message RegisterSocket { 94 // Device name, to be authenticated/authorized. 95 string device = 1; 96 97 // Channel ID, requested by the endpoint in the ChannelRequested message. 98 string channel = 2; 99 } 100 } 101 102 // Response message for method 103 // [OpenConnectionChannelSocket][ntt.devices.v1alpha2.OpenConnectionChannelSocket] 104 message OpenConnectionChannelSocketResponse { 105 oneof msg { 106 // Data from the endpoint (client) to the agent. 107 bytes data = 1; 108 109 // Ack from the client to the endpoint (device) 110 Ack ack = 2; 111 } 112 } 113 114 // Request message for method 115 // [ConnectToDevice][ntt.devices.v1alpha2.ConnectToDevice] ConnectToDevice 116 // connects a local service provided by a Device. 117 message ConnectToDeviceRequest { 118 oneof msg { 119 // The initiation message to open a channel to a device. 120 OpenRequest open_request = 1; 121 122 // Any data sent to the device through the endpoint. 123 bytes data = 3; 124 125 // Ack from the user to the endpoint (device) 126 Ack ack = 4; 127 128 KeepAlive keep_alive = 5; 129 } 130 131 message OpenRequest { 132 // Device name to connect. 133 string device = 1; 134 135 // Device service 136 BrokerServiceType service = 2; 137 138 // Initial argument (optional) 139 string arg = 3; 140 } 141 142 message KeepAlive {} 143 } 144 145 // Response message for method 146 // [ConnectToDevice][ntt.devices.v1alpha2.ConnectToDevice] 147 message ConnectToDeviceResponse { 148 oneof msg { 149 // Notification from the agent (endpoint) to the channel has been opened. 150 OpenResponse open_response = 1; 151 152 // Any data from the device (endpoint) to the client. 153 bytes data = 3; 154 155 // Any error from the device (endpoint) to the client. 156 bytes error = 4; 157 158 // Ack from the device to the endpoint (client) 159 Ack ack = 5; 160 } 161 162 message OpenResponse {} 163 } 164 165 // Ack message that contains how much data should have been processed 166 message Ack { uint64 processed = 1; } 167 168 // Services on the device that the client connects to 169 message SSHService { 170 message Hello { 171 string user = 1; 172 173 repeated string command = 2; 174 175 // Environment (optional) 176 map<string, string> env = 3; 177 } 178 179 message TerminalSize { 180 uint32 width = 1; 181 182 uint32 height = 2; 183 } 184 185 message ClientOut { 186 oneof msg { 187 bytes data = 1; 188 189 Hello ssh_hello = 2; 190 191 TerminalSize ssh_resize_terminal = 3; 192 } 193 } 194 195 message ClientIn { 196 oneof msg { bytes data = 1; } 197 } 198 } 199 200 message SCPService { 201 oneof msg { 202 // Request to create a directory 203 CreateDirectory dir = 1; 204 205 // Request to create a file 206 CreateFile file = 2; 207 208 // Request to end SCP transfer 209 bool eot = 3; 210 211 // Request SCP configuration 212 Configure config = 4; 213 } 214 215 message Configure { 216 bool recursive = 1; 217 218 Direction direction = 2; 219 220 string path = 3; 221 222 enum Direction { 223 DOWNLOAD = 0; 224 225 UPLOAD = 1; 226 } 227 } 228 229 message CreateDirectory { 230 string path = 1; 231 232 uint32 mode = 2; 233 } 234 235 message CreateFile { 236 oneof msg { 237 // Request file initialization 238 Initialize init = 1; 239 240 // Request file data 241 bytes data = 2; 242 243 // Request to end file transfer 244 bool eof = 3; 245 } 246 247 message Initialize { 248 string path = 1; 249 250 uint32 mode = 2; 251 252 uint64 size = 3; 253 } 254 } 255 } 256 257 message LogsService { 258 // Messages sent only to a device 259 message ToDevice { 260 // Live follow the logs service 261 bool follow = 1; 262 263 // Number of lines to get from the logs service 264 uint32 lines = 2; 265 266 // Source of the logs service (e.g. docker container ID) 267 string source = 3; 268 } 269 270 // Messages sent only to a client 271 message ToClient { 272 // Logs data 273 bytes data = 1; 274 } 275 } 276 277 message PodManagementService { 278 // Pod state command 279 PodState command = 1; 280 281 // Pod to execute the command on 282 string pod = 2; 283 284 // Service (container) name to execute the command on (empty = acts on the 285 // entire pod) 286 string service = 3; 287 288 // Commands for pod state management 289 enum PodState { 290 // Unspecified pod state 291 UNSPECIFIED = 0; 292 293 // Start the pod 294 START = 1; 295 296 // Stop the pod 297 STOP = 2; 298 299 // Restart the pod 300 RESTART = 3; 301 } 302 } 303 304 message SystemStateService { 305 // Commands for system state management 306 enum SystemState { 307 // Unspecified system state 308 UNSPECIFIED = 0; 309 310 // Shutdown the system 311 SHUTDOWN = 1; 312 313 // Reboot the system 314 REBOOT = 2; 315 } 316 } 317 318 // Broker dedicated messages 319 enum BrokerServiceType { 320 // Service type not specified 321 BROKER_SERVICE_UNSPECIFIED = 0; 322 323 // SSH service 324 BROKER_SERVICE_SSH_LEGACY = 1; 325 326 BROKER_SERVICE_SSH = 3; 327 328 // TCP port forward service 329 BROKER_SERVICE_TCP_FORWARD_PORT = 2; 330 331 // Reboot service 332 BROKER_SERVICE_REBOOT = 4; 333 334 // Shutdown service 335 BROKER_SERVICE_SHUTDOWN = 5; 336 337 // SCP service 338 BROKER_SERVICE_SCP = 6; 339 340 BROKER_SERVICE_SCP_LEGACY = 7; 341 342 // System Logs service 343 BROKER_SYS_LOGS = 8; 344 345 // Application (Container) Logs service 346 BROKER_APP_LOGS = 9; 347 348 // Pod State Management service 349 BROKER_POD_MANAGEMENT = 10; 350 }