syntax = "proto3";

package go.micro.runtime;

service Runtime {
	rpc Create(CreateRequest) returns (CreateResponse) {};
	rpc Read(ReadRequest) returns (ReadResponse) {};
	rpc Delete(DeleteRequest) returns (DeleteResponse) {};
	rpc Update(UpdateRequest) returns (UpdateResponse) {};
	rpc List(ListRequest) returns (ListResponse) {};
}

message Service {
	// name of the service
	string name = 1;
	// version of the service
	string version = 2;
	// git url of the source
	string source = 3;
	// service metadata
	map<string,string> metadata = 4;
}

message Event {
	string type = 1;
	int64 timestamp = 2;
	string service = 3;
	string version = 4;
}

message CreateOptions {
	// command to pass in
	repeated string command = 1;
	// environment to pass in
	repeated string env = 2;
	// output to send to
	string output = 3;
}

message CreateRequest {
	Service service = 1;
	CreateOptions options = 2;
}

message CreateResponse {}

message ReadOptions {
	// service name
	string service = 1;
	// version of the service
	string version = 2;
	// type of service
	string type = 3;
}

message ReadRequest {
        ReadOptions options = 1;
}

message ReadResponse {
        repeated Service services = 1;
}

message DeleteRequest {
	Service service = 1;
}

message DeleteResponse {}

message UpdateRequest {
	Service service = 1;
}

message UpdateResponse {}

message ListRequest {}

message ListResponse {
	repeated Service services = 1;
}