-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from odpf/optimus-runtime
feature: adding optimus runtime protos
- Loading branch information
Showing
8 changed files
with
1,732 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,383 @@ | ||
syntax = "proto3"; | ||
package odpf.optimus; | ||
|
||
import "odpf/third_party/googleapis/google/api/annotations.proto"; | ||
import "odpf/third_party/grpc-gateway/protoc-gen-openapiv2/options/annotations.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "google/protobuf/struct.proto"; | ||
|
||
option go_package = "github.com/odpf/proton/optimus"; | ||
option java_multiple_files = true; | ||
option java_package = "io.odpf.optimus"; | ||
option java_outer_classname = "RuntimeServiceManager"; | ||
|
||
// These annotations are used when generating the OpenAPI file. | ||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { | ||
info: { | ||
version: "0.1"; | ||
}; | ||
external_docs: { | ||
description: "Optimus server"; | ||
} | ||
schemes: HTTP; | ||
}; | ||
|
||
// WARNING: This is still in active development and can have breaking changes | ||
service RuntimeService { | ||
// server ping with version | ||
rpc Version(VersionRequest) returns (VersionResponse) { | ||
option (google.api.http) = { | ||
post: "/api/v1/version" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// DeployJobSpecification schedules jobs for execution | ||
// returns a stream of messages which can be used to track the progress | ||
// of deployments. Message containing ack are status events other are progress | ||
// events | ||
rpc DeployJobSpecification(DeployJobSpecificationRequest) returns (stream DeployJobSpecificationResponse) {} | ||
|
||
// ListJobSpecification returns list of jobs created in a project | ||
rpc ListJobSpecification(ListJobSpecificationRequest) returns (ListJobSpecificationResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/project/{project_name}/job" | ||
}; | ||
} | ||
|
||
// DumpJobSpecification returns compiled representation of the job in a scheduler | ||
// consumable form | ||
rpc DumpJobSpecification(DumpJobSpecificationRequest) returns (DumpJobSpecificationResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/project/{project_name}/job/{job_name}/dump" | ||
}; | ||
} | ||
|
||
// RegisterProject creates a new project | ||
rpc RegisterProject(RegisterProjectRequest) returns (RegisterProjectResponse) { | ||
option (google.api.http) = { | ||
post: "/api/v1/project" | ||
body: "*" | ||
}; | ||
} | ||
// RegisterSecret creates a new secret of a project | ||
rpc RegisterSecret(RegisterSecretRequest) returns (RegisterSecretResponse) { | ||
option (google.api.http) = { | ||
post: "/api/v1/project/{project_name}/secret/{secret_name}" | ||
body: "*" | ||
}; | ||
} | ||
// ListProjects returns list of registered projects and configurations | ||
rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/project" | ||
}; | ||
} | ||
|
||
// RegisterInstance is an internal admin command used during task execution | ||
rpc RegisterInstance(RegisterInstanceRequest) returns (RegisterInstanceResponse) { | ||
option (google.api.http) = { | ||
post: "/api/v1/instance" | ||
body: "*" | ||
}; | ||
} | ||
// JobStatus returns the current and past run status of jobs | ||
rpc JobStatus(JobStatusRequest) returns (JobStatusResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/project/{project_name}/job/{job_name}/status" | ||
}; | ||
} | ||
// GetWindow provides the start and end dates provided a scheduled date | ||
// of the execution window | ||
rpc GetWindow(GetWindowRequest) returns (GetWindowResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/window" | ||
}; | ||
} | ||
|
||
// DeployResourceSpecification migrate all resource specifications of a datastore in project | ||
rpc DeployResourceSpecification(DeployResourceSpecificationRequest) returns (stream DeployResourceSpecificationResponse) {} | ||
// ListResourceSpecification lists all resource specifications of a datastore in project | ||
rpc ListResourceSpecification(ListResourceSpecificationRequest) returns (ListResourceSpecificationResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/project/{project_name}/datastore/{datastore_name}/resource" | ||
}; | ||
} | ||
|
||
// Datastore CRUD | ||
rpc CreateResource(CreateResourceRequest) returns (CreateResourceResponse) { | ||
option (google.api.http) = { | ||
post: "/api/v1/project/{project_name}/datastore/{datastore_name}/resource" | ||
body: "*" | ||
}; | ||
} | ||
rpc ReadResource(ReadResourceRequest) returns (ReadResourceResponse) { | ||
option (google.api.http) = { | ||
get: "/api/v1/project/{project_name}/datastore/{datastore_name}/resource/{resource_name}" | ||
}; | ||
} | ||
rpc UpdateResource(UpdateResourceRequest) returns (UpdateResourceResponse) { | ||
option (google.api.http) = { | ||
put: "/api/v1/project/{project_name}/datastore/{datastore_name}/resource" | ||
body: "*" | ||
}; | ||
} | ||
// TODO(kush.sharma): unsupported ATM | ||
//rpc DeleteResource(DeleteResourceRequest) returns (DeleteResourceResponse) {} | ||
|
||
} | ||
|
||
// models | ||
|
||
message ProjectSpecification { | ||
string name = 1; | ||
map<string, string> config = 2; | ||
} | ||
|
||
message JobSpecHook { | ||
string name = 1; | ||
repeated JobConfigItem config = 2; | ||
} | ||
|
||
message JobSpecification { | ||
int32 version = 1; | ||
string name = 2; | ||
string owner = 3; | ||
|
||
string start_date = 4; | ||
string end_date = 5; // optional | ||
string interval = 6; | ||
|
||
bool depends_on_past = 7; // should only execute today if yesterday was completed with success? | ||
bool catch_up = 8; // should backfill till today? | ||
|
||
string task_name = 9; | ||
repeated JobConfigItem config = 10; | ||
|
||
string window_size = 11; | ||
string window_offset = 12; | ||
string window_truncate_to = 13; | ||
|
||
repeated JobDependency dependencies = 14; // static dependencies | ||
map<string, string> assets = 15; | ||
|
||
repeated JobSpecHook hooks = 16; // optional | ||
|
||
string description = 17; // optional | ||
map<string, string> labels = 18; | ||
} | ||
|
||
message JobConfigItem { | ||
string name = 1; | ||
string value = 2; | ||
} | ||
|
||
message JobDependency { | ||
string name = 1; | ||
string type = 2; | ||
} | ||
|
||
message ProjectSecret { | ||
string name = 1; | ||
string value = 2; | ||
} | ||
|
||
message InstanceSpec { | ||
string state = 1; | ||
google.protobuf.Timestamp scheduled_at = 2; | ||
repeated InstanceSpecData data = 3; | ||
string job_name = 4; | ||
} | ||
|
||
message InstanceSpecData { | ||
string name = 1; | ||
string value = 2; | ||
string task = 3; | ||
string type = 4; | ||
} | ||
|
||
message JobStatus { | ||
string state = 1; | ||
google.protobuf.Timestamp scheduled_at = 2; | ||
} | ||
|
||
// ResourceSpecification are datastore specification representation of a resource | ||
message ResourceSpecification { | ||
int32 version = 1; | ||
string name = 2; | ||
|
||
string datastore = 3; | ||
string type = 4; | ||
|
||
google.protobuf.Struct spec = 5; | ||
map<string, string> assets = 6; | ||
map<string, string> labels = 7; | ||
} | ||
|
||
// rpc req/res | ||
|
||
message VersionRequest { | ||
string client = 1; | ||
} | ||
|
||
message VersionResponse { | ||
string server = 1; | ||
} | ||
|
||
message DeployJobSpecificationRequest { | ||
string project_name = 1; // unique project identifier | ||
repeated JobSpecification jobs = 2; | ||
|
||
// TODO: not implemented yet, default behaviour is to treat this true always till then | ||
// bool synchronize = 3; // deletes job that are not sent as part of this deployment | ||
} | ||
|
||
message DeployJobSpecificationResponse { | ||
bool success = 1; | ||
|
||
// non ack responses are more of a progress/info response | ||
// and not really success or failure statuses | ||
bool ack = 2; | ||
|
||
string message = 3; | ||
string job_name = 4; | ||
} | ||
|
||
message ListJobSpecificationRequest { | ||
string project_name = 1; | ||
} | ||
|
||
message ListJobSpecificationResponse{ | ||
repeated JobSpecification jobs = 1; | ||
} | ||
|
||
message DumpJobSpecificationRequest { | ||
string project_name = 1; | ||
string job_name = 2; | ||
} | ||
|
||
message DumpJobSpecificationResponse { | ||
bool success = 1; | ||
string content = 2; | ||
} | ||
|
||
message RegisterProjectRequest { | ||
ProjectSpecification project = 1; | ||
} | ||
|
||
message RegisterProjectResponse { | ||
bool success = 1; | ||
string message = 2; | ||
} | ||
|
||
message RegisterSecretRequest { | ||
string project_name = 1; | ||
string secret_name = 2; | ||
string value = 3; // base64 encoded secret value | ||
} | ||
|
||
message RegisterSecretResponse { | ||
bool success = 1; | ||
string message = 2; | ||
} | ||
|
||
message ListProjectsRequest {} | ||
|
||
message ListProjectsResponse { | ||
repeated ProjectSpecification projects = 1; | ||
} | ||
|
||
message RegisterInstanceRequest { | ||
string project_name = 1; | ||
string job_name = 2; | ||
string type = 3; | ||
google.protobuf.Timestamp scheduled_at = 4; | ||
} | ||
|
||
message RegisterInstanceResponse { | ||
ProjectSpecification project = 1; | ||
JobSpecification job = 2; | ||
InstanceSpec instance = 3; | ||
} | ||
|
||
message JobStatusRequest { | ||
string project_name = 1; | ||
string job_name = 2; | ||
} | ||
|
||
message JobStatusResponse { | ||
repeated JobStatus statuses = 1; | ||
} | ||
|
||
message GetWindowRequest { | ||
google.protobuf.Timestamp scheduled_at = 1; | ||
string size = 2; | ||
string offset = 3; | ||
string truncate_to = 4; | ||
} | ||
|
||
message GetWindowResponse { | ||
google.protobuf.Timestamp start = 1; | ||
google.protobuf.Timestamp end = 2; | ||
} | ||
|
||
message DeployResourceSpecificationRequest { | ||
string project_name = 1; | ||
string datastore_name = 2; | ||
repeated ResourceSpecification resources = 3; | ||
} | ||
|
||
message DeployResourceSpecificationResponse { | ||
bool success = 1; | ||
|
||
// non ack responses are more of a progress/info response | ||
// and not success or failure statuses | ||
bool ack = 2; | ||
|
||
string message = 3; | ||
string resource_name = 4; | ||
} | ||
|
||
// ListResourceSpecificationRequest lists all resource specifications of a datastore in project | ||
message ListResourceSpecificationRequest { | ||
string project_name = 1; | ||
string datastore_name = 2; | ||
} | ||
|
||
message ListResourceSpecificationResponse { | ||
repeated ResourceSpecification resources = 1; | ||
} | ||
|
||
message CreateResourceRequest { | ||
string project_name = 1; | ||
string datastore_name = 2; | ||
ResourceSpecification resource = 3; | ||
} | ||
|
||
message CreateResourceResponse { | ||
bool success = 1; | ||
string message = 2; | ||
} | ||
|
||
message ReadResourceRequest { | ||
string project_name = 1; | ||
string datastore_name = 2; | ||
string resource_name = 3; | ||
} | ||
|
||
message ReadResourceResponse { | ||
bool success = 1; | ||
string message = 2; | ||
ResourceSpecification resource = 3; | ||
} | ||
|
||
message UpdateResourceRequest { | ||
string project_name = 1; | ||
string datastore_name = 2; | ||
ResourceSpecification resource = 3; | ||
} | ||
|
||
message UpdateResourceResponse { | ||
bool success = 1; | ||
string message = 2; | ||
} |
Oops, something went wrong.