github.com/webonyx/up@v0.7.4-0.20180808230834-91b94e551323/platform/aws/regions/regions.go (about) 1 // Package regions provides AWS region utilities. 2 package regions 3 4 import "path/filepath" 5 6 // IDs of regions. 7 var IDs = []string{ 8 "us-east-2", 9 "us-east-1", 10 "us-west-1", 11 "us-west-2", 12 "ap-south-1", 13 "ap-northeast-2", 14 "ap-southeast-1", 15 "ap-southeast-2", 16 "ap-northeast-1", 17 "ca-central-1", 18 "eu-central-1", 19 "eu-west-1", 20 "eu-west-2", 21 "eu-west-3", 22 "sa-east-1", 23 } 24 25 // Names of regions. 26 var Names = []string{ 27 "US East (Ohio)", 28 "US East (N. Virginia)", 29 "US West (N. California)", 30 "US West (Oregon)", 31 "Asia Pacific (Mumbai)", 32 "Asia Pacific (Seoul)", 33 "Asia Pacific (Singapore)", 34 "Asia Pacific (Sydney)", 35 "Asia Pacific (Tokyo)", 36 "Canada (Central)", 37 "EU (Frankfurt)", 38 "EU (Ireland)", 39 "EU (London)", 40 "EU (Paris)", 41 "South America (São Paulo)", 42 } 43 44 // Match returns regions matching the pattern(s) provided. Patterns 45 // which are not "expanded" are returned as-is. 46 func Match(regions []string) (v []string) { 47 for _, pattern := range regions { 48 matched := false 49 50 for _, id := range IDs { 51 if ok, _ := filepath.Match(pattern, id); ok { 52 v = append(v, id) 53 matched = true 54 } 55 } 56 57 if !matched { 58 v = append(v, pattern) 59 } 60 } 61 62 return 63 } 64 65 // GetIdByName returns a region id by name. 66 func GetIdByName(name string) string { 67 for i, n := range Names { 68 if n == name { 69 return IDs[i] 70 } 71 } 72 return "" 73 }