• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto3";
18
19package cuttlefish.cvd;
20
21message Status {
22  // Subset of status codes from gRPC.
23  enum Code {
24    OK = 0;
25    FAILED_PRECONDITION = 9;
26    INTERNAL = 13;
27  }
28
29  Code code = 1;
30  string message = 2;
31}
32
33message Request {
34  oneof contents {
35    // Returns the version of the CvdServer.
36    VersionRequest version_request = 1;
37    // Requests the CvdServer to shutdown.
38    ShutdownRequest shutdown_request = 2;
39    // Requests the CvdServer to execute a command on behalf of the client.
40    CommandRequest command_request = 3;
41  }
42}
43
44message Response {
45  Status status = 1;
46  oneof contents {
47    VersionResponse version_response = 2;
48    ShutdownResponse shutdown_response = 3;
49    CommandResponse command_response = 4;
50  }
51}
52
53message Version {
54  int32 major = 1;
55  int32 minor = 2;
56  string build = 3;
57  uint32 crc32 = 4;
58}
59
60message VersionRequest {}
61message VersionResponse {
62  Version version = 1;
63}
64
65message ShutdownRequest {
66  // If true, clears instance and assembly state before shutting down.
67  bool clear = 1;
68}
69message ShutdownResponse {}
70
71enum WaitBehavior {
72  WAIT_BEHAVIOR_UNKNOWN = 0;
73  WAIT_BEHAVIOR_START = 1;
74  WAIT_BEHAVIOR_COMPLETE = 2;
75}
76
77message CommandRequest {
78  // The args that should be executed, including the subcommand.
79  repeated string args = 1;
80  // Environment variables that will be used by the subcommand.
81  map<string, string> env = 2;
82  string working_directory = 3;
83  WaitBehavior wait_behavior = 4;
84}
85message CommandResponse {}
86