syntax = "proto3";

package global.nextgen.v1;

import "global/nextgen/v1/endpoint.proto";
import "google/api/field_behavior.proto";

service PublicConnectionSettingService {
  rpc GetPublicConnectionSetting(GetPublicConnectionSettingRequest) returns (PublicConnectionSetting) {}
  rpc UpdatePublicConnectionSetting(UpdatePublicConnectionSettingRequest) returns (PublicConnectionSetting) {}
}

message PublicConnectionSetting {
  uint64 cluster_id = 1 [(google.api.field_behavior) = REQUIRED];
  uint64 tidb_group_id = 2 [(google.api.field_behavior) = OPTIONAL];
  optional bool enable = 3 [(google.api.field_behavior) = OPTIONAL];
  repeated Endpoint.IpAddress ip_allow_list = 4 [(google.api.field_behavior) = OPTIONAL];
  optional bool clear_ip_allow_list = 5 [(google.api.field_behavior) = OPTIONAL];
  repeated string egress_ips = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
}

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

message UpdatePublicConnectionSettingRequest {
  PublicConnectionSetting public_connection_setting = 1 [(google.api.field_behavior) = REQUIRED];
}
