feat: System api (#3461)

* feat: start system api

* feat: remove auth

* feat: change gitignore

* feat: run system api

* feat: remove clear view form admin api

* feat: search instances

* feat: add instance

* fix: set primary domain

* Update .gitignore

* fix: add instance

* fix: add instance

* fix: handle errors

* fix: handle instance name

* fix: test

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2022-04-21 12:37:39 +02:00
committed by GitHub
parent a7816a43b1
commit 3d5891eb11
40 changed files with 1216 additions and 485 deletions

View File

@@ -2525,34 +2525,6 @@ service AdminService {
};
}
//Truncates the delta of the change stream
// be carefull with this function because ZITADEL has to
// recompute the deltas after they got cleared.
// Search requests will return wrong results until all deltas are recomputed
rpc ClearView(ClearViewRequest) returns (ClearViewResponse) {
option (google.api.http) = {
post: "/views/{database}/{view_name}";
};
option (zitadel.v1.auth_option) = {
permission: "iam.write";
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "views";
external_docs: {
url: "https://docs.zitadel.ch/concepts#Software_Architecture";
description: "details of ZITADEL's event driven software concepts";
};
responses: {
key: "200";
value: {
description: "View cleared";
};
};
};
}
//Returns event descriptions which cannot be processed.
// It's possible that some events need some retries.
// For example if the SMTP-API wasn't able to send an email at the first time
@@ -2582,7 +2554,7 @@ service AdminService {
//Deletes the event from failed events view.
// the event is not removed from the change stream
// This call is usefull if the system was able to process the event later.
// This call is usefull if the system was able to process the event later.
// e.g. if the second try of sending an email was successful. the first try produced a
// failed event. You can find out if it worked on the `failure_count`
rpc RemoveFailedEvent(RemoveFailedEventRequest) returns (RemoveFailedEventResponse) {
@@ -4512,34 +4484,6 @@ message ListViewsResponse {
repeated View result = 1;
}
message ClearViewRequest {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
json_schema: {
required: ["database", "view_name"]
};
};
string database = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"adminapi\"";
min_length: 1;
max_length: 200;
}
];
string view_name = 2 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"iam_members\"";
min_length: 1;
max_length: 200;
}
];
}
//This is an empty response
message ClearViewResponse {}
//This is an empty request
message ListFailedEventsRequest {}

View File

@@ -25,11 +25,6 @@ message Instance {
example: "\"ZITADEL\"";
}
];
string version = 5 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"v1.0.0\"";
}
];
}
enum State {
@@ -44,31 +39,19 @@ message Query {
oneof query {
option (validate.required) = true;
IdQuery id_query = 1;
StateQuery state_query = 2;
IdsQuery id_query = 1;
}
}
//IdQuery is always equals
message IdQuery {
string id = 1 [
(validate.rules).string = {max_len: 200},
message IdsQuery {
repeated string ids = 1 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "4820840938402429";
}
];
}
//StateQuery is always equals
message StateQuery {
State state = 1 [
(validate.rules).enum.defined_only = true,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "current state of the instance";
}
];
}
enum FieldName {
FIELD_NAME_UNSPECIFIED = 0;
FIELD_NAME_ID = 1;

View File

@@ -105,7 +105,7 @@ service SystemService {
// Returns a list of ZITADEL instances/tenants
rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {
option (google.api.http) = {
post: "/instances"
post: "/instances/_search"
body: "*"
};
}
@@ -134,17 +134,11 @@ service SystemService {
};
}
// Returns the usage metrics of an instance
rpc GetUsage(GetUsageRequest) returns (GetUsageResponse) {
option (google.api.http) = {
get: "/instances/{id}/usage";
};
}
// Returns the custom domains of an instance
rpc ListDomains(ListDomainsRequest) returns (ListDomainsResponse) {
option (google.api.http) = {
get: "/instances/{id}/domains";
post: "/instances/{id}/domains/_search";
body: "*"
};
}
@@ -178,6 +172,7 @@ service SystemService {
rpc ListViews(ListViewsRequest) returns (ListViewsResponse) {
option (google.api.http) = {
post: "/views/_search";
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
@@ -229,6 +224,7 @@ service SystemService {
rpc ListFailedEvents(ListFailedEventsRequest) returns (ListFailedEventsResponse) {
option (google.api.http) = {
post: "/failedevents/_search";
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
@@ -322,19 +318,19 @@ message GetInstanceResponse {
message AddInstanceRequest {
string instance_name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
string first_org_name = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
string first_org_name = 2 [(validate.rules).string = {max_len: 200}];
string custom_domain = 3 [(validate.rules).string = {max_len: 200}];
string owner_first_name = 4 [(validate.rules).string = {min_len: 1, max_len: 200}];
string owner_last_name = 5 [(validate.rules).string = {min_len: 1, max_len: 200}];
string owner_first_name = 4 [(validate.rules).string = {max_len: 200}];
string owner_last_name = 5 [(validate.rules).string = {max_len: 200}];
string owner_email = 6 [(validate.rules).string = {min_len: 1, max_len: 200}];
string owner_username = 7 [(validate.rules).string = {min_len: 1, max_len: 200}];
string password = 8 [(validate.rules).string = {min_len: 1, max_len: 200}];
uint64 request_limit = 9;
uint64 action_mins_limit = 10;
string owner_username = 7 [(validate.rules).string = {max_len: 200}];
uint64 request_limit = 8;
uint64 action_mins_limit = 9;
}
message AddInstanceResponse {
string id = 1;
zitadel.v1.ObjectDetails details = 2;
}
message RemoveInstanceRequest {