Skip to content

Commit

Permalink
Merge pull request #2687 from davidswu/remove-region-validation
Browse files Browse the repository at this point in the history
use aws sdk to validate regions
  • Loading branch information
dmcgowan authored Aug 20, 2018
2 parents 9bf62ca + 0b0d470 commit 633401c
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions registry/storage/driver/s3-aws/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"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/session"
"github.com/aws/aws-sdk-go/service/s3"
Expand Down Expand Up @@ -105,25 +106,11 @@ type DriverParameters struct {
}

func init() {
for _, region := range []string{
"us-east-1",
"us-east-2",
"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{}{}
partitions := endpoints.DefaultPartitions()
for _, p := range partitions {
for region := range p.Regions() {
validRegions[region] = struct{}{}
}
}

for _, objectACL := range []string{
Expand Down

0 comments on commit 633401c

Please sign in to comment.