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 membership management api to global admin service #291

Merged
merged 1 commit into from
Jul 25, 2024
Merged
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
67 changes: 67 additions & 0 deletions proto/global_admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ package global_admin;
service GlobalAdmin {
rpc GetAccounts(_GetAccountsRequest) returns(_GetAccountsResponse) {}
rpc GetAccountSessionToken (_GetAccountSessionTokenRequest) returns(_GetAccountSessionTokenResponse) {}
rpc AddMember(_AddMemberRequest) returns(_AddMemberResponse) {}
rpc RemoveMember(_RemoveMemberRequest) returns(_RemoveMemberResponse) {}
rpc ListMembers(_ListMembersRequest) returns(_ListMembersResponse) {}
rpc GetEndpointsForAccount(_GetEndpointsForAccountRequest) returns (_GetEndpointsForAccountResponse) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlinehan jfyi I think GetEndpointsForAccount is also good to go into client-protos repo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

}

// No parameters required - we derive identity from the auth header.
Expand All @@ -32,3 +36,66 @@ message _GetAccountSessionTokenRequest {
message _GetAccountSessionTokenResponse {
string account_session_token = 1;
}

// API Key needs to be provided via the "authorization" header.
// The Account to add the User to is derived from the API key, which is account-scoped.
message _AddMemberRequest {
string user_name = 1;
}

// This response is for when a Member is added successfully to the Account,
// including the case when the Member is already a Member.
// These are some of the Errors and their corresponding GRPC status codes.
// 1. User is already a Member. grpc code = FAILED_PRECONDITION. Metadata: "err" -> "already_a_member".
// 2. User does not exist. grpc code = NOT_FOUND. Metadata: "err" -> "user_not_found".
// 3. Account has too many Members. grpc code = RESOURCE_EXHAUSTED. Metadata: "err" -> "max_member_count_exceeded".
message _AddMemberResponse {
}

// API Key needs to be provided via the "authorization" header.
// The Account to remove the User from is derived from the API key, which is account-scoped.
message _RemoveMemberRequest {
string user_name = 1;
}

// This response is for when a Member is removed successfully from an Account.
// These are some of the Errors and their corresponding GRPC status codes:
// 1. User is not a Member. grpc code = FAILED_PRECONDITION. Metadata: "err" -> "user_is_not_a_member".
// 2. a non-owner Member may not be removed. grpc code = PERMISSION_DENIED. Metadata: "err" -> "owner_cannot_be_removed".
// Note that to remove an Owner, customers need to reach out to us so we can run mm commands for them.
message _RemoveMemberResponse {
}

// API Key needs to be provided via the "authorization" header.
// The Account to list the Users is derived from the API key, which is account-scoped.
message _ListMembersRequest {
}

enum MembershipStatus {
OWNER = 0;
MEMBER = 1;
}

message _Member {
string user_name = 1;
MembershipStatus membership_status = 2;
}

message _ListMembersResponse {
repeated _Member members = 1;
}

// API Key needs to be provided via the "authorization" header.
// The Account is derived from the API key, which is account-scoped.
message _GetEndpointsForAccountRequest {
}

message _GetEndpointsForAccountResponse {
repeated Endpoint endpoints = 1;
}

message Endpoint {
string friendly_name = 1; // the name displayed in the Console, e.g. 'us-west-2', 'private-us-west-2', etc.
string domain_name = 2; // domain name for talking to this Endpoint, e.g. `cell-4-us-west-2-1.prod.a.momentohq.com`
string region = 3; // AWS region, e.g. `us-west-2`
}
Loading