Files
onepanel/api/workflow.proto
2020-02-29 11:31:41 -08:00

259 lines
7.0 KiB
Protocol Buffer

syntax = "proto3";
package api;
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "protoc-gen-swagger/options/annotations.proto";
import "workflow_template.proto";
import "metric.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
security_definitions: {
security: {
key: "bearer";
value: {
type: TYPE_API_KEY;
in: IN_HEADER;
name: "authorization";
description: "Authentication token, prefixed by Bearer: Bearer <token>"
}
}
}
security: {
security_requirement: {
key: "bearer";
value: {};
}
}
};
service WorkflowService {
// Creates a Workflow
rpc CreateWorkflowExecution (CreateWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_executions"
body: "workflowExecution"
};
}
rpc GetWorkflowExecution (GetWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}"
};
}
rpc ListWorkflowExecutions (ListWorkflowExecutionsRequest) returns (ListWorkflowExecutionsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions"
};
}
rpc WatchWorkflowExecution (WatchWorkflowExecutionRequest) returns (stream WorkflowExecution) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/watch"
};
}
rpc GetWorkflowExecutionLogs (GetWorkflowExecutionLogsRequest) returns (stream LogEntry) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/pods/{podName}/containers/{containerName}/logs"
};
}
rpc GetWorkflowExecutionMetrics (GetWorkflowExecutionMetricsRequest) returns (GetWorkflowExecutionMetricsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/pods/{podName}/metrics"
};
}
rpc ResubmitWorkflowExecution (ResubmitWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_executions/{name}/resubmit"
};
}
rpc TerminateWorkflowExecution (TerminateWorkflowExecutionRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_executions/{name}/terminate"
};
}
rpc CreateWorkflowTemplate (CreateWorkflowTemplateRequest) returns (WorkflowTemplate) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_templates"
body: "workflowTemplate"
};
}
rpc UpdateWorkflowTemplateVersion (UpdateWorkflowTemplateVersionRequest) returns (WorkflowTemplate) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_templates/{workflowTemplate.uid}/versions/{workflowTemplate.version}"
body: "workflowTemplate"
};
}
rpc CreateWorkflowTemplateVersion (CreateWorkflowTemplateRequest) returns (WorkflowTemplate) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_templates/{workflowTemplate.uid}/versions"
body: "workflowTemplate"
};
}
rpc GetWorkflowTemplate (GetWorkflowTemplateRequest) returns (WorkflowTemplate) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_templates/{uid}"
additional_bindings {
get: "/apis/v1beta1/{namespace}/workflow_templates/{uid}/versions/{version}"
}
};
}
rpc ListWorkflowTemplateVersions (ListWorkflowTemplateVersionsRequest) returns (ListWorkflowTemplateVersionsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_templates/{uid}/versions"
};
}
rpc ListWorkflowTemplates (ListWorkflowTemplatesRequest) returns (ListWorkflowTemplatesResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_templates"
};
}
rpc ArchiveWorkflowTemplate (ArchiveWorkflowTemplateRequest) returns (ArchiveWorkflowTemplateResponse) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_templates/{uid}/archive"
};
}
rpc GetArtifact (GetArtifactRequest) returns (ArtifactResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/artifacts/{key=**}"
};
}
rpc ListFiles (ListFilesRequest) returns (ListFilesResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/files/{path=**}"
};
}
}
message CreateWorkflowExecutionRequest {
string namespace = 1;
WorkflowExecution workflowExecution = 2;
}
message GetWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
}
message GetArtifactRequest {
string namespace = 1;
string name = 2;
string key = 3;
}
message WatchWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
}
message ResubmitWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
}
message TerminateWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
}
message GetWorkflowExecutionLogsRequest {
string namespace = 1;
string name = 2;
string podName = 3;
string containerName = 4;
}
message GetWorkflowExecutionMetricsRequest {
string namespace = 1;
string name = 2;
string podName = 3;
}
message GetWorkflowExecutionMetricsResponse {
repeated Metric metrics = 1;
}
message ListWorkflowExecutionsRequest {
string namespace = 1;
string workflowTemplateUid = 2;
string workflowTemplateVersion = 3;
int32 pageSize = 4;
int32 page = 5;
}
message ListWorkflowExecutionsResponse {
int32 count = 1;
repeated WorkflowExecution workflowExecutions = 2;
int32 page = 3;
int32 pages = 4;
int32 totalCount = 5;
}
message LogEntry {
string timestamp = 1;
string content = 2;
}
message WorkflowExecution {
string createdAt = 1;
string uid = 2;
string name = 3;
string phase = 4;
string startedAt = 5;
string finishedAt = 6;
string manifest = 7;
repeated WorkflowExecutionParameter parameters = 8;
WorkflowTemplate workflowTemplate = 9;
}
message WorkflowExecutionParameter {
string name = 1;
string value = 2;
}
message ArtifactResponse {
bytes data = 1;
}
message File {
string path = 1;
string name = 2;
string extension = 3;
int64 size = 4;
string contentType = 5;
string lastModified = 6;
bool directory = 7;
}
message ListFilesRequest {
string namespace = 1;
string name = 2;
string path = 3;
}
message ListFilesResponse {
repeated File files = 1;
string parentPath = 2;
}