use aws sdk to validate regions
Signed-off-by: David Wu <david.wu@docker.com>
This commit is contained in:
parent
9bf62ca7b3
commit
0b0d470281
1 changed files with 6 additions and 19 deletions
|
@ -31,6 +31,7 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
|
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
|
||||||
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/endpoints"
|
||||||
"github.com/aws/aws-sdk-go/aws/request"
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/s3"
|
"github.com/aws/aws-sdk-go/service/s3"
|
||||||
|
@ -105,26 +106,12 @@ type DriverParameters struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
for _, region := range []string{
|
partitions := endpoints.DefaultPartitions()
|
||||||
"us-east-1",
|
for _, p := range partitions {
|
||||||
"us-east-2",
|
for region := range p.Regions() {
|
||||||
"us-west-1",
|
|
||||||
"us-west-2",
|
|
||||||
"eu-west-1",
|
|
||||||
"eu-west-2",
|
|
||||||
"eu-central-1",
|
|
||||||
"ap-south-1",
|
|
||||||
"ap-southeast-1",
|
|
||||||
"ap-southeast-2",
|
|
||||||
"ap-northeast-1",
|
|
||||||
"ap-northeast-2",
|
|
||||||
"sa-east-1",
|
|
||||||
"cn-north-1",
|
|
||||||
"us-gov-west-1",
|
|
||||||
"ca-central-1",
|
|
||||||
} {
|
|
||||||
validRegions[region] = struct{}{}
|
validRegions[region] = struct{}{}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, objectACL := range []string{
|
for _, objectACL := range []string{
|
||||||
s3.ObjectCannedACLPrivate,
|
s3.ObjectCannedACLPrivate,
|
||||||
|
|
Loading…
Reference in a new issue