Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## TODO1. Alibaba Cloud NoSQL(MongoDB)

- Alibaba Cloud NoSQL (MongoDB) 지원 추가

### 적용 기능 범위

- Generate
- Backup
- Restore
- Migration

### 적용 범위

- Web UI
- Backend API

### 참고사항

- Alibaba Cloud MongoDB 는 NCloud 에서 제공하는 MongoDB 와 동일 한 형식으로 제공

27 changes: 22 additions & 5 deletions config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ func NewNCPMongoDBClient(username, password, host string, port int) (*mongo.Clie
return mongo.Connect(context.Background(), newNCPMongoDBConfig(username, password, host, port))
}

func newAlibabaMongoDBConfig(username, password, host string, port int) *options.ClientOptions {
dc := true
return &options.ClientOptions{
Auth: &options.Credential{
Username: username,
Password: password,
},
Direct: &dc,
Hosts: []string{fmt.Sprintf("%s:%d", host, port)},
}
}

func NewAlibabaMongoDBClient(username, password, host string, port int) (*mongo.Client, error) {
if err := validateInputs(&username, &password, &host, &port); err != nil {
return nil, err
}
return mongo.Connect(context.Background(), newAlibabaMongoDBConfig(username, password, host, port))
}

func NewS3Client(accesskey, secretkey, region string) (*s3.Client, error) {
cfg, err := newAWSConfig(accesskey, secretkey, region)
if err != nil {
Expand Down Expand Up @@ -160,15 +179,13 @@ func NewGCPClient(credentialsJson string) (*storage.Client, error) {
return client, nil
}

func NewAlibabaClient(endpoint, region, accessKey, secretKey string) (*oss.Client, error) {
if endpoint == "" {
return nil, errors.New("endpoint is required")
}
func NewAlibabaClient(region, accessKey, secretKey string) (*oss.Client, error) {

if accessKey == "" || secretKey == "" {
return nil, errors.New("accessKey and secretKey are required")
}
cfg := oss.LoadDefaultConfig().
WithEndpoint(endpoint).
WithEndpoint("https://oss-" + region + ".aliyuncs.com").
WithCredentialsProvider(osscred.NewStaticCredentialsProvider(accessKey, secretKey)).
WithRegion(region).
WithRetryMaxAttempts(5)
Expand Down
Loading
Loading