Skip to content

Commit

Permalink
feat: add provider apis
Browse files Browse the repository at this point in the history
Co-authored-by: Abhishek <abhi.sah.97@gmail.com>
  • Loading branch information
pyadav and whoAbhishekSah committed Oct 5, 2021
1 parent 36c80df commit e5f53ab
Showing 1 changed file with 88 additions and 3 deletions.
91 changes: 88 additions & 3 deletions odpf/siren/v1/siren.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -32,6 +33,40 @@ service SirenService {
};
}

rpc ListProviders(google.protobuf.Empty) returns (ListProvidersResponse) {
option (google.api.http) = {
get: "/providers"
};
}

rpc CreateProvider(CreateProviderRequest) returns (Provider) {
option (google.api.http) = {
post: "/providers"
body: "*"
};
}

rpc GetProvider(GetProviderRequest) returns (Provider) {
option (google.api.http) = {
get: "/providers/{id}"
};
}

rpc UpdateProvider(UpdateProviderRequest) returns (Provider) {
option (google.api.http) = {
put: "/providers/{id}",
body: "*"
};
}

rpc DeleteProvider(DeleteProviderRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/providers/{id}"
};
}



rpc ListAlertHistory(ListAlertHistoryRequest) returns (ListAlertHistoryResponse) {
option (google.api.http) = {
get: "/history"
Expand All @@ -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) {
Expand Down Expand Up @@ -125,6 +160,56 @@ message PingResponse {
string message = 1;
}

enum Types {
CORTEX = 0;
}

message Provider {
uint64 id = 1;
string host = 2;
string name = 3;
string type = 4 [(validate.rules).string = {in: ["cortex"]}];
google.protobuf.Struct credentials = 5;
map<string, string> labels = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}

message ListProvidersResponse {
repeated Provider providers = 1;
}

message CreateProviderRequest {
string host = 1 [(validate.rules).string.pattern = "^[A-Za-z0-9_.-]+$"];
string name = 2 [(validate.rules).string.pattern = "^[A-Za-z0-9_-]+$"];
string type = 3 [(validate.rules).string = {in: ["cortex"]}];
google.protobuf.Struct credentials = 4;
map<string, string> labels = 5;
}

message GetProviderRequest {
uint64 id = 1;
}

message UpdateProviderRequest {
uint64 id = 1;
string host = 2 [(validate.rules).string= {
pattern: "^[A-Za-z0-9_.-]+$",
ignore_empty: true
}];
string name = 3 [(validate.rules).string= {
pattern: "^[A-Za-z0-9_-]+$",
ignore_empty: true
}];
string type = 4 [(validate.rules).string = {in: ["cortex"], ignore_empty: true}];
google.protobuf.Struct credentials = 5;
map<string, string> labels = 6;
}

message DeleteProviderRequest {
uint64 id = 1;
}

message ListAlertHistoryRequest {
string resource = 1;
uint32 start_time = 2;
Expand Down Expand Up @@ -171,7 +256,7 @@ message CreateAlertHistoryResponse {
repeated AlertHistory alerts = 1;
}

message Workspace {
message SlackWorkspace {
string id = 1;
string name = 2;
}
Expand All @@ -181,7 +266,7 @@ message ListWorkspaceChannelsRequest {
}

message ListWorkspaceChannelsResponse {
repeated Workspace data = 1;
repeated SlackWorkspace data = 1;
}

message ExchangeCodeRequest {
Expand Down

0 comments on commit e5f53ab

Please sign in to comment.