Permalink
...
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Open a pull request
18
contributors
Commits on Jan 16, 2015
Commits on Jan 17, 2015
Commits on Jan 18, 2015
Commits on Feb 10, 2015
Commits on Feb 12, 2015
Commits on Feb 28, 2015
Commits on Mar 01, 2015
Commits on Mar 02, 2015
Commits on Mar 05, 2015
Commits on Mar 12, 2015
Commits on Mar 17, 2015
Commits on Mar 19, 2015
Commits on Mar 24, 2015
Commits on Mar 25, 2015
Commits on Mar 26, 2015
Commits on Apr 03, 2015
Commits on May 06, 2015
Commits on May 22, 2015
Commits on Jun 04, 2015
Commits on Jun 25, 2015
Commits on Jun 26, 2015
Commits on Jun 27, 2015
Commits on Jun 29, 2015
Commits on Jun 30, 2015
Commits on Jul 02, 2015
Commits on Jul 22, 2015
Commits on Jul 24, 2015
Commits on Jul 27, 2015
Commits on Jul 28, 2015
Commits on Aug 03, 2015
Commits on Aug 04, 2015
Commits on Aug 05, 2015
Commits on Aug 07, 2015
Commits on Aug 08, 2015
Commits on Aug 09, 2015
Commits on Aug 10, 2015
Commits on Aug 20, 2015
Commits on Jan 15, 2016
Commits on Jan 21, 2016
Commits on Jan 25, 2016
Commits on Feb 02, 2016
Commits on Feb 19, 2016
Commits on Feb 22, 2016
Commits on Feb 24, 2016
Commits on Apr 18, 2016
Commits on Apr 20, 2016
Commits on Aug 18, 2016
Commits on Aug 19, 2016
Commits on Oct 06, 2016
Commits on Oct 19, 2016
Commits on Oct 20, 2016
Commits on Dec 15, 2016
Unified
Split
Showing
with
7,596 additions
and 3,126 deletions.
- +10 −0 .gitignore
- +1 −1 .travis.yml
- +1 −0 AUTHORS.md
- +1 −0 LICENSE
- +5 −5 README.md
- +1 −1 aws/attempt_test.go
- +126 −24 aws/aws.go
- +10 −1 aws/aws_test.go
- +158 −76 aws/sign.go
- +64 −6 aws/sign_test.go
- +83 −0 ec2/blockdevicemappings_test.go
- +96 −28 ec2/ec2.go
- +9 −4 ec2/ec2_test.go
- +13 −5 ec2/ec2i_test.go
- +355 −40 ec2/ec2t_test.go
- +71 −0 ec2/ec2test/account_attributes.go
- +97 −0 ec2/ec2test/availability_zones.go
- +85 −0 ec2/ec2test/block_devices.go
- +13 −0 ec2/ec2test/doc.go
- +16 −0 ec2/ec2test/export_test.go
- +8 −0 ec2/ec2test/filter.go
- +152 −0 ec2/ec2test/helpers.go
- +533 −0 ec2/ec2test/instances.go
- +92 −0 ec2/ec2test/interface_attachments.go
- +122 −0 ec2/ec2test/internet_gateways.go
- +113 −0 ec2/ec2test/internet_gateways_test.go
- +478 −0 ec2/ec2test/network_interfaces.go
- +110 −0 ec2/ec2test/private_ips.go
- +47 −0 ec2/ec2test/reservations.go
- +184 −0 ec2/ec2test/route_tables.go
- +154 −0 ec2/ec2test/route_tables_test.go
- +547 −0 ec2/ec2test/securty_groups.go
- +78 −2,075 ec2/ec2test/server.go
- +166 −0 ec2/ec2test/server_internals.go
- +267 −0 ec2/ec2test/subnets.go
- +129 −0 ec2/ec2test/subnets_test.go
- +122 −0 ec2/ec2test/tags.go
- +137 −0 ec2/ec2test/volume_attachments.go
- +192 −0 ec2/ec2test/volumes.go
- +284 −0 ec2/ec2test/vpcs.go
- +322 −0 ec2/ec2test/vpcs_test.go
- +61 −0 ec2/internet_gateways.go
- +64 −0 ec2/internet_gateways_test.go
- +326 −58 ec2/networkinterfaces_test.go
- +2 −2 ec2/privateips_test.go
- +166 −1 ec2/responses_test.go
- +119 −0 ec2/route_tables.go
- +118 −0 ec2/route_tables_test.go
- +22 −0 ec2/subnets.go
- +27 −10 ec2/subnets_test.go
- +188 −0 ec2/volumes.go
- +358 −0 ec2/volumes_test.go
- +2 −2 ec2/vpc_test.go
- +1 −1 exp/mturk/export_test.go
- +1 −1 exp/mturk/mturk.go
- +3 −3 exp/mturk/mturk_test.go
- +1 −1 exp/mturk/sign.go
- +2 −2 exp/mturk/sign_test.go
- +1 −1 exp/sdb/export_test.go
- +1 −1 exp/sdb/sdb.go
- +4 −4 exp/sdb/sdb_test.go
- +1 −1 exp/sdb/sign.go
- +2 −2 exp/sdb/sign_test.go
- +1 −1 exp/sns/sign.go
- +1 −1 exp/sns/sns.go
- +4 −4 exp/sns/sns_test.go
- +1 −1 iam/iam.go
- +4 −4 iam/iam_test.go
- +3 −3 iam/iami_test.go
- +4 −4 iam/iamt_test.go
- +1 −1 iam/iamtest/server.go
- +1 −1 iam/sign.go
- +7 −5 s3/export_test.go
- +223 −131 s3/multi.go
- +31 −20 s3/multi_test.go
- +231 −238 s3/s3.go
- +75 −38 s3/s3_test.go
- +82 −63 s3/s3i_test.go
- +3 −7 s3/s3t_test.go
- +1 −1 s3/s3test/server.go
- +0 −113 s3/sign.go
- +0 −133 s3/sign_test.go
- +1 −1 testutil/suite.go
View
10
.gitignore
| @@ -0,0 +1,10 @@ | ||
| +tags | ||
| +!tags/ | ||
| +TAGS | ||
| +!TAGS/ | ||
| +.emacs.desktop | ||
| +.emacs.desktop.lock | ||
| +*.test | ||
| +*.sw[nop] | ||
| +cover | ||
| +.#* |
View
2
.travis.yml
| @@ -10,7 +10,7 @@ install: | ||
| before_script: | ||
| - export DEFAULT_TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR | ||
| - - export TRAVIS_BUILD_DIR=$HOME/gopath/src/gopkg.in/amz.v2 | ||
| + - export TRAVIS_BUILD_DIR=$HOME/gopath/src/gopkg.in/amz.v3 | ||
| - mkdir -p $TRAVIS_BUILD_DIR | ||
| - mv -vfT $DEFAULT_TRAVIS_BUILD_DIR $TRAVIS_BUILD_DIR | ||
View
1
AUTHORS.md
| @@ -12,6 +12,7 @@ Please, keep the list sorted. | ||
| Full name | E-mail | GitHub account | ||
| ----------|--------|--------------- | ||
| +Alexander Surma | surma {at} surmair.de | [@surma](https://github.com/surma) | ||
| Andrew Wilkins | andrew.wilkins {at} canonical.com | [@axw](http://github.com/axw) | ||
| Dave Cheney | dave.cheney {at} canonical.com | [@davecheney](http://github.com/davecheney) | ||
| Dimiter Naydenov | dimiter.naydenov {at} canonical.com | [@dimitern](http://github.com/dimitern) | ||
View
1
LICENSE
| @@ -1,3 +1,4 @@ | ||
| +Copyright (C) 2011-2015 Canonical Ltd. | ||
| This software is licensed under the LGPLv3, included below. | ||
| As a special exception to the GNU Lesser General Public License version 3 | ||
View
10
README.md
| @@ -3,22 +3,22 @@ goamz | ||
| Go package to interact with Amazon Web Services | ||
| -[](https://travis-ci.org/go-amz/amz) [](http://godoc.org/gopkg.in/amz.v2) | ||
| +[](https://travis-ci.org/go-amz/amz) [](http://godoc.org/gopkg.in/amz.v3) | ||
| Instructions | ||
| ------------ | ||
| Install the package with: | ||
| - go get gopkg.in/amz.v2/... | ||
| + go get gopkg.in/amz.v3/... | ||
| Import it with: | ||
| - import "gopkg.in/amz.v2/<package>" | ||
| + import "gopkg.in/amz.v3/<package>" | ||
| Example: | ||
| - import "gopkg.in/amz.v2/ec2" | ||
| + import "gopkg.in/amz.v3/ec2" | ||
| and use _ec2_ as the package name inside the code. | ||
| The same applies to the other sub-packages: _aws_, _s3_, etc. | ||
| @@ -29,7 +29,7 @@ For more details, visit the project page: | ||
| and the API documentation: | ||
| -* https://gopkg.in/amz.v2 | ||
| +* https://gopkg.in/amz.v3 | ||
| Users Group | ||
| ----------- | ||
View
2
aws/attempt_test.go
| @@ -5,7 +5,7 @@ import ( | ||
| . "gopkg.in/check.v1" | ||
| - "gopkg.in/amz.v2/aws" | ||
| + "gopkg.in/amz.v3/aws" | ||
| ) | ||
| func (S) TestAttemptTiming(c *C) { | ||
View
150
aws/aws.go
| @@ -11,27 +11,34 @@ package aws | ||
| import ( | ||
| "errors" | ||
| "os" | ||
| + "strings" | ||
| ) | ||
| // Region defines the URLs where AWS services may be accessed. | ||
| // | ||
| // See http://goo.gl/d8BP1 for more details. | ||
| type Region struct { | ||
| - Name string // the canonical name of this region. | ||
| + Name string // The canonical name of this region. | ||
| EC2Endpoint string | ||
| S3Endpoint string | ||
| S3BucketEndpoint string // Not needed by AWS S3. Use ${bucket} for bucket name. | ||
| S3LocationConstraint bool // true if this region requires a LocationConstraint declaration. | ||
| S3LowercaseBucket bool // true if the region requires bucket names to be lower case. | ||
| - SDBEndpoint string | ||
| + SDBEndpoint string // Not all regions have simpleDB, e.g. Frankfurt (eu-central-1) does not. | ||
| SNSEndpoint string | ||
| SQSEndpoint string | ||
| IAMEndpoint string | ||
| - Sign Signer // Method which will be used to sign requests. | ||
| +} | ||
| + | ||
| +func (r Region) ResolveS3BucketEndpoint(bucketName string) string { | ||
| + if r.S3BucketEndpoint != "" { | ||
| + return strings.ToLower(strings.Replace(r.S3BucketEndpoint, "${bucket}", bucketName, -1)) | ||
| + } | ||
| + return strings.ToLower(r.S3Endpoint + "/" + bucketName + "/") | ||
| } | ||
| var USEast = Region{ | ||
| - "us-east-1", | ||
| + "us-east-1", // US East (N. Virginia) | ||
| "https://ec2.us-east-1.amazonaws.com", | ||
| "https://s3.amazonaws.com", | ||
| "", | ||
| @@ -41,11 +48,23 @@ var USEast = Region{ | ||
| "https://sns.us-east-1.amazonaws.com", | ||
| "https://sqs.us-east-1.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| +} | ||
| + | ||
| +var USEast2 = Region{ | ||
| + "us-east-2", // US East (Ohio) | ||
| + "https://ec2.us-east-2.amazonaws.com", | ||
| + "https://s3.us-east-2.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.us-east-2.amazonaws.com", | ||
| + "https://sqs.us-east-2.amazonaws.com", | ||
| + "https://iam.amazonaws.com", | ||
| } | ||
| var USWest = Region{ | ||
| - "us-west-1", | ||
| + "us-west-1", // US West (N. California) | ||
| "https://ec2.us-west-1.amazonaws.com", | ||
| "https://s3-us-west-1.amazonaws.com", | ||
| "", | ||
| @@ -55,11 +74,10 @@ var USWest = Region{ | ||
| "https://sns.us-west-1.amazonaws.com", | ||
| "https://sqs.us-west-1.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| } | ||
| var USWest2 = Region{ | ||
| - "us-west-2", | ||
| + "us-west-2", // US West (Oregon) | ||
| "https://ec2.us-west-2.amazonaws.com", | ||
| "https://s3-us-west-2.amazonaws.com", | ||
| "", | ||
| @@ -69,11 +87,36 @@ var USWest2 = Region{ | ||
| "https://sns.us-west-2.amazonaws.com", | ||
| "https://sqs.us-west-2.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| +} | ||
| + | ||
| +var USGovWest = Region{ | ||
| + "us-gov-west-1", // Isolated regions, AWS GovCloud (US) | ||
| + "https://ec2.us-gov-west-1.amazonaws.com", | ||
| + "https://s3-us-gov-west-1.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.us-gov-west-1.amazonaws.com", | ||
| + "https://sqs.us-gov-west-1.amazonaws.com", | ||
| + "https://iam.us-gov.amazonaws.com", | ||
| +} | ||
| + | ||
| +var CACentral = Region{ | ||
| + "ca-central-1", // CA (Central) | ||
| + "https://ec2.ca-central-1.amazonaws.com", | ||
| + "https://s3-ca-central-1.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.ca-central-1.amazonaws.com", | ||
| + "https://sqs.ca-central-1.amazonaws.com", | ||
| + "https://iam.amazonaws.com", | ||
| } | ||
| var EUWest = Region{ | ||
| - "eu-west-1", | ||
| + "eu-west-1", // EU (Ireland) | ||
| "https://ec2.eu-west-1.amazonaws.com", | ||
| "https://s3-eu-west-1.amazonaws.com", | ||
| "", | ||
| @@ -83,11 +126,49 @@ var EUWest = Region{ | ||
| "https://sns.eu-west-1.amazonaws.com", | ||
| "https://sqs.eu-west-1.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| +} | ||
| + | ||
| +var EUWest2 = Region{ | ||
| + "eu-west-2", // EU (London) | ||
| + "https://ec2.eu-west-2.amazonaws.com", | ||
| + "https://s3-eu-west-2.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.eu-west-2.amazonaws.com", | ||
| + "https://sqs.eu-west-2.amazonaws.com", | ||
| + "https://iam.amazonaws.com", | ||
| +} | ||
| + | ||
| +var EUCentral = Region{ | ||
| + "eu-central-1", // EU (Frankfurt) | ||
| + "https://ec2.eu-central-1.amazonaws.com", | ||
| + "https://s3-eu-central-1.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.eu-central-1.amazonaws.com", | ||
| + "https://sqs.eu-central-1.amazonaws.com", | ||
| + "https://iam.amazonaws.com", | ||
| +} | ||
| + | ||
| +var APSouth = Region{ | ||
| + "ap-south-1", // AP (Mumbai) | ||
| + "https://ec2.ap-south-1.amazonaws.com", | ||
| + "https://s3-ap-south-1.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.ap-south-1.amazonaws.com", | ||
| + "https://sqs.ap-south-1.amazonaws.com", | ||
| + "https://iam.amazonaws.com", | ||
| } | ||
| var APSoutheast = Region{ | ||
| - "ap-southeast-1", | ||
| + "ap-southeast-1", // Asia Pacific (Singapore) | ||
| "https://ec2.ap-southeast-1.amazonaws.com", | ||
| "https://s3-ap-southeast-1.amazonaws.com", | ||
| "", | ||
| @@ -97,11 +178,10 @@ var APSoutheast = Region{ | ||
| "https://sns.ap-southeast-1.amazonaws.com", | ||
| "https://sqs.ap-southeast-1.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| } | ||
| var APSoutheast2 = Region{ | ||
| - "ap-southeast-2", | ||
| + "ap-southeast-2", // Asia Pacific (Sydney) | ||
| "https://ec2.ap-southeast-2.amazonaws.com", | ||
| "https://s3-ap-southeast-2.amazonaws.com", | ||
| "", | ||
| @@ -111,11 +191,10 @@ var APSoutheast2 = Region{ | ||
| "https://sns.ap-southeast-2.amazonaws.com", | ||
| "https://sqs.ap-southeast-2.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| } | ||
| var APNortheast = Region{ | ||
| - "ap-northeast-1", | ||
| + "ap-northeast-1", // Asia Pacific (Tokyo) | ||
| "https://ec2.ap-northeast-1.amazonaws.com", | ||
| "https://s3-ap-northeast-1.amazonaws.com", | ||
| "", | ||
| @@ -125,11 +204,23 @@ var APNortheast = Region{ | ||
| "https://sns.ap-northeast-1.amazonaws.com", | ||
| "https://sqs.ap-northeast-1.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| +} | ||
| + | ||
| +var APNortheast2 = Region{ | ||
| + "ap-northeast-2", // Asia Pacific (Seoul) | ||
| + "https://ec2.ap-northeast-2.amazonaws.com", | ||
| + "https://s3-ap-northeast-2.amazonaws.com", | ||
| + "", | ||
| + true, | ||
| + true, | ||
| + "", | ||
| + "https://sns.ap-northeast-2.amazonaws.com", | ||
| + "https://sqs.ap-northeast-2.amazonaws.com", | ||
| + "https://iam.amazonaws.com", | ||
| } | ||
| var SAEast = Region{ | ||
| - "sa-east-1", | ||
| + "sa-east-1", // South America (Sao Paulo) | ||
| "https://ec2.sa-east-1.amazonaws.com", | ||
| "https://s3-sa-east-1.amazonaws.com", | ||
| "", | ||
| @@ -139,11 +230,10 @@ var SAEast = Region{ | ||
| "https://sns.sa-east-1.amazonaws.com", | ||
| "https://sqs.sa-east-1.amazonaws.com", | ||
| "https://iam.amazonaws.com", | ||
| - SignV2, | ||
| } | ||
| var CNNorth = Region{ | ||
| - "cn-north-1", | ||
| + "cn-north-1", // Isolated regions, China (Beijing) | ||
| "https://ec2.cn-north-1.amazonaws.com.cn", | ||
| "https://s3.cn-north-1.amazonaws.com.cn", | ||
| "", | ||
| @@ -152,20 +242,26 @@ var CNNorth = Region{ | ||
| "https://sdb.cn-north-1.amazonaws.com.cn", | ||
| "https://sns.cn-north-1.amazonaws.com.cn", | ||
| "https://sqs.cn-north-1.amazonaws.com.cn", | ||
| - "https://iam.amazonaws.com.cn", | ||
| - SignV4Factory("cn-north-1"), | ||
| + "https://iam.cn-north-1.amazonaws.com.cn", | ||
| } | ||
| var Regions = map[string]Region{ | ||
| APNortheast.Name: APNortheast, | ||
| + APNortheast2.Name: APNortheast2, | ||
| + APSouth.Name: APSouth, | ||
| APSoutheast.Name: APSoutheast, | ||
| APSoutheast2.Name: APSoutheast2, | ||
| EUWest.Name: EUWest, | ||
| + EUWest2.Name: EUWest2, | ||
| + EUCentral.Name: EUCentral, | ||
| USEast.Name: USEast, | ||
| + USEast2.Name: USEast2, | ||
| USWest.Name: USWest, | ||
| USWest2.Name: USWest2, | ||
| + USGovWest.Name: USGovWest, | ||
| SAEast.Name: SAEast, | ||
| CNNorth.Name: CNNorth, | ||
| + CACentral.Name: CACentral, | ||
| } | ||
| type Auth struct { | ||
| @@ -186,15 +282,21 @@ func init() { | ||
| // EnvAuth creates an Auth based on environment information. | ||
| // The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment | ||
| // variables are used as the first preference, but EC2_ACCESS_KEY | ||
| -// and EC2_SECRET_KEY environment variables are also supported. | ||
| +// and EC2_SECRET_KEY or AWS_ACCESS_KEY and AWS_SECRET_KEY | ||
| +// environment variables are also supported. | ||
| func EnvAuth() (auth Auth, err error) { | ||
| auth.AccessKey = os.Getenv("AWS_ACCESS_KEY_ID") | ||
| auth.SecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY") | ||
| - // We fallback to EC2_ env variables if the AWS_ variants are not used. | ||
| + // first fallbaback to EC2_ env variable | ||
| if auth.AccessKey == "" && auth.SecretKey == "" { | ||
| auth.AccessKey = os.Getenv("EC2_ACCESS_KEY") | ||
| auth.SecretKey = os.Getenv("EC2_SECRET_KEY") | ||
| } | ||
| + // second fallbaback to AWS_ env variable | ||
| + if auth.AccessKey == "" && auth.SecretKey == "" { | ||
| + auth.AccessKey = os.Getenv("AWS_ACCESS_KEY") | ||
| + auth.SecretKey = os.Getenv("AWS_SECRET_KEY") | ||
| + } | ||
| if auth.AccessKey == "" { | ||
| err = errors.New("AWS_ACCESS_KEY_ID not found in environment") | ||
| } | ||
View
11
aws/aws_test.go
| @@ -7,7 +7,7 @@ import ( | ||
| . "gopkg.in/check.v1" | ||
| - "gopkg.in/amz.v2/aws" | ||
| + "gopkg.in/amz.v3/aws" | ||
| ) | ||
| func Test(t *testing.T) { | ||
| @@ -63,6 +63,15 @@ func (s *S) TestEnvAuthLegacy(c *C) { | ||
| c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) | ||
| } | ||
| +func (s *S) TestEnvAuthAws(c *C) { | ||
| + os.Clearenv() | ||
| + os.Setenv("AWS_SECRET_KEY", "secret") | ||
| + os.Setenv("AWS_ACCESS_KEY", "access") | ||
| + auth, err := aws.EnvAuth() | ||
| + c.Assert(err, IsNil) | ||
| + c.Assert(auth, Equals, aws.Auth{SecretKey: "secret", AccessKey: "access"}) | ||
| +} | ||
| + | ||
| func (s *S) TestEncode(c *C) { | ||
| c.Assert(aws.Encode("foo"), Equals, "foo") | ||
| c.Assert(aws.Encode("/"), Equals, "%2F") | ||
Oops, something went wrong.