2022-01-08 17:24:02 +00:00
|
|
|
|
|
|
|
syntax = "proto3";
|
2022-01-29 23:45:42 +00:00
|
|
|
option go_package = "github.com/coder/coder/provisionersdk/proto";
|
2022-01-08 17:24:02 +00:00
|
|
|
|
|
|
|
package provisioner;
|
|
|
|
|
2022-02-28 18:40:49 +00:00
|
|
|
// Empty indicates a successful request/response.
|
|
|
|
message Empty {}
|
|
|
|
|
2022-01-29 23:45:42 +00:00
|
|
|
// ParameterSource represents the source location for a parameter to get it's value from.
|
|
|
|
message ParameterSource {
|
|
|
|
enum Scheme {
|
|
|
|
DATA = 0;
|
|
|
|
}
|
|
|
|
Scheme scheme = 1;
|
|
|
|
string value = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ParameterDestination represents the target location for a provisioner to set the value.
|
|
|
|
message ParameterDestination {
|
|
|
|
enum Scheme {
|
|
|
|
ENVIRONMENT_VARIABLE = 0;
|
|
|
|
PROVISIONER_VARIABLE = 1;
|
|
|
|
}
|
|
|
|
Scheme scheme = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ParameterValue represents the resolved source and destination of a parameter.
|
|
|
|
message ParameterValue {
|
|
|
|
ParameterDestination.Scheme destination_scheme = 1;
|
|
|
|
string name = 2;
|
|
|
|
string value = 3;
|
|
|
|
}
|
|
|
|
|
2022-01-08 17:24:02 +00:00
|
|
|
// ParameterSchema represents validation and type information for a parsed parameter.
|
|
|
|
message ParameterSchema {
|
|
|
|
string name = 1;
|
|
|
|
string description = 2;
|
2022-01-29 23:45:42 +00:00
|
|
|
ParameterSource default_source = 3;
|
|
|
|
bool allow_override_source = 4;
|
|
|
|
ParameterDestination default_destination = 5;
|
|
|
|
bool allow_override_destination = 6;
|
|
|
|
bool redisplay_value = 7;
|
2022-01-08 17:24:02 +00:00
|
|
|
|
|
|
|
enum TypeSystem {
|
2022-02-04 19:36:43 +00:00
|
|
|
None = 0;
|
|
|
|
HCL = 1;
|
2022-01-08 17:24:02 +00:00
|
|
|
}
|
2022-01-29 23:45:42 +00:00
|
|
|
TypeSystem validation_type_system = 8;
|
|
|
|
string validation_value_type = 9;
|
|
|
|
string validation_error = 10;
|
|
|
|
string validation_condition = 11;
|
2022-01-08 17:24:02 +00:00
|
|
|
}
|
|
|
|
|
2023-01-17 10:22:11 +00:00
|
|
|
// RichParameterOption represents a singular option that a parameter may expose.
|
|
|
|
message RichParameterOption {
|
|
|
|
string name = 1;
|
|
|
|
string description = 2;
|
|
|
|
string value = 3;
|
|
|
|
string icon = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// RichParameter represents a variable that is exposed.
|
|
|
|
message RichParameter {
|
|
|
|
string name = 1;
|
|
|
|
string description = 2;
|
|
|
|
string type = 3;
|
|
|
|
bool mutable = 4;
|
|
|
|
string default_value = 5;
|
|
|
|
string icon = 6;
|
|
|
|
repeated RichParameterOption options = 7;
|
|
|
|
string validation_regex = 8;
|
2023-01-24 13:22:00 +00:00
|
|
|
string validation_error = 9;
|
|
|
|
int32 validation_min = 10;
|
|
|
|
int32 validation_max = 11;
|
2023-01-17 10:22:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RichParameterValue holds the key/value mapping of a parameter.
|
|
|
|
message RichParameterValue {
|
|
|
|
string name = 1;
|
|
|
|
string value = 2;
|
|
|
|
}
|
|
|
|
|
2022-02-01 05:36:15 +00:00
|
|
|
// LogLevel represents severity of the log.
|
|
|
|
enum LogLevel {
|
|
|
|
TRACE = 0;
|
|
|
|
DEBUG = 1;
|
|
|
|
INFO = 2;
|
|
|
|
WARN = 3;
|
|
|
|
ERROR = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Log represents output from a request.
|
|
|
|
message Log {
|
|
|
|
LogLevel level = 1;
|
|
|
|
string output = 2;
|
|
|
|
}
|
|
|
|
|
2022-04-11 21:06:15 +00:00
|
|
|
message InstanceIdentityAuth {
|
2022-02-28 17:16:44 +00:00
|
|
|
string instance_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Agent represents a running agent on the workspace.
|
|
|
|
message Agent {
|
|
|
|
string id = 1;
|
2022-04-11 21:06:15 +00:00
|
|
|
string name = 2;
|
|
|
|
map<string, string> env = 3;
|
|
|
|
string startup_script = 4;
|
|
|
|
string operating_system = 5;
|
|
|
|
string architecture = 6;
|
2022-05-02 15:27:34 +00:00
|
|
|
string directory = 7;
|
2022-06-04 20:13:37 +00:00
|
|
|
repeated App apps = 8;
|
2022-02-28 17:16:44 +00:00
|
|
|
oneof auth {
|
2022-06-04 20:13:37 +00:00
|
|
|
string token = 9;
|
|
|
|
string instance_id = 10;
|
2022-02-28 17:16:44 +00:00
|
|
|
}
|
2022-11-09 15:27:05 +00:00
|
|
|
int32 connection_timeout_seconds = 11;
|
|
|
|
string troubleshooting_url = 12;
|
2022-11-24 12:22:20 +00:00
|
|
|
string motd_file = 13;
|
2023-01-27 20:07:47 +00:00
|
|
|
bool login_before_ready = 14;
|
2023-01-24 12:24:27 +00:00
|
|
|
int32 startup_script_timeout_seconds = 15;
|
2022-02-28 17:16:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-14 16:46:38 +00:00
|
|
|
enum AppSharingLevel {
|
2022-10-28 17:41:31 +00:00
|
|
|
OWNER = 0;
|
|
|
|
AUTHENTICATED = 1;
|
|
|
|
PUBLIC = 2;
|
2022-10-14 16:46:38 +00:00
|
|
|
}
|
|
|
|
|
2022-06-04 20:13:37 +00:00
|
|
|
// App represents a dev-accessible application on the workspace.
|
|
|
|
message App {
|
2022-10-28 17:41:31 +00:00
|
|
|
// slug is the unique identifier for the app, usually the name from the
|
|
|
|
// template. It must be URL-safe and hostname-safe.
|
|
|
|
string slug = 1;
|
|
|
|
string display_name = 2;
|
|
|
|
string command = 3;
|
|
|
|
string url = 4;
|
|
|
|
string icon = 5;
|
|
|
|
bool subdomain = 6;
|
|
|
|
Healthcheck healthcheck = 7;
|
|
|
|
AppSharingLevel sharing_level = 8;
|
2022-12-14 21:54:18 +00:00
|
|
|
bool external = 9;
|
2022-09-23 19:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Healthcheck represents configuration for checking for app readiness.
|
|
|
|
message Healthcheck {
|
|
|
|
string url = 1;
|
|
|
|
int32 interval = 2;
|
|
|
|
int32 threshold = 3;
|
2022-06-04 20:13:37 +00:00
|
|
|
}
|
|
|
|
|
2022-02-08 01:35:18 +00:00
|
|
|
// Resource represents created infrastructure.
|
|
|
|
message Resource {
|
|
|
|
string name = 1;
|
|
|
|
string type = 2;
|
2022-04-11 21:06:15 +00:00
|
|
|
repeated Agent agents = 3;
|
2022-08-01 21:53:05 +00:00
|
|
|
|
|
|
|
message Metadata {
|
|
|
|
string key = 1;
|
|
|
|
string value = 2;
|
|
|
|
bool sensitive = 3;
|
|
|
|
bool is_null = 4;
|
|
|
|
}
|
|
|
|
repeated Metadata metadata = 4;
|
2022-09-09 19:38:00 +00:00
|
|
|
bool hide = 5;
|
2022-10-28 17:41:31 +00:00
|
|
|
string icon = 6;
|
2022-11-01 21:51:57 +00:00
|
|
|
string instance_type = 7;
|
2022-11-14 17:57:33 +00:00
|
|
|
int32 daily_cost = 8;
|
2022-02-08 01:35:18 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 17:24:02 +00:00
|
|
|
// Parse consumes source-code from a directory to produce inputs.
|
|
|
|
message Parse {
|
|
|
|
message Request {
|
|
|
|
string directory = 1;
|
|
|
|
}
|
2022-02-01 05:36:15 +00:00
|
|
|
message Complete {
|
|
|
|
repeated ParameterSchema parameter_schemas = 2;
|
|
|
|
}
|
2022-01-08 17:24:02 +00:00
|
|
|
message Response {
|
2022-02-01 05:36:15 +00:00
|
|
|
oneof type {
|
|
|
|
Log log = 1;
|
|
|
|
Complete complete = 2;
|
|
|
|
}
|
2022-01-08 17:24:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-28 18:26:01 +00:00
|
|
|
enum WorkspaceTransition {
|
|
|
|
START = 0;
|
|
|
|
STOP = 1;
|
2022-02-28 19:20:36 +00:00
|
|
|
DESTROY = 2;
|
2022-02-28 18:26:01 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 17:24:02 +00:00
|
|
|
// Provision consumes source-code from a directory to produce resources.
|
2022-11-11 22:45:58 +00:00
|
|
|
// Exactly one of Plan or Apply must be provided in a single session.
|
2022-01-08 17:24:02 +00:00
|
|
|
message Provision {
|
2022-02-28 18:26:01 +00:00
|
|
|
message Metadata {
|
|
|
|
string coder_url = 1;
|
|
|
|
WorkspaceTransition workspace_transition = 2;
|
2022-03-25 16:34:45 +00:00
|
|
|
string workspace_name = 3;
|
|
|
|
string workspace_owner = 4;
|
2022-05-02 15:27:34 +00:00
|
|
|
string workspace_id = 5;
|
|
|
|
string workspace_owner_id = 6;
|
2022-07-19 18:24:06 +00:00
|
|
|
string workspace_owner_email = 7;
|
2022-02-28 18:26:01 +00:00
|
|
|
}
|
2022-11-11 22:45:58 +00:00
|
|
|
|
|
|
|
// Config represents execution configuration shared by both Plan and
|
|
|
|
// Apply commands.
|
|
|
|
message Config {
|
2022-01-08 17:24:02 +00:00
|
|
|
string directory = 1;
|
2022-11-11 22:45:58 +00:00
|
|
|
bytes state = 2;
|
2022-02-28 18:26:01 +00:00
|
|
|
Metadata metadata = 3;
|
2022-01-08 17:24:02 +00:00
|
|
|
}
|
2022-11-11 22:45:58 +00:00
|
|
|
|
|
|
|
message Plan {
|
|
|
|
Config config = 1;
|
|
|
|
repeated ParameterValue parameter_values = 2;
|
2023-01-17 10:22:11 +00:00
|
|
|
repeated RichParameterValue rich_parameter_values = 3;
|
2022-11-11 22:45:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Apply {
|
|
|
|
Config config = 1;
|
|
|
|
bytes plan = 2;
|
|
|
|
}
|
|
|
|
|
2022-03-22 19:17:50 +00:00
|
|
|
message Cancel {}
|
|
|
|
message Request {
|
|
|
|
oneof type {
|
2022-11-11 22:45:58 +00:00
|
|
|
Plan plan = 1;
|
|
|
|
Apply apply = 2;
|
|
|
|
Cancel cancel = 3;
|
2022-03-22 19:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-01 05:36:15 +00:00
|
|
|
message Complete {
|
2022-07-19 18:24:06 +00:00
|
|
|
bytes state = 1;
|
2022-02-28 18:40:49 +00:00
|
|
|
string error = 2;
|
|
|
|
repeated Resource resources = 3;
|
2023-01-17 10:22:11 +00:00
|
|
|
repeated RichParameter parameters = 4;
|
|
|
|
bytes plan = 5;
|
2022-01-08 17:24:02 +00:00
|
|
|
}
|
2022-02-01 05:36:15 +00:00
|
|
|
message Response {
|
|
|
|
oneof type {
|
|
|
|
Log log = 1;
|
|
|
|
Complete complete = 2;
|
|
|
|
}
|
|
|
|
}
|
2022-01-08 17:24:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
service Provisioner {
|
2022-02-01 05:36:15 +00:00
|
|
|
rpc Parse(Parse.Request) returns (stream Parse.Response);
|
2022-03-22 19:17:50 +00:00
|
|
|
rpc Provision(stream Provision.Request) returns (stream Provision.Response);
|
2022-02-08 01:35:18 +00:00
|
|
|
}
|