syntax = "proto3";

package yandex.cloud.mdb.elasticsearch.v1;

import "google/api/annotations.proto";
import "yandex/cloud/api/operation.proto";
import "yandex/cloud/validation.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/elasticsearch/v1;elasticsearch";
option java_package = "yandex.cloud.api.mdb.elasticsearch.v1";

message AuthProviders {
  repeated AuthProvider providers = 1;
}

message AuthProvider {
  enum Type {
    TYPE_UNSPECIFIED = 0;
    NATIVE = 1;
    SAML = 2;
    // OPENID = 3;
    // ANONYMOUS = 4;
  }

  Type type = 1;
  string name = 2 [(length) = "<=50", (pattern) = "[a-z][a-z0-9_-]*"];
  int64 order = 3;
  bool enabled = 4;

  // selector ui settings
  bool hidden = 5;
  string description = 6 [(length) = "<=50"];
  string hint = 7 [(length) = "<=250"];
  string icon = 8 [(length) = "<=250"];

  oneof settings {
    SamlSettings saml = 9;
  }
}

message SamlSettings {
  string idp_entity_id = 1 [(length) = "<=250"]; 
  bytes idp_metadata_file = 2 [(length) = "<=10000"];

  string sp_entity_id = 3 [(length) = "<=250"];
  string kibana_url = 4 [(length) = "<=250"];

  string attribute_principal = 5 [(length) = "<=50"];
  string attribute_groups = 6 [(length) = "<=50"];
  string attribute_name = 7 [(length) = "<=50"];
  string attribute_email = 8 [(length) = "<=50"];  
  string attribute_dn = 9 [(length) = "<=50"];  
}
