|
| 1 | +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 2 | +// or more contributor license agreements. Licensed under the Elastic License; |
| 3 | +// you may not use this file except in compliance with the Elastic License. |
| 4 | + |
| 5 | +syntax = "proto3"; |
| 6 | + |
| 7 | +// proto namespace/package name is shared with elastic-agent-client |
| 8 | +// we need to be careful with modifications to avoid name collisions |
| 9 | +// proto is here to maintain backward compatibility and cannot be changed. |
| 10 | +// elastic-agent-client namespace is likely change after 8.6 |
| 11 | +package proto; |
| 12 | + |
| 13 | +option cc_enable_arenas = true; |
| 14 | +option go_package = "pkg/agent/control/proto;proto"; |
| 15 | + |
| 16 | +// Status codes for the current state. |
| 17 | +enum Status { |
| 18 | + V1_STARTING = 0; |
| 19 | + V1_CONFIGURING = 1; |
| 20 | + V1_HEALTHY = 2; |
| 21 | + V1_DEGRADED = 3; |
| 22 | + V1_FAILED = 4; |
| 23 | + V1_STOPPING = 5; |
| 24 | + V1_UPGRADING = 6; |
| 25 | + V1_SROLLBACK = 7; |
| 26 | +} |
| 27 | + |
| 28 | +// Action status codes for restart and upgrade response. |
| 29 | +enum ActionStatus { |
| 30 | + // Action was successful. |
| 31 | + V1_SUCCESS = 0; |
| 32 | + // Action failed. |
| 33 | + V1_FAILURE = 1; |
| 34 | +} |
| 35 | + |
| 36 | +// Empty message. |
| 37 | +message Empty { |
| 38 | +} |
| 39 | + |
| 40 | +// Version response message. |
| 41 | +message VersionResponse { |
| 42 | + // Current running version. |
| 43 | + string version = 1; |
| 44 | + // Current running commit. |
| 45 | + string commit = 2; |
| 46 | + // Current running build time. |
| 47 | + string buildTime = 3; |
| 48 | + // Current running version is a snapshot. |
| 49 | + bool snapshot = 4; |
| 50 | +} |
| 51 | + |
| 52 | +message RestartResponse { |
| 53 | + // Response status. |
| 54 | + ActionStatus status = 1; |
| 55 | + // Error message when it fails to trigger restart. |
| 56 | + string error = 2; |
| 57 | +} |
| 58 | + |
| 59 | +// Upgrade request message. |
| 60 | +message UpgradeRequest { |
| 61 | + // (Optional) Version to upgrade to. |
| 62 | + // |
| 63 | + // If not provided Elastic Agent will auto discover the latest version in the same major |
| 64 | + // to upgrade to. If wanting to upgrade to a new major that major must be present in the |
| 65 | + // this version field. |
| 66 | + string version = 1; |
| 67 | + |
| 68 | + // (Optional) Use a different source URI then configured. |
| 69 | + // |
| 70 | + // If provided the upgrade process will use the provided sourceURI instead of the configured |
| 71 | + // sourceURI in the configuration. |
| 72 | + string sourceURI = 2; |
| 73 | +} |
| 74 | + |
| 75 | +// A upgrade response message. |
| 76 | +message UpgradeResponse { |
| 77 | + // Response status. |
| 78 | + ActionStatus status = 1; |
| 79 | + |
| 80 | + // Version that is being upgraded to. |
| 81 | + string version = 2; |
| 82 | + |
| 83 | + // Error message when it fails to trigger upgrade. |
| 84 | + string error = 3; |
| 85 | +} |
| 86 | + |
| 87 | +// Current status of the application in Elastic Agent. |
| 88 | +message ApplicationStatus { |
| 89 | + // Unique application ID. |
| 90 | + string id = 1; |
| 91 | + // Application name. |
| 92 | + string name = 2; |
| 93 | + // Current status. |
| 94 | + Status status = 3; |
| 95 | + // Current status message. |
| 96 | + string message = 4; |
| 97 | + // Current status payload. |
| 98 | + string payload = 5; |
| 99 | +} |
| 100 | + |
| 101 | +// Status is the current status of Elastic Agent. |
| 102 | +message StatusResponse { |
| 103 | + // Overall status of Elastic Agent. |
| 104 | + Status status = 1; |
| 105 | + // Overall status message of Elastic Agent. |
| 106 | + string message = 2; |
| 107 | + // Status of each application in Elastic Agent. |
| 108 | + repeated ApplicationStatus applications = 3; |
| 109 | +} |
| 110 | + |
| 111 | +service ElasticAgentControl { |
| 112 | + // Fetches the currently running version of the Elastic Agent. |
| 113 | + rpc Version(Empty) returns (VersionResponse); |
| 114 | + |
| 115 | + // Fetches the currently status of the Elastic Agent. |
| 116 | + rpc Status(Empty) returns (StatusResponse); |
| 117 | + |
| 118 | + // Restart restarts the current running Elastic Agent. |
| 119 | + rpc Restart(Empty) returns (RestartResponse); |
| 120 | + |
| 121 | + // Upgrade starts the upgrade process of Elastic Agent. |
| 122 | + rpc Upgrade(UpgradeRequest) returns (UpgradeResponse); |
| 123 | +} |
0 commit comments