syntax = "proto3";

package cloud_service;

option java_package = "com.risingwave.proto";
option optimize_for = SPEED;

enum SourceType {
  UNSPECIFIED = 0;
  KAFKA = 1;
}

message RwCloudValidateSourceRequest {
  SourceType source_type = 1;
  map<string, string> source_config = 2;
}

message RwCloudValidateSourceResponse {
  enum ErrorType {
    UNSPECIFIED = 0;
    PRIVATELINK_CONNECTION_NOT_FOUND = 1;
    PRIVATELINK_UNAVAILABLE = 2;
    PRIVATELINK_RESOLVE_ERR = 3;
    KAFKA_INVALID_PROPERTIES = 4;
    KAFKA_TOPIC_NOT_FOUND = 5;
    KAFKA_BROKER_UNREACHABLE = 6;
    KAFKA_OTHER = 7;
    AWS_CLIENT_NOT_CONFIGURED = 8;
  }

  message Error {
    ErrorType error_type = 1;
    string error_message = 2;
  }

  bool ok = 1;
  // On validation failure, we return the error.
  Error error = 2;
}

service CloudService {
  rpc RwCloudValidateSource(RwCloudValidateSourceRequest) returns (RwCloudValidateSourceResponse);
}
