Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add backend logic for extra-conn-params (#15344)
Vincent Huange22e2dccfc40
diff --git a/backend/component/dbfactory/dbfactory.go b/backend/component/dbfactory/dbfactory.goindex 34a3b183ce..3b926c8c4d 100644--- a/backend/component/dbfactory/dbfactory.go+++ b/backend/component/dbfactory/dbfactory.go@@ -150,30 +150,31 @@ func (d *DBFactory) GetDataSourceDriver(ctx context.Context, instance *store.InsSslCert: sslCert,SslKey: sslKey,},- Host: dataSource.Host,- Port: dataSource.Port,- Database: databaseName,- DataShare: datashare,- SRV: dataSource.SRV,- AuthenticationDatabase: dataSource.AuthenticationDatabase,- SID: dataSource.SID,- ServiceName: dataSource.ServiceName,- SSHConfig: sshConfig,- ReadOnly: readOnly,- ConnectionContext: connectionContext,- AuthenticationPrivateKey: authenticationPrivateKey,- AuthenticationType: dataSource.AuthenticationType,- SASLConfig: dbSaslConfig,- AdditionalAddresses: dataSource.AdditionalAddresses,- ReplicaSet: dataSource.ReplicaSet,- DirectConnection: dataSource.DirectConnection,- Region: dataSource.Region,- WarehouseID: dataSource.WarehouseID,- RedisType: dataSource.RedisType,- MasterName: dataSource.MasterName,- MasterUsername: dataSource.MasterUsername,- MasterPassword: masterPassword,- MaximumSQLResultSize: maximumSQLResultSize,+ Host: dataSource.Host,+ Port: dataSource.Port,+ Database: databaseName,+ DataShare: datashare,+ SRV: dataSource.SRV,+ AuthenticationDatabase: dataSource.AuthenticationDatabase,+ SID: dataSource.SID,+ ServiceName: dataSource.ServiceName,+ SSHConfig: sshConfig,+ ReadOnly: readOnly,+ ConnectionContext: connectionContext,+ AuthenticationPrivateKey: authenticationPrivateKey,+ AuthenticationType: dataSource.AuthenticationType,+ SASLConfig: dbSaslConfig,+ AdditionalAddresses: dataSource.AdditionalAddresses,+ ReplicaSet: dataSource.ReplicaSet,+ DirectConnection: dataSource.DirectConnection,+ Region: dataSource.Region,+ WarehouseID: dataSource.WarehouseID,+ RedisType: dataSource.RedisType,+ MasterName: dataSource.MasterName,+ MasterUsername: dataSource.MasterUsername,+ MasterPassword: masterPassword,+ ExtraConnectionParameters: dataSource.ExtraConnectionParameters,+ MaximumSQLResultSize: maximumSQLResultSize,},)if err != nil {diff --git a/backend/plugin/db/driver.go b/backend/plugin/db/driver.goindex 16e9a9b192..b08f8dc5c5 100644--- a/backend/plugin/db/driver.go+++ b/backend/plugin/db/driver.go@@ -201,6 +201,10 @@ type ConnectionConfig struct {MasterUsername stringMasterPassword string+ // ExtraConnectionParameters contains additional parameters to include in connection strings+ // For example, "target_session_attrs=read-write" for Postgres HA clusters+ ExtraConnectionParameters map[string]string+// The maximum number of bytes for sql results in response body.MaximumSQLResultSize int64}diff --git a/backend/plugin/db/pg/pg.go b/backend/plugin/db/pg/pg.goindex 5bf0a66513..74602fbebb 100644--- a/backend/plugin/db/pg/pg.go+++ b/backend/plugin/db/pg/pg.go@@ -158,6 +158,13 @@ func getPGConnectionConfig(config db.ConnectionConfig) (*pgx.ConnConfig, error)sslMode := getSSLMode(config.TLSConfig, config.SSHConfig)connStr += fmt.Sprintf(" sslmode=%s", sslMode)+ // Add target_session_attrs=read-write if specified in ExtraConnectionParameters+ if len(config.ExtraConnectionParameters) > 0 {+ for key, value := range config.ExtraConnectionParameters {+ connStr += fmt.Sprintf(" %s=%s", key, value)+ }+ }+connConfig, err := pgx.ParseConfig(connStr)if err != nil {return nil, errdiff --git a/backend/store/data_source.go b/backend/store/data_source.goindex b7522dfc2b..5d34e61c92 100644--- a/backend/store/data_source.go+++ b/backend/store/data_source.go@@ -55,6 +55,8 @@ type DataSourceMessage struct {MasterName stringMasterUsername stringMasterObfuscatedPassword string+ // Extra connection parameters+ ExtraConnectionParameters map[string]string}// FindDataSourceMessage is the message for finding a database.@@ -101,6 +103,7 @@ func (m *DataSourceMessage) Copy() *DataSourceMessage {MasterName: m.MasterName,MasterUsername: m.MasterUsername,MasterObfuscatedPassword: m.MasterObfuscatedPassword,+ ExtraConnectionParameters: m.ExtraConnectionParameters,}}@@ -235,6 +238,7 @@ func (*Store) listInstanceDataSourceMap(ctx context.Context, tx *Tx, find *FindDdataSourceMessage.MasterName = dataSourceOptions.MasterNamedataSourceMessage.MasterObfuscatedPassword = dataSourceOptions.MasterObfuscatedPassworddataSourceMessage.MasterUsername = dataSourceOptions.MasterUsername+ dataSourceMessage.ExtraConnectionParameters = dataSourceOptions.ExtraConnectionParametersinstanceDataSourcesMap[instanceID] = append(instanceDataSourcesMap[instanceID], &dataSourceMessage)}if err := rows.Err(); err != nil {@@ -506,6 +510,7 @@ func (*Store) addDataSourceToInstanceImplV2(ctx context.Context, tx *Tx, instancMasterName: dataSource.MasterName,MasterUsername: dataSource.MasterName,MasterObfuscatedPassword: dataSource.MasterObfuscatedPassword,+ ExtraConnectionParameters: dataSource.ExtraConnectionParameters,}protoBytes, err := protojson.Marshal(&dataSourceOptions)if err != nil {diff --git a/frontend/src/types/dataSource.ts b/frontend/src/types/dataSource.tsindex d0d6204ca8..7c97041751 100644--- a/frontend/src/types/dataSource.ts+++ b/frontend/src/types/dataSource.ts@@ -15,4 +15,7 @@ export interface DataSourceOptions {sshPassword: string;sshPrivateKey: string;authenticationPrivateKey: string;+ // Extra connection parameters for the database connection string+ // For PostgreSQL HA, this can be used to set target_session_attrs=read-write+ extraConnectionParameters?: { [key: string]: string };}diff --git a/frontend/src/types/proto/store/data_source.ts b/frontend/src/types/proto/store/data_source.tsindex beeae71fae..797dc58d67 100644--- a/frontend/src/types/proto/store/data_source.ts+++ b/frontend/src/types/proto/store/data_source.ts@@ -265,6 +265,11 @@ export interface DataSourceOptions {useSsl: boolean;/** Cluster is the cluster name for the data source. Used by CockroachDB. */cluster: string;+ /**+ * Extra connection parameters for the database connection.+ * For PostgreSQL HA, this can be used to set target_session_attrs=read-write+ */+ extraConnectionParameters: { [key: string]: string };}export enum DataSourceOptions_AuthenticationType {@@ -408,6 +413,11 @@ export interface DataSourceOptions_Address {port: string;}+export interface DataSourceOptions_ExtraConnectionParametersEntry {+ key: string;+ value: string;+}+export interface SASLConfig {krbConfig?: KerberosConfig | undefined;}@@ -753,6 +763,7 @@ function createBaseDataSourceOptions(): DataSourceOptions {redisType: DataSourceOptions_RedisType.REDIS_TYPE_UNSPECIFIED,useSsl: false,cluster: "",+ extraConnectionParameters: {},};}@@ -833,6 +844,10 @@ export const DataSourceOptions: MessageFns<DataSourceOptions> = {if (message.cluster !== "") {writer.uint32(202).string(message.cluster);}+ Object.entries(message.extraConnectionParameters).forEach(([key, value]) => {+ DataSourceOptions_ExtraConnectionParametersEntry.encode({ key: key as any, value }, writer.uint32(218).fork())+ .join();+ });return writer;},@@ -1043,6 +1058,17 @@ export const DataSourceOptions: MessageFns<DataSourceOptions> = {message.cluster = reader.string();continue;}+ case 27: {+ if (tag !== 218) {+ break;+ }++ const entry27 = DataSourceOptions_ExtraConnectionParametersEntry.decode(reader, reader.uint32());+ if (entry27.value !== undefined) {+ message.extraConnectionParameters[entry27.key] = entry27.value;+ }+ continue;+ }}if ((tag & 7) === 4 || tag === 0) {break;@@ -1097,6 +1123,12 @@ export const DataSourceOptions: MessageFns<DataSourceOptions> = {: DataSourceOptions_RedisType.REDIS_TYPE_UNSPECIFIED,useSsl: isSet(object.useSsl) ? globalThis.Boolean(object.useSsl) : false,cluster: isSet(object.cluster) ? globalThis.String(object.cluster) : "",+ extraConnectionParameters: isObject(object.extraConnectionParameters)+ ? Object.entries(object.extraConnectionParameters).reduce<{ [key: string]: string }>((acc, [key, value]) => {+ acc[key] = String(value);+ return acc;+ }, {})+ : {},};},@@ -1177,6 +1209,15 @@ export const DataSourceOptions: MessageFns<DataSourceOptions> = {if (message.cluster !== "") {obj.cluster = message.cluster;}+ if (message.extraConnectionParameters) {+ const entries = Object.entries(message.extraConnectionParameters);+ if (entries.length > 0) {+ obj.extraConnectionParameters = {};+ entries.forEach(([k, v]) => {+ obj.extraConnectionParameters[k] = v;+ });+ }+ }return obj;},@@ -1219,6 +1260,14 @@ export const DataSourceOptions: MessageFns<DataSourceOptions> = {message.redisType = object.redisType ?? DataSourceOptions_RedisType.REDIS_TYPE_UNSPECIFIED;message.useSsl = object.useSsl ?? false;message.cluster = object.cluster ?? "";+ message.extraConnectionParameters = Object.entries(object.extraConnectionParameters ?? {}).reduce<+ { [key: string]: string }+ >((acc, [key, value]) => {+ if (value !== undefined) {+ acc[key] = globalThis.String(value);+ }+ return acc;+ }, {});return message;},};@@ -1391,6 +1440,91 @@ export const DataSourceOptions_Address: MessageFns<DataSourceOptions_Address> =},};+function createBaseDataSourceOptions_ExtraConnectionParametersEntry(): DataSourceOptions_ExtraConnectionParametersEntry {+ return { key: "", value: "" };+}++export const DataSourceOptions_ExtraConnectionParametersEntry: MessageFns<+ DataSourceOptions_ExtraConnectionParametersEntry+> = {+ encode(+ message: DataSourceOptions_ExtraConnectionParametersEntry,+ writer: BinaryWriter = new BinaryWriter(),+ ): BinaryWriter {+ if (message.key !== "") {+ writer.uint32(10).string(message.key);+ }+ if (message.value !== "") {+ writer.uint32(18).string(message.value);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): DataSourceOptions_ExtraConnectionParametersEntry {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseDataSourceOptions_ExtraConnectionParametersEntry();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.key = reader.string();+ continue;+ }+ case 2: {+ if (tag !== 18) {+ break;+ }++ message.value = reader.string();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): DataSourceOptions_ExtraConnectionParametersEntry {+ return {+ key: isSet(object.key) ? globalThis.String(object.key) : "",+ value: isSet(object.value) ? globalThis.String(object.value) : "",+ };+ },++ toJSON(message: DataSourceOptions_ExtraConnectionParametersEntry): unknown {+ const obj: any = {};+ if (message.key !== "") {+ obj.key = message.key;+ }+ if (message.value !== "") {+ obj.value = message.value;+ }+ return obj;+ },++ create(+ base?: DeepPartial<DataSourceOptions_ExtraConnectionParametersEntry>,+ ): DataSourceOptions_ExtraConnectionParametersEntry {+ return DataSourceOptions_ExtraConnectionParametersEntry.fromPartial(base ?? {});+ },+ fromPartial(+ object: DeepPartial<DataSourceOptions_ExtraConnectionParametersEntry>,+ ): DataSourceOptions_ExtraConnectionParametersEntry {+ const message = createBaseDataSourceOptions_ExtraConnectionParametersEntry();+ message.key = object.key ?? "";+ message.value = object.value ?? "";+ return message;+ },+};+function createBaseSASLConfig(): SASLConfig {return { krbConfig: undefined };}@@ -1640,6 +1774,10 @@ export type DeepPartial<T> = T extends Builtin ? T: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }: Partial<T>;+function isObject(value: any): boolean {+ return typeof value === "object" && value !== null;+}+function isSet(value: any): boolean {return value !== null && value !== undefined;}diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex e7624d894f..85e400e398 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -65,6 +65,7 @@- [DataSourceOptions](#bytebase-store-DataSourceOptions)- [DataSourceOptions.Address](#bytebase-store-DataSourceOptions-Address)- [DataSourceOptions.ClientSecretCredential](#bytebase-store-DataSourceOptions-ClientSecretCredential)+ - [DataSourceOptions.ExtraConnectionParametersEntry](#bytebase-store-DataSourceOptions-ExtraConnectionParametersEntry)- [KerberosConfig](#bytebase-store-KerberosConfig)- [SASLConfig](#bytebase-store-SASLConfig)@@ -1183,6 +1184,7 @@ Metadata about the request.| redis_type | [DataSourceOptions.RedisType](#bytebase-store-DataSourceOptions-RedisType) | | || use_ssl | [bool](#bool) | | Use SSL to connect to the data source. By default, we use system default SSL configuration. || cluster | [string](#string) | | Cluster is the cluster name for the data source. Used by CockroachDB. |+| extra_connection_parameters | [DataSourceOptions.ExtraConnectionParametersEntry](#bytebase-store-DataSourceOptions-ExtraConnectionParametersEntry) | repeated | Extra connection parameters for the database connection. For PostgreSQL HA, this can be used to set target_session_attrs=read-write |@@ -1222,6 +1224,22 @@ Metadata about the request.+<a name="bytebase-store-DataSourceOptions-ExtraConnectionParametersEntry"></a>++### DataSourceOptions.ExtraConnectionParametersEntry++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| key | [string](#string) | | |+| value | [string](#string) | | |++++++<a name="bytebase-store-KerberosConfig"></a>### KerberosConfigdiff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 480d95ef75..189d25b12f 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -423,6 +423,10 @@<a href="#bytebase.store.DataSourceOptions.ClientSecretCredential"><span class="badge">M</span>DataSourceOptions.ClientSecretCredential</a></li>+ <li>+ <a href="#bytebase.store.DataSourceOptions.ExtraConnectionParametersEntry"><span class="badge">M</span>DataSourceOptions.ExtraConnectionParametersEntry</a>+ </li>+<li><a href="#bytebase.store.KerberosConfig"><span class="badge">M</span>KerberosConfig</a></li>@@ -3600,6 +3604,14 @@ Used for authentication when connecting to the data source. </p></td><td><p>Cluster is the cluster name for the data source. Used by CockroachDB. </p></td></tr>+ <tr>+ <td>extra_connection_parameters</td>+ <td><a href="#bytebase.store.DataSourceOptions.ExtraConnectionParametersEntry">DataSourceOptions.ExtraConnectionParametersEntry</a></td>+ <td>repeated</td>+ <td><p>Extra connection parameters for the database connection.+For PostgreSQL HA, this can be used to set target_session_attrs=read-write </p></td>+ </tr>+</tbody></table>@@ -3676,6 +3688,37 @@ Used for authentication when connecting to the data source. </p></td>+ <h3 id="bytebase.store.DataSourceOptions.ExtraConnectionParametersEntry">DataSourceOptions.ExtraConnectionParametersEntry</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>key</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>value</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>+++++<h3 id="bytebase.store.KerberosConfig">KerberosConfig</h3><p></p>diff --git a/proto/generated-go/store/data_source.pb.go b/proto/generated-go/store/data_source.pb.goindex 17e800d629..00771cb467 100644--- a/proto/generated-go/store/data_source.pb.go+++ b/proto/generated-go/store/data_source.pb.go@@ -465,9 +465,12 @@ type DataSourceOptions struct {// Use SSL to connect to the data source. By default, we use system default SSL configuration.UseSsl bool `protobuf:"varint,24,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"`// Cluster is the cluster name for the data source. Used by CockroachDB.- Cluster string `protobuf:"bytes,25,opt,name=cluster,proto3" json:"cluster,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ Cluster string `protobuf:"bytes,25,opt,name=cluster,proto3" json:"cluster,omitempty"`+ // Extra connection parameters for the database connection.+ // For PostgreSQL HA, this can be used to set target_session_attrs=read-write+ ExtraConnectionParameters map[string]string `protobuf:"bytes,27,rep,name=extra_connection_parameters,json=extraConnectionParameters,proto3" json:"extra_connection_parameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *DataSourceOptions) Reset() {@@ -684,6 +687,13 @@ func (x *DataSourceOptions) GetCluster() string {return ""}+func (x *DataSourceOptions) GetExtraConnectionParameters() map[string]string {+ if x != nil {+ return x.ExtraConnectionParameters+ }+ return nil+}+type isDataSourceOptions_IamExtension interface {isDataSourceOptions_IamExtension()}@@ -1095,7 +1105,7 @@ var file_store_data_source_proto_rawDesc = string([]byte{0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12,0x09, 0x0a, 0x05, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x56, 0x41,0x55, 0x4c, 0x54, 0x5f, 0x41, 0x50, 0x50, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x42, 0x0d,- 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x96, 0x0d,+ 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xe7, 0x0e,0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69,0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x72, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,0x52, 0x03, 0x73, 0x72, 0x76, 0x12, 0x37, 0x0a, 0x17, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,@@ -1176,54 +1186,67 @@ var file_store_data_source_proto_rawDesc = string([]byte{0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x73, 0x73, 0x6c, 0x18,0x18, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x53, 0x73, 0x6c, 0x12, 0x18, 0x0a,0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,- 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x1a, 0x77, 0x0a, 0x16, 0x43, 0x6c, 0x69, 0x65, 0x6e,- 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,- 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1b,- 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63,- 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74,- 0x1a, 0x31, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68,- 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12,- 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70,- 0x6f, 0x72, 0x74, 0x22, 0x7c, 0x0a, 0x12, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x55, 0x54,- 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50,- 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x41, 0x53,- 0x53, 0x57, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x47, 0x4f, 0x4f, 0x47, 0x4c,- 0x45, 0x5f, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x5f, 0x53, 0x51, 0x4c, 0x5f, 0x49, 0x41, 0x4d, 0x10,- 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x57, 0x53, 0x5f, 0x52, 0x44, 0x53, 0x5f, 0x49, 0x41, 0x4d,- 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x49, 0x41, 0x4d, 0x10,- 0x04, 0x22, 0x52, 0x0a, 0x09, 0x52, 0x65, 0x64, 0x69, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a,- 0x0a, 0x16, 0x52, 0x45, 0x44, 0x49, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53,- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x54,- 0x41, 0x4e, 0x44, 0x41, 0x4c, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x45,- 0x4e, 0x54, 0x49, 0x4e, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x55, 0x53,- 0x54, 0x45, 0x52, 0x10, 0x03, 0x42, 0x0f, 0x0a, 0x0d, 0x69, 0x61, 0x6d, 0x5f, 0x65, 0x78, 0x74,- 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x41, 0x53, 0x4c, 0x43, 0x6f,- 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3f, 0x0a, 0x0a, 0x6b, 0x72, 0x62, 0x5f, 0x63, 0x6f, 0x6e, 0x66,- 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4b, 0x65, 0x72, 0x62, 0x65, 0x72,- 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x72, 0x62, 0x43,- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x0b, 0x0a, 0x09, 0x6d, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x69,- 0x73, 0x6d, 0x22, 0xe0, 0x01, 0x0a, 0x0e, 0x4b, 0x65, 0x72, 0x62, 0x65, 0x72, 0x6f, 0x73, 0x43,- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79,- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x12,- 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72,- 0x65, 0x61, 0x6c, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x65, 0x61, 0x6c,- 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x74, 0x61, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28,- 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x74, 0x61, 0x62, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x64, 0x63,- 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x64, 0x63,- 0x48, 0x6f, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x64, 0x63, 0x5f, 0x70, 0x6f, 0x72, 0x74,- 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x64, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x12,- 0x34, 0x0a, 0x16, 0x6b, 0x64, 0x63, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74,- 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,- 0x14, 0x6b, 0x64, 0x63, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f,- 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,- 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x33,+ 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x80, 0x01, 0x0a, 0x1b, 0x65, 0x78, 0x74, 0x72,+ 0x61, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x72,+ 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x44,+ 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,+ 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,+ 0x19, 0x65, 0x78, 0x74, 0x72, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x77, 0x0a, 0x16, 0x43, 0x6c,+ 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e,+ 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69,+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49,+ 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x23,+ 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18,+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63,+ 0x72, 0x65, 0x74, 0x1a, 0x31, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12,+ 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f,+ 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x4c, 0x0a, 0x1e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x43,+ 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74,+ 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,+ 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,+ 0x3a, 0x02, 0x38, 0x01, 0x22, 0x7c, 0x0a, 0x12, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,+ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x55,+ 0x54, 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53,+ 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x41,+ 0x53, 0x53, 0x57, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x47, 0x4f, 0x4f, 0x47,+ 0x4c, 0x45, 0x5f, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x5f, 0x53, 0x51, 0x4c, 0x5f, 0x49, 0x41, 0x4d,+ 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x57, 0x53, 0x5f, 0x52, 0x44, 0x53, 0x5f, 0x49, 0x41,+ 0x4d, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x49, 0x41, 0x4d,+ 0x10, 0x04, 0x22, 0x52, 0x0a, 0x09, 0x52, 0x65, 0x64, 0x69, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12,+ 0x1a, 0x0a, 0x16, 0x52, 0x45, 0x44, 0x49, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x53,+ 0x54, 0x41, 0x4e, 0x44, 0x41, 0x4c, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x53,+ 0x45, 0x4e, 0x54, 0x49, 0x4e, 0x45, 0x4c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x55,+ 0x53, 0x54, 0x45, 0x52, 0x10, 0x03, 0x42, 0x0f, 0x0a, 0x0d, 0x69, 0x61, 0x6d, 0x5f, 0x65, 0x78,+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x41, 0x53, 0x4c, 0x43,+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3f, 0x0a, 0x0a, 0x6b, 0x72, 0x62, 0x5f, 0x63, 0x6f, 0x6e,+ 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4b, 0x65, 0x72, 0x62, 0x65,+ 0x72, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x72, 0x62,+ 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x0b, 0x0a, 0x09, 0x6d, 0x65, 0x63, 0x68, 0x61, 0x6e,+ 0x69, 0x73, 0x6d, 0x22, 0xe0, 0x01, 0x0a, 0x0e, 0x4b, 0x65, 0x72, 0x62, 0x65, 0x72, 0x6f, 0x73,+ 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72,+ 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79,+ 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05,+ 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x65, 0x61,+ 0x6c, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x74, 0x61, 0x62, 0x18, 0x04, 0x20, 0x01,+ 0x28, 0x0c, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x74, 0x61, 0x62, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x64,+ 0x63, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x64,+ 0x63, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x64, 0x63, 0x5f, 0x70, 0x6f, 0x72,+ 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x64, 0x63, 0x50, 0x6f, 0x72, 0x74,+ 0x12, 0x34, 0x0a, 0x16, 0x6b, 0x64, 0x63, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72,+ 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,+ 0x52, 0x14, 0x6b, 0x64, 0x63, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72,+ 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61,+ 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72,+ 0x6f, 0x74, 0x6f, 0x33,})var (@@ -1239,7 +1262,7 @@ func file_store_data_source_proto_rawDescGZIP() []byte {}var file_store_data_source_proto_enumTypes = make([]protoimpl.EnumInfo, 5)-var file_store_data_source_proto_msgTypes = make([]protoimpl.MessageInfo, 7)+var file_store_data_source_proto_msgTypes = make([]protoimpl.MessageInfo, 8)var file_store_data_source_proto_goTypes = []any{(DataSourceExternalSecret_SecretType)(0), // 0: bytebase.store.DataSourceExternalSecret.SecretType(DataSourceExternalSecret_AuthType)(0), // 1: bytebase.store.DataSourceExternalSecret.AuthType@@ -1253,6 +1276,7 @@ var file_store_data_source_proto_goTypes = []any{(*DataSourceExternalSecret_AppRoleAuthOption)(nil), // 9: bytebase.store.DataSourceExternalSecret.AppRoleAuthOption(*DataSourceOptions_ClientSecretCredential)(nil), // 10: bytebase.store.DataSourceOptions.ClientSecretCredential(*DataSourceOptions_Address)(nil), // 11: bytebase.store.DataSourceOptions.Address+ nil, // 12: bytebase.store.DataSourceOptions.ExtraConnectionParametersEntry}var file_store_data_source_proto_depIdxs = []int32{0, // 0: bytebase.store.DataSourceExternalSecret.secret_type:type_name -> bytebase.store.DataSourceExternalSecret.SecretType@@ -1264,13 +1288,14 @@ var file_store_data_source_proto_depIdxs = []int32{7, // 6: bytebase.store.DataSourceOptions.sasl_config:type_name -> bytebase.store.SASLConfig11, // 7: bytebase.store.DataSourceOptions.additional_addresses:type_name -> bytebase.store.DataSourceOptions.Address4, // 8: bytebase.store.DataSourceOptions.redis_type:type_name -> bytebase.store.DataSourceOptions.RedisType- 8, // 9: bytebase.store.SASLConfig.krb_config:type_name -> bytebase.store.KerberosConfig- 2, // 10: bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.type:type_name -> bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType- 11, // [11:11] is the sub-list for method output_type- 11, // [11:11] is the sub-list for method input_type- 11, // [11:11] is the sub-list for extension type_name- 11, // [11:11] is the sub-list for extension extendee- 0, // [0:11] is the sub-list for field type_name+ 12, // 9: bytebase.store.DataSourceOptions.extra_connection_parameters:type_name -> bytebase.store.DataSourceOptions.ExtraConnectionParametersEntry+ 8, // 10: bytebase.store.SASLConfig.krb_config:type_name -> bytebase.store.KerberosConfig+ 2, // 11: bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.type:type_name -> bytebase.store.DataSourceExternalSecret.AppRoleAuthOption.SecretType+ 12, // [12:12] is the sub-list for method output_type+ 12, // [12:12] is the sub-list for method input_type+ 12, // [12:12] is the sub-list for extension type_name+ 12, // [12:12] is the sub-list for extension extendee+ 0, // [0:12] is the sub-list for field type_name}func init() { file_store_data_source_proto_init() }@@ -1294,7 +1319,7 @@ func file_store_data_source_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_data_source_proto_rawDesc), len(file_store_data_source_proto_rawDesc)),NumEnums: 5,- NumMessages: 7,+ NumMessages: 8,NumExtensions: 0,NumServices: 0,},diff --git a/proto/store/data_source.proto b/proto/store/data_source.protoindex 707117916b..484c28cddb 100644--- a/proto/store/data_source.proto+++ b/proto/store/data_source.proto@@ -143,6 +143,10 @@ message DataSourceOptions {// Cluster is the cluster name for the data source. Used by CockroachDB.string cluster = 25;++ // Extra connection parameters for the database connection.+ // For PostgreSQL HA, this can be used to set target_session_attrs=read-write+ map<string, string> extra_connection_parameters = 27;}message SASLConfig {