github.com/franciscocpg/up@v0.1.10/platform/lambda/regions/regions.go (about)

     1  package regions
     2  
     3  import "path/filepath"
     4  
     5  // All regions.
     6  var All = []string{
     7  	"us-east-1",
     8  	"us-west-2",
     9  	"eu-west-1",
    10  	"eu-central-1",
    11  	"ap-northeast-1",
    12  	"ap-southeast-1",
    13  	"ap-southeast-2",
    14  	"us-east-2",
    15  	"us-west-1",
    16  	"ap-northeast-2",
    17  	"ap-south-1",
    18  	"sa-east-1",
    19  	"ca-central-1",
    20  }
    21  
    22  // Match returns regions matching the pattern(s) provided. Any
    23  // patern which does not match is returned so it may be validated
    24  // (aka it will fail validation).
    25  func Match(regions []string) (v []string) {
    26  	for _, pattern := range regions {
    27  		matched := false
    28  
    29  		for _, id := range All {
    30  			if ok, _ := filepath.Match(pattern, id); ok {
    31  				v = append(v, id)
    32  				matched = true
    33  			}
    34  		}
    35  
    36  		if !matched {
    37  			v = append(v, pattern)
    38  		}
    39  	}
    40  
    41  	return
    42  }