Files
archie/proto/controlplane/v1/controlplane.proto
T

122 lines
3.4 KiB
Protocol Buffer

syntax = "proto3";
package controlplane.v1;
import "google/protobuf/timestamp.proto";
service ControlPlaneService {
rpc Catalog(CatalogRequest) returns (CatalogResponse);
rpc Query(QueryRequest) returns (QueryResponse);
rpc History(HistoryRequest) returns (HistoryResponse);
rpc Audit(AuditRequest) returns (AuditResponse);
rpc Command(CommandRequest) returns (CommandResponse);
rpc Watch(WatchRequest) returns (stream WatchResponse);
}
message ResourceDescriptor {
string kind = 1;
string title = 2;
string schema_json = 3;
repeated string commands = 4;
// ApplyMode is "live", "restart-required", or "domain-managed".
string apply_mode = 5;
// QueryService and command_service identify an existing domain API when
// the resource is not stored as a generic JSON document.
string query_service = 6;
string command_service = 7;
// DefaultsJson is the factory value a client can restore this resource to.
// Empty when the resource has no shipped default.
string defaults_json = 8;
}
message CatalogRequest {}
message CatalogResponse { repeated ResourceDescriptor resources = 1; }
message Resource {
string kind = 1;
int64 version = 2;
bytes value_json = 3;
google.protobuf.Timestamp updated_at = 4;
string org_id = 5;
}
// Every request that names a resource acts in one org's copy of it: the org
// the State Store derives from the caller's principal, else the default org.
message QueryRequest {
string kind = 1;
reserved 2;
reserved "org_id";
}
message QueryResponse { Resource resource = 1; }
// Revision is one entry of a resource's audit trail: the value that version
// held, and who changed it from where.
message Revision {
int64 version = 1;
bytes value_json = 2;
string actor = 3;
string source = 4;
string request_id = 5;
google.protobuf.Timestamp at = 6;
}
message HistoryRequest {
string kind = 1;
// Limit caps the revisions returned, newest first. Zero means the server's
// own default.
int32 limit = 2;
reserved 3;
reserved "org_id";
}
message HistoryResponse { repeated Revision revisions = 1; }
// AuditEntry is one changed field of one record. Old and new values are JSON;
// an absent side is empty.
message AuditEntry {
int64 id = 1;
string table = 2;
string record_key = 3;
string field = 4;
bytes old_value_json = 5;
bytes new_value_json = 6;
int64 version = 7;
string actor = 8;
string source = 9;
string request_id = 10;
google.protobuf.Timestamp at = 11;
}
// AuditRequest names resource kinds; the trail returned is theirs in the
// caller's org, so no request can name another org's records.
message AuditRequest {
reserved 1, 2;
reserved "table", "record_keys";
repeated string kinds = 4;
// Limit caps the entries returned, newest first. Zero means the server's
// own default.
int32 limit = 3;
}
message AuditResponse { repeated AuditEntry entries = 1; }
message CommandRequest {
string kind = 1;
string command = 2;
bytes value_json = 3;
int64 expected_version = 4;
string request_id = 5;
// Actor and source are supplied by a trusted service adapter, never copied
// from browser/request JSON.
string actor = 6;
string source = 7;
reserved 8;
reserved "org_id";
}
message CommandResponse { Resource resource = 1; }
message WatchRequest {
string kind = 1;
int64 after_version = 2;
reserved 3;
reserved "org_id";
}
message WatchResponse {
Resource resource = 1;
string error = 2;
}