Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add aws-iam via OpenSearch-go-client (#16985)

Vincent Huanga98e786fb2ee
diff --git a/backend/plugin/db/elasticsearch/elasticsearch.go b/backend/plugin/db/elasticsearch/elasticsearch.go
index 30d05cd458..444f489492 100644
--- a/backend/plugin/db/elasticsearch/elasticsearch.go
+++ b/backend/plugin/db/elasticsearch/elasticsearch.go
@@ -3,12 +3,10 @@ package elasticsearch
import (
"bytes"
"context"
- "crypto/sha256"
"crypto/tls"
"crypto/x509"
"database/sql"
"encoding/base64"
- "encoding/hex"
"encoding/json"
"fmt"
"io"
@@ -17,10 +15,11 @@ import (
"strings"
"time"
- "github.com/aws/aws-sdk-go-v2/aws"
- v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" //nolint:revive
awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/elastic/go-elasticsearch/v7"
+ opensearch "github.com/opensearch-project/opensearch-go/v4"
+ "github.com/opensearch-project/opensearch-go/v4/opensearchapi"
+ "github.com/opensearch-project/opensearch-go/v4/signer/awsv2"
"github.com/pkg/errors"
"google.golang.org/protobuf/types/known/durationpb"
@@ -43,9 +42,15 @@ var (
)
type Driver struct {
- typedClient *elasticsearch.Client
+ // For Elasticsearch
+ typedClient *elasticsearch.Client
+ // For OpenSearch
+ opensearchClient *opensearch.Client
+ opensearchAPI *opensearchapi.Client
+ // Common basic auth client for REST operations
basicAuthClient *BasicAuthClient
config db.ConnectionConfig
+ isOpenSearch bool
}
type BasicAuthClient struct {
@@ -56,7 +61,16 @@ type BasicAuthClient struct {
func (client *BasicAuthClient) Do(method string, route []byte, queryString []byte) (*http.Response, error) {
address := client.addrScheduler.GetNewAddress()
- req, err := http.NewRequest(method, fmt.Sprintf("%s%s", address, string(route)), bytes.NewReader(queryString))
+
+ // Parse base URL and join with route path
+ baseURL, err := url.Parse(address)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to parse base URL")
+ }
+
+ fullURL := baseURL.JoinPath(string(route)).String()
+
+ req, err := http.NewRequest(method, fullURL, bytes.NewReader(queryString))
if err != nil {
return nil, errors.Wrapf(err, "failed to init a HTTP request")
}
@@ -82,69 +96,31 @@ func (scheduler *AddressScheduler) GetNewAddress() string {
return address
}
-// sigV4RoundTripper implements http.RoundTripper with AWS SigV4 signing
-type sigV4RoundTripper struct {
- signer *v4.Signer
- credentials aws.CredentialsProvider
- region string
- service string
- wrapped http.RoundTripper
-}
-
-func (rt *sigV4RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
- // Clone request to avoid mutating the original
- signedReq := req.Clone(req.Context())
-
- // Read and hash the body
- var bodyBytes []byte
- if req.Body != nil {
- bodyBytes, _ = io.ReadAll(req.Body)
- req.Body = io.NopCloser(bytes.NewReader(bodyBytes))
- signedReq.Body = io.NopCloser(bytes.NewReader(bodyBytes))
- }
-
- // Calculate payload hash
- h := sha256.New()
- h.Write(bodyBytes)
- payloadHash := hex.EncodeToString(h.Sum(nil))
-
- // Get credentials
- creds, err := rt.credentials.Retrieve(req.Context())
- if err != nil {
- return nil, errors.Wrap(err, "failed to retrieve AWS credentials")
- }
-
- // Sign the request
- err = rt.signer.SignHTTP(req.Context(), creds, signedReq,
- payloadHash, rt.service, rt.region, time.Now())
- if err != nil {
- return nil, errors.Wrap(err, "failed to sign request")
- }
-
- return rt.wrapped.RoundTrip(signedReq)
-}
-
func (*Driver) Open(ctx context.Context, _ storepb.Engine, config db.ConnectionConfig) (db.Driver, error) {
address := fmt.Sprintf("%s:%s", config.DataSource.Host, config.DataSource.Port)
- u, err := url.Parse(address)
- if err != nil || u.Host == "" {
+
+ // Check if address already has a protocol
+ if !strings.HasPrefix(address, "http://") && !strings.HasPrefix(address, "https://") {
protocol := "http"
if config.DataSource.GetUseSsl() {
protocol = "https"
}
+ // AWS OpenSearch always requires HTTPS (port 443)
+ // Even if UseSsl is false, AWS managed services enforce HTTPS
+ if config.DataSource.GetAuthenticationType() == storepb.DataSource_AWS_RDS_IAM {
+ protocol = "https"
+ }
address = fmt.Sprintf("%s://%s", protocol, address)
+ }
- if _, err := url.Parse(address); err != nil {
- return nil, errors.Wrapf(err, "failed to parse address: %v", address)
- }
+ if _, err := url.Parse(address); err != nil {
+ return nil, errors.Wrapf(err, "failed to parse address: %v", address)
}
- // Check if AWS IAM authentication is requested
if config.DataSource.GetAuthenticationType() == storepb.DataSource_AWS_RDS_IAM {
- return openWithAWSAuth(ctx, config, address)
+ return openWithOpenSearchClient(ctx, config, address)
}
- // Existing basic auth implementation
return openWithBasicAuth(ctx, config, address)
}
@@ -155,7 +131,7 @@ func openWithBasicAuth(_ context.Context, config db.ConnectionConfig, address st
Addresses: []string{address},
Transport: &http.Transport{
MaxIdleConnsPerHost: 10,
- ResponseHeaderTimeout: time.Second,
+ ResponseHeaderTimeout: 5 * time.Second,
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
InsecureSkipVerify: true,
@@ -212,65 +188,111 @@ func openWithBasicAuth(_ context.Context, config db.ConnectionConfig, address st
}, nil
}
-func openWithAWSAuth(ctx context.Context, config db.ConnectionConfig, address string) (db.Driver, error) {
- // Validate AWS-specific requirements
- if config.DataSource.GetRegion() == "" {
- return nil, errors.New("region is required for AWS IAM authentication")
- }
+func openWithOpenSearchClient(ctx context.Context, config db.ConnectionConfig, address string) (db.Driver, error) {
+ // Keep debugInfo for error messages
+ debugInfo := fmt.Sprintf("OpenSearch config - address: %s, authType: %v", address, config.DataSource.GetAuthenticationType())
- // Load AWS configuration
- awsCfg, err := awsconfig.LoadDefaultConfig(ctx,
- awsconfig.WithRegion(config.DataSource.GetRegion()),
- )
- if err != nil {
- return nil, errors.Wrap(err, "failed to load AWS config")
- }
-
- // Create base transport with TLS config
baseTransport := &http.Transport{
MaxIdleConnsPerHost: 10,
- ResponseHeaderTimeout: time.Second,
+ ResponseHeaderTimeout: 5 * time.Second, // Increase timeout for AWS
TLSClientConfig: &tls.Config{
- MinVersion: tls.VersionTLS12,
+ MinVersion: tls.VersionTLS12,
+ InsecureSkipVerify: true,
},
}
+ osConfig := opensearch.Config{
+ Addresses: []string{address},
+ Transport: baseTransport,
+ }
+
+ // Configure authentication
+ switch config.DataSource.GetAuthenticationType() {
+ case storepb.DataSource_AWS_RDS_IAM:
+ // Validate AWS-specific requirements
+ if config.DataSource.GetRegion() == "" {
+ return nil, errors.New("region is required for AWS IAM authentication")
+ }
+
+ // Load AWS configuration
+ awsCfg, err := awsconfig.LoadDefaultConfig(ctx,
+ awsconfig.WithRegion(config.DataSource.GetRegion()),
+ )
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to load AWS config")
+ }
+
+ // Verify credentials are available
+ _, err = awsCfg.Credentials.Retrieve(ctx)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to retrieve AWS credentials")
+ }
+
+ // Create AWS signer
+ signer, err := awsv2.NewSigner(awsCfg)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to create AWS signer")
+ }
+
+ osConfig.Signer = signer
+
+ default:
+ // Basic auth
+ osConfig.Username = config.DataSource.Username
+ osConfig.Password = config.Password
+ }
+
// Add custom CA if provided
if config.DataSource.GetSslCert() != "" {
certPool := x509.NewCertPool()
if ok := certPool.AppendCertsFromPEM([]byte(config.DataSource.GetSslCert())); !ok {
return nil, errors.New("cannot add CA cert to pool")
}
+ // Update the base transport, not the debug transport
baseTransport.TLSClientConfig.RootCAs = certPool
+ baseTransport.TLSClientConfig.InsecureSkipVerify = false
}
- // Create SigV4 transport
- sigV4Transport := &sigV4RoundTripper{
- signer: v4.NewSigner(),
- credentials: awsCfg.Credentials,
- region: config.DataSource.GetRegion(),
- service: "es", // AWS OpenSearch uses "es" service name
- wrapped: baseTransport,
+ // Create OpenSearch client
+ osClient, err := opensearch.NewClient(osConfig)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to create OpenSearch client; %s", debugInfo)
+ }
+
+ // Create OpenSearch API client
+ apiClient, err := opensearchapi.NewClient(opensearchapi.Config{
+ Client: osConfig,
+ })
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to create OpenSearch API client; %s", debugInfo)
}
- // Create HTTP client with SigV4 transport
+ // For consistency, still create a basic auth client for REST operations
httpClient := &http.Client{
- Transport: sigV4Transport,
+ Transport: osConfig.Transport,
+ }
+
+ basicAuthString := ""
+ // For AWS IAM, we don't use basic auth - the AWS signer handles authentication
+ if config.DataSource.GetAuthenticationType() != storepb.DataSource_AWS_RDS_IAM &&
+ config.DataSource.Username != "" && config.Password != "" {
+ encodedUsrAndPasswd := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", config.DataSource.Username, config.Password)))
+ basicAuthString = fmt.Sprintf("Basic %s", string(encodedUsrAndPasswd))
}
- // Create basic auth client that will use the SigV4 HTTP client
- // Note: basicAuthString will be empty but the structure is reused
return &Driver{
- typedClient: nil, // Will use basicAuthClient for AWS IAM mode
+ opensearchClient: osClient,
+ opensearchAPI: apiClient,
basicAuthClient: &BasicAuthClient{
httpClient: httpClient,
addrScheduler: &AddressScheduler{
addresses: []string{address},
count: 0,
},
- basicAuthString: "", // No basic auth header needed for AWS IAM
+ basicAuthString: basicAuthString,
},
- config: config,
+ config: config,
+ isOpenSearch: true,
}, nil
}
@@ -280,8 +302,37 @@ func (*Driver) Close(_ context.Context) error {
}
func (d *Driver) Ping(_ context.Context) error {
- // For AWS IAM mode, use basicAuthClient
- if d.typedClient == nil && d.basicAuthClient != nil {
+ if d.isOpenSearch && d.opensearchAPI != nil {
+ ctx := context.Background()
+ info, err := d.opensearchAPI.Info(ctx, &opensearchapi.InfoReq{})
+ if err != nil {
+ // Check if it's an authentication or connection issue
+ errStr := err.Error()
+ if strings.Contains(errStr, "401") || strings.Contains(errStr, "403") {
+ return errors.Errorf("authentication failed: %v", err)
+ }
+ if strings.Contains(errStr, "404") {
+ return errors.Errorf("endpoint not found (check if path is correct): %v", err)
+ }
+ // For any other error, return the full error
+ return errors.Wrapf(err, "failed to connect to OpenSearch")
+ }
+ if info == nil || info.Version.Number == "" {
+ return errors.New("invalid response from server")
+ }
+ return nil
+ }
+
+ // Use Elasticsearch client
+ if d.typedClient != nil {
+ if _, err := d.typedClient.Ping(); err != nil {
+ return errors.Wrapf(err, "failed to ping db")
+ }
+ return nil
+ }
+
+ // Fallback to basic auth client
+ if d.basicAuthClient != nil {
resp, err := d.basicAuthClient.Do("GET", []byte("/"), nil)
if err != nil {
return errors.Wrapf(err, "failed to ping db")
@@ -295,11 +346,7 @@ func (d *Driver) Ping(_ context.Context) error {
return nil
}
- // Existing typed client logic
- if _, err := d.typedClient.Ping(); err != nil {
- return errors.Wrapf(err, "failed to ping db")
- }
- return nil
+ return errors.New("no client available for ping")
}
func (d *Driver) Execute(ctx context.Context, statement string, _ db.ExecuteOptions) (int64, error) {
@@ -332,9 +379,34 @@ func (d *Driver) QueryConn(_ context.Context, _ *sql.Conn, statement string, _ d
data = append(data, []byte(item)...)
data = append(data, '\n')
}
- resp, err := d.basicAuthClient.Do(request.Method, []byte(request.URL), data)
- if err != nil {
- return errors.Wrapf(err, "failed to send HTTP request")
+ var resp *http.Response
+
+ // For AWS IAM auth, we need to use the OpenSearch client which has the signer
+ if d.isOpenSearch && d.opensearchClient != nil && d.config.DataSource.GetAuthenticationType() == storepb.DataSource_AWS_RDS_IAM {
+ // Create request for OpenSearch client
+ // Ensure the path starts with "/" for proper HTTP request
+ requestPath := strings.TrimSpace(request.URL)
+ if requestPath != "" && !strings.HasPrefix(requestPath, "/") {
+ requestPath = "/" + requestPath
+ }
+
+ req, err := http.NewRequest(request.Method, requestPath, bytes.NewReader(data))
+ if err != nil {
+ return errors.Wrapf(err, "failed to create HTTP request")
+ }
+ req.Header.Set("Content-Type", "application/json")
+
+ // Use OpenSearch client's Perform method which handles AWS signing
+ resp, err = d.opensearchClient.Perform(req)
+ if err != nil {
+ return errors.Wrapf(err, "failed to send HTTP request via OpenSearch client")
+ }
+ } else {
+ // For basic auth, use the basic auth client as before
+ resp, err = d.basicAuthClient.Do(request.Method, []byte(request.URL), data)
+ if err != nil {
+ return errors.Wrapf(err, "failed to send HTTP request")
+ }
}
defer resp.Body.Close()
@@ -348,6 +420,12 @@ func (d *Driver) QueryConn(_ context.Context, _ *sql.Conn, statement string, _ d
var row v1pb.QueryRow
contentType := resp.Header.Get("Content-Type")
+
+ // Debug HTML responses
+ if strings.Contains(contentType, "text/html") && resp.StatusCode >= 400 {
+ return errors.Errorf("received HTML error response (status %d): %s", resp.StatusCode, string(respBytes))
+ }
+
switch {
case strings.Contains(contentType, "application/json"):
pairs := map[string]any{}
diff --git a/backend/plugin/db/elasticsearch/role.go b/backend/plugin/db/elasticsearch/role.go
index aa09d02357..f9bd87d042 100644
--- a/backend/plugin/db/elasticsearch/role.go
+++ b/backend/plugin/db/elasticsearch/role.go
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "io"
"log/slog"
"net/http"
"strings"
@@ -19,14 +20,40 @@ type UserResult struct {
}
func (d *Driver) getInstanceRoles() ([]*storepb.InstanceRole, error) {
- resp, err := esapi.SecurityGetUserRequest{Pretty: true}.Do(context.Background(), d.typedClient)
- if err != nil {
- return nil, err
- }
+ var bytes []byte
+
+ if d.isOpenSearch && d.opensearchClient != nil {
+ resp, err := d.basicAuthClient.Do("GET", []byte("/_plugins/_security/api/internalusers"), nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ bytes, err = io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, err
+ }
+ } else if d.typedClient != nil {
+ resp, err := esapi.SecurityGetUserRequest{Pretty: true}.Do(context.Background(), d.typedClient)
+ if err != nil {
+ return nil, err
+ }
- bytes, err := readBytesAndClose(resp)
- if err != nil {
- return nil, err
+ bytes, err = readBytesAndClose(resp)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ resp, err := d.basicAuthClient.Do("GET", []byte("/_security/user"), nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ bytes, err = io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, err
+ }
}
var instanceRoles []*storepb.InstanceRole
@@ -51,17 +78,22 @@ func (d *Driver) getInstanceRoles() ([]*storepb.InstanceRole, error) {
}
func (d *Driver) getUserPrivileges(usrName string) (string, error) {
- header := http.Header{}
- header.Add("Authorization", d.config.DataSource.GetAuthenticationPrivateKey())
- header.Add("es-security-runas-user", usrName)
- resp, err := esapi.SecurityGetUserPrivilegesRequest{Header: header}.Do(context.Background(), d.typedClient)
- if err != nil {
- return "", err
- }
+ if d.isOpenSearch && d.opensearchClient != nil {
+ return "", nil
+ } else if d.typedClient != nil {
+ header := http.Header{}
+ header.Add("Authorization", d.config.DataSource.GetAuthenticationPrivateKey())
+ header.Add("es-security-runas-user", usrName)
+ resp, err := esapi.SecurityGetUserPrivilegesRequest{Header: header}.Do(context.Background(), d.typedClient)
+ if err != nil {
+ return "", err
+ }
- bytes, err := readBytesAndClose(resp)
- if err != nil {
- return "", err
+ bytes, err := readBytesAndClose(resp)
+ if err != nil {
+ return "", err
+ }
+ return string(bytes), nil
}
- return string(bytes), nil
+ return "", nil
}
diff --git a/backend/plugin/db/elasticsearch/sync.go b/backend/plugin/db/elasticsearch/sync.go
index 4b8a1f8775..b7c0390039 100644
--- a/backend/plugin/db/elasticsearch/sync.go
+++ b/backend/plugin/db/elasticsearch/sync.go
@@ -3,14 +3,14 @@ package elasticsearch
import (
"context"
"encoding/json"
+ "io"
+ "net/http"
"regexp"
"strconv"
"strings"
- "io"
- "net/http"
-
"github.com/elastic/go-elasticsearch/v7/esapi"
+ "github.com/opensearch-project/opensearch-go/v4/opensearchapi"
"github.com/pkg/errors"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
@@ -18,19 +18,16 @@ import (
)
func (d *Driver) SyncInstance(ctx context.Context) (*db.InstanceMetadata, error) {
- // version.
- version, err := d.getVerison()
+ version, err := d.getVersion()
if err != nil {
return nil, errors.Wrapf(err, "failed to fetch version from Elasticsearch server")
}
- // databases.
dbMetadata, err := d.SyncDBSchema(ctx)
if err != nil {
return nil, errors.Wrapf(err, "failed to fetch indices from Elasticsearch server")
}
- // roles.
instanceRoles, err := d.getInstanceRoles()
if err != nil {
return nil, err
@@ -69,7 +66,15 @@ type VersionResult struct {
} `json:"version"`
}
-func (d *Driver) getVerison() (string, error) {
+func (d *Driver) getVersion() (string, error) {
+ if d.isOpenSearch && d.opensearchAPI != nil {
+ ctx := context.Background()
+ info, err := d.opensearchAPI.Info(ctx, &opensearchapi.InfoReq{})
+ if err != nil {
+ return "", err
+ }
+ return info.Version.Number, nil
+ }
resp, err := d.basicAuthClient.Do("GET", []byte("/"), nil)
if err != nil {
return "", err
@@ -80,9 +85,6 @@ func (d *Driver) getVerison() (string, error) {
if err != nil {
return "", err
}
- if err := resp.Body.Close(); err != nil {
- return "", err
- }
var result VersionResult
err = json.Unmarshal(bytes, &result)
@@ -100,20 +102,88 @@ type IndicesResult struct {
}
func (d *Driver) getIndices() ([]*storepb.TableMetadata, error) {
- // GET _cat/indices.
- res, err := esapi.CatIndicesRequest{Format: "json", Pretty: true}.Do(context.Background(), d.typedClient)
+ var indicesMetadata []*storepb.TableMetadata
+
+ if d.isOpenSearch && d.opensearchAPI != nil {
+ ctx := context.Background()
+ resp, err := d.opensearchAPI.Cat.Indices(ctx, &opensearchapi.CatIndicesReq{})
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to list indices")
+ }
+
+ for _, idx := range resp.Indices {
+ var datasize int64
+ if idx.StoreSize != nil {
+ datasize, err = unitConversion(*idx.StoreSize)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ var docCount int64
+ if idx.DocsCount != nil {
+ docCount = int64(*idx.DocsCount)
+ }
+
+ indicesMetadata = append(indicesMetadata, &storepb.TableMetadata{
+ Name: idx.Index,
+ DataSize: datasize,
+ RowCount: docCount,
+ })
+ }
+ return indicesMetadata, nil
+ } else if d.typedClient != nil {
+ res, err := esapi.CatIndicesRequest{Format: "json", Pretty: true}.Do(context.Background(), d.typedClient)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to list indices")
+ }
+
+ bytes, err := readBytesAndClose(res)
+ if err != nil {
+ return nil, err
+ }
+
+ var results []IndicesResult
+ if err := json.Unmarshal(bytes, &results); err != nil {
+ return nil, err
+ }
+
+ for _, m := range results {
+ // index size.
+ datasize, err := unitConversion(m.IndexSize)
+ if err != nil {
+ return nil, err
+ }
+
+ // document count.
+ docCount, err := strconv.Atoi(m.DocsCount)
+ if err != nil {
+ return nil, err
+ }
+
+ indicesMetadata = append(indicesMetadata, &storepb.TableMetadata{
+ Name: m.Index,
+ DataSize: datasize,
+ RowCount: int64(docCount),
+ })
+ }
+ return indicesMetadata, nil
+ }
+
+ // Fallback to basic auth client
+ resp, err := d.basicAuthClient.Do("GET", []byte("/_cat/indices?format=json&pretty"), nil)
if err != nil {
return nil, errors.Wrapf(err, "failed to list indices")
}
+ defer resp.Body.Close()
- bytes, err := readBytesAndClose(res)
+ bytes, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var results []IndicesResult
- var indicesMetadata []*storepb.TableMetadata
if err := json.Unmarshal(bytes, &results); err != nil {
return nil, err
}
diff --git a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue
index 0dd41d749d..20549286fb 100644
--- a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue
+++ b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue
@@ -13,7 +13,8 @@
basicInfo.engine === Engine.MYSQL ||
basicInfo.engine === Engine.POSTGRES ||
basicInfo.engine === Engine.COSMOSDB ||
- basicInfo.engine === Engine.MSSQL
+ basicInfo.engine === Engine.MSSQL ||
+ basicInfo.engine === Engine.ELASTICSEARCH
"
class="mt-2 sm:col-span-3 sm:col-start-1"
>
@@ -42,6 +43,20 @@
</NRadio>
</NRadioGroup>
</template>
+ <template v-else-if="basicInfo.engine === Engine.ELASTICSEARCH">
+ <NRadioGroup
+ v-model:value="dataSource.authenticationType"
+ class="textlabel"
+ :disabled="!allowEdit"
+ >
+ <NRadio :value="DataSource_AuthenticationType.PASSWORD">
+ {{ $t("instance.password-type.password") }}
+ </NRadio>
+ <NRadio :value="DataSource_AuthenticationType.AWS_RDS_IAM">
+ {{ $t("instance.password-type.aws-iam") }}
+ </NRadio>
+ </NRadioGroup>
+ </template>
<template v-else>
<NRadioGroup
v-model:value="dataSource.authenticationType"
diff --git a/go.mod b/go.mod
index e1fac93511..31d27fea05 100644
--- a/go.mod
+++ b/go.mod
@@ -76,6 +76,7 @@ require (
github.com/mattn/go-sqlite3 v1.14.28
github.com/microsoft/go-mssqldb v1.8.2
github.com/nyaruka/phonenumbers v1.6.3
+ github.com/opensearch-project/opensearch-go/v4 v4.5.0
github.com/paulmach/orb v0.11.1
github.com/pganalyze/pg_query_go/v6 v6.1.0
github.com/pingcap/tidb v1.1.0-beta.0.20241125141335-ec8b81b98edc
diff --git a/go.sum b/go.sum
index 77499d14ee..b5cdb7e87d 100644
--- a/go.sum
+++ b/go.sum
@@ -1512,6 +1512,8 @@ github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgr
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.1.13 h1:98S2srgG9vw0zWcDpFMn5TRrh8kLxa/5OFUstuUhmRs=
github.com/opencontainers/runc v1.1.13/go.mod h1:R016aXacfp/gwQBYw2FDGa9m+n6atbLWrYY8hNMT/sA=
+github.com/opensearch-project/opensearch-go/v4 v4.5.0 h1:26XckmmF6MhlXt91Bu1yY6R51jy1Ns/C3XgIfvyeTRo=
+github.com/opensearch-project/opensearch-go/v4 v4.5.0/go.mod h1:VmFc7dqOEM3ZtLhrpleOzeq+cqUgNabqQG5gX0xId64=
github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0=
github.com/opentracing/basictracer-go v1.1.0/go.mod h1:V2HZueSJEp879yv285Aap1BS69fQMD+MNP1mRs6mBQc=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
@@ -1698,7 +1700,15 @@ github.com/the42/cartconvert v0.0.0-20131203171324-aae784c392b8 h1:I4DY8wLxJXCrM
github.com/the42/cartconvert v0.0.0-20131203171324-aae784c392b8/go.mod h1:fWO/msnJVhHqN1yX6OBoxSyfj7TEj1hHiL8bJSQsK30=
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a h1:J/YdBZ46WKpXsxsW93SG+q0F8KI+yFrcIDT4c/RNoc4=
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a/go.mod h1:h4xBhSNtOeEosLJ4P7JyKXX7Cabg7AVkWCK5gV2vOrM=
+github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
+github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
+github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
+github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
+github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
+github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
+github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
+github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/tiendc/go-deepcopy v1.6.0 h1:0UtfV/imoCwlLxVsyfUd4hNHnB3drXsfle+wzSCA5Wo=
github.com/tiendc/go-deepcopy v1.6.0/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
github.com/tikv/client-go/v2 v2.0.8-0.20231116051730-1c2351c28173 h1:lmJzX0kqrV7kO21wrZPbtjkidzwbDCfXeQrhDWEi5dE=
@@ -1737,6 +1747,8 @@ github.com/vcaesar/tt v0.20.1 h1:D/jUeeVCNbq3ad8M7hhtB3J9x5RZ6I1n1eZ0BJp7M+4=
github.com/vcaesar/tt v0.20.1/go.mod h1:cH2+AwGAJm19Wa6xvEa+0r+sXDJBT0QgNQey6mwqLeU=
github.com/vjeantet/ldapserver v1.0.1 h1:3z+TCXhwwDLJC3pZCNbuECPDqC2x1R7qQQbswB1Qwoc=
github.com/vjeantet/ldapserver v1.0.1/go.mod h1:YvUqhu5vYhmbcLReMLrm/Tq3S7Yj43kSVFvvol6Lh6k=
+github.com/wI2L/jsondiff v0.7.0 h1:1lH1G37GhBPqCfp/lrs91rf/2j3DktX6qYAKZkLuCQQ=
+github.com/wI2L/jsondiff v0.7.0/go.mod h1:KAEIojdQq66oJiHhDyQez2x+sRit0vIzC9KeK0yizxM=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=