forked from aws-samples/aurora-dsql-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_multi_region.go
44 lines (35 loc) · 1.12 KB
/
create_multi_region.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"context"
dsql "github.com/aws/aws-sdk-go-v2/service/dsql"
"github.com/aws/aws-sdk-go-v2/service/dsql/types"
)
func CreateMultiRegionCluster(client *dsql.Client) (clustersStatus *dsql.CreateMultiRegionClustersOutput, err error) {
deleteProtection := false
witnessRegion := "us-west-2"
usEast1Props := types.LinkedClusterProperties{
DeletionProtectionEnabled: &deleteProtection,
Tags: map[string]string{
"Name": "us-east-1-go-example-cluster",
"Usercase": "testing-mr-use1",
},
}
usEast2Props := types.LinkedClusterProperties{
DeletionProtectionEnabled: &deleteProtection,
Tags: map[string]string{
"Name": "us-east-2-go-example-cluster",
"Usercase": "testing-mr-use2",
},
}
clusterProperties := map[string]types.LinkedClusterProperties{
"us-east-1": usEast1Props,
"us-east-2": usEast2Props,
}
input := dsql.CreateMultiRegionClustersInput{
LinkedRegionList: []string{"us-east-1", "us-east-2"},
WitnessRegion: &witnessRegion,
ClusterProperties: clusterProperties,
}
clustersStatus, err = client.CreateMultiRegionClusters(context.Background(), &input)
return
}