2022-09-30 00:18:15 -05:00
|
|
|
syntax = "proto3";
|
|
|
|
package object;
|
|
|
|
|
|
|
|
option go_package = "./;object";
|
|
|
|
|
|
|
|
// The canonical object/document data -- this represents the raw bytes and storage level metadata
|
|
|
|
message RawObject {
|
|
|
|
// Unique ID
|
|
|
|
string UID = 1;
|
|
|
|
|
|
|
|
// Identify the object kind. This kind will be used to apply a schema to the body and
|
|
|
|
// will trigger additional indexing behavior.
|
|
|
|
string kind = 2;
|
|
|
|
|
|
|
|
// Time in epoch milliseconds that the object was created
|
|
|
|
int64 created = 3;
|
|
|
|
|
2022-10-05 13:58:46 -05:00
|
|
|
// Time in epoch milliseconds that the object was updated
|
|
|
|
int64 updated = 4;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// Who created the object
|
2022-10-05 20:46:17 -05:00
|
|
|
string created_by = 5;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
2022-10-05 13:58:46 -05:00
|
|
|
// Who updated the object
|
2022-10-05 20:46:17 -05:00
|
|
|
string updated_by = 6;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// Content Length
|
|
|
|
int64 size = 7;
|
|
|
|
|
|
|
|
// MD5 digest of the body
|
|
|
|
string ETag = 8;
|
|
|
|
|
|
|
|
// Raw bytes of the storage object. The kind will determine what is a valid payload
|
|
|
|
bytes body = 9;
|
|
|
|
|
|
|
|
// The version will change when the object is saved. It is not necessarily sortable
|
|
|
|
//
|
|
|
|
// NOTE: currently managed by the dashboard+dashboard_version tables
|
|
|
|
string version = 10;
|
|
|
|
|
2022-10-06 14:48:53 -05:00
|
|
|
// External location info
|
|
|
|
RawObjectSyncInfo sync = 11;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RawObjectSyncInfo {
|
2022-09-30 00:18:15 -05:00
|
|
|
// NOTE: currently managed by the dashboard_provisioning table
|
2022-10-06 14:48:53 -05:00
|
|
|
string source = 11;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// Time in epoch milliseconds that the object was last synced with an external system (provisioning/git)
|
2022-10-06 14:48:53 -05:00
|
|
|
int64 time = 12;
|
2022-09-30 00:18:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Report error while working with objects
|
|
|
|
// NOTE: real systems at scale will contain errors.
|
|
|
|
message ObjectErrorInfo {
|
|
|
|
// Match an error code registry?
|
|
|
|
int64 code = 1;
|
|
|
|
|
|
|
|
// Simple error display
|
|
|
|
string message = 2;
|
|
|
|
|
|
|
|
// Details encoded in JSON
|
|
|
|
bytes details_json = 3;
|
|
|
|
}
|
|
|
|
|
2022-10-04 13:57:26 -05:00
|
|
|
// This is a subset of RawObject that does not include body or sync info
|
|
|
|
message ObjectVersionInfo {
|
|
|
|
// The version will change when the object is saved. It is not necessarily sortable
|
|
|
|
string version = 1;
|
|
|
|
|
2022-10-05 13:58:46 -05:00
|
|
|
// Time in epoch milliseconds that the object was updated
|
|
|
|
int64 updated = 2;
|
2022-10-04 13:57:26 -05:00
|
|
|
|
2022-10-05 13:58:46 -05:00
|
|
|
// Who updated the object
|
2022-10-05 20:46:17 -05:00
|
|
|
string updated_by = 3;
|
2022-10-04 13:57:26 -05:00
|
|
|
|
|
|
|
// Content Length
|
|
|
|
int64 size = 4;
|
|
|
|
|
|
|
|
// MD5 digest of the body
|
|
|
|
string ETag = 5;
|
|
|
|
|
|
|
|
// optional "save" or "commit" message
|
|
|
|
//
|
|
|
|
// NOTE: currently managed by the dashboard_version table, and will be returned from a "history" command
|
|
|
|
string comment = 6;
|
|
|
|
}
|
|
|
|
|
2022-09-30 00:18:15 -05:00
|
|
|
//-----------------------------------------------
|
|
|
|
// Get request/response
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
|
|
|
message ReadObjectRequest {
|
|
|
|
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string UID = 1;
|
|
|
|
|
|
|
|
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string kind = 2;
|
|
|
|
|
|
|
|
// Fetch an explicit version
|
|
|
|
string version = 3;
|
|
|
|
|
|
|
|
// Include the full body bytes
|
|
|
|
bool with_body = 4;
|
|
|
|
|
|
|
|
// Include derived summary metadata
|
|
|
|
bool with_summary = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ReadObjectResponse {
|
|
|
|
// Object details with the body removed
|
|
|
|
RawObject object = 1;
|
|
|
|
|
|
|
|
// Object summary as JSON
|
|
|
|
bytes summary_json = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------
|
|
|
|
// Make many read requests at once (by Kind+ID+version)
|
|
|
|
//------------------------------------------------------
|
|
|
|
|
|
|
|
message BatchReadObjectRequest {
|
|
|
|
repeated ReadObjectRequest batch = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message BatchReadObjectResponse {
|
|
|
|
repeated ReadObjectResponse results = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
// Write request/response
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
|
|
|
message WriteObjectRequest {
|
|
|
|
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string UID = 1;
|
|
|
|
|
|
|
|
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string kind = 2;
|
|
|
|
|
|
|
|
// The raw object body
|
|
|
|
bytes body = 3;
|
|
|
|
|
|
|
|
// Message that can be seen when exploring object history
|
|
|
|
string comment = 4;
|
|
|
|
|
|
|
|
// Used for optimistic locking. If missing, the previous version will be replaced regardless
|
|
|
|
string previous_version = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
message WriteObjectResponse {
|
|
|
|
// Error info -- if exists, the save did not happen
|
|
|
|
ObjectErrorInfo error = 1;
|
|
|
|
|
|
|
|
// Object details with the body removed
|
2022-10-04 13:57:26 -05:00
|
|
|
ObjectVersionInfo object = 2;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// Object summary as JSON
|
|
|
|
bytes summary_json = 3;
|
2022-10-04 13:57:26 -05:00
|
|
|
|
|
|
|
// Status code
|
|
|
|
Status status = 4;
|
|
|
|
|
|
|
|
// Status enumeration
|
|
|
|
enum Status {
|
|
|
|
ERROR = 0;
|
|
|
|
CREATED = 1;
|
2022-10-05 13:58:46 -05:00
|
|
|
UPDATED = 2;
|
2022-10-04 13:57:26 -05:00
|
|
|
UNCHANGED = 3;
|
|
|
|
}
|
2022-09-30 00:18:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
// Delete request/response
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
|
|
|
message DeleteObjectRequest {
|
|
|
|
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string UID = 1;
|
|
|
|
|
|
|
|
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string kind = 2;
|
|
|
|
|
|
|
|
// Used for optimistic locking. If missing, the previous version will be replaced regardless
|
|
|
|
string previous_version = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteObjectResponse {
|
|
|
|
bool OK = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
// History request/response
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
|
|
|
message ObjectHistoryRequest {
|
|
|
|
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string UID = 1;
|
|
|
|
|
|
|
|
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
|
|
|
string kind = 2;
|
|
|
|
|
|
|
|
// Maximum number of items to return
|
|
|
|
int64 limit = 3;
|
|
|
|
|
|
|
|
// Starting from the requested page
|
|
|
|
string next_page_token = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ObjectHistoryResponse {
|
|
|
|
// Object metadata without the raw bytes
|
2022-10-04 13:57:26 -05:00
|
|
|
repeated ObjectVersionInfo versions = 1;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// More results exist... pass this in the next request
|
|
|
|
string next_page_token = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
// List request/response
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
|
|
|
message ObjectSearchRequest {
|
|
|
|
// Starting from the requested page (other query parameters must match!)
|
|
|
|
string next_page_token = 1;
|
|
|
|
|
|
|
|
// Maximum number of items to return
|
|
|
|
int64 limit = 2;
|
|
|
|
|
|
|
|
// Free text query string -- mileage may vary :)
|
|
|
|
string query = 3;
|
|
|
|
|
|
|
|
// limit to a specific kind (empty is all)
|
|
|
|
repeated string kind = 4;
|
|
|
|
|
|
|
|
// Limit results to items in a specific folder
|
|
|
|
string folder = 5;
|
|
|
|
|
|
|
|
// Must match all labels
|
|
|
|
map<string,string> labels = 6;
|
|
|
|
|
|
|
|
// Sorting instructions `field ASC/DESC`
|
|
|
|
repeated string sort = 7;
|
|
|
|
|
2022-10-05 20:46:17 -05:00
|
|
|
// Return the full body in each payload
|
|
|
|
bool with_body = 8;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// Return the full body in each payload
|
2022-10-05 20:46:17 -05:00
|
|
|
bool with_labels = 9;
|
|
|
|
|
|
|
|
// Return the full body in each payload
|
|
|
|
bool with_fields = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Search result metadata for each object
|
|
|
|
message ObjectSearchResult {
|
|
|
|
// Unique ID
|
|
|
|
string UID = 1;
|
|
|
|
|
|
|
|
// Identify the object kind. This kind will be used to apply a schema to the body and
|
|
|
|
// will trigger additional indexing behavior.
|
|
|
|
string kind = 2;
|
|
|
|
|
|
|
|
// The current veresion of this object
|
|
|
|
string version = 3;
|
|
|
|
|
|
|
|
// Time in epoch milliseconds that the object was updated
|
|
|
|
int64 updated = 4;
|
|
|
|
|
|
|
|
// Who updated the object
|
|
|
|
string updated_by = 5;
|
|
|
|
|
|
|
|
// Optionally include the full object body
|
|
|
|
bytes body = 6;
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
// Derived from body in the summary
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
// Always included
|
|
|
|
string name = 7;
|
|
|
|
|
|
|
|
// Always included
|
|
|
|
string description = 8;
|
|
|
|
|
|
|
|
// The structured labels
|
|
|
|
map<string,string> labels = 9;
|
|
|
|
|
|
|
|
// Optionally include extracted JSON
|
2022-10-06 14:48:53 -05:00
|
|
|
bytes fields_json = 10;
|
2022-10-05 20:46:17 -05:00
|
|
|
|
|
|
|
// ObjectErrorInfo in json
|
2022-10-06 14:48:53 -05:00
|
|
|
bytes error_json = 11;
|
2022-09-30 00:18:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
message ObjectSearchResponse {
|
2022-10-05 20:46:17 -05:00
|
|
|
repeated ObjectSearchResult results = 1;
|
2022-09-30 00:18:15 -05:00
|
|
|
|
|
|
|
// More results exist... pass this in the next request
|
|
|
|
string next_page_token = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------
|
|
|
|
// Storage interface
|
|
|
|
//-----------------------------------------------
|
|
|
|
|
|
|
|
// This assumes a future grpc interface where the user info is passed in context, not in each message body
|
|
|
|
// for now it will only work with an admin API key
|
|
|
|
service ObjectStore {
|
|
|
|
rpc Read(ReadObjectRequest) returns (ReadObjectResponse);
|
|
|
|
rpc BatchRead(BatchReadObjectRequest) returns (BatchReadObjectResponse);
|
|
|
|
rpc Write(WriteObjectRequest) returns (WriteObjectResponse);
|
|
|
|
rpc Delete(DeleteObjectRequest) returns (DeleteObjectResponse);
|
|
|
|
rpc History(ObjectHistoryRequest) returns (ObjectHistoryResponse);
|
|
|
|
rpc Search(ObjectSearchRequest) returns (ObjectSearchResponse);
|
|
|
|
|
|
|
|
// Ideally an additional search endpoint with more flexibility to limit what you actually care about
|
|
|
|
// https://github.com/grafana/grafana-plugin-sdk-go/blob/main/proto/backend.proto#L129
|
|
|
|
// rpc SearchEX(ObjectSearchRequest) returns (DataResponse);
|
|
|
|
}
|