From 182c21e38c0a9dfa941996c98f398c4a26bfb6ec Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 28 Sep 2017 17:57:05 +0300 Subject: [PATCH] Upgrade AWS SDK to the latest version --- Gopkg.lock | 6 +- .../aws/aws-sdk-go/.github/ISSUE_TEMPLATE.md | 14 + .../.github/PULL_REQUEST_TEMPLATE.md | 3 + vendor/github.com/aws/aws-sdk-go/.travis.yml | 3 +- vendor/github.com/aws/aws-sdk-go/CHANGELOG.md | 1121 + .../aws/aws-sdk-go/CHANGELOG_PENDING.md | 5 + .../github.com/aws/aws-sdk-go/CONTRIBUTING.md | 5 + vendor/github.com/aws/aws-sdk-go/Gopkg.lock | 20 + vendor/github.com/aws/aws-sdk-go/Gopkg.toml | 48 + vendor/github.com/aws/aws-sdk-go/Makefile | 18 +- vendor/github.com/aws/aws-sdk-go/README.md | 449 +- .../github.com/aws/aws-sdk-go/aws/arn/arn.go | 86 + .../aws/aws-sdk-go/aws/arn/arn_test.go | 90 + .../aws/aws-sdk-go/aws/client/client.go | 62 +- .../aws/aws-sdk-go/aws/client/client_test.go | 78 + .../aws-sdk-go/aws/client/default_retryer.go | 10 +- .../aws/aws-sdk-go/aws/client/logger.go | 108 + .../aws/aws-sdk-go/aws/client/logger_test.go | 57 + .../github.com/aws/aws-sdk-go/aws/config.go | 13 +- .../aws/aws-sdk-go/aws/context_1_6.go | 6 +- .../aws/aws-sdk-go/aws/convert_types.go | 18 + .../aws/aws-sdk-go/aws/convert_types_test.go | 33 + .../aws-sdk-go/aws/corehandlers/handlers.go | 131 +- .../aws/corehandlers/handlers_1_8_test.go | 64 + .../aws/corehandlers/handlers_test.go | 33 + .../aws/credentials/chain_provider.go | 14 +- .../aws-sdk-go/aws/credentials/credentials.go | 33 +- .../aws/credentials/env_provider.go | 1 + .../aws/credentials/plugincreds/doc_1_7.go | 5 + .../aws/credentials/plugincreds/provider.go | 211 + .../credentials/plugincreds/provider_test.go | 71 + .../shared_credentials_provider.go | 33 +- .../shared_credentials_provider_test.go | 20 + .../stscreds/assume_role_provider.go | 2 +- .../aws/aws-sdk-go/aws/defaults/defaults.go | 46 +- .../aws-sdk-go/aws/defaults/defaults_test.go | 84 +- .../aws-sdk-go/aws/defaults/shared_config.go | 27 + vendor/github.com/aws/aws-sdk-go/aws/doc.go | 56 + .../aws/aws-sdk-go/aws/endpoints/defaults.go | 399 +- .../aws/aws-sdk-go/aws/endpoints/doc.go | 4 +- .../aws/aws-sdk-go/aws/endpoints/endpoints.go | 112 +- .../aws/endpoints/endpoints_test.go | 91 + .../aws/endpoints/v3model_codegen.go | 19 +- .../aws/aws-sdk-go/aws/jsonvalue.go | 3 +- .../github.com/aws/aws-sdk-go/aws/logger.go | 4 +- .../aws/request/connection_reset_error.go | 19 + .../request/connection_reset_error_other.go | 11 + .../connection_reset_error_other_test.go | 9 + .../request/connection_reset_error_test.go | 11 + .../aws/aws-sdk-go/aws/request/handlers.go | 82 +- .../aws-sdk-go/aws/request/handlers_test.go | 197 +- .../aws/aws-sdk-go/aws/request/request.go | 130 +- .../aws/aws-sdk-go/aws/request/request_1_7.go | 22 +- .../aws/aws-sdk-go/aws/request/request_1_8.go | 30 +- .../aws/request/request_1_8_test.go | 64 +- .../aws/request/request_internal_test.go | 15 +- .../aws/request/request_pagination_test.go | 73 + .../aws/request/request_resetbody_test.go | 2 +- .../aws-sdk-go/aws/request/request_test.go | 508 +- .../aws/aws-sdk-go/aws/request/retryer.go | 99 +- .../aws-sdk-go/aws/request/retryer_test.go | 52 +- .../aws/request/timeout_read_closer.go | 94 + .../timeout_read_closer_benchmark_test.go | 76 + .../aws/request/timeout_read_closer_test.go | 118 + .../aws/aws-sdk-go/aws/request/validation.go | 2 +- .../aws/aws-sdk-go/aws/request/waiter.go | 32 +- .../aws/aws-sdk-go/aws/request/waiter_test.go | 149 +- .../aws/session/custom_ca_bundle_test.go | 312 +- .../aws/aws-sdk-go/aws/session/doc.go | 9 +- .../aws/aws-sdk-go/aws/session/env_config.go | 43 +- .../aws-sdk-go/aws/session/env_config_test.go | 152 +- .../aws/aws-sdk-go/aws/session/session.go | 30 +- .../aws-sdk-go/aws/session/session_test.go | 54 +- .../aws-sdk-go/aws/session/shared_config.go | 2 +- .../aws/signer/v4/functional_test.go | 100 +- .../aws/aws-sdk-go/aws/signer/v4/v4.go | 85 +- .../aws/aws-sdk-go/aws/signer/v4/v4_test.go | 275 +- vendor/github.com/aws/aws-sdk-go/aws/url.go | 12 + .../github.com/aws/aws-sdk-go/aws/url_1_7.go | 29 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/awstesting/assert.go | 10 +- .../awstesting/cmd/bucket_cleanup/main.go | 94 + .../aws-sdk-go/awstesting/custom_ca_bundle.go | 199 + .../s3/s3manager/bucket_region_test.go | 27 + .../s3/s3manager/integration_test.go | 123 +- .../awstesting/sandbox/Dockerfile.test.go1.9 | 11 + .../aws/aws-sdk-go/awstesting/util.go | 27 + .../doc-src/aws-godoc/templates/godoc.html | 21 +- .../aws-godoc/templates/package_default.html | 12 +- .../aws-godoc/templates/package_service.html | 210 +- .../doc-src/aws-godoc/templates/style.css | 31 +- vendor/github.com/aws/aws-sdk-go/doc.go | 405 + .../aws/credentials/plugincreds/README.md | 49 + .../aws/credentials/plugincreds/main.go | 83 + .../credentials/plugincreds/plugin/plugin.go | 61 + .../aws/endpoints/customEndpoint/README.md | 10 +- .../aws/endpoints/enumEndpoints/README.md | 4 +- .../example/aws/request/withContext/README.md | 2 +- .../aws/request/withContext/withContext.go | 27 +- .../service/dynamodb/expression/readme.md | 102 + .../service/dynamodb/expression/scan.go | 88 + .../service/dynamodb/scanItems/README.md | 5 +- .../service/dynamodb/unitTest/README.md | 5 +- .../service/ec2/filterInstances/README.md | 4 +- .../service/ec2/instancesbyRegion/README.md | 32 + .../instancesbyRegion/instancesByRegion.go | 137 + .../rds/rdsutils/authentication/README.md | 15 + .../authentication/iam_authentication.go | 47 + .../service/s3/concatObjects/README.md | 4 +- .../example/service/s3/listObjects/README.md | 4 +- .../s3/listObjectsConcurrently/README.md | 2 +- .../example/service/s3/presignURL/README.md | 124 + .../service/s3/presignURL/client/client.go | 266 + .../service/s3/presignURL/server/server.go | 186 + .../service/s3/putObjectAcl/putObjectAcl.go | 2 + .../sqs/mockingClientsForTests/README.md | 4 +- .../mockingClientsForTests/ifaceExample.go | 2 + .../ifaceExample_test.go | 2 + .../internal/shareddefaults/shared_config.go | 40 + .../shared_config_other_test.go | 40 + .../shared_config_windows_test.go | 40 + .../apis/AWS Glue/2017-03-31/api-2.json | 3587 +++ .../apis/AWS Glue/2017-03-31/docs-2.json | 2474 +++ .../apis/AWS Glue/2017-03-31/examples-1.json | 5 + .../AWS Glue/2017-03-31/paginators-1.json | 69 + .../apis/MobileHub/2017-07-01/api-2.json | 551 + .../apis/MobileHub/2017-07-01/docs-2.json | 392 + .../apis/MobileHub/2017-07-01/examples-1.json | 5 + .../MobileHub/2017-07-01/paginators-1.json | 14 + .../models/apis/acm/2015-12-08/docs-2.json | 6 +- .../apis/apigateway/2015-07-09/api-2.json | 447 +- .../apis/apigateway/2015-07-09/docs-2.json | 456 +- .../2016-02-06/api-2.json | 102 +- .../2016-02-06/docs-2.json | 143 +- .../2016-02-06/paginators-1.json | 18 +- .../apis/appstream/2016-12-01/api-2.json | 385 +- .../apis/appstream/2016-12-01/docs-2.json | 282 +- .../appstream/2016-12-01/paginators-1.json | 4 + .../apis/appstream/2016-12-01/waiters-2.json | 12 +- .../models/apis/athena/2017-05-18/api-2.json | 615 + .../models/apis/athena/2017-05-18/docs-2.json | 467 + .../apis/athena/2017-05-18/examples-1.json | 5 + .../apis/athena/2017-05-18/paginators-1.json | 19 + .../apis/autoscaling/2011-01-01/api-2.json | 112 +- .../apis/autoscaling/2011-01-01/docs-2.json | 325 +- .../autoscaling/2011-01-01/examples-1.json | 3 +- .../autoscaling/2011-01-01/paginators-1.json | 18 +- .../models/apis/batch/2016-08-10/api-2.json | 43 +- .../models/apis/batch/2016-08-10/docs-2.json | 71 +- .../apis/batch/2016-08-10/examples-1.json | 4 +- .../apis/batch/2016-08-10/paginators-1.json | 4 + .../models/apis/budgets/2016-10-20/api-2.json | 30 +- .../apis/budgets/2016-10-20/docs-2.json | 31 +- .../apis/clouddirectory/2016-05-10/api-2.json | 909 +- .../clouddirectory/2016-05-10/docs-2.json | 914 +- .../2016-05-10/paginators-1.json | 10 + .../apis/cloudformation/2010-05-15/api-2.json | 941 +- .../cloudformation/2010-05-15/docs-2.json | 622 +- .../cloudformation/2010-05-15/examples-1.json | 153 - .../2010-05-15/paginators-1.json | 12 +- .../cloudformation/2010-05-15/waiters-2.json | 25 + .../apis/cloudfront/2017-03-25/api-2.json | 2689 +++ .../apis/cloudfront/2017-03-25/docs-2.json | 1449 ++ .../cloudfront/2017-03-25/examples-1.json | 83 + .../cloudfront/2017-03-25/paginators-1.json | 32 + .../apis/cloudfront/2017-03-25/waiters-2.json | 47 + .../apis/cloudhsmv2/2017-04-28/api-2.json | 604 + .../apis/cloudhsmv2/2017-04-28/docs-2.json | 425 + .../cloudhsmv2/2017-04-28/examples-1.json | 5 + .../cloudhsmv2/2017-04-28/paginators-1.json | 19 + .../apis/cloudtrail/2013-11-01/api-2.json | 5 + .../apis/cloudtrail/2013-11-01/docs-2.json | 6 +- .../apis/codebuild/2016-10-06/api-2.json | 57 +- .../apis/codebuild/2016-10-06/docs-2.json | 53 +- .../apis/codebuild/2016-10-06/examples-1.json | 276 + .../apis/codedeploy/2014-10-06/api-2.json | 172 +- .../apis/codedeploy/2014-10-06/docs-2.json | 303 +- .../apis/codepipeline/2015-07-09/api-2.json | 77 +- .../apis/codepipeline/2015-07-09/docs-2.json | 204 +- .../codepipeline/2015-07-09/paginators-1.json | 4 + .../apis/codestar/2017-04-19/api-2.json | 872 + .../apis/codestar/2017-04-19/docs-2.json | 540 + .../apis/codestar/2017-04-19/examples-1.json | 5 + .../codestar/2017-04-19/paginators-1.json | 4 + .../apis/cognito-idp/2016-04-18/api-2.json | 991 +- .../apis/cognito-idp/2016-04-18/docs-2.json | 792 +- .../cognito-idp/2016-04-18/paginators-1.json | 4 + .../models/apis/config/2014-11-12/api-2.json | 68 +- .../models/apis/config/2014-11-12/docs-2.json | 76 +- .../models/apis/dax/2017-04-19/api-2.json | 1085 + .../models/apis/dax/2017-04-19/docs-2.json | 751 + .../apis/dax/2017-04-19/examples-1.json | 5 + .../apis/dax/2017-04-19/paginators-1.json | 4 + .../apis/devicefarm/2015-06-23/api-2.json | 136 +- .../apis/devicefarm/2015-06-23/docs-2.json | 135 +- .../apis/directconnect/2012-10-25/docs-2.json | 2 +- .../apis/discovery/2015-11-01/api-2.json | 99 +- .../apis/discovery/2015-11-01/docs-2.json | 179 +- .../discovery/2015-11-01/paginators-1.json | 4 + .../models/apis/dms/2016-01-01/api-2.json | 390 +- .../models/apis/dms/2016-01-01/docs-2.json | 302 +- .../apis/dms/2016-01-01/examples-1.json | 1048 + .../apis/dms/2016-01-01/paginators-1.json | 64 + .../models/apis/ds/2015-04-16/api-2.json | 123 +- .../models/apis/ds/2015-04-16/docs-2.json | 93 +- .../apis/ds/2015-04-16/paginators-1.json | 9 + .../apis/dynamodb/2012-08-10/docs-2.json | 20 +- .../apis/dynamodb/2012-08-10/examples-1.json | 5 +- .../models/apis/ec2/2016-11-15/api-2.json | 7030 +++--- .../models/apis/ec2/2016-11-15/docs-2.json | 1306 +- .../models/apis/ec2/2016-11-15/waiters-2.json | 5 + .../models/apis/ecs/2014-11-13/api-2.json | 22 +- .../models/apis/ecs/2014-11-13/docs-2.json | 66 +- .../apis/ecs/2014-11-13/paginators-1.json | 78 +- .../apis/elasticache/2015-02-02/api-2.json | 82 +- .../apis/elasticache/2015-02-02/docs-2.json | 79 +- .../elasticache/2015-02-02/examples-1.json | 2021 +- .../elasticache/2015-02-02/paginators-1.json | 36 +- .../elasticbeanstalk/2010-12-01/api-2.json | 11 +- .../elasticbeanstalk/2010-12-01/docs-2.json | 29 +- .../elasticfilesystem/2015-02-01/api-2.json | 14 +- .../elasticfilesystem/2015-02-01/docs-2.json | 16 +- .../2015-02-01/paginators-1.json | 4 + .../2012-06-01/api-2.json | 41 +- .../2012-06-01/docs-2.json | 102 +- .../2012-06-01/paginators-1.json | 2 +- .../2012-06-01/waiters-2.json | 5 + .../2015-12-01/api-2.json | 169 +- .../2015-12-01/docs-2.json | 219 +- .../2015-12-01/waiters-2.json | 100 + .../elasticmapreduce/2009-03-31/api-2.json | 18 +- .../elasticmapreduce/2009-03-31/docs-2.json | 43 +- .../models/apis/email/2010-12-01/api-2.json | 180 +- .../models/apis/email/2010-12-01/docs-2.json | 279 +- .../apis/email/2010-12-01/examples-1.json | 2 + .../apis/email/2010-12-01/paginators-1.json | 4 +- .../2017-01-11/api-2.json | 128 + .../2017-01-11/docs-2.json | 131 + .../2017-01-11/examples-1.json | 5 + .../2017-01-11/paginators-1.json | 4 + .../models/apis/events/2015-10-07/api-2.json | 97 + .../models/apis/events/2015-10-07/docs-2.json | 76 +- .../apis/firehose/2015-08-04/api-2.json | 101 + .../apis/firehose/2015-08-04/docs-2.json | 163 +- .../firehose/2015-08-04/paginators-1.json | 4 + .../apis/gamelift/2015-10-01/api-2.json | 875 +- .../apis/gamelift/2015-10-01/docs-2.json | 903 +- .../apis/greengrass/2017-06-07/api-2.json | 3507 +++ .../apis/greengrass/2017-06-07/docs-2.json | 548 + .../models/apis/iam/2010-05-08/api-2.json | 234 +- .../models/apis/iam/2010-05-08/docs-2.json | 218 +- .../apis/inspector/2016-02-16/api-2.json | 105 +- .../apis/inspector/2016-02-16/docs-2.json | 72 +- .../apis/inspector/2016-02-16/examples-1.json | 7 + .../inspector/2016-02-16/paginators-1.json | 44 + .../models/apis/iot/2015-05-28/api-2.json | 2181 +- .../models/apis/iot/2015-05-28/docs-2.json | 69 +- .../apis/iot/2015-05-28/examples-1.json | 4 +- .../apis/iot/2015-05-28/paginators-1.json | 4 + .../models/apis/kinesis/2013-12-02/api-2.json | 155 +- .../apis/kinesis/2013-12-02/docs-2.json | 81 +- .../apis/kinesis/2013-12-02/paginators-1.json | 2 +- .../apis/kinesis/2013-12-02/waiters-2.json | 12 + .../kinesisanalytics/2015-08-14/api-2.json | 153 +- .../kinesisanalytics/2015-08-14/docs-2.json | 117 +- .../2015-08-14/paginators-1.json | 4 + .../models/apis/kms/2014-11-01/api-2.json | 10 +- .../models/apis/kms/2014-11-01/docs-2.json | 24 +- .../apis/kms/2014-11-01/examples-1.json | 42 + .../models/apis/lambda/2015-03-31/api-2.json | 217 +- .../models/apis/lambda/2015-03-31/docs-2.json | 196 +- .../apis/lambda/2015-03-31/paginators-1.json | 6 +- .../apis/lex-models/2017-04-19/api-2.json | 2123 ++ .../apis/lex-models/2017-04-19/docs-2.json | 1168 + .../lex-models/2017-04-19/examples-1.json | 758 + .../lex-models/2017-04-19/paginators-1.json | 54 + .../apis/lightsail/2016-11-28/api-2.json | 72 +- .../apis/lightsail/2016-11-28/docs-2.json | 60 +- .../lightsail/2016-11-28/paginators-1.json | 4 + .../models/apis/logs/2014-03-28/api-2.json | 145 +- .../models/apis/logs/2014-03-28/docs-2.json | 186 +- .../apis/logs/2014-03-28/paginators-1.json | 16 +- .../2015-07-01/docs-2.json | 2 +- .../models/apis/mgh/2017-05-31/api-2.json | 839 + .../models/apis/mgh/2017-05-31/docs-2.json | 497 + .../apis/mgh/2017-05-31/examples-1.json | 5 + .../apis/mgh/2017-05-31/paginators-1.json | 4 + .../apis/monitoring/2010-08-01/api-2.json | 215 +- .../apis/monitoring/2010-08-01/docs-2.json | 208 +- .../monitoring/2010-08-01/paginators-1.json | 6 +- .../apis/opsworks/2013-02-18/api-2.json | 236 +- .../apis/opsworks/2013-02-18/docs-2.json | 265 +- .../opsworks/2013-02-18/paginators-1.json | 4 +- .../apis/organizations/2016-11-28/api-2.json | 24 +- .../apis/organizations/2016-11-28/docs-2.json | 41 +- .../organizations/2016-11-28/examples-1.json | 15 +- .../2016-11-28/paginators-1.json | 60 + .../apis/pinpoint/2016-12-01/api-2.json | 1970 +- .../apis/pinpoint/2016-12-01/docs-2.json | 465 +- .../models/apis/polly/2016-06-10/api-2.json | 39 +- .../models/apis/polly/2016-06-10/docs-2.json | 28 +- .../apis/polly/2016-06-10/paginators-1.json | 4 + .../models/apis/rds/2013-01-10/docs-2.json | 2 +- .../models/apis/rds/2013-02-12/docs-2.json | 2 +- .../models/apis/rds/2013-09-09/docs-2.json | 2 +- .../models/apis/rds/2014-09-01/docs-2.json | 2 +- .../models/apis/rds/2014-10-31/api-2.json | 148 +- .../models/apis/rds/2014-10-31/docs-2.json | 237 +- .../apis/rds/2014-10-31/examples-1.json | 398 +- .../apis/redshift/2012-12-01/api-2.json | 73 +- .../apis/redshift/2012-12-01/docs-2.json | 39 +- .../redshift/2012-12-01/paginators-1.json | 32 +- .../apis/rekognition/2016-06-27/api-2.json | 206 +- .../apis/rekognition/2016-06-27/docs-2.json | 181 +- .../rekognition/2016-06-27/examples-1.json | 30 +- .../2017-01-26/api-2.json | 328 + .../2017-01-26/docs-2.json | 259 + .../2017-01-26/examples-1.json | 5 + .../2017-01-26/paginators-1.json | 20 + .../models/apis/route53/2013-04-01/api-2.json | 220 +- .../apis/route53/2013-04-01/docs-2.json | 481 +- .../apis/route53domains/2014-05-15/api-2.json | 4 +- .../route53domains/2014-05-15/docs-2.json | 312 +- .../2014-05-15/paginators-1.json | 7 +- .../apis/runtime.lex/2016-11-28/api-2.json | 166 +- .../apis/runtime.lex/2016-11-28/docs-2.json | 129 +- .../models/apis/s3/2006-03-01/api-2.json | 5 + .../models/apis/s3/2006-03-01/docs-2.json | 1 + .../models/apis/s3/2006-03-01/examples-1.json | 1871 ++ .../apis/s3/2006-03-01/paginators-1.json | 36 +- .../apis/servicecatalog/2015-12-10/api-2.json | 519 +- .../servicecatalog/2015-12-10/docs-2.json | 529 +- .../2015-12-10/paginators-1.json | 54 + .../apis/snowball/2016-06-30/api-2.json | 51 +- .../apis/snowball/2016-06-30/docs-2.json | 33 +- .../snowball/2016-06-30/paginators-1.json | 14 +- .../models/apis/sqs/2012-11-05/api-2.json | 4 +- .../models/apis/sqs/2012-11-05/docs-2.json | 60 +- .../apis/sqs/2012-11-05/paginators-1.json | 2 +- .../models/apis/ssm/2014-11-06/api-2.json | 1430 +- .../models/apis/ssm/2014-11-06/docs-2.json | 1301 +- .../apis/ssm/2014-11-06/paginators-1.json | 39 +- .../apis/storagegateway/2013-06-30/api-2.json | 53 +- .../storagegateway/2013-06-30/docs-2.json | 166 +- .../models/apis/sts/2011-06-15/api-2.json | 6 +- .../models/apis/sts/2011-06-15/docs-2.json | 4 +- .../apis/sts/2011-06-15/paginators-1.json | 4 + .../models/apis/swf/2012-01-25/api-2.json | 504 +- .../models/apis/swf/2012-01-25/docs-2.json | 868 +- .../apis/swf/2012-01-25/examples-1.json | 5 + .../apis/swf/2012-01-25/paginators-1.json | 16 +- .../apis/waf-regional/2016-11-28/api-2.json | 244 +- .../apis/waf-regional/2016-11-28/docs-2.json | 137 +- .../models/apis/waf/2015-08-24/api-2.json | 244 +- .../models/apis/waf/2015-08-24/docs-2.json | 137 +- .../apis/workdocs/2016-05-01/api-2.json | 919 +- .../apis/workdocs/2016-05-01/docs-2.json | 433 +- .../apis/workspaces/2015-04-08/api-2.json | 4 +- .../apis/workspaces/2015-04-08/docs-2.json | 12 +- .../workspaces/2015-04-08/paginators-1.json | 4 +- .../models/apis/xray/2016-04-12/api-2.json | 3 +- .../models/apis/xray/2016-04-12/docs-2.json | 61 +- .../apis/xray/2016-04-12/paginators-1.json | 4 + .../models/endpoints/endpoints.json | 3948 ++-- .../aws/aws-sdk-go/private/model/api/api.go | 131 +- .../aws-sdk-go/private/model/api/api_test.go | 22 +- .../private/model/api/customization_passes.go | 60 +- .../aws-sdk-go/private/model/api/docstring.go | 53 +- .../private/model/api/docstring_test.go | 44 +- .../aws-sdk-go/private/model/api/example.go | 318 + .../private/model/api/example_test.go | 206 + .../private/model/api/examples_builder.go | 256 + .../api/examples_builder_customizations.go | 28 + .../private/model/api/list_of_shame.go | 495 + .../aws-sdk-go/private/model/api/load_test.go | 6 +- .../aws-sdk-go/private/model/api/operation.go | 31 +- .../aws-sdk-go/private/model/api/passes.go | 20 +- .../private/model/api/passes_test.go | 169 + .../aws/aws-sdk-go/private/model/api/shape.go | 80 +- .../private/model/api/shapetag_test.go | 9 +- .../aws-sdk-go/private/model/api/waiters.go | 9 +- .../private/model/cli/gen-api/main.go | 55 +- .../private/protocol/ec2query/build_test.go | 294 +- .../protocol/ec2query/unmarshal_test.go | 243 +- .../private/protocol/jsonrpc/build_test.go | 460 +- .../protocol/jsonrpc/unmarshal_test.go | 205 +- .../private/protocol/protocol_test.go | 8 +- .../private/protocol/query/build_test.go | 759 +- .../private/protocol/query/unmarshal_test.go | 405 +- .../protocol/restjson/build_bench_test.go | 452 +- .../private/protocol/restjson/build_test.go | 1093 +- .../protocol/restjson/unmarshal_test.go | 324 +- .../protocol/restxml/build_bench_test.go | 482 +- .../private/protocol/restxml/build_test.go | 1309 +- .../protocol/restxml/unmarshal_test.go | 383 +- .../private/protocol/xml/xmlutil/build.go | 1 - .../private/protocol/xml/xmlutil/unmarshal.go | 7 +- .../protocol/xml/xmlutil/unmarshal_test.go | 142 + .../protocol/xml/xmlutil/xml_to_struct.go | 13 +- .../xml/xmlutil/xml_to_struct_test.go | 17 +- vendor/github.com/aws/aws-sdk-go/sdk.go | 7 - .../service/acm/acmiface/interface.go | 4 +- .../aws/aws-sdk-go/service/acm/api.go | 222 +- .../aws/aws-sdk-go/service/acm/doc.go | 32 + .../aws/aws-sdk-go/service/acm/errors.go | 2 +- .../aws-sdk-go/service/acm/examples_test.go | 262 - .../aws/aws-sdk-go/service/acm/service.go | 14 +- .../aws/aws-sdk-go/service/apigateway/api.go | 5340 +++-- .../apigateway/apigatewayiface/interface.go | 44 +- .../aws/aws-sdk-go/service/apigateway/doc.go | 30 + .../aws-sdk-go/service/apigateway/errors.go | 20 +- .../service/apigateway/examples_test.go | 2635 --- .../aws-sdk-go/service/apigateway/service.go | 15 +- .../service/applicationautoscaling/api.go | 857 +- .../applicationautoscalingiface/interface.go | 4 +- .../service/applicationautoscaling/doc.go | 63 + .../service/applicationautoscaling/errors.go | 13 +- .../applicationautoscaling/examples_test.go | 467 +- .../service/applicationautoscaling/service.go | 36 +- .../applicationdiscoveryservice/api.go | 1022 +- .../interface.go | 12 +- .../applicationdiscoveryservice/doc.go | 87 + .../applicationdiscoveryservice/errors.go | 2 +- .../examples_test.go | 471 - .../applicationdiscoveryservice/service.go | 69 +- .../aws/aws-sdk-go/service/appstream/api.go | 1798 +- .../appstream/appstreamiface/interface.go | 20 +- .../aws/aws-sdk-go/service/appstream/doc.go | 28 + .../aws-sdk-go/service/appstream/errors.go | 20 +- .../service/appstream/examples_test.go | 453 - .../aws-sdk-go/service/appstream/service.go | 12 +- .../aws-sdk-go/service/appstream/waiters.go | 32 +- .../aws/aws-sdk-go/service/athena/api.go | 2738 +++ .../service/athena/athenaiface/interface.go | 117 + .../aws/aws-sdk-go/service/athena/doc.go | 39 + .../aws/aws-sdk-go/service/athena/errors.go | 26 + .../aws/aws-sdk-go/service/athena/service.go | 95 + .../aws/aws-sdk-go/service/autoscaling/api.go | 1820 +- .../autoscaling/autoscalingiface/interface.go | 4 +- .../aws/aws-sdk-go/service/autoscaling/doc.go | 30 + .../aws-sdk-go/service/autoscaling/errors.go | 2 +- .../service/autoscaling/examples_test.go | 2561 ++- .../aws-sdk-go/service/autoscaling/service.go | 14 +- .../aws-sdk-go/service/autoscaling/waiters.go | 29 +- .../aws/aws-sdk-go/service/batch/api.go | 623 +- .../service/batch/batchiface/interface.go | 4 +- .../aws/aws-sdk-go/service/batch/doc.go | 44 + .../aws/aws-sdk-go/service/batch/errors.go | 2 +- .../aws-sdk-go/service/batch/examples_test.go | 944 +- .../aws/aws-sdk-go/service/batch/service.go | 26 +- .../aws/aws-sdk-go/service/budgets/api.go | 360 +- .../service/budgets/budgetsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/budgets/doc.go | 26 + .../aws/aws-sdk-go/service/budgets/errors.go | 2 +- .../service/budgets/examples_test.go | 455 - .../aws/aws-sdk-go/service/budgets/service.go | 11 +- .../aws-sdk-go/service/clouddirectory/api.go | 6759 +++++- .../clouddirectoryiface/interface.go | 50 +- .../aws-sdk-go/service/clouddirectory/doc.go | 33 + .../service/clouddirectory/errors.go | 35 +- .../service/clouddirectory/examples_test.go | 1502 -- .../service/clouddirectory/service.go | 17 +- .../aws-sdk-go/service/cloudformation/api.go | 5080 ++++- .../cloudformationiface/interface.go | 69 +- .../aws-sdk-go/service/cloudformation/doc.go | 46 + .../service/cloudformation/errors.go | 84 +- .../service/cloudformation/examples_test.go | 712 - .../service/cloudformation/service.go | 28 +- .../service/cloudformation/waiters.go | 94 +- .../aws/aws-sdk-go/service/cloudfront/api.go | 1110 +- .../cloudfront/cloudfrontiface/interface.go | 4 +- .../aws/aws-sdk-go/service/cloudfront/doc.go | 31 + .../aws-sdk-go/service/cloudfront/errors.go | 10 +- .../service/cloudfront/examples_test.go | 2080 +- .../aws-sdk-go/service/cloudfront/service.go | 17 +- .../service/cloudfront/sign/sign_cookie.go | 6 +- .../aws-sdk-go/service/cloudfront/waiters.go | 29 +- .../aws/aws-sdk-go/service/cloudhsm/api.go | 383 +- .../cloudhsm/cloudhsmiface/interface.go | 4 +- .../aws/aws-sdk-go/service/cloudhsm/doc.go | 28 + .../aws/aws-sdk-go/service/cloudhsm/errors.go | 2 +- .../service/cloudhsm/examples_test.go | 471 - .../aws-sdk-go/service/cloudhsm/service.go | 11 +- .../aws/aws-sdk-go/service/cloudhsmv2/api.go | 2503 +++ .../cloudhsmv2/cloudhsmv2iface/interface.go | 113 + .../aws/aws-sdk-go/service/cloudhsmv2/doc.go | 29 + .../aws-sdk-go/service/cloudhsmv2/errors.go | 38 + .../aws-sdk-go/service/cloudhsmv2/service.go | 98 + .../aws/aws-sdk-go/service/cloudsearch/api.go | 459 +- .../cloudsearch/cloudsearchiface/interface.go | 4 +- .../aws/aws-sdk-go/service/cloudsearch/doc.go | 33 + .../aws-sdk-go/service/cloudsearch/errors.go | 2 +- .../service/cloudsearch/examples_test.go | 664 - .../aws-sdk-go/service/cloudsearch/service.go | 16 +- .../service/cloudsearchdomain/api.go | 61 +- .../cloudsearchdomainiface/interface.go | 4 +- .../service/cloudsearchdomain/doc.go | 35 + .../service/cloudsearchdomain/errors.go | 2 +- .../cloudsearchdomain/examples_test.go | 95 - .../service/cloudsearchdomain/service.go | 18 +- .../aws/aws-sdk-go/service/cloudtrail/api.go | 318 +- .../cloudtrail/cloudtrailiface/interface.go | 4 +- .../aws/aws-sdk-go/service/cloudtrail/doc.go | 48 + .../aws-sdk-go/service/cloudtrail/errors.go | 2 +- .../service/cloudtrail/examples_test.go | 379 - .../aws-sdk-go/service/cloudtrail/service.go | 30 +- .../aws/aws-sdk-go/service/cloudwatch/api.go | 1260 +- .../cloudwatch/cloudwatchiface/interface.go | 20 +- .../aws/aws-sdk-go/service/cloudwatch/doc.go | 42 + .../aws-sdk-go/service/cloudwatch/errors.go | 16 +- .../service/cloudwatch/examples_test.go | 365 - .../aws-sdk-go/service/cloudwatch/service.go | 24 +- .../aws-sdk-go/service/cloudwatch/waiters.go | 11 +- .../service/cloudwatchevents/api.go | 827 +- .../cloudwatcheventsiface/interface.go | 16 +- .../service/cloudwatchevents/doc.go | 45 + .../service/cloudwatchevents/errors.go | 10 +- .../service/cloudwatchevents/examples_test.go | 332 - .../service/cloudwatchevents/service.go | 27 +- .../aws-sdk-go/service/cloudwatchlogs/api.go | 1655 +- .../cloudwatchlogsiface/interface.go | 28 +- .../aws-sdk-go/service/cloudwatchlogs/doc.go | 57 + .../service/cloudwatchlogs/errors.go | 2 +- .../service/cloudwatchlogs/examples_test.go | 695 - .../service/cloudwatchlogs/service.go | 39 +- .../aws/aws-sdk-go/service/codebuild/api.go | 522 +- .../codebuild/codebuildiface/interface.go | 12 +- .../aws/aws-sdk-go/service/codebuild/doc.go | 73 + .../aws-sdk-go/service/codebuild/errors.go | 2 +- .../service/codebuild/examples_test.go | 366 +- .../aws-sdk-go/service/codebuild/service.go | 53 +- .../aws/aws-sdk-go/service/codecommit/api.go | 350 +- .../codecommit/codecommitiface/interface.go | 4 +- .../aws/aws-sdk-go/service/codecommit/doc.go | 89 + .../aws-sdk-go/service/codecommit/errors.go | 2 +- .../service/codecommit/examples_test.go | 426 - .../aws-sdk-go/service/codecommit/service.go | 71 +- .../aws/aws-sdk-go/service/codedeploy/api.go | 1458 +- .../codedeploy/codedeployiface/interface.go | 8 +- .../aws/aws-sdk-go/service/codedeploy/doc.go | 81 + .../aws-sdk-go/service/codedeploy/errors.go | 49 +- .../service/codedeploy/examples_test.go | 1115 - .../aws-sdk-go/service/codedeploy/service.go | 62 +- .../aws-sdk-go/service/codedeploy/waiters.go | 11 +- .../aws-sdk-go/service/codepipeline/api.go | 979 +- .../codepipelineiface/interface.go | 8 +- .../aws-sdk-go/service/codepipeline/doc.go | 140 + .../aws-sdk-go/service/codepipeline/errors.go | 2 +- .../service/codepipeline/examples_test.go | 783 - .../service/codepipeline/service.go | 118 +- .../aws/aws-sdk-go/service/codestar/api.go | 3681 ++++ .../codestar/codestariface/interface.go | 136 + .../aws/aws-sdk-go/service/codestar/doc.go | 76 + .../aws/aws-sdk-go/service/codestar/errors.go | 91 + .../aws-sdk-go/service/codestar/service.go | 95 + .../aws-sdk-go/service/cognitoidentity/api.go | 345 +- .../cognitoidentityiface/interface.go | 4 +- .../aws-sdk-go/service/cognitoidentity/doc.go | 59 + .../service/cognitoidentity/errors.go | 2 +- .../service/cognitoidentity/examples_test.go | 506 - .../service/cognitoidentity/service.go | 41 +- .../service/cognitoidentityprovider/api.go | 6633 +++++- .../cognitoidentityprovideriface/interface.go | 76 +- .../service/cognitoidentityprovider/doc.go | 35 + .../service/cognitoidentityprovider/errors.go | 43 +- .../cognitoidentityprovider/examples_test.go | 1754 -- .../cognitoidentityprovider/service.go | 17 +- .../aws/aws-sdk-go/service/cognitosync/api.go | 326 +- .../cognitosync/cognitosynciface/interface.go | 4 +- .../aws/aws-sdk-go/service/cognitosync/doc.go | 45 + .../aws-sdk-go/service/cognitosync/errors.go | 2 +- .../service/cognitosync/examples_test.go | 428 - .../aws-sdk-go/service/cognitosync/service.go | 27 +- .../aws-sdk-go/service/configservice/api.go | 890 +- .../configserviceiface/interface.go | 8 +- .../aws-sdk-go/service/configservice/doc.go | 51 + .../service/configservice/errors.go | 2 +- .../service/configservice/examples_test.go | 687 - .../service/configservice/service.go | 33 +- .../service/costandusagereportservice/api.go | 68 +- .../interface.go | 4 +- .../service/costandusagereportservice/doc.go | 28 + .../costandusagereportservice/errors.go | 2 +- .../examples_test.go | 96 - .../costandusagereportservice/service.go | 12 +- .../service/databasemigrationservice/api.go | 3380 ++- .../interface.go | 68 +- .../service/databasemigrationservice/doc.go | 37 + .../databasemigrationservice/errors.go | 14 +- .../databasemigrationservice/examples_test.go | 1514 +- .../databasemigrationservice/service.go | 18 +- .../aws-sdk-go/service/datapipeline/api.go | 388 +- .../datapipelineiface/interface.go | 4 +- .../aws-sdk-go/service/datapipeline/doc.go | 49 + .../aws-sdk-go/service/datapipeline/errors.go | 2 +- .../service/datapipeline/examples_test.go | 568 - .../service/datapipeline/service.go | 31 +- .../aws/aws-sdk-go/service/dax/api.go | 4677 ++++ .../service/dax/daxiface/interface.go | 148 + .../aws/aws-sdk-go/service/dax/doc.go | 33 + .../aws/aws-sdk-go/service/dax/errors.go | 160 + .../aws/aws-sdk-go/service/dax/service.go | 95 + .../aws/aws-sdk-go/service/devicefarm/api.go | 1617 +- .../devicefarm/devicefarmiface/interface.go | 8 +- .../aws/aws-sdk-go/service/devicefarm/doc.go | 30 + .../aws-sdk-go/service/devicefarm/errors.go | 2 +- .../service/devicefarm/examples_test.go | 1986 +- .../aws-sdk-go/service/devicefarm/service.go | 14 +- .../aws-sdk-go/service/directconnect/api.go | 724 +- .../directconnectiface/interface.go | 4 +- .../aws-sdk-go/service/directconnect/doc.go | 39 + .../service/directconnect/errors.go | 2 +- .../service/directconnect/examples_test.go | 895 - .../service/directconnect/service.go | 23 +- .../service/directoryservice/api.go | 1292 +- .../directoryserviceiface/interface.go | 15 +- .../service/directoryservice/doc.go | 40 + .../service/directoryservice/errors.go | 9 +- .../service/directoryservice/examples_test.go | 971 - .../service/directoryservice/service.go | 22 +- .../aws/aws-sdk-go/service/dynamodb/api.go | 532 +- .../service/dynamodb/customizations.go | 23 +- .../service/dynamodb/customizations_test.go | 79 +- .../aws/aws-sdk-go/service/dynamodb/doc.go | 45 + .../aws-sdk-go/service/dynamodb/doc_custom.go | 27 + .../dynamodb/dynamodbattribute/decode.go | 13 +- .../dynamodb/dynamodbattribute/decode_test.go | 28 + .../service/dynamodb/dynamodbattribute/doc.go | 94 +- .../dynamodb/dynamodbattribute/encode.go | 11 +- .../dynamodb/dynamodbattribute/encode_test.go | 28 + .../dynamodb/dynamodbiface/interface.go | 4 +- .../aws/aws-sdk-go/service/dynamodb/errors.go | 2 +- .../service/dynamodb/examples_test.go | 2043 +- .../service/dynamodb/expression/condition.go | 1577 ++ .../dynamodb/expression/condition_test.go | 1615 ++ .../service/dynamodb/expression/doc.go | 48 + .../service/dynamodb/expression/error.go | 59 + .../service/dynamodb/expression/error_test.go | 51 + .../dynamodb/expression/examples_test.go | 315 + .../service/dynamodb/expression/expression.go | 635 + .../dynamodb/expression/expression_test.go | 1082 + .../dynamodb/expression/key_condition.go | 557 + .../dynamodb/expression/key_condition_test.go | 446 + .../service/dynamodb/expression/operand.go | 620 + .../dynamodb/expression/operand_test.go | 144 + .../service/dynamodb/expression/projection.go | 148 + .../dynamodb/expression/projection_test.go | 215 + .../service/dynamodb/expression/update.go | 391 + .../dynamodb/expression/update_test.go | 771 + .../aws-sdk-go/service/dynamodb/service.go | 27 +- .../aws-sdk-go/service/dynamodb/waiters.go | 20 +- .../aws-sdk-go/service/dynamodbstreams/api.go | 79 +- .../aws-sdk-go/service/dynamodbstreams/doc.go | 31 + .../dynamodbstreamsiface/interface.go | 4 +- .../service/dynamodbstreams/errors.go | 2 +- .../service/dynamodbstreams/examples_test.go | 183 +- .../service/dynamodbstreams/service.go | 15 +- .../aws/aws-sdk-go/service/ec2/api.go | 8440 +++++--- .../aws/aws-sdk-go/service/ec2/doc.go | 31 + .../service/ec2/ec2iface/interface.go | 60 +- .../aws/aws-sdk-go/service/ec2/errors.go | 2 +- .../aws-sdk-go/service/ec2/examples_test.go | 9451 +++----- .../aws/aws-sdk-go/service/ec2/service.go | 15 +- .../aws/aws-sdk-go/service/ec2/waiters.go | 286 +- .../aws/aws-sdk-go/service/ecr/api.go | 350 +- .../aws/aws-sdk-go/service/ecr/doc.go | 33 + .../service/ecr/ecriface/interface.go | 4 +- .../aws/aws-sdk-go/service/ecr/errors.go | 2 +- .../aws-sdk-go/service/ecr/examples_test.go | 669 +- .../aws/aws-sdk-go/service/ecr/service.go | 17 +- .../aws/aws-sdk-go/service/ecs/api.go | 928 +- .../aws/aws-sdk-go/service/ecs/doc.go | 39 + .../service/ecs/ecsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/ecs/errors.go | 2 +- .../aws-sdk-go/service/ecs/examples_test.go | 1686 +- .../aws/aws-sdk-go/service/ecs/service.go | 21 +- .../aws/aws-sdk-go/service/ecs/waiters.go | 38 +- .../aws/aws-sdk-go/service/efs/api.go | 272 +- .../aws/aws-sdk-go/service/efs/doc.go | 32 + .../service/efs/efsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/efs/errors.go | 2 +- .../aws-sdk-go/service/efs/examples_test.go | 508 +- .../aws/aws-sdk-go/service/efs/service.go | 16 +- .../aws/aws-sdk-go/service/elasticache/api.go | 1176 +- .../aws/aws-sdk-go/service/elasticache/doc.go | 38 + .../elasticache/elasticacheiface/interface.go | 8 +- .../aws-sdk-go/service/elasticache/errors.go | 22 +- .../service/elasticache/examples_test.go | 2400 +- .../aws-sdk-go/service/elasticache/service.go | 20 +- .../aws-sdk-go/service/elasticache/waiters.go | 38 +- .../service/elasticbeanstalk/api.go | 872 +- .../service/elasticbeanstalk/doc.go | 44 + .../elasticbeanstalkiface/interface.go | 4 +- .../service/elasticbeanstalk/errors.go | 2 +- .../service/elasticbeanstalk/examples_test.go | 1666 +- .../service/elasticbeanstalk/service.go | 26 +- .../service/elasticsearchservice/api.go | 351 +- .../service/elasticsearchservice/doc.go | 31 + .../elasticsearchserviceiface/interface.go | 4 +- .../service/elasticsearchservice/errors.go | 2 +- .../elasticsearchservice/examples_test.go | 352 - .../service/elasticsearchservice/service.go | 15 +- .../service/elastictranscoder/api.go | 358 +- .../service/elastictranscoder/doc.go | 26 + .../elastictranscoderiface/interface.go | 4 +- .../service/elastictranscoder/errors.go | 2 +- .../elastictranscoder/examples_test.go | 839 - .../service/elastictranscoder/service.go | 11 +- .../service/elastictranscoder/waiters.go | 11 +- .../aws/aws-sdk-go/service/elb/api.go | 805 +- .../aws/aws-sdk-go/service/elb/doc.go | 55 + .../service/elb/elbiface/interface.go | 8 +- .../aws/aws-sdk-go/service/elb/errors.go | 4 +- .../aws-sdk-go/service/elb/examples_test.go | 1863 +- .../aws/aws-sdk-go/service/elb/service.go | 36 +- .../aws/aws-sdk-go/service/elb/waiters.go | 34 +- .../aws/aws-sdk-go/service/elbv2/api.go | 1391 +- .../aws/aws-sdk-go/service/elbv2/doc.go | 76 + .../service/elbv2/elbv2iface/interface.go | 23 +- .../aws/aws-sdk-go/service/elbv2/errors.go | 16 +- .../aws-sdk-go/service/elbv2/examples_test.go | 2107 +- .../aws/aws-sdk-go/service/elbv2/service.go | 55 +- .../aws/aws-sdk-go/service/elbv2/waiters.go | 270 + .../aws/aws-sdk-go/service/emr/api.go | 752 +- .../aws/aws-sdk-go/service/emr/doc.go | 31 + .../service/emr/emriface/interface.go | 4 +- .../aws/aws-sdk-go/service/emr/errors.go | 2 +- .../aws-sdk-go/service/emr/examples_test.go | 1127 - .../aws/aws-sdk-go/service/emr/service.go | 15 +- .../aws/aws-sdk-go/service/emr/waiters.go | 29 +- .../aws/aws-sdk-go/service/firehose/api.go | 793 +- .../aws/aws-sdk-go/service/firehose/doc.go | 30 + .../aws/aws-sdk-go/service/firehose/errors.go | 8 +- .../service/firehose/examples_test.go | 606 - .../firehose/firehoseiface/interface.go | 8 +- .../aws-sdk-go/service/firehose/service.go | 14 +- .../aws/aws-sdk-go/service/gamelift/api.go | 8340 ++++++- .../aws/aws-sdk-go/service/gamelift/doc.go | 304 + .../aws/aws-sdk-go/service/gamelift/errors.go | 8 +- .../service/gamelift/examples_test.go | 1227 -- .../gamelift/gameliftiface/interface.go | 76 +- .../aws-sdk-go/service/gamelift/service.go | 209 +- .../aws/aws-sdk-go/service/glacier/api.go | 662 +- .../aws/aws-sdk-go/service/glacier/doc.go | 56 + .../aws/aws-sdk-go/service/glacier/errors.go | 2 +- .../service/glacier/examples_test.go | 1497 +- .../service/glacier/glacieriface/interface.go | 4 +- .../aws/aws-sdk-go/service/glacier/service.go | 39 +- .../aws-sdk-go/service/glacier/treehash.go | 12 +- .../service/glacier/treehash_test.go | 45 +- .../aws/aws-sdk-go/service/glacier/waiters.go | 20 +- .../aws/aws-sdk-go/service/glue/api.go | 18049 ++++++++++++++++ .../aws/aws-sdk-go/service/glue/doc.go | 28 + .../aws/aws-sdk-go/service/glue/errors.go | 120 + .../service/glue/glueiface/interface.go | 399 + .../aws/aws-sdk-go/service/glue/service.go | 95 + .../aws/aws-sdk-go/service/greengrass/api.go | 11574 ++++++++++ .../aws/aws-sdk-go/service/greengrass/doc.go | 33 + .../aws-sdk-go/service/greengrass/errors.go | 18 + .../greengrass/greengrassiface/interface.go | 324 + .../aws-sdk-go/service/greengrass/service.go | 97 + .../aws/aws-sdk-go/service/health/api.go | 149 +- .../aws/aws-sdk-go/service/health/doc.go | 65 + .../aws/aws-sdk-go/service/health/errors.go | 2 +- .../service/health/examples_test.go | 335 - .../service/health/healthiface/interface.go | 4 +- .../aws/aws-sdk-go/service/health/service.go | 47 +- .../aws/aws-sdk-go/service/iam/api.go | 3473 +-- .../aws/aws-sdk-go/service/iam/doc.go | 80 + .../aws/aws-sdk-go/service/iam/errors.go | 20 +- .../aws-sdk-go/service/iam/examples_test.go | 4276 ++-- .../service/iam/iamiface/interface.go | 20 +- .../aws/aws-sdk-go/service/iam/service.go | 62 +- .../aws/aws-sdk-go/service/iam/waiters.go | 20 +- .../aws/aws-sdk-go/service/inspector/api.go | 1344 +- .../aws/aws-sdk-go/service/inspector/doc.go | 30 + .../aws-sdk-go/service/inspector/errors.go | 12 +- .../service/inspector/examples_test.go | 1806 +- .../inspector/inspectoriface/interface.go | 32 +- .../aws-sdk-go/service/inspector/service.go | 14 +- .../aws/aws-sdk-go/service/iot/api.go | 1187 +- .../aws/aws-sdk-go/service/iot/doc.go | 33 + .../aws/aws-sdk-go/service/iot/errors.go | 2 +- .../aws-sdk-go/service/iot/examples_test.go | 1453 -- .../service/iot/iotiface/interface.go | 4 +- .../aws/aws-sdk-go/service/iot/service.go | 16 +- .../aws-sdk-go/service/iotdataplane/api.go | 99 +- .../aws-sdk-go/service/iotdataplane/doc.go | 31 + .../aws-sdk-go/service/iotdataplane/errors.go | 2 +- .../service/iotdataplane/examples_test.go | 103 - .../iotdataplaneiface/interface.go | 4 +- .../service/iotdataplane/service.go | 17 +- .../aws/aws-sdk-go/service/kinesis/api.go | 1014 +- .../service/kinesis/customizations.go | 22 + .../service/kinesis/customizations_test.go | 89 + .../aws/aws-sdk-go/service/kinesis/doc.go | 29 + .../aws/aws-sdk-go/service/kinesis/errors.go | 45 +- .../service/kinesis/examples_test.go | 460 - .../service/kinesis/kinesisiface/interface.go | 15 +- .../aws/aws-sdk-go/service/kinesis/service.go | 13 +- .../aws/aws-sdk-go/service/kinesis/waiters.go | 57 +- .../service/kinesisanalytics/api.go | 940 +- .../service/kinesisanalytics/doc.go | 26 + .../service/kinesisanalytics/errors.go | 16 +- .../service/kinesisanalytics/examples_test.go | 550 - .../kinesisanalyticsiface/interface.go | 16 +- .../service/kinesisanalytics/service.go | 12 +- .../aws/aws-sdk-go/service/kms/api.go | 783 +- .../aws/aws-sdk-go/service/kms/doc.go | 98 + .../aws/aws-sdk-go/service/kms/errors.go | 2 +- .../aws-sdk-go/service/kms/examples_test.go | 1714 +- .../service/kms/kmsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/kms/service.go | 80 +- .../aws/aws-sdk-go/service/lambda/api.go | 1531 +- .../aws/aws-sdk-go/service/lambda/doc.go | 34 + .../aws/aws-sdk-go/service/lambda/errors.go | 12 +- .../service/lambda/examples_test.go | 1165 +- .../service/lambda/lambdaiface/interface.go | 16 +- .../aws/aws-sdk-go/service/lambda/service.go | 15 +- .../service/lexmodelbuildingservice/api.go | 10261 +++++++++ .../service/lexmodelbuildingservice/doc.go | 30 + .../service/lexmodelbuildingservice/errors.go | 61 + .../lexmodelbuildingservice/examples_test.go | 481 + .../lexmodelbuildingserviceiface/interface.go | 230 + .../lexmodelbuildingservice/service.go | 97 + .../service/lexruntimeservice/api.go | 887 +- .../service/lexruntimeservice/doc.go | 38 + .../service/lexruntimeservice/errors.go | 43 +- .../lexruntimeservice/examples_test.go | 44 - .../lexruntimeserviceiface/interface.go | 12 +- .../service/lexruntimeservice/service.go | 22 +- .../aws/aws-sdk-go/service/lightsail/api.go | 1407 +- .../aws/aws-sdk-go/service/lightsail/doc.go | 40 + .../aws-sdk-go/service/lightsail/errors.go | 6 +- .../service/lightsail/examples_test.go | 1068 - .../lightsail/lightsailiface/interface.go | 8 +- .../aws-sdk-go/service/lightsail/service.go | 22 +- .../aws-sdk-go/service/machinelearning/api.go | 567 +- .../aws-sdk-go/service/machinelearning/doc.go | 26 + .../service/machinelearning/errors.go | 2 +- .../service/machinelearning/examples_test.go | 737 - .../machinelearningiface/interface.go | 4 +- .../service/machinelearning/service.go | 11 +- .../service/machinelearning/waiters.go | 38 +- .../marketplacecommerceanalytics/api.go | 170 +- .../marketplacecommerceanalytics/doc.go | 28 + .../marketplacecommerceanalytics/errors.go | 2 +- .../examples_test.go | 76 - .../interface.go | 4 +- .../marketplacecommerceanalytics/service.go | 12 +- .../marketplaceentitlementservice/api.go | 351 + .../marketplaceentitlementservice/doc.go | 39 + .../marketplaceentitlementservice/errors.go | 25 + .../interface.go | 68 + .../marketplaceentitlementservice/service.go | 98 + .../service/marketplacemetering/api.go | 60 +- .../service/marketplacemetering/doc.go | 48 + .../service/marketplacemetering/errors.go | 2 +- .../marketplacemetering/examples_test.go | 92 - .../marketplacemeteringiface/interface.go | 4 +- .../service/marketplacemetering/service.go | 30 +- .../aws-sdk-go/service/migrationhub/api.go | 3717 ++++ .../aws-sdk-go/service/migrationhub/doc.go | 26 + .../aws-sdk-go/service/migrationhub/errors.go | 64 + .../migrationhubiface/interface.go | 128 + .../service/migrationhub/service.go | 95 + .../aws/aws-sdk-go/service/mobile/api.go | 1995 ++ .../aws/aws-sdk-go/service/mobile/doc.go | 31 + .../aws/aws-sdk-go/service/mobile/errors.go | 61 + .../service/mobile/mobileiface/interface.go | 106 + .../aws/aws-sdk-go/service/mobile/service.go | 97 + .../aws-sdk-go/service/mobileanalytics/api.go | 22 +- .../aws-sdk-go/service/mobileanalytics/doc.go | 27 + .../service/mobileanalytics/errors.go | 2 +- .../service/mobileanalytics/examples_test.go | 60 - .../mobileanalyticsiface/interface.go | 4 +- .../service/mobileanalytics/service.go | 12 +- .../aws/aws-sdk-go/service/mturk/api.go | 824 +- .../aws/aws-sdk-go/service/mturk/doc.go | 28 + .../aws/aws-sdk-go/service/mturk/errors.go | 2 +- .../aws-sdk-go/service/mturk/examples_test.go | 1096 - .../service/mturk/mturkiface/interface.go | 4 +- .../aws/aws-sdk-go/service/mturk/service.go | 11 +- .../aws/aws-sdk-go/service/opsworks/api.go | 2826 ++- .../aws/aws-sdk-go/service/opsworks/doc.go | 97 + .../aws/aws-sdk-go/service/opsworks/errors.go | 2 +- .../service/opsworks/examples_test.go | 2035 -- .../opsworks/opsworksiface/interface.go | 16 +- .../aws-sdk-go/service/opsworks/service.go | 75 +- .../aws-sdk-go/service/opsworks/waiters.go | 56 +- .../aws/aws-sdk-go/service/opsworkscm/api.go | 290 +- .../aws/aws-sdk-go/service/opsworkscm/doc.go | 75 + .../aws-sdk-go/service/opsworkscm/errors.go | 2 +- .../service/opsworkscm/examples_test.go | 391 - .../opsworkscm/opsworkscmiface/interface.go | 4 +- .../aws-sdk-go/service/opsworkscm/service.go | 57 +- .../aws-sdk-go/service/organizations/api.go | 4565 +++- .../aws-sdk-go/service/organizations/doc.go | 139 + .../service/organizations/errors.go | 167 +- .../service/organizations/examples_test.go | 2103 +- .../organizationsiface/interface.go | 40 +- .../service/organizations/service.go | 121 +- .../aws/aws-sdk-go/service/pinpoint/api.go | 7057 +++++- .../aws/aws-sdk-go/service/pinpoint/doc.go | 26 + .../aws/aws-sdk-go/service/pinpoint/errors.go | 14 +- .../service/pinpoint/examples_test.go | 1254 -- .../pinpoint/pinpointiface/interface.go | 92 +- .../aws-sdk-go/service/pinpoint/service.go | 11 +- .../aws/aws-sdk-go/service/polly/api.go | 159 +- .../service/polly/customizations_test.go | 27 +- .../aws/aws-sdk-go/service/polly/doc.go | 34 + .../aws/aws-sdk-go/service/polly/errors.go | 15 +- .../aws-sdk-go/service/polly/examples_test.go | 272 +- .../service/polly/pollyiface/interface.go | 4 +- .../aws/aws-sdk-go/service/polly/service.go | 16 +- .../aws/aws-sdk-go/service/rds/api.go | 3805 ++-- .../aws/aws-sdk-go/service/rds/doc.go | 69 + .../aws/aws-sdk-go/service/rds/doc_custom.go | 25 + .../aws/aws-sdk-go/service/rds/errors.go | 6 +- .../aws-sdk-go/service/rds/examples_test.go | 4685 ++-- .../service/rds/rdsiface/interface.go | 12 +- .../service/rds/rdsutils/connect.go | 70 + .../service/rds/rdsutils/connect_test.go | 39 + .../aws/aws-sdk-go/service/rds/service.go | 52 +- .../aws/aws-sdk-go/service/rds/waiters.go | 20 +- .../aws/aws-sdk-go/service/redshift/api.go | 1607 +- .../aws/aws-sdk-go/service/redshift/doc.go | 51 + .../aws/aws-sdk-go/service/redshift/errors.go | 9 +- .../service/redshift/examples_test.go | 1711 -- .../redshift/redshiftiface/interface.go | 8 +- .../aws-sdk-go/service/redshift/service.go | 33 +- .../aws-sdk-go/service/redshift/waiters.go | 38 +- .../aws/aws-sdk-go/service/rekognition/api.go | 1342 +- .../aws/aws-sdk-go/service/rekognition/doc.go | 26 + .../aws-sdk-go/service/rekognition/errors.go | 2 +- .../service/rekognition/examples_test.go | 607 +- .../rekognition/rekognitioniface/interface.go | 16 +- .../aws-sdk-go/service/rekognition/service.go | 11 +- .../service/resourcegroupstaggingapi/api.go | 1325 ++ .../service/resourcegroupstaggingapi/doc.go | 64 + .../resourcegroupstaggingapi/errors.go | 33 + .../interface.go | 93 + .../resourcegroupstaggingapi/service.go | 95 + .../aws/aws-sdk-go/service/route53/api.go | 3305 +-- .../aws/aws-sdk-go/service/route53/doc.go | 26 + .../aws/aws-sdk-go/service/route53/errors.go | 79 +- .../service/route53/examples_test.go | 1786 +- .../service/route53/route53iface/interface.go | 20 +- .../aws/aws-sdk-go/service/route53/service.go | 12 +- .../aws/aws-sdk-go/service/route53/waiters.go | 11 +- .../aws-sdk-go/service/route53domains/api.go | 1417 +- .../aws-sdk-go/service/route53domains/doc.go | 29 + .../service/route53domains/errors.go | 2 +- .../service/route53domains/examples_test.go | 755 - .../route53domainsiface/interface.go | 4 +- .../service/route53domains/service.go | 12 +- .../aws/aws-sdk-go/service/s3/api.go | 2130 +- .../aws-sdk-go/service/s3/bucket_location.go | 65 +- .../service/s3/bucket_location_test.go | 85 +- .../aws-sdk-go/service/s3/customizations.go | 18 + .../aws/aws-sdk-go/service/s3/doc.go | 26 + .../aws/aws-sdk-go/service/s3/doc_custom.go | 109 + .../aws/aws-sdk-go/service/s3/errors.go | 2 +- .../aws-sdk-go/service/s3/examples_test.go | 3779 ++-- .../service/s3/host_style_bucket.go | 13 +- .../service/s3/s3crypto/cipher_builder.go | 2 +- .../service/s3/s3crypto/envelope.go | 2 +- .../service/s3/s3iface/interface.go | 4 +- .../aws-sdk-go/service/s3/s3manager/batch.go | 500 + .../service/s3/s3manager/batch_test.go | 975 + .../service/s3/s3manager/bucket_region.go | 83 + .../s3/s3manager/bucket_region_test.go | 92 + .../service/s3/s3manager/download.go | 134 +- .../service/s3/s3manager/download_test.go | 289 +- .../s3/s3manager/s3manageriface/interface.go | 3 + .../aws-sdk-go/service/s3/s3manager/upload.go | 64 +- .../service/s3/s3manager/upload_test.go | 440 +- .../aws/aws-sdk-go/service/s3/service.go | 12 +- .../aws/aws-sdk-go/service/s3/sse.go | 18 +- .../service/s3/statusok_error_test.go | 2 +- .../aws/aws-sdk-go/service/s3/waiters.go | 38 +- .../aws-sdk-go/service/servicecatalog/api.go | 4218 +++- .../aws-sdk-go/service/servicecatalog/doc.go | 40 + .../service/servicecatalog/errors.go | 18 +- .../service/servicecatalog/examples_test.go | 1146 - .../service/servicecatalog/service.go | 22 +- .../servicecatalogiface/interface.go | 74 +- .../aws/aws-sdk-go/service/ses/api.go | 2043 +- .../aws/aws-sdk-go/service/ses/doc.go | 34 + .../aws/aws-sdk-go/service/ses/errors.go | 33 +- .../aws-sdk-go/service/ses/examples_test.go | 2046 +- .../aws/aws-sdk-go/service/ses/service.go | 16 +- .../service/ses/sesiface/interface.go | 16 +- .../aws/aws-sdk-go/service/ses/waiters.go | 11 +- .../aws/aws-sdk-go/service/sfn/api.go | 358 +- .../aws/aws-sdk-go/service/sfn/doc.go | 43 + .../aws/aws-sdk-go/service/sfn/errors.go | 2 +- .../aws-sdk-go/service/sfn/examples_test.go | 391 - .../aws/aws-sdk-go/service/sfn/service.go | 25 +- .../service/sfn/sfniface/interface.go | 4 +- .../aws/aws-sdk-go/service/shield/api.go | 174 +- .../aws/aws-sdk-go/service/shield/doc.go | 32 + .../aws/aws-sdk-go/service/shield/errors.go | 2 +- .../service/shield/examples_test.go | 214 - .../aws/aws-sdk-go/service/shield/service.go | 16 +- .../service/shield/shieldiface/interface.go | 4 +- .../aws/aws-sdk-go/service/simpledb/api.go | 209 +- .../aws/aws-sdk-go/service/simpledb/doc.go | 40 + .../aws/aws-sdk-go/service/simpledb/errors.go | 2 +- .../service/simpledb/examples_test.go | 289 - .../aws-sdk-go/service/simpledb/service.go | 23 +- .../simpledb/simpledbiface/interface.go | 4 +- .../aws/aws-sdk-go/service/sms/api.go | 244 +- .../aws/aws-sdk-go/service/sms/doc.go | 29 + .../aws/aws-sdk-go/service/sms/errors.go | 2 +- .../aws-sdk-go/service/sms/examples_test.go | 260 - .../aws/aws-sdk-go/service/sms/service.go | 13 +- .../service/sms/smsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/snowball/api.go | 473 +- .../aws/aws-sdk-go/service/snowball/doc.go | 35 + .../aws/aws-sdk-go/service/snowball/errors.go | 9 +- .../service/snowball/examples_test.go | 1047 +- .../aws-sdk-go/service/snowball/service.go | 19 +- .../snowball/snowballiface/interface.go | 4 +- .../aws/aws-sdk-go/service/sns/api.go | 613 +- .../aws/aws-sdk-go/service/sns/doc.go | 40 + .../aws/aws-sdk-go/service/sns/errors.go | 2 +- .../aws-sdk-go/service/sns/examples_test.go | 704 - .../aws/aws-sdk-go/service/sns/service.go | 22 +- .../service/sns/snsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/sqs/api.go | 561 +- .../aws/aws-sdk-go/service/sqs/doc.go | 63 + .../aws/aws-sdk-go/service/sqs/errors.go | 2 +- .../aws-sdk-go/service/sqs/examples_test.go | 472 - .../aws/aws-sdk-go/service/sqs/service.go | 45 +- .../service/sqs/sqsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/ssm/api.go | 8214 ++++++- .../aws/aws-sdk-go/service/ssm/doc.go | 40 + .../aws/aws-sdk-go/service/ssm/errors.go | 160 +- .../aws-sdk-go/service/ssm/examples_test.go | 2300 -- .../aws/aws-sdk-go/service/ssm/service.go | 24 +- .../service/ssm/ssmiface/interface.go | 77 +- .../aws-sdk-go/service/storagegateway/api.go | 1777 +- .../aws-sdk-go/service/storagegateway/doc.go | 79 + .../service/storagegateway/errors.go | 2 +- .../service/storagegateway/examples_test.go | 2613 ++- .../service/storagegateway/service.go | 61 +- .../storagegatewayiface/interface.go | 8 +- .../aws/aws-sdk-go/service/sts/api.go | 142 +- .../aws/aws-sdk-go/service/sts/doc.go | 72 + .../aws/aws-sdk-go/service/sts/errors.go | 2 +- .../aws-sdk-go/service/sts/examples_test.go | 328 +- .../aws/aws-sdk-go/service/sts/service.go | 54 +- .../service/sts/stsiface/interface.go | 4 +- .../aws/aws-sdk-go/service/support/api.go | 285 +- .../aws/aws-sdk-go/service/support/doc.go | 77 + .../aws/aws-sdk-go/service/support/errors.go | 2 +- .../service/support/examples_test.go | 360 - .../aws/aws-sdk-go/service/support/service.go | 59 +- .../service/support/supportiface/interface.go | 4 +- .../aws/aws-sdk-go/service/swf/api.go | 3232 +-- .../aws/aws-sdk-go/service/swf/doc.go | 38 + .../aws/aws-sdk-go/service/swf/errors.go | 24 +- .../aws-sdk-go/service/swf/examples_test.go | 962 - .../aws/aws-sdk-go/service/swf/service.go | 21 +- .../service/swf/swfiface/interface.go | 4 +- .../aws/aws-sdk-go/service/waf/api.go | 2351 +- .../aws/aws-sdk-go/service/waf/doc.go | 34 + .../aws/aws-sdk-go/service/waf/errors.go | 5 +- .../aws-sdk-go/service/waf/examples_test.go | 2237 +- .../aws/aws-sdk-go/service/waf/service.go | 18 +- .../service/waf/wafiface/interface.go | 28 +- .../aws/aws-sdk-go/service/wafregional/api.go | 1688 +- .../aws/aws-sdk-go/service/wafregional/doc.go | 36 + .../aws-sdk-go/service/wafregional/errors.go | 5 +- .../service/wafregional/examples_test.go | 2322 +- .../aws-sdk-go/service/wafregional/service.go | 20 +- .../wafregional/wafregionaliface/interface.go | 28 +- .../aws/aws-sdk-go/service/workdocs/api.go | 3683 +++- .../aws/aws-sdk-go/service/workdocs/doc.go | 58 + .../aws/aws-sdk-go/service/workdocs/errors.go | 37 +- .../service/workdocs/examples_test.go | 703 - .../aws-sdk-go/service/workdocs/service.go | 40 +- .../workdocs/workdocsiface/interface.go | 44 +- .../aws/aws-sdk-go/service/workspaces/api.go | 311 +- .../aws/aws-sdk-go/service/workspaces/doc.go | 29 + .../aws-sdk-go/service/workspaces/errors.go | 10 +- .../service/workspaces/examples_test.go | 392 - .../aws-sdk-go/service/workspaces/service.go | 13 +- .../workspaces/workspacesiface/interface.go | 4 +- .../aws/aws-sdk-go/service/xray/api.go | 235 +- .../aws/aws-sdk-go/service/xray/doc.go | 29 + .../aws/aws-sdk-go/service/xray/errors.go | 2 +- .../aws-sdk-go/service/xray/examples_test.go | 179 - .../aws/aws-sdk-go/service/xray/service.go | 13 +- .../service/xray/xrayiface/interface.go | 4 +- 1096 files changed, 309697 insertions(+), 132612 deletions(-) create mode 100644 vendor/github.com/aws/aws-sdk-go/.github/ISSUE_TEMPLATE.md create mode 100644 vendor/github.com/aws/aws-sdk-go/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 vendor/github.com/aws/aws-sdk-go/Gopkg.lock create mode 100644 vendor/github.com/aws/aws-sdk-go/Gopkg.toml create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/arn/arn_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/logger.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/doc_1_7.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/url.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.9 create mode 100644 vendor/github.com/aws/aws-sdk-go/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/credentials/plugincreds/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/credentials/plugincreds/main.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/credentials/plugincreds/plugin/plugin.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/dynamodb/expression/readme.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/dynamodb/expression/scan.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/ec2/instancesbyRegion/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/ec2/instancesbyRegion/instancesByRegion.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/iam_authentication.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/client/client.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/server/server.go create mode 100644 vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go create mode 100644 vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/AWS Glue/2017-03-31/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/AWS Glue/2017-03-31/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/AWS Glue/2017-03-31/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/AWS Glue/2017-03-31/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/MobileHub/2017-07-01/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/MobileHub/2017-07-01/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/MobileHub/2017-07-01/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/MobileHub/2017-07-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/appstream/2016-12-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/batch/2016-08-10/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudhsmv2/2017-04-28/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudhsmv2/2017-04-28/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudhsmv2/2017-04-28/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudhsmv2/2017-04-28/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codepipeline/2015-07-09/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cognito-idp/2016-04-18/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/dax/2017-04-19/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/dax/2017-04-19/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/dax/2017-04-19/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/dax/2017-04-19/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/discovery/2015-11-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/dms/2016-01-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/ds/2015-04-16/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticfilesystem/2015-02-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancingv2/2015-12-01/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/entitlement.marketplace/2017-01-11/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/entitlement.marketplace/2017-01-11/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/entitlement.marketplace/2017-01-11/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/entitlement.marketplace/2017-01-11/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/firehose/2015-08-04/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/greengrass/2017-06-07/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/greengrass/2017-06-07/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/iot/2015-05-28/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/kinesisanalytics/2015-08-14/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/mgh/2017-05-31/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/mgh/2017-05-31/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/mgh/2017-05-31/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/mgh/2017-05-31/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/polly/2016-06-10/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/servicecatalog/2015-12-10/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/sts/2011-06-15/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/swf/2012-01-25/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/xray/2016-04-12/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/example.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/example_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/examples_builder.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/examples_builder_customizations.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/list_of_shame.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/passes_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/sdk.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/acm/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/acm/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/apigateway/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/apigateway/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/applicationdiscoveryservice/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/applicationdiscoveryservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appstream/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/appstream/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/athena/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/athena/athenaiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/athena/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/athena/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/athena/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/batch/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/budgets/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/budgets/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/clouddirectory/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/clouddirectory/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudformation/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudformation/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudfront/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsm/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsm/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsmv2/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsmv2/cloudhsmv2iface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsmv2/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsmv2/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsmv2/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudsearch/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudsearch/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudsearchdomain/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudsearchdomain/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudtrail/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudtrail/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatch/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codebuild/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codecommit/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/codecommit/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codedeploy/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codepipeline/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/codepipeline/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/codestariface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitoidentityprovider/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitoidentityprovider/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitosync/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitosync/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/configservice/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/configservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/datapipeline/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/datapipeline/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dax/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dax/daxiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dax/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dax/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dax/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/devicefarm/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/directconnect/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/directconnect/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/directoryservice/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/directoryservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/doc_custom.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/condition.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/condition_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/error.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/error_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/expression.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/expression_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/key_condition.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/key_condition_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/operand.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/operand_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/projection.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/projection_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/update.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/expression/update_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodbstreams/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ecr/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ecs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/efs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticache/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/emr/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/emr/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/firehose/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/firehose/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/gamelift/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/gamelift/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glacier/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glue/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glue/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glue/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glue/glueiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glue/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/greengrass/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/greengrass/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/greengrass/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/greengrass/greengrassiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/greengrass/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/health/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/health/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/iam/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/inspector/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/iot/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/iot/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/iotdataplane/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/iotdataplane/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesisanalytics/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesisanalytics/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kms/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lambda/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/lexmodelbuildingserviceiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexruntimeservice/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexruntimeservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/lightsail/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/machinelearning/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/machinelearning/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplacecommerceanalytics/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplacecommerceanalytics/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplaceentitlementservice/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplaceentitlementservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplaceentitlementservice/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplaceentitlementservice/marketplaceentitlementserviceiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplaceentitlementservice/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplacemetering/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplacemetering/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/migrationhub/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/migrationhub/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/migrationhub/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/migrationhub/migrationhubiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/migrationhub/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobile/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobile/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobile/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobile/mobileiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobile/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobileanalytics/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobileanalytics/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mturk/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/mturk/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworks/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworks/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworkscm/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworkscm/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/organizations/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/pinpoint/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/pinpoint/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/polly/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/doc_custom.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/redshift/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/redshift/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rekognition/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53domains/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53domains/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/batch_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/bucket_region.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/bucket_region_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/servicecatalog/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/servicecatalog/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ses/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sfn/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sfn/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/shield/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/shield/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/simpledb/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/simpledb/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sms/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sms/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/snowball/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sns/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sns/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sqs/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sqs/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ssm/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/ssm/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/storagegateway/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/support/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/support/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/swf/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/swf/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/waf/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/wafregional/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workspaces/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/workspaces/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/xray/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/xray/examples_test.go diff --git a/Gopkg.lock b/Gopkg.lock index 4dc16378..5efc871b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -20,9 +20,9 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280" [[projects]] name = "github.com/aws/aws-sdk-go" - packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","private/protocol","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/restxml","private/protocol/xml/xmlutil","service/s3","service/sts"] - revision = "2db5849d2939d93075d911138309a83235032bea" - version = "v1.8.0" + packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","internal/shareddefaults","private/protocol","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/restxml","private/protocol/xml/xmlutil","service/s3","service/sts"] + revision = "c652f9369083515c3ddf1fbaf6df68da2c101545" + version = "v1.12.1" [[projects]] name = "github.com/cheggaaa/pb" diff --git a/vendor/github.com/aws/aws-sdk-go/.github/ISSUE_TEMPLATE.md b/vendor/github.com/aws/aws-sdk-go/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..1ecb636b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,14 @@ +Please fill out the sections below to help us address your issue. + +### Version of AWS SDK for Go? + + +### Version of Go (`go version`)? + + +### What issue did you see? + +### Steps to reproduce + +If you have have an runnable example, please include it. + diff --git a/vendor/github.com/aws/aws-sdk-go/.github/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/aws/aws-sdk-go/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..a9aaa9a8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +For changes to files under the `/model/` folder, and manual edits to autogenerated code (e.g. `/service/s3/api.go`) please create an Issue instead of a PR for those type of changes. + +If there is an existing bug or feature this PR is answers please reference it here. diff --git a/vendor/github.com/aws/aws-sdk-go/.travis.yml b/vendor/github.com/aws/aws-sdk-go/.travis.yml index 02c93210..130d9115 100644 --- a/vendor/github.com/aws/aws-sdk-go/.travis.yml +++ b/vendor/github.com/aws/aws-sdk-go/.travis.yml @@ -1,12 +1,13 @@ language: go -sudo: false +sudo: required go: - 1.5 - 1.6 - 1.7 - 1.8 + - 1.9 - tip # Use Go 1.5's vendoring experiment for 1.5 tests. diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md index 0ad7e24b..d86aaf43 100644 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md @@ -1,3 +1,1124 @@ +Release v1.12.1 (2017-09-27) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/pinpoint`: Updates service API and documentation + * Added two new push notification channels: Amazon Device Messaging (ADM) and, for push notification support in China, Baidu Cloud Push. Added support for APNs auth via .p8 key file. Added operation for direct message deliveries to user IDs, enabling you to message an individual user on multiple endpoints. + +Release v1.12.0 (2017-09-26) +=== + +### SDK Bugs +* `API Marshaler`: Revert REST JSON and XML protocol marshaler improvements + * Bug [#1550](https://github.com/aws/aws-sdk-go/issues/1550) identified a missed condition in the Amazon Route 53 RESTXML protocol marshaling causing requests to that service to fail. Reverting the marshaler improvements until the bug can be fixed. + +Release v1.11.0 (2017-09-26) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service API and documentation + * You can now prevent a stack from being accidentally deleted by enabling termination protection on the stack. If you attempt to delete a stack with termination protection enabled, the deletion fails and the stack, including its status, remains unchanged. You can enable termination protection on a stack when you create it. Termination protection on stacks is disabled by default. After creation, you can set termination protection on a stack whose status is CREATE_COMPLETE, UPDATE_COMPLETE, or UPDATE_ROLLBACK_COMPLETE. + +### SDK Features +* Add dep Go dependency management metadata files (#1544) + * Adds the Go `dep` dependency management metadata files to the SDK. + * Fixes [#1451](https://github.com/aws/aws-sdk-go/issues/1451) + * Fixes [#634](https://github.com/aws/aws-sdk-go/issues/634) +* `service/dynamodb/expression`: Add expression building utility for DynamoDB ([#1527](https://github.com/aws/aws-sdk-go/pull/1527)) + * Adds a new package, expression, to the SDK providing builder utilities to create DynamoDB expressions safely taking advantage of type safety. +* `API Marshaler`: Add generated marshalers for RESTXML protocol ([#1409](https://github.com/aws/aws-sdk-go/pull/1409)) + * Updates the RESTXML protocol marshaler to use generated code instead of reflection for REST XML based services. +* `API Marshaler`: Add generated marshalers for RESTJSON protocol ([#1547](https://github.com/aws/aws-sdk-go/pull/1547)) + * Updates the RESTJSON protocol marshaler to use generated code instead of reflection for REST JSON based services. + +### SDK Enhancements +* `private/protocol`: Update format of REST JSON and XMl benchmarks ([#1546](https://github.com/aws/aws-sdk-go/pull/1546)) + * Updates the format of the REST JSON and XML benchmarks to be readable. RESTJSON benchmarks were updated to more accurately bench building of the protocol. + +Release v1.10.51 (2017-09-22) +=== + +### Service Client Updates +* `service/config`: Updates service API and documentation +* `service/ecs`: Updates service API and documentation + * Amazon ECS users can now add and drop Linux capabilities to their containers through the use of docker's cap-add and cap-drop features. Customers can specify the capabilities they wish to add or drop for each container in their task definition. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/rds`: Updates service documentation + * Documentation updates for rds + +Release v1.10.50 (2017-09-21) +=== + +### Service Client Updates +* `service/budgets`: Updates service API + * Including "DuplicateRecordException" in UpdateNotification and UpdateSubscriber. +* `service/ec2`: Updates service API and documentation + * Add EC2 APIs to copy Amazon FPGA Images (AFIs) within the same region and across multiple regions, delete AFIs, and modify AFI attributes. AFI attributes include name, description and granting/denying other AWS accounts to load the AFI. +* `service/logs`: Updates service API and documentation + * Adds support for associating LogGroups with KMS Keys. + +### SDK Bugs +* Fix greengrass service model being duplicated with different casing. ([#1541](https://github.com/aws/aws-sdk-go/pull/1541)) + * Fixes [#1540](https://github.com/aws/aws-sdk-go/issues/1540) + * Fixes [#1539](https://github.com/aws/aws-sdk-go/issues/1539) +Release v1.10.49 (2017-09-20) +=== + +### Service Client Updates +* `service/Greengrass`: Adds new service +* `service/appstream`: Updates service API and documentation + * API updates for supporting On-Demand fleets. +* `service/codepipeline`: Updates service API and documentation + * This change includes a PipelineMetadata object that is part of the output from the GetPipeline API that includes the Pipeline ARN, created, and updated timestamp. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/rds`: Updates service API and documentation + * Introduces the --option-group-name parameter to the ModifyDBSnapshot CLI command. You can specify this parameter when you upgrade an Oracle DB snapshot. The same option group considerations apply when upgrading a DB snapshot as when upgrading a DB instance. For more information, see http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Oracle.html#USER_UpgradeDBInstance.Oracle.OGPG.OG +* `service/runtime.lex`: Updates service API and documentation + +Release v1.10.48 (2017-09-19) +=== + +### Service Client Updates +* `service/ec2`: Updates service API + * Fixed bug in EC2 clients preventing ElasticGpuSet from being set. + +### SDK Enhancements +* `aws/credentials`: Add EnvProviderName constant. ([#1531](https://github.com/aws/aws-sdk-go/issues/1531)) + * Adds the "EnvConfigCredentials" string literal as EnvProviderName constant. + * Fixes [#1444](https://github.com/aws/aws-sdk-go/issues/1444) + +Release v1.10.47 (2017-09-18) +=== + +### Service Client Updates +* `service/ec2`: Updates service API and documentation + * Amazon EC2 now lets you opt for Spot instances to be stopped in the event of an interruption instead of being terminated. Your Spot request can be fulfilled again by restarting instances from a previously stopped state, subject to availability of capacity at or below your preferred price. When you submit a persistent Spot request, you can choose from "terminate" or "stop" as the instance interruption behavior. Choosing "stop" will shutdown your Spot instances so you can continue from this stopped state later on. This feature is only available for instances with Amazon EBS volume as their root device. +* `service/email`: Updates service API and documentation + * Amazon Simple Email Service (Amazon SES) now lets you customize the domains used for tracking open and click events. Previously, open and click tracking links referred to destinations hosted on domains operated by Amazon SES. With this feature, you can use your own branded domains for capturing open and click events. +* `service/iam`: Updates service API and documentation + * A new API, DeleteServiceLinkedRole, submits a service-linked role deletion request and returns a DeletionTaskId, which you can use to check the status of the deletion. + +Release v1.10.46 (2017-09-15) +=== + +### Service Client Updates +* `service/apigateway`: Updates service API and documentation + * Add a new enum "REQUEST" to '--type ' field in the current create-authorizer API, and make "identitySource" optional. + +Release v1.10.45 (2017-09-14) +=== + +### Service Client Updates +* `service/codebuild`: Updates service API and documentation + * Supporting Parameter Store in environment variables for AWS CodeBuild +* `service/organizations`: Updates service documentation + * Documentation updates for AWS Organizations +* `service/servicecatalog`: Updates service API, documentation, and paginators + * This release of Service Catalog adds API support to copy products. + +Release v1.10.44 (2017-09-13) +=== + +### Service Client Updates +* `service/autoscaling`: Updates service API and documentation + * Customers can create Life Cycle Hooks at the time of creating Auto Scaling Groups through the CreateAutoScalingGroup API +* `service/batch`: Updates service documentation and examples + * Documentation updates for batch +* `service/ec2`: Updates service API + * You are now able to create and launch EC2 x1e.32xlarge instance, a new EC2 instance in the X1 family, in us-east-1, us-west-2, eu-west-1, and ap-northeast-1. x1e.32xlarge offers 128 vCPUs, 3,904 GiB of DDR4 instance memory, high memory bandwidth, large L3 caches, and leading reliability capabilities to boost the performance and reliability of in-memory applications. +* `service/events`: Updates service API and documentation + * Exposes ConcurrentModificationException as one of the valid exceptions for PutPermission and RemovePermission operation. + +### SDK Enhancements +* `service/autoscaling`: Fix documentation for PutScalingPolicy.AutoScalingGroupName [#1522](https://github.com/aws/aws-sdk-go/pull/1522) +* `service/s3/s3manager`: Clarify S3 Upload manager Concurrency config [#1521](https://github.com/aws/aws-sdk-go/pull/1521) + * Fixes [#1458](https://github.com/aws/aws-sdk-go/issues/1458) +* `service/dynamodb/dynamodbattribute`: Add support for time alias. [#1520](https://github.com/aws/aws-sdk-go/pull/1520) + * Related to [#1505](https://github.com/aws/aws-sdk-go/pull/1505) + +Release v1.10.43 (2017-09-12) +=== + +### Service Client Updates +* `service/ec2`: Updates service API + * Fixed bug in EC2 clients preventing HostOfferingSet from being set +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.10.42 (2017-09-12) +=== + +### Service Client Updates +* `service/devicefarm`: Updates service API and documentation + * DeviceFarm has added support for two features - RemoteDebugging and Customer Artifacts. Customers can now do remote Debugging on their Private Devices and can now retrieve custom files generated by their tests on the device and the device host (execution environment) on both public and private devices. + +Release v1.10.41 (2017-09-08) +=== + +### Service Client Updates +* `service/logs`: Updates service API and documentation + * Adds support for the PutResourcePolicy, DescribeResourcePolicy and DeleteResourcePolicy APIs. + +Release v1.10.40 (2017-09-07) +=== + +### Service Client Updates +* `service/application-autoscaling`: Updates service documentation +* `service/ec2`: Updates service API and documentation + * With Tagging support, you can add Key and Value metadata to search, filter and organize your NAT Gateways according to your organization's needs. +* `service/elasticloadbalancingv2`: Updates service API and documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lex-models`: Updates service API and documentation +* `service/route53`: Updates service API and documentation + * You can configure Amazon Route 53 to log information about the DNS queries that Amazon Route 53 receives for your domains and subdomains. When you configure query logging, Amazon Route 53 starts to send logs to CloudWatch Logs. You can use various tools, including the AWS console, to access the query logs. + +Release v1.10.39 (2017-09-06) +=== + +### Service Client Updates +* `service/budgets`: Updates service API and documentation + * Add an optional "thresholdType" to notifications to support percentage or absolute value thresholds. + +Release v1.10.38 (2017-09-05) +=== + +### Service Client Updates +* `service/codestar`: Updates service API and documentation + * Added support to tag CodeStar projects. Tags can be used to organize and find CodeStar projects on key-value pairs that you can choose. For example, you could add a tag with a key of "Release" and a value of "Beta" to projects your organization is working on for an upcoming beta release. +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.10.37 (2017-09-01) +=== + +### Service Client Updates +* `service/MobileHub`: Adds new service +* `service/gamelift`: Updates service API and documentation + * GameLift VPC resources can be peered with any other AWS VPC. R4 memory-optimized instances now available to deploy. +* `service/ssm`: Updates service API and documentation + * Adding KMS encryption support to SSM Inventory Resource Data Sync. Exposes the ClientToken parameter on SSM StartAutomationExecution to provide idempotent execution requests. + +Release v1.10.36 (2017-08-31) +=== + +### Service Client Updates +* `service/codebuild`: Updates service API, documentation, and examples + * The AWS CodeBuild HTTP API now provides the BatchDeleteBuilds operation, which enables you to delete existing builds. +* `service/ec2`: Updates service API and documentation + * Descriptions for Security Group Rules enables customers to be able to define a description for ingress and egress security group rules . The Descriptions for Security Group Rules feature supports one description field per Security Group rule for both ingress and egress rules . Descriptions for Security Group Rules provides a simple way to describe the purpose or function of a Security Group Rule allowing for easier customer identification of configuration elements . Prior to the release of Descriptions for Security Group Rules , customers had to maintain a separate system outside of AWS if they wanted to track Security Group Rule mapping and their purpose for being implemented. If a security group rule has already been created and you would like to update or change your description for that security group rule you can use the UpdateSecurityGroupRuleDescription API. +* `service/elasticloadbalancingv2`: Updates service API and documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lex-models`: Updates service API and documentation + +### SDK Bugs +* `aws/signer/v4`: Revert [#1491](https://github.com/aws/aws-sdk-go/issues/1491) as change conflicts with an undocumented AWS v4 signature test case. + * Related to: [#1495](https://github.com/aws/aws-sdk-go/issues/1495). +Release v1.10.35 (2017-08-30) +=== + +### Service Client Updates +* `service/application-autoscaling`: Updates service API and documentation +* `service/organizations`: Updates service API and documentation + * The exception ConstraintViolationException now contains a new reason subcode MASTERACCOUNT_MISSING_CONTACT_INFO to make it easier to understand why attempting to remove an account from an Organization can fail. We also improved several other of the text descriptions and examples. + +Release v1.10.34 (2017-08-29) +=== + +### Service Client Updates +* `service/config`: Updates service API and documentation +* `service/ec2`: Updates service API and documentation + * Provides capability to add secondary CIDR blocks to a VPC. + +### SDK Bugs +* `aws/signer/v4`: Fix Signing Unordered Multi Value Query Parameters ([#1491](https://github.com/aws/aws-sdk-go/pull/1491)) + * Removes sorting of query string values when calculating v4 signing as this is not part of the spec. The spec only requires the keys, not values, to be sorted which is achieved by Query.Encode(). +Release v1.10.33 (2017-08-25) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service API and documentation + * Rollback triggers enable you to have AWS CloudFormation monitor the state of your application during stack creation and updating, and to roll back that operation if the application breaches the threshold of any of the alarms you've specified. +* `service/gamelift`: Updates service API + * Update spelling of MatchmakingTicket status values for internal consistency. +* `service/rds`: Updates service API and documentation + * Option group options now contain additional properties that identify requirements for certain options. Check these properties to determine if your DB instance must be in a VPC or have auto minor upgrade turned on before you can use an option. Check to see if you can downgrade the version of an option after you have installed it. + +### SDK Enhancements +* `example/service/ec2`: Add EC2 list instances example ([#1492](https://github.com/aws/aws-sdk-go/pull/1492)) + +Release v1.10.32 (2017-08-25) +=== + +### Service Client Updates +* `service/rekognition`: Updates service API, documentation, and examples + * Update the enum value of LandmarkType and GenderType to be consistent with service response + +Release v1.10.31 (2017-08-23) +=== + +### Service Client Updates +* `service/appstream`: Updates service documentation + * Documentation updates for appstream +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.10.30 (2017-08-22) +=== + +### Service Client Updates +* `service/ssm`: Updates service API and documentation + * Changes to associations in Systems Manager State Manager can now be recorded. Previously, when you edited associations, you could not go back and review older association settings. Now, associations are versioned, and can be named using human-readable strings, allowing you to see a trail of association changes. You can also perform rate-based scheduling, which allows you to schedule associations more granularly. + +Release v1.10.29 (2017-08-21) +=== + +### Service Client Updates +* `service/firehose`: Updates service API, documentation, and paginators + * This change will allow customers to attach a Firehose delivery stream to an existing Kinesis stream directly. You no longer need a forwarder to move data from a Kinesis stream to a Firehose delivery stream. You can now run your streaming applications on your Kinesis stream and easily attach a Firehose delivery stream to it for data delivery to S3, Redshift, or Elasticsearch concurrently. +* `service/route53`: Updates service API and documentation + * Amazon Route 53 now supports CAA resource record type. A CAA record controls which certificate authorities are allowed to issue certificates for the domain or subdomain. + +Release v1.10.28 (2017-08-18) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.10.27 (2017-08-16) +=== + +### Service Client Updates +* `service/gamelift`: Updates service API and documentation + * The Matchmaking Grouping Service is a new feature that groups player match requests for a given game together into game sessions based on developer configured rules. + +### SDK Enhancements +* `aws/arn`: aws/arn: Package for parsing and producing ARNs ([#1463](https://github.com/aws/aws-sdk-go/pull/1463)) + * Adds the `arn` package for AWS ARN parsing and building. Use this package to build AWS ARNs for services such as outlined in the [documentation](http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + +### SDK Bugs +* `aws/signer/v4`: Correct V4 presign signature to include content sha25 in URL ([#1469](https://github.com/aws/aws-sdk-go/pull/1469)) + * Updates the V4 signer so that when a Presign is generated the `X-Amz-Content-Sha256` header is added to the query string instead of being required to be in the header. This allows you to generate presigned URLs for GET requests, e.g S3.GetObject that do not require additional headers to be set by the downstream users of the presigned URL. + * Related To: [#1467](https://github.com/aws/aws-sdk-go/issues/1467) + +Release v1.10.26 (2017-08-15) +=== + +### Service Client Updates +* `service/ec2`: Updates service API + * Fixed bug in EC2 clients preventing HostReservation from being set +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.10.25 (2017-08-14) +=== + +### Service Client Updates +* `service/AWS Glue`: Adds new service +* `service/batch`: Updates service API and documentation + * This release enhances the DescribeJobs API to include the CloudWatch logStreamName attribute in ContainerDetail and ContainerDetailAttempt +* `service/cloudhsmv2`: Adds new service + * CloudHSM provides hardware security modules for protecting sensitive data and cryptographic keys within an EC2 VPC, and enable the customer to maintain control over key access and use. This is a second-generation of the service that will improve security, lower cost and provide better customer usability. +* `service/elasticfilesystem`: Updates service API, documentation, and paginators + * Customers can create encrypted EFS file systems and specify a KMS master key to encrypt it with. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/mgh`: Adds new service + * AWS Migration Hub provides a single location to track migrations across multiple AWS and partner solutions. Using Migration Hub allows you to choose the AWS and partner migration tools that best fit your needs, while providing visibility into the status of your entire migration portfolio. Migration Hub also provides key metrics and progress for individual applications, regardless of which tools are being used to migrate them. For example, you might use AWS Database Migration Service, AWS Server Migration Service, and partner migration tools to migrate an application comprised of a database, virtualized web servers, and a bare metal server. Using Migration Hub will provide you with a single screen that shows the migration progress of all the resources in the application. This allows you to quickly get progress updates across all of your migrations, easily identify and troubleshoot any issues, and reduce the overall time and effort spent on your migration projects. Migration Hub is available to all AWS customers at no additional charge. You only pay for the cost of the migration tools you use, and any resources being consumed on AWS. +* `service/ssm`: Updates service API and documentation + * Systems Manager Maintenance Windows include the following changes or enhancements: New task options using Systems Manager Automation, AWS Lambda, and AWS Step Functions; enhanced ability to edit the targets of a Maintenance Window, including specifying a target name and description, and ability to edit the owner field; enhanced ability to edits tasks; enhanced support for Run Command parameters; and you can now use a --safe flag when attempting to deregister a target. If this flag is enabled when you attempt to deregister a target, the system returns an error if the target is referenced by any task. Also, Systems Manager now includes Configuration Compliance to scan your fleet of managed instances for patch compliance and configuration inconsistencies. You can collect and aggregate data from multiple AWS accounts and Regions, and then drill down into specific resources that aren't compliant. +* `service/storagegateway`: Updates service API and documentation + * Add optional field ForceDelete to DeleteFileShare api. + +Release v1.10.24 (2017-08-11) +=== + +### Service Client Updates +* `service/codedeploy`: Updates service API and documentation + * Adds support for specifying Application Load Balancers in deployment groups, for both in-place and blue/green deployments. +* `service/cognito-idp`: Updates service API and documentation +* `service/ec2`: Updates service API and documentation + * Provides customers an opportunity to recover an EIP that was released + +Release v1.10.23 (2017-08-10) +=== + +### Service Client Updates +* `service/clouddirectory`: Updates service API and documentation + * Enable BatchDetachPolicy +* `service/codebuild`: Updates service API + * Supporting Bitbucket as source type in AWS CodeBuild. + +Release v1.10.22 (2017-08-09) +=== + +### Service Client Updates +* `service/rds`: Updates service documentation + * Documentation updates for RDS. + +Release v1.10.21 (2017-08-09) +=== + +### Service Client Updates +* `service/elasticbeanstalk`: Updates service API and documentation + * Add support for paginating the result of DescribeEnvironments Include the ARN of described environments in DescribeEnvironments output + +### SDK Enhancements +* `aws`: Add pointer conversion utilities to transform int64 to time.Time [#1433](https://github.com/aws/aws-sdk-go/pull/1433) + * Adds `SecondsTimeValue` and `MillisecondsTimeValue` utilities. + +Release v1.10.20 (2017-08-01) +=== + +### Service Client Updates +* `service/codedeploy`: Updates service API and documentation + * AWS CodeDeploy now supports the use of multiple tag groups in a single deployment group (an intersection of tags) to identify the instances for a deployment. When you create or update a deployment group, use the new ec2TagSet and onPremisesTagSet structures to specify up to three groups of tags. Only instances that are identified by at least one tag in each of the tag groups are included in the deployment group. +* `service/config`: Updates service API and documentation +* `service/ec2`: Updates service waiters + * Ec2 SpotInstanceRequestFulfilled waiter update +* `service/elasticloadbalancingv2`: Updates service waiters +* `service/email`: Updates service API, documentation, paginators, and examples + * This update adds information about publishing email open and click events. This update also adds information about publishing email events to Amazon Simple Notification Service (Amazon SNS). +* `service/pinpoint`: Updates service API and documentation + * This release of the Pinpoint SDK enables App management - create, delete, update operations, Raw Content delivery for APNs and GCM campaign messages and From Address override. + +Release v1.10.19 (2017-08-01) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/inspector`: Updates service API, documentation, and paginators + * Inspector's StopAssessmentRun API has been updated with a new input option - stopAction. This request parameter can be set to either START_EVALUATION or SKIP_EVALUATION. START_EVALUATION (the default value, and the previous behavior) stops the AWS agent data collection and begins the results evaluation for findings generation based on the data collected so far. SKIP_EVALUATION cancels the assessment run immediately, after which no findings are generated. +* `service/ssm`: Updates service API and documentation + * Adds a SendAutomationSignal API to SSM Service. This API is used to send a signal to an automation execution to change the current behavior or status of the execution. + +Release v1.10.18 (2017-07-27) +=== + +### Service Client Updates +* `service/ec2`: Updates service API and documentation + * The CreateDefaultVPC API enables you to create a new default VPC . You no longer need to contact AWS support, if your default VPC has been deleted. +* `service/kinesisanalytics`: Updates service API and documentation + * Added additional exception types and clarified documentation. + +Release v1.10.17 (2017-07-27) +=== + +### Service Client Updates +* `service/dynamodb`: Updates service documentation and examples + * Corrected a typo. +* `service/ec2`: Updates service API and documentation + * Amazon EC2 Elastic GPUs allow you to easily attach low-cost graphics acceleration to current generation EC2 instances. With Amazon EC2 Elastic GPUs, you can configure the right amount of graphics acceleration to your particular workload without being constrained by fixed hardware configurations and limited GPU selection. +* `service/monitoring`: Updates service documentation + * This release adds high resolution features to CloudWatch, with support for Custom Metrics down to 1 second and Alarms down to 10 seconds. + +Release v1.10.16 (2017-07-26) +=== + +### Service Client Updates +* `service/clouddirectory`: Updates service API and documentation + * Cloud Directory adds support for additional batch operations. +* `service/cloudformation`: Updates service API and documentation + * AWS CloudFormation StackSets enables you to manage stacks across multiple accounts and regions. + +### SDK Enhancements +* `aws/signer/v4`: Optimize V4 signer's header duplicate space stripping. [#1417](https://github.com/aws/aws-sdk-go/pull/1417) + +Release v1.10.15 (2017-07-24) +=== + +### Service Client Updates +* `service/appstream`: Updates service API, documentation, and waiters + * Amazon AppStream 2.0 image builders and fleets can now access applications and network resources that rely on Microsoft Active Directory (AD) for authentication and permissions. This new feature allows you to join your streaming instances to your AD, so you can use your existing AD user management tools. +* `service/ec2`: Updates service API and documentation + * Spot Fleet tagging capability allows customers to automatically tag instances launched by Spot Fleet. You can use this feature to label or distinguish instances created by distinct Spot Fleets. Tagging your EC2 instances also enables you to see instance cost allocation by tag in your AWS bill. + +### SDK Bugs +* `aws/signer/v4`: Fix out of bounds panic in stripExcessSpaces [#1412](https://github.com/aws/aws-sdk-go/pull/1412) + * Fixes the out of bands panic in stripExcessSpaces caused by an incorrect calculation of the stripToIdx value. Simplified to code also. + * Fixes [#1411](https://github.com/aws/aws-sdk-go/issues/1411) +Release v1.10.14 (2017-07-20) +=== + +### Service Client Updates +* `service/elasticmapreduce`: Updates service API and documentation + * Amazon EMR now includes the ability to use a custom Amazon Linux AMI and adjustable root volume size when launching a cluster. + +Release v1.10.13 (2017-07-19) +=== + +### Service Client Updates +* `service/budgets`: Updates service API and documentation + * Update budget Management API's to list/create/update RI_UTILIZATION type budget. Update budget Management API's to support DAILY timeUnit for RI_UTILIZATION type budget. + +### SDK Enhancements +* `service/s3`: Use interfaces assertions instead of ValuesAtPath for S3 field lookups. [#1401](https://github.com/aws/aws-sdk-go/pull/1401) + * Improves the performance across the board for all S3 API calls by removing the usage of `ValuesAtPath` being used for every S3 API call. + +### SDK Bugs +* `aws/request`: waiter test bug + * waiters_test.go file would sometimes fail due to travis hiccups. This occurs because a test would sometimes fail the cancel check and succeed the timeout. However, the timeout check should never occur in that test. This fix introduces a new field that dictates how waiters will sleep. +Release v1.10.12 (2017-07-17) +=== + +### Service Client Updates +* `service/cognito-idp`: Updates service API and documentation +* `service/lambda`: Updates service API and documentation + * Lambda@Edge lets you run code closer to your end users without provisioning or managing servers. With Lambda@Edge, your code runs in AWS edge locations, allowing you to respond to your end users at the lowest latency. Your code is triggered by Amazon CloudFront events, such as requests to and from origin servers and viewers, and it is ready to execute at every AWS edge location whenever a request for content is received. You just upload your Node.js code to AWS Lambda and Lambda takes care of everything required to run and scale your code with high availability. You only pay for the compute time you consume - there is no charge when your code is not running. + +Release v1.10.11 (2017-07-14) +=== + +### Service Client Updates +* `service/discovery`: Updates service API and documentation + * Adding feature to the Export API for Discovery Service to allow filters for the export task to allow export based on per agent id. +* `service/ec2`: Updates service API + * New EC2 GPU Graphics instance +* `service/marketplacecommerceanalytics`: Updates service documentation + * Update to Documentation Model For New Report Cadence / Reformat of Docs + +Release v1.10.10 (2017-07-13) +=== + +### Service Client Updates +* `service/apigateway`: Updates service API and documentation + * Adds support for management of gateway responses. +* `service/ec2`: Updates service API and documentation + * X-ENI (or Cross-Account ENI) is a new feature that allows the attachment or association of Elastic Network Interfaces (ENI) between VPCs in different AWS accounts located in the same availability zone. With this new capability, service providers and partners can deliver managed solutions in a variety of new architectural patterns where the provider and consumer of the service are in different AWS accounts. +* `service/lex-models`: Updates service documentation + +Release v1.10.9 (2017-07-12) +=== + +### Service Client Updates +* `service/autoscaling`: Updates service API and documentation + * Auto Scaling now supports a new type of scaling policy called target tracking scaling policies that you can use to set up dynamic scaling for your application. +* `service/swf`: Updates service API, documentation, paginators, and examples + * Added support for attaching control data to Lambda tasks. Control data lets you attach arbitrary strings to your decisions and history events. + +Release v1.10.8 (2017-07-06) +=== + +### Service Client Updates +* `service/ds`: Updates service API, documentation, and paginators + * You can now improve the resilience and performance of your Microsoft AD directory by deploying additional domain controllers. Added UpdateNumberofDomainControllers API that allows you to update the number of domain controllers you want for your directory, and DescribeDomainControllers API that allows you to describe the detailed information of each domain controller of your directory. Also added the 'DesiredNumberOfDomainControllers' field to the DescribeDirectories API output for Microsoft AD. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/kinesis`: Updates service API and documentation + * You can now encrypt your data at rest within an Amazon Kinesis Stream using server-side encryption. Server-side encryption via AWS KMS makes it easy for customers to meet strict data management requirements by encrypting their data at rest within the Amazon Kinesis Streams, a fully managed real-time data processing service. +* `service/kms`: Updates service API and documentation + * This release of AWS Key Management Service introduces the ability to determine whether a key is AWS managed or customer managed. +* `service/ssm`: Updates service API and documentation + * Amazon EC2 Systems Manager now expands Patching support to Amazon Linux, Red Hat and Ubuntu in addition to the already supported Windows Server. + +Release v1.10.7 (2017-07-05) +=== + +### Service Client Updates +* `service/monitoring`: Updates service API and documentation + * We are excited to announce the availability of APIs and CloudFormation support for CloudWatch Dashboards. You can use the new dashboard APIs or CloudFormation templates to dynamically build and maintain dashboards to monitor your infrastructure and applications. There are four new dashboard APIs - PutDashboard, GetDashboard, DeleteDashboards, and ListDashboards APIs. PutDashboard is used to create a new dashboard or modify an existing one whereas GetDashboard is the API to get the details of a specific dashboard. ListDashboards and DeleteDashboards are used to get the names or delete multiple dashboards respectively. Getting started with dashboard APIs is similar to any other AWS APIs. The APIs can be accessed through AWS SDK or through CLI tools. +* `service/route53`: Updates service API and documentation + * Bug fix for InvalidChangeBatch exception. + +### SDK Enhancements +* `service/s3/s3manager`: adding cleanup function to batch objects [#1375](https://github.com/aws/aws-sdk-go/issues/1375) + * This enhancement will add an After field that will be called after each iteration of the batch operation. + +Release v1.10.6 (2017-06-30) +=== + +### Service Client Updates +* `service/marketplacecommerceanalytics`: Updates service documentation + * Documentation updates for AWS Marketplace Commerce Analytics. +* `service/s3`: Updates service API and documentation + * API Update for S3: Adding Object Tagging Header to MultipartUpload Initialization + +Release v1.10.5 (2017-06-29) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/events`: Updates service API and documentation + * CloudWatch Events now allows different AWS accounts to share events with each other through a new resource called event bus. Event buses accept events from AWS services, other AWS accounts and PutEvents API calls. Currently all AWS accounts have one default event bus. To send events to another account, customers simply write rules to match the events of interest and attach an event bus in the receiving account as the target to the rule. The PutTargets API has been updated to allow adding cross account event buses as targets. In addition, we have released two new APIs - PutPermission and RemovePermission - that enables customers to add/remove permissions to their default event bus. +* `service/gamelift`: Updates service API and documentation + * Allow developers to download GameLift fleet creation logs to assist with debugging. +* `service/ssm`: Updates service API and documentation + * Adding Resource Data Sync support to SSM Inventory. New APIs: * CreateResourceDataSync - creates a new resource data sync configuration, * ListResourceDataSync - lists existing resource data sync configurations, * DeleteResourceDataSync - deletes an existing resource data sync configuration. + +Release v1.10.4 (2017-06-27) +=== + +### Service Client Updates +* `service/servicecatalog`: Updates service API, documentation, and paginators + * Proper tagging of resources is critical to post-launch operations such as billing, cost allocation, and resource management. By using Service Catalog's TagOption Library, administrators can define a library of re-usable TagOptions that conform to company standards, and associate these with Service Catalog portfolios and products. Learn how to move your current tags to the new library, create new TagOptions, and view and associate your library items with portfolios and products. Understand how to ensure that the right tags are created on products launched through Service Catalog and how to provide users with defined selectable tags. + +### SDK Bugs +* `aws/signer/v4`: checking length on `stripExcessSpaces` [#1372](https://github.com/aws/aws-sdk-go/issues/1372) + * Fixes a bug where `stripExcessSpaces` did not check length against the slice. + * Fixes: [#1371](https://github.com/aws/aws-sdk-go/issues/1371) +Release v1.10.3 (2017-06-23) +=== + +### Service Client Updates +* `service/lambda`: Updates service API and documentation + * The Lambda Invoke API will now throw new exception InvalidRuntimeException (status code 502) for invokes with deprecated runtimes. + +Release v1.10.2 (2017-06-22) +=== + +### Service Client Updates +* `service/codepipeline`: Updates service API, documentation, and paginators + * A new API, ListPipelineExecutions, enables you to retrieve summary information about the most recent executions in a pipeline, including pipeline execution ID, status, start time, and last updated time. You can request information for a maximum of 100 executions. Pipeline execution data is available for the most recent 12 months of activity. +* `service/dms`: Updates service API and documentation + * Added tagging for DMS certificates. +* `service/elasticloadbalancing`: Updates service waiters +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lightsail`: Updates service API and documentation + * This release adds a new nextPageToken property to the result of the GetOperationsForResource API. Developers can now get the next set of items in a list by making subsequent calls to GetOperationsForResource API with the token from the previous call. This release also deprecates the nextPageCount property, which previously returned null (use the nextPageToken property instead). This release also deprecates the customImageName property on the CreateInstancesRequest class, which was previously ignored by the API. +* `service/route53`: Updates service API and documentation + * This release reintroduces the HealthCheckInUse exception. + +Release v1.10.1 (2017-06-21) +=== + +### Service Client Updates +* `service/dax`: Adds new service + * Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for DynamoDB that delivers up to a 10x performance improvement - from milliseconds to microseconds - even at millions of requests per second. DAX does all the heavy lifting required to add in-memory acceleration to your DynamoDB tables, without requiring developers to manage cache invalidation, data population, or cluster management. +* `service/route53`: Updates service API and documentation + * Amazon Route 53 now supports multivalue answers in response to DNS queries, which lets you route traffic approximately randomly to multiple resources, such as web servers. Create one multivalue answer record for each resource and, optionally, associate an Amazon Route 53 health check with each record, and Amazon Route 53 responds to DNS queries with up to eight healthy records. +* `service/ssm`: Updates service API, documentation, and paginators + * Adding hierarchy support to the SSM Parameter Store API. Added support tor tagging. New APIs: GetParameter - retrieves one parameter, DeleteParameters - deletes multiple parameters (max number 10), GetParametersByPath - retrieves parameters located in the hierarchy. Updated APIs: PutParameter - added ability to enforce parameter value by applying regex (AllowedPattern), DescribeParameters - modified to support Tag filtering. +* `service/waf`: Updates service API and documentation + * You can now create, edit, update, and delete a new type of WAF rule with a rate tracking component. +* `service/waf-regional`: Updates service API and documentation + +Release v1.10.0 (2017-06-20) +=== + +### Service Client Updates +* `service/workdocs`: Updates service API and documentation + * This release provides a new API to retrieve the activities performed by WorkDocs users. + +### SDK Features +* `aws/credentials/plugincreds`: Add support for Go plugin for credentials [#1320](https://github.com/aws/aws-sdk-go/pull/1320) + * Adds support for using plugins to retrieve credentials for API requests. This change adds a new package plugincreds under aws/credentials. See the `example/aws/credentials/plugincreds` folder in the SDK for example usage. + +Release v1.9.00 (2017-06-19) +=== + +### Service Client Updates +* `service/organizations`: Updates service API and documentation + * Improvements to Exception Modeling + +### SDK Features +* `service/s3/s3manager`: Adds batch operations to s3manager [#1333](https://github.com/aws/aws-sdk-go/pull/1333) + * Allows for batch upload, download, and delete of objects. Also adds the interface pattern to allow for easy traversal of objects. E.G `DownloadWithIterator`, `UploadWithIterator`, and `BatchDelete`. `BatchDelete` also contains a utility iterator using the `ListObjects` API to easily delete a list of objects. + +Release v1.8.44 (2017-06-16) +=== + +### Service Client Updates +* `service/xray`: Updates service API, documentation, and paginators + * Add a response time histogram to the services in response of GetServiceGraph API. + +Release v1.8.43 (2017-06-15) +=== + +### Service Client Updates +* `service/ec2`: Updates service API and documentation + * Adds API to describe Amazon FPGA Images (AFIs) available to customers, which includes public AFIs, private AFIs that you own, and AFIs owned by other AWS accounts for which you have load permissions. +* `service/ecs`: Updates service API and documentation + * Added support for cpu, memory, and memory reservation container overrides on the RunTask and StartTask APIs. +* `service/iot`: Updates service API and documentation + * Revert the last release: remove CertificatePem from DescribeCertificate API. +* `service/servicecatalog`: Updates service API, documentation, and paginators + * Added ProvisioningArtifactSummaries to DescribeProductAsAdmin's output to show the provisioning artifacts belong to the product. Allow filtering by SourceProductId in SearchProductsAsAdmin for AWS Marketplace products. Added a verbose option to DescribeProvisioningArtifact to display the CloudFormation template used to create the provisioning artifact.Added DescribeProvisionedProduct API. Changed the type of ProvisionedProduct's Status to be distinct from Record's Status. New ProvisionedProduct's Status are AVAILABLE, UNDER_CHANGE, TAINTED, ERROR. Changed Record's Status set of values to CREATED, IN_PROGRESS, IN_PROGRESS_IN_ERROR, SUCCEEDED, FAILED. + +### SDK Bugs +* `private/model/api`: Fix RESTXML support for XML Namespace [#1343](https://github.com/aws/aws-sdk-go/pull/1343) + * Fixes a bug with the SDK's generation of services using the REST XML protocol not annotating shape references with the XML Namespace attribute. + * Fixes [#1334](https://github.com/aws/aws-sdk-go/pull/1334) +Release v1.8.42 (2017-06-14) +=== + +### Service Client Updates +* `service/applicationautoscaling`: Updates service API and documentation +* `service/clouddirectory`: Updates service documentation + * Documentation update for Cloud Directory + +Release v1.8.41 (2017-06-13) +=== + +### Service Client Updates +* `service/configservice`: Updates service API + +Release v1.8.40 (2017-06-13) +=== + +### Service Client Updates +* `service/rds`: Updates service API and documentation + * API Update for RDS: this update enables copy-on-write, a new Aurora MySQL Compatible Edition feature that allows users to restore their database, and support copy of TDE enabled snapshot cross region. + +### SDK Bugs +* `aws/request`: Fix NewErrParamMinLen to use correct ParamMinLenErrCode [#1336](https://github.com/aws/aws-sdk-go/issues/1336) + * Fixes the `NewErrParamMinLen` function returning the wrong error code. `ParamMinLenErrCode` should be returned not `ParamMinValueErrCode`. + * Fixes [#1335](https://github.com/aws/aws-sdk-go/issues/1335) +Release v1.8.39 (2017-06-09) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/opsworks`: Updates service API and documentation + * Tagging Support for AWS OpsWorks Stacks + +Release v1.8.38 (2017-06-08) +=== + +### Service Client Updates +* `service/iot`: Updates service API and documentation + * In addition to using certificate ID, AWS IoT customers can now obtain the description of a certificate with the certificate PEM. +* `service/pinpoint`: Updates service API and documentation + * Starting today Amazon Pinpoint adds SMS Text and Email Messaging support in addition to Mobile Push Notifications, providing developers, product managers and marketers with multi-channel messaging capabilities to drive user engagement in their applications. Pinpoint also enables backend services and applications to message users directly and provides advanced user and app analytics to understand user behavior and messaging performance. +* `service/rekognition`: Updates service API and documentation + * API Update for AmazonRekognition: Adding RecognizeCelebrities API + +Release v1.8.37 (2017-06-07) +=== + +### Service Client Updates +* `service/codebuild`: Updates service API and documentation + * Add support to APIs for privileged containers. This change would allow performing privileged operations like starting the Docker daemon inside builds possible in custom docker images. +* `service/greengrass`: Adds new service + * AWS Greengrass is software that lets you run local compute, messaging, and device state synchronization for connected devices in a secure way. With AWS Greengrass, connected devices can run AWS Lambda functions, keep device data in sync, and communicate with other devices securely even when not connected to the Internet. Using AWS Lambda, Greengrass ensures your IoT devices can respond quickly to local events, operate with intermittent connections, and minimize the cost of transmitting IoT data to the cloud. + +Release v1.8.36 (2017-06-06) +=== + +### Service Client Updates +* `service/acm`: Updates service documentation + * Documentation update for AWS Certificate Manager. +* `service/cloudfront`: Updates service documentation + * Doc update to fix incorrect prefix in S3OriginConfig +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/iot`: Updates service API + * Update client side validation for SalesForce action. + +Release v1.8.35 (2017-06-05) +=== + +### Service Client Updates +* `service/appstream`: Updates service API and documentation + * AppStream 2.0 Custom Security Groups allows you to easily control what network resources your streaming instances and images have access to. You can assign up to 5 security groups per Fleet to control the inbound and outbound network access to your streaming instances to specific IP ranges, network protocols, or ports. +* `service/iot`: Updates service API, documentation, paginators, and examples + * Added Salesforce action to IoT Rules Engine. + +Release v1.8.34 (2017-06-02) +=== + +### Service Client Updates +* `service/kinesisanalytics`: Updates service API, documentation, and paginators + * Kinesis Analytics publishes error messages CloudWatch logs in case of application misconfigurations +* `service/workdocs`: Updates service API and documentation + * This release includes new APIs to manage tags and custom metadata on resources and also new APIs to add and retrieve comments at the document level. + +Release v1.8.33 (2017-06-01) +=== + +### Service Client Updates +* `service/codedeploy`: Updates service API and documentation + * AWS CodeDeploy has improved how it manages connections to GitHub accounts and repositories. You can now create and store up to 25 connections to GitHub accounts in order to associate AWS CodeDeploy applications with GitHub repositories. Each connection can support multiple repositories. You can create connections to up to 25 different GitHub accounts, or create more than one connection to a single account. The ListGitHubAccountTokenNames command has been introduced to retrieve the names of stored connections to GitHub accounts that you have created. The name of the connection to GitHub used for an AWS CodeDeploy application is also included in the ApplicationInfo structure. Two new fields, lastAttemptedDeployment and lastSuccessfulDeployment, have been added to DeploymentGroupInfo to improve the handling of deployment group information in the AWS CodeDeploy console. Information about these latest deployments can also be retrieved using the GetDeploymentGroup and BatchGetDeployment group requests. Also includes a region update (us-gov-west-1). +* `service/cognitoidentityprovider`: Updates service API, documentation, and paginators +* `service/elbv2`: Updates service API and documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lexmodelbuildingservice`: Updates service documentation and examples + +### SDK Enhancements +* `aws/defaults`: Exports shared credentials and config default filenames used by the SDK. [#1308](https://github.com/aws/aws-sdk-go/pull/1308) + * Adds SharedCredentialsFilename and SharedConfigFilename functions to defaults package. + +### SDK Bugs +* `aws/credentials`: Fixes shared credential provider's default filename on Windows. [#1308](https://github.com/aws/aws-sdk-go/pull/1308) + * The shared credentials provider would attempt to use the wrong filename on Windows if the `HOME` environment variable was defined. +* `service/s3/s3manager`: service/s3/s3manager: Fix Downloader ignoring Range get parameter [#1311](https://github.com/aws/aws-sdk-go/pull/1311) + * Fixes the S3 Download Manager ignoring the GetObjectInput's Range parameter. If this parameter is provided it will force the downloader to fallback to a single GetObject request disabling concurrency and automatic part size gets. + * Fixes [#1296](https://github.com/aws/aws-sdk-go/issues/1296) +Release v1.8.32 (2017-05-31) +=== + +### Service Client Updates +* `service/rds`: Updates service API and documentation + * Amazon RDS customers can now easily and quickly stop and start their DB instances. + +Release v1.8.31 (2017-05-30) +=== + +### Service Client Updates +* `service/clouddirectory`: Updates service API, documentation, and paginators + * Cloud Directory has launched support for Typed Links, enabling customers to create object-to-object relationships that are not hierarchical in nature. Typed Links enable customers to quickly query for data along these relationships. Customers can also enforce referential integrity using Typed Links, ensuring data in use is not inadvertently deleted. +* `service/s3`: Updates service paginators and examples + * New example snippets for Amazon S3. + +Release v1.8.30 (2017-05-25) +=== + +### Service Client Updates +* `service/appstream`: Updates service API and documentation + * Support added for persistent user storage, backed by S3. +* `service/rekognition`: Updates service API and documentation + * Updated the CompareFaces API response to include orientation information, unmatched faces, landmarks, pose, and quality of the compared faces. + +Release v1.8.29 (2017-05-24) +=== + +### Service Client Updates +* `service/iam`: Updates service API + * The unique ID and access key lengths were extended from 32 to 128 +* `service/storagegateway`: Updates service API and documentation + * Two Storage Gateway data types, Tape and TapeArchive, each have a new response element, TapeUsedInBytes. This element helps you manage your virtual tapes. By using TapeUsedInBytes, you can see the amount of data written to each virtual tape. +* `service/sts`: Updates service API, documentation, and paginators + * The unique ID and access key lengths were extended from 32 to 128. + +Release v1.8.28 (2017-05-23) +=== + +### Service Client Updates +* `service/databasemigrationservice`: Updates service API, documentation, paginators, and examples + * This release adds support for using Amazon S3 and Amazon DynamoDB as targets for database migration, and using MongoDB as a source for database migration. For more information, see the AWS Database Migration Service documentation. + +Release v1.8.27 (2017-05-22) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/resourcegroupstaggingapi`: Updates service API, documentation, and paginators + * You can now specify the number of resources returned per page in GetResources operation, as an optional parameter, to easily manage the list of resources returned by your queries. + +### SDK Bugs +* `aws/request`: Add support for PUT temporary redirects (307) [#1283](https://github.com/aws/aws-sdk-go/issues/1283) + * Adds support for Go 1.8's GetBody function allowing the SDK's http request using PUT and POST methods to be redirected with temporary redirects with 307 status code. + * Fixes: [#1267](https://github.com/aws/aws-sdk-go/issues/1267) +* `aws/request`: Add handling for retrying temporary errors during unmarshal [#1289](https://github.com/aws/aws-sdk-go/issues/1289) + * Adds support for retrying temporary errors that occur during unmarshaling of a request's response body. + * Fixes: [#1275](https://github.com/aws/aws-sdk-go/issues/1275) +Release v1.8.26 (2017-05-18) +=== + +### Service Client Updates +* `service/athena`: Adds new service + * This release adds support for Amazon Athena. Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL. Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries that you run. +* `service/lightsail`: Updates service API, documentation, and paginators + * This release adds new APIs that make it easier to set network port configurations on Lightsail instances. Developers can now make a single request to both open and close public ports on an instance using the PutInstancePublicPorts operation. + +### SDK Bugs +* `aws/request`: Fix logging from reporting wrong retry request errors #1281 + * Fixes the SDK's retry request logging to report the the actual error that occurred, not a stubbed Unknown error message. + * Fixes the SDK's response logger to not output the response log multiple times per retry. +Release v1.8.25 (2017-05-17) +=== + +### Service Client Updates +* `service/autoscaling`: Updates service documentation, paginators, and examples + * Various Auto Scaling documentation updates +* `service/cloudwatchevents`: Updates service documentation + * Various CloudWatch Events documentation updates. +* `service/cloudwatchlogs`: Updates service documentation and paginators + * Various CloudWatch Logs documentation updates. +* `service/polly`: Updates service API + * Amazon Polly adds new German voice "Vicki" + +Release v1.8.24 (2017-05-16) +=== + +### Service Client Updates +* `service/codedeploy`: Updates service API and documentation + * This release introduces the previousRevision field in the responses to the GetDeployment and BatchGetDeployments actions. previousRevision provides information about the application revision that was deployed to the deployment group before the most recent successful deployment. Also, the fileExistsBehavior parameter has been added for CreateDeployment action requests. In the past, if the AWS CodeDeploy agent detected files in a target location that weren't part of the application revision from the most recent successful deployment, it would fail the current deployment by default. This new parameter provides options for how the agent handles these files: fail the deployment, retain the content, or overwrite the content. +* `service/gamelift`: Updates service API and documentation + * Allow developers to specify how metrics are grouped in CloudWatch for their GameLift fleets. Developers can also specify how many concurrent game sessions activate on a per-instance basis. +* `service/inspector`: Updates service API, documentation, paginators, and examples + * Adds ability to produce an assessment report that includes detailed and comprehensive results of a specified assessment run. +* `service/kms`: Updates service documentation + * Update documentation for KMS. + +Release v1.8.23 (2017-05-15) +=== + +### Service Client Updates +* `service/ssm`: Updates service API and documentation + * UpdateAssociation API now supports updating document name and targets of an association. GetAutomationExecution API can return FailureDetails as an optional field to the StepExecution Object, which contains failure type, failure stage as well as other failure related information for a failed step. + +### SDK Enhancements +* `aws/session`: SDK should be able to load multiple custom shared config files. [#1258](https://github.com/aws/aws-sdk-go/issues/1258) + * This change adds a `SharedConfigFiles` field to the `session.Options` type that allows you to specify the files, and their order, the SDK will use for loading shared configuration and credentials from when the `Session` is created. Use the `NewSessionWithOptions` Session constructor to specify these options. You'll also most likely want to enable support for the shared configuration file's additional attributes by setting `session.Option`'s `SharedConfigState` to `session.SharedConfigEnabled`. + +Release v1.8.22 (2017-05-11) +=== + +### Service Client Updates +* `service/elb`: Updates service API, documentation, and paginators +* `service/elbv2`: Updates service API and documentation +* `service/lexmodelbuildingservice`: Updates service API and documentation +* `service/organizations`: Updates service API, documentation, paginators, and examples + * AWS Organizations APIs that return an Account object now include the email address associated with the account’s root user. + +Release v1.8.21 (2017-05-09) +=== + +### Service Client Updates +* `service/codestar`: Updates service documentation + * Updated documentation for AWS CodeStar. +* `service/workspaces`: Updates service API, documentation, and paginators + * Doc-only Update for WorkSpaces + +Release v1.8.20 (2017-05-04) +=== + +### Service Client Updates +* `service/ecs`: Updates service API, documentation, and paginators + * Exposes container instance registration time in ECS:DescribeContainerInstances. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/marketplaceentitlementservice`: Adds new service +* `service/lambda`: Updates service API and documentation + * Support for UpdateFunctionCode DryRun option + +Release v1.8.19 (2017-04-28) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service waiters and paginators + * Adding back the removed waiters and paginators. + +Release v1.8.18 (2017-04-28) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service API, documentation, waiters, paginators, and examples + * API update for CloudFormation: New optional parameter ClientRequestToken which can be used as an idempotency token to safely retry certain operations as well as tagging StackEvents. +* `service/rds`: Updates service API, documentation, and examples + * The DescribeDBClusterSnapshots API now returns a SourceDBClusterSnapshotArn field which identifies the source DB cluster snapshot of a copied snapshot. +* `service/rekognition`: Updates service API + * Fix for missing file type check +* `service/snowball`: Updates service API, documentation, and paginators + * The Snowball API has a new exception that can be thrown for list operation requests. +* `service/sqs`: Updates service API, documentation, and paginators + * Adding server-side encryption (SSE) support to SQS by integrating with AWS KMS; adding new queue attributes to SQS CreateQueue, SetQueueAttributes and GetQueueAttributes APIs to support SSE. + +Release v1.8.17 (2017-04-26) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/rds`: Updates service API and documentation + * With Amazon Relational Database Service (Amazon RDS) running MySQL or Amazon Aurora, you can now authenticate to your DB instance using IAM database authentication. + +Release v1.8.16 (2017-04-21) +=== + +### Service Client Updates +* `service/appstream`: Updates service API, documentation, and paginators + * The new feature named "Default Internet Access" will enable Internet access from AppStream 2.0 instances - image builders and fleet instances. Admins will check a flag either through AWS management console for AppStream 2.0 or through API while creating an image builder or while creating/updating a fleet. +* `service/kinesis`: Updates service API, documentation, waiters, and paginators + * Adds a new waiter, StreamNotExists, to Kinesis. + +### SDK Enhancements +* `aws/endpoints`: Add utilities improving endpoints lookup (#1218) + * Adds several utilities to the endpoints packages to make looking up partitions, regions, and services easier. + * Fixes #994 + +### SDK Bugs +* `private/protocol/xml/xmlutil`: Fix unmarshaling dropping errors (#1219) + * The XML unmarshaler would drop any serialization or body read error that occurred on the floor effectively hiding any errors that would occur. + * Fixes #1205 +Release v1.8.15 (2017-04-20) +=== + +### Service Client Updates +* `service/devicefarm`: Updates service API and documentation + * API Update for AWS Device Farm: Support for Deals and Promotions +* `service/directconnect`: Updates service documentation + * Documentation updates for AWS Direct Connect. +* `service/elbv2`: Updates service waiters +* `service/kms`: Updates service documentation and examples + * Doc-only update for Key Management Service (KMS): Update docs for GrantConstraints and GenerateRandom +* `service/route53`: Updates service documentation + * Release notes: SDK documentation now includes examples for ChangeResourceRecordSets for all types of resource record set, such as weighted, alias, and failover. +* `service/route53domains`: Updates service API, documentation, and paginators + * Adding examples and other documentation updates. + +### SDK Enhancements +* `service/s3`: Add utilities to make getting a bucket's region easier (#1207) + * Adds two features which make it easier to get a bucket's region, `s3.NormalizeBucketLocation` and `s3manager.GetBucketRegion`. + +### SDK Bugs +* `service/s3`: Fix HeadObject's incorrect documented error codes (#1213) + * The HeadObject's model incorrectly states that the operation can return the NoSuchKey error code. + * Fixes #1208 + +Release v1.8.14 (2017-04-19) +=== + +### Service Client Updates +* `service/apigateway`: Updates service API and documentation + * Add support for "embed" property. +* `service/codestar`: Adds new service + * AWS CodeStar is a cloud-based service for creating, managing, and working with software development projects on AWS. An AWS CodeStar project creates and integrates AWS services for your project development toolchain. AWS CodeStar also manages the permissions required for project users. +* `service/ec2`: Updates service API and documentation + * Adds support for creating an Amazon FPGA Image (AFI) from a specified design checkpoint (DCP). +* `service/iam`: Updates service API and documentation + * This changes introduces a new IAM role type, Service Linked Role, which works like a normal role but must be managed via services' control. +* `service/lambda`: Updates service API and documentation + * Lambda integration with CloudDebugger service to enable customers to enable tracing for the Lambda functions and send trace information to the CloudDebugger service. +* `service/lexmodelbuildingservice`: Adds new service +* `service/polly`: Updates service API, documentation, and paginators + * API Update for Amazon Polly: Add support for speech marks +* `service/rekognition`: Updates service API and documentation + * Given an image, the API detects explicit or suggestive adult content in the image and returns a list of corresponding labels with confidence scores, as well as a taxonomy (parent-child relation) for each label. + +Release v1.8.13 (2017-04-18) +=== + +### Service Client Updates +* `service/lambda`: Updates service API and documentation + * You can use tags to group and filter your Lambda functions, making it easier to analyze them for billing allocation purposes. For more information, see Tagging Lambda Functions. You can now write or upgrade your Lambda functions using Python version 3.6. For more information, see Programming Model for Authoring Lambda Functions in Python. Note: Features will be rolled out in the US regions on 4/19. + +### SDK Enhancements +* `aws/request`: add support for appengine's custom standard library (#1190) + * Remove syscall error checking on appengine platforms. + +Release v1.8.12 (2017-04-11) +=== + +### Service Client Updates +* `service/apigateway`: Updates service API and documentation + * API Gateway request validators +* `service/batch`: Updates service API and documentation + * API Update for AWS Batch: Customer provided AMI for MANAGED Compute Environment +* `service/gamelift`: Updates service API and documentation + * Allows developers to utilize an improved workflow when calling our Queues API and introduces a new feature that allows developers to specify a maximum allowable latency per Queue. +* `service/opsworks`: Updates service API, documentation, and paginators + * Cloudwatch Logs agent configuration can now be attached to OpsWorks Layers using CreateLayer and UpdateLayer. OpsWorks will then automatically install and manage the CloudWatch Logs agent on the instances part of the OpsWorks Layer. + +### SDK Bugs +* `aws/client`: Fix clients polluting handler list (#1197) + * Fixes the clients potentially polluting the passed in handler list with the client's customizations. This change ensures every client always works with a clean copy of the request handlers and it cannot pollute the handlers back upstream. + * Fixes #1184 +* `aws/request`: Fix waiter error match condition (#1195) + * Fixes the waiters's matching overwriting the request's err, effectively ignoring the error condition. This broke waiters with the FailureWaiterState matcher state. +Release v1.8.11 (2017-04-07) +=== + +### Service Client Updates +* `service/redshift`: Updates service API, documentation, and paginators + * This update adds the GetClusterCredentials API which is used to get temporary login credentials to the cluster. AccountWithRestoreAccess now has a new member AccountAlias, this is the identifier of the AWS support account authorized to restore the specified snapshot. This is added to support the feature where the customer can share their snapshot with the Amazon Redshift Support Account without having to manually specify the AWS Redshift Service account ID on the AWS Console/API. + +Release v1.8.10 (2017-04-06) +=== + +### Service Client Updates +* `service/elbv2`: Updates service documentation + +Release v1.8.9 (2017-04-05) +=== + +### Service Client Updates +* `service/elasticache`: Updates service API, documentation, paginators, and examples + * ElastiCache added support for testing the Elasticache Multi-AZ feature with Automatic Failover. + +Release v1.8.8 (2017-04-04) +=== + +### Service Client Updates +* `service/cloudwatch`: Updates service API, documentation, and paginators + * Amazon Web Services announced the immediate availability of two additional alarm configuration rules for Amazon CloudWatch Alarms. The first rule is for configuring missing data treatment. Customers have the options to treat missing data as alarm threshold breached, alarm threshold not breached, maintain alarm state and the current default treatment. The second rule is for alarms based on percentiles metrics that can trigger unnecassarily if the percentile is calculated from a small number of samples. The new rule can treat percentiles with low sample counts as same as missing data. If the first rule is enabled, the same treatment will be applied when an alarm encounters a percentile with low sample counts. + +Release v1.8.7 (2017-04-03) +=== + +### Service Client Updates +* `service/lexruntimeservice`: Updates service API and documentation + * Adds support to PostContent for speech input + +### SDK Enhancements +* `aws/request`: Improve handler copy, push back, push front performance (#1171) + * Minor optimization to the handler list's handling of copying and pushing request handlers to the handler list. +* Update codegen header to use Go std wording (#1172) + * Go recently accepted the proposal for standard generated file header wording in, https://golang.org/s/generatedcode. + +### SDK Bugs +* `service/dynamodb`: Fix DynamoDB using custom retryer (#1170) + * Fixes (#1139) the DynamoDB service client clobbering any custom retryer that was passed into the service client or Session's config. +Release v1.8.6 (2017-04-01) +=== + +### Service Client Updates +* `service/clouddirectory`: Updates service API and documentation + * ListObjectAttributes now supports filtering by facet. +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.8.5 (2017-03-30) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service waiters and paginators + * Adding paginators for ListExports and ListImports +* `service/cloudfront`: Adds new service + * Amazon CloudFront now supports user configurable HTTP Read and Keep-Alive Idle Timeouts for your Custom Origin Servers +* `service/configservice`: Updates service documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/resourcegroupstaggingapi`: Adds new service +* `service/storagegateway`: Updates service API and documentation + * File gateway mode in AWS Storage gateway provides access to objects in S3 as files on a Network File System (NFS) mount point. Once a file share is created, any changes made externally to the S3 bucket will not be reflected by the gateway. Using the cache refresh feature in this update, the customer can trigger an on-demand scan of the keys in their S3 bucket and refresh the file namespace cached on the gateway. It takes as an input the fileShare ARN and refreshes the cache for only that file share. Additionally there is new functionality on file gateway that allows you configure what squash options they would like on their file share, this allows a customer to configure their gateway to not squash root permissions. This can be done by setting options in NfsOptions for CreateNfsFileShare and UpdateNfsFileShare APIs. + +Release v1.8.4 (2017-03-28) +=== + +### Service Client Updates +* `service/batch`: Updates service API, documentation, and paginators + * Customers can now provide a retryStrategy as part of the RegisterJobDefinition and SubmitJob API calls. The retryStrategy object has a number value for attempts. This is the number of non successful executions before a job is considered FAILED. In addition, the JobDetail object now has an attempts field and shows all execution attempts. +* `service/ec2`: Updates service API and documentation + * Customers can now tag their Amazon EC2 Instances and Amazon EBS Volumes at + the time of their creation. You can do this from the EC2 Instance launch + wizard or through the RunInstances or CreateVolume APIs. By tagging + resources at the time of creation, you can eliminate the need to run custom + tagging scripts after resource creation. In addition, you can now set + resource-level permissions on the CreateVolume, CreateTags, DeleteTags, and + the RunInstances APIs. This allows you to implement stronger security + policies by giving you more granular control over which users and groups + have access to these APIs. You can also enforce the use of tagging and + control what tag keys and values are set on your resources. When you combine + tag usage and resource-level IAM policies together, you can ensure your + instances and volumes are properly secured upon creation and achieve more + accurate cost allocation reporting. These new features are provided at no + additional cost. + +### SDK Enhancements +* `aws/request`: Add retry support for RequestTimeoutException (#1158) + * Adds support for retrying RequestTimeoutException error code that is returned by some services. + +### SDK Bugs +* `private/model/api`: Fix Waiter and Paginators panic on nil param inputs (#1157) + * Corrects the code generation for Paginators and waiters that caused a panic if nil input parameters were used with the operations. +Release v1.8.3 (2017-03-27) +=== + +## Service Client Updates +* `service/ssm`: Updates service API, documentation, and paginators + * Updated validation rules for SendCommand and RegisterTaskWithMaintenanceWindow APIs. +Release v1.8.2 (2017-03-24) +=== + +Service Client Updates +--- +* `service/applicationautoscaling`: Updates service API, documentation, and paginators + * Application AutoScaling is launching support for a new target resource (AppStream 2.0 Fleets) as a scalable target. +* `service/cloudtrail`: Updates service API and documentation + * Doc-only Update for CloudTrail: Add required parameters for GetEventSelectors and PutEventSelectors + +Release v1.8.1 (2017-03-23) +=== + +Service Client Updates +--- +* `service/applicationdiscoveryservice`: Updates service API, documentation, and paginators + * Adds export configuration options to the AWS Discovery Service API. +* `service/elbv2`: Updates waiters +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lambda`: Updates service API and paginators + * Adds support for new runtime Node.js v6.10 for AWS Lambda service + Release v1.8.0 (2017-03-22) === diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md index e69de29b..8a1927a3 100644 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md @@ -0,0 +1,5 @@ +### SDK Features + +### SDK Enhancements + +### SDK Bugs diff --git a/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md b/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md index 81edbfae..7c0186f0 100644 --- a/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md +++ b/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md @@ -64,6 +64,11 @@ Please be aware of the following notes prior to opening a pull request: SDK's test coverage percentage are unlikely to be merged until tests have been added. +5. The JSON files under the SDK's `models` folder are sourced from outside the SDK. + Such as `models/apis/ec2/2016-11-15/api.json`. We will not accept pull requests + directly on these models. If you discover an issue with the models please + create a Github [issue](issues) describing the issue. + ### Testing To run the tests locally, running the `make unit` command will `go get` the diff --git a/vendor/github.com/aws/aws-sdk-go/Gopkg.lock b/vendor/github.com/aws/aws-sdk-go/Gopkg.lock new file mode 100644 index 00000000..854c94fd --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/Gopkg.lock @@ -0,0 +1,20 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/go-ini/ini" + packages = ["."] + revision = "300e940a926eb277d3901b20bdfcc54928ad3642" + version = "v1.25.4" + +[[projects]] + name = "github.com/jmespath/go-jmespath" + packages = ["."] + revision = "0b12d6b5" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "51a86a867df617990082dec6b868e4efe2fdb2ed0e02a3daa93cd30f962b5085" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/aws/aws-sdk-go/Gopkg.toml b/vendor/github.com/aws/aws-sdk-go/Gopkg.toml new file mode 100644 index 00000000..664fc595 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/Gopkg.toml @@ -0,0 +1,48 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + +ignored = [ + # Testing/Example/Codegen dependencies + "github.com/stretchr/testify", + "github.com/stretchr/testify/assert", + "github.com/stretchr/testify/require", + "github.com/go-sql-driver/mysql", + "github.com/gucumber/gucumber", + "github.com/pkg/errors", + "golang.org/x/net", + "golang.org/x/net/html", + "golang.org/x/net/http2", + "golang.org/x/text", + "golang.org/x/text/html", + "golang.org/x/tools", + "golang.org/x/tools/go/loader", +] + + +[[constraint]] + name = "github.com/go-ini/ini" + version = "1.25.4" + +[[constraint]] + name = "github.com/jmespath/go-jmespath" + revision = "0b12d6b5" + #version = "0.2.2" diff --git a/vendor/github.com/aws/aws-sdk-go/Makefile b/vendor/github.com/aws/aws-sdk-go/Makefile index fc2bc0ce..83ccc1e6 100644 --- a/vendor/github.com/aws/aws-sdk-go/Makefile +++ b/vendor/github.com/aws/aws-sdk-go/Makefile @@ -5,7 +5,8 @@ LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)' LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be ' LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be ' LINTIGNOREDEPS='vendor/.+\.go' -UNIT_TEST_TAGS="example codegen" +LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form' +UNIT_TEST_TAGS="example codegen awsinclude" SDK_WITH_VENDOR_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/src") SDK_ONLY_PKGS=$(shell go list ./... | grep -v "/vendor/") @@ -64,13 +65,16 @@ integration: get-deps-tests integ-custom smoke-tests performance integ-custom: go test -tags "integration" ./awstesting/integration/customizations/... +cleanup-integ: + go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration" + smoke-tests: get-deps-tests gucumber -go-tags "integration" ./awstesting/integration/smoke performance: get-deps-tests AWS_TESTING_LOG_RESULTS=${log-detailed} AWS_TESTING_REGION=$(region) AWS_TESTING_DB_TABLE=$(table) gucumber -go-tags "integration" ./awstesting/performance -sandbox-tests: sandbox-test-go15 sandbox-test-go15-novendorexp sandbox-test-go16 sandbox-test-go17 sandbox-test-go18 sandbox-test-gotip +sandbox-tests: sandbox-test-go15 sandbox-test-go15-novendorexp sandbox-test-go16 sandbox-test-go17 sandbox-test-go18 sandbox-test-go19 sandbox-test-gotip sandbox-build-go15: docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5 -t "aws-sdk-go-1.5" . @@ -107,6 +111,13 @@ sandbox-go18: sandbox-build-go18 sandbox-test-go18: sandbox-build-go18 docker run -t aws-sdk-go-1.8 +sandbox-build-go19: + docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.9" . +sandbox-go19: sandbox-build-go19 + docker run -i -t aws-sdk-go-1.9 bash +sandbox-test-go19: sandbox-build-go19 + docker run -t aws-sdk-go-1.9 + sandbox-build-gotip: @echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container" docker build -f ./awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" . @@ -123,7 +134,7 @@ verify: get-deps-verify lint vet lint: @echo "go lint SDK and vendor packages" @lint=`if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then golint ./...; else echo "skipping golint"; fi`; \ - lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD}`; \ + lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT}`; \ echo "$$lint"; \ if [ "$$lint" != "" ] && [ "$$lint" != "skipping golint" ]; then exit 1; fi @@ -149,6 +160,7 @@ get-deps-tests: go get github.com/stretchr/testify go get github.com/smartystreets/goconvey go get golang.org/x/net/html + go get golang.org/x/net/http2 get-deps-verify: @echo "go get SDK verification utilities" diff --git a/vendor/github.com/aws/aws-sdk-go/README.md b/vendor/github.com/aws/aws-sdk-go/README.md index 77755e1f..d5e048a5 100644 --- a/vendor/github.com/aws/aws-sdk-go/README.md +++ b/vendor/github.com/aws/aws-sdk-go/README.md @@ -1,9 +1,6 @@ -# AWS SDK for Go +[![API Reference](http://img.shields.io/badge/api-reference-blue.svg)](http://docs.aws.amazon.com/sdk-for-go/api) [![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) [![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt) -[![API Reference](http://img.shields.io/badge/api-reference-blue.svg)](http://docs.aws.amazon.com/sdk-for-go/api) -[![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) -[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt) +# AWS SDK for Go aws-sdk-go is the official AWS SDK for the Go programming language. @@ -31,16 +28,17 @@ These two processes will still include the `vendor` folder and it should be dele ## Getting Help Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests. + * Ask a question on [StackOverflow](http://stackoverflow.com/) and tag it with the [`aws-sdk-go`](http://stackoverflow.com/questions/tagged/aws-sdk-go) tag. * Come join the AWS SDK for Go community chat on [gitter](https://gitter.im/aws/aws-sdk-go). * Open a support ticket with [AWS Support](http://docs.aws.amazon.com/awssupport/latest/user/getting-started.html). -* If you think you may of found a bug, please open an [issue](https://github.com/aws/aws-sdk-go/issues/new). +* If you think you may have found a bug, please open an [issue](https://github.com/aws/aws-sdk-go/issues/new). ## Opening Issues -If you encounter a bug with the AWS SDK for Go we would like to hear about it. Search the [existing issues]( https://github.com/aws/aws-sdk-go/issues) and see if others are also experiencing the issue before opening a new issue. Please include the version of AWS SDK for Go, Go language, and OS you’re using. Please also include repro case when appropriate. +If you encounter a bug with the AWS SDK for Go we would like to hear about it. Search the [existing issues](https://github.com/aws/aws-sdk-go/issues) and see if others are also experiencing the issue before opening a new issue. Please include the version of AWS SDK for Go, Go language, and OS you’re using. Please also include repro case when appropriate. -The GitHub issues are intended for bug reports and feature requests. For help and questions with using AWS SDK for GO please make use of the resources listed in the [Getting Help]( https://github.com/aws/aws-sdk-go#getting-help) section. Keeping the list of open issues lean will help us respond in a timely manner. +The GitHub issues are intended for bug reports and feature requests. For help and questions with using AWS SDK for GO please make use of the resources listed in the [Getting Help](https://github.com/aws/aws-sdk-go#getting-help) section. Keeping the list of open issues lean will help us respond in a timely manner. ## Reference Documentation @@ -52,80 +50,397 @@ The GitHub issues are intended for bug reports and feature requests. For help an [`SDK Examples`](https://github.com/aws/aws-sdk-go/tree/master/example) - Included in the SDK's repo are a several hand crafted examples using the SDK features and AWS services. -## Configuring Credentials +## Overview of SDK's Packages -Before using the SDK, ensure that you've configured credentials. The best -way to configure credentials on a development machine is to use the -`~/.aws/credentials` file, which might look like: +The SDK is composed of two main components, SDK core, and service clients. +The SDK core packages are all available under the aws package at the root of +the SDK. Each client for a supported AWS service is available within its own +package under the service folder at the root of the SDK. -``` -[default] -aws_access_key_id = AKID1234567890 -aws_secret_access_key = MY-SECRET-KEY -``` + * aws - SDK core, provides common shared types such as Config, Logger, + and utilities to make working with API parameters easier. -You can learn more about the credentials file from this -[blog post](http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs). + * awserr - Provides the error interface that the SDK will use for all + errors that occur in the SDK's processing. This includes service API + response errors as well. The Error type is made up of a code and message. + Cast the SDK's returned error type to awserr.Error and call the Code + method to compare returned error to specific error codes. See the package's + documentation for additional values that can be extracted such as RequestID. -Alternatively, you can set the following environment variables: + * credentials - Provides the types and built in credentials providers + the SDK will use to retrieve AWS credentials to make API requests with. + Nested under this folder are also additional credentials providers such as + stscreds for assuming IAM roles, and ec2rolecreds for EC2 Instance roles. -``` -AWS_ACCESS_KEY_ID=AKID1234567890 -AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY -``` + * endpoints - Provides the AWS Regions and Endpoints metadata for the SDK. + Use this to lookup AWS service endpoint information such as which services + are in a region, and what regions a service is in. Constants are also provided + for all region identifiers, e.g UsWest2RegionID for "us-west-2". -### AWS shared config file (`~/.aws/config`) -The AWS SDK for Go added support the shared config file in release [v1.3.0](https://github.com/aws/aws-sdk-go/releases/tag/v1.3.0). You can opt into enabling support for the shared config by setting the environment variable `AWS_SDK_LOAD_CONFIG` to a truthy value. See the [Session](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/sessions.html) docs for more information about this feature. + * session - Provides initial default configuration, and load + configuration from external sources such as environment and shared + credentials file. -## Using the Go SDK + * request - Provides the API request sending, and retry logic for the SDK. + This package also includes utilities for defining your own request + retryer, and configuring how the SDK processes the request. -To use a service in the SDK, create a service variable by calling the `New()` -function. Once you have a service client, you can call API operations which each -return response data and a possible error. + * service - Clients for AWS services. All services supported by the SDK are + available under this folder. -To list a set of instance IDs from EC2, you could run: +## How to Use the SDK's AWS Service Clients + +The SDK includes the Go types and utilities you can use to make requests to +AWS service APIs. Within the service folder at the root of the SDK you'll find +a package for each AWS service the SDK supports. All service clients follows +a common pattern of creation and usage. + +When creating a client for an AWS service you'll first need to have a Session +value constructed. The Session provides shared configuration that can be shared +between your service clients. When service clients are created you can pass +in additional configuration via the aws.Config type to override configuration +provided by in the Session to create service client instances with custom +configuration. + +Once the service's client is created you can use it to make API requests the +AWS service. These clients are safe to use concurrently. + +## Configuring the SDK + +In the AWS SDK for Go, you can configure settings for service clients, such +as the log level and maximum number of retries. Most settings are optional; +however, for each service client, you must specify a region and your credentials. +The SDK uses these values to send requests to the correct AWS region and sign +requests with the correct credentials. You can specify these values as part +of a session or as environment variables. + +See the SDK's [configuration guide][config_guide] for more information. + +See the [session][session_pkg] package documentation for more information on how to use Session +with the SDK. + +See the [Config][config_typ] type in the [aws][aws_pkg] package for more information on configuration +options. + +[config_guide]: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html +[session_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ +[config_typ]: https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +[aws_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/ + +### Configuring Credentials + +When using the SDK you'll generally need your AWS credentials to authenticate +with AWS services. The SDK supports multiple methods of supporting these +credentials. By default the SDK will source credentials automatically from +its default credential chain. See the session package for more information +on this chain, and how to configure it. The common items in the credential +chain are the following: + + * Environment Credentials - Set of environment variables that are useful + when sub processes are created for specific roles. + + * Shared Credentials file (~/.aws/credentials) - This file stores your + credentials based on a profile name and is useful for local development. + + * EC2 Instance Role Credentials - Use EC2 Instance Role to assign credentials + to application running on an EC2 instance. This removes the need to manage + credential files in production. + +Credentials can be configured in code as well by setting the Config's Credentials +value to a custom provider or using one of the providers included with the +SDK to bypass the default credential chain and use a custom one. This is +helpful when you want to instruct the SDK to only use a specific set of +credentials or providers. + +This example creates a credential provider for assuming an IAM role, "myRoleARN" +and configures the S3 service client to use that role for API requests. ```go -package main + // Initial credentials loaded from SDK's default credential chain. Such as + // the environment, shared credentials (~/.aws/credentials), or EC2 Instance + // Role. These credentials will be used to to make the STS Assume Role API. + sess := session.Must(session.NewSession()) -import ( - "fmt" + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. + creds := stscreds.NewCredentials(sess, "myRoleArn") - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ec2" -) - -func main() { - sess, err := session.NewSession() - if err != nil { - panic(err) - } - - // Create an EC2 service object in the "us-west-2" region - // Note that you can also configure your region globally by - // exporting the AWS_REGION environment variable - svc := ec2.New(sess, &aws.Config{Region: aws.String("us-west-2")}) - - // Call the DescribeInstances Operation - resp, err := svc.DescribeInstances(nil) - if err != nil { - panic(err) - } - - // resp has all of the response data, pull out instance IDs: - fmt.Println("> Number of reservation sets: ", len(resp.Reservations)) - for idx, res := range resp.Reservations { - fmt.Println(" > Number of instances: ", len(res.Instances)) - for _, inst := range resp.Reservations[idx].Instances { - fmt.Println(" - Instance ID: ", *inst.InstanceId) - } - } -} + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) ``` -You can find more information and operations in our -[API documentation](http://docs.aws.amazon.com/sdk-for-go/api/). +See the [credentials][credentials_pkg] package documentation for more information on credential +providers included with the SDK, and how to customize the SDK's usage of +credentials. + +The SDK has support for the shared configuration file (~/.aws/config). This +support can be enabled by setting the environment variable, "AWS_SDK_LOAD_CONFIG=1", +or enabling the feature in code when creating a Session via the +Option's SharedConfigState parameter. + +```go + sess := session.Must(session.NewSessionWithOptions(session.Options{ + SharedConfigState: session.SharedConfigEnable, + })) +``` + +[credentials_pkg]: ttps://docs.aws.amazon.com/sdk-for-go/api/aws/credentials + +### Configuring AWS Region + +In addition to the credentials you'll need to specify the region the SDK +will use to make AWS API requests to. In the SDK you can specify the region +either with an environment variable, or directly in code when a Session or +service client is created. The last value specified in code wins if the region +is specified multiple ways. + +To set the region via the environment variable set the "AWS_REGION" to the +region you want to the SDK to use. Using this method to set the region will +allow you to run your application in multiple regions without needing additional +code in the application to select the region. + + AWS_REGION=us-west-2 + +The endpoints package includes constants for all regions the SDK knows. The +values are all suffixed with RegionID. These values are helpful, because they +reduce the need to type the region string manually. + +To set the region on a Session use the aws package's Config struct parameter +Region to the AWS region you want the service clients created from the session to +use. This is helpful when you want to create multiple service clients, and +all of the clients make API requests to the same region. + +```go + sess := session.Must(session.NewSession(&aws.Config{ + Region: aws.String(endpoints.UsWest2RegionID), + })) +``` + +See the [endpoints][endpoints_pkg] package for the AWS Regions and Endpoints metadata. + +In addition to setting the region when creating a Session you can also set +the region on a per service client bases. This overrides the region of a +Session. This is helpful when you want to create service clients in specific +regions different from the Session's region. + +```go + svc := s3.New(sess, &aws.Config{ + Region: aws.String(endpoints.UsWest2RegionID), + }) +``` + +See the [Config][config_typ] type in the [aws][aws_pkg] package for more information and additional +options such as setting the Endpoint, and other service client configuration options. + +[endpoints_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/endpoints/ + +## Making API Requests + +Once the client is created you can make an API request to the service. +Each API method takes a input parameter, and returns the service response +and an error. The SDK provides methods for making the API call in multiple ways. + +In this list we'll use the S3 ListObjects API as an example for the different +ways of making API requests. + + * ListObjects - Base API operation that will make the API request to the service. + + * ListObjectsRequest - API methods suffixed with Request will construct the + API request, but not send it. This is also helpful when you want to get a + presigned URL for a request, and share the presigned URL instead of your + application making the request directly. + + * ListObjectsPages - Same as the base API operation, but uses a callback to + automatically handle pagination of the API's response. + + * ListObjectsWithContext - Same as base API operation, but adds support for + the Context pattern. This is helpful for controlling the canceling of in + flight requests. See the Go standard library context package for more + information. This method also takes request package's Option functional + options as the variadic argument for modifying how the request will be + made, or extracting information from the raw HTTP response. + + * ListObjectsPagesWithContext - same as ListObjectsPages, but adds support for + the Context pattern. Similar to ListObjectsWithContext this method also + takes the request package's Option function option types as the variadic + argument. + +In addition to the API operations the SDK also includes several higher level +methods that abstract checking for and waiting for an AWS resource to be in +a desired state. In this list we'll use WaitUntilBucketExists to demonstrate +the different forms of waiters. + + * WaitUntilBucketExists. - Method to make API request to query an AWS service for + a resource's state. Will return successfully when that state is accomplished. + + * WaitUntilBucketExistsWithContext - Same as WaitUntilBucketExists, but adds + support for the Context pattern. In addition these methods take request + package's WaiterOptions to configure the waiter, and how underlying request + will be made by the SDK. + +The API method will document which error codes the service might return for +the operation. These errors will also be available as const strings prefixed +with "ErrCode" in the service client's package. If there are no errors listed +in the API's SDK documentation you'll need to consult the AWS service's API +documentation for the errors that could be returned. + +```go + ctx := context.Background() + + result, err := svc.GetObjectWithContext(ctx, &s3.GetObjectInput{ + Bucket: aws.String("my-bucket"), + Key: aws.String("my-key"), + }) + if err != nil { + // Cast err to awserr.Error to handle specific error codes. + aerr, ok := err.(awserr.Error) + if ok && aerr.Code() == s3.ErrCodeNoSuchKey { + // Specific error code handling + } + return err + } + + // Make sure to close the body when done with it for S3 GetObject APIs or + // will leak connections. + defer result.Body.Close() + + fmt.Println("Object Size:", aws.StringValue(result.ContentLength)) +``` + +### API Request Pagination and Resource Waiters + +Pagination helper methods are suffixed with "Pages", and provide the +functionality needed to round trip API page requests. Pagination methods +take a callback function that will be called for each page of the API's response. + +```go + objects := []string{} + err := svc.ListObjectsPagesWithContext(ctx, &s3.ListObjectsInput{ + Bucket: aws.String(myBucket), + }, func(p *s3.ListObjectsOutput, lastPage bool) bool { + for _, o := range p.Contents { + objects = append(objects, aws.StringValue(o.Key)) + } + return true // continue paging + }) + if err != nil { + panic(fmt.Sprintf("failed to list objects for bucket, %s, %v", myBucket, err)) + } + + fmt.Println("Objects in bucket:", objects) +``` + +Waiter helper methods provide the functionality to wait for an AWS resource +state. These methods abstract the logic needed to to check the state of an +AWS resource, and wait until that resource is in a desired state. The waiter +will block until the resource is in the state that is desired, an error occurs, +or the waiter times out. If a resource times out the error code returned will +be request.WaiterResourceNotReadyErrorCode. + +```go + err := svc.WaitUntilBucketExistsWithContext(ctx, &s3.HeadBucketInput{ + Bucket: aws.String(myBucket), + }) + if err != nil { + aerr, ok := err.(awserr.Error) + if ok && aerr.Code() == request.WaiterResourceNotReadyErrorCode { + fmt.Fprintf(os.Stderr, "timed out while waiting for bucket to exist") + } + panic(fmt.Errorf("failed to wait for bucket to exist, %v", err)) + } + fmt.Println("Bucket", myBucket, "exists") +``` + +## Complete SDK Example + +This example shows a complete working Go file which will upload a file to S3 +and use the Context pattern to implement timeout logic that will cancel the +request if it takes too long. This example highlights how to use sessions, +create a service client, make a request, handle the error, and process the +response. + +```go + package main + + import ( + "context" + "flag" + "fmt" + "os" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" + ) + + // Uploads a file to S3 given a bucket and object key. Also takes a duration + // value to terminate the update if it doesn't complete within that time. + // + // The AWS Region needs to be provided in the AWS shared config or on the + // environment variable as `AWS_REGION`. Credentials also must be provided + // Will default to shared config file, but can load from environment if provided. + // + // Usage: + // # Upload myfile.txt to myBucket/myKey. Must complete within 10 minutes or will fail + // go run withContext.go -b mybucket -k myKey -d 10m < myfile.txt + func main() { + var bucket, key string + var timeout time.Duration + + flag.StringVar(&bucket, "b", "", "Bucket name.") + flag.StringVar(&key, "k", "", "Object key name.") + flag.DurationVar(&timeout, "d", 0, "Upload timeout.") + flag.Parse() + + // All clients require a Session. The Session provides the client with + // shared configuration such as region, endpoint, and credentials. A + // Session should be shared where possible to take advantage of + // configuration and credential caching. See the session package for + // more information. + sess := session.Must(session.NewSession()) + + // Create a new instance of the service's client with a Session. + // Optional aws.Config values can also be provided as variadic arguments + // to the New function. This option allows you to provide service + // specific configuration. + svc := s3.New(sess) + + // Create a context with a timeout that will abort the upload if it takes + // more than the passed in timeout. + ctx := context.Background() + var cancelFn func() + if timeout > 0 { + ctx, cancelFn = context.WithTimeout(ctx, timeout) + } + // Ensure the context is canceled to prevent leaking. + // See context package for more information, https://golang.org/pkg/context/ + defer cancelFn() + + // Uploads the object to S3. The Context will interrupt the request if the + // timeout expires. + _, err := svc.PutObjectWithContext(ctx, &s3.PutObjectInput{ + Bucket: aws.String(bucket), + Key: aws.String(key), + Body: os.Stdin, + }) + if err != nil { + if aerr, ok := err.(awserr.Error); ok && aerr.Code() == request.CanceledErrorCode { + // If the SDK can determine the request or retry delay was canceled + // by a context the CanceledErrorCode error code will be returned. + fmt.Fprintf(os.Stderr, "upload canceled due to timeout, %v\n", err) + } else { + fmt.Fprintf(os.Stderr, "failed to upload object, %v\n", err) + } + os.Exit(1) + } + + fmt.Printf("successfully uploaded file to %s/%s\n", bucket, key) + } +``` ## License diff --git a/vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go b/vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go new file mode 100644 index 00000000..44aa125a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go @@ -0,0 +1,86 @@ +// Package arn provides a parser for interacting with Amazon Resource Names. +package arn + +import ( + "errors" + "strings" +) + +const ( + arnDelimiter = ":" + arnSections = 6 + arnPrefix = "arn:" + + // zero-indexed + sectionPartition = 1 + sectionService = 2 + sectionRegion = 3 + sectionAccountID = 4 + sectionResource = 5 + + // errors + invalidPrefix = "arn: invalid prefix" + invalidSections = "arn: not enough sections" +) + +// ARN captures the individual fields of an Amazon Resource Name. +// See http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html for more information. +type ARN struct { + // The partition that the resource is in. For standard AWS regions, the partition is "aws". If you have resources in + // other partitions, the partition is "aws-partitionname". For example, the partition for resources in the China + // (Beijing) region is "aws-cn". + Partition string + + // The service namespace that identifies the AWS product (for example, Amazon S3, IAM, or Amazon RDS). For a list of + // namespaces, see + // http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces. + Service string + + // The region the resource resides in. Note that the ARNs for some resources do not require a region, so this + // component might be omitted. + Region string + + // The ID of the AWS account that owns the resource, without the hyphens. For example, 123456789012. Note that the + // ARNs for some resources don't require an account number, so this component might be omitted. + AccountID string + + // The content of this part of the ARN varies by service. It often includes an indicator of the type of resource — + // for example, an IAM user or Amazon RDS database - followed by a slash (/) or a colon (:), followed by the + // resource name itself. Some services allows paths for resource names, as described in + // http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arns-paths. + Resource string +} + +// Parse parses an ARN into its constituent parts. +// +// Some example ARNs: +// arn:aws:elasticbeanstalk:us-east-1:123456789012:environment/My App/MyEnvironment +// arn:aws:iam::123456789012:user/David +// arn:aws:rds:eu-west-1:123456789012:db:mysql-db +// arn:aws:s3:::my_corporate_bucket/exampleobject.png +func Parse(arn string) (ARN, error) { + if !strings.HasPrefix(arn, arnPrefix) { + return ARN{}, errors.New(invalidPrefix) + } + sections := strings.SplitN(arn, arnDelimiter, arnSections) + if len(sections) != arnSections { + return ARN{}, errors.New(invalidSections) + } + return ARN{ + Partition: sections[sectionPartition], + Service: sections[sectionService], + Region: sections[sectionRegion], + AccountID: sections[sectionAccountID], + Resource: sections[sectionResource], + }, nil +} + +// String returns the canonical representation of the ARN +func (arn ARN) String() string { + return arnPrefix + + arn.Partition + arnDelimiter + + arn.Service + arnDelimiter + + arn.Region + arnDelimiter + + arn.AccountID + arnDelimiter + + arn.Resource +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/arn/arn_test.go b/vendor/github.com/aws/aws-sdk-go/aws/arn/arn_test.go new file mode 100644 index 00000000..3dda7843 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/arn/arn_test.go @@ -0,0 +1,90 @@ +// +build go1.7 + +package arn + +import ( + "errors" + "testing" +) + +func TestParseARN(t *testing.T) { + cases := []struct { + input string + arn ARN + err error + }{ + { + input: "invalid", + err: errors.New(invalidPrefix), + }, + { + input: "arn:nope", + err: errors.New(invalidSections), + }, + { + input: "arn:aws:ecr:us-west-2:123456789012:repository/foo/bar", + arn: ARN{ + Partition: "aws", + Service: "ecr", + Region: "us-west-2", + AccountID: "123456789012", + Resource: "repository/foo/bar", + }, + }, + { + input: "arn:aws:elasticbeanstalk:us-east-1:123456789012:environment/My App/MyEnvironment", + arn: ARN{ + Partition: "aws", + Service: "elasticbeanstalk", + Region: "us-east-1", + AccountID: "123456789012", + Resource: "environment/My App/MyEnvironment", + }, + }, + { + input: "arn:aws:iam::123456789012:user/David", + arn: ARN{ + Partition: "aws", + Service: "iam", + Region: "", + AccountID: "123456789012", + Resource: "user/David", + }, + }, + { + input: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db", + arn: ARN{ + Partition: "aws", + Service: "rds", + Region: "eu-west-1", + AccountID: "123456789012", + Resource: "db:mysql-db", + }, + }, + { + input: "arn:aws:s3:::my_corporate_bucket/exampleobject.png", + arn: ARN{ + Partition: "aws", + Service: "s3", + Region: "", + AccountID: "", + Resource: "my_corporate_bucket/exampleobject.png", + }, + }, + } + for _, tc := range cases { + t.Run(tc.input, func(t *testing.T) { + spec, err := Parse(tc.input) + if tc.arn != spec { + t.Errorf("Expected %q to parse as %v, but got %v", tc.input, tc.arn, spec) + } + if err == nil && tc.err != nil { + t.Errorf("Expected err to be %v, but got nil", tc.err) + } else if err != nil && tc.err == nil { + t.Errorf("Expected err to be nil, but got %v", err) + } else if err != nil && tc.err != nil && err.Error() != tc.err.Error() { + t.Errorf("Expected err to be %v, but got %v", tc.err, err) + } + }) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go index 17fc76a0..788fe6e2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go @@ -2,7 +2,6 @@ package client import ( "fmt" - "net/http/httputil" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/client/metadata" @@ -46,7 +45,7 @@ func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, op svc := &Client{ Config: cfg, ClientInfo: info, - Handlers: handlers, + Handlers: handlers.Copy(), } switch retryer, ok := cfg.Retryer.(request.Retryer); { @@ -86,61 +85,6 @@ func (c *Client) AddDebugHandlers() { return } - c.Handlers.Send.PushFront(logRequest) - c.Handlers.Send.PushBack(logResponse) -} - -const logReqMsg = `DEBUG: Request %s/%s Details: ----[ REQUEST POST-SIGN ]----------------------------- -%s ------------------------------------------------------` - -const logReqErrMsg = `DEBUG ERROR: Request %s/%s: ----[ REQUEST DUMP ERROR ]----------------------------- -%s ------------------------------------------------------` - -func logRequest(r *request.Request) { - logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) - if err != nil { - r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - - if logBody { - // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's - // Body as a NoOpCloser and will not be reset after read by the HTTP - // client reader. - r.ResetBody() - } - - r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ClientInfo.ServiceName, r.Operation.Name, string(dumpedBody))) -} - -const logRespMsg = `DEBUG: Response %s/%s Details: ----[ RESPONSE ]-------------------------------------- -%s ------------------------------------------------------` - -const logRespErrMsg = `DEBUG ERROR: Response %s/%s: ----[ RESPONSE DUMP ERROR ]----------------------------- -%s ------------------------------------------------------` - -func logResponse(r *request.Request) { - var msg = "no response data" - if r.HTTPResponse != nil { - logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, err := httputil.DumpResponse(r.HTTPResponse, logBody) - if err != nil { - r.Config.Logger.Log(fmt.Sprintf(logRespErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - - msg = string(dumpedBody) - } else if r.Error != nil { - msg = r.Error.Error() - } - r.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.ClientInfo.ServiceName, r.Operation.Name, msg)) + c.Handlers.Send.PushFrontNamed(request.NamedHandler{Name: "awssdk.client.LogRequest", Fn: logRequest}) + c.Handlers.Send.PushBackNamed(request.NamedHandler{Name: "awssdk.client.LogResponse", Fn: logResponse}) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go new file mode 100644 index 00000000..30d3b999 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go @@ -0,0 +1,78 @@ +package client + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" +) + +func pushBackTestHandler(name string, list *request.HandlerList) *bool { + called := false + (*list).PushBackNamed(request.NamedHandler{ + Name: name, + Fn: func(r *request.Request) { + called = true + }, + }) + + return &called +} + +func pushFrontTestHandler(name string, list *request.HandlerList) *bool { + called := false + (*list).PushFrontNamed(request.NamedHandler{ + Name: name, + Fn: func(r *request.Request) { + called = true + }, + }) + + return &called +} + +func TestNewClient_CopyHandlers(t *testing.T) { + handlers := request.Handlers{} + firstCalled := pushBackTestHandler("first", &handlers.Send) + secondCalled := pushBackTestHandler("second", &handlers.Send) + + var clientHandlerCalled *bool + c := New(aws.Config{}, metadata.ClientInfo{}, handlers, + func(c *Client) { + clientHandlerCalled = pushFrontTestHandler("client handler", &c.Handlers.Send) + }, + ) + + if e, a := 2, handlers.Send.Len(); e != a { + t.Errorf("expect %d original handlers, got %d", e, a) + } + if e, a := 3, c.Handlers.Send.Len(); e != a { + t.Errorf("expect %d client handlers, got %d", e, a) + } + + handlers.Send.Run(nil) + if !*firstCalled { + t.Errorf("expect first handler to of been called") + } + *firstCalled = false + if !*secondCalled { + t.Errorf("expect second handler to of been called") + } + *secondCalled = false + if *clientHandlerCalled { + t.Errorf("expect client handler to not of been called, but was") + } + + c.Handlers.Send.Run(nil) + if !*firstCalled { + t.Errorf("expect client's first handler to of been called") + } + if !*secondCalled { + t.Errorf("expect client's second handler to of been called") + } + if !*clientHandlerCalled { + t.Errorf("expect client's client handler to of been called") + } + +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index 43a3676b..e25a460f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -15,11 +15,11 @@ import ( // the MaxRetries method: // // type retryer struct { -// service.DefaultRetryer +// client.DefaultRetryer // } // // // This implementation always has 100 max retries -// func (d retryer) MaxRetries() uint { return 100 } +// func (d retryer) MaxRetries() int { return 100 } type DefaultRetryer struct { NumMaxRetries int } @@ -54,6 +54,12 @@ func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { // ShouldRetry returns true if the request should be retried. func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { + // If one of the other handlers already set the retry state + // we don't want to override it based on the service's state + if r.Retryable != nil { + return *r.Retryable + } + if r.HTTPResponse.StatusCode >= 500 { return true } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go new file mode 100644 index 00000000..1f39c91f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -0,0 +1,108 @@ +package client + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http/httputil" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +const logReqMsg = `DEBUG: Request %s/%s Details: +---[ REQUEST POST-SIGN ]----------------------------- +%s +-----------------------------------------------------` + +const logReqErrMsg = `DEBUG ERROR: Request %s/%s: +---[ REQUEST DUMP ERROR ]----------------------------- +%s +------------------------------------------------------` + +type logWriter struct { + // Logger is what we will use to log the payload of a response. + Logger aws.Logger + // buf stores the contents of what has been read + buf *bytes.Buffer +} + +func (logger *logWriter) Write(b []byte) (int, error) { + return logger.buf.Write(b) +} + +type teeReaderCloser struct { + // io.Reader will be a tee reader that is used during logging. + // This structure will read from a body and write the contents to a logger. + io.Reader + // Source is used just to close when we are done reading. + Source io.ReadCloser +} + +func (reader *teeReaderCloser) Close() error { + return reader.Source.Close() +} + +func logRequest(r *request.Request) { + logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) + dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) + if err != nil { + r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) + return + } + + if logBody { + // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's + // Body as a NoOpCloser and will not be reset after read by the HTTP + // client reader. + r.ResetBody() + } + + r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ClientInfo.ServiceName, r.Operation.Name, string(dumpedBody))) +} + +const logRespMsg = `DEBUG: Response %s/%s Details: +---[ RESPONSE ]-------------------------------------- +%s +-----------------------------------------------------` + +const logRespErrMsg = `DEBUG ERROR: Response %s/%s: +---[ RESPONSE DUMP ERROR ]----------------------------- +%s +-----------------------------------------------------` + +func logResponse(r *request.Request) { + lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} + r.HTTPResponse.Body = &teeReaderCloser{ + Reader: io.TeeReader(r.HTTPResponse.Body, lw), + Source: r.HTTPResponse.Body, + } + + handlerFn := func(req *request.Request) { + body, err := httputil.DumpResponse(req.HTTPResponse, false) + if err != nil { + lw.Logger.Log(fmt.Sprintf(logRespErrMsg, req.ClientInfo.ServiceName, req.Operation.Name, err)) + return + } + + b, err := ioutil.ReadAll(lw.buf) + if err != nil { + lw.Logger.Log(fmt.Sprintf(logRespErrMsg, req.ClientInfo.ServiceName, req.Operation.Name, err)) + return + } + lw.Logger.Log(fmt.Sprintf(logRespMsg, req.ClientInfo.ServiceName, req.Operation.Name, string(body))) + if req.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) { + lw.Logger.Log(string(b)) + } + } + + const handlerName = "awsdk.client.LogResponse.ResponseBody" + + r.Handlers.Unmarshal.SetBackNamed(request.NamedHandler{ + Name: handlerName, Fn: handlerFn, + }) + r.Handlers.UnmarshalError.SetBackNamed(request.NamedHandler{ + Name: handlerName, Fn: handlerFn, + }) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go new file mode 100644 index 00000000..b8d600c9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go @@ -0,0 +1,57 @@ +package client + +import ( + "bytes" + "io" + "testing" +) + +type mockCloser struct { + closed bool +} + +func (closer *mockCloser) Read(b []byte) (int, error) { + return 0, io.EOF +} + +func (closer *mockCloser) Close() error { + closer.closed = true + return nil +} + +func TestTeeReaderCloser(t *testing.T) { + expected := "FOO" + buf := bytes.NewBuffer([]byte(expected)) + lw := bytes.NewBuffer(nil) + c := &mockCloser{} + closer := teeReaderCloser{ + io.TeeReader(buf, lw), + c, + } + + b := make([]byte, len(expected)) + _, err := closer.Read(b) + closer.Close() + + if expected != lw.String() { + t.Errorf("Expected %q, but received %q", expected, lw.String()) + } + + if err != nil { + t.Errorf("Expected 'nil', but received %v", err) + } + + if !c.closed { + t.Error("Expected 'true', but received 'false'") + } +} + +func TestLogWriter(t *testing.T) { + expected := "FOO" + lw := &logWriter{nil, bytes.NewBuffer(nil)} + lw.Write([]byte(expected)) + + if expected != lw.buf.String() { + t.Errorf("Expected %q, but received %q", expected, lw.buf.String()) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index 948e0a67..ae3a2869 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -53,6 +53,13 @@ type Config struct { // to use based on region. EndpointResolver endpoints.Resolver + // EnforceShouldRetryCheck is used in the AfterRetryHandler to always call + // ShouldRetry regardless of whether or not if request.Retryable is set. + // This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck + // is not set, then ShouldRetry will only be called if request.Retryable is nil. + // Proper handling of the request.Retryable field is important when setting this field. + EnforceShouldRetryCheck *bool + // The region to send requests to. This parameter is required and must // be configured globally or on a per-client basis unless otherwise // noted. A full list of regions is found in the "Regions and Endpoints" @@ -88,7 +95,7 @@ type Config struct { // recoverable failures. // // When nil or the value does not implement the request.Retryer interface, - // the request.DefaultRetryer will be used. + // the client.DefaultRetryer will be used. // // When both Retryer and MaxRetries are non-nil, the former is used and // the latter ignored. @@ -443,6 +450,10 @@ func mergeInConfig(dst *Config, other *Config) { if other.DisableRestProtocolURICleaning != nil { dst.DisableRestProtocolURICleaning = other.DisableRestProtocolURICleaning } + + if other.EnforceShouldRetryCheck != nil { + dst.EnforceShouldRetryCheck = other.EnforceShouldRetryCheck + } } // Copy will return a shallow copy of the Config object. If any additional diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go index e8cf93d2..8fdda530 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go @@ -4,9 +4,9 @@ package aws import "time" -// An emptyCtx is a copy of the the Go 1.7 context.emptyCtx type. This -// is copied to provide a 1.6 and 1.5 safe version of context that is compatible -// with Go 1.7's Context. +// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to +// provide a 1.6 and 1.5 safe version of context that is compatible with Go +// 1.7's Context. // // An emptyCtx is never canceled, has no values, and has no deadline. It is not // struct{}, since vars of this type must have distinct addresses. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go index 3b73a7da..ff5d58e0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go @@ -311,6 +311,24 @@ func TimeValue(v *time.Time) time.Time { return time.Time{} } +// SecondsTimeValue converts an int64 pointer to a time.Time value +// representing seconds since Epoch or time.Time{} if the pointer is nil. +func SecondsTimeValue(v *int64) time.Time { + if v != nil { + return time.Unix((*v / 1000), 0) + } + return time.Time{} +} + +// MillisecondsTimeValue converts an int64 pointer to a time.Time value +// representing milliseconds sinch Epoch or time.Time{} if the pointer is nil. +func MillisecondsTimeValue(v *int64) time.Time { + if v != nil { + return time.Unix(0, (*v * 1000000)) + } + return time.Time{} +} + // TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". // The result is undefined if the Unix time cannot be represented by an int64. // Which includes calling TimeUnixMilli on a zero Time is undefined. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go index df7a3e5d..0046d220 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go @@ -435,3 +435,36 @@ func TestTimeMap(t *testing.T) { assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } } + +type TimeValueTestCase struct { + in int64 + outSecs time.Time + outMillis time.Time +} + +var testCasesTimeValue = []TimeValueTestCase{ + { + in: int64(1501558289000), + outSecs: time.Unix(1501558289, 0), + outMillis: time.Unix(1501558289, 0), + }, + { + in: int64(1501558289001), + outSecs: time.Unix(1501558289, 0), + outMillis: time.Unix(1501558289, 1*1000000), + }, +} + +func TestSecondsTimeValue(t *testing.T) { + for idx, testCase := range testCasesTimeValue { + out := SecondsTimeValue(&testCase.in) + assert.Equal(t, testCase.outSecs, out, "Unexpected value for time value at %d", idx) + } +} + +func TestMillisecondsTimeValue(t *testing.T) { + for idx, testCase := range testCasesTimeValue { + out := MillisecondsTimeValue(&testCase.in) + assert.Equal(t, testCase.outMillis, out, "Unexpected value for time value at %d", idx) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 08a66659..495e3ef6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -27,7 +27,7 @@ type lener interface { // or will use the HTTPRequest.Header's "Content-Length" if defined. If unable // to determine request body length and no "Content-Length" was specified it will panic. // -// The Content-Length will only be aded to the request if the length of the body +// The Content-Length will only be added to the request if the length of the body // is greater than 0. If the body is empty or the current `Content-Length` // header is <= 0, the header will also be stripped. var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *request.Request) { @@ -71,8 +71,8 @@ var reStatusCode = regexp.MustCompile(`^(\d{3})`) // ValidateReqSigHandler is a request handler to ensure that the request's // signature doesn't expire before it is sent. This can happen when a request -// is built and signed signficantly before it is sent. Or significant delays -// occur whne retrying requests that would cause the signature to expire. +// is built and signed significantly before it is sent. Or significant delays +// occur when retrying requests that would cause the signature to expire. var ValidateReqSigHandler = request.NamedHandler{ Name: "core.ValidateReqSigHandler", Fn: func(r *request.Request) { @@ -98,54 +98,95 @@ var ValidateReqSigHandler = request.NamedHandler{ } // SendHandler is a request handler to send service request using HTTP client. -var SendHandler = request.NamedHandler{Name: "core.SendHandler", Fn: func(r *request.Request) { - var err error - r.HTTPResponse, err = r.Config.HTTPClient.Do(r.HTTPRequest) - if err != nil { - // Prevent leaking if an HTTPResponse was returned. Clean up - // the body. - if r.HTTPResponse != nil { - r.HTTPResponse.Body.Close() +var SendHandler = request.NamedHandler{ + Name: "core.SendHandler", + Fn: func(r *request.Request) { + sender := sendFollowRedirects + if r.DisableFollowRedirects { + sender = sendWithoutFollowRedirects } - // Capture the case where url.Error is returned for error processing - // response. e.g. 301 without location header comes back as string - // error and r.HTTPResponse is nil. Other url redirect errors will - // comeback in a similar method. - if e, ok := err.(*url.Error); ok && e.Err != nil { - if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { - code, _ := strconv.ParseInt(s[1], 10, 64) - r.HTTPResponse = &http.Response{ - StatusCode: int(code), - Status: http.StatusText(int(code)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - return - } + + if request.NoBody == r.HTTPRequest.Body { + // Strip off the request body if the NoBody reader was used as a + // place holder for a request body. This prevents the SDK from + // making requests with a request body when it would be invalid + // to do so. + // + // Use a shallow copy of the http.Request to ensure the race condition + // of transport on Body will not trigger + reqOrig, reqCopy := r.HTTPRequest, *r.HTTPRequest + reqCopy.Body = nil + r.HTTPRequest = &reqCopy + defer func() { + r.HTTPRequest = reqOrig + }() } - if r.HTTPResponse == nil { - // Add a dummy request response object to ensure the HTTPResponse - // value is consistent. + + var err error + r.HTTPResponse, err = sender(r) + if err != nil { + handleSendError(r, err) + } + }, +} + +func sendFollowRedirects(r *request.Request) (*http.Response, error) { + return r.Config.HTTPClient.Do(r.HTTPRequest) +} + +func sendWithoutFollowRedirects(r *request.Request) (*http.Response, error) { + transport := r.Config.HTTPClient.Transport + if transport == nil { + transport = http.DefaultTransport + } + + return transport.RoundTrip(r.HTTPRequest) +} + +func handleSendError(r *request.Request, err error) { + // Prevent leaking if an HTTPResponse was returned. Clean up + // the body. + if r.HTTPResponse != nil { + r.HTTPResponse.Body.Close() + } + // Capture the case where url.Error is returned for error processing + // response. e.g. 301 without location header comes back as string + // error and r.HTTPResponse is nil. Other URL redirect errors will + // comeback in a similar method. + if e, ok := err.(*url.Error); ok && e.Err != nil { + if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { + code, _ := strconv.ParseInt(s[1], 10, 64) r.HTTPResponse = &http.Response{ - StatusCode: int(0), - Status: http.StatusText(int(0)), + StatusCode: int(code), + Status: http.StatusText(int(code)), Body: ioutil.NopCloser(bytes.NewReader([]byte{})), } - } - // Catch all other request errors. - r.Error = awserr.New("RequestError", "send request failed", err) - r.Retryable = aws.Bool(true) // network errors are retryable - - // Override the error with a context canceled error, if that was canceled. - ctx := r.Context() - select { - case <-ctx.Done(): - r.Error = awserr.New(request.CanceledErrorCode, - "request context canceled", ctx.Err()) - r.Retryable = aws.Bool(false) - default: + return } } -}} + if r.HTTPResponse == nil { + // Add a dummy request response object to ensure the HTTPResponse + // value is consistent. + r.HTTPResponse = &http.Response{ + StatusCode: int(0), + Status: http.StatusText(int(0)), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + } + // Catch all other request errors. + r.Error = awserr.New("RequestError", "send request failed", err) + r.Retryable = aws.Bool(true) // network errors are retryable + + // Override the error with a context canceled error, if that was canceled. + ctx := r.Context() + select { + case <-ctx.Done(): + r.Error = awserr.New(request.CanceledErrorCode, + "request context canceled", ctx.Err()) + r.Retryable = aws.Bool(false) + default: + } +} // ValidateResponseHandler is a request handler to validate service response. var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseHandler", Fn: func(r *request.Request) { @@ -160,7 +201,7 @@ var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseH var AfterRetryHandler = request.NamedHandler{Name: "core.AfterRetryHandler", Fn: func(r *request.Request) { // If one of the other handlers already set the retry state // we don't want to override it based on the service's state - if r.Retryable == nil { + if r.Retryable == nil || aws.BoolValue(r.Config.EnforceShouldRetryCheck) { r.Retryable = aws.Bool(r.ShouldRetry(r)) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go new file mode 100644 index 00000000..b47afc24 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go @@ -0,0 +1,64 @@ +// +build go1.8 + +package corehandlers_test + +import ( + "crypto/tls" + "net/http" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/service/s3" + "golang.org/x/net/http2" +) + +func TestSendHandler_HEADNoBody(t *testing.T) { + TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err := awstesting.CreateTLSBundleFiles() + if err != nil { + panic(err) + } + defer awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile) + + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + transport := http.DefaultTransport.(*http.Transport) + // test server's certificate is self-signed certificate + transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + http2.ConfigureTransport(transport) + + sess, err := session.NewSessionWithOptions(session.Options{ + Config: aws.Config{ + HTTPClient: &http.Client{}, + Endpoint: aws.String(endpoint), + Region: aws.String("mock-region"), + Credentials: credentials.AnonymousCredentials, + S3ForcePathStyle: aws.Bool(true), + }, + }) + + svc := s3.New(sess) + + req, _ := svc.HeadObjectRequest(&s3.HeadObjectInput{ + Bucket: aws.String("bucketname"), + Key: aws.String("keyname"), + }) + + if e, a := request.NoBody, req.HTTPRequest.Body; e != a { + t.Fatalf("expect %T request body, got %T", e, a) + } + + err = req.Send() + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, req.HTTPResponse.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go index c698e9ef..fe7d3c9b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go @@ -206,6 +206,39 @@ func TestSendHandlerError(t *testing.T) { assert.NotNil(t, r.HTTPResponse) } +func TestSendWithoutFollowRedirects(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/original": + w.Header().Set("Location", "/redirected") + w.WriteHeader(301) + case "/redirected": + t.Fatalf("expect not to redirect, but was") + } + })) + + svc := awstesting.NewClient(&aws.Config{ + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL), + }) + svc.Handlers.Clear() + svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) + + r := svc.NewRequest(&request.Operation{ + Name: "Operation", + HTTPPath: "/original", + }, nil, nil) + r.DisableFollowRedirects = true + + err := r.Send() + if err != nil { + t.Errorf("expect no error, got %v", err) + } + if e, a := 301, r.HTTPResponse.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } +} + func TestValidateReqSigHandler(t *testing.T) { cases := []struct { Req *request.Request diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go index 6efc77bf..f298d659 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go @@ -13,7 +13,7 @@ var ( // // @readonly ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", - `no valid providers in chain. Deprecated. + `no valid providers in chain. Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, nil) ) @@ -39,16 +39,18 @@ var ( // does not return any credentials ChainProvider will return the error // ErrNoValidProvidersFoundInChain // -// creds := NewChainCredentials( -// []Provider{ -// &EnvProvider{}, -// &EC2RoleProvider{ +// creds := credentials.NewChainCredentials( +// []credentials.Provider{ +// &credentials.EnvProvider{}, +// &ec2rolecreds.EC2RoleProvider{ // Client: ec2metadata.New(sess), // }, // }) // // // Usage of ChainCredentials with aws.Config -// svc := ec2.New(&aws.Config{Credentials: creds}) +// svc := ec2.New(session.Must(session.NewSession(&aws.Config{ +// Credentials: creds, +// }))) // type ChainProvider struct { Providers []Provider diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 7b8ebf5f..42416fc2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -14,7 +14,7 @@ // // Example of using the environment variable credentials. // -// creds := NewEnvCredentials() +// creds := credentials.NewEnvCredentials() // // // Retrieve the credentials value // credValue, err := creds.Get() @@ -26,7 +26,7 @@ // This may be helpful to proactively expire credentials and refresh them sooner // than they would naturally expire on their own. // -// creds := NewCredentials(&EC2RoleProvider{}) +// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{}) // creds.Expire() // credsValue, err := creds.Get() // // New credentials will be retrieved instead of from cache. @@ -43,7 +43,7 @@ // func (m *MyProvider) Retrieve() (Value, error) {...} // func (m *MyProvider) IsExpired() bool {...} // -// creds := NewCredentials(&MyProvider{}) +// creds := credentials.NewCredentials(&MyProvider{}) // credValue, err := creds.Get() // package credentials @@ -60,7 +60,9 @@ import ( // when making service API calls. For example, when accessing public // s3 buckets. // -// svc := s3.New(&aws.Config{Credentials: AnonymousCredentials}) +// svc := s3.New(session.Must(session.NewSession(&aws.Config{ +// Credentials: credentials.AnonymousCredentials, +// }))) // // Access public S3 buckets. // // @readonly @@ -88,7 +90,7 @@ type Value struct { // The Provider should not need to implement its own mutexes, because // that will be managed by Credentials. type Provider interface { - // Refresh returns nil if it successfully retrieved the value. + // Retrieve returns nil if it successfully retrieved the value. // Error is returned if the value were not obtainable, or empty. Retrieve() (Value, error) @@ -97,6 +99,27 @@ type Provider interface { IsExpired() bool } +// An ErrorProvider is a stub credentials provider that always returns an error +// this is used by the SDK when construction a known provider is not possible +// due to an error. +type ErrorProvider struct { + // The error to be returned from Retrieve + Err error + + // The provider name to set on the Retrieved returned Value + ProviderName string +} + +// Retrieve will always return the error that the ErrorProvider was created with. +func (p ErrorProvider) Retrieve() (Value, error) { + return Value{ProviderName: p.ProviderName}, p.Err +} + +// IsExpired will always return not expired. +func (p ErrorProvider) IsExpired() bool { + return false +} + // A Expiry provides shared expiration logic to be used by credentials // providers to implement expiry functionality. // diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go index 96655bc4..c14231a1 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go @@ -29,6 +29,7 @@ var ( // Environment variables used: // // * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY +// // * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY type EnvProvider struct { retrieved bool diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/doc_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/doc_1_7.go new file mode 100644 index 00000000..5b269fee --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/doc_1_7.go @@ -0,0 +1,5 @@ +// +build !go1.8 + +// Package plugincreds provides usage of Go plugins for providing credentials +// to the SDK. Only available with Go 1.8 and above. +package plugincreds diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go new file mode 100644 index 00000000..77c386ca --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider.go @@ -0,0 +1,211 @@ +// +build go1.8 + +// Package plugincreds implements a credentials provider sourced from a Go +// plugin. This package allows you to use a Go plugin to retrieve AWS credentials +// for the SDK to use for service API calls. +// +// As of Go 1.8 plugins are only supported on the Linux platform. +// +// Plugin Symbol Name +// +// The "GetAWSSDKCredentialProvider" is the symbol name that will be used to +// lookup the credentials provider getter from the plugin. If you want to use a +// custom symbol name you should use GetPluginProviderFnsByName to lookup the +// symbol by a custom name. +// +// This symbol is a function that returns two additional functions. One to +// retrieve the credentials, and another to determine if the credentials have +// expired. +// +// Plugin Symbol Signature +// +// The plugin credential provider requires the symbol to match the +// following signature. +// +// func() (RetrieveFn func() (key, secret, token string, err error), IsExpiredFn func() bool) +// +// Plugin Implementation Exmaple +// +// The following is an example implementation of a SDK credential provider using +// the plugin provider in this package. See the SDK's example/aws/credential/plugincreds/plugin +// folder for a runnable example of this. +// +// package main +// +// func main() {} +// +// var myCredProvider provider +// +// // Build: go build -o plugin.so -buildmode=plugin plugin.go +// func init() { +// // Initialize a mock credential provider with stubs +// myCredProvider = provider{"a","b","c"} +// } +// +// // GetAWSSDKCredentialProvider is the symbol SDK will lookup and use to +// // get the credential provider's retrieve and isExpired functions. +// func GetAWSSDKCredentialProvider() (func() (key, secret, token string, err error), func() bool) { +// return myCredProvider.Retrieve, myCredProvider.IsExpired +// } +// +// // mock implementation of a type that returns retrieves credentials and +// // returns if they have expired. +// type provider struct { +// key, secret, token string +// } +// +// func (p provider) Retrieve() (key, secret, token string, err error) { +// return p.key, p.secret, p.token, nil +// } +// +// func (p *provider) IsExpired() bool { +// return false; +// } +// +// Configuring SDK for Plugin Credentials +// +// To configure the SDK to use a plugin's credential provider you'll need to first +// open the plugin file using the plugin standard library package. Once you have +// a handle to the plugin you can use the NewCredentials function of this package +// to create a new credentials.Credentials value that can be set as the +// credentials loader of a Session or Config. See the SDK's example/aws/credential/plugincreds +// folder for a runnable example of this. +// +// // Open plugin, and load it into the process. +// p, err := plugin.Open("somefile.so") +// if err != nil { +// return nil, err +// } +// +// // Create a new Credentials value which will source the provider's Retrieve +// // and IsExpired functions from the plugin. +// creds, err := plugincreds.NewCredentials(p) +// if err != nil { +// return nil, err +// } +// +// // Example to configure a Session with the newly created credentials that +// // will be sourced using the plugin's functionality. +// sess := session.Must(session.NewSession(&aws.Config{ +// Credentials: creds, +// })) +package plugincreds + +import ( + "fmt" + "plugin" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" +) + +// ProviderSymbolName the symbol name the SDK will use to lookup the plugin +// provider value from. +const ProviderSymbolName = `GetAWSSDKCredentialProvider` + +// ProviderName is the name this credentials provider will label any returned +// credentials Value with. +const ProviderName = `PluginCredentialsProvider` + +const ( + // ErrCodeLookupSymbolError failed to lookup symbol + ErrCodeLookupSymbolError = "LookupSymbolError" + + // ErrCodeInvalidSymbolError symbol invalid + ErrCodeInvalidSymbolError = "InvalidSymbolError" + + // ErrCodePluginRetrieveNil Retrieve function was nil + ErrCodePluginRetrieveNil = "PluginRetrieveNilError" + + // ErrCodePluginIsExpiredNil IsExpired Function was nil + ErrCodePluginIsExpiredNil = "PluginIsExpiredNilError" + + // ErrCodePluginProviderRetrieve plugin provider's retrieve returned error + ErrCodePluginProviderRetrieve = "PluginProviderRetrieveError" +) + +// Provider is the credentials provider that will use the plugin provided +// Retrieve and IsExpired functions to retrieve credentials. +type Provider struct { + RetrieveFn func() (key, secret, token string, err error) + IsExpiredFn func() bool +} + +// NewCredentials returns a new Credentials loader using the plugin provider. +// If the symbol isn't found or is invalid in the plugin an error will be +// returned. +func NewCredentials(p *plugin.Plugin) (*credentials.Credentials, error) { + retrieve, isExpired, err := GetPluginProviderFns(p) + if err != nil { + return nil, err + } + + return credentials.NewCredentials(Provider{ + RetrieveFn: retrieve, + IsExpiredFn: isExpired, + }), nil +} + +// Retrieve will return the credentials Value if they were successfully retrieved +// from the underlying plugin provider. An error will be returned otherwise. +func (p Provider) Retrieve() (credentials.Value, error) { + creds := credentials.Value{ + ProviderName: ProviderName, + } + + k, s, t, err := p.RetrieveFn() + if err != nil { + return creds, awserr.New(ErrCodePluginProviderRetrieve, + "failed to retrieve credentials with plugin provider", err) + } + + creds.AccessKeyID = k + creds.SecretAccessKey = s + creds.SessionToken = t + + return creds, nil +} + +// IsExpired will return the expired state of the underlying plugin provider. +func (p Provider) IsExpired() bool { + return p.IsExpiredFn() +} + +// GetPluginProviderFns returns the plugin's Retrieve and IsExpired functions +// returned by the plugin's credential provider getter. +// +// Uses ProviderSymbolName as the symbol name when lookup up the symbol. If you +// want to use a different symbol name, use GetPluginProviderFnsByName. +func GetPluginProviderFns(p *plugin.Plugin) (func() (key, secret, token string, err error), func() bool, error) { + return GetPluginProviderFnsByName(p, ProviderSymbolName) +} + +// GetPluginProviderFnsByName returns the plugin's Retrieve and IsExpired functions +// returned by the plugin's credential provider getter. +// +// Same as GetPluginProviderFns, but takes a custom symbolName to lookup with. +func GetPluginProviderFnsByName(p *plugin.Plugin, symbolName string) (func() (key, secret, token string, err error), func() bool, error) { + sym, err := p.Lookup(symbolName) + if err != nil { + return nil, nil, awserr.New(ErrCodeLookupSymbolError, + fmt.Sprintf("failed to lookup %s plugin provider symbol", symbolName), err) + } + + fn, ok := sym.(func() (func() (key, secret, token string, err error), func() bool)) + if !ok { + return nil, nil, awserr.New(ErrCodeInvalidSymbolError, + fmt.Sprintf("symbol %T, does not match the 'func() (func() (key, secret, token string, err error), func() bool)' type", sym), nil) + } + + retrieveFn, isExpiredFn := fn() + if retrieveFn == nil { + return nil, nil, awserr.New(ErrCodePluginRetrieveNil, + "the plugin provider retrieve function cannot be nil", nil) + } + if isExpiredFn == nil { + return nil, nil, awserr.New(ErrCodePluginIsExpiredNil, + "the plugin provider isExpired function cannot be nil", nil) + } + + return retrieveFn, isExpiredFn, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider_test.go new file mode 100644 index 00000000..a6b8563b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/plugincreds/provider_test.go @@ -0,0 +1,71 @@ +// +build go1.8,awsinclude + +package plugincreds + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" +) + +func TestProvider_Passthrough(t *testing.T) { + p := Provider{ + RetrieveFn: func() (string, string, string, error) { + return "key", "secret", "token", nil + }, + IsExpiredFn: func() bool { + return false + }, + } + + actual, err := p.Retrieve() + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + expect := credentials.Value{ + AccessKeyID: "key", + SecretAccessKey: "secret", + SessionToken: "token", + ProviderName: ProviderName, + } + if expect != actual { + t.Errorf("expect %+v credentials, got %+v", expect, actual) + } +} + +func TestProvider_Error(t *testing.T) { + expectErr := fmt.Errorf("expect error") + + p := Provider{ + RetrieveFn: func() (string, string, string, error) { + return "", "", "", expectErr + }, + IsExpiredFn: func() bool { + return false + }, + } + + actual, err := p.Retrieve() + if err == nil { + t.Fatalf("expect error, got none") + } + + aerr := err.(awserr.Error) + if e, a := ErrCodePluginProviderRetrieve, aerr.Code(); e != a { + t.Errorf("expect %s error code, got %s", e, a) + } + + if e, a := expectErr, aerr.OrigErr(); e != a { + t.Errorf("expect %v cause error, got %v", e, a) + } + + expect := credentials.Value{ + ProviderName: ProviderName, + } + if expect != actual { + t.Errorf("expect %+v credentials, got %+v", expect, actual) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go index 7fb7cbf0..51e21e0f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go @@ -3,11 +3,11 @@ package credentials import ( "fmt" "os" - "path/filepath" "github.com/go-ini/ini" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/internal/shareddefaults" ) // SharedCredsProviderName provides a name of SharedCreds provider @@ -15,8 +15,6 @@ const SharedCredsProviderName = "SharedCredentialsProvider" var ( // ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found. - // - // @readonly ErrSharedCredentialsHomeNotFound = awserr.New("UserHomeNotFound", "user home directory not found.", nil) ) @@ -117,22 +115,23 @@ func loadProfile(filename, profile string) (Value, error) { // // Will return an error if the user's home directory path cannot be found. func (p *SharedCredentialsProvider) filename() (string, error) { - if p.Filename == "" { - if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); p.Filename != "" { - return p.Filename, nil - } - - homeDir := os.Getenv("HOME") // *nix - if homeDir == "" { // Windows - homeDir = os.Getenv("USERPROFILE") - } - if homeDir == "" { - return "", ErrSharedCredentialsHomeNotFound - } - - p.Filename = filepath.Join(homeDir, ".aws", "credentials") + if len(p.Filename) != 0 { + return p.Filename, nil } + if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); len(p.Filename) != 0 { + return p.Filename, nil + } + + if home := shareddefaults.UserHomeDir(); len(home) == 0 { + // Backwards compatibility of home directly not found error being returned. + // This error is too verbose, failure when opening the file would of been + // a better error to return. + return "", ErrSharedCredentialsHomeNotFound + } + + p.Filename = shareddefaults.SharedCredentialsFilename() + return p.Filename, nil } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go index 6b4093a1..1eb45f26 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go @@ -5,6 +5,7 @@ import ( "path/filepath" "testing" + "github.com/aws/aws-sdk-go/internal/shareddefaults" "github.com/stretchr/testify/assert" ) @@ -97,6 +98,25 @@ func TestSharedCredentialsProviderColonInCredFile(t *testing.T) { assert.Empty(t, creds.SessionToken, "Expect no token") } +func TestSharedCredentialsProvider_DefaultFilename(t *testing.T) { + os.Clearenv() + os.Setenv("USERPROFILE", "profile_dir") + os.Setenv("HOME", "home_dir") + + // default filename and profile + p := SharedCredentialsProvider{} + + filename, err := p.filename() + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + if e, a := shareddefaults.SharedCredentialsFilename(), filename; e != a { + t.Errorf("expect %q filename, got %q", e, a) + } +} + func BenchmarkSharedCredentialsProvider(b *testing.B) { os.Clearenv() diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index b8406233..4108e433 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -12,7 +12,7 @@ between multiple Credentials, Sessions or service clients. Assume Role To assume an IAM role using STS with the SDK you can create a new Credentials -with the SDKs's stscreds package. +with the SDKs's stscreds package. // Initial credentials loaded from SDK's default credential chain. Such as // the environment, shared credentials (~/.aws/credentials), or EC2 Instance diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go index 110ca836..07afe3b8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -10,10 +10,12 @@ package defaults import ( "fmt" "net/http" + "net/url" "os" "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" @@ -96,23 +98,51 @@ func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credenti }) } -// RemoteCredProvider returns a credenitials provider for the default remote +const ( + httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" + ecsCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" +) + +// RemoteCredProvider returns a credentials provider for the default remote // endpoints such as EC2 or ECS Roles. func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - ecsCredURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") + if u := os.Getenv(httpProviderEnvVar); len(u) > 0 { + return localHTTPCredProvider(cfg, handlers, u) + } - if len(ecsCredURI) > 0 { - return ecsCredProvider(cfg, handlers, ecsCredURI) + if uri := os.Getenv(ecsCredsProviderEnvVar); len(uri) > 0 { + u := fmt.Sprintf("http://169.254.170.2%s", uri) + return httpCredProvider(cfg, handlers, u) } return ec2RoleProvider(cfg, handlers) } -func ecsCredProvider(cfg aws.Config, handlers request.Handlers, uri string) credentials.Provider { - const host = `169.254.170.2` +func localHTTPCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { + var errMsg string - return endpointcreds.NewProviderClient(cfg, handlers, - fmt.Sprintf("http://%s%s", host, uri), + parsed, err := url.Parse(u) + if err != nil { + errMsg = fmt.Sprintf("invalid URL, %v", err) + } else if host := aws.URLHostname(parsed); !(host == "localhost" || host == "127.0.0.1") { + errMsg = fmt.Sprintf("invalid host address, %q, only localhost and 127.0.0.1 are valid.", host) + } + + if len(errMsg) > 0 { + if cfg.Logger != nil { + cfg.Logger.Log("Ignoring, HTTP credential provider", errMsg, err) + } + return credentials.ErrorProvider{ + Err: awserr.New("CredentialsEndpointError", errMsg, err), + ProviderName: endpointcreds.ProviderName, + } + } + + return httpCredProvider(cfg, handlers, u) +} + +func httpCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { + return endpointcreds.NewProviderClient(cfg, handlers, u, func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute }, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go index bea61dea..d3e4a86b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go @@ -6,39 +6,83 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" "github.com/aws/aws-sdk-go/aws/request" - "github.com/stretchr/testify/assert" ) +func TestHTTPCredProvider(t *testing.T) { + cases := []struct { + Host string + Fail bool + }{ + {"localhost", false}, {"127.0.0.1", false}, + {"www.example.com", true}, {"169.254.170.2", true}, + } + + defer os.Clearenv() + + for i, c := range cases { + u := fmt.Sprintf("http://%s/abc/123", c.Host) + os.Setenv(httpProviderEnvVar, u) + + provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + if provider == nil { + t.Fatalf("%d, expect provider not to be nil, but was", i) + } + + if c.Fail { + creds, err := provider.Retrieve() + if err == nil { + t.Fatalf("%d, expect error but got none", i) + } else { + aerr := err.(awserr.Error) + if e, a := "CredentialsEndpointError", aerr.Code(); e != a { + t.Errorf("%d, expect %s error code, got %s", i, e, a) + } + } + if e, a := endpointcreds.ProviderName, creds.ProviderName; e != a { + t.Errorf("%d, expect %s provider name got %s", i, e, a) + } + } else { + httpProvider := provider.(*endpointcreds.Provider) + if e, a := u, httpProvider.Client.Endpoint; e != a { + t.Errorf("%d, expect %q endpoint, got %q", i, e, a) + } + } + } +} + func TestECSCredProvider(t *testing.T) { defer os.Clearenv() - os.Setenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", "/abc/123") + os.Setenv(ecsCredsProviderEnvVar, "/abc/123") provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + if provider == nil { + t.Fatalf("expect provider not to be nil, but was") + } - assert.NotNil(t, provider) - - ecsProvider, ok := provider.(*endpointcreds.Provider) - assert.NotNil(t, ecsProvider) - assert.True(t, ok) - - assert.Equal(t, fmt.Sprintf("http://169.254.170.2/abc/123"), - ecsProvider.Client.Endpoint) + httpProvider := provider.(*endpointcreds.Provider) + if httpProvider == nil { + t.Fatalf("expect provider not to be nil, but was") + } + if e, a := "http://169.254.170.2/abc/123", httpProvider.Client.Endpoint; e != a { + t.Errorf("expect %q endpoint, got %q", e, a) + } } func TestDefaultEC2RoleProvider(t *testing.T) { provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + if provider == nil { + t.Fatalf("expect provider not to be nil, but was") + } - assert.NotNil(t, provider) - - ec2Provider, ok := provider.(*ec2rolecreds.EC2RoleProvider) - assert.NotNil(t, ec2Provider) - assert.True(t, ok) - - fmt.Println(ec2Provider.Client.Endpoint) - - assert.Equal(t, fmt.Sprintf("http://169.254.169.254/latest"), - ec2Provider.Client.Endpoint) + ec2Provider := provider.(*ec2rolecreds.EC2RoleProvider) + if ec2Provider == nil { + t.Fatalf("expect provider not to be nil, but was") + } + if e, a := "http://169.254.169.254/latest", ec2Provider.Client.Endpoint; e != a { + t.Errorf("expect %q endpoint, got %q", e, a) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go new file mode 100644 index 00000000..ca0ee1dc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go @@ -0,0 +1,27 @@ +package defaults + +import ( + "github.com/aws/aws-sdk-go/internal/shareddefaults" +) + +// SharedCredentialsFilename returns the SDK's default file path +// for the shared credentials file. +// +// Builds the shared config file path based on the OS's platform. +// +// - Linux/Unix: $HOME/.aws/credentials +// - Windows: %USERPROFILE%\.aws\credentials +func SharedCredentialsFilename() string { + return shareddefaults.SharedCredentialsFilename() +} + +// SharedConfigFilename returns the SDK's default file path for +// the shared config file. +// +// Builds the shared config file path based on the OS's platform. +// +// - Linux/Unix: $HOME/.aws/config +// - Windows: %USERPROFILE%\.aws\config +func SharedConfigFilename() string { + return shareddefaults.SharedConfigFilename() +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/doc.go new file mode 100644 index 00000000..4fcb6161 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/doc.go @@ -0,0 +1,56 @@ +// Package aws provides the core SDK's utilities and shared types. Use this package's +// utilities to simplify setting and reading API operations parameters. +// +// Value and Pointer Conversion Utilities +// +// This package includes a helper conversion utility for each scalar type the SDK's +// API use. These utilities make getting a pointer of the scalar, and dereferencing +// a pointer easier. +// +// Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. +// The Pointer to value will safely dereference the pointer and return its value. +// If the pointer was nil, the scalar's zero value will be returned. +// +// The value to pointer functions will be named after the scalar type. So get a +// *string from a string value use the "String" function. This makes it easy to +// to get pointer of a literal string value, because getting the address of a +// literal requires assigning the value to a variable first. +// +// var strPtr *string +// +// // Without the SDK's conversion functions +// str := "my string" +// strPtr = &str +// +// // With the SDK's conversion functions +// strPtr = aws.String("my string") +// +// // Convert *string to string value +// str = aws.StringValue(strPtr) +// +// In addition to scalars the aws package also includes conversion utilities for +// map and slice for commonly types used in API parameters. The map and slice +// conversion functions use similar naming pattern as the scalar conversion +// functions. +// +// var strPtrs []*string +// var strs []string = []string{"Go", "Gophers", "Go"} +// +// // Convert []string to []*string +// strPtrs = aws.StringSlice(strs) +// +// // Convert []*string to []string +// strs = aws.StringValueSlice(strPtrs) +// +// SDK Default HTTP Client +// +// The SDK will use the http.DefaultClient if a HTTP client is not provided to +// the SDK's Session, or service client constructor. This means that if the +// http.DefaultClient is modified by other components of your application the +// modifications will be picked up by the SDK as well. +// +// In some cases this might be intended, but it is a better practice to create +// a custom HTTP Client to share explicitly through your application. You can +// configure the SDK to use the custom HTTP Client by setting the HTTPClient +// value of the SDK's Config type when creating a Session or service client. +package aws diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 5f0f6dd3..f468de00 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. package endpoints @@ -47,6 +47,7 @@ const ( ApigatewayServiceID = "apigateway" // Apigateway. ApplicationAutoscalingServiceID = "application-autoscaling" // ApplicationAutoscaling. Appstream2ServiceID = "appstream2" // Appstream2. + AthenaServiceID = "athena" // Athena. AutoscalingServiceID = "autoscaling" // Autoscaling. BatchServiceID = "batch" // Batch. BudgetsServiceID = "budgets" // Budgets. @@ -54,12 +55,14 @@ const ( CloudformationServiceID = "cloudformation" // Cloudformation. CloudfrontServiceID = "cloudfront" // Cloudfront. CloudhsmServiceID = "cloudhsm" // Cloudhsm. + Cloudhsmv2ServiceID = "cloudhsmv2" // Cloudhsmv2. CloudsearchServiceID = "cloudsearch" // Cloudsearch. CloudtrailServiceID = "cloudtrail" // Cloudtrail. CodebuildServiceID = "codebuild" // Codebuild. CodecommitServiceID = "codecommit" // Codecommit. CodedeployServiceID = "codedeploy" // Codedeploy. CodepipelineServiceID = "codepipeline" // Codepipeline. + CodestarServiceID = "codestar" // Codestar. CognitoIdentityServiceID = "cognito-identity" // CognitoIdentity. CognitoIdpServiceID = "cognito-idp" // CognitoIdp. CognitoSyncServiceID = "cognito-sync" // CognitoSync. @@ -83,11 +86,14 @@ const ( ElasticmapreduceServiceID = "elasticmapreduce" // Elasticmapreduce. ElastictranscoderServiceID = "elastictranscoder" // Elastictranscoder. EmailServiceID = "email" // Email. + EntitlementMarketplaceServiceID = "entitlement.marketplace" // EntitlementMarketplace. EsServiceID = "es" // Es. EventsServiceID = "events" // Events. FirehoseServiceID = "firehose" // Firehose. GameliftServiceID = "gamelift" // Gamelift. GlacierServiceID = "glacier" // Glacier. + GlueServiceID = "glue" // Glue. + GreengrassServiceID = "greengrass" // Greengrass. HealthServiceID = "health" // Health. IamServiceID = "iam" // Iam. ImportexportServiceID = "importexport" // Importexport. @@ -102,7 +108,9 @@ const ( MachinelearningServiceID = "machinelearning" // Machinelearning. MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. + MghServiceID = "mgh" // Mgh. MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. + ModelsLexServiceID = "models.lex" // ModelsLex. MonitoringServiceID = "monitoring" // Monitoring. MturkRequesterServiceID = "mturk-requester" // MturkRequester. OpsworksServiceID = "opsworks" // Opsworks. @@ -131,6 +139,7 @@ const ( StsServiceID = "sts" // Sts. SupportServiceID = "support" // Support. SwfServiceID = "swf" // Swf. + TaggingServiceID = "tagging" // Tagging. WafServiceID = "waf" // Waf. WafRegionalServiceID = "waf-regional" // WafRegional. WorkdocsServiceID = "workdocs" // Workdocs. @@ -141,17 +150,20 @@ const ( // DefaultResolver returns an Endpoint resolver that will be able // to resolve endpoints for: AWS Standard, AWS China, and AWS GovCloud (US). // -// Casting the return value of this func to a EnumPartitions will -// allow you to get a list of the partitions in the order the endpoints -// will be resolved in. +// Use DefaultPartitions() to get the list of the default partitions. +func DefaultResolver() Resolver { + return defaultPartitions +} + +// DefaultPartitions returns a list of the partitions the SDK is bundled +// with. The available partitions are: AWS Standard, AWS China, and AWS GovCloud (US). // -// resolver := endpoints.DefaultResolver() -// partitions := resolver.(endpoints.EnumPartitions).Partitions() +// partitions := endpoints.DefaultPartitions // for _, p := range partitions { // // ... inspect partitions // } -func DefaultResolver() Resolver { - return defaultPartitions +func DefaultPartitions() []Partition { + return defaultPartitions.Partitions() } var defaultPartitions = partitions{ @@ -249,11 +261,14 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -299,6 +314,17 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "athena": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "autoscaling": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -323,7 +349,15 @@ var awsPartition = partition{ "batch": service{ Endpoints: endpoints{ - "us-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "budgets": service{ @@ -345,6 +379,7 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -398,6 +433,15 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "cloudhsmv2": service{ + + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "cloudsearch": service{ Endpoints: endpoints{ @@ -435,19 +479,36 @@ var awsPartition = partition{ "codebuild": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "codecommit": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "codedeploy": service{ @@ -473,13 +534,32 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "codestar": service{ + + Endpoints: endpoints{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "sa-east-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -488,6 +568,8 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, @@ -502,6 +584,8 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, @@ -516,6 +600,8 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, @@ -614,11 +700,16 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -755,15 +846,17 @@ var awsPartition = partition{ "elasticfilesystem": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "elasticloadbalancing": service{ Defaults: endpoint{ - Protocols: []string{"http", "https"}, + Protocols: []string{"https"}, }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, @@ -829,6 +922,16 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "entitlement.marketplace": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "aws-marketplace", + }, + }, + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, "es": service{ Endpoints: endpoints{ @@ -837,8 +940,10 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -868,9 +973,12 @@ var awsPartition = partition{ "firehose": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "gamelift": service{ @@ -880,10 +988,15 @@ var awsPartition = partition{ "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -895,6 +1008,7 @@ var awsPartition = partition{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, @@ -906,6 +1020,27 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "glue": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "greengrass": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "health": service{ Endpoints: endpoints{ @@ -949,6 +1084,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1022,11 +1158,14 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1036,7 +1175,16 @@ var awsPartition = partition{ "lightsail": service{ Endpoints: endpoints{ - "us-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "logs": service{ @@ -1094,12 +1242,28 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "mgh": service{ + + Endpoints: endpoints{ + "us-west-2": endpoint{}, + }, + }, "mobileanalytics": service{ Endpoints: endpoints{ "us-east-1": endpoint{}, }, }, + "models.lex": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "lex", + }, + }, + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, "monitoring": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -1346,6 +1510,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, @@ -1370,20 +1535,27 @@ var awsPartition = partition{ "sms": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "snowball": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1440,10 +1612,13 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1455,8 +1630,10 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -1467,6 +1644,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, @@ -1482,7 +1660,7 @@ var awsPartition = partition{ }, "streams.dynamodb": service{ Defaults: endpoint{ - Protocols: []string{"http", "http", "https", "https"}, + Protocols: []string{"http", "https"}, CredentialScope: credentialScope{ Service: "dynamodb", }, @@ -1537,9 +1715,33 @@ var awsPartition = partition{ "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "sts-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "sts-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "sts-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "sts-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "support": service{ @@ -1567,6 +1769,25 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "tagging": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "waf": service{ PartitionEndpoint: "aws-global", IsRegionalized: boxedFalse, @@ -1586,6 +1807,7 @@ var awsPartition = partition{ "ap-northeast-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1608,6 +1830,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-west-2": endpoint{}, }, @@ -1620,8 +1843,10 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1658,6 +1883,18 @@ var awscnPartition = partition{ }, }, Services: services{ + "application-autoscaling": service{ + Defaults: endpoint{ + Hostname: "autoscaling.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "application-autoscaling", + }, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "autoscaling": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -1678,6 +1915,12 @@ var awscnPartition = partition{ "cn-north-1": endpoint{}, }, }, + "codedeploy": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "config": service{ Endpoints: endpoints{ @@ -1717,6 +1960,18 @@ var awscnPartition = partition{ }, }, }, + "ecr": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "ecs": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "elasticache": service{ Endpoints: endpoints{ @@ -1731,7 +1986,7 @@ var awscnPartition = partition{ }, "elasticloadbalancing": service{ Defaults: endpoint{ - Protocols: []string{"http", "https"}, + Protocols: []string{"https"}, }, Endpoints: endpoints{ "cn-north-1": endpoint{}, @@ -1772,6 +2027,16 @@ var awscnPartition = partition{ }, }, }, + "iot": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "execute-api", + }, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "kinesis": service{ Endpoints: endpoints{ @@ -1813,6 +2078,12 @@ var awscnPartition = partition{ "cn-north-1": endpoint{}, }, }, + "snowball": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "sns": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -1830,6 +2101,12 @@ var awscnPartition = partition{ "cn-north-1": endpoint{}, }, }, + "ssm": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "storagegateway": service{ Endpoints: endpoints{ @@ -1838,7 +2115,7 @@ var awscnPartition = partition{ }, "streams.dynamodb": service{ Defaults: endpoint{ - Protocols: []string{"http", "http", "https", "https"}, + Protocols: []string{"http", "https"}, CredentialScope: credentialScope{ Service: "dynamodb", }, @@ -1855,6 +2132,12 @@ var awscnPartition = partition{ }, "swf": service{ + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "tagging": service{ + Endpoints: endpoints{ "cn-north-1": endpoint{}, }, @@ -1888,6 +2171,18 @@ var awsusgovPartition = partition{ }, }, Services: services{ + "acm": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "apigateway": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "autoscaling": service{ Endpoints: endpoints{ @@ -1914,6 +2209,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "codedeploy": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "config": service{ Endpoints: endpoints{ @@ -1971,6 +2272,12 @@ var awsusgovPartition = partition{ }, }, }, + "events": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "glacier": service{ Endpoints: endpoints{ @@ -2004,6 +2311,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "lambda": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "logs": service{ Endpoints: endpoints{ @@ -2028,6 +2341,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "rekognition": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "s3": service{ Defaults: endpoint{ SignatureVersions: []string{"s3", "s3v4"}, @@ -2045,6 +2364,12 @@ var awsusgovPartition = partition{ }, }, }, + "sms": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "snowball": service{ Endpoints: endpoints{ @@ -2068,6 +2393,12 @@ var awsusgovPartition = partition{ }, }, }, + "ssm": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "streams.dynamodb": service{ Defaults: endpoint{ CredentialScope: credentialScope{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go index a0e9bc45..84316b92 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go @@ -21,12 +21,12 @@ // partitions := resolver.(endpoints.EnumPartitions).Partitions() // // for _, p := range partitions { -// fmt.Println("Regions for", p.Name) +// fmt.Println("Regions for", p.ID()) // for id, _ := range p.Regions() { // fmt.Println("*", id) // } // -// fmt.Println("Services for", p.Name) +// fmt.Println("Services for", p.ID()) // for id, _ := range p.Services() { // fmt.Println("*", id) // } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go index 37e19ab0..9c3eedb4 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go @@ -124,6 +124,49 @@ type EnumPartitions interface { Partitions() []Partition } +// RegionsForService returns a map of regions for the partition and service. +// If either the partition or service does not exist false will be returned +// as the second parameter. +// +// This example shows how to get the regions for DynamoDB in the AWS partition. +// rs, exists := endpoints.RegionsForService(endpoints.DefaultPartitions(), endpoints.AwsPartitionID, endpoints.DynamodbServiceID) +// +// This is equivalent to using the partition directly. +// rs := endpoints.AwsPartition().Services()[endpoints.DynamodbServiceID].Regions() +func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool) { + for _, p := range ps { + if p.ID() != partitionID { + continue + } + if _, ok := p.p.Services[serviceID]; !ok { + break + } + + s := Service{ + id: serviceID, + p: p.p, + } + return s.Regions(), true + } + + return map[string]Region{}, false +} + +// PartitionForRegion returns the first partition which includes the region +// passed in. This includes both known regions and regions which match +// a pattern supported by the partition which may include regions that are +// not explicitly known by the partition. Use the Regions method of the +// returned Partition if explicit support is needed. +func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { + for _, p := range ps { + if _, ok := p.p.Regions[regionID]; ok || p.p.RegionRegex.MatchString(regionID) { + return p, true + } + } + + return Partition{}, false +} + // A Partition provides the ability to enumerate the partition's regions // and services. type Partition struct { @@ -132,7 +175,7 @@ type Partition struct { } // ID returns the identifier of the partition. -func (p *Partition) ID() string { return p.id } +func (p Partition) ID() string { return p.id } // EndpointFor attempts to resolve the endpoint based on service and region. // See Options for information on configuring how the endpoint is resolved. @@ -155,13 +198,13 @@ func (p *Partition) ID() string { return p.id } // Errors that can be returned. // * UnknownServiceError // * UnknownEndpointError -func (p *Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { +func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { return p.p.EndpointFor(service, region, opts...) } // Regions returns a map of Regions indexed by their ID. This is useful for // enumerating over the regions in a partition. -func (p *Partition) Regions() map[string]Region { +func (p Partition) Regions() map[string]Region { rs := map[string]Region{} for id := range p.p.Regions { rs[id] = Region{ @@ -175,7 +218,7 @@ func (p *Partition) Regions() map[string]Region { // Services returns a map of Service indexed by their ID. This is useful for // enumerating over the services in a partition. -func (p *Partition) Services() map[string]Service { +func (p Partition) Services() map[string]Service { ss := map[string]Service{} for id := range p.p.Services { ss[id] = Service{ @@ -195,16 +238,16 @@ type Region struct { } // ID returns the region's identifier. -func (r *Region) ID() string { return r.id } +func (r Region) ID() string { return r.id } // ResolveEndpoint resolves an endpoint from the context of the region given // a service. See Partition.EndpointFor for usage and errors that can be returned. -func (r *Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error) { +func (r Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error) { return r.p.EndpointFor(service, r.id, opts...) } // Services returns a list of all services that are known to be in this region. -func (r *Region) Services() map[string]Service { +func (r Region) Services() map[string]Service { ss := map[string]Service{} for id, s := range r.p.Services { if _, ok := s.Endpoints[r.id]; ok { @@ -226,17 +269,38 @@ type Service struct { } // ID returns the identifier for the service. -func (s *Service) ID() string { return s.id } +func (s Service) ID() string { return s.id } // ResolveEndpoint resolves an endpoint from the context of a service given // a region. See Partition.EndpointFor for usage and errors that can be returned. -func (s *Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error) { +func (s Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error) { return s.p.EndpointFor(s.id, region, opts...) } +// Regions returns a map of Regions that the service is present in. +// +// A region is the AWS region the service exists in. Whereas a Endpoint is +// an URL that can be resolved to a instance of a service. +func (s Service) Regions() map[string]Region { + rs := map[string]Region{} + for id := range s.p.Services[s.id].Endpoints { + if _, ok := s.p.Regions[id]; ok { + rs[id] = Region{ + id: id, + p: s.p, + } + } + } + + return rs +} + // Endpoints returns a map of Endpoints indexed by their ID for all known // endpoints for a service. -func (s *Service) Endpoints() map[string]Endpoint { +// +// A region is the AWS region the service exists in. Whereas a Endpoint is +// an URL that can be resolved to a instance of a service. +func (s Service) Endpoints() map[string]Endpoint { es := map[string]Endpoint{} for id := range s.p.Services[s.id].Endpoints { es[id] = Endpoint{ @@ -259,15 +323,15 @@ type Endpoint struct { } // ID returns the identifier for an endpoint. -func (e *Endpoint) ID() string { return e.id } +func (e Endpoint) ID() string { return e.id } // ServiceID returns the identifier the endpoint belongs to. -func (e *Endpoint) ServiceID() string { return e.serviceID } +func (e Endpoint) ServiceID() string { return e.serviceID } // ResolveEndpoint resolves an endpoint from the context of a service and // region the endpoint represents. See Partition.EndpointFor for usage and // errors that can be returned. -func (e *Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error) { +func (e Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error) { return e.p.EndpointFor(e.serviceID, e.id, opts...) } @@ -300,28 +364,6 @@ type EndpointNotFoundError struct { Region string } -//// NewEndpointNotFoundError builds and returns NewEndpointNotFoundError. -//func NewEndpointNotFoundError(p, s, r string) EndpointNotFoundError { -// return EndpointNotFoundError{ -// awsError: awserr.New("EndpointNotFoundError", "unable to find endpoint", nil), -// Partition: p, -// Service: s, -// Region: r, -// } -//} -// -//// Error returns string representation of the error. -//func (e EndpointNotFoundError) Error() string { -// extra := fmt.Sprintf("partition: %q, service: %q, region: %q", -// e.Partition, e.Service, e.Region) -// return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -//} -// -//// String returns the string representation of the error. -//func (e EndpointNotFoundError) String() string { -// return e.Error() -//} - // A UnknownServiceError is returned when the service does not resolve to an // endpoint. Includes a list of all known services for the partition. Returned // when a partition does not support the service. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go index 8877d7bd..9c0e09db 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go @@ -84,6 +84,22 @@ func TestEnumRegionServices(t *testing.T) { } } +func TestEnumServiceRegions(t *testing.T) { + p := testPartitions[0].Partition() + + rs := p.Services()["service1"].Regions() + if e, a := 2, len(rs); e != a { + t.Errorf("expect %d regions, got %d", e, a) + } + + if _, ok := rs["us-east-1"]; !ok { + t.Errorf("expect region to be found") + } + if _, ok := rs["us-west-2"]; !ok { + t.Errorf("expect region to be found") + } +} + func TestEnumServicesEndpoints(t *testing.T) { p := testPartitions[0].Partition() @@ -242,3 +258,78 @@ func TestOptionsSet(t *testing.T) { t.Errorf("expect %v options got %v", expect, actual) } } + +func TestRegionsForService(t *testing.T) { + ps := DefaultPartitions() + + var expect map[string]Region + var serviceID string + for _, s := range ps[0].Services() { + expect = s.Regions() + serviceID = s.ID() + if len(expect) > 0 { + break + } + } + + actual, ok := RegionsForService(ps, ps[0].ID(), serviceID) + if !ok { + t.Fatalf("expect regions to be found, was not") + } + + if len(actual) == 0 { + t.Fatalf("expect service %s to have regions", serviceID) + } + if e, a := len(expect), len(actual); e != a { + t.Fatalf("expect %d regions, got %d", e, a) + } + + for id, r := range actual { + if e, a := id, r.ID(); e != a { + t.Errorf("expect %s region id, got %s", e, a) + } + if _, ok := expect[id]; !ok { + t.Errorf("expect %s region to be found", id) + } + } +} + +func TestRegionsForService_NotFound(t *testing.T) { + ps := testPartitions.Partitions() + + actual, ok := RegionsForService(ps, ps[0].ID(), "service-not-exists") + if ok { + t.Fatalf("expect no regions to be found, but were") + } + if len(actual) != 0 { + t.Errorf("expect no regions, got %v", actual) + } +} + +func TestPartitionForRegion(t *testing.T) { + ps := DefaultPartitions() + expect := ps[len(ps)%2] + + var regionID string + for id := range expect.Regions() { + regionID = id + break + } + + actual, ok := PartitionForRegion(ps, regionID) + if !ok { + t.Fatalf("expect partition to be found") + } + if e, a := expect.ID(), actual.ID(); e != a { + t.Errorf("expect %s partition, got %s", e, a) + } +} + +func TestPartitionForRegion_NotFound(t *testing.T) { + ps := DefaultPartitions() + + actual, ok := PartitionForRegion(ps, "regionNotExists") + if ok { + t.Errorf("expect no partition to be found, got %v", actual) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go index 1e7369db..05e92df2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go @@ -158,7 +158,7 @@ var funcMap = template.FuncMap{ const v3Tmpl = ` {{ define "defaults" -}} -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. package endpoints @@ -209,17 +209,20 @@ import ( // DefaultResolver returns an Endpoint resolver that will be able // to resolve endpoints for: {{ ListPartitionNames . }}. // - // Casting the return value of this func to a EnumPartitions will - // allow you to get a list of the partitions in the order the endpoints - // will be resolved in. + // Use DefaultPartitions() to get the list of the default partitions. + func DefaultResolver() Resolver { + return defaultPartitions + } + + // DefaultPartitions returns a list of the partitions the SDK is bundled + // with. The available partitions are: {{ ListPartitionNames . }}. // - // resolver := endpoints.DefaultResolver() - // partitions := resolver.(endpoints.EnumPartitions).Partitions() + // partitions := endpoints.DefaultPartitions // for _, p := range partitions { // // ... inspect partitions // } - func DefaultResolver() Resolver { - return defaultPartitions + func DefaultPartitions() []Partition { + return defaultPartitions.Partitions() } var defaultPartitions = partitions{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go index a94f0410..91a6f277 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go @@ -4,7 +4,8 @@ package aws // into a json string. This type can be used just like any other map. // // Example: -// values := JSONValue{ +// +// values := aws.JSONValue{ // "Foo": "Bar", // } // values["Baz"] = "Qux" diff --git a/vendor/github.com/aws/aws-sdk-go/aws/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/logger.go index db87188e..3babb5ab 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/logger.go @@ -26,14 +26,14 @@ func (l *LogLevelType) Value() LogLevelType { // Matches returns true if the v LogLevel is enabled by this LogLevel. Should be // used with logging sub levels. Is safe to use on nil value LogLevelTypes. If -// LogLevel is nill, will default to LogOff comparison. +// LogLevel is nil, will default to LogOff comparison. func (l *LogLevelType) Matches(v LogLevelType) bool { c := l.Value() return c&v == v } // AtLeast returns true if this LogLevel is at least high enough to satisfies v. -// Is safe to use on nil value LogLevelTypes. If LogLevel is nill, will default +// Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default // to LogOff comparison. func (l *LogLevelType) AtLeast(v LogLevelType) bool { c := l.Value() diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go new file mode 100644 index 00000000..271da432 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go @@ -0,0 +1,19 @@ +// +build !appengine,!plan9 + +package request + +import ( + "net" + "os" + "syscall" +) + +func isErrConnectionReset(err error) bool { + if opErr, ok := err.(*net.OpError); ok { + if sysErr, ok := opErr.Err.(*os.SyscallError); ok { + return sysErr.Err == syscall.ECONNRESET + } + } + + return false +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go new file mode 100644 index 00000000..daf9eca4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go @@ -0,0 +1,11 @@ +// +build appengine plan9 + +package request + +import ( + "strings" +) + +func isErrConnectionReset(err error) bool { + return strings.Contains(err.Error(), "connection reset") +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go new file mode 100644 index 00000000..aba8eb4e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go @@ -0,0 +1,9 @@ +// +build appengine plan9 + +package request_test + +import ( + "errors" +) + +var stubConnectionResetError = errors.New("connection reset") diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go new file mode 100644 index 00000000..bb5f6bdd --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go @@ -0,0 +1,11 @@ +// +build !appengine,!plan9 + +package request_test + +import ( + "net" + "os" + "syscall" +) + +var stubConnectionResetError = &net.OpError{Err: &os.SyscallError{Syscall: "read", Err: syscall.ECONNRESET}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 24a3672d..802ac88a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -88,13 +88,17 @@ func (l *HandlerList) copy() HandlerList { n := HandlerList{ AfterEachFn: l.AfterEachFn, } + if len(l.list) == 0 { + return n + } + n.list = append(make([]NamedHandler, 0, len(l.list)), l.list...) return n } // Clear clears the handler list. func (l *HandlerList) Clear() { - l.list = []NamedHandler{} + l.list = l.list[0:0] } // Len returns the number of handlers in the list. @@ -104,33 +108,85 @@ func (l *HandlerList) Len() int { // PushBack pushes handler f to the back of the handler list. func (l *HandlerList) PushBack(f func(*Request)) { - l.list = append(l.list, NamedHandler{"__anonymous", f}) -} - -// PushFront pushes handler f to the front of the handler list. -func (l *HandlerList) PushFront(f func(*Request)) { - l.list = append([]NamedHandler{{"__anonymous", f}}, l.list...) + l.PushBackNamed(NamedHandler{"__anonymous", f}) } // PushBackNamed pushes named handler f to the back of the handler list. func (l *HandlerList) PushBackNamed(n NamedHandler) { + if cap(l.list) == 0 { + l.list = make([]NamedHandler, 0, 5) + } l.list = append(l.list, n) } +// PushFront pushes handler f to the front of the handler list. +func (l *HandlerList) PushFront(f func(*Request)) { + l.PushFrontNamed(NamedHandler{"__anonymous", f}) +} + // PushFrontNamed pushes named handler f to the front of the handler list. func (l *HandlerList) PushFrontNamed(n NamedHandler) { - l.list = append([]NamedHandler{n}, l.list...) + if cap(l.list) == len(l.list) { + // Allocating new list required + l.list = append([]NamedHandler{n}, l.list...) + } else { + // Enough room to prepend into list. + l.list = append(l.list, NamedHandler{}) + copy(l.list[1:], l.list) + l.list[0] = n + } } // Remove removes a NamedHandler n func (l *HandlerList) Remove(n NamedHandler) { - newlist := []NamedHandler{} - for _, m := range l.list { - if m.Name != n.Name { - newlist = append(newlist, m) + l.RemoveByName(n.Name) +} + +// RemoveByName removes a NamedHandler by name. +func (l *HandlerList) RemoveByName(name string) { + for i := 0; i < len(l.list); i++ { + m := l.list[i] + if m.Name == name { + // Shift array preventing creating new arrays + copy(l.list[i:], l.list[i+1:]) + l.list[len(l.list)-1] = NamedHandler{} + l.list = l.list[:len(l.list)-1] + + // decrement list so next check to length is correct + i-- } } - l.list = newlist +} + +// SwapNamed will swap out any existing handlers with the same name as the +// passed in NamedHandler returning true if handlers were swapped. False is +// returned otherwise. +func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) { + for i := 0; i < len(l.list); i++ { + if l.list[i].Name == n.Name { + l.list[i].Fn = n.Fn + swapped = true + } + } + + return swapped +} + +// SetBackNamed will replace the named handler if it exists in the handler list. +// If the handler does not exist the handler will be added to the end of the list. +func (l *HandlerList) SetBackNamed(n NamedHandler) { + if !l.SwapNamed(n) { + l.PushBackNamed(n) + } +} + +// SetFrontNamed will replace the named handler if it exists in the handler list. +// If the handler does not exist the handler will be added to the beginning of +// the list. +func (l *HandlerList) SetFrontNamed(n NamedHandler) { + if !l.SwapNamed(n) { + l.PushFrontNamed(n) + } } // Run executes all handlers in the list with a given request object. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go index b32a6510..b2da558d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go @@ -1,12 +1,13 @@ package request_test import ( + "reflect" "testing" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/service/s3" ) func TestHandlerList(t *testing.T) { @@ -18,8 +19,12 @@ func TestHandlerList(t *testing.T) { r.Data = s }) l.Run(r) - assert.Equal(t, "a", s) - assert.Equal(t, "a", r.Data) + if e, a := "a", s; e != a { + t.Errorf("expect %q update got %q", e, a) + } + if e, a := "a", r.Data.(string); e != a { + t.Errorf("expect %q data update got %q", e, a) + } } func TestMultipleHandlers(t *testing.T) { @@ -41,9 +46,110 @@ func TestNamedHandlers(t *testing.T) { l.PushBackNamed(named) l.PushBackNamed(named2) l.PushBack(func(r *request.Request) {}) - assert.Equal(t, 4, l.Len()) + if e, a := 4, l.Len(); e != a { + t.Errorf("expect %d list length, got %d", e, a) + } l.Remove(named) - assert.Equal(t, 2, l.Len()) + if e, a := 2, l.Len(); e != a { + t.Errorf("expect %d list length, got %d", e, a) + } +} + +func TestSwapHandlers(t *testing.T) { + firstHandlerCalled := 0 + swappedOutHandlerCalled := 0 + swappedInHandlerCalled := 0 + + l := request.HandlerList{} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { + firstHandlerCalled++ + }} + named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedOutHandlerCalled++ + }} + l.PushBackNamed(named) + l.PushBackNamed(named2) + l.PushBackNamed(named) + + l.SwapNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedInHandlerCalled++ + }}) + + l.Run(&request.Request{}) + + if e, a := 2, firstHandlerCalled; e != a { + t.Errorf("expect first handler to be called %d, was called %d times", e, a) + } + if n := swappedOutHandlerCalled; n != 0 { + t.Errorf("expect swapped out handler to not be called, was called %d times", n) + } + if e, a := 1, swappedInHandlerCalled; e != a { + t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) + } +} + +func TestSetBackNamed_Exists(t *testing.T) { + firstHandlerCalled := 0 + swappedOutHandlerCalled := 0 + swappedInHandlerCalled := 0 + + l := request.HandlerList{} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { + firstHandlerCalled++ + }} + named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedOutHandlerCalled++ + }} + l.PushBackNamed(named) + l.PushBackNamed(named2) + + l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedInHandlerCalled++ + }}) + + l.Run(&request.Request{}) + + if e, a := 1, firstHandlerCalled; e != a { + t.Errorf("expect first handler to be called %d, was called %d times", e, a) + } + if n := swappedOutHandlerCalled; n != 0 { + t.Errorf("expect swapped out handler to not be called, was called %d times", n) + } + if e, a := 1, swappedInHandlerCalled; e != a { + t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) + } +} + +func TestSetBackNamed_NotExists(t *testing.T) { + firstHandlerCalled := 0 + secondHandlerCalled := 0 + swappedInHandlerCalled := 0 + + l := request.HandlerList{} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { + firstHandlerCalled++ + }} + named2 := request.NamedHandler{Name: "OtherName", Fn: func(r *request.Request) { + secondHandlerCalled++ + }} + l.PushBackNamed(named) + l.PushBackNamed(named2) + + l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedInHandlerCalled++ + }}) + + l.Run(&request.Request{}) + + if e, a := 1, firstHandlerCalled; e != a { + t.Errorf("expect first handler to be called %d, was called %d times", e, a) + } + if e, a := 1, secondHandlerCalled; e != a { + t.Errorf("expect second handler to be called %d, was called %d times", e, a) + } + if e, a := 1, swappedInHandlerCalled; e != a { + t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) + } } func TestLoggedHandlers(t *testing.T) { @@ -61,7 +167,10 @@ func TestLoggedHandlers(t *testing.T) { l.PushBackNamed(named2) l.Run(&request.Request{Config: cfg}) - assert.Equal(t, expectedHandlers, loggedHandlers) + if !reflect.DeepEqual(expectedHandlers, loggedHandlers) { + t.Errorf("expect handlers executed %v to match logged handlers, %v", + expectedHandlers, loggedHandlers) + } } func TestStopHandlers(t *testing.T) { @@ -79,9 +188,79 @@ func TestStopHandlers(t *testing.T) { called++ }}) l.PushBackNamed(request.NamedHandler{Name: "name3", Fn: func(r *request.Request) { - assert.Fail(t, "third handler should not be called") + t.Fatalf("third handler should not be called") }}) l.Run(&request.Request{}) - assert.Equal(t, 2, called, "Expect only two handlers to be called") + if e, a := 2, called; e != a { + t.Errorf("expect %d handlers called, got %d", e, a) + } +} + +func BenchmarkNewRequest(b *testing.B) { + svc := s3.New(unit.Session) + + for i := 0; i < b.N; i++ { + r, _ := svc.GetObjectRequest(nil) + if r == nil { + b.Fatal("r should not be nil") + } + } +} + +func BenchmarkHandlersCopy(b *testing.B) { + handlers := request.Handlers{} + + handlers.Validate.PushBack(func(r *request.Request) {}) + handlers.Validate.PushBack(func(r *request.Request) {}) + handlers.Build.PushBack(func(r *request.Request) {}) + handlers.Build.PushBack(func(r *request.Request) {}) + handlers.Send.PushBack(func(r *request.Request) {}) + handlers.Send.PushBack(func(r *request.Request) {}) + handlers.Unmarshal.PushBack(func(r *request.Request) {}) + handlers.Unmarshal.PushBack(func(r *request.Request) {}) + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + if e, a := handlers.Validate.Len(), h.Validate.Len(); e != a { + b.Fatalf("expected %d handlers got %d", e, a) + } + } +} + +func BenchmarkHandlersPushBack(b *testing.B) { + handlers := request.Handlers{} + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + h.Validate.PushBack(func(r *request.Request) {}) + h.Validate.PushBack(func(r *request.Request) {}) + h.Validate.PushBack(func(r *request.Request) {}) + h.Validate.PushBack(func(r *request.Request) {}) + } +} + +func BenchmarkHandlersPushFront(b *testing.B) { + handlers := request.Handlers{} + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + } +} + +func BenchmarkHandlersClear(b *testing.B) { + handlers := request.Handlers{} + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Clear() + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 937f07d5..911c058e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -16,10 +16,23 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" ) -// CanceledErrorCode is the error code that will be returned by an -// API request that was canceled. Requests given a aws.Context may -// return this error when canceled. -const CanceledErrorCode = "RequestCanceled" +const ( + // ErrCodeSerialization is the serialization error code that is received + // during protocol unmarshaling. + ErrCodeSerialization = "SerializationError" + + // ErrCodeRead is an error that is returned during HTTP reads. + ErrCodeRead = "ReadError" + + // ErrCodeResponseTimeout is the connection timeout error that is received + // during body reads. + ErrCodeResponseTimeout = "ResponseTimeout" + + // CanceledErrorCode is the error code that will be returned by an + // API request that was canceled. Requests given a aws.Context may + // return this error when canceled. + CanceledErrorCode = "RequestCanceled" +) // A Request is the service request to be made. type Request struct { @@ -28,23 +41,24 @@ type Request struct { Handlers Handlers Retryer - Time time.Time - ExpireTime time.Duration - Operation *Operation - HTTPRequest *http.Request - HTTPResponse *http.Response - Body io.ReadSeeker - BodyStart int64 // offset from beginning of Body that the request body starts - Params interface{} - Error error - Data interface{} - RequestID string - RetryCount int - Retryable *bool - RetryDelay time.Duration - NotHoist bool - SignedHeaderVals http.Header - LastSignedAt time.Time + Time time.Time + ExpireTime time.Duration + Operation *Operation + HTTPRequest *http.Request + HTTPResponse *http.Response + Body io.ReadSeeker + BodyStart int64 // offset from beginning of Body that the request body starts + Params interface{} + Error error + Data interface{} + RequestID string + RetryCount int + Retryable *bool + RetryDelay time.Duration + NotHoist bool + SignedHeaderVals http.Header + LastSignedAt time.Time + DisableFollowRedirects bool context aws.Context @@ -114,6 +128,40 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, // using a WithContext API operation method. type Option func(*Request) +// WithGetResponseHeader builds a request Option which will retrieve a single +// header value from the HTTP Response. If there are multiple values for the +// header key use WithGetResponseHeaders instead to access the http.Header +// map directly. The passed in val pointer must be non-nil. +// +// This Option can be used multiple times with a single API operation. +// +// var id2, versionID string +// svc.PutObjectWithContext(ctx, params, +// request.WithGetResponseHeader("x-amz-id-2", &id2), +// request.WithGetResponseHeader("x-amz-version-id", &versionID), +// ) +func WithGetResponseHeader(key string, val *string) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *val = req.HTTPResponse.Header.Get(key) + }) + } +} + +// WithGetResponseHeaders builds a request Option which will retrieve the +// headers from the HTTP response and assign them to the passed in headers +// variable. The passed in headers pointer must be non-nil. +// +// var headers http.Header +// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) +func WithGetResponseHeaders(headers *http.Header) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *headers = req.HTTPResponse.Header + }) + } +} + // WithLogLevel is a request option that will set the request to use a specific // log level when the request is made. // @@ -221,11 +269,17 @@ func (r *Request) Presign(expireTime time.Duration) (string, error) { return r.HTTPRequest.URL.String(), nil } -// PresignRequest behaves just like presign, but hoists all headers and signs them. -// Also returns the signed hash back to the user +// PresignRequest behaves just like presign, with the addition of returning a +// set of headers that were signed. +// +// Returns the URL string for the API operation with signature in the query string, +// and the HTTP headers that were included in the signature. These headers must +// be included in any HTTP request made with the presigned URL. +// +// To prevent hoisting any headers to the query string set NotHoist to true on +// this Request value prior to calling PresignRequest. func (r *Request) PresignRequest(expireTime time.Duration) (string, http.Header, error) { r.ExpireTime = expireTime - r.NotHoist = true r.Sign() if r.Error != nil { return "", nil, r.Error @@ -290,10 +344,7 @@ func (r *Request) Sign() error { return r.Error } -// ResetBody rewinds the request body backto its starting position, and -// set's the HTTP Request body reference. When the body is read prior -// to being sent in the HTTP request it will need to be rewound. -func (r *Request) ResetBody() { +func (r *Request) getNextRequestBody() (io.ReadCloser, error) { if r.safeBody != nil { r.safeBody.Close() } @@ -315,14 +366,14 @@ func (r *Request) ResetBody() { // Related golang/go#18257 l, err := computeBodyLength(r.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed to compute request body size", err) - return + return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) } + var body io.ReadCloser if l == 0 { - r.HTTPRequest.Body = noBodyReader + body = NoBody } else if l > 0 { - r.HTTPRequest.Body = r.safeBody + body = r.safeBody } else { // Hack to prevent sending bodies for methods where the body // should be ignored by the server. Sending bodies on these @@ -334,11 +385,13 @@ func (r *Request) ResetBody() { // a io.Reader that was not also an io.Seeker. switch r.Operation.HTTPMethod { case "GET", "HEAD", "DELETE": - r.HTTPRequest.Body = noBodyReader + body = NoBody default: - r.HTTPRequest.Body = r.safeBody + body = r.safeBody } } + + return body, nil } // Attempts to compute the length of the body of the reader using the @@ -440,7 +493,7 @@ func (r *Request) Send() error { r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { - debugLogReqError(r, "Send Request", false, r.Error) + debugLogReqError(r, "Send Request", false, err) return r.Error } debugLogReqError(r, "Send Request", true, err) @@ -449,12 +502,13 @@ func (r *Request) Send() error { r.Handlers.UnmarshalMeta.Run(r) r.Handlers.ValidateResponse.Run(r) if r.Error != nil { - err := r.Error r.Handlers.UnmarshalError.Run(r) + err := r.Error + r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { - debugLogReqError(r, "Validate Response", false, r.Error) + debugLogReqError(r, "Validate Response", false, err) return r.Error } debugLogReqError(r, "Validate Response", true, err) @@ -467,7 +521,7 @@ func (r *Request) Send() error { r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { - debugLogReqError(r, "Unmarshal Response", false, r.Error) + debugLogReqError(r, "Unmarshal Response", false, err) return r.Error } debugLogReqError(r, "Unmarshal Response", true, err) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go index 1323af90..869b97a1 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go @@ -16,6 +16,24 @@ func (noBody) Read([]byte) (int, error) { return 0, io.EOF } func (noBody) Close() error { return nil } func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } -// Is an empty reader that will trigger the Go HTTP client to not include +// NoBody is an empty reader that will trigger the Go HTTP client to not include // and body in the HTTP request. -var noBodyReader = noBody{} +var NoBody = noBody{} + +// ResetBody rewinds the request body back to its starting position, and +// set's the HTTP Request body reference. When the body is read prior +// to being sent in the HTTP request it will need to be rewound. +// +// ResetBody will automatically be called by the SDK's build handler, but if +// the request is being used directly ResetBody must be called before the request +// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically +// call ResetBody. +func (r *Request) ResetBody() { + body, err := r.getNextRequestBody() + if err != nil { + r.Error = err + return + } + + r.HTTPRequest.Body = body +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go index 8b963f4d..c32fc69b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go @@ -2,8 +2,32 @@ package request -import "net/http" +import ( + "net/http" +) -// Is a http.NoBody reader instructing Go HTTP client to not include +// NoBody is a http.NoBody reader instructing Go HTTP client to not include // and body in the HTTP request. -var noBodyReader = http.NoBody +var NoBody = http.NoBody + +// ResetBody rewinds the request body back to its starting position, and +// set's the HTTP Request body reference. When the body is read prior +// to being sent in the HTTP request it will need to be rewound. +// +// ResetBody will automatically be called by the SDK's build handler, but if +// the request is being used directly ResetBody must be called before the request +// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically +// call ResetBody. +// +// Will also set the Go 1.8's http.Request.GetBody member to allow retrying +// PUT/POST redirects. +func (r *Request) ResetBody() { + body, err := r.getNextRequestBody() + if err != nil { + r.Error = err + return + } + + r.HTTPRequest.Body = body + r.HTTPRequest.GetBody = r.getNextRequestBody +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go index 6a3aba68..8f3b0f04 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go @@ -1,15 +1,23 @@ // +build go1.8 -package request +package request_test import ( + "bytes" + "io" "net/http" + "net/http/httptest" "strings" "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" ) func TestResetBody_WithEmptyBody(t *testing.T) { - r := Request{ + r := request.Request{ HTTPRequest: &http.Request{}, } @@ -23,3 +31,55 @@ func TestResetBody_WithEmptyBody(t *testing.T) { r.HTTPRequest.Body) } } + +func TestRequest_FollowPUTRedirects(t *testing.T) { + const bodySize = 1024 + + redirectHit := 0 + endpointHit := 0 + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/redirect-me": + u := *r.URL + u.Path = "/endpoint" + w.Header().Set("Location", u.String()) + w.WriteHeader(307) + redirectHit++ + case "/endpoint": + b := bytes.Buffer{} + io.Copy(&b, r.Body) + r.Body.Close() + if e, a := bodySize, b.Len(); e != a { + t.Fatalf("expect %d body size, got %d", e, a) + } + endpointHit++ + default: + t.Fatalf("unexpected endpoint used, %q", r.URL.String()) + } + })) + + svc := awstesting.NewClient(&aws.Config{ + Region: unit.Session.Config.Region, + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL), + }) + + req := svc.NewRequest(&request.Operation{ + Name: "Operation", + HTTPMethod: "PUT", + HTTPPath: "/redirect-me", + }, &struct{}{}, &struct{}{}) + req.SetReaderBody(bytes.NewReader(make([]byte, bodySize))) + + err := req.Send() + if err != nil { + t.Errorf("expect no error, got %v", err) + } + if e, a := 1, redirectHit; e != a { + t.Errorf("expect %d redirect hits, got %d", e, a) + } + if e, a := 1, endpointHit; e != a { + t.Errorf("expect %d endpoint hits, got %d", e, a) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go index 660f4d49..966f9345 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go @@ -2,8 +2,6 @@ package request import ( "testing" - - "github.com/stretchr/testify/assert" ) func TestCopy(t *testing.T) { @@ -15,6 +13,15 @@ func TestCopy(t *testing.T) { req.Handlers = handlers r := req.copy() - assert.NotEqual(t, req, r) - assert.Equal(t, req.Operation.HTTPMethod, r.Operation.HTTPMethod) + + if r == req { + t.Fatal("expect request pointer copy to be different") + } + if r.Operation == req.Operation { + t.Errorf("expect request operation pointer to be different") + } + + if e, a := req.Operation.HTTPMethod, r.Operation.HTTPMethod; e != a { + t.Errorf("expect %q http method, got %q", e, a) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go index 07e82a04..73a95bad 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go @@ -381,6 +381,79 @@ func TestPaginationNilToken(t *testing.T) { assert.Equal(t, []string{"first.example.com.", "second.example.com.", "third.example.com."}, results) } +func TestPaginationNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { + r.Data = &s3.ListObjectsOutput{} + }) + + gotToEnd := false + numPages := 0 + err := client.ListObjectsPages(nil, func(p *s3.ListObjectsOutput, last bool) bool { + numPages++ + if last { + gotToEnd = true + } + return true + }) + + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, numPages; e != a { + t.Errorf("expect %d number pages but got %d", e, a) + } + if !gotToEnd { + t.Errorf("expect to of gotten to end, did not") + } +} + +func TestPaginationWithContextNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { + r.Data = &s3.ListObjectsOutput{} + }) + + gotToEnd := false + numPages := 0 + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + err := client.ListObjectsPagesWithContext(ctx, nil, func(p *s3.ListObjectsOutput, last bool) bool { + numPages++ + if last { + gotToEnd = true + } + return true + }) + + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, numPages; e != a { + t.Errorf("expect %d number pages but got %d", e, a) + } + if !gotToEnd { + t.Errorf("expect to of gotten to end, did not") + } +} + type testPageInput struct { NextToken string } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go index 4efc5057..4a917248 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go @@ -50,7 +50,7 @@ func TestResetBody_ExcludeUnseekableBodyByMethod(t *testing.T) { r.SetReaderBody(reader) - if a, e := r.HTTPRequest.Body == noBodyReader, c.IsNoBody; a != e { + if a, e := r.HTTPRequest.Body == NoBody, c.IsNoBody; a != e { t.Errorf("%d, expect body to be set to noBody(%t), but was %t", i, e, a) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go index 213dcdb8..4d9258c0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go @@ -8,18 +8,23 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "reflect" "runtime" "strconv" "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" "github.com/aws/aws-sdk-go/private/protocol/rest" ) @@ -91,9 +96,15 @@ func TestRequestRecoverRetry5xx(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 2, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } // test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry` @@ -117,9 +128,15 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 2, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } // test that retries don't occur for 4xx status codes with a response type that can't be retried @@ -135,15 +152,22 @@ func TestRequest4xxUnretryable(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 401, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + aerr := err.(awserr.RequestFailure) + if e, a := 401, aerr.StatusCode(); e != a { + t.Errorf("expect %d status code, got %d", e, a) + } + if e, a := "SignatureDoesNotMatch", aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := "Signature does not match.", aerr.Message(); e != a { + t.Errorf("expect %q error message, got %q", e, a) + } + if e, a := 0, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) } - assert.Equal(t, "SignatureDoesNotMatch", err.(awserr.Error).Code()) - assert.Equal(t, "Signature does not match.", err.(awserr.Error).Message()) - assert.Equal(t, 0, int(r.RetryCount)) } func TestRequestExhaustRetries(t *testing.T) { @@ -171,22 +195,31 @@ func TestRequestExhaustRetries(t *testing.T) { }) r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 500, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + aerr := err.(awserr.RequestFailure) + if e, a := 500, aerr.StatusCode(); e != a { + t.Errorf("expect %d status code, got %d", e, a) + } + if e, a := "UnknownError", aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := "An error occurred.", aerr.Message(); e != a { + t.Errorf("expect %q error message, got %q", e, a) + } + if e, a := 3, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) } - assert.Equal(t, "UnknownError", err.(awserr.Error).Code()) - assert.Equal(t, "An error occurred.", err.(awserr.Error).Message()) - assert.Equal(t, 3, int(r.RetryCount)) expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}} for i, v := range delays { min := expectDelays[i].min * time.Millisecond max := expectDelays[i].max * time.Millisecond - assert.True(t, min <= v && v <= max, - "Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max) + if !(min <= v && v <= max) { + t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", + i, v, min, max) + } } } @@ -222,14 +255,26 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } - assert.False(t, credExpiredBeforeRetry, "Expect valid creds before retry check") - assert.True(t, credExpiredAfterRetry, "Expect expired creds after retry check") - assert.False(t, s.Config.Credentials.IsExpired(), "Expect valid creds after cred expired recovery") + if credExpiredBeforeRetry { + t.Errorf("Expect valid creds before retry check") + } + if !credExpiredAfterRetry { + t.Errorf("Expect expired creds after retry check") + } + if s.Config.Credentials.IsExpired() { + t.Errorf("Expect valid creds after cred expired recovery") + } - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if e, a := 1, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } func TestMakeAddtoUserAgentHandler(t *testing.T) { @@ -238,7 +283,9 @@ func TestMakeAddtoUserAgentHandler(t *testing.T) { r.HTTPRequest.Header.Set("User-Agent", "foo/bar") fn(r) - assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) + if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a { + t.Errorf("expect %q user agent, got %q", e, a) + } } func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { @@ -247,7 +294,9 @@ func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { r.HTTPRequest.Header.Set("User-Agent", "foo/bar") fn(r) - assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) + if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a { + t.Errorf("expect %q user agent, got %q", e, a) + } } func TestRequestUserAgent(t *testing.T) { @@ -256,11 +305,15 @@ func TestRequestUserAgent(t *testing.T) { req := s.NewRequest(&request.Operation{Name: "Operation"}, nil, &testData{}) req.HTTPRequest.Header.Set("User-Agent", "foo/bar") - assert.NoError(t, req.Build()) + if err := req.Build(); err != nil { + t.Fatalf("expect no error, got %v", err) + } expectUA := fmt.Sprintf("foo/bar %s/%s (%s; %s; %s)", aws.SDKName, aws.SDKVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH) - assert.Equal(t, expectUA, req.HTTPRequest.Header.Get("User-Agent")) + if e, a := expectUA, req.HTTPRequest.Header.Get("User-Agent"); e != a { + t.Errorf("expect %q user agent, got %q", e, a) + } } func TestRequestThrottleRetries(t *testing.T) { @@ -288,22 +341,31 @@ func TestRequestThrottleRetries(t *testing.T) { }) r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 500, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + aerr := err.(awserr.RequestFailure) + if e, a := 500, aerr.StatusCode(); e != a { + t.Errorf("expect %d status code, got %d", e, a) + } + if e, a := "Throttling", aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := "An error occurred.", aerr.Message(); e != a { + t.Errorf("expect %q error message, got %q", e, a) + } + if e, a := 3, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) } - assert.Equal(t, "Throttling", err.(awserr.Error).Code()) - assert.Equal(t, "An error occurred.", err.(awserr.Error).Message()) - assert.Equal(t, 3, int(r.RetryCount)) expectDelays := []struct{ min, max time.Duration }{{500, 999}, {1000, 1998}, {2000, 3996}} for i, v := range delays { min := expectDelays[i].min * time.Millisecond max := expectDelays[i].max * time.Millisecond - assert.True(t, min <= v && v <= max, - "Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max) + if !(min <= v && v <= max) { + t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", + i, v, min, max) + } } } @@ -339,9 +401,15 @@ func TestRequestRecoverTimeoutWithNilBody(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } func TestRequestRecoverTimeoutWithNilResponse(t *testing.T) { @@ -376,9 +444,15 @@ func TestRequestRecoverTimeoutWithNilResponse(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } func TestRequest_NoBody(t *testing.T) { @@ -438,3 +512,333 @@ func TestRequest_NoBody(t *testing.T) { } } } + +func TestIsSerializationErrorRetryable(t *testing.T) { + testCases := []struct { + err error + expected bool + }{ + { + err: awserr.New(request.ErrCodeSerialization, "foo error", nil), + expected: false, + }, + { + err: awserr.New("ErrFoo", "foo error", nil), + expected: false, + }, + { + err: nil, + expected: false, + }, + { + err: awserr.New(request.ErrCodeSerialization, "foo error", stubConnectionResetError), + expected: true, + }, + } + + for i, c := range testCases { + r := &request.Request{ + Error: c.err, + } + if r.IsErrorRetryable() != c.expected { + t.Errorf("Case %d: Expected %v, but received %v", i+1, c.expected, !c.expected) + } + } +} + +func TestWithLogLevel(t *testing.T) { + r := &request.Request{} + + opt := request.WithLogLevel(aws.LogDebugWithHTTPBody) + r.ApplyOptions(opt) + + if !r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) { + t.Errorf("expect log level to be set, but was not, %v", + r.Config.LogLevel.Value()) + } +} + +func TestWithGetResponseHeader(t *testing.T) { + r := &request.Request{} + + var val, val2 string + r.ApplyOptions( + request.WithGetResponseHeader("x-a-header", &val), + request.WithGetResponseHeader("x-second-header", &val2), + ) + + r.HTTPResponse = &http.Response{ + Header: func() http.Header { + h := http.Header{} + h.Set("x-a-header", "first") + h.Set("x-second-header", "second") + return h + }(), + } + r.Handlers.Complete.Run(r) + + if e, a := "first", val; e != a { + t.Errorf("expect %q header value got %q", e, a) + } + if e, a := "second", val2; e != a { + t.Errorf("expect %q header value got %q", e, a) + } +} + +func TestWithGetResponseHeaders(t *testing.T) { + r := &request.Request{} + + var headers http.Header + opt := request.WithGetResponseHeaders(&headers) + + r.ApplyOptions(opt) + + r.HTTPResponse = &http.Response{ + Header: func() http.Header { + h := http.Header{} + h.Set("x-a-header", "headerValue") + return h + }(), + } + r.Handlers.Complete.Run(r) + + if e, a := "headerValue", headers.Get("x-a-header"); e != a { + t.Errorf("expect %q header value got %q", e, a) + } +} + +type connResetCloser struct { +} + +func (rc *connResetCloser) Read(b []byte) (int, error) { + return 0, stubConnectionResetError +} + +func (rc *connResetCloser) Close() error { + return nil +} + +func TestSerializationErrConnectionReset(t *testing.T) { + count := 0 + handlers := request.Handlers{} + handlers.Send.PushBack(func(r *request.Request) { + count++ + r.HTTPResponse = &http.Response{} + r.HTTPResponse.Body = &connResetCloser{} + }) + + handlers.Sign.PushBackNamed(v4.SignRequestHandler) + handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) + + op := &request.Operation{ + Name: "op", + HTTPMethod: "POST", + HTTPPath: "/", + } + + meta := metadata.ClientInfo{ + ServiceName: "fooService", + SigningName: "foo", + SigningRegion: "foo", + Endpoint: "localhost", + APIVersion: "2001-01-01", + JSONVersion: "1.1", + TargetPrefix: "Foo", + } + cfg := unit.Session.Config.Copy() + cfg.MaxRetries = aws.Int(5) + + req := request.New( + *cfg, + meta, + handlers, + client.DefaultRetryer{NumMaxRetries: 5}, + op, + &struct { + }{}, + &struct { + }{}, + ) + + osErr := stubConnectionResetError + req.ApplyOptions(request.WithResponseReadTimeout(time.Second)) + err := req.Send() + if err == nil { + t.Error("Expected rror 'SerializationError', but received nil") + } + if aerr, ok := err.(awserr.Error); ok && aerr.Code() != "SerializationError" { + t.Errorf("Expected 'SerializationError', but received %q", aerr.Code()) + } else if !ok { + t.Errorf("Expected 'awserr.Error', but received %v", reflect.TypeOf(err)) + } else if aerr.OrigErr().Error() != osErr.Error() { + t.Errorf("Expected %q, but received %q", osErr.Error(), aerr.OrigErr().Error()) + } + + if count != 6 { + t.Errorf("Expected '6', but received %d", count) + } +} + +type testRetryer struct { + shouldRetry bool +} + +func (d *testRetryer) MaxRetries() int { + return 3 +} + +// RetryRules returns the delay duration before retrying this request again +func (d *testRetryer) RetryRules(r *request.Request) time.Duration { + return time.Duration(time.Millisecond) +} + +func (d *testRetryer) ShouldRetry(r *request.Request) bool { + d.shouldRetry = true + if r.Retryable != nil { + return *r.Retryable + } + + if r.HTTPResponse.StatusCode >= 500 { + return true + } + return r.IsErrorRetryable() +} + +func TestEnforceShouldRetryCheck(t *testing.T) { + tp := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + ResponseHeaderTimeout: 1 * time.Millisecond, + } + + client := &http.Client{Transport: tp} + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // This server should wait forever. Requests will timeout and the SDK should + // attempt to retry. + select {} + })) + + retryer := &testRetryer{} + s := awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + MaxRetries: aws.Int(0), + Endpoint: aws.String(server.URL), + DisableSSL: aws.Bool(true), + Retryer: retryer, + HTTPClient: client, + EnforceShouldRetryCheck: aws.Bool(true), + }) + + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + + out := &testData{} + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) + err := r.Send() + if err == nil { + t.Fatalf("expect error, but got nil") + } + if e, a := 3, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if !retryer.shouldRetry { + t.Errorf("expect 'true' for ShouldRetry, but got %v", retryer.shouldRetry) + } +} + +type errReader struct { + err error +} + +func (reader *errReader) Read(b []byte) (int, error) { + return 0, reader.err +} + +func (reader *errReader) Close() error { + return nil +} + +func TestIsNoBodyReader(t *testing.T) { + cases := []struct { + reader io.ReadCloser + expect bool + }{ + {ioutil.NopCloser(bytes.NewReader([]byte("abc"))), false}, + {ioutil.NopCloser(bytes.NewReader(nil)), false}, + {nil, false}, + {request.NoBody, true}, + } + + for i, c := range cases { + if e, a := c.expect, request.NoBody == c.reader; e != a { + t.Errorf("%d, expect %t match, but was %t", i, e, a) + } + } +} + +func TestRequest_TemporaryRetry(t *testing.T) { + done := make(chan struct{}) + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Length", "1024") + w.WriteHeader(http.StatusOK) + + w.Write(make([]byte, 100)) + + f := w.(http.Flusher) + f.Flush() + + <-done + })) + + client := &http.Client{ + Timeout: 100 * time.Millisecond, + } + + svc := awstesting.NewClient(&aws.Config{ + Region: unit.Session.Config.Region, + MaxRetries: aws.Int(1), + HTTPClient: client, + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL), + }) + + req := svc.NewRequest(&request.Operation{ + Name: "name", HTTPMethod: "GET", HTTPPath: "/path", + }, &struct{}{}, &struct{}{}) + + req.Handlers.Unmarshal.PushBack(func(r *request.Request) { + defer req.HTTPResponse.Body.Close() + _, err := io.Copy(ioutil.Discard, req.HTTPResponse.Body) + r.Error = awserr.New(request.ErrCodeSerialization, "error", err) + }) + + err := req.Send() + if err == nil { + t.Errorf("expect error, got none") + } + close(done) + + aerr := err.(awserr.Error) + if e, a := request.ErrCodeSerialization, aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + + if e, a := 1, req.RetryCount; e != a { + t.Errorf("expect %d retries, got %d", e, a) + } + + type temporary interface { + Temporary() bool + } + + terr := aerr.OrigErr().(temporary) + if !terr.Temporary() { + t.Errorf("expect temporary error, was not") + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index ebd60ccc..f35fef21 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -8,7 +8,7 @@ import ( ) // Retryer is an interface to control retry logic for a given service. -// The default implementation used by most services is the service.DefaultRetryer +// The default implementation used by most services is the client.DefaultRetryer // structure, which contains basic retry logic using exponential backoff. type Retryer interface { RetryRules(*Request) time.Duration @@ -26,8 +26,10 @@ func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { // retryableCodes is a collection of service response codes which are retry-able // without any further action. var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "RequestTimeout": {}, + "RequestError": {}, + "RequestTimeout": {}, + ErrCodeResponseTimeout: {}, + "RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout } var throttleCodes = map[string]struct{}{ @@ -36,7 +38,6 @@ var throttleCodes = map[string]struct{}{ "ThrottlingException": {}, "RequestLimitExceeded": {}, "RequestThrottled": {}, - "LimitExceededException": {}, // Deleting 10+ DynamoDb tables at once "TooManyRequestsException": {}, // Lambda functions "PriorRequestNotComplete": {}, // Route53 } @@ -68,35 +69,93 @@ func isCodeExpiredCreds(code string) bool { return ok } +var validParentCodes = map[string]struct{}{ + ErrCodeSerialization: {}, + ErrCodeRead: {}, +} + +type temporaryError interface { + Temporary() bool +} + +func isNestedErrorRetryable(parentErr awserr.Error) bool { + if parentErr == nil { + return false + } + + if _, ok := validParentCodes[parentErr.Code()]; !ok { + return false + } + + err := parentErr.OrigErr() + if err == nil { + return false + } + + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) + } + + if t, ok := err.(temporaryError); ok { + return t.Temporary() + } + + return isErrConnectionReset(err) +} + // IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if the request has no Error set. -func (r *Request) IsErrorRetryable() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeRetryable(err.Code()) +// Returns false if error is nil. +func IsErrorRetryable(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) || isNestedErrorRetryable(aerr) } } return false } // IsErrorThrottle returns whether the error is to be throttled based on its code. -// Returns false if the request has no Error set -func (r *Request) IsErrorThrottle() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeThrottle(err.Code()) +// Returns false if error is nil. +func IsErrorThrottle(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeThrottle(aerr.Code()) } } return false } -// IsErrorExpired returns whether the error code is a credential expiry error. -// Returns false if the request has no Error set. -func (r *Request) IsErrorExpired() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeExpiredCreds(err.Code()) +// IsErrorExpiredCreds returns whether the error code is a credential expiry error. +// Returns false if error is nil. +func IsErrorExpiredCreds(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeExpiredCreds(aerr.Code()) } } return false } + +// IsErrorRetryable returns whether the error is retryable, based on its Code. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorRetryable +func (r *Request) IsErrorRetryable() bool { + return IsErrorRetryable(r.Error) +} + +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set +// +// Alias for the utility function IsErrorThrottle +func (r *Request) IsErrorThrottle() bool { + return IsErrorThrottle(r.Error) +} + +// IsErrorExpired returns whether the error code is a credential expiry error. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorExpiredCreds +func (r *Request) IsErrorExpired() bool { + return IsErrorExpiredCreds(r.Error) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go index b1926e3d..a8787487 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go @@ -1,10 +1,10 @@ package request import ( + "errors" + "fmt" "testing" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws/awserr" ) @@ -12,5 +12,51 @@ func TestRequestThrottling(t *testing.T) { req := Request{} req.Error = awserr.New("Throttling", "", nil) - assert.True(t, req.IsErrorThrottle()) + if e, a := true, req.IsErrorThrottle(); e != a { + t.Errorf("expect %t to be throttled, was %t", e, a) + } +} + +type mockTempError bool + +func (e mockTempError) Error() string { + return fmt.Sprintf("mock temporary error: %t", e.Temporary()) +} +func (e mockTempError) Temporary() bool { + return bool(e) +} + +func TestIsErrorRetryable(t *testing.T) { + cases := []struct { + Err error + IsTemp bool + }{ + { + Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(true)), + IsTemp: true, + }, + { + Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(false)), + IsTemp: false, + }, + { + Err: awserr.New(ErrCodeSerialization, "some error", errors.New("blah")), + IsTemp: false, + }, + { + Err: awserr.New("SomeError", "some error", nil), + IsTemp: false, + }, + { + Err: awserr.New("RequestError", "some error", nil), + IsTemp: true, + }, + } + + for i, c := range cases { + retryable := IsErrorRetryable(c.Err) + if e, a := c.IsTemp, retryable; e != a { + t.Errorf("%d, expect %t temporary error, got %t", i, e, a) + } + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go new file mode 100644 index 00000000..09a44eb9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go @@ -0,0 +1,94 @@ +package request + +import ( + "io" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +var timeoutErr = awserr.New( + ErrCodeResponseTimeout, + "read on body has reached the timeout limit", + nil, +) + +type readResult struct { + n int + err error +} + +// timeoutReadCloser will handle body reads that take too long. +// We will return a ErrReadTimeout error if a timeout occurs. +type timeoutReadCloser struct { + reader io.ReadCloser + duration time.Duration +} + +// Read will spin off a goroutine to call the reader's Read method. We will +// select on the timer's channel or the read's channel. Whoever completes first +// will be returned. +func (r *timeoutReadCloser) Read(b []byte) (int, error) { + timer := time.NewTimer(r.duration) + c := make(chan readResult, 1) + + go func() { + n, err := r.reader.Read(b) + timer.Stop() + c <- readResult{n: n, err: err} + }() + + select { + case data := <-c: + return data.n, data.err + case <-timer.C: + return 0, timeoutErr + } +} + +func (r *timeoutReadCloser) Close() error { + return r.reader.Close() +} + +const ( + // HandlerResponseTimeout is what we use to signify the name of the + // response timeout handler. + HandlerResponseTimeout = "ResponseTimeoutHandler" +) + +// adaptToResponseTimeoutError is a handler that will replace any top level error +// to a ErrCodeResponseTimeout, if its child is that. +func adaptToResponseTimeoutError(req *Request) { + if err, ok := req.Error.(awserr.Error); ok { + aerr, ok := err.OrigErr().(awserr.Error) + if ok && aerr.Code() == ErrCodeResponseTimeout { + req.Error = aerr + } + } +} + +// WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. +// This will allow for per read timeouts. If a timeout occurred, we will return the +// ErrCodeResponseTimeout. +// +// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) +func WithResponseReadTimeout(duration time.Duration) Option { + return func(r *Request) { + + var timeoutHandler = NamedHandler{ + HandlerResponseTimeout, + func(req *Request) { + req.HTTPResponse.Body = &timeoutReadCloser{ + reader: req.HTTPResponse.Body, + duration: duration, + } + }} + + // remove the handler so we are not stomping over any new durations. + r.Handlers.Send.RemoveByName(HandlerResponseTimeout) + r.Handlers.Send.PushBackNamed(timeoutHandler) + + r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) + r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go new file mode 100644 index 00000000..33e1b2d1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go @@ -0,0 +1,76 @@ +package request_test + +import ( + "bytes" + "io/ioutil" + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +func BenchmarkTimeoutReadCloser(b *testing.B) { + resp := ` + { + "Bar": "qux" + } + ` + + handlers := request.Handlers{} + + handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: http.StatusOK, + Body: ioutil.NopCloser(bytes.NewBuffer([]byte(resp))), + } + }) + handlers.Sign.PushBackNamed(v4.SignRequestHandler) + handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + op := &request.Operation{ + Name: "op", + HTTPMethod: "POST", + HTTPPath: "/", + } + + meta := metadata.ClientInfo{ + ServiceName: "fooService", + SigningName: "foo", + SigningRegion: "foo", + Endpoint: "localhost", + APIVersion: "2001-01-01", + JSONVersion: "1.1", + TargetPrefix: "Foo", + } + + req := request.New( + *unit.Session.Config, + meta, + handlers, + client.DefaultRetryer{NumMaxRetries: 5}, + op, + &struct { + Foo *string + }{}, + &struct { + Bar *string + }{}, + ) + + req.ApplyOptions(request.WithResponseReadTimeout(15 * time.Second)) + for i := 0; i < b.N; i++ { + err := req.Send() + if err != nil { + b.Errorf("Expected no error, but received %v", err) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go new file mode 100644 index 00000000..c814158d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go @@ -0,0 +1,118 @@ +package request + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +type testReader struct { + duration time.Duration + count int +} + +func (r *testReader) Read(b []byte) (int, error) { + if r.count > 0 { + r.count-- + return len(b), nil + } + time.Sleep(r.duration) + return 0, io.EOF +} + +func (r *testReader) Close() error { + return nil +} + +func TestTimeoutReadCloser(t *testing.T) { + reader := timeoutReadCloser{ + reader: &testReader{ + duration: time.Second, + count: 5, + }, + duration: time.Millisecond, + } + b := make([]byte, 100) + _, err := reader.Read(b) + if err != nil { + t.Log(err) + } +} + +func TestTimeoutReadCloserSameDuration(t *testing.T) { + reader := timeoutReadCloser{ + reader: &testReader{ + duration: time.Millisecond, + count: 5, + }, + duration: time.Millisecond, + } + b := make([]byte, 100) + _, err := reader.Read(b) + if err != nil { + t.Log(err) + } +} + +func TestWithResponseReadTimeout(t *testing.T) { + r := Request{ + HTTPResponse: &http.Response{ + Body: ioutil.NopCloser(bytes.NewReader(nil)), + }, + } + r.ApplyOptions(WithResponseReadTimeout(time.Second)) + err := r.Send() + if err != nil { + t.Error(err) + } + v, ok := r.HTTPResponse.Body.(*timeoutReadCloser) + if !ok { + t.Error("Expected the body to be a timeoutReadCloser") + } + if v.duration != time.Second { + t.Errorf("Expected %v, but receive %v\n", time.Second, v.duration) + } +} + +func TestAdaptToResponseTimeout(t *testing.T) { + testCases := []struct { + childErr error + r Request + expectedRootCode string + }{ + { + childErr: awserr.New(ErrCodeResponseTimeout, "timeout!", nil), + r: Request{ + Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout, "timeout!", nil)), + }, + expectedRootCode: ErrCodeResponseTimeout, + }, + { + childErr: awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil), + r: Request{ + Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil)), + }, + expectedRootCode: "ErrTest", + }, + { + r: Request{ + Error: awserr.New("ErrTest", "FooBar", nil), + }, + expectedRootCode: "ErrTest", + }, + } + + for i, c := range testCases { + adaptToResponseTimeoutError(&c.r) + if aerr, ok := c.r.Error.(awserr.Error); !ok { + t.Errorf("Case %d: Expected 'awserr', but received %v", i+1, c.r.Error) + } else if aerr.Code() != c.expectedRootCode { + t.Errorf("Case %d: Expected %q, but received %s", i+1, c.expectedRootCode, aerr.Code()) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go index 2520286b..40124622 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go @@ -220,7 +220,7 @@ type ErrParamMinLen struct { func NewErrParamMinLen(field string, min int) *ErrParamMinLen { return &ErrParamMinLen{ errInvalidParam: errInvalidParam{ - code: ParamMinValueErrCode, + code: ParamMinLenErrCode, field: field, msg: fmt.Sprintf("minimum field size of %v", min), }, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go index 354c3812..4601f883 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go @@ -66,8 +66,8 @@ func WithWaiterRequestOptions(opts ...Option) WaiterOption { } } -// A Waiter provides the functionality to performing blocking call which will -// wait for an resource state to be satisfied a service. +// A Waiter provides the functionality to perform a blocking call which will +// wait for a resource state to be satisfied by a service. // // This type should not be used directly. The API operations provided in the // service packages prefixed with "WaitUntil" should be used instead. @@ -79,8 +79,9 @@ type Waiter struct { MaxAttempts int Delay WaiterDelay - RequestOptions []Option - NewRequest func([]Option) (*Request, error) + RequestOptions []Option + NewRequest func([]Option) (*Request, error) + SleepWithContext func(aws.Context, time.Duration) error } // ApplyOptions updates the waiter with the list of waiter options provided. @@ -178,14 +179,8 @@ func (w Waiter) WaitWithContext(ctx aws.Context) error { // See if any of the acceptors match the request's response, or error for _, a := range w.Acceptors { - var matched bool - matched, err = a.match(w.Name, w.Logger, req, err) - if err != nil { - // Error occurred during current waiter call - return err - } else if matched { - // Match was found can stop here and return - return nil + if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched { + return matchErr } } @@ -201,8 +196,15 @@ func (w Waiter) WaitWithContext(ctx aws.Context) error { if sleepFn := req.Config.SleepDelay; sleepFn != nil { // Support SleepDelay for backwards compatibility and testing sleepFn(delay) - } else if err := aws.SleepWithContext(ctx, delay); err != nil { - return awserr.New(CanceledErrorCode, "waiter context canceled", err) + } else { + sleepCtxFn := w.SleepWithContext + if sleepCtxFn == nil { + sleepCtxFn = aws.SleepWithContext + } + + if err := sleepCtxFn(ctx, delay); err != nil { + return awserr.New(CanceledErrorCode, "waiter context canceled", err) + } } } @@ -274,7 +276,7 @@ func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err erro return true, nil case FailureWaiterState: // Waiter failure state triggered - return false, awserr.New("ResourceNotReady", + return true, awserr.New(WaiterResourceNotReadyErrorCode, "failed waiting for successful resource state", err) case RetryWaiterState: // clear the error and retry the operation diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go index 8d76e438..db0f92df 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go @@ -15,6 +15,8 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/service/s3" ) type mockClient struct { @@ -98,8 +100,9 @@ func TestWaiterPathAll(t *testing.T) { }) w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -162,8 +165,9 @@ func TestWaiterPath(t *testing.T) { }) w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -226,8 +230,9 @@ func TestWaiterFailure(t *testing.T) { }) w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -271,7 +276,9 @@ func TestWaiterError(t *testing.T) { {State: aws.String("pending")}, }, }, - { // Request 2, error case + { // Request 1, error case retry + }, + { // Request 2, error case failure }, { // Request 3 States: []*MockState{ @@ -280,6 +287,9 @@ func TestWaiterError(t *testing.T) { }, }, } + reqErrs := make([]error, len(resps)) + reqErrs[1] = awserr.New("MockException", "mock exception message", nil) + reqErrs[2] = awserr.New("FailureException", "mock failure exception message", nil) numBuiltReq := 0 svc.Handlers.Build.PushBack(func(r *request.Request) { @@ -305,17 +315,18 @@ func TestWaiterError(t *testing.T) { reqNum++ }) svc.Handlers.UnmarshalMeta.PushBack(func(r *request.Request) { - if reqNum == 1 { - r.Error = awserr.New("MockException", "mock exception message", nil) - // If there was an error unmarshal error will be called instead of unmarshal - // need to increment count here also + // If there was an error unmarshal error will be called instead of unmarshal + // need to increment count here also + if err := reqErrs[reqNum]; err != nil { + r.Error = err reqNum++ } }) w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -329,14 +340,30 @@ func TestWaiterError(t *testing.T) { Argument: "", Expected: "MockException", }, + { + State: request.FailureWaiterState, + Matcher: request.ErrorWaiterMatch, + Argument: "", + Expected: "FailureException", + }, }, NewRequest: BuildNewMockRequest(svc, &MockInput{}), } err := w.WaitWithContext(aws.BackgroundContext()) - assert.NoError(t, err) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) + if err == nil { + t.Fatalf("expected error, but did not get one") + } + aerr := err.(awserr.Error) + if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := 3, numBuiltReq; e != a { + t.Errorf("expect %d built requests got %d", e, a) + } + if e, a := 3, reqNum; e != a { + t.Errorf("expect %d reqNum got %d", e, a) + } } func TestWaiterStatus(t *testing.T) { @@ -366,8 +393,9 @@ func TestWaiterStatus(t *testing.T) { }) w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -424,9 +452,10 @@ func TestWaiter_WithContextCanceled(t *testing.T) { reqCount := 0 w := request.Waiter{ - Name: "TestWaiter", - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + Name: "TestWaiter", + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -452,6 +481,16 @@ func TestWaiter_WithContextCanceled(t *testing.T) { }, } + w.SleepWithContext = func(c aws.Context, delay time.Duration) error { + context := c.(*awstesting.FakeContext) + select { + case <-context.DoneCh: + return context.Err() + default: + return nil + } + } + err := w.WaitWithContext(ctx) if err == nil { @@ -475,9 +514,10 @@ func TestWaiter_WithContext(t *testing.T) { statuses := []int{http.StatusNotFound, http.StatusOK} w := request.Waiter{ - Name: "TestWaiter", - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + Name: "TestWaiter", + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -520,9 +560,10 @@ func TestWaiter_AttemptsExpires(t *testing.T) { reqCount := 0 w := request.Waiter{ - Name: "TestWaiter", - MaxAttempts: 2, - Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + Name: "TestWaiter", + MaxAttempts: 2, + Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + SleepWithContext: aws.SleepWithContext, Acceptors: []request.WaiterAcceptor{ { State: request.SuccessWaiterState, @@ -557,3 +598,57 @@ func TestWaiter_AttemptsExpires(t *testing.T) { t.Errorf("expect %d requests, got %d", e, a) } } + +func TestWaiterNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: http.StatusOK, + } + }) + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + client.Config.SleepDelay = func(dur time.Duration) {} + + // Ensure waiters do not panic on nil input. It doesn't make sense to + // call a waiter without an input, Validation will + err := client.WaitUntilBucketExists(nil) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } +} + +func TestWaiterWithContextNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: http.StatusOK, + } + }) + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + + // Ensure waiters do not panic on nil input + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + err := client.WaitUntilBucketExistsWithContext(ctx, nil, + request.WithWaiterDelay(request.ConstantWaiterDelay(0)), + request.WithWaiterMaxAttempts(1), + ) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go index 8a5a3a04..a89c0af5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go @@ -2,158 +2,166 @@ package session import ( "bytes" - "crypto/tls" - "io/ioutil" + "fmt" "net" "net/http" - "net/http/httptest" "os" + "strings" "testing" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/awstesting" ) -func createTLSServer(cert, key []byte, done <-chan struct{}) (*httptest.Server, error) { - c, err := tls.X509KeyPair(cert, key) +var TLSBundleCertFile string +var TLSBundleKeyFile string +var TLSBundleCAFile string + +func TestMain(m *testing.M) { + var err error + + TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err = awstesting.CreateTLSBundleFiles() if err != nil { - return nil, err + panic(err) } - s := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - })) - s.TLS = &tls.Config{ - Certificates: []tls.Certificate{c}, - } - s.TLS.BuildNameToCertificate() - s.StartTLS() + fmt.Println("TestMain", TLSBundleCertFile, TLSBundleKeyFile) - go func() { - <-done - s.Close() - }() + code := m.Run() - return s, nil -} - -func setupTestCAFile(b []byte) (string, error) { - bundleFile, err := ioutil.TempFile(os.TempDir(), "aws-sdk-go-session-test") + err = awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile) if err != nil { - return "", err + panic(err) } - _, err = bundleFile.Write(b) - if err != nil { - return "", err - } - - defer bundleFile.Close() - return bundleFile.Name(), nil + os.Exit(code) } func TestNewSession_WithCustomCABundle_Env(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } - // Write bundle to file - caFilename, err := setupTestCAFile(testTLSBundleCA) - defer func() { - os.Remove(caFilename) - }() - assert.NoError(t, err) - - os.Setenv("AWS_CA_BUNDLE", caFilename) + os.Setenv("AWS_CA_BUNDLE", TLSBundleCAFile) s, err := NewSession(&aws.Config{ HTTPClient: &http.Client{}, - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } func TestNewSession_WithCustomCABundle_EnvNotExists(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_CA_BUNDLE", "file-not-exists") s, err := NewSession() - assert.Error(t, err) - assert.Equal(t, "LoadCustomCABundleError", err.(awserr.Error).Code()) - assert.Nil(t, s) + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a { + t.Errorf("expect %s error code, got %s", e, a) + } + if s != nil { + t.Errorf("expect nil session, got %v", s) + } } func TestNewSession_WithCustomCABundle_Option(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } s, err := NewSessionWithOptions(Options{ Config: aws.Config{ HTTPClient: &http.Client{}, - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } func TestNewSession_WithCustomCABundle_OptionPriority(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } os.Setenv("AWS_CA_BUNDLE", "file-not-exists") s, err := NewSessionWithOptions(Options{ Config: aws.Config{ HTTPClient: &http.Client{}, - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } type mockRoundTripper struct{} @@ -164,7 +172,7 @@ func (m *mockRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { func TestNewSession_WithCustomCABundle_UnsupportedTransport(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) s, err := NewSessionWithOptions(Options{ Config: aws.Config{ @@ -172,25 +180,35 @@ func TestNewSession_WithCustomCABundle_UnsupportedTransport(t *testing.T) { Transport: &mockRoundTripper{}, }, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.Error(t, err) - assert.Equal(t, "LoadCustomCABundleError", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "transport unsupported type") - assert.Nil(t, s) + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a { + t.Errorf("expect %s error code, got %s", e, a) + } + if s != nil { + t.Errorf("expect nil session, got %v", s) + } + aerrMsg := err.(awserr.Error).Message() + if e, a := "transport unsupported type", aerrMsg; !strings.Contains(a, e) { + t.Errorf("expect %s to be in %s", e, a) + } } func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } s, err := NewSessionWithOptions(Options{ Config: aws.Config{ - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, HTTPClient: &http.Client{ @@ -205,115 +223,21 @@ func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) { }, }, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } - -/* Cert generation steps -# Create the CA key -openssl genrsa -des3 -out ca.key 1024 - -# Create the CA Cert -openssl req -new -sha256 -x509 -days 3650 \ - -subj "/C=GO/ST=Gopher/O=Testing ROOT CA" \ - -key ca.key -out ca.crt - -# Create config -cat > csr_details.txt <<-EOF - -[req] -default_bits = 1024 -prompt = no -default_md = sha256 -req_extensions = SAN -distinguished_name = dn - -[ dn ] -C=GO -ST=Gopher -O=Testing Certificate -OU=Testing IP - -[SAN] -subjectAltName = IP:127.0.0.1 -EOF - -# Create certificate signing request -openssl req -new -sha256 -nodes -newkey rsa:1024 \ - -config <( cat csr_details.txt ) \ - -keyout ia.key -out ia.csr - -# Create a signed certificate -openssl x509 -req -days 3650 \ - -CAcreateserial \ - -extfile <( cat csr_details.txt ) \ - -extensions SAN \ - -CA ca.crt -CAkey ca.key -in ia.csr -out ia.crt - -# Verify -openssl req -noout -text -in ia.csr -openssl x509 -noout -text -in ia.crt -*/ -var ( - // ca.crt - testTLSBundleCA = []byte(`-----BEGIN CERTIFICATE----- -MIICiTCCAfKgAwIBAgIJAJ5X1olt05XjMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV -BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD -QTAeFw0xNzAzMDkwMDAyMDZaFw0yNzAzMDcwMDAyMDZaMDgxCzAJBgNVBAYTAkdP -MQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBDQTCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw/8DN+t9XQR60jx42rsQ2WE2Dx85rb3n -GQxnKZZLNddsT8rDyxJNP18aFalbRbFlyln5fxWxZIblu9Xkm/HRhOpbSimSqo1y -uDx21NVZ1YsOvXpHby71jx3gPrrhSc/t/zikhi++6D/C6m1CiIGuiJ0GBiJxtrub -UBMXT0QtI2ECAwEAAaOBmjCBlzAdBgNVHQ4EFgQU8XG3X/YHBA6T04kdEkq6+4GV -YykwaAYDVR0jBGEwX4AU8XG3X/YHBA6T04kdEkq6+4GVYymhPKQ6MDgxCzAJBgNV -BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD -QYIJAJ5X1olt05XjMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADgYEAeILv -z49+uxmPcfOZzonuOloRcpdvyjiXblYxbzz6ch8GsE7Q886FTZbvwbgLhzdwSVgG -G8WHkodDUsymVepdqAamS3f8PdCUk8xIk9mop8LgaB9Ns0/TssxDvMr3sOD2Grb3 -xyWymTWMcj6uCiEBKtnUp4rPiefcvCRYZ17/hLE= ------END CERTIFICATE----- -`) - - // ai.crt - testTLSBundleCert = []byte(`-----BEGIN CERTIFICATE----- -MIICGjCCAYOgAwIBAgIJAIIu+NOoxxM0MA0GCSqGSIb3DQEBBQUAMDgxCzAJBgNV -BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD -QTAeFw0xNzAzMDkwMDAzMTRaFw0yNzAzMDcwMDAzMTRaMFExCzAJBgNVBAYTAkdP -MQ8wDQYDVQQIDAZHb3BoZXIxHDAaBgNVBAoME1Rlc3RpbmcgQ2VydGlmaWNhdGUx -EzARBgNVBAsMClRlc3RpbmcgSVAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB -AN1hWHeioo/nASvbrjwCQzXCiWiEzGkw353NxsAB54/NqDL3LXNATtiSJu8kJBrm -Ah12IFLtWLGXjGjjYlHbQWnOR6awveeXnQZukJyRWh7m/Qlt9Ho0CgZE1U+832ac -5GWVldNxW1Lz4I+W9/ehzqe8I80RS6eLEKfUFXGiW+9RAgMBAAGjEzARMA8GA1Ud -EQQIMAaHBH8AAAEwDQYJKoZIhvcNAQEFBQADgYEAdF4WQHfVdPCbgv9sxgJjcR1H -Hgw9rZ47gO1IiIhzglnLXQ6QuemRiHeYFg4kjcYBk1DJguxzDTGnUwhUXOibAB+S -zssmrkdYYvn9aUhjc3XK3tjAoDpsPpeBeTBamuUKDHoH/dNRXxerZ8vu6uPR3Pgs -5v/KCV6IAEcvNyOXMPo= ------END CERTIFICATE----- -`) - - // ai.key - testTLSBundleKey = []byte(`-----BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDdYVh3oqKP5wEr2648AkM1wolohMxpMN+dzcbAAeePzagy9y1z -QE7YkibvJCQa5gIddiBS7Vixl4xo42JR20FpzkemsL3nl50GbpCckVoe5v0JbfR6 -NAoGRNVPvN9mnORllZXTcVtS8+CPlvf3oc6nvCPNEUunixCn1BVxolvvUQIDAQAB -AoGBAMISrcirddGrlLZLLrKC1ULS2T0cdkqdQtwHYn4+7S5+/z42vMx1iumHLsSk -rVY7X41OWkX4trFxhvEIrc/O48bo2zw78P7flTxHy14uxXnllU8cLThE29SlUU7j -AVBNxJZMsXMlS/DowwD4CjFe+x4Pu9wZcReF2Z9ntzMpySABAkEA+iWoJCPE2JpS -y78q3HYYgpNY3gF3JqQ0SI/zTNkb3YyEIUffEYq0Y9pK13HjKtdsSuX4osTIhQkS -+UgRp6tCAQJBAOKPYTfQ2FX8ijgUpHZRuEAVaxASAS0UATiLgzXxLvOh/VC2at5x -wjOX6sD65pPz/0D8Qj52Cq6Q1TQ+377SDVECQAIy0od+yPweXxvrUjUd1JlRMjbB -TIrKZqs8mKbUQapw0bh5KTy+O1elU4MRPS3jNtBxtP25PQnuSnxmZcFTgAECQFzg -DiiFcsn9FuRagfkHExMiNJuH5feGxeFaP9WzI144v9GAllrOI6Bm3JNzx2ZLlg4b -20Qju8lIEj6yr6JYFaECQHM1VSojGRKpOl9Ox/R4yYSA9RV5Gyn00/aJNxVYyPD5 -i3acL2joQm2kLD/LO8paJ4+iQdRXCOMMIpjxSNjGQjQ= ------END RSA PRIVATE KEY----- -`) -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go index 660d9bef..ea7b886f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -23,7 +23,7 @@ additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. Alternatively you can explicitly create a Session with shared config enabled. To do this you can use NewSessionWithOptions to configure how the Session will be created. Using the NewSessionWithOptions with SharedConfigState set to -SharedConfigEnabled will create the session as if the AWS_SDK_LOAD_CONFIG +SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG environment variable was set. Creating Sessions @@ -84,7 +84,7 @@ override the shared config state (AWS_SDK_LOAD_CONFIG). // Force enable Shared Config support sess := session.Must(session.NewSessionWithOptions(session.Options{ - SharedConfigState: SharedConfigEnable, + SharedConfigState: session.SharedConfigEnable, })) Adding Handlers @@ -124,9 +124,8 @@ file (~/.aws/config) and shared credentials file (~/.aws/credentials). Both files have the same format. If both config files are present the configuration from both files will be -read. The Session will be created from configuration values from the shared -credentials file (~/.aws/credentials) over those in the shared credentials -file (~/.aws/config). +read. The Session will be created from configuration values from the shared +credentials file (~/.aws/credentials) over those in the shared config file (~/.aws/config). Credentials are the values the SDK should use for authenticating requests with AWS Services. They arfrom a configuration file will need to include both diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go index e6278a78..f1adcf48 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -2,12 +2,14 @@ package session import ( "os" - "path/filepath" "strconv" "github.com/aws/aws-sdk-go/aws/credentials" ) +// EnvProviderName provides a name of the provider when config is loaded from environment. +const EnvProviderName = "EnvConfigCredentials" + // envConfig is a collection of environment values the SDK will read // setup config from. All environment values are optional. But some values // such as credentials require multiple values to be complete or the values @@ -77,7 +79,7 @@ type envConfig struct { SharedConfigFile string // Sets the path to a custom Credentials Authroity (CA) Bundle PEM file - // that the SDK will use instead of the the system's root CA bundle. + // that the SDK will use instead of the system's root CA bundle. // Only use this if you want to configure the SDK to use a custom set // of CAs. // @@ -116,6 +118,12 @@ var ( "AWS_PROFILE", "AWS_DEFAULT_PROFILE", // Only read if AWS_SDK_LOAD_CONFIG is also set } + sharedCredsFileEnvKey = []string{ + "AWS_SHARED_CREDENTIALS_FILE", + } + sharedConfigFileEnvKey = []string{ + "AWS_CONFIG_FILE", + } ) // loadEnvConfig retrieves the SDK's environment configuration. @@ -152,7 +160,7 @@ func envConfigLoad(enableSharedConfig bool) envConfig { if len(cfg.Creds.AccessKeyID) == 0 || len(cfg.Creds.SecretAccessKey) == 0 { cfg.Creds = credentials.Value{} } else { - cfg.Creds.ProviderName = "EnvConfigCredentials" + cfg.Creds.ProviderName = EnvProviderName } regionKeys := regionEnvKeys @@ -165,8 +173,8 @@ func envConfigLoad(enableSharedConfig bool) envConfig { setFromEnvVal(&cfg.Region, regionKeys) setFromEnvVal(&cfg.Profile, profileKeys) - cfg.SharedCredentialsFile = sharedCredentialsFilename() - cfg.SharedConfigFile = sharedConfigFilename() + setFromEnvVal(&cfg.SharedCredentialsFile, sharedCredsFileEnvKey) + setFromEnvVal(&cfg.SharedConfigFile, sharedConfigFileEnvKey) cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE") @@ -181,28 +189,3 @@ func setFromEnvVal(dst *string, keys []string) { } } } - -func sharedCredentialsFilename() string { - if name := os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); len(name) > 0 { - return name - } - - return filepath.Join(userHomeDir(), ".aws", "credentials") -} - -func sharedConfigFilename() string { - if name := os.Getenv("AWS_CONFIG_FILE"); len(name) > 0 { - return name - } - - return filepath.Join(userHomeDir(), ".aws", "config") -} - -func userHomeDir() string { - homeDir := os.Getenv("HOME") // *nix - if len(homeDir) == 0 { // windows - homeDir = os.Getenv("USERPROFILE") - } - - return homeDir -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go index 162a7105..10e3662a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go @@ -2,17 +2,16 @@ package session import ( "os" - "path/filepath" - "strings" + "reflect" "testing" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/awstesting" ) func TestLoadEnvConfig_Creds(t *testing.T) { - env := stashEnv() - defer popEnv(env) + env := awstesting.StashEnv() + defer awstesting.PopEnv(env) cases := []struct { Env map[string]string @@ -83,26 +82,30 @@ func TestLoadEnvConfig_Creds(t *testing.T) { } cfg := loadEnvConfig() - assert.Equal(t, c.Val, cfg.Creds) + if !reflect.DeepEqual(c.Val, cfg.Creds) { + t.Errorf("expect credentials to match.\n%s", + awstesting.SprintExpectActual(c.Val, cfg.Creds)) + } } } func TestLoadEnvConfig(t *testing.T) { - env := stashEnv() - defer popEnv(env) + env := awstesting.StashEnv() + defer awstesting.PopEnv(env) cases := []struct { Env map[string]string - Region, Profile string - CustomCABundle string UseSharedConfigCall bool + Config envConfig }{ { Env: map[string]string{ "AWS_REGION": "region", "AWS_PROFILE": "profile", }, - Region: "region", Profile: "profile", + Config: envConfig{ + Region: "region", Profile: "profile", + }, }, { Env: map[string]string{ @@ -111,7 +114,9 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_PROFILE": "profile", "AWS_DEFAULT_PROFILE": "default_profile", }, - Region: "region", Profile: "profile", + Config: envConfig{ + Region: "region", Profile: "profile", + }, }, { Env: map[string]string{ @@ -121,7 +126,10 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_DEFAULT_PROFILE": "default_profile", "AWS_SDK_LOAD_CONFIG": "1", }, - Region: "region", Profile: "profile", + Config: envConfig{ + Region: "region", Profile: "profile", + EnableSharedConfig: true, + }, }, { Env: map[string]string{ @@ -135,14 +143,20 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_DEFAULT_PROFILE": "default_profile", "AWS_SDK_LOAD_CONFIG": "1", }, - Region: "default_region", Profile: "default_profile", + Config: envConfig{ + Region: "default_region", Profile: "default_profile", + EnableSharedConfig: true, + }, }, { Env: map[string]string{ "AWS_REGION": "region", "AWS_PROFILE": "profile", }, - Region: "region", Profile: "profile", + Config: envConfig{ + Region: "region", Profile: "profile", + EnableSharedConfig: true, + }, UseSharedConfigCall: true, }, { @@ -152,7 +166,10 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_PROFILE": "profile", "AWS_DEFAULT_PROFILE": "default_profile", }, - Region: "region", Profile: "profile", + Config: envConfig{ + Region: "region", Profile: "profile", + EnableSharedConfig: true, + }, UseSharedConfigCall: true, }, { @@ -163,7 +180,10 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_DEFAULT_PROFILE": "default_profile", "AWS_SDK_LOAD_CONFIG": "1", }, - Region: "region", Profile: "profile", + Config: envConfig{ + Region: "region", Profile: "profile", + EnableSharedConfig: true, + }, UseSharedConfigCall: true, }, { @@ -171,7 +191,10 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_DEFAULT_REGION": "default_region", "AWS_DEFAULT_PROFILE": "default_profile", }, - Region: "default_region", Profile: "default_profile", + Config: envConfig{ + Region: "default_region", Profile: "default_profile", + EnableSharedConfig: true, + }, UseSharedConfigCall: true, }, { @@ -180,22 +203,40 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_DEFAULT_PROFILE": "default_profile", "AWS_SDK_LOAD_CONFIG": "1", }, - Region: "default_region", Profile: "default_profile", + Config: envConfig{ + Region: "default_region", Profile: "default_profile", + EnableSharedConfig: true, + }, UseSharedConfigCall: true, }, { Env: map[string]string{ "AWS_CA_BUNDLE": "custom_ca_bundle", }, - CustomCABundle: "custom_ca_bundle", + Config: envConfig{ + CustomCABundle: "custom_ca_bundle", + }, }, { Env: map[string]string{ "AWS_CA_BUNDLE": "custom_ca_bundle", }, - CustomCABundle: "custom_ca_bundle", + Config: envConfig{ + CustomCABundle: "custom_ca_bundle", + EnableSharedConfig: true, + }, UseSharedConfigCall: true, }, + { + Env: map[string]string{ + "AWS_SHARED_CREDENTIALS_FILE": "/path/to/credentials/file", + "AWS_CONFIG_FILE": "/path/to/config/file", + }, + Config: envConfig{ + SharedCredentialsFile: "/path/to/credentials/file", + SharedConfigFile: "/path/to/config/file", + }, + }, } for _, c := range cases { @@ -212,55 +253,16 @@ func TestLoadEnvConfig(t *testing.T) { cfg = loadEnvConfig() } - assert.Equal(t, c.Region, cfg.Region) - assert.Equal(t, c.Profile, cfg.Profile) - assert.Equal(t, c.CustomCABundle, cfg.CustomCABundle) + if !reflect.DeepEqual(c.Config, cfg) { + t.Errorf("expect config to match.\n%s", + awstesting.SprintExpectActual(c.Config, cfg)) + } } } -func TestSharedCredsFilename(t *testing.T) { - env := stashEnv() - defer popEnv(env) - - os.Setenv("USERPROFILE", "profile_dir") - expect := filepath.Join("profile_dir", ".aws", "credentials") - name := sharedCredentialsFilename() - assert.Equal(t, expect, name) - - os.Setenv("HOME", "home_dir") - expect = filepath.Join("home_dir", ".aws", "credentials") - name = sharedCredentialsFilename() - assert.Equal(t, expect, name) - - expect = filepath.Join("path/to/credentials/file") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", expect) - name = sharedCredentialsFilename() - assert.Equal(t, expect, name) -} - -func TestSharedConfigFilename(t *testing.T) { - env := stashEnv() - defer popEnv(env) - - os.Setenv("USERPROFILE", "profile_dir") - expect := filepath.Join("profile_dir", ".aws", "config") - name := sharedConfigFilename() - assert.Equal(t, expect, name) - - os.Setenv("HOME", "home_dir") - expect = filepath.Join("home_dir", ".aws", "config") - name = sharedConfigFilename() - assert.Equal(t, expect, name) - - expect = filepath.Join("path/to/config/file") - os.Setenv("AWS_CONFIG_FILE", expect) - name = sharedConfigFilename() - assert.Equal(t, expect, name) -} - func TestSetEnvValue(t *testing.T) { - env := stashEnv() - defer popEnv(env) + env := awstesting.StashEnv() + defer awstesting.PopEnv(env) os.Setenv("empty_key", "") os.Setenv("second_key", "2") @@ -271,21 +273,7 @@ func TestSetEnvValue(t *testing.T) { "empty_key", "first_key", "second_key", "third_key", }) - assert.Equal(t, "2", dst) -} - -func stashEnv() []string { - env := os.Environ() - os.Clearenv() - - return env -} - -func popEnv(env []string) { - os.Clearenv() - - for _, e := range env { - p := strings.SplitN(e, "=", 2) - os.Setenv(p[0], p[1]) + if e, a := "2", dst; e != a { + t.Errorf("expect %s value from environment, got %s", e, a) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 96c740d0..9f75d5ac 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -155,6 +155,10 @@ type Options struct { // and enable or disable the shared config functionality. SharedConfigState SharedConfigState + // Ordered list of files the session will load configuration from. + // It will override environment variable AWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE. + SharedConfigFiles []string + // When the SDK's shared config is configured to assume a role with MFA // this option is required in order to provide the mechanism that will // retrieve the MFA token. There is no default value for this field. If @@ -218,7 +222,7 @@ type Options struct { // // // Force enable Shared Config support // sess := session.Must(session.NewSessionWithOptions(session.Options{ -// SharedConfigState: SharedConfigEnable, +// SharedConfigState: session.SharedConfigEnable, // })) func NewSessionWithOptions(opts Options) (*Session, error) { var envCfg envConfig @@ -239,6 +243,13 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg.EnableSharedConfig = true } + if len(envCfg.SharedCredentialsFile) == 0 { + envCfg.SharedCredentialsFile = defaults.SharedCredentialsFilename() + } + if len(envCfg.SharedConfigFile) == 0 { + envCfg.SharedConfigFile = defaults.SharedConfigFilename() + } + // Only use AWS_CA_BUNDLE if session option is not provided. if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { f, err := os.Open(envCfg.CustomCABundle) @@ -304,13 +315,18 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, userCfg := &aws.Config{} userCfg.MergeIn(cfgs...) - // Order config files will be loaded in with later files overwriting + // Ordered config files will be loaded in with later files overwriting // previous config file values. - cfgFiles := []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} - if !envCfg.EnableSharedConfig { - // The shared config file (~/.aws/config) is only loaded if instructed - // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). - cfgFiles = cfgFiles[1:] + var cfgFiles []string + if opts.SharedConfigFiles != nil { + cfgFiles = opts.SharedConfigFiles + } else { + cfgFiles = []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} + if !envCfg.EnableSharedConfig { + // The shared config file (~/.aws/config) is only loaded if instructed + // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). + cfgFiles = cfgFiles[1:] + } } // Load additional config from file(s) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go index 877af02e..d0ab360e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go @@ -14,12 +14,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/service/s3" ) func TestNewDefaultSession(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) s := New(&aws.Config{Region: aws.String("region")}) @@ -31,7 +32,7 @@ func TestNewDefaultSession(t *testing.T) { func TestNew_WithCustomCreds(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) customCreds := credentials.NewStaticCredentials("AKID", "SECRET", "TOKEN") s := New(&aws.Config{Credentials: customCreds}) @@ -49,7 +50,7 @@ func (w mockLogger) Log(args ...interface{}) { func TestNew_WithSessionLoadError(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_SDK_LOAD_CONFIG", "1") os.Setenv("AWS_CONFIG_FILE", testConfigFilename) @@ -72,7 +73,7 @@ func TestNew_WithSessionLoadError(t *testing.T) { func TestSessionCopy(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_REGION", "orig_region") @@ -100,7 +101,7 @@ func TestSessionClientConfig(t *testing.T) { func TestNewSession_NoCredentials(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) s, err := NewSession() assert.NoError(t, err) @@ -111,7 +112,7 @@ func TestNewSession_NoCredentials(t *testing.T) { func TestNewSessionWithOptions_OverrideProfile(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_SDK_LOAD_CONFIG", "1") os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) @@ -134,7 +135,7 @@ func TestNewSessionWithOptions_OverrideProfile(t *testing.T) { func TestNewSessionWithOptions_OverrideSharedConfigEnable(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_SDK_LOAD_CONFIG", "0") os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) @@ -157,7 +158,7 @@ func TestNewSessionWithOptions_OverrideSharedConfigEnable(t *testing.T) { func TestNewSessionWithOptions_OverrideSharedConfigDisable(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_SDK_LOAD_CONFIG", "1") os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) @@ -178,6 +179,29 @@ func TestNewSessionWithOptions_OverrideSharedConfigDisable(t *testing.T) { assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") } +func TestNewSessionWithOptions_OverrideSharedConfigFiles(t *testing.T) { + oldEnv := initSessionTestEnv() + defer awstesting.PopEnv(oldEnv) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "config_file_load_order") + + s, err := NewSessionWithOptions(Options{ + SharedConfigFiles: []string{testConfigOtherFilename}, + }) + assert.NoError(t, err) + + assert.Equal(t, "shared_config_other_region", *s.Config.Region) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "shared_config_other_akid", creds.AccessKeyID) + assert.Equal(t, "shared_config_other_secret", creds.SecretAccessKey) + assert.Empty(t, creds.SessionToken) + assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") +} + func TestNewSessionWithOptions_Overrides(t *testing.T) { cases := []struct { InEnvs map[string]string @@ -235,7 +259,7 @@ func TestNewSessionWithOptions_Overrides(t *testing.T) { for _, c := range cases { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) for k, v := range c.InEnvs { os.Setenv(k, v) @@ -279,7 +303,7 @@ const assumeRoleRespMsg = ` func TestSesisonAssumeRole(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_REGION", "us-east-1") os.Setenv("AWS_SDK_LOAD_CONFIG", "1") @@ -302,7 +326,7 @@ func TestSesisonAssumeRole(t *testing.T) { func TestSessionAssumeRole_WithMFA(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_REGION", "us-east-1") os.Setenv("AWS_SDK_LOAD_CONFIG", "1") @@ -345,7 +369,7 @@ func TestSessionAssumeRole_WithMFA(t *testing.T) { func TestSessionAssumeRole_WithMFA_NoTokenProvider(t *testing.T) { oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_REGION", "us-east-1") os.Setenv("AWS_SDK_LOAD_CONFIG", "1") @@ -363,7 +387,7 @@ func TestSessionAssumeRole_DisableSharedConfig(t *testing.T) { // Backwards compatibility with Shared config disabled // assume role should not be built into the config. oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_SDK_LOAD_CONFIG", "0") os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) @@ -383,7 +407,7 @@ func TestSessionAssumeRole_InvalidSourceProfile(t *testing.T) { // Backwards compatibility with Shared config disabled // assume role should not be built into the config. oldEnv := initSessionTestEnv() - defer popEnv(oldEnv) + defer awstesting.PopEnv(oldEnv) os.Setenv("AWS_SDK_LOAD_CONFIG", "1") os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) @@ -396,7 +420,7 @@ func TestSessionAssumeRole_InvalidSourceProfile(t *testing.T) { } func initSessionTestEnv() (oldEnv []string) { - oldEnv = stashEnv() + oldEnv = awstesting.StashEnv() os.Setenv("AWS_CONFIG_FILE", "file_not_exists") os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "file_not_exists") diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go index b58076f5..09c8e5bc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go @@ -113,7 +113,7 @@ func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { f, err := ini.Load(b) if err != nil { - return nil, SharedConfigLoadError{Filename: filename} + return nil, SharedConfigLoadError{Filename: filename, Err: err} } files = append(files, sharedConfigFile{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go index 9b6b0be2..c5341a93 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go @@ -3,6 +3,8 @@ package v4_test import ( "net/http" "net/url" + "reflect" + "strings" "testing" "time" @@ -10,7 +12,6 @@ import ( "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" ) var standaloneSignCases = []struct { @@ -40,24 +41,43 @@ func TestPresignHandler(t *testing.T) { req.Time = time.Unix(0, 0) urlstr, err := req.Presign(5 * time.Minute) - assert.NoError(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } expectedHost := "bucket.s3.mock-region.amazonaws.com" expectedDate := "19700101T000000Z" expectedHeaders := "content-disposition;host;x-amz-acl" - expectedSig := "2d76a414208c0eac2a23ef9c834db9635ecd5a0fbb447a00ad191f82d854f55b" + expectedSig := "a46583256431b09eb45ba4af2e6286d96a9835ed13721023dc8076dfdcb90fcb" expectedCred := "AKID/19700101/mock-region/s3/aws4_request" u, _ := url.Parse(urlstr) urlQ := u.Query() - assert.Equal(t, expectedHost, u.Host) - assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) - assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) + if e, a := expectedHost, u.Host; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedSig, urlQ.Get("X-Amz-Signature"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedCred, urlQ.Get("X-Amz-Credential"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedDate, urlQ.Get("X-Amz-Date"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "300", urlQ.Get("X-Amz-Expires"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "UNSIGNED-PAYLOAD", urlQ.Get("X-Amz-Content-Sha256"); e != a { + t.Errorf("expect %v, got %v", e, a) + } - assert.NotContains(t, urlstr, "+") // + encoded as %20 + if e, a := "+", urlstr; strings.Contains(a, e) { // + encoded as %20 + t.Errorf("expect %v not to be in %v", e, a) + } } func TestPresignRequest(t *testing.T) { @@ -71,30 +91,50 @@ func TestPresignRequest(t *testing.T) { req.Time = time.Unix(0, 0) urlstr, headers, err := req.PresignRequest(5 * time.Minute) - assert.NoError(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } expectedHost := "bucket.s3.mock-region.amazonaws.com" expectedDate := "19700101T000000Z" - expectedHeaders := "content-disposition;host;x-amz-acl;x-amz-content-sha256" - expectedSig := "a5b2b500dfbf2eab5b4f55bec3e3752e04536ea1d5c047aa93bc9f1130a72cd2" + expectedHeaders := "content-disposition;host;x-amz-acl" + expectedSig := "a46583256431b09eb45ba4af2e6286d96a9835ed13721023dc8076dfdcb90fcb" expectedCred := "AKID/19700101/mock-region/s3/aws4_request" expectedHeaderMap := http.Header{ - "x-amz-acl": []string{"public-read"}, - "content-disposition": []string{"a+b c$d"}, - "x-amz-content-sha256": []string{"UNSIGNED-PAYLOAD"}, + "x-amz-acl": []string{"public-read"}, + "content-disposition": []string{"a+b c$d"}, } u, _ := url.Parse(urlstr) urlQ := u.Query() - assert.Equal(t, expectedHost, u.Host) - assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) - assert.Equal(t, expectedHeaderMap, headers) - assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) + if e, a := expectedHost, u.Host; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedSig, urlQ.Get("X-Amz-Signature"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedCred, urlQ.Get("X-Amz-Credential"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedDate, urlQ.Get("X-Amz-Date"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedHeaderMap, headers; !reflect.DeepEqual(e, a) { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "300", urlQ.Get("X-Amz-Expires"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := "UNSIGNED-PAYLOAD", urlQ.Get("X-Amz-Content-Sha256"); e != a { + t.Errorf("expect %v, got %v", e, a) + } - assert.NotContains(t, urlstr, "+") // + encoded as %20 + if e, a := "+", urlstr; strings.Contains(a, e) { // + encoded as %20 + t.Errorf("expect %v not to be in %v", e, a) + } } func TestStandaloneSign_CustomURIEscape(t *testing.T) { @@ -107,14 +147,20 @@ func TestStandaloneSign_CustomURIEscape(t *testing.T) { host := "https://subdomain.us-east-1.es.amazonaws.com" req, err := http.NewRequest("GET", host, nil) - assert.NoError(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } req.URL.Path = `/log-*/_search` req.URL.Opaque = "//subdomain.us-east-1.es.amazonaws.com/log-%2A/_search" _, err = signer.Sign(req, nil, "es", "us-east-1", time.Unix(0, 0)) - assert.NoError(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } actual := req.Header.Get("Authorization") - assert.Equal(t, expectSig, actual) + if e, a := expectSig, actual; e != a { + t.Errorf("expect %v, got %v", e, a) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 434ac872..15da5724 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -45,7 +45,7 @@ // If signing a request intended for HTTP2 server, and you're using Go 1.6.2 // through 1.7.4 you should use the URL.RawPath as the pre-escaped form of the // request URL. https://github.com/golang/go/issues/16847 points to a bug in -// Go pre 1.8 that failes to make HTTP2 requests using absolute URL in the HTTP +// Go pre 1.8 that fails to make HTTP2 requests using absolute URL in the HTTP // message. URL.Opaque generally will force Go to make requests with absolute URL. // URL.RawPath does not do this, but RawPath must be a valid escaping of Path // or url.EscapedPath will ignore the RawPath escaping. @@ -55,7 +55,6 @@ package v4 import ( - "bytes" "crypto/hmac" "crypto/sha256" "encoding/hex" @@ -402,7 +401,7 @@ var SignRequestHandler = request.NamedHandler{ } // SignSDKRequest signs an AWS request with the V4 signature. This -// request handler is bested used only with the SDK's built in service client's +// request handler should only be used with the SDK's built in service client's // API operation requests. // // This function should not be used on its on its own, but in conjunction with @@ -503,6 +502,8 @@ func (ctx *signingCtx) build(disableHeaderHoisting bool) { ctx.buildTime() // no depends ctx.buildCredentialString() // no depends + ctx.buildBodyDigest() + unsignedHeaders := ctx.Request.Header if ctx.isPresign { if !disableHeaderHoisting { @@ -514,7 +515,6 @@ func (ctx *signingCtx) build(disableHeaderHoisting bool) { } } - ctx.buildBodyDigest() ctx.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) ctx.buildCanonicalString() // depends on canon headers / signed headers ctx.buildStringToSign() // depends on canon string @@ -604,14 +604,18 @@ func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { headerValues := make([]string, len(headers)) for i, k := range headers { if k == "host" { - headerValues[i] = "host:" + ctx.Request.URL.Host + if ctx.Request.Host != "" { + headerValues[i] = "host:" + ctx.Request.Host + } else { + headerValues[i] = "host:" + ctx.Request.URL.Host + } } else { headerValues[i] = k + ":" + strings.Join(ctx.SignedHeaderVals[k], ",") } } - - ctx.canonicalHeaders = strings.Join(stripExcessSpaces(headerValues), "\n") + stripExcessSpaces(headerValues) + ctx.canonicalHeaders = strings.Join(headerValues, "\n") } func (ctx *signingCtx) buildCanonicalString() { @@ -713,49 +717,46 @@ func makeSha256Reader(reader io.ReadSeeker) []byte { return hash.Sum(nil) } -const doubleSpaces = " " +const doubleSpace = " " -var doubleSpaceBytes = []byte(doubleSpaces) +// stripExcessSpaces will rewrite the passed in slice's string values to not +// contain muliple side-by-side spaces. +func stripExcessSpaces(vals []string) { + var j, k, l, m, spaces int + for i, str := range vals { + // Trim trailing spaces + for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { + } -func stripExcessSpaces(headerVals []string) []string { - vals := make([]string, len(headerVals)) - for i, str := range headerVals { - // Trim leading and trailing spaces - trimmed := strings.TrimSpace(str) + // Trim leading spaces + for k = 0; k < j && str[k] == ' '; k++ { + } + str = str[k : j+1] - idx := strings.Index(trimmed, doubleSpaces) - var buf []byte - for idx > -1 { - // Multiple adjacent spaces found - if buf == nil { - // first time create the buffer - buf = []byte(trimmed) - } + // Strip multiple spaces. + j = strings.Index(str, doubleSpace) + if j < 0 { + vals[i] = str + continue + } - stripToIdx := -1 - for j := idx + 1; j < len(buf); j++ { - if buf[j] != ' ' { - buf = append(buf[:idx+1], buf[j:]...) - stripToIdx = j - break - } - } - - if stripToIdx >= 0 { - idx = bytes.Index(buf[stripToIdx:], doubleSpaceBytes) - if idx >= 0 { - idx += stripToIdx + buf := []byte(str) + for k, m, l = j, j, len(buf); k < l; k++ { + if buf[k] == ' ' { + if spaces == 0 { + // First space. + buf[m] = buf[k] + m++ } + spaces++ } else { - idx = -1 + // End of multiple spaces. + spaces = 0 + buf[m] = buf[k] + m++ } } - if buf != nil { - vals[i] = string(buf) - } else { - vals[i] = trimmed - } + vals[i] = string(buf[:m]) } - return vals } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go index 72763fd0..45d0eb88 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go @@ -6,12 +6,11 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "reflect" "strings" "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" @@ -20,30 +19,44 @@ import ( func TestStripExcessHeaders(t *testing.T) { vals := []string{ + "", "123", "1 2 3", + "1 2 3 ", " 1 2 3", "1 2 3", "1 23", "1 2 3", "1 2 ", " 1 2 ", + "12 3", + "12 3 1", + "12 3 1", + "12 3 1abc123", } expected := []string{ + "", "123", "1 2 3", "1 2 3", "1 2 3", + "1 2 3", "1 23", "1 2 3", "1 2", "1 2", + "12 3", + "12 3 1", + "12 3 1", + "12 3 1abc123", } - newVals := stripExcessSpaces(vals) - for i := 0; i < len(newVals); i++ { - assert.Equal(t, expected[i], newVals[i], "test: %d", i) + stripExcessSpaces(vals) + for i := 0; i < len(vals); i++ { + if e, a := expected[i], vals[i]; e != a { + t.Errorf("%d, expect %v, got %v", i, e, a) + } } } @@ -93,12 +106,24 @@ func TestPresignRequest(t *testing.T) { expectedTarget := "prefix.Operation" q := req.URL.Query() - assert.Equal(t, expectedSig, q.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, q.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) - assert.Empty(t, q.Get("X-Amz-Meta-Other-Header")) - assert.Equal(t, expectedTarget, q.Get("X-Amz-Target")) + if e, a := expectedSig, q.Get("X-Amz-Signature"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedCred, q.Get("X-Amz-Credential"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedHeaders, q.Get("X-Amz-SignedHeaders"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if a := q.Get("X-Amz-Meta-Other-Header"); len(a) != 0 { + t.Errorf("expect %v to be empty", a) + } + if e, a := expectedTarget, q.Get("X-Amz-Target"); e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestPresignBodyWithArrayRequest(t *testing.T) { @@ -115,12 +140,24 @@ func TestPresignBodyWithArrayRequest(t *testing.T) { expectedTarget := "prefix.Operation" q := req.URL.Query() - assert.Equal(t, expectedSig, q.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, q.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) - assert.Empty(t, q.Get("X-Amz-Meta-Other-Header")) - assert.Equal(t, expectedTarget, q.Get("X-Amz-Target")) + if e, a := expectedSig, q.Get("X-Amz-Signature"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedCred, q.Get("X-Amz-Credential"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedHeaders, q.Get("X-Amz-SignedHeaders"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if a := q.Get("X-Amz-Meta-Other-Header"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } + if e, a := expectedTarget, q.Get("X-Amz-Target"); e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestSignRequest(t *testing.T) { @@ -132,8 +169,12 @@ func TestSignRequest(t *testing.T) { expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore;x-amz-security-token;x-amz-target, Signature=ea766cabd2ec977d955a3c2bae1ae54f4515d70752f2207618396f20aa85bd21" q := req.Header - assert.Equal(t, expectedSig, q.Get("Authorization")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) + if e, a := expectedSig, q.Get("Authorization"); e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestSignBodyS3(t *testing.T) { @@ -141,7 +182,9 @@ func TestSignBodyS3(t *testing.T) { signer := buildSigner() signer.Sign(req, body, "s3", "us-east-1", time.Now()) hash := req.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) + if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestSignBodyGlacier(t *testing.T) { @@ -149,7 +192,9 @@ func TestSignBodyGlacier(t *testing.T) { signer := buildSigner() signer.Sign(req, body, "glacier", "us-east-1", time.Now()) hash := req.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) + if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestPresignEmptyBodyS3(t *testing.T) { @@ -157,7 +202,9 @@ func TestPresignEmptyBodyS3(t *testing.T) { signer := buildSigner() signer.Presign(req, body, "s3", "us-east-1", 5*time.Minute, time.Now()) hash := req.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "UNSIGNED-PAYLOAD", hash) + if e, a := "UNSIGNED-PAYLOAD", hash; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestSignPrecomputedBodyChecksum(t *testing.T) { @@ -166,7 +213,9 @@ func TestSignPrecomputedBodyChecksum(t *testing.T) { signer := buildSigner() signer.Sign(req, body, "dynamodb", "us-east-1", time.Now()) hash := req.Header.Get("X-Amz-Content-Sha256") - assert.Equal(t, "PRECOMPUTED", hash) + if e, a := "PRECOMPUTED", hash; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestAnonymousCredentials(t *testing.T) { @@ -183,14 +232,26 @@ func TestAnonymousCredentials(t *testing.T) { SignSDKRequest(r) urlQ := r.HTTPRequest.URL.Query() - assert.Empty(t, urlQ.Get("X-Amz-Signature")) - assert.Empty(t, urlQ.Get("X-Amz-Credential")) - assert.Empty(t, urlQ.Get("X-Amz-SignedHeaders")) - assert.Empty(t, urlQ.Get("X-Amz-Date")) + if a := urlQ.Get("X-Amz-Signature"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } + if a := urlQ.Get("X-Amz-Credential"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } + if a := urlQ.Get("X-Amz-SignedHeaders"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } + if a := urlQ.Get("X-Amz-Date"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } hQ := r.HTTPRequest.Header - assert.Empty(t, hQ.Get("Authorization")) - assert.Empty(t, hQ.Get("X-Amz-Date")) + if a := hQ.Get("Authorization"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } + if a := hQ.Get("X-Amz-Date"); len(a) != 0 { + t.Errorf("expect %v to be empty, was not", a) + } } func TestIgnoreResignRequestWithValidCreds(t *testing.T) { @@ -216,7 +277,9 @@ func TestIgnoreResignRequestWithValidCreds(t *testing.T) { // when it is resigned. return time.Now().Add(1 * time.Second) }) - assert.NotEqual(t, sig, r.HTTPRequest.Header.Get("Authorization")) + if e, a := sig, r.HTTPRequest.Header.Get("Authorization"); e == a { + t.Errorf("expect %v to be %v, but was not", e, a) + } } func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { @@ -243,7 +306,9 @@ func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { // when it is resigned. return time.Now().Add(1 * time.Second) }) - assert.NotEqual(t, sig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature")) + if e, a := sig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"); e == a { + t.Errorf("expect %v to be %v, but was not", e, a) + } } func TestResignRequestExpiredCreds(t *testing.T) { @@ -267,8 +332,12 @@ func TestResignRequestExpiredCreds(t *testing.T) { break } } - assert.NotEmpty(t, origSignedHeaders) - assert.NotContains(t, origSignedHeaders, "authorization") + if a := origSignedHeaders; len(a) == 0 { + t.Errorf("expect not to be empty, but was") + } + if e, a := origSignedHeaders, "authorization"; strings.Contains(a, e) { + t.Errorf("expect %v to not be in %v, but was", e, a) + } origSignedAt := r.LastSignedAt creds.Expire() @@ -279,7 +348,9 @@ func TestResignRequestExpiredCreds(t *testing.T) { return time.Now().Add(1 * time.Second) }) updatedQuerySig := r.HTTPRequest.Header.Get("Authorization") - assert.NotEqual(t, querySig, updatedQuerySig) + if e, a := querySig, updatedQuerySig; e == a { + t.Errorf("expect %v to be %v, was not", e, a) + } var updatedSignedHeaders string for _, p := range strings.Split(updatedQuerySig, ", ") { @@ -288,9 +359,15 @@ func TestResignRequestExpiredCreds(t *testing.T) { break } } - assert.NotEmpty(t, updatedSignedHeaders) - assert.NotContains(t, updatedQuerySig, "authorization") - assert.NotEqual(t, origSignedAt, r.LastSignedAt) + if a := updatedSignedHeaders; len(a) == 0 { + t.Errorf("expect not to be empty, but was") + } + if e, a := updatedQuerySig, "authorization"; strings.Contains(a, e) { + t.Errorf("expect %v to not be in %v, but was", e, a) + } + if e, a := origSignedAt, r.LastSignedAt; e == a { + t.Errorf("expect %v to be %v, was not", e, a) + } } func TestPreResignRequestExpiredCreds(t *testing.T) { @@ -315,7 +392,9 @@ func TestPreResignRequestExpiredCreds(t *testing.T) { SignSDKRequest(r) querySig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature") signedHeaders := r.HTTPRequest.URL.Query().Get("X-Amz-SignedHeaders") - assert.NotEmpty(t, signedHeaders) + if a := signedHeaders; len(a) == 0 { + t.Errorf("expect not to be empty, but was") + } origSignedAt := r.LastSignedAt creds.Expire() @@ -324,11 +403,19 @@ func TestPreResignRequestExpiredCreds(t *testing.T) { // Simulate the request occurred 15 minutes in the past return time.Now().Add(-48 * time.Hour) }) - assert.NotEqual(t, querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature")) + if e, a := querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"); e == a { + t.Errorf("expect %v to be %v, was not", e, a) + } resignedHeaders := r.HTTPRequest.URL.Query().Get("X-Amz-SignedHeaders") - assert.Equal(t, signedHeaders, resignedHeaders) - assert.NotContains(t, signedHeaders, "x-amz-signedHeaders") - assert.NotEqual(t, origSignedAt, r.LastSignedAt) + if e, a := signedHeaders, resignedHeaders; e != a { + t.Errorf("expect %v, got %v", e, a) + } + if e, a := signedHeaders, "x-amz-signedHeaders"; strings.Contains(a, e) { + t.Errorf("expect %v to not be in %v, but was", e, a) + } + if e, a := origSignedAt, r.LastSignedAt; e == a { + t.Errorf("expect %v to be %v, was not", e, a) + } } func TestResignRequestExpiredRequest(t *testing.T) { @@ -352,8 +439,12 @@ func TestResignRequestExpiredRequest(t *testing.T) { // Simulate the request occurred 15 minutes in the past return time.Now().Add(15 * time.Minute) }) - assert.NotEqual(t, querySig, r.HTTPRequest.Header.Get("Authorization")) - assert.NotEqual(t, origSignedAt, r.LastSignedAt) + if e, a := querySig, r.HTTPRequest.Header.Get("Authorization"); e == a { + t.Errorf("expect %v to be %v, was not", e, a) + } + if e, a := origSignedAt, r.LastSignedAt; e == a { + t.Errorf("expect %v to be %v, was not", e, a) + } } func TestSignWithRequestBody(t *testing.T) { @@ -365,19 +456,29 @@ func TestSignWithRequestBody(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { b, err := ioutil.ReadAll(r.Body) r.Body.Close() - assert.NoError(t, err) - assert.Equal(t, expectBody, b) + if err != nil { + t.Errorf("expect no error, got %v", err) + } + if e, a := expectBody, b; !reflect.DeepEqual(e, a) { + t.Errorf("expect %v, got %v", e, a) + } w.WriteHeader(http.StatusOK) })) req, err := http.NewRequest("POST", server.URL, nil) _, err = signer.Sign(req, bytes.NewReader(expectBody), "service", "region", time.Now()) - assert.NoError(t, err) + if err != nil { + t.Errorf("expect not no error, got %v", err) + } resp, err := http.DefaultClient.Do(req) - assert.NoError(t, err) - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Errorf("expect not no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestSignWithRequestBody_Overwrite(t *testing.T) { @@ -389,8 +490,12 @@ func TestSignWithRequestBody_Overwrite(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { b, err := ioutil.ReadAll(r.Body) r.Body.Close() - assert.NoError(t, err) - assert.Equal(t, len(expectBody), len(b)) + if err != nil { + t.Errorf("expect not no error, got %v", err) + } + if e, a := len(expectBody), len(b); e != a { + t.Errorf("expect %v, got %v", e, a) + } w.WriteHeader(http.StatusOK) })) @@ -399,11 +504,17 @@ func TestSignWithRequestBody_Overwrite(t *testing.T) { _, err = signer.Sign(req, nil, "service", "region", time.Now()) req.ContentLength = 0 - assert.NoError(t, err) + if err != nil { + t.Errorf("expect not no error, got %v", err) + } resp, err := http.DefaultClient.Do(req) - assert.NoError(t, err) - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Errorf("expect not no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestBuildCanonicalRequest(t *testing.T) { @@ -421,7 +532,9 @@ func TestBuildCanonicalRequest(t *testing.T) { ctx.buildCanonicalString() expected := "https://example.org/bucket/key-._~,!@#$%^&*()?Foo=z&Foo=o&Foo=m&Foo=a" - assert.Equal(t, expected, ctx.Request.URL.String()) + if e, a := expected, ctx.Request.URL.String(); e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestSignWithBody_ReplaceRequestBody(t *testing.T) { @@ -463,7 +576,27 @@ func TestSignWithBody_NoReplaceRequestBody(t *testing.T) { } if req.Body != origBody { - t.Errorf("expeect request body to not be chagned") + t.Errorf("expect request body to not be chagned") + } +} + +func TestRequestHost(t *testing.T) { + req, body := buildRequest("dynamodb", "us-east-1", "{}") + req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a" + req.Host = "myhost" + ctx := &signingCtx{ + ServiceName: "dynamodb", + Region: "us-east-1", + Request: req, + Body: body, + Query: req.URL.Query(), + Time: time.Now(), + ExpireTime: 5 * time.Second, + } + + ctx.buildCanonicalHeaders(ignoredHeaders, ctx.Request.Header) + if !strings.Contains(ctx.canonicalHeaders, "host:"+req.Host) { + t.Errorf("canonical host header invalid") } } @@ -483,15 +616,29 @@ func BenchmarkSignRequest(b *testing.B) { } } -func BenchmarkStripExcessSpaces(b *testing.B) { - vals := []string{ - `AWS4-HMAC-SHA256 Credential=AKIDFAKEIDFAKEID/20160628/us-west-2/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=1234567890abcdef1234567890abcdef1234567890abcdef`, - `123 321 123 321`, - ` 123 321 123 321 `, - } +var stripExcessSpaceCases = []string{ + `AWS4-HMAC-SHA256 Credential=AKIDFAKEIDFAKEID/20160628/us-west-2/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=1234567890abcdef1234567890abcdef1234567890abcdef`, + `123 321 123 321`, + ` 123 321 123 321 `, + ` 123 321 123 321 `, + "123", + "1 2 3", + " 1 2 3", + "1 2 3", + "1 23", + "1 2 3", + "1 2 ", + " 1 2 ", + "12 3", + "12 3 1", + "12 3 1", + "12 3 1abc123", +} - b.ResetTimer() +func BenchmarkStripExcessSpaces(b *testing.B) { for i := 0; i < b.N; i++ { - stripExcessSpaces(vals) + // Make sure to start with a copy of the cases + cases := append([]string{}, stripExcessSpaceCases...) + stripExcessSpaces(cases) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url.go b/vendor/github.com/aws/aws-sdk-go/aws/url.go new file mode 100644 index 00000000..6192b245 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/url.go @@ -0,0 +1,12 @@ +// +build go1.8 + +package aws + +import "net/url" + +// URLHostname will extract the Hostname without port from the URL value. +// +// Wrapper of net/url#URL.Hostname for backwards Go version compatibility. +func URLHostname(url *url.URL) string { + return url.Hostname() +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go new file mode 100644 index 00000000..0210d272 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go @@ -0,0 +1,29 @@ +// +build !go1.8 + +package aws + +import ( + "net/url" + "strings" +) + +// URLHostname will extract the Hostname without port from the URL value. +// +// Copy of Go 1.8's net/url#URL.Hostname functionality. +func URLHostname(url *url.URL) string { + return stripPort(url.Host) + +} + +// stripPort is copy of Go 1.8 url#URL.Hostname functionality. +// https://golang.org/src/net/url/url.go +func stripPort(hostport string) string { + colon := strings.IndexByte(hostport, ':') + if colon == -1 { + return hostport + } + if i := strings.IndexByte(hostport, ']'); i != -1 { + return strings.TrimPrefix(hostport[:i], "[") + } + return hostport[:colon] +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 8dc43fcd..31be8fd3 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.8.0" +const SDKVersion = "1.12.1" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go b/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go index 5494dc71..5d095d20 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go @@ -149,8 +149,8 @@ func objectsAreEqual(expected, actual interface{}) bool { // Copied locally to prevent non-test build dependencies on testify func equal(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool { if !objectsAreEqual(expected, actual) { - t.Errorf("Not Equal:\n\t%#v (expected)\n\t%#v (actual), %s", - expected, actual, messageFromMsgAndArgs(msgAndArgs)) + t.Errorf("%s\n%s", messageFromMsgAndArgs(msgAndArgs), + SprintExpectActual(expected, actual)) return false } @@ -188,3 +188,9 @@ func queryValueKeys(v url.Values) []string { sort.Strings(keys) return keys } + +// SprintExpectActual returns a string for test failure cases when the actual +// value is not the same as the expected. +func SprintExpectActual(expect, actual interface{}) string { + return fmt.Sprintf("expect: %+v\nactual: %+v\n", expect, actual) +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go b/vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go new file mode 100644 index 00000000..8425c39a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go @@ -0,0 +1,94 @@ +// +build integration + +package main + +import ( + "fmt" + "os" + "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" +) + +// Searches the buckets of an account that match the prefix, and deletes +// those buckets, and all objects within. Before deleting will prompt user +// to confirm bucket should be deleted. Positive confirmation is required. +// +// Usage: +// go run deleteBuckets.go +func main() { + sess := session.Must(session.NewSession()) + + svc := s3.New(sess) + buckets, err := svc.ListBuckets(&s3.ListBucketsInput{}) + if err != nil { + panic(fmt.Sprintf("failed to list buckets, %v", err)) + } + + if len(os.Args) < 2 { + fmt.Fprintln(os.Stderr, "bucket prefix required") + os.Exit(1) + } + bucketPrefix := os.Args[1] + + var failed bool + for _, b := range buckets.Buckets { + bucket := aws.StringValue(b.Name) + + if !strings.HasPrefix(bucket, bucketPrefix) { + continue + } + + fmt.Printf("Delete bucket %q? [y/N]: ", bucket) + var v string + if _, err := fmt.Scanln(&v); err != nil || !(v == "Y" || v == "y") { + fmt.Println("\tSkipping") + continue + } + + fmt.Println("\tDeleting") + if err := deleteBucket(svc, bucket); err != nil { + fmt.Fprintf(os.Stderr, "failed to delete bucket %q, %v", bucket, err) + failed = true + } + } + + if failed { + os.Exit(1) + } +} + +func deleteBucket(svc *s3.S3, bucket string) error { + bucketName := &bucket + + objs, err := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q objects, %v", bucketName, err) + } + + for _, o := range objs.Contents { + svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key}) + } + + uploads, err := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q multipart objects, %v", bucketName, err) + } + + for _, u := range uploads.Uploads { + svc.AbortMultipartUpload(&s3.AbortMultipartUploadInput{ + Bucket: bucketName, + Key: u.Key, + UploadId: u.UploadId, + }) + } + + _, err = svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to delete bucket %q, %v", bucketName, err) + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go b/vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go new file mode 100644 index 00000000..13edc7bc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go @@ -0,0 +1,199 @@ +package awstesting + +import ( + "io/ioutil" + "net" + "net/http" + "os" + "strings" + "time" +) + +func availableLocalAddr(ip string) (string, error) { + l, err := net.Listen("tcp", ip+":0") + if err != nil { + return "", err + } + defer l.Close() + + return l.Addr().String(), nil +} + +// CreateTLSServer will create the TLS server on an open port using the +// certificate and key. The address will be returned that the server is running on. +func CreateTLSServer(cert, key string, mux *http.ServeMux) (string, error) { + addr, err := availableLocalAddr("127.0.0.1") + if err != nil { + return "", err + } + + if mux == nil { + mux = http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {}) + } + + go func() { + if err := http.ListenAndServeTLS(addr, cert, key, mux); err != nil { + panic(err) + } + }() + + for i := 0; i < 60; i++ { + if _, err := http.Get("https://" + addr); err != nil && !strings.Contains(err.Error(), "connection refused") { + break + } + + time.Sleep(1 * time.Second) + } + + return "https://" + addr, nil +} + +// CreateTLSBundleFiles returns the temporary filenames for the certificate +// key, and CA PEM content. These files should be deleted when no longer +// needed. CleanupTLSBundleFiles can be used for this cleanup. +func CreateTLSBundleFiles() (cert, key, ca string, err error) { + cert, err = createTmpFile(TLSBundleCert) + if err != nil { + return "", "", "", err + } + + key, err = createTmpFile(TLSBundleKey) + if err != nil { + return "", "", "", err + } + + ca, err = createTmpFile(TLSBundleCA) + if err != nil { + return "", "", "", err + } + + return cert, key, ca, nil +} + +// CleanupTLSBundleFiles takes variadic list of files to be deleted. +func CleanupTLSBundleFiles(files ...string) error { + for _, file := range files { + if err := os.Remove(file); err != nil { + return err + } + } + + return nil +} + +func createTmpFile(b []byte) (string, error) { + bundleFile, err := ioutil.TempFile(os.TempDir(), "aws-sdk-go-session-test") + if err != nil { + return "", err + } + + _, err = bundleFile.Write(b) + if err != nil { + return "", err + } + + defer bundleFile.Close() + return bundleFile.Name(), nil +} + +/* Cert generation steps +# Create the CA key +openssl genrsa -des3 -out ca.key 1024 + +# Create the CA Cert +openssl req -new -sha256 -x509 -days 3650 \ + -subj "/C=GO/ST=Gopher/O=Testing ROOT CA" \ + -key ca.key -out ca.crt + +# Create config +cat > csr_details.txt <<-EOF + +[req] +default_bits = 1024 +prompt = no +default_md = sha256 +req_extensions = SAN +distinguished_name = dn + +[ dn ] +C=GO +ST=Gopher +O=Testing Certificate +OU=Testing IP + +[SAN] +subjectAltName = IP:127.0.0.1 +EOF + +# Create certificate signing request +openssl req -new -sha256 -nodes -newkey rsa:1024 \ + -config <( cat csr_details.txt ) \ + -keyout ia.key -out ia.csr + +# Create a signed certificate +openssl x509 -req -days 3650 \ + -CAcreateserial \ + -extfile <( cat csr_details.txt ) \ + -extensions SAN \ + -CA ca.crt -CAkey ca.key -in ia.csr -out ia.crt + +# Verify +openssl req -noout -text -in ia.csr +openssl x509 -noout -text -in ia.crt +*/ +var ( + // TLSBundleCA ca.crt + TLSBundleCA = []byte(`-----BEGIN CERTIFICATE----- +MIICiTCCAfKgAwIBAgIJAJ5X1olt05XjMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QTAeFw0xNzAzMDkwMDAyMDZaFw0yNzAzMDcwMDAyMDZaMDgxCzAJBgNVBAYTAkdP +MQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBDQTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw/8DN+t9XQR60jx42rsQ2WE2Dx85rb3n +GQxnKZZLNddsT8rDyxJNP18aFalbRbFlyln5fxWxZIblu9Xkm/HRhOpbSimSqo1y +uDx21NVZ1YsOvXpHby71jx3gPrrhSc/t/zikhi++6D/C6m1CiIGuiJ0GBiJxtrub +UBMXT0QtI2ECAwEAAaOBmjCBlzAdBgNVHQ4EFgQU8XG3X/YHBA6T04kdEkq6+4GV +YykwaAYDVR0jBGEwX4AU8XG3X/YHBA6T04kdEkq6+4GVYymhPKQ6MDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QYIJAJ5X1olt05XjMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADgYEAeILv +z49+uxmPcfOZzonuOloRcpdvyjiXblYxbzz6ch8GsE7Q886FTZbvwbgLhzdwSVgG +G8WHkodDUsymVepdqAamS3f8PdCUk8xIk9mop8LgaB9Ns0/TssxDvMr3sOD2Grb3 +xyWymTWMcj6uCiEBKtnUp4rPiefcvCRYZ17/hLE= +-----END CERTIFICATE----- +`) + + // TLSBundleCert ai.crt + TLSBundleCert = []byte(`-----BEGIN CERTIFICATE----- +MIICGjCCAYOgAwIBAgIJAIIu+NOoxxM0MA0GCSqGSIb3DQEBBQUAMDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QTAeFw0xNzAzMDkwMDAzMTRaFw0yNzAzMDcwMDAzMTRaMFExCzAJBgNVBAYTAkdP +MQ8wDQYDVQQIDAZHb3BoZXIxHDAaBgNVBAoME1Rlc3RpbmcgQ2VydGlmaWNhdGUx +EzARBgNVBAsMClRlc3RpbmcgSVAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AN1hWHeioo/nASvbrjwCQzXCiWiEzGkw353NxsAB54/NqDL3LXNATtiSJu8kJBrm +Ah12IFLtWLGXjGjjYlHbQWnOR6awveeXnQZukJyRWh7m/Qlt9Ho0CgZE1U+832ac +5GWVldNxW1Lz4I+W9/ehzqe8I80RS6eLEKfUFXGiW+9RAgMBAAGjEzARMA8GA1Ud +EQQIMAaHBH8AAAEwDQYJKoZIhvcNAQEFBQADgYEAdF4WQHfVdPCbgv9sxgJjcR1H +Hgw9rZ47gO1IiIhzglnLXQ6QuemRiHeYFg4kjcYBk1DJguxzDTGnUwhUXOibAB+S +zssmrkdYYvn9aUhjc3XK3tjAoDpsPpeBeTBamuUKDHoH/dNRXxerZ8vu6uPR3Pgs +5v/KCV6IAEcvNyOXMPo= +-----END CERTIFICATE----- +`) + + // TLSBundleKey ai.key + TLSBundleKey = []byte(`-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDdYVh3oqKP5wEr2648AkM1wolohMxpMN+dzcbAAeePzagy9y1z +QE7YkibvJCQa5gIddiBS7Vixl4xo42JR20FpzkemsL3nl50GbpCckVoe5v0JbfR6 +NAoGRNVPvN9mnORllZXTcVtS8+CPlvf3oc6nvCPNEUunixCn1BVxolvvUQIDAQAB +AoGBAMISrcirddGrlLZLLrKC1ULS2T0cdkqdQtwHYn4+7S5+/z42vMx1iumHLsSk +rVY7X41OWkX4trFxhvEIrc/O48bo2zw78P7flTxHy14uxXnllU8cLThE29SlUU7j +AVBNxJZMsXMlS/DowwD4CjFe+x4Pu9wZcReF2Z9ntzMpySABAkEA+iWoJCPE2JpS +y78q3HYYgpNY3gF3JqQ0SI/zTNkb3YyEIUffEYq0Y9pK13HjKtdsSuX4osTIhQkS ++UgRp6tCAQJBAOKPYTfQ2FX8ijgUpHZRuEAVaxASAS0UATiLgzXxLvOh/VC2at5x +wjOX6sD65pPz/0D8Qj52Cq6Q1TQ+377SDVECQAIy0od+yPweXxvrUjUd1JlRMjbB +TIrKZqs8mKbUQapw0bh5KTy+O1elU4MRPS3jNtBxtP25PQnuSnxmZcFTgAECQFzg +DiiFcsn9FuRagfkHExMiNJuH5feGxeFaP9WzI144v9GAllrOI6Bm3JNzx2ZLlg4b +20Qju8lIEj6yr6JYFaECQHM1VSojGRKpOl9Ox/R4yYSA9RV5Gyn00/aJNxVYyPD5 +i3acL2joQm2kLD/LO8paJ4+iQdRXCOMMIpjxSNjGQjQ= +-----END RSA PRIVATE KEY----- +`) +) diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go new file mode 100644 index 00000000..823b2c1d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go @@ -0,0 +1,27 @@ +// +build integration + +package s3manager + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/awstesting/integration" + "github.com/aws/aws-sdk-go/service/s3/s3manager" +) + +func TestGetBucketRegion(t *testing.T) { + expectRegion := aws.StringValue(integration.Session.Config.Region) + + ctx := aws.BackgroundContext() + region, err := s3manager.GetBucketRegion(ctx, integration.Session, + aws.StringValue(bucketName), expectRegion) + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + if e, a := expectRegion, region; e != a { + t.Errorf("expect %s bucket region, got %s", e, a) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go index 3a0dd600..87536435 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go @@ -1,6 +1,6 @@ // +build integration -// Package s3manager provides +// Package s3manager provides integration tests for the service/s3/s3manager package package s3manager import ( @@ -9,12 +9,13 @@ import ( "fmt" "io" "os" + "regexp" + "strings" "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/awstesting/integration" "github.com/aws/aws-sdk-go/service/s3" @@ -26,45 +27,64 @@ var integMD512MB = fmt.Sprintf("%x", md5.Sum(integBuf12MB)) var bucketName *string func TestMain(m *testing.M) { - setup() - defer teardown() // only called if we panic - result := m.Run() - teardown() - os.Exit(result) + if err := setup(); err != nil { + panic(fmt.Sprintf("failed to setup integration test, %v", err)) + } + + var result int + + defer func() { + if err := teardown(); err != nil { + fmt.Fprintf(os.Stderr, "teardown failed, %v", err) + } + if r := recover(); r != nil { + fmt.Println("S3Manager integration test hit a panic,", r) + result = 1 + } + os.Exit(result) + }() + + result = m.Run() } -func setup() { - // Create a bucket for testing +func setup() error { svc := s3.New(integration.Session) + + // Create a bucket for testing bucketName = aws.String( fmt.Sprintf("aws-sdk-go-integration-%d-%s", time.Now().Unix(), integration.UniqueID())) - for i := 0; i < 10; i++ { - _, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName}) - if err == nil { - break - } + _, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to create bucket %q, %v", *bucketName, err) } - for { - _, err := svc.HeadBucket(&s3.HeadBucketInput{Bucket: bucketName}) - if err == nil { - break - } - time.Sleep(1 * time.Second) + err = svc.WaitUntilBucketExists(&s3.HeadBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to wait for bucket %q to exist, %v", bucketName, err) } + + return nil } // Delete the bucket -func teardown() { +func teardown() error { svc := s3.New(integration.Session) - objs, _ := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) + objs, err := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q objects, %v", bucketName, err) + } + for _, o := range objs.Contents { svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key}) } - uploads, _ := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName}) + uploads, err := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q multipart objects, %v", bucketName, err) + } + for _, u := range uploads.Uploads { svc.AbortMultipartUpload(&s3.AbortMultipartUploadInput{ Bucket: bucketName, @@ -73,7 +93,12 @@ func teardown() { }) } - svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) + _, err = svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to delete bucket %q, %v", bucketName, err) + } + + return nil } type dlwriter struct { @@ -106,8 +131,12 @@ func validate(t *testing.T, key string, md5value string) { w := newDLWriter(1024 * 1024 * 20) n, err := mgr.Download(w, params) - assert.NoError(t, err) - assert.Equal(t, md5value, fmt.Sprintf("%x", md5.Sum(w.buf[0:n]))) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := md5value, fmt.Sprintf("%x", md5.Sum(w.buf[0:n])); e != a { + t.Errorf("expect %s md5 value, got %s", e, a) + } } func TestUploadConcurrently(t *testing.T) { @@ -119,9 +148,17 @@ func TestUploadConcurrently(t *testing.T) { Body: bytes.NewReader(integBuf12MB), }) - assert.NoError(t, err) - assert.NotEqual(t, "", out.UploadID) - assert.Regexp(t, `^https?://.+/`+key+`$`, out.Location) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if len(out.UploadID) == 0 { + t.Errorf("expect upload ID but was empty") + } + + re := regexp.MustCompile(`^https?://.+/` + key + `$`) + if e, a := re.String(), out.Location; !re.MatchString(a) { + t.Errorf("expect %s to match URL regexp %q, did not", e, a) + } validate(t, key, integMD512MB) } @@ -149,15 +186,25 @@ func TestUploadFailCleanup(t *testing.T) { Key: &key, Body: bytes.NewReader(integBuf12MB), }) - assert.Error(t, err) - assert.NotContains(t, err.Error(), "MissingRegion") - uploadID := "" - if merr, ok := err.(s3manager.MultiUploadFailure); ok { - uploadID = merr.UploadID() + if err == nil { + t.Fatalf("expect error, but did not get one") + } + + aerr := err.(awserr.Error) + if e, a := "MissingRegion", aerr.Code(); strings.Contains(a, e) { + t.Errorf("expect %q to not be in error code %q", e, a) + } + + uploadID := "" + merr := err.(s3manager.MultiUploadFailure) + if uploadID = merr.UploadID(); len(uploadID) == 0 { + t.Errorf("expect upload ID to not be empty, but was") } - assert.NotEmpty(t, uploadID) _, err = svc.ListParts(&s3.ListPartsInput{ - Bucket: bucketName, Key: &key, UploadId: &uploadID}) - assert.Error(t, err) + Bucket: bucketName, Key: &key, UploadId: &uploadID, + }) + if err == nil { + t.Errorf("expect error for list parts, but got none") + } } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.9 b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.9 new file mode 100644 index 00000000..24c9508f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.test.go1.9 @@ -0,0 +1,11 @@ +FROM ubuntu:12.04 +FROM golang:1.9 + +ADD . /go/src/github.com/aws/aws-sdk-go + +RUN apt-get update && apt-get install -y --no-install-recommends \ + vim \ + && rm -rf /var/list/apt/lists/* + +WORKDIR /go/src/github.com/aws/aws-sdk-go +CMD ["make", "unit"] diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go index fde4dcc4..3c146a23 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go @@ -2,6 +2,8 @@ package awstesting import ( "io" + "os" + "strings" "time" "github.com/aws/aws-sdk-go/private/util" @@ -92,3 +94,28 @@ func (c *FakeContext) Err() error { func (c *FakeContext) Value(key interface{}) interface{} { return nil } + +// StashEnv stashes the current environment variables and returns an array of +// all environment values as key=val strings. +func StashEnv() []string { + env := os.Environ() + os.Clearenv() + + return env +} + +// PopEnv takes the list of the environment values and injects them into the +// process's environment variable data. Clears any existing environment values +// that may already exist. +func PopEnv(env []string) { + os.Clearenv() + + for _, e := range env { + p := strings.SplitN(e, "=", 2) + k, v := p[0], "" + if len(p) > 1 { + v = p[1] + } + os.Setenv(k, v) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html b/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html index ba90a442..bdaff8ac 100644 --- a/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html +++ b/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html @@ -16,6 +16,25 @@ + + + + + + + +