syntax = "proto3";

package global.nextgen.v1;

import "google/api/field_behavior.proto";
import "google/protobuf/empty.proto";

service TiDBGroupService {
  rpc CreateTiDBGroup(CreateTiDBGroupRequest) returns (TiDBGroup) {}
  rpc DeleteTiDBGroup(DeleteTiDBGroupRequest) returns (google.protobuf.Empty) {}
}

message DeleteTiDBGroupRequest {
  uint64 cluster_id = 1 [(google.api.field_behavior) = REQUIRED];
  uint64 tidb_group_id = 2 [(google.api.field_behavior) = REQUIRED];
}

message TiDBGroup {
  uint64 id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  uint64 cluster_id = 2 [(google.api.field_behavior) = REQUIRED];
  // Currently, only rebuilding DefaultGroup is supported; this field cannot be specified.
  string display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  string dns_identity = 4 [(google.api.field_behavior) = OPTIONAL];
  // if the dns is migrated from Dedicated, set this to true so that the public dns identity is empty.
  // final dns e.g. tidb.{gateway_identity}.tidbcloud.com
  bool disable_public_dns_identity = 5 [(google.api.field_behavior) = OPTIONAL];
}

message CreateTiDBGroupRequest {
  TiDBGroup tidb_group = 1 [(google.api.field_behavior) = REQUIRED];
}
