Skip to content

Commit 04430d3

Browse files
authored
feat: Update global admin proto for GlobalApiKeys (#332)
1 parent 320eb56 commit 04430d3

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

proto/global_admin.proto

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ package global_admin;
1111

1212
service GlobalAdmin {
1313
rpc GetAccounts(_GetAccountsRequest) returns (_GetAccountsResponse) {}
14-
rpc GetInvitationsForUser(_GetInvitationsForUserRequest) returns (_GetInvitationsForUserResponse) {
15-
16-
}
14+
rpc GetInvitationsForUser(_GetInvitationsForUserRequest) returns (_GetInvitationsForUserResponse) {}
1715
rpc GetAccountSessionToken (_GetAccountSessionTokenRequest) returns(_GetAccountSessionTokenResponse) {}
1816
rpc RemoveMember(_RemoveMemberRequest) returns(_RemoveMemberResponse) {}
1917
rpc ListMembers(_ListMembersRequest) returns(_ListMembersResponse) {}
@@ -26,7 +24,9 @@ service GlobalAdmin {
2624
rpc RevokeInvitation(_RevokeInvitationRequest) returns (_RevokeInvitationResponse) {}
2725
rpc ListRolesForAccount(_ListRolesForAccountRequest) returns (_ListRolesForAccountResponse) {}
2826
rpc SetMemberRole(_SetMemberRoleRequest) returns (_SetMemberRoleResponse) {}
29-
27+
rpc GenerateGlobalApiKey(_GenerateGlobalApiKeyRequest) returns (_GenerateGlobalApiKeyResponse) {}
28+
rpc ListGlobalApiKeys(_ListGlobalApiKeysRequest) returns (stream GlobalApiKey) {}
29+
rpc RevokeGlobalApiKey(_RevokeGlobalApiKeyRequest) returns (_RevokeGlobalApiKeyResponse) {}
3030
}
3131

3232
message _SetAccountNameRequest {
@@ -218,3 +218,45 @@ message _SetMemberRoleRequest {
218218
// 6. Role does not exist. grpc code = NOT_FOUND. Metadata: "err" -> "role_not_found".
219219
message _SetMemberRoleResponse {
220220
}
221+
222+
// Account Session Token provides relevant account.
223+
message _GenerateGlobalApiKeyRequest {
224+
string role_id = 1;
225+
string description = 2;
226+
oneof expiry {
227+
Never never = 3;
228+
Expires expires = 4;
229+
}
230+
231+
// generate a token that will never expire
232+
message Never {}
233+
// generate a token that has an expiry
234+
message Expires {
235+
// how many seconds do you want the api token to be valid for?
236+
uint64 expiration_epoch_seconds = 1;
237+
}
238+
}
239+
240+
message _GenerateGlobalApiKeyResponse {
241+
string api_key = 1;
242+
}
243+
244+
// Account Session Token provides relevant account.
245+
message _ListGlobalApiKeysRequest {}
246+
247+
message GlobalApiKey {
248+
string key_id = 1;
249+
string account_id = 2;
250+
string description = 3;
251+
string role_id = 4;
252+
optional uint64 expires_at_epoch_seconds = 5;
253+
uint64 issued_at_epoch_seconds = 6;
254+
}
255+
256+
// Account Session Token provides relevant account
257+
// as well as user id of the revoking user
258+
message _RevokeGlobalApiKeyRequest {
259+
string key_id = 1;
260+
}
261+
262+
message _RevokeGlobalApiKeyResponse {}

0 commit comments

Comments
 (0)