110 lines
2.6 KiB
Protocol Buffer
110 lines
2.6 KiB
Protocol Buffer
|
|
/*
|
||
|
|
* Copyright (C) 2021 The Android Open Source Project
|
||
|
|
*
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
|
||
|
|
syntax = "proto3";
|
||
|
|
|
||
|
|
package cuttlefish.cvd;
|
||
|
|
|
||
|
|
message Status {
|
||
|
|
// Subset of status codes from gRPC.
|
||
|
|
enum Code {
|
||
|
|
OK = 0;
|
||
|
|
FAILED_PRECONDITION = 9;
|
||
|
|
INTERNAL = 13;
|
||
|
|
}
|
||
|
|
|
||
|
|
Code code = 1;
|
||
|
|
string message = 2;
|
||
|
|
}
|
||
|
|
|
||
|
|
message Request {
|
||
|
|
oneof contents {
|
||
|
|
// Returns the version of the CvdServer.
|
||
|
|
VersionRequest version_request = 1;
|
||
|
|
// Requests the CvdServer to shutdown.
|
||
|
|
ShutdownRequest shutdown_request = 2;
|
||
|
|
// Requests the CvdServer to execute a command on behalf of the client.
|
||
|
|
CommandRequest command_request = 3;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
message Response {
|
||
|
|
Status status = 1;
|
||
|
|
oneof contents {
|
||
|
|
VersionResponse version_response = 2;
|
||
|
|
ShutdownResponse shutdown_response = 3;
|
||
|
|
CommandResponse command_response = 4;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
message Version {
|
||
|
|
int32 major = 1;
|
||
|
|
int32 minor = 2;
|
||
|
|
string build = 3;
|
||
|
|
uint32 crc32 = 4;
|
||
|
|
}
|
||
|
|
|
||
|
|
message VersionRequest {}
|
||
|
|
message VersionResponse {
|
||
|
|
Version version = 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
message ShutdownRequest {
|
||
|
|
// If true, clears instance and assembly state before shutting down.
|
||
|
|
bool clear = 1;
|
||
|
|
}
|
||
|
|
message ShutdownResponse {}
|
||
|
|
|
||
|
|
enum WaitBehavior {
|
||
|
|
WAIT_BEHAVIOR_UNKNOWN = 0;
|
||
|
|
WAIT_BEHAVIOR_START = 1;
|
||
|
|
WAIT_BEHAVIOR_COMPLETE = 2;
|
||
|
|
}
|
||
|
|
|
||
|
|
// the arguments that are used by selector inside the server
|
||
|
|
message SelectorOption {
|
||
|
|
repeated string args = 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
message CommandRequest {
|
||
|
|
// The args that should be executed, including the subcommand.
|
||
|
|
repeated string args = 1;
|
||
|
|
// Environment variables that will be used by the subcommand.
|
||
|
|
map<string, string> env = 2;
|
||
|
|
string working_directory = 3;
|
||
|
|
WaitBehavior wait_behavior = 4;
|
||
|
|
SelectorOption selector_opts = 5;
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
* The fields are required to be filled only for a successful "cvd start" cmd
|
||
|
|
*/
|
||
|
|
message InstanceGroupInfo {
|
||
|
|
string group_name = 1;
|
||
|
|
message PerInstanceInfo {
|
||
|
|
string name = 1;
|
||
|
|
uint32 instance_id = 2;
|
||
|
|
}
|
||
|
|
repeated PerInstanceInfo instances = 2;
|
||
|
|
repeated string home_directories = 3;
|
||
|
|
}
|
||
|
|
|
||
|
|
message CommandResponse {
|
||
|
|
oneof response_report {
|
||
|
|
InstanceGroupInfo instance_group_info = 1;
|
||
|
|
}
|
||
|
|
}
|