Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add client RPC attributes to optimus Runtime proto #9

Merged
merged 5 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions odpf/metadata/optimus/Job.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ message JobMetadata {
repeated JobHook hooks = 11;
repeated JobDependency dependencies = 12;

string namespace = 13;

google.protobuf.Timestamp event_timestamp = 100;
}

Expand Down
123 changes: 114 additions & 9 deletions odpf/optimus/RuntimeService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ 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";
version: "0.1";
};
external_docs: {
description: "Optimus server";
description: "Optimus server";
}
schemes: HTTP;
};
Expand All @@ -37,8 +37,30 @@ service RuntimeService {
// 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

// CreateJobSpecification registers a new job for a namespace which belongs to a project
rpc CreateJobSpecification(CreateJobSpecificationRequest) returns (CreateJobSpecificationResponse) {
option (google.api.http) = {
post: "/api/v1/project/{project_name}/namespace/{namespace}/job"
body: "*"
};
}

// ReadJobSpecification reads a provided job spec of a namespace
rpc ReadJobSpecification(ReadJobSpecificationRequest) returns (ReadJobSpecificationResponse) {
option (google.api.http) = {
get: "/api/v1/project/{project_name}/namespace/{namespace}/job/{job_name}"
};
}

// DeleteJobSpecification deletes a job spec of a namespace
rpc DeleteJobSpecification(DeleteJobSpecificationRequest) returns (DeleteJobSpecificationResponse) {
option (google.api.http) = {
delete: "/api/v1/project/{project_name}/namespace/{namespace}/job/{job_name}"
};
}

// 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"
Expand Down Expand Up @@ -68,6 +90,13 @@ service RuntimeService {
body: "*"
};
}
// RegisterProjectNamespace creates a new namespace for a project
rpc RegisterProjectNamespace(RegisterProjectNamespaceRequest) returns (RegisterProjectNamespaceResponse) {
option (google.api.http) = {
post: "/api/v1/project/{project_name}/namespace"
body: "*"
};
}
// RegisterSecret creates a new secret of a project
rpc RegisterSecret(RegisterSecretRequest) returns (RegisterSecretResponse) {
option (google.api.http) = {
Expand All @@ -82,6 +111,13 @@ service RuntimeService {
};
}

// ListProjectNamespaces returns list of namespaces of a project
rpc ListProjectNamespaces(ListProjectNamespacesRequest) returns (ListProjectNamespacesResponse) {
option (google.api.http) = {
get: "/api/v1/project/{project_name}/namespace"
};
}

// RegisterInstance is an internal admin command used during task execution
rpc RegisterInstance(RegisterInstanceRequest) returns (RegisterInstanceResponse) {
option (google.api.http) = {
Expand All @@ -108,25 +144,25 @@ service RuntimeService {
// 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"
get: "/api/v1/project/{project_name}/namespace/{namespace}/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"
post: "/api/v1/project/{project_name}/namespace/{namespace}/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}"
get: "/api/v1/project/{project_name}/namespace/{namespace}/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"
put: "/api/v1/project/{project_name}/namespace/{namespace}/datastore/{datastore_name}/resource"
body: "*"
};
}
Expand All @@ -142,6 +178,11 @@ message ProjectSpecification {
map<string, string> config = 2;
}

message NamespaceSpecification {
string name = 1;
map<string, string> config = 2;
}

message JobSpecHook {
string name = 1;
repeated JobConfigItem config = 2;
Expand Down Expand Up @@ -238,6 +279,8 @@ message DeployJobSpecificationRequest {

// 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

string namespace = 4;
}

message DeployJobSpecificationResponse {
Expand All @@ -253,6 +296,7 @@ message DeployJobSpecificationResponse {

message ListJobSpecificationRequest {
string project_name = 1;
string namespace = 2;
}

message ListJobSpecificationResponse{
Expand All @@ -262,6 +306,7 @@ message ListJobSpecificationResponse{
message DumpJobSpecificationRequest {
string project_name = 1;
string job_name = 2;
string namespace = 3;
}

message DumpJobSpecificationResponse {
Expand All @@ -272,6 +317,7 @@ message DumpJobSpecificationResponse {
message CheckJobSpecificationRequest {
string project_name = 1;
JobSpecification job = 2;
string namespace = 3;
}

message CheckJobSpecificationResponse {
Expand All @@ -281,6 +327,7 @@ message CheckJobSpecificationResponse {
message CheckJobSpecificationsRequest {
string project_name = 1;
repeated JobSpecification jobs = 2;
string namespace = 3;
}

message CheckJobSpecificationsResponse {
Expand All @@ -296,13 +343,56 @@ message CheckJobSpecificationsResponse {

message RegisterProjectRequest {
ProjectSpecification project = 1;
NamespaceSpecification namespace = 2;
}

message RegisterProjectResponse {
bool success = 1;
string message = 2;
}

message RegisterProjectNamespaceRequest {
string project_name = 1;
NamespaceSpecification namespace = 2;
}

message RegisterProjectNamespaceResponse {
bool success = 1;
string message = 2;
}

message CreateJobSpecificationRequest {
string project_name = 1;
string namespace = 2;
JobSpecification spec = 3;
}

message CreateJobSpecificationResponse {
bool success = 1;
string message = 2;
}

message ReadJobSpecificationRequest {
string project_name = 1;
string namespace = 2;
string job_name = 3;
}

message ReadJobSpecificationResponse {
JobSpecification spec = 1;
}

message DeleteJobSpecificationRequest {
string project_name = 1;
string namespace = 2;
string job_name = 3;
}

message DeleteJobSpecificationResponse {
bool success = 1;
string message = 2;
}

message RegisterSecretRequest {
string project_name = 1;
string secret_name = 2;
Expand All @@ -320,6 +410,14 @@ message ListProjectsResponse {
repeated ProjectSpecification projects = 1;
}

message ListProjectNamespacesRequest {
string project_name = 1;
}

message ListProjectNamespacesResponse {
repeated NamespaceSpecification namespaces = 1;
}

message RegisterInstanceRequest {
string project_name = 1;
string job_name = 2;
Expand All @@ -331,11 +429,13 @@ message RegisterInstanceResponse {
ProjectSpecification project = 1;
JobSpecification job = 2;
InstanceSpec instance = 3;
NamespaceSpecification namespace = 4;
}

message JobStatusRequest {
string project_name = 1;
string job_name = 2;
string namespace = 3;
}

message JobStatusResponse {
Expand All @@ -358,6 +458,7 @@ message DeployResourceSpecificationRequest {
string project_name = 1;
string datastore_name = 2;
repeated ResourceSpecification resources = 3;
string namespace = 4;
}

message DeployResourceSpecificationResponse {
Expand All @@ -375,6 +476,7 @@ message DeployResourceSpecificationResponse {
message ListResourceSpecificationRequest {
string project_name = 1;
string datastore_name = 2;
string namespace = 3;
}

message ListResourceSpecificationResponse {
Expand All @@ -385,6 +487,7 @@ message CreateResourceRequest {
string project_name = 1;
string datastore_name = 2;
ResourceSpecification resource = 3;
string namespace = 4;
}

message CreateResourceResponse {
Expand All @@ -396,6 +499,7 @@ message ReadResourceRequest {
string project_name = 1;
string datastore_name = 2;
string resource_name = 3;
string namespace = 4;
}

message ReadResourceResponse {
Expand All @@ -408,9 +512,10 @@ message UpdateResourceRequest {
string project_name = 1;
string datastore_name = 2;
ResourceSpecification resource = 3;
string namespace = 4;
}

message UpdateResourceResponse {
bool success = 1;
string message = 2;
}
}