129 lines
3.3 KiB
Protocol Buffer
129 lines
3.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
package komp_ac.backup;
|
|
|
|
import "common.proto";
|
|
|
|
service BackupService {
|
|
rpc StartBackup(StartBackupRequest) returns (BackupOperationResponse);
|
|
rpc StartCheck(komp_ac.common.Empty) returns (BackupOperationResponse);
|
|
rpc StartDump(komp_ac.common.Empty) returns (BackupOperationResponse);
|
|
rpc GetBackupInfo(komp_ac.common.Empty) returns (BackupInfoResponse);
|
|
rpc GetOperationStatus(GetOperationStatusRequest) returns (BackupOperationResponse);
|
|
rpc ListDatabases(komp_ac.common.Empty) returns (ListDatabasesResponse);
|
|
rpc CreateDatabase(CreateDatabaseRequest) returns (DatabaseInfo);
|
|
rpc RunDatabaseMigrations(DatabaseRequest) returns (DatabaseInfo);
|
|
rpc ListDatabaseDumps(komp_ac.common.Empty) returns (ListDatabaseDumpsResponse);
|
|
rpc RestoreDatabase(RestoreDatabaseRequest) returns (DatabaseInfo);
|
|
}
|
|
|
|
message DatabaseRequest {
|
|
string database_name = 1;
|
|
}
|
|
|
|
message CreateDatabaseRequest {
|
|
string database_name = 1;
|
|
}
|
|
|
|
message RestoreDatabaseRequest {
|
|
string database_name = 1;
|
|
string dump_file_name = 2;
|
|
}
|
|
|
|
message DatabaseDumpInfo {
|
|
string file_name = 1;
|
|
int64 size_bytes = 2;
|
|
int64 modified_at_unix_seconds = 3;
|
|
bool readable = 4;
|
|
string permissions = 5;
|
|
string owner = 6;
|
|
}
|
|
|
|
message ListDatabaseDumpsResponse {
|
|
repeated DatabaseDumpInfo dumps = 1;
|
|
}
|
|
|
|
message DatabaseInfo {
|
|
string database_name = 1;
|
|
bool active = 2;
|
|
bool connectable = 3;
|
|
int64 size_bytes = 4;
|
|
int32 applied_migrations = 5;
|
|
int32 pending_migrations = 6;
|
|
bool migration_dirty = 7;
|
|
bool application_database = 8;
|
|
string status = 9;
|
|
bool empty = 10;
|
|
}
|
|
|
|
message ListDatabasesResponse {
|
|
string mode = 1;
|
|
repeated DatabaseInfo databases = 2;
|
|
}
|
|
|
|
enum BackupType {
|
|
BACKUP_TYPE_UNSPECIFIED = 0;
|
|
BACKUP_TYPE_FULL = 1;
|
|
BACKUP_TYPE_DIFF = 2;
|
|
BACKUP_TYPE_INCR = 3;
|
|
}
|
|
|
|
enum OperationKind {
|
|
OPERATION_KIND_UNSPECIFIED = 0;
|
|
OPERATION_KIND_BACKUP = 1;
|
|
OPERATION_KIND_CHECK = 2;
|
|
OPERATION_KIND_DUMP = 3;
|
|
}
|
|
|
|
enum OperationStatus {
|
|
OPERATION_STATUS_UNSPECIFIED = 0;
|
|
OPERATION_STATUS_RUNNING = 1;
|
|
OPERATION_STATUS_SUCCEEDED = 2;
|
|
OPERATION_STATUS_FAILED = 3;
|
|
}
|
|
|
|
message StartBackupRequest {
|
|
BackupType backup_type = 1;
|
|
}
|
|
|
|
message GetOperationStatusRequest {
|
|
string operation_id = 1;
|
|
}
|
|
|
|
message BackupOperationResponse {
|
|
string operation_id = 1;
|
|
OperationKind kind = 2;
|
|
OperationStatus status = 3;
|
|
string message = 4;
|
|
string output = 5;
|
|
int64 started_at_unix_seconds = 6;
|
|
int64 finished_at_unix_seconds = 7;
|
|
// Set when an operation produced a file, which today means a succeeded dump.
|
|
// The path is on the server host, not the caller's machine.
|
|
string artifact_path = 8;
|
|
string artifact_sha256 = 9;
|
|
}
|
|
|
|
message BackupInfoResponse {
|
|
reserved 6, 22, 23, 24;
|
|
bool success = 1;
|
|
string output = 2;
|
|
string server_version = 3;
|
|
string database_name = 4;
|
|
bool database_healthy = 5;
|
|
bool ecb_healthy = 7;
|
|
string ecb_status = 8;
|
|
string dump_directory = 9;
|
|
bool dump_directory_exists = 10;
|
|
bool dump_directory_readable = 11;
|
|
bool dump_directory_writable = 12;
|
|
string dump_directory_permissions = 13;
|
|
string dump_directory_owner = 14;
|
|
string postgres_data_directory = 15;
|
|
string database_user = 16;
|
|
string database_owner = 17;
|
|
bool database_user_owns_database = 18;
|
|
bool database_user_can_connect = 19;
|
|
bool database_user_can_create_database = 20;
|
|
string database_default_tablespace = 21;
|
|
}
|