-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmulti_region.go
54 lines (46 loc) · 1.01 KB
/
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
45
46
47
48
49
50
51
52
53
54
package main
var asiaPac = []string{
"ap-south-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-southeast-1",
"ap-southeast-2",
}
var america = []string{
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
"ca-central-1",
"sa-east-1",
}
var europe = []string{
"eu-central-1",
"eu-west-1",
"eu-west-2",
"eu-west-3",
"eu-north-1",
}
// multiRegion will sort through comma seperated regions and make a slice of strings.
func multiRegion(reg string) []string {
var sliceReg []string
sliceInp := checkMultiInput(reg)
// Run through slice of inputs to concat all regions desired
for _, input := range sliceInp {
switch input {
case "AM":
sliceReg = append(sliceReg, america...)
case "AP":
sliceReg = append(sliceReg, asiaPac...)
case "EU":
sliceReg = append(sliceReg, europe...)
case "ALL":
asiaAmer := append(asiaPac, america...)
asiaAmerEur := append(asiaAmer, europe...)
sliceReg = append(sliceReg, asiaAmerEur...)
default:
sliceReg = append(sliceReg, input)
}
}
return sliceReg
}