github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/proto/runtime/runtime.proto (about)

     1  syntax = "proto3";
     2  
     3  package runtime;
     4  
     5  option go_package = "github.com/tickoalcantara12/micro/v3/proto/runtime;runtime";
     6  
     7  service Runtime {
     8  	rpc Create(CreateRequest) returns (CreateResponse) {};
     9  	rpc Read(ReadRequest) returns (ReadResponse) {};
    10  	rpc Delete(DeleteRequest) returns (DeleteResponse) {};
    11  	rpc Update(UpdateRequest) returns (UpdateResponse) {};
    12  	rpc Logs(LogsRequest) returns (stream LogRecord) {};
    13  }
    14  
    15  message Resource {
    16  	Namespace namespace = 1;
    17  	NetworkPolicy networkpolicy = 2;
    18  	Service service = 3;
    19  	ResourceQuota resourcequota = 4;
    20  }
    21  
    22  message Namespace {
    23  	// name of the namespace
    24  	string name = 1;
    25  }
    26  
    27  message NetworkPolicy {
    28  	// the labels allowed ingress by this policy
    29  	map<string,string> allowedlabels = 1;
    30  	// name of the network policy
    31  	string name = 2;
    32  	// namespace the network policy belongs to
    33  	string namespace = 3;
    34  }
    35  
    36  message ResourceQuota {
    37  	// name of the resource quota
    38  	string name = 1;
    39  	// namespace the resource quota belongs to
    40  	string namespace = 2;
    41  	// resource requests
    42  	Resources requests = 3;
    43  	// resource limits
    44  	Resources limits = 4;
    45  }
    46  
    47  message Resources {
    48  	int32 Memory = 1; // in MiB
    49  	int32 CPU = 2; // in millicores
    50  	int32 EphemeralStorage = 3; // in MiB
    51  }
    52  
    53  // Source service is used by the CLI to upload source to the service. The service will return
    54  // a unique ID representing the location of that source. This ID can then be used as a source
    55  // for the service when doing Runtime.Create. The server will handle cleanup of uploaded source.
    56  service Source {
    57  	rpc Upload(stream UploadRequest) returns (UploadResponse) {};
    58  }
    59  
    60  // Build service is used by containers to download prebuilt binaries. The client will pass the 
    61  // service (name and version are required attributed) and the server will then stream the latest
    62  // binary to the client.
    63  service Build {
    64  	rpc Read(Service) returns (stream BuildReadResponse) {};
    65  }
    66  
    67  message Service {
    68  	// name of the service
    69  	string name = 1;
    70  	// version of the service
    71  	string version = 2;
    72  	// git url of the source
    73  	string source = 3;
    74  	// service metadata
    75  	map<string,string> metadata = 4;
    76  	// status of the service
    77  	int32 status = 5;
    78  }
    79  
    80  message CreateOptions {
    81  	// command to pass in
    82  	repeated string command = 1;
    83  	// args to pass into command
    84  	repeated string args = 2;
    85  	// environment to pass in
    86  	repeated string env = 3;
    87  	// output to send to
    88  	string output = 4;
    89  	// create type of service
    90  	string type = 5;
    91  	// image to use
    92  	string image = 6;
    93  	// namespace to create the service in
    94  	string namespace = 7;
    95  	// secrets to use for the service
    96  	map<string,string> secrets = 8;
    97  	// entrypoint within the source
    98  	string entrypoint = 9;
    99  	// volumes to mount
   100  	map<string,string> volumes = 10;
   101  	// number of instances
   102  	int64 instances = 11;
   103  	// force rebuild and restart the service
   104  	bool force = 12;
   105  }
   106  
   107  message CreateRequest {
   108  	Resource resource = 1;
   109  	CreateOptions options = 2;
   110  }
   111  
   112  message CreateResponse {}
   113  
   114  message ReadOptions {
   115  	// service name
   116  	string service = 1;
   117  	// version of the service
   118  	string version = 2;
   119  	// type of service
   120  	string type = 3;
   121  	// namespace of the service
   122  	string namespace = 4;
   123  }
   124  
   125  message ReadRequest {
   126  	ReadOptions options = 1;
   127  }
   128  
   129  message ReadResponse {
   130  	repeated Service services = 1;
   131  }
   132  
   133  message DeleteOptions {
   134  	// namespace of the service
   135  	string namespace = 1;
   136  }
   137  
   138  message DeleteRequest {
   139  	Resource resource = 1;
   140  	DeleteOptions options = 2;
   141  }
   142  
   143  message DeleteResponse {}
   144  
   145  message UpdateOptions {
   146  	// namespace of the service
   147  	string namespace = 1;
   148  	// entrypoint within the source
   149  	string entrypoint = 2;
   150  	// number of instances
   151  	int64 instances = 3;
   152  }
   153  
   154  message UpdateRequest {
   155  	Resource resource = 1;
   156  	UpdateOptions options = 2;
   157  }
   158  
   159  message UpdateResponse {}
   160  
   161  message ListOptions {
   162  	// namespace of the service
   163  	string namespace = 1;
   164  }
   165  
   166  message ListRequest {
   167  	ListOptions options = 1;
   168  }
   169  
   170  message ListResponse {
   171  	repeated Service services = 1;
   172  }
   173  
   174  message LogsOptions {
   175  	// namespace of the service
   176  	string namespace = 1;
   177  }
   178  
   179  message LogsRequest{
   180  	// service to request logs for
   181  	string service = 1;
   182  	// stream records continuously
   183  	bool stream = 2;
   184  	// count of records to request
   185  	int64 count = 3;
   186  	// relative time in seconds
   187  	// before the current time
   188  	// from which to show logs
   189  	int64 since = 4;
   190  	// options to use
   191  	LogsOptions options = 5;
   192  	// service version
   193  	string version = 6;
   194  }
   195  
   196  message LogRecord {
   197  	// timestamp of log record
   198  	int64 timestamp = 1;
   199  	// record metadata
   200  	map<string,string> metadata = 2;
   201  	// message
   202  	string message = 3;
   203  }
   204  
   205  message UploadRequest {
   206  	Service service = 1;
   207  	bytes data = 2;	
   208  }
   209  
   210  message UploadResponse {
   211  	string id = 1;
   212  }
   213  
   214  message BuildReadResponse {
   215  	bytes data = 1;	
   216  }