| 497 | } |
| 498 | |
| 499 | func convertV1DataSource(dataSource *v1pb.DataSource) (*storepb.DataSource, error) { |
| 500 | dsType, err := convertV1DataSourceType(dataSource.Type) |
| 501 | if err != nil { |
| 502 | return nil, err |
| 503 | } |
| 504 | externalSecret, err := convertV1DataSourceExternalSecret(dataSource.ExternalSecret) |
| 505 | if err != nil { |
| 506 | return nil, err |
| 507 | } |
| 508 | saslConfig := convertV1DataSourceSaslConfig(dataSource.SaslConfig) |
| 509 | |
| 510 | storeDataSource := &storepb.DataSource{ |
| 511 | Id: dataSource.Id, |
| 512 | Type: dsType, |
| 513 | Username: dataSource.Username, |
| 514 | Password: dataSource.Password, |
| 515 | SslCa: dataSource.SslCa, |
| 516 | SslCert: dataSource.SslCert, |
| 517 | SslKey: dataSource.SslKey, |
| 518 | SslCaPath: dataSource.SslCaPath, |
| 519 | SslCertPath: dataSource.SslCertPath, |
| 520 | SslKeyPath: dataSource.SslKeyPath, |
| 521 | Host: dataSource.Host, |
| 522 | Port: dataSource.Port, |
| 523 | Database: dataSource.Database, |
| 524 | Srv: dataSource.Srv, |
| 525 | AuthenticationDatabase: dataSource.AuthenticationDatabase, |
| 526 | Sid: dataSource.Sid, |
| 527 | ServiceName: dataSource.ServiceName, |
| 528 | SshHost: dataSource.SshHost, |
| 529 | SshPort: dataSource.SshPort, |
| 530 | SshUser: dataSource.SshUser, |
| 531 | SshPassword: dataSource.SshPassword, |
| 532 | SshPrivateKey: dataSource.SshPrivateKey, |
| 533 | AuthenticationPrivateKey: dataSource.AuthenticationPrivateKey, |
| 534 | AuthenticationPrivateKeyPassphrase: dataSource.AuthenticationPrivateKeyPassphrase, |
| 535 | ExternalSecret: externalSecret, |
| 536 | SaslConfig: saslConfig, |
| 537 | AuthenticationType: convertV1AuthenticationType(dataSource.AuthenticationType), |
| 538 | AdditionalAddresses: convertAdditionalAddresses(dataSource.AdditionalAddresses), |
| 539 | ReplicaSet: dataSource.ReplicaSet, |
| 540 | DirectConnection: dataSource.DirectConnection, |
| 541 | Region: dataSource.Region, |
| 542 | WarehouseId: dataSource.WarehouseId, |
| 543 | UseSsl: dataSource.UseSsl, |
| 544 | VerifyTlsCertificate: dataSource.VerifyTlsCertificate, |
| 545 | RedisType: convertV1RedisType(dataSource.RedisType), |
| 546 | CloudSqlIpType: convertV1CloudSQLIPType(dataSource.CloudSqlIpType), |
| 547 | MasterName: dataSource.MasterName, |
| 548 | MasterUsername: dataSource.MasterUsername, |
| 549 | MasterPassword: dataSource.MasterPassword, |
| 550 | ExtraConnectionParameters: dataSource.ExtraConnectionParameters, |
| 551 | } |
| 552 | |
| 553 | switch dataSource.AuthenticationType { |
| 554 | case v1pb.DataSource_AZURE_IAM: |
| 555 | if azureCredential := dataSource.GetAzureCredential(); azureCredential != nil { |
| 556 | storeDataSource.IamExtension = &storepb.DataSource_AzureCredential_{ |