One gRPC service per domain in state.v1 (tasks, executions, accounts, identities, packages, captures, bindings, access, orgs, alerts and so on), each with its own server type in staterpc. RPC and message names and numbers are unchanged.
99 lines
3.4 KiB
Protocol Buffer
99 lines
3.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package state.v1;
|
|
|
|
service OrgService {
|
|
// CallerModels answers the model aliases the caller's org may use. The org
|
|
// is the calling principal's; a call with none is the system org's.
|
|
rpc CallerModels(CallerModelsRequest) returns (CallerModelsResponse);
|
|
// Orgs, workspaces, memberships and agent assignments
|
|
// (docs/prds/orgs-and-access.md). Every request names an org, but the
|
|
// State Store acts in the org the caller's principal carries: a request
|
|
// org that is not the caller's is ignored, so the contract cannot reach
|
|
// another tenant. Instance-admin widening is a later change.
|
|
rpc ListOrgs(ListOrgsRequest) returns (ListOrgsResponse);
|
|
rpc GetOrg(GetOrgRequest) returns (GetOrgResponse);
|
|
rpc CreateOrg(CreateOrgRequest) returns (CreateOrgResponse);
|
|
rpc ListWorkspaces(ListWorkspacesRequest) returns (ListWorkspacesResponse);
|
|
rpc CreateWorkspace(CreateWorkspaceRequest) returns (CreateWorkspaceResponse);
|
|
rpc ListMembers(ListMembersRequest) returns (ListMembersResponse);
|
|
rpc SetMembership(SetMembershipRequest) returns (SetMembershipResponse);
|
|
rpc RemoveMembership(RemoveMembershipRequest) returns (RemoveMembershipResponse);
|
|
rpc ListOrgAgents(ListOrgAgentsRequest) returns (ListOrgAgentsResponse);
|
|
rpc AssignAgent(AssignAgentRequest) returns (AssignAgentResponse);
|
|
}
|
|
|
|
// Org mirrors internal/domain/org.Org: one tenant.
|
|
message Org {
|
|
string id = 1;
|
|
string name = 2;
|
|
}
|
|
// Workspace mirrors internal/domain/org.Workspace: a division of an org.
|
|
message Workspace {
|
|
string id = 1;
|
|
string org_id = 2;
|
|
string name = 3;
|
|
string environment = 4;
|
|
}
|
|
// Member mirrors internal/domain/org.Member: a membership with the identity
|
|
// it names, as the dashboard lists it.
|
|
message Member {
|
|
string identity_id = 1;
|
|
string kind = 2;
|
|
string display_name = 3;
|
|
string workspace_id = 4;
|
|
string role = 5;
|
|
}
|
|
message ListOrgsRequest {}
|
|
message ListOrgsResponse { repeated Org orgs = 1; }
|
|
message GetOrgRequest { string org_id = 1; }
|
|
message GetOrgResponse { Org org = 1; }
|
|
// CreateOrgRequest creates an org with its default workspace and its first
|
|
// owner. Only an instance admin may.
|
|
message CreateOrgRequest {
|
|
string id = 1;
|
|
string name = 2;
|
|
string owner_identity_id = 3;
|
|
}
|
|
message CreateOrgResponse { Org org = 1; }
|
|
message ListWorkspacesRequest { string org_id = 1; }
|
|
message ListWorkspacesResponse { repeated Workspace workspaces = 1; }
|
|
message CreateWorkspaceRequest {
|
|
string org_id = 1;
|
|
string id = 2;
|
|
string name = 3;
|
|
string environment = 4;
|
|
}
|
|
message CreateWorkspaceResponse { Workspace workspace = 1; }
|
|
message ListMembersRequest { string org_id = 1; }
|
|
message ListMembersResponse { repeated Member members = 1; }
|
|
message SetMembershipRequest {
|
|
string org_id = 1;
|
|
string identity_id = 2;
|
|
string workspace_id = 3;
|
|
string role = 4;
|
|
}
|
|
message SetMembershipResponse {}
|
|
message RemoveMembershipRequest {
|
|
string org_id = 1;
|
|
string identity_id = 2;
|
|
string workspace_id = 3;
|
|
}
|
|
message RemoveMembershipResponse {}
|
|
message AssignAgentRequest {
|
|
string org_id = 1;
|
|
string identity_id = 2;
|
|
}
|
|
message AssignAgentResponse {}
|
|
message CallerModelsRequest {}
|
|
message CallerModelsResponse {
|
|
string org_id = 1;
|
|
map<string, string> aliases = 2;
|
|
}
|
|
message ListOrgAgentsRequest { string org_id = 1; }
|
|
message AgentAssignment {
|
|
string identity_id = 1;
|
|
string org_id = 2;
|
|
}
|
|
message ListOrgAgentsResponse { repeated AgentAssignment agents = 1; }
|