From 0d48c513eb94eabd1a16ee67dd8d818221d857b8 Mon Sep 17 00:00:00 2001 From: Praveen Yadav Date: Thu, 23 Sep 2021 16:55:12 +0530 Subject: [PATCH] wip: add workspaces apis --- odpf/siren/v1/siren.proto | 73 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/odpf/siren/v1/siren.proto b/odpf/siren/v1/siren.proto index 1fbde95e..79289ec9 100644 --- a/odpf/siren/v1/siren.proto +++ b/odpf/siren/v1/siren.proto @@ -6,6 +6,7 @@ import "google/api/field_behavior.proto"; import "google/protobuf/descriptor.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/empty.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; import "validate/validate.proto"; @@ -32,6 +33,40 @@ service SirenService { }; } + rpc ListWorkspaces(ListWorkspacesRequest) returns (ListWorkspacesResponse) { + option (google.api.http) = { + get: "/workspaces" + }; + } + + rpc CreateWorkspace(CreateWorkspaceRequest) returns (Workspace) { + option (google.api.http) = { + post: "/workspaces" + body: "*" + }; + } + + rpc GetWorkspace(GetWorkspaceRequest) returns (Workspace) { + option (google.api.http) = { + get: "/workspace/{id}" + }; + } + + rpc UpdateWorkspace(UpdateWorkspaceRequest) returns (Workspace) { + option (google.api.http) = { + put: "/workspace/{id}", + body: "*" + }; + } + + rpc DeleteWorkspace(DeleteWorkspaceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/workspace/{id}" + }; + } + + + rpc ListAlertHistory(ListAlertHistoryRequest) returns (ListAlertHistoryResponse) { option (google.api.http) = { get: "/history" @@ -47,7 +82,7 @@ service SirenService { rpc ListWorkspaceChannels(ListWorkspaceChannelsRequest) returns (ListWorkspaceChannelsResponse) { option (google.api.http) = { - get: "/workspaces/{workspace_name}/channels" + get: "/slackworkspaces/{workspace_name}/channels" }; } rpc ExchangeCode(ExchangeCodeRequest) returns (ExchangeCodeResponse) { @@ -125,6 +160,38 @@ message PingResponse { string message = 1; } +message Workspace { + uint64 id = 1; + string urn = 2; + string name = 3; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; +} + +message ListWorkspacesRequest {} + +message ListWorkspacesResponse { + repeated Workspace workspaces = 1; +} + +message CreateWorkspaceRequest { + string urn = 1 [(validate.rules).string.pattern = "^[A-Za-z0-9_-]+$"]; + string name = 2 [(validate.rules).string.pattern = "^[A-Za-z0-9_-]+$"]; +} + +message GetWorkspaceRequest { + uint64 id = 1; +} + +message UpdateWorkspaceRequest { + uint64 id = 1; + string name = 2 [(validate.rules).string.pattern = "^[A-Za-z0-9_-]+$"]; +} + +message DeleteWorkspaceRequest { + uint64 id = 1; +} + message ListAlertHistoryRequest { string resource = 1; uint32 start_time = 2; @@ -171,7 +238,7 @@ message CreateAlertHistoryResponse { repeated AlertHistory alerts = 1; } -message Workspace { +message SlackWorkspace { string id = 1; string name = 2; } @@ -181,7 +248,7 @@ message ListWorkspaceChannelsRequest { } message ListWorkspaceChannelsResponse { - repeated Workspace data = 1; + repeated SlackWorkspace data = 1; } message ExchangeCodeRequest {