Skip to content

draft: db management protos #139

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions pkg/proto/ydbcp/v1alpha1/audit.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package ydbcp.v1alpha1;
option go_package = "github.com/ydb-platform/ydbcp/pkg/proto/ydbcp/v1alpha1;ydbcp";

import "google/protobuf/timestamp.proto";

message AuditInfo {
// Creator of the entity, YDBCP receives this info from the IAM.
string creator = 1;
// Timestamp when an entity was created.
google.protobuf.Timestamp created_at = 2;
// Timestamp when an entity was modified.
google.protobuf.Timestamp updated_at = 3;
// Timestamp when a corresponding operation was completed.
google.protobuf.Timestamp completed_at = 4;
}
55 changes: 55 additions & 0 deletions pkg/proto/ydbcp/v1alpha1/database.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
syntax = "proto3";

package ydbcp.v1alpha1;
option go_package = "github.com/ydb-platform/ydbcp/pkg/proto/ydbcp/v1alpha1;ydbcp";

import "google/protobuf/struct.proto";

import "ydbcp/v1alpha1/audit.proto";

message StorageUnit {
enum UnitKind {
ROT = 0;
ROT_ENCRYPTED = 1;
SSD = 2;
SSD_ENCRYPTED = 3;
}
UnitKind Kind = 1;
int64 Count = 2;
}

message ContainerResources {
int64 cpu_cores = 1;
int64 memory_bytes = 2;
}

message ComputeResources {
int64 nodes = 1;
repeated StorageUnit storage_units = 2;
ContainerResources container_resources = 3;
}

message DatabaseConfig {
google.protobuf.Struct config_data = 1;
}

enum DatabaseKind {
DEDICATED = 0;
SERVERLESS = 1;
}

message Database {
string id = 1;
DatabaseKind kind = 2;
string iam_region_id = 3;
string iam_container_id = 4;
string iam_folder_id = 5;
string database_name = 6;
string database_endpoint = 7;
string k8s_cluster = 8;
string k8s_namespace = 9;
string database_url = 10;
ComputeResources compute_resources = 11;
DatabaseConfig database_config = 13; //should it be here?
AuditInfo audit_info = 14;
}
57 changes: 57 additions & 0 deletions pkg/proto/ydbcp/v1alpha1/database_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
syntax = "proto3";

package ydbcp.v1alpha1;
option go_package = "github.com/ydb-platform/ydbcp/pkg/proto/ydbcp/v1alpha1;ydbcp";

import "ydbcp/v1alpha1/database.proto";
import "ydbcp/v1alpha1/operation.proto";
import "google/protobuf/duration.proto";

service DatabaseService {
rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse);

rpc GetDatabase(GetDatabaseRequest) returns (Database);

//rpc CreateDatabase(CreateDatabaseRequest) returns (Operation);

//should it accept CreateDatabaseRequest, or maybe Database?
rpc ImportDatabase(ImportDatabaseRequest) returns (Database);
}

message ListDatabasesRequest {
string container_id = 1;
string database_name_mask = 2;
uint32 page_size = 1000;
string page_token = 1001;
}

message ListDatabasesResponse {
repeated Database databases = 1;
string next_page_token = 2;
}

message GetDatabaseRequest {
string id = 1;
}

message CreateDatabaseRequest {
string iam_region_id = 1;
string iam_container_id = 2;
string iam_folder_id = 3;
string database_name = 4;
string database_endpoint = 5;
DatabaseKind kind = 6;
ComputeResources compute_resources = 7;
DatabaseConfig database_config = 8; //should it be here?
}

message ImportDatabaseRequest {
string iam_region_id = 1;
string iam_container_id = 2;
string iam_folder_id = 3;
string database_name = 4;
string database_endpoint = 5;
DatabaseKind kind = 6;
ComputeResources compute_resources = 7;
DatabaseConfig database_config = 8; //should it be here?
}
Loading