From c80322924f651c829ef0be8c83518a06c38681c8 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Thu, 3 Nov 2016 23:54:12 -0400 Subject: [PATCH] Update aws-sdk-go to 1.5.2 --- _vendor/github.com/aws/aws-sdk-go | 2 +- vendor/github.com/aws/aws-sdk-go/.travis.yml | 1 + vendor/github.com/aws/aws-sdk-go/CHANGELOG.md | 151 + vendor/github.com/aws/aws-sdk-go/Makefile | 31 +- vendor/github.com/aws/aws-sdk-go/README.md | 15 +- .../aws/aws-sdk-go/aws/awserr/error.go | 4 +- .../aws/aws-sdk-go/aws/awserr/types.go | 2 +- .../aws/aws-sdk-go/aws/awsutil/copy.go | 10 +- .../aws/aws-sdk-go/aws/awsutil/copy_test.go | 38 +- .../aws/aws-sdk-go/aws/awsutil/path_value.go | 4 +- .../aws/aws-sdk-go/aws/client/client.go | 27 +- .../github.com/aws/aws-sdk-go/aws/config.go | 126 +- .../aws-sdk-go/aws/corehandlers/handlers.go | 30 + .../aws/corehandlers/handlers_test.go | 44 +- .../aws/corehandlers/param_validator_test.go | 4 +- .../aws/credentials/chain_provider.go | 2 +- .../ec2rolecreds/ec2_role_provider_test.go | 12 +- .../aws/credentials/static_provider.go | 11 +- .../aws/aws-sdk-go/aws/defaults/defaults.go | 9 +- .../aws-sdk-go/aws/defaults/defaults_test.go | 4 +- .../aws/aws-sdk-go/aws/ec2metadata/api.go | 22 + .../aws-sdk-go/aws/ec2metadata/api_test.go | 67 +- .../aws/ec2metadata/service_test.go | 13 +- .../aws-sdk-go/aws/request/handlers_test.go | 2 +- .../aws-sdk-go/aws/request/http_request.go | 21 +- .../aws/request/http_request_1_4.go | 31 - .../aws/request/http_request_retry_test.go | 4 +- .../aws-sdk-go/aws/request/offset_reader.go | 19 +- .../aws/request/offset_reader_test.go | 17 + .../aws/aws-sdk-go/aws/request/request.go | 50 +- .../aws/request/request_1_6_test.go | 2 +- .../aws/aws-sdk-go/aws/session/doc.go | 223 + .../aws/aws-sdk-go/aws/session/env_config.go | 188 + .../aws-sdk-go/aws/session/env_config_test.go | 276 + .../aws/aws-sdk-go/aws/session/session.go | 349 +- .../aws-sdk-go/aws/session/session_test.go | 330 +- .../aws-sdk-go/aws/session/shared_config.go | 295 + .../aws/session/shared_config_test.go | 264 + .../aws/session/testdata/shared_config | 60 + .../testdata/shared_config_invalid_ini | 1 + .../aws/session/testdata/shared_config_other | 17 + .../aws/signer/v4/functional_1_4_test.go | 40 + .../aws/signer/v4/functional_1_5_test.go | 40 + .../aws/signer/v4/functional_test.go | 39 + .../aws/aws-sdk-go/aws/signer/v4/uri_path.go | 24 + .../aws-sdk-go/aws/signer/v4/uri_path_1_4.go | 24 + .../aws/aws-sdk-go/aws/signer/v4/v4.go | 121 +- .../aws/aws-sdk-go/aws/signer/v4/v4_test.go | 85 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../awsmigrate/awsmigrate-renamer/gen/gen.go | 2 +- .../awsmigrate-renamer/rename/rename.go | 2 +- .../awsmigrate-renamer/rename/renames.go | 2 +- .../awsmigrate/awsmigrate-renamer/renamer.go | 4 +- .../aws/aws-sdk-go/awstesting/assert.go | 51 +- .../aws/aws-sdk-go/awstesting/client.go | 22 - .../customizations/s3/s3crypto/client.go | 29 + .../s3/s3crypto/s3_crypto.feature | 18 + .../customizations/s3/s3crypto/stepdef.go | 192 + .../s3/s3manager/integration_test.go | 6 +- .../awstesting/integration/integration.go | 2 +- .../integration/smoke/acm/client.go | 6 +- .../integration/smoke/apigateway/client.go | 6 +- .../applicationdiscoveryservice/client.go | 8 +- .../integration/smoke/autoscaling/client.go | 6 +- .../smoke/cloudformation/client.go | 6 +- .../integration/smoke/cloudfront/client.go | 6 +- .../integration/smoke/cloudhsm/client.go | 6 +- .../integration/smoke/cloudsearch/client.go | 6 +- .../integration/smoke/cloudtrail/client.go | 6 +- .../smoke/cloudtrail/cloudtrail.feature | 6 +- .../integration/smoke/cloudwatch/client.go | 6 +- .../smoke/cloudwatchlogs/client.go | 6 +- .../integration/smoke/codecommit/client.go | 6 +- .../integration/smoke/codedeploy/client.go | 6 +- .../integration/smoke/codepipeline/client.go | 6 +- .../smoke/cognitoidentity/client.go | 6 +- .../integration/smoke/cognitosync/client.go | 6 +- .../integration/smoke/configservice/client.go | 6 +- .../integration/smoke/datapipeline/client.go | 6 +- .../integration/smoke/devicefarm/client.go | 6 +- .../integration/smoke/directconnect/client.go | 6 +- .../smoke/directoryservice/client.go | 6 +- .../integration/smoke/dynamodb/client.go | 6 +- .../smoke/dynamodbstreams/client.go | 6 +- .../integration/smoke/ec2/client.go | 6 +- .../integration/smoke/ecs/client.go | 6 +- .../integration/smoke/efs/client.go | 6 +- .../integration/smoke/elasticache/client.go | 6 +- .../smoke/elasticbeanstalk/client.go | 6 +- .../smoke/elasticloadbalancing/client.go | 6 +- .../smoke/elastictranscoder/client.go | 6 +- .../integration/smoke/emr/client.go | 6 +- .../awstesting/integration/smoke/es/client.go | 6 +- .../integration/smoke/glacier/client.go | 6 +- .../integration/smoke/iam/client.go | 6 +- .../integration/smoke/iotdataplane/client.go | 8 +- .../smoke/iotdataplane/iotdataplane.feature | 9 +- .../integration/smoke/kinesis/client.go | 6 +- .../integration/smoke/kms/client.go | 6 +- .../integration/smoke/lambda/client.go | 6 +- .../smoke/machinelearning/client.go | 6 +- .../integration/smoke/opsworks/client.go | 6 +- .../integration/smoke/rds/client.go | 6 +- .../integration/smoke/redshift/client.go | 6 +- .../integration/smoke/route53/client.go | 6 +- .../smoke/route53domains/client.go | 6 +- .../integration/smoke/ses/client.go | 6 +- .../awstesting/integration/smoke/shared.go | 116 +- .../integration/smoke/simpledb/client.go | 6 +- .../integration/smoke/sns/client.go | 6 +- .../integration/smoke/sqs/client.go | 6 +- .../integration/smoke/ssm/client.go | 6 +- .../smoke/storagegateway/client.go | 6 +- .../integration/smoke/sts/client.go | 6 +- .../integration/smoke/support/client.go | 6 +- .../integration/smoke/swf/client.go | 6 +- .../integration/smoke/waf/client.go | 6 +- .../integration/smoke/workspaces/client.go | 6 +- .../aws/aws-sdk-go/awstesting/mock/mock.go | 43 + .../aws/aws-sdk-go/awstesting/mock/server.go | 20 - .../awstesting/performance/benchmarks.go | 2 +- .../awstesting/performance/client.go | 2 +- .../aws-sdk-go/awstesting/performance/init.go | 2 +- .../awstesting/performance/logging.go | 10 +- .../awstesting/sandbox/Dockerfile.golang-tip | 3 +- .../aws/aws-sdk-go/awstesting/unit/unit.go | 4 +- .../doc-src/aws-godoc/templates/codewalk.html | 3 - .../doc-src/aws-godoc/templates/godoc.html | 9 +- .../aws-godoc/templates/jquery.treeview.css | 19 - .../aws-godoc/templates/package_default.html | 1 - .../aws-godoc/templates/package_service.html | 6 + .../doc-src/aws-godoc/templates/pkglist.html | 4 +- .../doc-src/aws-godoc/templates/style.css | 2 - .../request/handleServiceErrorCodes/README.md | 17 + .../handleServiceErrorCodes.go | 69 + .../service/cloudfront/signCookies/README.md | 2 +- .../cloudfront/signCookies/signCookies.go | 6 +- .../service/dynamodb/scanItems/README.md | 46 + .../service/dynamodb/scanItems/scanItems.go | 101 + .../service/ec2/filterInstances/README.md | 31 + .../ec2/filterInstances/filter_ec2_by_tag.go | 46 + .../service/s3/concatObjects/README.md | 14 + .../service/s3/concatObjects/concatObjects.go | 104 + .../example/service/s3/listObjects/README.md | 2 +- .../service/s3/listObjects/listObjects.go | 17 +- .../s3/listObjectsConcurrently/README.md | 4 +- .../listObjectsConcurrently.go | 18 +- .../models/apis/acm/2015-12-08/api-2.json | 64 +- .../models/apis/acm/2015-12-08/docs-2.json | 66 +- .../apis/apigateway/2015-07-09/api-2.json | 624 +- .../apis/apigateway/2015-07-09/docs-2.json | 505 +- .../apigateway/2015-07-09/paginators-1.json | 18 + .../2016-02-06/api-2.json | 10 +- .../2016-02-06/docs-2.json | 48 +- .../2016-02-06/examples-1.json | 252 + .../apis/autoscaling/2011-01-01/api-2.json | 141 +- .../apis/autoscaling/2011-01-01/docs-2.json | 407 +- .../autoscaling/2011-01-01/examples-1.json | 1390 ++ .../models/apis/budgets/2016-10-20/api-2.json | 695 + .../apis/budgets/2016-10-20/docs-2.json | 416 + .../apis/budgets/2016-10-20/examples-1.json | 5 + .../apis/cloudformation/2010-05-15/api-2.json | 110 +- .../cloudformation/2010-05-15/docs-2.json | 118 +- .../cloudformation/2010-05-15/waiters-2.json | 118 +- .../apis/cloudfront/2016-08-01/api-2.json | 2547 ++ .../apis/cloudfront/2016-08-01/docs-2.json | 1355 ++ .../cloudfront/2016-08-01/examples-1.json | 5 + .../cloudfront/2016-08-01/paginators-1.json | 32 + .../apis/cloudfront/2016-08-01/waiters-2.json | 47 + .../apis/cloudfront/2016-08-20/api-2.json | 2585 ++ .../apis/cloudfront/2016-08-20/docs-2.json | 1381 ++ .../cloudfront/2016-08-20/paginators-1.json | 32 + .../apis/cloudfront/2016-08-20/waiters-2.json | 47 + .../apis/cloudfront/2016-09-07/api-2.json | 2595 ++ .../apis/cloudfront/2016-09-07/docs-2.json | 1388 ++ .../cloudfront/2016-09-07/examples-1.json | 5 + .../cloudfront/2016-09-07/paginators-1.json | 32 + .../apis/cloudfront/2016-09-07/waiters-2.json | 47 + .../apis/cloudfront/2016-09-29/api-2.json | 2598 ++ .../apis/cloudfront/2016-09-29/docs-2.json | 1390 ++ .../cloudfront/2016-09-29/examples-1.json | 5 + .../cloudfront/2016-09-29/paginators-1.json | 32 + .../apis/cloudfront/2016-09-29/waiters-2.json | 47 + .../apis/codedeploy/2014-10-06/api-2.json | 114 +- .../apis/codedeploy/2014-10-06/docs-2.json | 143 +- .../apis/codedeploy/2014-10-06/waiters-2.json | 30 + .../apis/codepipeline/2015-07-09/api-2.json | 84 +- .../apis/codepipeline/2015-07-09/docs-2.json | 75 +- .../codepipeline/2015-07-09/examples-1.json | 897 - .../apis/cognito-idp/2016-04-18/api-2.json | 1351 +- .../apis/cognito-idp/2016-04-18/docs-2.json | 716 +- .../models/apis/config/2014-11-12/api-2.json | 4 +- .../models/apis/config/2014-11-12/docs-2.json | 124 +- .../apis/devicefarm/2015-06-23/docs-2.json | 90 +- .../devicefarm/2015-06-23/examples-1.json | 1237 + .../apis/directconnect/2012-10-25/api-2.json | 143 + .../apis/directconnect/2012-10-25/docs-2.json | 104 +- .../models/apis/ds/2015-04-16/api-2.json | 155 + .../models/apis/ds/2015-04-16/docs-2.json | 127 +- .../models/apis/ec2/2016-04-01/api-2.json | 358 +- .../models/apis/ec2/2016-04-01/docs-2.json | 322 +- .../apis/ec2/2016-04-01/examples-1.json | 3724 +++ .../models/apis/ec2/2016-09-15/api-2.json | 14414 +++++++++++ .../models/apis/ec2/2016-09-15/docs-2.json | 6696 +++++ .../apis/ec2/2016-09-15/examples-1.json | 3740 +++ .../apis/ec2/2016-09-15/paginators-1.json | 138 + .../models/apis/ec2/2016-09-15/waiters-2.json | 593 + .../models/apis/ecr/2015-09-21/api-2.json | 88 +- .../models/apis/ecr/2015-09-21/docs-2.json | 106 +- .../apis/ecr/2015-09-21/examples-1.json | 210 + .../apis/ecr/2015-09-21/paginators-1.json | 22 + .../models/apis/ecs/2014-11-13/api-2.json | 21 +- .../models/apis/ecs/2014-11-13/docs-2.json | 121 +- .../apis/ecs/2014-11-13/examples-1.json | 878 + .../models/apis/ecs/2014-11-13/waiters-2.json | 2 +- .../apis/elasticache/2015-02-02/api-2.json | 59 +- .../apis/elasticache/2015-02-02/docs-2.json | 527 +- .../elasticbeanstalk/2010-12-01/api-2.json | 36 +- .../elasticbeanstalk/2010-12-01/docs-2.json | 320 +- .../elasticfilesystem/2015-02-01/docs-2.json | 2 +- .../2012-06-01/api-2.json | 824 +- .../2012-06-01/docs-2.json | 253 +- .../2012-06-01/examples-1.json | 1036 + .../2012-06-01/waiters-2.json | 88 +- .../2015-12-01/api-2.json | 1779 ++ .../2015-12-01/docs-2.json | 1191 + .../2015-12-01/examples-1.json | 1384 ++ .../2015-12-01/paginators-1.json | 20 + .../elasticmapreduce/2009-03-31/api-2.json | 140 +- .../elasticmapreduce/2009-03-31/docs-2.json | 264 +- .../models/apis/email/2010-12-01/api-2.json | 428 +- .../models/apis/email/2010-12-01/docs-2.json | 283 +- .../apis/email/2010-12-01/examples-1.json | 948 + .../models/apis/es/2015-01-01/api-2.json | 274 +- .../models/apis/es/2015-01-01/docs-2.json | 17 +- .../apis/gamelift/2015-10-01/api-2.json | 1114 +- .../apis/gamelift/2015-10-01/docs-2.json | 363 +- .../apis/gamelift/2015-10-01/examples-1.json | 4 +- .../models/apis/iam/2010-05-08/docs-2.json | 6 +- .../models/apis/iot/2015-05-28/api-2.json | 592 +- .../models/apis/iot/2015-05-28/docs-2.json | 330 +- .../kinesisanalytics/2015-08-14/api-2.json | 1048 + .../kinesisanalytics/2015-08-14/docs-2.json | 789 + .../2015-08-14/examples-1.json | 5 + .../models/apis/kms/2014-11-01/api-2.json | 169 +- .../models/apis/kms/2014-11-01/docs-2.json | 161 +- .../models/apis/lambda/2015-03-31/api-2.json | 23 +- .../models/apis/lambda/2015-03-31/docs-2.json | 179 +- .../models/apis/logs/2014-03-28/api-2.json | 5 +- .../models/apis/logs/2014-03-28/docs-2.json | 124 +- .../machinelearning/2014-12-12/api-2.json | 46 +- .../machinelearning/2014-12-12/docs-2.json | 36 +- .../2014-12-12/examples-1.json | 5 + .../2015-07-01/api-2.json | 47 + .../2015-07-01/docs-2.json | 43 +- .../meteringmarketplace/2016-01-14/api-2.json | 2 +- .../apis/monitoring/2010-08-01/docs-2.json | 288 +- .../apis/opsworks/2013-02-18/docs-2.json | 36 +- .../models/apis/rds/2014-10-31/api-2.json | 326 +- .../models/apis/rds/2014-10-31/docs-2.json | 235 +- .../apis/rds/2014-10-31/examples-1.json | 1856 ++ .../models/apis/rds/2014-10-31/waiters-2.json | 12 - .../apis/redshift/2012-12-01/api-2.json | 12 +- .../apis/redshift/2012-12-01/docs-2.json | 1032 +- .../apis/redshift/2012-12-01/waiters-2.json | 4 +- .../models/apis/route53/2013-04-01/api-2.json | 100 + .../apis/route53/2013-04-01/docs-2.json | 796 +- .../apis/route53domains/2014-05-15/api-2.json | 125 + .../route53domains/2014-05-15/docs-2.json | 111 +- .../models/apis/s3/2006-03-01/api-2.json | 31 + .../models/apis/s3/2006-03-01/docs-2.json | 13 +- .../apis/servicecatalog/2015-12-10/api-2.json | 23 +- .../servicecatalog/2015-12-10/docs-2.json | 65 +- .../models/apis/sms/2016-10-24/api-2.json | 611 + .../models/apis/sms/2016-10-24/docs-2.json | 492 + .../apis/sms/2016-10-24/examples-1.json | 5 + .../apis/sms/2016-10-24/paginators-1.json | 28 + .../apis/snowball/2016-06-30/api-2.json | 562 + .../apis/snowball/2016-06-30/docs-2.json | 414 + .../apis/snowball/2016-06-30/examples-1.json | 5 + .../snowball/2016-06-30/paginators-1.json | 16 + .../models/apis/sns/2010-03-31/api-2.json | 7 +- .../models/apis/sns/2010-03-31/docs-2.json | 42 +- .../apis/sns/2010-03-31/examples-1.json | 5 + .../apis/sqs/2012-11-05/examples-1.json | 596 +- .../models/apis/ssm/2014-11-06/docs-2.json | 12 +- .../models/apis/sts/2011-06-15/docs-2.json | 20 +- .../models/apis/support/2013-04-15/api-2.json | 192 +- .../apis/support/2013-04-15/docs-2.json | 119 +- .../apis/support/2013-04-15/examples-1.json | 5 + .../models/apis/waf/2015-08-24/api-2.json | 19 +- .../models/apis/waf/2015-08-24/docs-2.json | 144 +- .../apis/waf/2015-08-24/examples-1.json | 1036 + .../apis/workspaces/2015-04-08/api-2.json | 209 +- .../apis/workspaces/2015-04-08/docs-2.json | 204 +- .../models/protocol_tests/generate.go | 10 +- .../aws-sdk-go/private/endpoints/endpoints.go | 21 +- .../private/endpoints/endpoints.json | 7 + .../private/endpoints/endpoints_map.go | 7 + .../private/endpoints/endpoints_test.go | 22 +- .../aws/aws-sdk-go/private/model/api/api.go | 74 +- .../aws-sdk-go/private/model/api/api_test.go | 2 +- .../private/model/api/customization_passes.go | 2 + .../aws-sdk-go/private/model/api/docstring.go | 258 +- .../private/model/api/docstring_test.go | 82 + .../private/model/api/exportable_name.go | 2 + .../aws/aws-sdk-go/private/model/api/load.go | 2 + .../aws-sdk-go/private/model/api/load_test.go | 2 +- .../aws-sdk-go/private/model/api/operation.go | 48 +- .../private/model/api/pagination.go | 2 + .../private/model/api/param_filler.go | 2 + .../aws-sdk-go/private/model/api/passes.go | 8 + .../aws/aws-sdk-go/private/model/api/shape.go | 105 +- .../private/model/api/shape_validation.go | 2 + .../private/model/api/shapetag_test.go | 2 +- .../aws-sdk-go/private/model/api/waiters.go | 32 +- .../private/model/cli/api-info/api-info.go | 2 + .../private/model/cli/gen-api/main.go | 12 +- .../private/model/cli/gen-endpoints/main.go | 2 + .../aws/aws-sdk-go/private/model/endpoints.go | 2 + .../private/protocol/ec2query/build.go | 4 +- .../private/protocol/ec2query/build_test.go | 210 +- .../private/protocol/ec2query/unmarshal.go | 2 +- .../protocol/ec2query/unmarshal_test.go | 221 +- .../private/protocol/json/jsonutil/build.go | 4 +- .../private/protocol/jsonrpc/build_test.go | 256 +- .../private/protocol/jsonrpc/jsonrpc.go | 6 +- .../protocol/jsonrpc/unmarshal_test.go | 207 +- .../private/protocol/query/build.go | 4 +- .../private/protocol/query/build_test.go | 439 +- .../private/protocol/query/unmarshal.go | 2 +- .../private/protocol/query/unmarshal_test.go | 383 +- .../private/protocol/restjson/build_test.go | 633 +- .../private/protocol/restjson/restjson.go | 6 +- .../protocol/restjson/unmarshal_test.go | 319 +- .../private/protocol/restxml/build_test.go | 765 +- .../private/protocol/restxml/restxml.go | 6 +- .../protocol/restxml/unmarshal_test.go | 369 +- .../private/protocol/xml/xmlutil/build.go | 2 +- .../service/acm/acmiface/interface.go | 57 +- .../aws/aws-sdk-go/service/acm/api.go | 975 +- .../aws-sdk-go/service/acm/examples_test.go | 100 +- .../aws/aws-sdk-go/service/acm/service.go | 13 +- .../aws/aws-sdk-go/service/apigateway/api.go | 7878 +++++- .../apigateway/apigatewayiface/interface.go | 107 +- .../service/apigateway/examples_test.go | 1021 +- .../aws-sdk-go/service/apigateway/service.go | 10 +- .../service/applicationautoscaling/api.go | 993 +- .../applicationautoscalingiface/interface.go | 53 +- .../applicationautoscaling/examples_test.go | 56 +- .../service/applicationautoscaling/service.go | 35 +- .../applicationdiscoveryservice/api.go | 802 +- .../interface.go | 53 +- .../examples_test.go | 80 +- .../applicationdiscoveryservice/service.go | 181 +- .../aws/aws-sdk-go/service/autoscaling/api.go | 4520 +++- .../autoscaling/autoscalingiface/interface.go | 71 +- .../service/autoscaling/examples_test.go | 495 +- .../aws-sdk-go/service/autoscaling/waiters.go | 12 + .../aws/aws-sdk-go/service/budgets/api.go | 2953 +++ .../service/budgets/budgetsiface/interface.go | 115 + .../service/budgets/examples_test.go | 507 + .../aws/aws-sdk-go/service/budgets/service.go | 88 + .../aws-sdk-go/service/cloudformation/api.go | 2565 +- .../cloudformationiface/interface.go | 65 +- .../service/cloudformation/examples_test.go | 235 +- .../service/cloudformation/service.go | 15 +- .../service/cloudformation/waiters.go | 98 +- .../aws/aws-sdk-go/service/cloudfront/api.go | 5856 ++++- .../cloudfront/cloudfrontiface/interface.go | 79 +- .../service/cloudfront/examples_test.go | 611 +- .../aws-sdk-go/service/cloudfront/service.go | 7 +- .../service/cloudfront/sign/sign_cookie.go | 2 +- .../sign/sign_cookie_example_test.go | 4 +- .../aws-sdk-go/service/cloudfront/waiters.go | 12 + .../aws/aws-sdk-go/service/cloudhsm/api.go | 1158 +- .../cloudhsm/cloudhsmiface/interface.go | 53 +- .../service/cloudhsm/examples_test.go | 160 +- .../aws/aws-sdk-go/service/cloudsearch/api.go | 2293 +- .../cloudsearch/cloudsearchiface/interface.go | 53 +- .../service/cloudsearch/examples_test.go | 192 +- .../aws-sdk-go/service/cloudsearch/service.go | 3 +- .../service/cloudsearchdomain/api.go | 730 +- .../cloudsearchdomainiface/interface.go | 53 +- .../cloudsearchdomain/examples_test.go | 24 +- .../aws/aws-sdk-go/service/cloudtrail/api.go | 1440 +- .../cloudtrail/cloudtrailiface/interface.go | 53 +- .../service/cloudtrail/examples_test.go | 96 +- .../aws-sdk-go/service/cloudtrail/service.go | 4 +- .../aws/aws-sdk-go/service/cloudwatch/api.go | 1212 +- .../cloudwatch/cloudwatchiface/interface.go | 55 +- .../service/cloudwatch/examples_test.go | 88 +- .../aws-sdk-go/service/cloudwatch/waiters.go | 4 + .../service/cloudwatchevents/api.go | 782 +- .../cloudwatcheventsiface/interface.go | 53 +- .../service/cloudwatchevents/examples_test.go | 96 +- .../service/cloudwatchevents/service.go | 12 +- .../aws-sdk-go/service/cloudwatchlogs/api.go | 1883 +- .../cloudwatchlogsiface/interface.go | 53 +- .../service/cloudwatchlogs/examples_test.go | 201 +- .../service/cloudwatchlogs/service.go | 39 +- .../aws/aws-sdk-go/service/codecommit/api.go | 1235 +- .../codecommit/codecommitiface/interface.go | 53 +- .../service/codecommit/examples_test.go | 120 +- .../aws-sdk-go/service/codecommit/service.go | 53 +- .../aws/aws-sdk-go/service/codedeploy/api.go | 3330 ++- .../codedeploy/codedeployiface/interface.go | 55 +- .../service/codedeploy/examples_test.go | 327 +- .../aws-sdk-go/service/codedeploy/service.go | 63 +- .../aws-sdk-go/service/codedeploy/waiters.go | 46 + .../aws-sdk-go/service/codepipeline/api.go | 2608 +- .../codepipelineiface/interface.go | 57 +- .../service/codepipeline/examples_test.go | 234 +- .../service/codepipeline/service.go | 80 +- .../aws-sdk-go/service/cognitoidentity/api.go | 1219 +- .../cognitoidentityiface/interface.go | 53 +- .../service/cognitoidentity/examples_test.go | 144 +- .../service/cognitoidentityprovider/api.go | 8268 ++++++- .../cognitoidentityprovideriface/interface.go | 141 +- .../cognitoidentityprovider/examples_test.go | 1010 +- .../cognitoidentityprovider/service.go | 10 +- .../aws/aws-sdk-go/service/cognitosync/api.go | 1342 +- .../cognitosync/cognitosynciface/interface.go | 53 +- .../service/cognitosync/examples_test.go | 136 +- .../aws-sdk-go/service/configservice/api.go | 2245 +- .../configserviceiface/interface.go | 53 +- .../service/configservice/examples_test.go | 208 +- .../service/configservice/service.go | 6 +- .../service/databasemigrationservice/api.go | 2463 +- .../interface.go | 53 +- .../databasemigrationservice/examples_test.go | 256 +- .../aws-sdk-go/service/datapipeline/api.go | 1372 +- .../datapipelineiface/interface.go | 53 +- .../service/datapipeline/examples_test.go | 152 +- .../service/datapipeline/service.go | 12 +- .../aws/aws-sdk-go/service/devicefarm/api.go | 4018 ++- .../devicefarm/devicefarmiface/interface.go | 53 +- .../service/devicefarm/examples_test.go | 344 +- .../aws-sdk-go/service/directconnect/api.go | 2188 +- .../directconnectiface/interface.go | 65 +- .../service/directconnect/examples_test.go | 257 +- .../service/directoryservice/api.go | 2961 ++- .../directoryserviceiface/interface.go | 65 +- .../service/directoryservice/examples_test.go | 345 +- .../aws/aws-sdk-go/service/dynamodb/api.go | 4924 ++-- .../dynamodb/dynamodbattribute/decode.go | 23 +- .../dynamodb/dynamodbattribute/decode_test.go | 86 + .../service/dynamodb/dynamodbattribute/doc.go | 7 +- .../dynamodb/dynamodbattribute/encode.go | 28 +- .../dynamodb/dynamodbattribute/encode_test.go | 32 + .../service/dynamodb/dynamodbattribute/tag.go | 2 +- .../dynamodb/dynamodbattribute/tag_test.go | 2 + .../dynamodb/dynamodbiface/interface.go | 57 +- .../service/dynamodb/examples_test.go | 112 +- .../aws-sdk-go/service/dynamodb/service.go | 136 +- .../aws-sdk-go/service/dynamodb/waiters.go | 8 + .../aws-sdk-go/service/dynamodbstreams/api.go | 553 +- .../dynamodbstreamsiface/interface.go | 53 +- .../service/dynamodbstreams/examples_test.go | 32 +- .../service/dynamodbstreams/service.go | 15 +- .../aws/aws-sdk-go/service/ec2/api.go | 20113 ++++++++++++++-- .../aws-sdk-go/service/ec2/customizations.go | 6 +- .../service/ec2/ec2iface/interface.go | 137 +- .../aws-sdk-go/service/ec2/examples_test.go | 1885 +- .../aws/aws-sdk-go/service/ec2/service.go | 2 +- .../aws/aws-sdk-go/service/ec2/waiters.go | 120 + .../aws/aws-sdk-go/service/ecr/api.go | 1677 +- .../service/ecr/ecriface/interface.go | 63 +- .../aws-sdk-go/service/ecr/examples_test.go | 175 +- .../aws/aws-sdk-go/service/ecs/api.go | 3241 ++- .../service/ecs/ecsiface/interface.go | 61 +- .../aws-sdk-go/service/ecs/examples_test.go | 221 +- .../aws/aws-sdk-go/service/ecs/waiters.go | 18 +- .../aws/aws-sdk-go/service/efs/api.go | 871 +- .../service/efs/efsiface/interface.go | 53 +- .../aws-sdk-go/service/efs/examples_test.go | 88 +- .../aws/aws-sdk-go/service/efs/service.go | 5 + .../aws/aws-sdk-go/service/elasticache/api.go | 5663 ++++- .../elasticache/elasticacheiface/interface.go | 61 +- .../service/elasticache/examples_test.go | 335 +- .../aws-sdk-go/service/elasticache/service.go | 6 +- .../aws-sdk-go/service/elasticache/waiters.go | 16 + .../service/elasticbeanstalk/api.go | 3315 ++- .../elasticbeanstalkiface/interface.go | 53 +- .../service/elasticbeanstalk/examples_test.go | 295 +- .../service/elasticbeanstalk/service.go | 2 +- .../service/elasticsearchservice/api.go | 1015 +- .../elasticsearchserviceiface/interface.go | 53 +- .../elasticsearchservice/examples_test.go | 81 +- .../service/elasticsearchservice/service.go | 3 +- .../service/elastictranscoder/api.go | 3623 ++- .../elastictranscoderiface/interface.go | 55 +- .../elastictranscoder/examples_test.go | 136 +- .../service/elastictranscoder/waiters.go | 4 + .../aws/aws-sdk-go/service/elb/api.go | 2119 +- .../service/elb/elbiface/interface.go | 59 +- .../aws-sdk-go/service/elb/examples_test.go | 228 +- .../aws/aws-sdk-go/service/elb/service.go | 28 +- .../aws/aws-sdk-go/service/elb/waiters.go | 12 + .../aws/aws-sdk-go/service/elbv2/api.go | 6120 +++++ .../service/elbv2/elbv2iface/interface.go | 185 + .../aws-sdk-go/service/elbv2/examples_test.go | 950 + .../aws/aws-sdk-go/service/elbv2/service.go | 131 + .../aws/aws-sdk-go/service/emr/api.go | 3168 ++- .../service/emr/emriface/interface.go | 73 +- .../aws-sdk-go/service/emr/examples_test.go | 242 +- .../aws/aws-sdk-go/service/emr/waiters.go | 8 + .../aws/aws-sdk-go/service/firehose/api.go | 1112 +- .../service/firehose/examples_test.go | 56 +- .../firehose/firehoseiface/interface.go | 53 +- .../aws/aws-sdk-go/service/gamelift/api.go | 4644 +++- .../service/gamelift/examples_test.go | 387 +- .../gamelift/gameliftiface/interface.go | 61 +- .../aws-sdk-go/service/gamelift/service.go | 142 +- .../aws/aws-sdk-go/service/generate.go | 2 +- .../aws/aws-sdk-go/service/glacier/api.go | 2421 +- .../service/glacier/examples_test.go | 248 +- .../service/glacier/glacieriface/interface.go | 57 +- .../aws/aws-sdk-go/service/glacier/service.go | 20 +- .../aws/aws-sdk-go/service/glacier/waiters.go | 8 + .../aws/aws-sdk-go/service/iam/api.go | 7351 +++++- .../aws-sdk-go/service/iam/examples_test.go | 904 +- .../service/iam/iamiface/interface.go | 57 +- .../aws/aws-sdk-go/service/iam/service.go | 47 +- .../aws/aws-sdk-go/service/iam/waiters.go | 8 + .../aws/aws-sdk-go/service/inspector/api.go | 2808 ++- .../service/inspector/examples_test.go | 256 +- .../inspector/inspectoriface/interface.go | 53 +- .../aws/aws-sdk-go/service/iot/api.go | 5021 +++- .../aws-sdk-go/service/iot/examples_test.go | 607 +- .../service/iot/iotiface/interface.go | 77 +- .../aws-sdk-go/service/iotdataplane/api.go | 211 + .../service/iotdataplane/examples_test.go | 32 +- .../iotdataplaneiface/interface.go | 53 +- .../aws/aws-sdk-go/service/kinesis/api.go | 1294 +- .../service/kinesis/examples_test.go | 136 +- .../service/kinesis/kinesisiface/interface.go | 55 +- .../aws/aws-sdk-go/service/kinesis/waiters.go | 4 + .../service/kinesisanalytics/api.go | 4872 ++++ .../service/kinesisanalytics/examples_test.go | 602 + .../kinesisanalyticsiface/interface.go | 115 + .../service/kinesisanalytics/service.go | 88 + .../aws/aws-sdk-go/service/kms/api.go | 3252 ++- .../aws-sdk-go/service/kms/examples_test.go | 314 +- .../service/kms/kmsiface/interface.go | 65 +- .../aws/aws-sdk-go/service/kms/service.go | 50 +- .../aws/aws-sdk-go/service/lambda/api.go | 1843 +- .../service/lambda/examples_test.go | 192 +- .../service/lambda/lambdaiface/interface.go | 53 +- .../aws-sdk-go/service/machinelearning/api.go | 4035 +++- .../service/machinelearning/examples_test.go | 224 +- .../machinelearningiface/interface.go | 61 +- .../service/machinelearning/waiters.go | 16 + .../marketplacecommerceanalytics/api.go | 445 +- .../examples_test.go | 42 +- .../interface.go | 57 +- .../service/marketplacemetering/api.go | 86 + .../marketplacemetering/examples_test.go | 8 +- .../marketplacemeteringiface/interface.go | 53 +- .../service/marketplacemetering/service.go | 2 +- .../aws-sdk-go/service/mobileanalytics/api.go | 102 + .../service/mobileanalytics/examples_test.go | 8 +- .../mobileanalyticsiface/interface.go | 53 +- .../aws/aws-sdk-go/service/opsworks/api.go | 6285 ++++- .../service/opsworks/examples_test.go | 560 +- .../opsworks/opsworksiface/interface.go | 65 +- .../aws-sdk-go/service/opsworks/service.go | 54 +- .../aws-sdk-go/service/opsworks/waiters.go | 24 + .../aws/aws-sdk-go/service/rds/api.go | 11046 ++++++++- .../aws-sdk-go/service/rds/examples_test.go | 816 +- .../service/rds/rdsiface/interface.go | 73 +- .../aws/aws-sdk-go/service/rds/service.go | 21 +- .../aws/aws-sdk-go/service/rds/waiters.go | 20 +- .../aws/aws-sdk-go/service/redshift/api.go | 6230 ++++- .../service/redshift/examples_test.go | 499 +- .../redshift/redshiftiface/interface.go | 61 +- .../aws-sdk-go/service/redshift/service.go | 32 +- .../aws-sdk-go/service/redshift/waiters.go | 20 +- .../aws/aws-sdk-go/service/route53/api.go | 7352 +++++- .../service/route53/examples_test.go | 414 +- .../service/route53/route53iface/interface.go | 59 +- .../service/route53/unmarshal_error.go | 2 +- .../aws/aws-sdk-go/service/route53/waiters.go | 4 + .../aws-sdk-go/service/route53domains/api.go | 2947 ++- .../service/route53domains/examples_test.go | 242 +- .../route53domainsiface/interface.go | 65 +- .../aws/aws-sdk-go/service/s3/api.go | 5021 +++- .../service/s3/customizations_test.go | 53 + .../aws-sdk-go/service/s3/examples_test.go | 476 +- .../service/s3/host_style_bucket.go | 21 + .../service/s3/host_style_bucket_test.go | 14 + .../aws-sdk-go/service/s3/s3crypto/aes_gcm.go | 105 + .../s3/s3crypto/aes_gcm_content_cipher.go | 68 + .../s3crypto/aes_gcm_content_cipher_test.go | 23 + .../service/s3/s3crypto/aes_gcm_test.go | 73 + .../aws-sdk-go/service/s3/s3crypto/cipher.go | 43 + .../service/s3/s3crypto/cipher_builder.go | 29 + .../service/s3/s3crypto/cipher_test.go | 34 + .../service/s3/s3crypto/cipher_util.go | 89 + .../service/s3/s3crypto/cipher_util_test.go | 218 + .../service/s3/s3crypto/decryption_client.go | 110 + .../s3/s3crypto/decryption_client_test.go | 76 + .../aws/aws-sdk-go/service/s3/s3crypto/doc.go | 66 + .../service/s3/s3crypto/encryption_client.go | 131 + .../s3/s3crypto/encryption_client_test.go | 67 + .../service/s3/s3crypto/envelope.go | 37 + .../aws-sdk-go/service/s3/s3crypto/hash_io.go | 61 + .../service/s3/s3crypto/hash_io_test.go | 25 + .../aws-sdk-go/service/s3/s3crypto/helper.go | 70 + .../service/s3/s3crypto/helper_test.go | 47 + .../service/s3/s3crypto/key_handler.go | 21 + .../service/s3/s3crypto/key_handler_test.go | 16 + .../service/s3/s3crypto/kms_key_handler.go | 114 + .../s3/s3crypto/kms_key_handler_test.go | 105 + .../service/s3/s3crypto/mat_desc.go | 18 + .../service/s3/s3crypto/mat_desc_test.go | 28 + .../service/s3/s3crypto/mock_test.go | 70 + .../service/s3/s3crypto/strategy.go | 142 + .../service/s3/s3crypto/strategy_test.go | 46 + .../service/s3/s3iface/interface.go | 61 +- .../service/s3/s3manager/download.go | 129 +- .../service/s3/s3manager/download_test.go | 118 + .../aws-sdk-go/service/s3/s3manager/upload.go | 75 +- .../service/s3/s3manager/upload_test.go | 85 +- .../aws-sdk-go/service/s3/unmarshal_error.go | 2 +- .../aws/aws-sdk-go/service/s3/waiters.go | 16 + .../aws-sdk-go/service/servicecatalog/api.go | 1348 +- .../service/servicecatalog/examples_test.go | 104 +- .../service/servicecatalog/service.go | 8 +- .../servicecatalogiface/interface.go | 53 +- .../aws/aws-sdk-go/service/ses/api.go | 3976 ++- .../aws-sdk-go/service/ses/examples_test.go | 581 +- .../aws/aws-sdk-go/service/ses/service.go | 2 +- .../service/ses/sesiface/interface.go | 83 +- .../aws/aws-sdk-go/service/ses/waiters.go | 4 + .../aws/aws-sdk-go/service/simpledb/api.go | 744 +- .../service/simpledb/examples_test.go | 80 +- .../aws-sdk-go/service/simpledb/service.go | 4 +- .../simpledb/simpledbiface/interface.go | 53 +- .../aws/aws-sdk-go/service/sms/api.go | 2363 ++ .../aws-sdk-go/service/sms/examples_test.go | 304 + .../aws/aws-sdk-go/service/sms/service.go | 89 + .../service/sms/smsiface/interface.go | 115 + .../aws/aws-sdk-go/service/snowball/api.go | 2691 +++ .../service/snowball/examples_test.go | 356 + .../aws-sdk-go/service/snowball/service.go | 95 + .../snowball/snowballiface/interface.go | 111 + .../aws/aws-sdk-go/service/sns/api.go | 1695 +- .../aws-sdk-go/service/sns/examples_test.go | 240 +- .../service/sns/snsiface/interface.go | 53 +- .../aws/aws-sdk-go/service/sqs/api.go | 1263 +- .../aws/aws-sdk-go/service/sqs/api_test.go | 4 +- .../aws-sdk-go/service/sqs/examples_test.go | 136 +- .../aws/aws-sdk-go/service/sqs/service.go | 22 +- .../service/sqs/sqsiface/interface.go | 53 +- .../aws/aws-sdk-go/service/ssm/api.go | 2227 +- .../aws-sdk-go/service/ssm/examples_test.go | 208 +- .../aws/aws-sdk-go/service/ssm/service.go | 105 +- .../service/ssm/ssmiface/interface.go | 53 +- .../aws-sdk-go/service/storagegateway/api.go | 3681 ++- .../service/storagegateway/examples_test.go | 448 +- .../service/storagegateway/service.go | 56 +- .../storagegatewayiface/interface.go | 53 +- .../aws/aws-sdk-go/service/sts/api.go | 897 +- .../aws-sdk-go/service/sts/examples_test.go | 56 +- .../aws/aws-sdk-go/service/sts/service.go | 8 +- .../service/sts/stsiface/interface.go | 53 +- .../aws/aws-sdk-go/service/support/api.go | 1302 +- .../service/support/examples_test.go | 112 +- .../aws/aws-sdk-go/service/support/service.go | 53 +- .../service/support/supportiface/interface.go | 53 +- .../aws/aws-sdk-go/service/swf/api.go | 6743 +++++- .../aws-sdk-go/service/swf/examples_test.go | 248 +- .../service/swf/swfiface/interface.go | 53 +- .../aws/aws-sdk-go/service/waf/api.go | 4856 +++- .../aws-sdk-go/service/waf/examples_test.go | 318 +- .../service/waf/wafiface/interface.go | 53 +- .../aws/aws-sdk-go/service/workspaces/api.go | 1591 +- .../service/workspaces/examples_test.go | 202 +- .../aws-sdk-go/service/workspaces/service.go | 5 +- .../workspaces/workspacesiface/interface.go | 69 +- 681 files changed, 336082 insertions(+), 27792 deletions(-) create mode 100644 vendor/github.com/aws/aws-sdk-go/CHANGELOG.md delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_invalid_ini create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_other create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_4_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path_1_4.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/mock/server.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/request/handleServiceErrorCodes/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/request/handleServiceErrorCodes/handleServiceErrorCodes.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/dynamodb/scanItems/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/dynamodb/scanItems/scanItems.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/ec2/filterInstances/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/ec2/filterInstances/filter_ec2_by_tag.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/s3/concatObjects/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/service/s3/concatObjects/concatObjects.go create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/budgets/2016-10-20/api-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/budgets/2016-10-20/docs-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/budgets/2016-10-20/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-01/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-01/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-01/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-01/waiters-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-20/api-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-20/docs-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-20/paginators-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-08-20/waiters-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-07/api-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-07/docs-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-07/examples-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-07/paginators-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-07/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-29/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-29/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-29/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-29/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2016-09-29/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/waiters-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/ec2/2016-09-15/api-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/ec2/2016-09-15/docs-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/ec2/2016-09-15/examples-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/ec2/2016-09-15/paginators-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/ec2/2016-09-15/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/ecr/2015-09-21/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancing/2012-06-01/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancingv2/2015-12-01/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancingv2/2015-12-01/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancingv2/2015-12-01/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancingv2/2015-12-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/kinesisanalytics/2015-08-14/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/kinesisanalytics/2015-08-14/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/kinesisanalytics/2015-08-14/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/machinelearning/2014-12-12/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/sms/2016-10-24/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/sms/2016-10-24/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/sms/2016-10-24/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/sms/2016-10-24/paginators-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/snowball/2016-06-30/api-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/snowball/2016-06-30/docs-2.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/snowball/2016-06-30/examples-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/snowball/2016-06-30/paginators-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/sns/2010-03-31/examples-1.json create mode 100755 vendor/github.com/aws/aws-sdk-go/models/apis/support/2013-04-15/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/docstring_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/budgets/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/budgets/budgetsiface/interface.go create 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/budgets/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codedeploy/waiters.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/elbv2iface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesisanalytics/api.go create 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/kinesisanalytics/kinesisanalyticsiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesisanalytics/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_gcm.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_gcm_content_cipher.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_gcm_content_cipher_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_gcm_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/cipher.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/cipher_builder.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/cipher_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/cipher_util.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/cipher_util_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/decryption_client.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/decryption_client_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/encryption_client.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/encryption_client_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/envelope.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/hash_io.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/hash_io_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/helper.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/helper_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/key_handler.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/key_handler_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/kms_key_handler.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/kms_key_handler_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/mat_desc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/mat_desc_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/mock_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/strategy.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/strategy_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sms/api.go create 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/sms/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sms/smsiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/snowball/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/snowball/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/snowball/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/snowball/snowballiface/interface.go diff --git a/_vendor/github.com/aws/aws-sdk-go b/_vendor/github.com/aws/aws-sdk-go index 5fbcfa00ec..45d21707a5 160000 --- a/_vendor/github.com/aws/aws-sdk-go +++ b/_vendor/github.com/aws/aws-sdk-go @@ -1 +1 @@ -Subproject commit 5fbcfa00ec930ccaa641b404adece72bf96e3667 +Subproject commit 45d21707a58c6bfdf7cf12197d054769d88f7d13 diff --git a/vendor/github.com/aws/aws-sdk-go/.travis.yml b/vendor/github.com/aws/aws-sdk-go/.travis.yml index 0196798a51..b76546d20a 100644 --- a/vendor/github.com/aws/aws-sdk-go/.travis.yml +++ b/vendor/github.com/aws/aws-sdk-go/.travis.yml @@ -6,6 +6,7 @@ go: - 1.4 - 1.5 - 1.6 + - 1.7 - tip # Use Go 1.5's vendoring experiment for 1.5 tests. 1.4 tests will use the tip of the dependencies repo. diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md new file mode 100644 index 0000000000..afc7891095 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md @@ -0,0 +1,151 @@ +Release v1.5.2 (2016-11-03) +=== + +Service Client Updates +--- +`service/directconnect`: Updates service API and documentation + +Release v1.5.1 (2016-11-02) +=== + +Service Client Updates +--- +`service/email`: Updates service API and documentation + +Release v1.5.0 (2016-11-01) +=== + +Service Client Updates +--- +`service/cloudformation`: Updates service API and documentation +`service/ecr`: Updates service paginators + +SDK Feature Updates +--- +* `private/model/api`: Add generated setters for API parameters (#918) + * Adds setters to the SDK's API parameter types, and are a convenience method that reduce the need to use `aws.String` and like utility. + +Release v1.4.22 (2016-10-25) +=== + +Service Client Updates +--- +* `service/elasticloadbalancingv2`: Updates service documentation. +* `service/autoscaling`: Updates service documentation. + +Release v1.4.21 (2016-10-24) +=== + +Service Client Updates +--- +* `service/sms`: AWS Server Migration Service (SMS) is an agentless service which makes it easier and faster for you to migrate thousands of on-premises workloads to AWS. AWS SMS allows you to automate, schedule, and track incremental replications of live server volumes, making it easier for you to coordinate large-scale server migrations. +* `service/ecs`: Updates documentation. + +SDK Feature Updates +--- +* `private/models/api`: Improve code generation of documentation. + +Release v1.4.20 (2016-10-20) +=== + +Service Client Updates +--- +* `service/budgets`: Adds new service, AWS Budgets. +* `service/waf`: Updates service documentation. + +Release v1.4.19 (2016-10-18) +=== + +Service Client Updates +--- +* `service/cloudfront`: Updates service API and documentation. + * Ability to use Amazon CloudFront to deliver your content both via IPv6 and IPv4 using HTTP/HTTPS. +* `service/configservice`: Update service API and documentation. +* `service/iot`: Updates service API and documentation. +* `service/kinesisanalytics`: Updates service API and documentation. + * Whenever Amazon Kinesis Analytics is not able to detect schema for the given streaming source on DiscoverInputSchema API, we would return the raw records that was sampled to detect the schema. +* `service/rds`: Updates service API and documentation. + * Amazon Aurora integrates with other AWS services to allow you to extend your Aurora DB cluster to utilize other capabilities in the AWS cloud. Permission to access other AWS services is granted by creating an IAM role with the necessary permissions, and then associating the role with your DB cluster. + +SDK Feature Updates +--- +* `service/dynamodb/dynamodbattribute`: Add UnmarshalListOfMaps #897 + * Adds support for unmarshalling a list of maps. This is useful for unmarshalling the DynamoDB AttributeValue list of maps returned by APIs like Query and Scan. + +Release v1.4.18 (2016-10-17) +=== + +Service Model Updates +--- +* `service/route53`: Updates service API and documentation. + +Release v1.4.17 +=== + +Service Model Updates +--- +* `service/acm`: Update service API, and documentation. + * This change allows users to import third-party SSL/TLS certificates into ACM. +* `service/elasticbeanstalk`: Update service API, documentation, and pagination. + * Elastic Beanstalk DescribeApplicationVersions API is being updated to support pagination. +* `service/gamelift`: Update service API, and documentation. + * New APIs to protect game developer resource (builds, alias, fleets, instances, game sessions and player sessions) against abuse. + +SDK Features +--- +* `service/s3`: Add support for accelerate with dualstack [#887](https://github.com/aws/aws-sdk-go/issues/887) + +Release v1.4.16 (2016-10-13) +=== + +Service Model Updates +--- +* `service/ecr`: Update Amazon EC2 Container Registry service model + * DescribeImages is a new api used to expose image metadata which today includes image size and image creation timestamp. +* `service/elasticache`: Update Amazon ElastiCache service model + * Elasticache is launching a new major engine release of Redis, 3.2 (providing stability updates and new command sets over 2.8), as well as ElasticSupport for enabling Redis Cluster in 3.2, which provides support for multiple node groups to horizontally scale data, as well as superior engine failover capabilities + +SDK Bug Fixes +--- +* `aws/session`: Skip shared config on read errors [#883](https://github.com/aws/aws-sdk-go/issues/883) +* `aws/signer/v4`: Add support for URL.EscapedPath to signer [#885](https://github.com/aws/aws-sdk-go/issues/885) + +SDK Features +--- +* `private/model/api`: Add docs for errors to API operations [#881](https://github.com/aws/aws-sdk-go/issues/881) +* `private/model/api`: Improve field and waiter doc strings [#879](https://github.com/aws/aws-sdk-go/issues/879) +* `service/dynamodb/dynamodbattribute`: Allow multiple struct tag elements [#886](https://github.com/aws/aws-sdk-go/issues/886) +* Add build tags to internal SDK tools [#880](https://github.com/aws/aws-sdk-go/issues/880) + +Release v1.4.15 (2016-10-06) +=== + +Service Model Updates +--- +* `service/cognitoidentityprovider`: Update Amazon Cognito Identity Provider service model +* `service/devicefarm`: Update AWS Device Farm documentation +* `service/opsworks`: Update AWS OpsWorks service model +* `service/s3`: Update Amazon Simple Storage Service model +* `service/waf`: Update AWS WAF service model + +SDK Bug Fixes +--- +* `aws/request`: Fix HTTP Request Body race condition [#874](https://github.com/aws/aws-sdk-go/issues/874) + +SDK Feature Updates +--- +* `aws/ec2metadata`: Add support for EC2 User Data [#872](https://github.com/aws/aws-sdk-go/issues/872) +* `aws/signer/v4`: Remove logic determining if request needs to be resigned [#876](https://github.com/aws/aws-sdk-go/issues/876) + +Release v1.4.14 (2016-09-29) +=== +* `service/ec2`: api, documentation, and paginators updates. +* `service/s3`: api and documentation updates. + +Release v1.4.13 (2016-09-27) +=== +* `service/codepipeline`: documentation updates. +* `service/cloudformation`: api and documentation updates. +* `service/kms`: documentation updates. +* `service/elasticfilesystem`: documentation updates. +* `service/snowball`: documentation updates. diff --git a/vendor/github.com/aws/aws-sdk-go/Makefile b/vendor/github.com/aws/aws-sdk-go/Makefile index b8b4e94640..141ace57a5 100644 --- a/vendor/github.com/aws/aws-sdk-go/Makefile +++ b/vendor/github.com/aws/aws-sdk-go/Makefile @@ -5,10 +5,13 @@ LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)' LINTIGNOREINFLECT='service/[^/]+/(api|service)\.go:.+method .+ should be ' LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be ' LINTIGNOREDEPS='vendor/.+\.go' +UNIT_TEST_TAGS="example codegen" -SDK_WITH_VENDOR_PKGS=$(shell go list ./... | grep -v "/vendor/src") +SDK_WITH_VENDOR_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/src") SDK_ONLY_PKGS=$(shell go list ./... | grep -v "/vendor/") +SDK_UNIT_TEST_ONLY_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/") SDK_GO_1_4=$(shell go version | grep "go1.4") +SDK_GO_1_5=$(shell go version | grep "go1.5") SDK_GO_VERSION=$(shell go version | awk '''{print $$3}''' | tr -d '''\n''') all: get-deps generate unit @@ -50,11 +53,11 @@ build: unit: get-deps-tests build verify @echo "go test SDK and vendor packages" - @go test -tags $(SDK_ONLY_PKGS) + @go test -tags ${UNIT_TEST_TAGS} $(SDK_UNIT_TEST_ONLY_PKGS) unit-with-race-cover: get-deps-tests build verify @echo "go test SDK and vendor packages" - @go test -tags -race -cpu=1,2,4 $(SDK_ONLY_PKGS) + @go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 $(SDK_UNIT_TEST_ONLY_PKGS) integration: get-deps-tests integ-custom smoke-tests performance @@ -101,20 +104,18 @@ verify: get-deps-verify lint vet lint: @echo "go lint SDK and vendor packages" - @lint=`if [ -z "${SDK_GO_1_4}" ]; then golint ./...; else echo "skipping golint"; fi`; \ + @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}`; \ echo "$$lint"; \ if [ "$$lint" != "" ] && [ "$$lint" != "skipping golint" ]; then exit 1; fi SDK_BASE_FOLDERS=$(shell ls -d */ | grep -v vendor | grep -v awsmigrate) -ifneq (,$(findstring go1.5, ${SDK_GO_VERSION})) - GO_VET_CMD=go tool vet --all -shadow +ifneq (,$(findstring go1.4, ${SDK_GO_VERSION})) + GO_VET_CMD=echo skipping go vet, ${SDK_GO_VERSION} else ifneq (,$(findstring go1.6, ${SDK_GO_VERSION})) GO_VET_CMD=go tool vet --all -shadow -example=false -else ifneq (,$(findstring devel, ${SDK_GO_VERSION})) - GO_VET_CMD=go tool vet --all -shadow -tests=false else - GO_VET_CMD=echo skipping go vet, ${SDK_GO_VERSION} + GO_VET_CMD=go tool vet --all -shadow endif vet: @@ -126,13 +127,14 @@ get-deps: get-deps-tests get-deps-verify get-deps-tests: @echo "go get SDK testing dependencies" - go get github.com/lsegal/gucumber/cmd/gucumber + go get github.com/gucumber/gucumber/cmd/gucumber go get github.com/stretchr/testify go get github.com/smartystreets/goconvey + go get golang.org/x/net/html get-deps-verify: @echo "go get SDK verification utilities" - @if [ -z "${SDK_GO_1_4}" ]; then go get github.com/golang/lint/golint; else echo "skipped getting golint"; fi + @if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then go get github.com/golang/lint/golint; else echo "skipped getting golint"; fi bench: @echo "go bench SDK packages" @@ -144,9 +146,12 @@ bench-protocol: docs: @echo "generate SDK docs" - rm -rf doc && bundle install && bundle exec yard @# This env variable, DOCS, is for internal use - @if [ -n "$(AWS_DOC_GEN_TOOL)" ]; then echo "For internal use. Subject to change."; $(AWS_DOC_GEN_TOOL) `pwd`; fi + @if [ -z ${AWS_DOC_GEN_TOOL} ]; then\ + rm -rf doc && bundle install && bundle exec yard;\ + else\ + $(AWS_DOC_GEN_TOOL) `pwd`;\ + fi api_info: @go run private/model/cli/api-info/api-info.go diff --git a/vendor/github.com/aws/aws-sdk-go/README.md b/vendor/github.com/aws/aws-sdk-go/README.md index 812ce716c6..df806f403f 100644 --- a/vendor/github.com/aws/aws-sdk-go/README.md +++ b/vendor/github.com/aws/aws-sdk-go/README.md @@ -17,7 +17,7 @@ If you are using Go 1.5 with the `GO15VENDOREXPERIMENT=1` vendoring flag, or 1.6 go get -u github.com/aws/aws-sdk-go -Otherwise if your Go environment does not have vendoring support enabled, or you do not want to include the vendored SDK's dependencies you can use the following command to retrieve the SDK and its non-testing dependencies using `go get`. +Otherwise if your Go environment does not have vendoring support enabled, or you do not want to include the vendored SDK's dependencies you can use the following command to retrieve the SDK and its non-testing dependencies using `go get`. go get -u github.com/aws/aws-sdk-go/aws/... go get -u github.com/aws/aws-sdk-go/service/... @@ -25,7 +25,7 @@ Otherwise if your Go environment does not have vendoring support enabled, or you If you're looking to retrieve just the SDK without any dependencies use the following command. go get -d github.com/aws/aws-sdk-go/ - + These two processes will still include the `vendor` folder and it should be deleted if its not going to be used by your environment. rm -rf $GOPATH/src/github.com/aws/aws-sdk-go/vendor @@ -61,8 +61,8 @@ AWS_ACCESS_KEY_ID=AKID1234567890 AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY ``` -### AWS CLI config file (`~/.aws/config`) -The AWS SDK for Go does not support the AWS CLI's config file. The SDK will not use any contents from this file. The SDK only supports the shared credentials file (`~/.aws/credentials`). #384 tracks this feature request discussion. +### 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://github.com/aws/aws-sdk-go/wiki/sessions) wiki for more information about this feature. ## Using the Go SDK @@ -84,10 +84,15 @@ import ( ) 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(session.New(), &aws.Config{Region: aws.String("us-west-2")}) + svc := ec2.New(sess, &aws.Config{Region: aws.String("us-west-2")}) // Call the DescribeInstances Operation resp, err := svc.DescribeInstances(nil) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go index e50771f803..56fdfc2bfc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go @@ -44,7 +44,7 @@ type Error interface { // BatchError is a batch of errors which also wraps lower level errors with // code, message, and original errors. Calling Error() will include all errors -// that occured in the batch. +// that occurred in the batch. // // Deprecated: Replaced with BatchedErrors. Only defined for backwards // compatibility. @@ -64,7 +64,7 @@ type BatchError interface { // BatchedErrors is a batch of errors which also wraps lower level errors with // code, message, and original errors. Calling Error() will include all errors -// that occured in the batch. +// that occurred in the batch. // // Replaces BatchError type BatchedErrors interface { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go index e2d333b84b..0202a008f5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -98,7 +98,7 @@ func (b baseError) OrigErr() error { return NewBatchError(err.Code(), err.Message(), b.errs[1:]) } return NewBatchError("BatchedErrors", - "multiple errors occured", b.errs) + "multiple errors occurred", b.errs) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go index 8429470b9d..1a3d106d5c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go @@ -3,6 +3,7 @@ package awsutil import ( "io" "reflect" + "time" ) // Copy deeply copies a src structure to dst. Useful for copying request and @@ -49,7 +50,14 @@ func rcopy(dst, src reflect.Value, root bool) { } else { e := src.Type().Elem() if dst.CanSet() && !src.IsNil() { - dst.Set(reflect.New(e)) + if _, ok := src.Interface().(*time.Time); !ok { + dst.Set(reflect.New(e)) + } else { + tempValue := reflect.New(e) + tempValue.Elem().Set(src.Elem()) + // Sets time.Time's unexported values + dst.Set(tempValue) + } } if src.Elem().IsValid() { // Keep the current root state since the depth hasn't changed diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go index 84b7e3f34a..0e75c5eea1 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go @@ -6,6 +6,7 @@ import ( "io" "io/ioutil" "testing" + "time" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/stretchr/testify/assert" @@ -36,11 +37,19 @@ func ExampleCopy() { // } } -func TestCopy(t *testing.T) { +func TestCopy1(t *testing.T) { + type Bar struct { + a *int + B *int + c int + D int + } type Foo struct { A int B []*string C map[string]*int + D *time.Time + E *Bar } // Create the initial value @@ -48,6 +57,9 @@ func TestCopy(t *testing.T) { str2 := "bye bye" int1 := 1 int2 := 2 + intPtr1 := 1 + intPtr2 := 2 + now := time.Now() f1 := &Foo{ A: 1, B: []*string{&str1, &str2}, @@ -55,6 +67,13 @@ func TestCopy(t *testing.T) { "A": &int1, "B": &int2, }, + D: &now, + E: &Bar{ + &intPtr1, + &intPtr2, + 2, + 3, + }, } // Do the copy @@ -65,16 +84,29 @@ func TestCopy(t *testing.T) { assert.Equal(t, f2.A, f1.A) assert.Equal(t, f2.B, f1.B) assert.Equal(t, f2.C, f1.C) + assert.Equal(t, f2.D, f1.D) + assert.Equal(t, f2.E.B, f1.E.B) + assert.Equal(t, f2.E.D, f1.E.D) // But pointers are not! str3 := "nothello" int3 := 57 f2.A = 100 - f2.B[0] = &str3 - f2.C["B"] = &int3 + *f2.B[0] = str3 + *f2.C["B"] = int3 + *f2.D = time.Now() + f2.E.a = &int3 + *f2.E.B = int3 + f2.E.c = 5 + f2.E.D = 5 assert.NotEqual(t, f2.A, f1.A) assert.NotEqual(t, f2.B, f1.B) assert.NotEqual(t, f2.C, f1.C) + assert.NotEqual(t, f2.D, f1.D) + assert.NotEqual(t, f2.E.a, f1.E.a) + assert.NotEqual(t, f2.E.B, f1.E.B) + assert.NotEqual(t, f2.E.c, f1.E.c) + assert.NotEqual(t, f2.E.D, f1.E.D) } func TestCopyNestedWithUnexported(t *testing.T) { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go index 4d2a01e8c4..11c52c3896 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go @@ -106,8 +106,8 @@ func rValuesAtPath(v interface{}, path string, createPath, caseSensitive, nilTer if indexStar || index != nil { nextvals = []reflect.Value{} - for _, value := range values { - value := reflect.Indirect(value) + for _, valItem := range values { + value := reflect.Indirect(valItem) if value.Kind() != reflect.Slice { continue } 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 c8d0564d8a..7c0e7d9dd1 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" - "io/ioutil" "net/http/httputil" "github.com/aws/aws-sdk-go/aws" @@ -87,16 +86,24 @@ const logReqMsg = `DEBUG: Request %s/%s Details: %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, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) + 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.Body.Seek(r.BodyStart, 0) - r.HTTPRequest.Body = ioutil.NopCloser(r.Body) + r.ResetBody() } r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ClientInfo.ServiceName, r.Operation.Name, string(dumpedBody))) @@ -107,11 +114,21 @@ const logRespMsg = `DEBUG: Response %s/%s Details: %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, _ := httputil.DumpResponse(r.HTTPResponse, logBody) + 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() 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 da72935be2..34c2bab338 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -7,24 +7,36 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" ) -// UseServiceDefaultRetries instructs the config to use the service's own default -// number of retries. This will be the default action if Config.MaxRetries -// is nil also. +// UseServiceDefaultRetries instructs the config to use the service's own +// default number of retries. This will be the default action if +// Config.MaxRetries is nil also. const UseServiceDefaultRetries = -1 -// RequestRetryer is an alias for a type that implements the request.Retryer interface. +// RequestRetryer is an alias for a type that implements the request.Retryer +// interface. type RequestRetryer interface{} // A Config provides service configuration for service clients. By default, -// all clients will use the {defaults.DefaultConfig} structure. +// all clients will use the defaults.DefaultConfig tructure. +// +// // Create Session with MaxRetry configuration to be shared by multiple +// // service clients. +// sess, err := session.NewSession(&aws.Config{ +// MaxRetries: aws.Int(3), +// }) +// +// // Create S3 service client with a specific Region. +// svc := s3.New(sess, &aws.Config{ +// Region: aws.String("us-west-2"), +// }) type Config struct { // Enables verbose error printing of all credential chain errors. - // Should be used when wanting to see all errors while attempting to retreive - // credentials. + // Should be used when wanting to see all errors while attempting to + // retrieve credentials. CredentialsChainVerboseErrors *bool - // The credentials object to use when signing requests. Defaults to - // a chain of credential providers to search for credentials in environment + // The credentials object to use when signing requests. Defaults to a + // chain of credential providers to search for credentials in environment // variables, shared credential file, and EC2 Instance Roles. Credentials *credentials.Credentials @@ -63,11 +75,12 @@ type Config struct { Logger Logger // The maximum number of times that a request will be retried for failures. - // Defaults to -1, which defers the max retry setting to the service specific - // configuration. + // Defaults to -1, which defers the max retry setting to the service + // specific configuration. MaxRetries *int - // Retryer guides how HTTP requests should be retried in case of recoverable failures. + // Retryer guides how HTTP requests should be retried in case of + // recoverable failures. // // When nil or the value does not implement the request.Retryer interface, // the request.DefaultRetryer will be used. @@ -82,8 +95,8 @@ type Config struct { // Retryer RequestRetryer - // Disables semantic parameter validation, which validates input for missing - // required fields and/or other semantic request input errors. + // Disables semantic parameter validation, which validates input for + // missing required fields and/or other semantic request input errors. DisableParamValidation *bool // Disables the computation of request and response checksums, e.g., @@ -91,8 +104,8 @@ type Config struct { DisableComputeChecksums *bool // Set this to `true` to force the request to use path-style addressing, - // i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client will - // use virtual hosted bucket addressing when possible + // i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client + // will use virtual hosted bucket addressing when possible // (`http://BUCKET.s3.amazonaws.com/KEY`). // // @note This configuration option is specific to the Amazon S3 service. @@ -109,36 +122,60 @@ type Config struct { // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html // // 100-Continue is only enabled for Go 1.6 and above. See `http.Transport`'s - // `ExpectContinueTimeout` for information on adjusting the continue wait timeout. - // https://golang.org/pkg/net/http/#Transport + // `ExpectContinueTimeout` for information on adjusting the continue wait + // timeout. https://golang.org/pkg/net/http/#Transport // - // You should use this flag to disble 100-Continue if you experiance issues - // with proxies or thrid party S3 compatible services. + // You should use this flag to disble 100-Continue if you experience issues + // with proxies or third party S3 compatible services. S3Disable100Continue *bool - // Set this to `true` to enable S3 Accelerate feature. For all operations compatible - // with S3 Accelerate will use the accelerate endpoint for requests. Requests not compatible - // will fall back to normal S3 requests. + // Set this to `true` to enable S3 Accelerate feature. For all operations + // compatible with S3 Accelerate will use the accelerate endpoint for + // requests. Requests not compatible will fall back to normal S3 requests. // - // The bucket must be enable for accelerate to be used with S3 client with accelerate - // enabled. If the bucket is not enabled for accelerate an error will be returned. - // The bucket name must be DNS compatible to also work with accelerate. + // The bucket must be enable for accelerate to be used with S3 client with + // accelerate enabled. If the bucket is not enabled for accelerate an error + // will be returned. The bucket name must be DNS compatible to also work + // with accelerate. S3UseAccelerate *bool // Set this to `true` to disable the EC2Metadata client from overriding the - // default http.Client's Timeout. This is helpful if you do not want the EC2Metadata - // client to create a new http.Client. This options is only meaningful if you're not - // already using a custom HTTP client with the SDK. Enabled by default. + // default http.Client's Timeout. This is helpful if you do not want the + // EC2Metadata client to create a new http.Client. This options is only + // meaningful if you're not already using a custom HTTP client with the + // SDK. Enabled by default. // - // Must be set and provided to the session.New() in order to disable the EC2Metadata - // overriding the timeout for default credentials chain. + // Must be set and provided to the session.NewSession() in order to disable + // the EC2Metadata overriding the timeout for default credentials chain. // // Example: - // sess := session.New(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // sess, err := session.NewSession(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // // svc := s3.New(sess) // EC2MetadataDisableTimeoutOverride *bool + // Instructs the endpiont to be generated for a service client to + // be the dual stack endpoint. The dual stack endpoint will support + // both IPv4 and IPv6 addressing. + // + // Setting this for a service which does not support dual stack will fail + // to make requets. It is not recommended to set this value on the session + // as it will apply to all service clients created with the session. Even + // services which don't support dual stack endpoints. + // + // If the Endpoint config value is also provided the UseDualStack flag + // will be ignored. + // + // Only supported with. + // + // sess, err := session.NewSession() + // + // svc := s3.New(sess, &aws.Config{ + // UseDualStack: aws.Bool(true), + // }) + UseDualStack *bool + // SleepDelay is an override for the func the SDK will call when sleeping // during the lifecycle of a request. Specifically this will be used for // request delays. This value should only be used for testing. To adjust @@ -147,11 +184,19 @@ type Config struct { SleepDelay func(time.Duration) } -// NewConfig returns a new Config pointer that can be chained with builder methods to -// set multiple configuration values inline without using pointers. +// NewConfig returns a new Config pointer that can be chained with builder +// methods to set multiple configuration values inline without using pointers. // -// sess := session.New(aws.NewConfig().WithRegion("us-west-2").WithMaxRetries(10)) +// // Create Session with MaxRetry configuration to be shared by multiple +// // service clients. +// sess, err := session.NewSession(aws.NewConfig(). +// WithMaxRetries(3), +// ) // +// // Create S3 service client with a specific Region. +// svc := s3.New(sess, aws.NewConfig(). +// WithRegion("us-west-2"), +// ) func NewConfig() *Config { return &Config{} } @@ -254,6 +299,13 @@ func (c *Config) WithS3UseAccelerate(enable bool) *Config { return c } +// WithUseDualStack sets a config UseDualStack value returning a Config +// pointer for chaining. +func (c *Config) WithUseDualStack(enable bool) *Config { + c.UseDualStack = &enable + return c +} + // WithEC2MetadataDisableTimeoutOverride sets a config EC2MetadataDisableTimeoutOverride value // returning a Config pointer for chaining. func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config { @@ -340,6 +392,10 @@ func mergeInConfig(dst *Config, other *Config) { dst.S3UseAccelerate = other.S3UseAccelerate } + if other.UseDualStack != nil { + dst.UseDualStack = other.UseDualStack + } + if other.EC2MetadataDisableTimeoutOverride != nil { dst.EC2MetadataDisableTimeoutOverride = other.EC2MetadataDisableTimeoutOverride } 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 8456e29b56..8e12f82b04 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 @@ -10,9 +10,11 @@ import ( "regexp" "runtime" "strconv" + "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/aws/aws-sdk-go/aws/request" ) @@ -67,6 +69,34 @@ var SDKVersionUserAgentHandler = request.NamedHandler{ 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 signficant delays +// occur whne retrying requests that would cause the signature to expire. +var ValidateReqSigHandler = request.NamedHandler{ + Name: "core.ValidateReqSigHandler", + Fn: func(r *request.Request) { + // Unsigned requests are not signed + if r.Config.Credentials == credentials.AnonymousCredentials { + return + } + + signedTime := r.Time + if !r.LastSignedAt.IsZero() { + signedTime = r.LastSignedAt + } + + // 10 minutes to allow for some clock skew/delays in transmission. + // Would be improved with aws/aws-sdk-go#423 + if signedTime.Add(10 * time.Minute).After(time.Now()) { + return + } + + fmt.Println("request expired, resigning") + r.Sign() + }, +} + // 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 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 5b61a33b67..799285198f 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 @@ -8,6 +8,7 @@ import ( "net/http/httptest" "os" "testing" + "time" "github.com/stretchr/testify/assert" @@ -117,11 +118,52 @@ func TestSendHandlerError(t *testing.T) { assert.NotNil(t, r.HTTPResponse) } +func TestValidateReqSigHandler(t *testing.T) { + cases := []struct { + Req *request.Request + Resign bool + }{ + { + Req: &request.Request{ + Config: aws.Config{Credentials: credentials.AnonymousCredentials}, + Time: time.Now().Add(-15 * time.Minute), + }, + Resign: false, + }, + { + Req: &request.Request{ + Time: time.Now().Add(-15 * time.Minute), + }, + Resign: true, + }, + { + Req: &request.Request{ + Time: time.Now().Add(-1 * time.Minute), + }, + Resign: false, + }, + } + + for i, c := range cases { + resigned := false + c.Req.Handlers.Sign.PushBack(func(r *request.Request) { + resigned = true + }) + + corehandlers.ValidateReqSigHandler.Fn(c.Req) + + assert.NoError(t, c.Req.Error, "%d, expect no error", i) + assert.Equal(t, c.Resign, resigned, "%d, expected resigning to match", i) + } +} + func setupContentLengthTestServer(t *testing.T, hasContentLength bool, contentLength int64) *httptest.Server { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, ok := r.Header["Content-Length"] assert.Equal(t, hasContentLength, ok, "expect content length to be set, %t", hasContentLength) - assert.Equal(t, contentLength, r.ContentLength) + if hasContentLength { + assert.Equal(t, contentLength, r.ContentLength) + } b, err := ioutil.ReadAll(r.Body) assert.NoError(t, err) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go index fb50a0bd87..66973ca01f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go @@ -12,7 +12,7 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/kinesis" "github.com/stretchr/testify/require" ) @@ -242,7 +242,7 @@ func BenchmarkValidateAny(b *testing.B) { input.Records = append(input.Records, record) } - req, _ := kinesis.New(session.New()).PutRecordsRequest(input) + req, _ := kinesis.New(unit.Session).PutRecordsRequest(input) b.ResetTimer() for i := 0; i < b.N; i++ { 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 857311f64c..6efc77bf09 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 @@ -34,7 +34,7 @@ var ( // // Example of ChainProvider to be used with an EnvProvider and EC2RoleProvider. // In this example EnvProvider will first check if any credentials are available -// vai the environment variables. If there are none ChainProvider will check +// via the environment variables. If there are none ChainProvider will check // the next Provider in the list, EC2RoleProvider in this case. If EC2RoleProvider // does not return any credentials ChainProvider will return the error // ErrNoValidProvidersFoundInChain diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go index da3d8ed3ec..cccd4bffe4 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go @@ -13,7 +13,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" ) const credsRespTmpl = `{ @@ -55,7 +55,7 @@ func TestEC2RoleProvider(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } creds, err := p.Retrieve() @@ -71,7 +71,7 @@ func TestEC2RoleProviderFailAssume(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } creds, err := p.Retrieve() @@ -92,7 +92,7 @@ func TestEC2RoleProviderIsExpired(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } p.CurrentTime = func() time.Time { return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) @@ -117,7 +117,7 @@ func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), ExpiryWindow: time.Hour * 1, } p.CurrentTime = func() time.Time { @@ -143,7 +143,7 @@ func BenchmarkEC3RoleProvider(b *testing.B) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } _, err := p.Retrieve() if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go index 6f075604e2..4f5dab3fcc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go @@ -30,13 +30,22 @@ func NewStaticCredentials(id, secret, token string) *Credentials { }}) } +// NewStaticCredentialsFromCreds returns a pointer to a new Credentials object +// wrapping the static credentials value provide. Same as NewStaticCredentials +// but takes the creds Value instead of individual fields +func NewStaticCredentialsFromCreds(creds Value) *Credentials { + return NewCredentials(&StaticProvider{Value: creds}) +} + // Retrieve returns the credentials or error if the credentials are invalid. func (s *StaticProvider) Retrieve() (Value, error) { if s.AccessKeyID == "" || s.SecretAccessKey == "" { return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty } - s.Value.ProviderName = StaticProviderName + if len(s.Value.ProviderName) == 0 { + s.Value.ProviderName = StaticProviderName + } return s.Value, nil } 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 570417ffa1..8dbbf670e8 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 @@ -72,6 +72,7 @@ func Handlers() request.Handlers { handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) handlers.Build.AfterEachFn = request.HandlerListStopOnError handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) + handlers.Send.PushBackNamed(corehandlers.ValidateReqSigHandler) handlers.Send.PushBackNamed(corehandlers.SendHandler) handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) handlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler) @@ -90,12 +91,14 @@ func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credenti Providers: []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - remoteCredProvider(*cfg, handlers), + RemoteCredProvider(*cfg, handlers), }, }) } -func remoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { +// RemoteCredProvider returns a credenitials 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 len(ecsCredURI) > 0 { @@ -118,7 +121,7 @@ func ecsCredProvider(cfg aws.Config, handlers request.Handlers, uri string) cred func ec2RoleProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { endpoint, signingRegion := endpoints.EndpointForRegion(ec2metadata.ServiceName, - aws.StringValue(cfg.Region), true) + aws.StringValue(cfg.Region), true, false) return &ec2rolecreds.EC2RoleProvider{ Client: ec2metadata.NewClient(cfg, handlers, endpoint, signingRegion), 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 c7910eda05..68226743ff 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 @@ -16,7 +16,7 @@ func TestECSCredProvider(t *testing.T) { defer os.Clearenv() os.Setenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", "/abc/123") - provider := remoteCredProvider(aws.Config{}, request.Handlers{}) + provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) assert.NotNil(t, provider) @@ -29,7 +29,7 @@ func TestECSCredProvider(t *testing.T) { } func TestDefaultEC2RoleProvider(t *testing.T) { - provider := remoteCredProvider(aws.Config{}, request.Handlers{}) + provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) assert.NotNil(t, provider) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go index 669c813a00..e5755d11b0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -3,6 +3,7 @@ package ec2metadata import ( "encoding/json" "fmt" + "net/http" "path" "strings" "time" @@ -27,6 +28,27 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) { return output.Content, req.Send() } +// GetUserData returns the userdata that was configured for the service. If +// there is no user-data setup for the EC2 instance a "NotFoundError" error +// code will be returned. +func (c *EC2Metadata) GetUserData() (string, error) { + op := &request.Operation{ + Name: "GetUserData", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "user-data"), + } + + output := &metadataOutput{} + req := c.NewRequest(op, nil, output) + req.Handlers.UnmarshalError.PushBack(func(r *request.Request) { + if r.HTTPResponse.StatusCode == http.StatusNotFound { + r.Error = awserr.New("NotFoundError", "user-data not found", r.Error) + } + }) + + return output.Content, req.Send() +} + // GetDynamicData uses the path provided to request information from the EC2 // instance metadata service for dynamic data. The content will be returned // as a string, or error if the request failed. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go index 37b74fb0cc..35e75782b9 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go @@ -2,6 +2,8 @@ package ec2metadata_test import ( "bytes" + "fmt" + "io" "io/ioutil" "net/http" "net/http/httptest" @@ -15,7 +17,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" ) const instanceIdentityDocument = `{ @@ -61,7 +63,7 @@ func initTestServer(path string, resp string) *httptest.Server { } func TestEndpoint(t *testing.T) { - c := ec2metadata.New(session.New()) + c := ec2metadata.New(unit.Session) op := &request.Operation{ Name: "GetMetadata", HTTPMethod: "GET", @@ -79,7 +81,7 @@ func TestGetMetadata(t *testing.T) { "success", // real response includes suffix ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) resp, err := c.GetMetadata("some/path") @@ -87,13 +89,58 @@ func TestGetMetadata(t *testing.T) { assert.Equal(t, "success", resp) } +func TestGetUserData(t *testing.T) { + server := initTestServer( + "/latest/user-data", + "success", // real response includes suffix + ) + defer server.Close() + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + + resp, err := c.GetUserData() + + assert.NoError(t, err) + assert.Equal(t, "success", resp) +} + +func TestGetUserData_Error(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + reader := strings.NewReader(` + + + + 404 - Not Found + + +

404 - Not Found

+ +`) + w.Header().Set("Content-Type", "text/html") + w.Header().Set("Content-Length", fmt.Sprintf("%d", reader.Len())) + w.WriteHeader(http.StatusNotFound) + io.Copy(w, reader) + })) + + defer server.Close() + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + + resp, err := c.GetUserData() + assert.Error(t, err) + assert.Empty(t, resp) + + aerr, ok := err.(awserr.Error) + assert.True(t, ok) + assert.Equal(t, "NotFoundError", aerr.Code()) +} + func TestGetRegion(t *testing.T) { server := initTestServer( "/latest/meta-data/placement/availability-zone", "us-west-2a", // real response includes suffix ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) region, err := c.Region() @@ -107,7 +154,7 @@ func TestMetadataAvailable(t *testing.T) { "instance-id", ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) available := c.Available() @@ -120,7 +167,7 @@ func TestMetadataIAMInfo_success(t *testing.T) { validIamInfo, ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) iamInfo, err := c.IAMInfo() assert.NoError(t, err) @@ -135,7 +182,7 @@ func TestMetadataIAMInfo_failure(t *testing.T) { unsuccessfulIamInfo, ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) iamInfo, err := c.IAMInfo() assert.NotNil(t, err) @@ -145,7 +192,7 @@ func TestMetadataIAMInfo_failure(t *testing.T) { } func TestMetadataNotAvailable(t *testing.T) { - c := ec2metadata.New(session.New()) + c := ec2metadata.New(unit.Session) c.Handlers.Send.Clear() c.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &http.Response{ @@ -163,7 +210,7 @@ func TestMetadataNotAvailable(t *testing.T) { } func TestMetadataErrorResponse(t *testing.T) { - c := ec2metadata.New(session.New()) + c := ec2metadata.New(unit.Session) c.Handlers.Send.Clear() c.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &http.Response{ @@ -185,7 +232,7 @@ func TestEC2RoleProviderInstanceIdentity(t *testing.T) { instanceIdentityDocument, ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) doc, err := c.GetInstanceIdentityDocument() assert.Nil(t, err, "Expect no error, %v", err) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go index d10ecb303b..c2bc215879 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go @@ -9,25 +9,24 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/stretchr/testify/assert" ) func TestClientOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(session.New()) + svc := ec2metadata.New(unit.Session) assert.NotEqual(t, http.DefaultClient, svc.Config.HTTPClient) assert.Equal(t, 5*time.Second, svc.Config.HTTPClient.Timeout) } func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { - origClient := *http.DefaultClient http.DefaultClient.Transport = &http.Transport{} defer func() { - http.DefaultClient = &origClient + http.DefaultClient.Transport = nil }() - svc := ec2metadata.New(session.New()) + svc := ec2metadata.New(unit.Session) assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) @@ -38,7 +37,7 @@ func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { } func TestClientDisableOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(session.New(aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true))) + svc := ec2metadata.New(unit.Session, aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true)) assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) } @@ -69,7 +68,7 @@ func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) { wg.Add(atOnce) for i := 0; i < atOnce; i++ { go func() { - svc := ec2metadata.New(session.New(), cfg) + svc := ec2metadata.New(unit.Session, cfg) _, err := svc.Region() assert.NoError(t, err) wg.Done() 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 f2062c3e02..b32a6510d3 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 @@ -79,7 +79,7 @@ func TestStopHandlers(t *testing.T) { called++ }}) l.PushBackNamed(request.NamedHandler{Name: "name3", Fn: func(r *request.Request) { - assert.Fail(t, "thrid handler should not be called") + assert.Fail(t, "third handler should not be called") }}) l.Run(&request.Request{}) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go index a4087f20e8..79f79602b0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go @@ -1,5 +1,3 @@ -// +build go1.5 - package request import ( @@ -9,20 +7,13 @@ import ( ) func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { - req := &http.Request{ - URL: &url.URL{}, - Header: http.Header{}, - Close: r.Close, - Body: body, - Host: r.Host, - Method: r.Method, - Proto: r.Proto, - ContentLength: r.ContentLength, - // Cancel will be deprecated in 1.7 and will be replaced with Context - Cancel: r.Cancel, - } - + req := new(http.Request) + *req = *r + req.URL = &url.URL{} *req.URL = *r.URL + req.Body = body + + req.Header = http.Header{} for k, v := range r.Header { for _, vv := range v { req.Header.Add(k, vv) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go deleted file mode 100644 index 75da021efe..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build !go1.5 - -package request - -import ( - "io" - "net/http" - "net/url" -) - -func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { - req := &http.Request{ - URL: &url.URL{}, - Header: http.Header{}, - Close: r.Close, - Body: body, - Host: r.Host, - Method: r.Method, - Proto: r.Proto, - ContentLength: r.ContentLength, - } - - *req.URL = *r.URL - for k, v := range r.Header { - for _, vv := range v { - req.Header.Add(k, vv) - } - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go index 7e5e68c761..fc0f46fb2e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go @@ -9,7 +9,7 @@ import ( "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/mock" "github.com/stretchr/testify/assert" ) @@ -17,7 +17,7 @@ func TestRequestCancelRetry(t *testing.T) { c := make(chan struct{}) reqNum := 0 - s := awstesting.NewMockClient(aws.NewConfig().WithMaxRetries(10)) + s := mock.NewMockClient(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.Clear() s.Handlers.UnmarshalMeta.Clear() diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go index da6396d2d9..02f07f4a46 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go @@ -9,7 +9,7 @@ import ( // with retrying requests type offsetReader struct { buf io.ReadSeeker - lock sync.RWMutex + lock sync.Mutex closed bool } @@ -21,7 +21,8 @@ func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { return reader } -// Close is a thread-safe close. Uses the write lock. +// Close will close the instance of the offset reader's access to +// the underlying io.ReadSeeker. func (o *offsetReader) Close() error { o.lock.Lock() defer o.lock.Unlock() @@ -29,10 +30,10 @@ func (o *offsetReader) Close() error { return nil } -// Read is a thread-safe read using a read lock. +// Read is a thread-safe read of the underlying io.ReadSeeker func (o *offsetReader) Read(p []byte) (int, error) { - o.lock.RLock() - defer o.lock.RUnlock() + o.lock.Lock() + defer o.lock.Unlock() if o.closed { return 0, io.EOF @@ -41,6 +42,14 @@ func (o *offsetReader) Read(p []byte) (int, error) { return o.buf.Read(p) } +// Seek is a thread-safe seeking operation. +func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { + o.lock.Lock() + defer o.lock.Unlock() + + return o.buf.Seek(offset, whence) +} + // CloseAndCopy will return a new offsetReader with a copy of the old buffer // and close the old buffer. func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go index 8472258c23..01856e316d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go @@ -24,6 +24,23 @@ func TestOffsetReaderRead(t *testing.T) { assert.Equal(t, buf, tempBuf) } +func TestOffsetReaderSeek(t *testing.T) { + buf := []byte("testData") + reader := newOffsetReader(bytes.NewReader(buf), 0) + + orig, err := reader.Seek(0, 1) + assert.NoError(t, err) + assert.Equal(t, int64(0), orig) + + n, err := reader.Seek(0, 2) + assert.NoError(t, err) + assert.Equal(t, int64(len(buf)), n) + + n, err = reader.Seek(orig, 0) + assert.NoError(t, err) + assert.Equal(t, int64(0), n) +} + func TestOffsetReaderClose(t *testing.T) { buf := []byte("testData") reader := &offsetReader{buf: bytes.NewReader(buf)} 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 2832aaa436..8ef9715c6b 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 @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "net/http" "net/url" "reflect" @@ -42,6 +41,12 @@ type Request struct { LastSignedAt time.Time built bool + + // Need to persist an intermideant body betweend the input Body and HTTP + // request body because the HTTP Client's transport can maintain a reference + // to the HTTP request's body after the client has returned. This value is + // safe to use concurrently and rewraps the input Body for each HTTP request. + safeBody *offsetReader } // An Operation is the service API operation to be made. @@ -135,8 +140,8 @@ func (r *Request) SetStringBody(s string) { // SetReaderBody will set the request's body reader. func (r *Request) SetReaderBody(reader io.ReadSeeker) { - r.HTTPRequest.Body = newOffsetReader(reader, 0) r.Body = reader + r.ResetBody() } // Presign returns the request's signed URL. Error will be returned @@ -220,6 +225,24 @@ 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() { + if r.safeBody != nil { + r.safeBody.Close() + } + + r.safeBody = newOffsetReader(r.Body, r.BodyStart) + r.HTTPRequest.Body = r.safeBody +} + +// GetBody will return an io.ReadSeeker of the Request's underlying +// input body with a concurrency safe wrapper. +func (r *Request) GetBody() io.ReadSeeker { + return r.safeBody +} + // Send will send the request returning error if errors are encountered. // // Send will sign the request prior to sending. All Send Handlers will @@ -231,6 +254,8 @@ func (r *Request) Sign() error { // // readLoop() and getConn(req *Request, cm connectMethod) // https://github.com/golang/go/blob/master/src/net/http/transport.go +// +// Send will not close the request.Request's body. func (r *Request) Send() error { for { if aws.BoolValue(r.Retryable) { @@ -239,21 +264,15 @@ func (r *Request) Send() error { r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) } - var body io.ReadCloser - if reader, ok := r.HTTPRequest.Body.(*offsetReader); ok { - body = reader.CloseAndCopy(r.BodyStart) - } else { - if r.Config.Logger != nil { - r.Config.Logger.Log("Request body type has been overwritten. May cause race conditions") - } - r.Body.Seek(r.BodyStart, 0) - body = ioutil.NopCloser(r.Body) - } + // The previous http.Request will have a reference to the r.Body + // and the HTTP Client's Transport may still be reading from + // the request's body even though the Client's Do returned. + r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, nil) + r.ResetBody() - r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, body) + // Closing response body to ensure that no response body is leaked + // between retry attempts. if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { - // Closing response body. Since we are setting a new request to send off, this - // response will get squashed and leaked. r.HTTPResponse.Body.Close() } } @@ -281,7 +300,6 @@ func (r *Request) Send() error { debugLogReqError(r, "Send Request", true, err) continue } - r.Handlers.UnmarshalMeta.Run(r) r.Handlers.ValidateResponse.Run(r) if r.Error != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go index f72f6d4577..afa0d94681 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go @@ -18,7 +18,7 @@ import ( // go version 1.4 and 1.5 do not return an error. Version 1.5 will url encode // the uri while 1.4 will not func TestRequestInvalidEndpoint(t *testing.T) { - endpoint, _ := endpoints.NormalizeEndpoint("localhost:80 ", "test-service", "test-region", false) + endpoint, _ := endpoints.NormalizeEndpoint("localhost:80 ", "test-service", "test-region", false, false) r := request.New( aws.Config{}, metadata.ClientInfo{Endpoint: endpoint}, 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 new file mode 100644 index 0000000000..d3dc8404ed --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -0,0 +1,223 @@ +/* +Package session provides configuration for the SDK's service clients. + +Sessions can be shared across all service clients that share the same base +configuration. The Session is built from the SDK's default configuration and +request handlers. + +Sessions should be cached when possible, because creating a new Session will +load all configuration values from the environment, and config files each time +the Session is created. Sharing the Session value across all of your service +clients will ensure the configuration is loaded the fewest number of times possible. + +Concurrency + +Sessions are safe to use concurrently as long as the Session is not being +modified. The SDK will not modify the Session once the Session has been created. +Creating service clients concurrently from a shared Session is safe. + +Sessions from Shared Config + +Sessions can be created using the method above that will only load the +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 +environment variable was set. + +Creating Sessions + +When creating Sessions optional aws.Config values can be passed in that will +override the default, or loaded config values the Session is being created +with. This allows you to provide additional, or case based, configuration +as needed. + +By default NewSession will only load credentials from the shared credentials +file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is +set to a truthy value the Session will be created from the configuration +values from the shared config (~/.aws/config) and shared credentials +(~/.aws/credentials) files. See the section Sessions from Shared Config for +more information. + +Create a Session with the default config and request handlers. With credentials +region, and profile loaded from the environment and shared config automatically. +Requires the AWS_PROFILE to be set, or "default" is used. + + // Create Session + sess, err := session.NewSession() + + // Create a Session with a custom region + sess, err := session.NewSession(&aws.Config{Region: aws.String("us-east-1")}) + + // Create a S3 client instance from a session + sess, err := session.NewSession() + if err != nil { + // Handle Session creation error + } + svc := s3.New(sess) + +Create Session With Option Overrides + +In addition to NewSession, Sessions can be created using NewSessionWithOptions. +This func allows you to control and override how the Session will be created +through code instead of being driven by environment variables only. + +Use NewSessionWithOptions when you want to provide the config profile, or +override the shared config state (AWS_SDK_LOAD_CONFIG). + + // Equivalent to session.NewSession() + sess, err := session.NewSessionWithOptions(session.Options{}) + + // Specify profile to load for the session's config + sess, err := session.NewSessionWithOptions(session.Options{ + Profile: "profile_name", + }) + + // Specify profile for config and region for requests + sess, err := session.NewSessionWithOptions(session.Options{ + Config: aws.Config{Region: aws.String("us-east-1")}, + Profile: "profile_name", + }) + + // Force enable Shared Config support + sess, err := session.NewSessionWithOptions(session.Options{ + SharedConfigState: SharedConfigEnable, + }) + +Adding Handlers + +You can add handlers to a session for processing HTTP requests. All service +clients that use the session inherit the handlers. For example, the following +handler logs every request and its payload made by a service client: + + // Create a session, and add additional handlers for all service + // clients created with the Session to inherit. Adds logging handler. + sess, err := session.NewSession() + sess.Handlers.Send.PushFront(func(r *request.Request) { + // Log every request made and its payload + logger.Println("Request: %s/%s, Payload: %s", + r.ClientInfo.ServiceName, r.Operation, r.Params) + }) + +Deprecated "New" function + +The New session function has been deprecated because it does not provide good +way to return errors that occur when loading the configuration files and values. +Because of this, NewSession was created so errors can be retrieved when +creating a session fails. + +Shared Config Fields + +By default the SDK will only load the shared credentials file's (~/.aws/credentials) +credentials values, and all other config is provided by the environment variables, +SDK defaults, and user provided aws.Config values. + +If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnable +option is used to create the Session the full shared config values will be +loaded. This includes credentials, region, and support for assume role. In +addition the Session will load its configuration from both the shared config +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). + +Credentials are the values the SDK should use for authenticating requests with +AWS Services. They arfrom a configuration file will need to include both +aws_access_key_id and aws_secret_access_key must be provided together in the +same file to be considered valid. The values will be ignored if not a complete +group. aws_session_token is an optional field that can be provided if both of +the other two fields are also provided. + + aws_access_key_id = AKID + aws_secret_access_key = SECRET + aws_session_token = TOKEN + +Assume Role values allow you to configure the SDK to assume an IAM role using +a set of credentials provided in a config file via the source_profile field. +Both "role_arn" and "source_profile" are required. The SDK does not support +assuming a role with MFA token Via the Session's constructor. You can use the +stscreds.AssumeRoleProvider credentials provider to specify custom +configuration and support for MFA. + + role_arn = arn:aws:iam:::role/ + source_profile = profile_with_creds + external_id = 1234 + mfa_serial = not supported! + role_session_name = session_name + +Region is the region the SDK should use for looking up AWS service endpoints +and signing requests. + + region = us-east-1 + +Environment Variables + +When a Session is created several environment variables can be set to adjust +how the SDK functions, and what configuration data it loads when creating +Sessions. All environment values are optional, but some values like credentials +require multiple of the values to set or the partial values will be ignored. +All environment variable values are strings unless otherwise noted. + +Environment configuration values. If set both Access Key ID and Secret Access +Key must be provided. Session Token and optionally also be provided, but is +not required. + + # Access Key ID + AWS_ACCESS_KEY_ID=AKID + AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. + + # Secret Access Key + AWS_SECRET_ACCESS_KEY=SECRET + AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. + + # Session Token + AWS_SESSION_TOKEN=TOKEN + +Region value will instruct the SDK where to make service API requests to. If is +not provided in the environment the region must be provided before a service +client request is made. + + AWS_REGION=us-east-1 + + # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, + # and AWS_REGION is not also set. + AWS_DEFAULT_REGION=us-east-1 + +Profile name the SDK should load use when loading shared config from the +configuration files. If not provided "default" will be used as the profile name. + + AWS_PROFILE=my_profile + + # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, + # and AWS_PROFILE is not also set. + AWS_DEFAULT_PROFILE=my_profile + +SDK load config instructs the SDK to load the shared config in addition to +shared credentials. This also expands the configuration loaded so the shared +credentials will have parity with the shared config file. This also enables +Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE +env values as well. + + AWS_SDK_LOAD_CONFIG=1 + +Shared credentials file path can be set to instruct the SDK to use an alternative +file for the shared credentials. If not set the file will be loaded from +$HOME/.aws/credentials on Linux/Unix based systems, and +%USERPROFILE%\.aws\credentials on Windows. + + AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials + +Shared config file path can be set to instruct the SDK to use an alternative +file for the shared config. If not set the file will be loaded from +$HOME/.aws/config on Linux/Unix based systems, and +%USERPROFILE%\.aws\config on Windows. + + AWS_CONFIG_FILE=$HOME/my_shared_config + + +*/ +package session 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 new file mode 100644 index 0000000000..d2f0c84481 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -0,0 +1,188 @@ +package session + +import ( + "os" + "path/filepath" + "strconv" + + "github.com/aws/aws-sdk-go/aws/credentials" +) + +// 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 +// will be ignored. +type envConfig struct { + // Environment configuration values. If set both Access Key ID and Secret Access + // Key must be provided. Session Token and optionally also be provided, but is + // not required. + // + // # Access Key ID + // AWS_ACCESS_KEY_ID=AKID + // AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. + // + // # Secret Access Key + // AWS_SECRET_ACCESS_KEY=SECRET + // AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. + // + // # Session Token + // AWS_SESSION_TOKEN=TOKEN + Creds credentials.Value + + // Region value will instruct the SDK where to make service API requests to. If is + // not provided in the environment the region must be provided before a service + // client request is made. + // + // AWS_REGION=us-east-1 + // + // # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, + // # and AWS_REGION is not also set. + // AWS_DEFAULT_REGION=us-east-1 + Region string + + // Profile name the SDK should load use when loading shared configuration from the + // shared configuration files. If not provided "default" will be used as the + // profile name. + // + // AWS_PROFILE=my_profile + // + // # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, + // # and AWS_PROFILE is not also set. + // AWS_DEFAULT_PROFILE=my_profile + Profile string + + // SDK load config instructs the SDK to load the shared config in addition to + // shared credentials. This also expands the configuration loaded from the shared + // credentials to have parity with the shared config file. This also enables + // Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE + // env values as well. + // + // AWS_SDK_LOAD_CONFIG=1 + EnableSharedConfig bool + + // Shared credentials file path can be set to instruct the SDK to use an alternate + // file for the shared credentials. If not set the file will be loaded from + // $HOME/.aws/credentials on Linux/Unix based systems, and + // %USERPROFILE%\.aws\credentials on Windows. + // + // AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials + SharedCredentialsFile string + + // Shared config file path can be set to instruct the SDK to use an alternate + // file for the shared config. If not set the file will be loaded from + // $HOME/.aws/config on Linux/Unix based systems, and + // %USERPROFILE%\.aws\config on Windows. + // + // AWS_CONFIG_FILE=$HOME/my_shared_config + SharedConfigFile string +} + +var ( + credAccessEnvKey = []string{ + "AWS_ACCESS_KEY_ID", + "AWS_ACCESS_KEY", + } + credSecretEnvKey = []string{ + "AWS_SECRET_ACCESS_KEY", + "AWS_SECRET_KEY", + } + credSessionEnvKey = []string{ + "AWS_SESSION_TOKEN", + } + + regionEnvKeys = []string{ + "AWS_REGION", + "AWS_DEFAULT_REGION", // Only read if AWS_SDK_LOAD_CONFIG is also set + } + profileEnvKeys = []string{ + "AWS_PROFILE", + "AWS_DEFAULT_PROFILE", // Only read if AWS_SDK_LOAD_CONFIG is also set + } +) + +// loadEnvConfig retrieves the SDK's environment configuration. +// See `envConfig` for the values that will be retrieved. +// +// If the environment variable `AWS_SDK_LOAD_CONFIG` is set to a truthy value +// the shared SDK config will be loaded in addition to the SDK's specific +// configuration values. +func loadEnvConfig() envConfig { + enableSharedConfig, _ := strconv.ParseBool(os.Getenv("AWS_SDK_LOAD_CONFIG")) + return envConfigLoad(enableSharedConfig) +} + +// loadEnvSharedConfig retrieves the SDK's environment configuration, and the +// SDK shared config. See `envConfig` for the values that will be retrieved. +// +// Loads the shared configuration in addition to the SDK's specific configuration. +// This will load the same values as `loadEnvConfig` if the `AWS_SDK_LOAD_CONFIG` +// environment variable is set. +func loadSharedEnvConfig() envConfig { + return envConfigLoad(true) +} + +func envConfigLoad(enableSharedConfig bool) envConfig { + cfg := envConfig{} + + cfg.EnableSharedConfig = enableSharedConfig + + setFromEnvVal(&cfg.Creds.AccessKeyID, credAccessEnvKey) + setFromEnvVal(&cfg.Creds.SecretAccessKey, credSecretEnvKey) + setFromEnvVal(&cfg.Creds.SessionToken, credSessionEnvKey) + + // Require logical grouping of credentials + if len(cfg.Creds.AccessKeyID) == 0 || len(cfg.Creds.SecretAccessKey) == 0 { + cfg.Creds = credentials.Value{} + } else { + cfg.Creds.ProviderName = "EnvConfigCredentials" + } + + regionKeys := regionEnvKeys + profileKeys := profileEnvKeys + if !cfg.EnableSharedConfig { + regionKeys = regionKeys[:1] + profileKeys = profileKeys[:1] + } + + setFromEnvVal(&cfg.Region, regionKeys) + setFromEnvVal(&cfg.Profile, profileKeys) + + cfg.SharedCredentialsFile = sharedCredentialsFilename() + cfg.SharedConfigFile = sharedConfigFilename() + + return cfg +} + +func setFromEnvVal(dst *string, keys []string) { + for _, k := range keys { + if v := os.Getenv(k); len(v) > 0 { + *dst = v + break + } + } +} + +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 new file mode 100644 index 0000000000..5a6aa7d879 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go @@ -0,0 +1,276 @@ +package session + +import ( + "os" + "path/filepath" + "strings" + "testing" + + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/stretchr/testify/assert" +) + +func TestLoadEnvConfig_Creds(t *testing.T) { + env := stashEnv() + defer popEnv(env) + + cases := []struct { + Env map[string]string + Val credentials.Value + }{ + { + Env: map[string]string{ + "AWS_ACCESS_KEY": "AKID", + }, + Val: credentials.Value{}, + }, + { + Env: map[string]string{ + "AWS_ACCESS_KEY_ID": "AKID", + }, + Val: credentials.Value{}, + }, + { + Env: map[string]string{ + "AWS_SECRET_KEY": "SECRET", + }, + Val: credentials.Value{}, + }, + { + Env: map[string]string{ + "AWS_SECRET_ACCESS_KEY": "SECRET", + }, + Val: credentials.Value{}, + }, + { + Env: map[string]string{ + "AWS_ACCESS_KEY_ID": "AKID", + "AWS_SECRET_ACCESS_KEY": "SECRET", + }, + Val: credentials.Value{ + AccessKeyID: "AKID", SecretAccessKey: "SECRET", + ProviderName: "EnvConfigCredentials", + }, + }, + { + Env: map[string]string{ + "AWS_ACCESS_KEY": "AKID", + "AWS_SECRET_KEY": "SECRET", + }, + Val: credentials.Value{ + AccessKeyID: "AKID", SecretAccessKey: "SECRET", + ProviderName: "EnvConfigCredentials", + }, + }, + { + Env: map[string]string{ + "AWS_ACCESS_KEY": "AKID", + "AWS_SECRET_KEY": "SECRET", + "AWS_SESSION_TOKEN": "TOKEN", + }, + Val: credentials.Value{ + AccessKeyID: "AKID", SecretAccessKey: "SECRET", SessionToken: "TOKEN", + ProviderName: "EnvConfigCredentials", + }, + }, + } + + for _, c := range cases { + os.Clearenv() + + for k, v := range c.Env { + os.Setenv(k, v) + } + + cfg := loadEnvConfig() + assert.Equal(t, c.Val, cfg.Creds) + } +} + +func TestLoadEnvConfig(t *testing.T) { + env := stashEnv() + defer popEnv(env) + + cases := []struct { + Env map[string]string + Region, Profile string + UseSharedConfigCall bool + }{ + { + Env: map[string]string{ + "AWS_REGION": "region", + "AWS_PROFILE": "profile", + }, + Region: "region", Profile: "profile", + }, + { + Env: map[string]string{ + "AWS_REGION": "region", + "AWS_DEFAULT_REGION": "default_region", + "AWS_PROFILE": "profile", + "AWS_DEFAULT_PROFILE": "default_profile", + }, + Region: "region", Profile: "profile", + }, + { + Env: map[string]string{ + "AWS_REGION": "region", + "AWS_DEFAULT_REGION": "default_region", + "AWS_PROFILE": "profile", + "AWS_DEFAULT_PROFILE": "default_profile", + "AWS_SDK_LOAD_CONFIG": "1", + }, + Region: "region", Profile: "profile", + }, + { + Env: map[string]string{ + "AWS_DEFAULT_REGION": "default_region", + "AWS_DEFAULT_PROFILE": "default_profile", + }, + }, + { + Env: map[string]string{ + "AWS_DEFAULT_REGION": "default_region", + "AWS_DEFAULT_PROFILE": "default_profile", + "AWS_SDK_LOAD_CONFIG": "1", + }, + Region: "default_region", Profile: "default_profile", + }, + { + Env: map[string]string{ + "AWS_REGION": "region", + "AWS_PROFILE": "profile", + }, + Region: "region", Profile: "profile", + UseSharedConfigCall: true, + }, + { + Env: map[string]string{ + "AWS_REGION": "region", + "AWS_DEFAULT_REGION": "default_region", + "AWS_PROFILE": "profile", + "AWS_DEFAULT_PROFILE": "default_profile", + }, + Region: "region", Profile: "profile", + UseSharedConfigCall: true, + }, + { + Env: map[string]string{ + "AWS_REGION": "region", + "AWS_DEFAULT_REGION": "default_region", + "AWS_PROFILE": "profile", + "AWS_DEFAULT_PROFILE": "default_profile", + "AWS_SDK_LOAD_CONFIG": "1", + }, + Region: "region", Profile: "profile", + UseSharedConfigCall: true, + }, + { + Env: map[string]string{ + "AWS_DEFAULT_REGION": "default_region", + "AWS_DEFAULT_PROFILE": "default_profile", + }, + Region: "default_region", Profile: "default_profile", + UseSharedConfigCall: true, + }, + { + Env: map[string]string{ + "AWS_DEFAULT_REGION": "default_region", + "AWS_DEFAULT_PROFILE": "default_profile", + "AWS_SDK_LOAD_CONFIG": "1", + }, + Region: "default_region", Profile: "default_profile", + UseSharedConfigCall: true, + }, + } + + for _, c := range cases { + os.Clearenv() + + for k, v := range c.Env { + os.Setenv(k, v) + } + + var cfg envConfig + if c.UseSharedConfigCall { + cfg = loadSharedEnvConfig() + } else { + cfg = loadEnvConfig() + } + + assert.Equal(t, c.Region, cfg.Region) + assert.Equal(t, c.Profile, cfg.Profile) + } +} + +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) + + os.Setenv("empty_key", "") + os.Setenv("second_key", "2") + os.Setenv("third_key", "3") + + var dst string + setFromEnvVal(&dst, []string{ + "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]) + } +} 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 6bc8f1be95..602f4e1efd 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 @@ -1,17 +1,14 @@ -// Package session provides a way to create service clients with shared configuration -// and handlers. -// -// Generally this package should be used instead of the `defaults` package. -// -// A session should be used to share configurations and request handlers between multiple -// service clients. When service clients need specific configuration aws.Config can be -// used to provide additional configuration directly to the service client. package session import ( + "fmt" + "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/corehandlers" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/defaults" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/private/endpoints" @@ -21,36 +18,204 @@ import ( // store configurations and request handlers for those services. // // Sessions are safe to create service clients concurrently, but it is not safe -// to mutate the session concurrently. +// to mutate the Session concurrently. +// +// The Session satisfies the service client's client.ClientConfigProvider. type Session struct { Config *aws.Config Handlers request.Handlers } -// New creates a new instance of the handlers merging in the provided Configs -// on top of the SDK's default configurations. Once the session is created it -// can be mutated to modify Configs or Handlers. The session is safe to be read -// concurrently, but it should not be written to concurrently. +// New creates a new instance of the handlers merging in the provided configs +// on top of the SDK's default configurations. Once the Session is created it +// can be mutated to modify the Config or Handlers. The Session is safe to be +// read concurrently, but it should not be written to concurrently. // -// Example: -// // Create a session with the default config and request handlers. -// sess := session.New() +// If the AWS_SDK_LOAD_CONFIG environment is set to a truthy value, the New +// method could now encounter an error when loading the configuration. When +// The environment variable is set, and an error occurs, New will return a +// session that will fail all requests reporting the error that occured while +// loading the session. Use NewSession to get the error when creating the +// session. // -// // Create a session with a custom region -// sess := session.New(&aws.Config{Region: aws.String("us-east-1")}) +// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value +// the shared config file (~/.aws/config) will also be loaded, in addition to +// the shared credentials file (~/.aws/config). Values set in both the +// shared config, and shared credentials will be taken from the shared +// credentials file. // -// // Create a session, and add additional handlers for all service -// // clients created with the session to inherit. Adds logging handler. -// sess := session.New() -// sess.Handlers.Send.PushFront(func(r *request.Request) { -// // Log every request made and its payload -// logger.Println("Request: %s/%s, Payload: %s", r.ClientInfo.ServiceName, r.Operation, r.Params) +// Deprecated: Use NewSession functiions to create sessions instead. NewSession +// has the same functionality as New except an error can be returned when the +// func is called instead of waiting to receive an error until a request is made. +func New(cfgs ...*aws.Config) *Session { + // load initial config from environment + envCfg := loadEnvConfig() + + if envCfg.EnableSharedConfig { + s, err := newSession(envCfg, cfgs...) + if err != nil { + // Old session.New expected all errors to be discovered when + // a request is made, and would report the errors then. This + // needs to be replicated if an error occurs while creating + // the session. + msg := "failed to create session with AWS_SDK_LOAD_CONFIG enabled. " + + "Use session.NewSession to handle errors occuring during session creation." + + // Session creation failed, need to report the error and prevent + // any requests from succeeding. + s = &Session{Config: defaults.Config()} + s.Config.MergeIn(cfgs...) + s.Config.Logger.Log("ERROR:", msg, "Error:", err) + s.Handlers.Validate.PushBack(func(r *request.Request) { + r.Error = err + }) + } + return s + } + + return oldNewSession(cfgs...) +} + +// NewSession returns a new Session created from SDK defaults, config files, +// environment, and user provided config files. Once the Session is created +// it can be mutated to modify the Config or Handlers. The Session is safe to +// be read concurrently, but it should not be written to concurrently. +// +// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value +// the shared config file (~/.aws/config) will also be loaded in addition to +// the shared credentials file (~/.aws/config). Values set in both the +// shared config, and shared credentials will be taken from the shared +// credentials file. Enabling the Shared Config will also allow the Session +// to be built with retrieving credentials with AssumeRole set in the config. +// +// See the NewSessionWithOptions func for information on how to override or +// control through code how the Session will be created. Such as specifing the +// config profile, and controlling if shared config is enabled or not. +func NewSession(cfgs ...*aws.Config) (*Session, error) { + envCfg := loadEnvConfig() + + return newSession(envCfg, cfgs...) +} + +// SharedConfigState provides the ability to optionally override the state +// of the session's creation based on the shared config being enabled or +// disabled. +type SharedConfigState int + +const ( + // SharedConfigStateFromEnv does not override any state of the + // AWS_SDK_LOAD_CONFIG env var. It is the default value of the + // SharedConfigState type. + SharedConfigStateFromEnv SharedConfigState = iota + + // SharedConfigDisable overrides the AWS_SDK_LOAD_CONFIG env var value + // and disables the shared config functionality. + SharedConfigDisable + + // SharedConfigEnable overrides the AWS_SDK_LOAD_CONFIG env var value + // and enables the shared config functionality. + SharedConfigEnable +) + +// Options provides the means to control how a Session is created and what +// configuration values will be loaded. +// +type Options struct { + // Provides config values for the SDK to use when creating service clients + // and making API requests to services. Any value set in with this field + // will override the associated value provided by the SDK defaults, + // environment or config files where relevent. + // + // If not set, configuration values from from SDK defaults, environment, + // config will be used. + Config aws.Config + + // Overrides the config profile the Session should be created from. If not + // set the value of the environment variable will be loaded (AWS_PROFILE, + // or AWS_DEFAULT_PROFILE if the Shared Config is enabled). + // + // If not set and environment variables are not set the "default" + // (DefaultSharedConfigProfile) will be used as the profile to load the + // session config from. + Profile string + + // Instructs how the Session will be created based on the AWS_SDK_LOAD_CONFIG + // environment variable. By default a Session will be created using the + // value provided by the AWS_SDK_LOAD_CONFIG environment variable. + // + // Setting this value to SharedConfigEnable or SharedConfigDisable + // will allow you to override the AWS_SDK_LOAD_CONFIG environment variable + // and enable or disable the shared config functionality. + SharedConfigState SharedConfigState +} + +// NewSessionWithOptions returns a new Session created from SDK defaults, config files, +// environment, and user provided config files. This func uses the Options +// values to configure how the Session is created. +// +// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value +// the shared config file (~/.aws/config) will also be loaded in addition to +// the shared credentials file (~/.aws/config). Values set in both the +// shared config, and shared credentials will be taken from the shared +// credentials file. Enabling the Shared Config will also allow the Session +// to be built with retrieving credentials with AssumeRole set in the config. +// +// // Equivalent to session.New +// sess, err := session.NewSessionWithOptions(session.Options{}) +// +// // Specify profile to load for the session's config +// sess, err := session.NewSessionWithOptions(session.Options{ +// Profile: "profile_name", // }) // -// // Create a S3 client instance from a session -// sess := session.New() -// svc := s3.New(sess) -func New(cfgs ...*aws.Config) *Session { +// // Specify profile for config and region for requests +// sess, err := session.NewSessionWithOptions(session.Options{ +// Config: aws.Config{Region: aws.String("us-east-1")}, +// Profile: "profile_name", +// }) +// +// // Force enable Shared Config support +// sess, err := session.NewSessionWithOptions(session.Options{ +// SharedConfigState: SharedConfigEnable, +// }) +func NewSessionWithOptions(opts Options) (*Session, error) { + var envCfg envConfig + if opts.SharedConfigState == SharedConfigEnable { + envCfg = loadSharedEnvConfig() + } else { + envCfg = loadEnvConfig() + } + + if len(opts.Profile) > 0 { + envCfg.Profile = opts.Profile + } + + switch opts.SharedConfigState { + case SharedConfigDisable: + envCfg.EnableSharedConfig = false + case SharedConfigEnable: + envCfg.EnableSharedConfig = true + } + + return newSession(envCfg, &opts.Config) +} + +// Must is a helper function to ensure the Session is valid and there was no +// error when calling a NewSession function. +// +// This helper is intended to be used in variable initialization to load the +// Session and configuration at startup. Such as: +// +// var sess = session.Must(session.NewSession()) +func Must(sess *Session, err error) *Session { + if err != nil { + panic(err) + } + + return sess +} + +func oldNewSession(cfgs ...*aws.Config) *Session { cfg := defaults.Config() handlers := defaults.Handlers() @@ -72,6 +237,115 @@ func New(cfgs ...*aws.Config) *Session { return s } +func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { + cfg := defaults.Config() + handlers := defaults.Handlers() + + // Get a merged version of the user provided config to determine if + // credentials were. + userCfg := &aws.Config{} + userCfg.MergeIn(cfgs...) + + // Order 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:] + } + + // Load additional config from file(s) + sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles) + if err != nil { + return nil, err + } + + mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers) + + s := &Session{ + Config: cfg, + Handlers: handlers, + } + + initHandlers(s) + + return s, nil +} + +func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers) { + // Merge in user provided configuration + cfg.MergeIn(userCfg) + + // Region if not already set by user + if len(aws.StringValue(cfg.Region)) == 0 { + if len(envCfg.Region) > 0 { + cfg.WithRegion(envCfg.Region) + } else if envCfg.EnableSharedConfig && len(sharedCfg.Region) > 0 { + cfg.WithRegion(sharedCfg.Region) + } + } + + // Configure credentials if not already set + if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { + if len(envCfg.Creds.AccessKeyID) > 0 { + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + envCfg.Creds, + ) + } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.RoleARN) > 0 && sharedCfg.AssumeRoleSource != nil { + cfgCp := *cfg + cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( + sharedCfg.AssumeRoleSource.Creds, + ) + cfg.Credentials = stscreds.NewCredentials( + &Session{ + Config: &cfgCp, + Handlers: handlers.Copy(), + }, + sharedCfg.AssumeRole.RoleARN, + func(opt *stscreds.AssumeRoleProvider) { + opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName + + if len(sharedCfg.AssumeRole.ExternalID) > 0 { + opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) + } + + // MFA not supported + }, + ) + } else if len(sharedCfg.Creds.AccessKeyID) > 0 { + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + sharedCfg.Creds, + ) + } else { + // Fallback to default credentials provider, include mock errors + // for the credential chain so user can identify why credentials + // failed to be retrieved. + cfg.Credentials = credentials.NewCredentials(&credentials.ChainProvider{ + VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), + Providers: []credentials.Provider{ + &credProviderError{Err: awserr.New("EnvAccessKeyNotFound", "failed to find credentials in the environment.", nil)}, + &credProviderError{Err: awserr.New("SharedCredsLoad", fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil)}, + defaults.RemoteCredProvider(*cfg, handlers), + }, + }) + } + } +} + +type credProviderError struct { + Err error +} + +var emptyCreds = credentials.Value{} + +func (c credProviderError) Retrieve() (credentials.Value, error) { + return credentials.Value{}, c.Err +} +func (c credProviderError) IsExpired() bool { + return true +} + func initHandlers(s *Session) { // Add the Validate parameter handler if it is not disabled. s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) @@ -80,12 +354,11 @@ func initHandlers(s *Session) { } } -// Copy creates and returns a copy of the current session, coping the config +// Copy creates and returns a copy of the current Session, coping the config // and handlers. If any additional configs are provided they will be merged -// on top of the session's copied config. +// on top of the Session's copied config. // -// Example: -// // Create a copy of the current session, configured for the us-west-2 region. +// // Create a copy of the current Session, configured for the us-west-2 region. // sess.Copy(&aws.Config{Region: aws.String("us-west-2")}) func (s *Session) Copy(cfgs ...*aws.Config) *Session { newSession := &Session{ @@ -101,15 +374,15 @@ func (s *Session) Copy(cfgs ...*aws.Config) *Session { // ClientConfig satisfies the client.ConfigProvider interface and is used to // configure the service client instances. Passing the Session to the service // client's constructor (New) will use this method to configure the client. -// -// Example: -// sess := session.New() -// s3.New(sess) func (s *Session) ClientConfig(serviceName string, cfgs ...*aws.Config) client.Config { s = s.Copy(cfgs...) endpoint, signingRegion := endpoints.NormalizeEndpoint( - aws.StringValue(s.Config.Endpoint), serviceName, - aws.StringValue(s.Config.Region), aws.BoolValue(s.Config.DisableSSL)) + aws.StringValue(s.Config.Endpoint), + serviceName, + aws.StringValue(s.Config.Region), + aws.BoolValue(s.Config.DisableSSL), + aws.BoolValue(s.Config.UseDualStack), + ) return client.Config{ Config: s.Config, 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 e56c02fc66..f8a8ae4b30 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 @@ -1,20 +1,344 @@ -package session_test +package session import ( + "bytes" + "fmt" "net/http" + "net/http/httptest" + "os" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/service/s3" ) func TestNewDefaultSession(t *testing.T) { - s := session.New(&aws.Config{Region: aws.String("region")}) + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + s := New(&aws.Config{Region: aws.String("region")}) assert.Equal(t, "region", *s.Config.Region) assert.Equal(t, http.DefaultClient, s.Config.HTTPClient) assert.NotNil(t, s.Config.Logger) assert.Equal(t, aws.LogOff, *s.Config.LogLevel) } + +func TestNew_WithCustomCreds(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + customCreds := credentials.NewStaticCredentials("AKID", "SECRET", "TOKEN") + s := New(&aws.Config{Credentials: customCreds}) + + assert.Equal(t, customCreds, s.Config.Credentials) +} + +type mockLogger struct { + *bytes.Buffer +} + +func (w mockLogger) Log(args ...interface{}) { + fmt.Fprintln(w, args...) +} + +func TestNew_WithSessionLoadError(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_CONFIG_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "assume_role_invalid_source_profile") + + logger := bytes.Buffer{} + s := New(&aws.Config{Logger: &mockLogger{&logger}}) + + assert.NotNil(t, s) + + svc := s3.New(s) + _, err := svc.ListBuckets(&s3.ListBucketsInput{}) + + assert.Error(t, err) + assert.Contains(t, logger.String(), "ERROR: failed to create session with AWS_SDK_LOAD_CONFIG enabled") + assert.Contains(t, err.Error(), SharedConfigAssumeRoleError{ + RoleARN: "assume_role_invalid_source_profile_role_arn", + }.Error()) +} + +func TestSessionCopy(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_REGION", "orig_region") + + s := Session{ + Config: defaults.Config(), + Handlers: defaults.Handlers(), + } + + newSess := s.Copy(&aws.Config{Region: aws.String("new_region")}) + + assert.Equal(t, "orig_region", *s.Config.Region) + assert.Equal(t, "new_region", *newSess.Config.Region) +} + +func TestSessionClientConfig(t *testing.T) { + s, err := NewSession(&aws.Config{Region: aws.String("orig_region")}) + assert.NoError(t, err) + + cfg := s.ClientConfig("s3", &aws.Config{Region: aws.String("us-west-2")}) + + assert.Equal(t, "https://s3-us-west-2.amazonaws.com", cfg.Endpoint) + assert.Empty(t, cfg.SigningRegion) + assert.Equal(t, "us-west-2", *cfg.Config.Region) +} + +func TestNewSession_NoCredentials(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + s, err := NewSession() + assert.NoError(t, err) + + assert.NotNil(t, s.Config.Credentials) + assert.NotEqual(t, credentials.AnonymousCredentials, s.Config.Credentials) +} + +func TestNewSessionWithOptions_OverrideProfile(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "other_profile") + + s, err := NewSessionWithOptions(Options{ + Profile: "full_profile", + }) + assert.NoError(t, err) + + assert.Equal(t, "full_profile_region", *s.Config.Region) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "full_profile_akid", creds.AccessKeyID) + assert.Equal(t, "full_profile_secret", creds.SecretAccessKey) + assert.Empty(t, creds.SessionToken) + assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") +} + +func TestNewSessionWithOptions_OverrideSharedConfigEnable(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "0") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "full_profile") + + s, err := NewSessionWithOptions(Options{ + SharedConfigState: SharedConfigEnable, + }) + assert.NoError(t, err) + + assert.Equal(t, "full_profile_region", *s.Config.Region) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "full_profile_akid", creds.AccessKeyID) + assert.Equal(t, "full_profile_secret", creds.SecretAccessKey) + assert.Empty(t, creds.SessionToken) + assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") +} + +func TestNewSessionWithOptions_OverrideSharedConfigDisable(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "full_profile") + + s, err := NewSessionWithOptions(Options{ + SharedConfigState: SharedConfigDisable, + }) + assert.NoError(t, err) + + assert.Empty(t, *s.Config.Region) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "full_profile_akid", creds.AccessKeyID) + assert.Equal(t, "full_profile_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 + InProfile string + OutRegion string + OutCreds credentials.Value + }{ + { + InEnvs: map[string]string{ + "AWS_SDK_LOAD_CONFIG": "0", + "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename, + "AWS_PROFILE": "other_profile", + }, + InProfile: "full_profile", + OutRegion: "full_profile_region", + OutCreds: credentials.Value{ + AccessKeyID: "full_profile_akid", + SecretAccessKey: "full_profile_secret", + ProviderName: "SharedConfigCredentials", + }, + }, + { + InEnvs: map[string]string{ + "AWS_SDK_LOAD_CONFIG": "0", + "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename, + "AWS_REGION": "env_region", + "AWS_ACCESS_KEY": "env_akid", + "AWS_SECRET_ACCESS_KEY": "env_secret", + "AWS_PROFILE": "other_profile", + }, + InProfile: "full_profile", + OutRegion: "env_region", + OutCreds: credentials.Value{ + AccessKeyID: "env_akid", + SecretAccessKey: "env_secret", + ProviderName: "EnvConfigCredentials", + }, + }, + { + InEnvs: map[string]string{ + "AWS_SDK_LOAD_CONFIG": "0", + "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename, + "AWS_CONFIG_FILE": testConfigOtherFilename, + "AWS_PROFILE": "shared_profile", + }, + InProfile: "config_file_load_order", + OutRegion: "shared_config_region", + OutCreds: credentials.Value{ + AccessKeyID: "shared_config_akid", + SecretAccessKey: "shared_config_secret", + ProviderName: "SharedConfigCredentials", + }, + }, + } + + for _, c := range cases { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + for k, v := range c.InEnvs { + os.Setenv(k, v) + } + + s, err := NewSessionWithOptions(Options{ + Profile: c.InProfile, + SharedConfigState: SharedConfigEnable, + }) + assert.NoError(t, err) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, c.OutRegion, *s.Config.Region) + assert.Equal(t, c.OutCreds.AccessKeyID, creds.AccessKeyID) + assert.Equal(t, c.OutCreds.SecretAccessKey, creds.SecretAccessKey) + assert.Equal(t, c.OutCreds.SessionToken, creds.SessionToken) + assert.Contains(t, creds.ProviderName, c.OutCreds.ProviderName) + } +} + +func TestSesisonAssumeRole(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_REGION", "us-east-1") + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "assume_role_w_creds") + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + const respMsg = ` + + + + arn:aws:sts::account_id:assumed-role/role/session_name + AKID:session_name + + + AKID + SECRET + SESSION_TOKEN + %s + + + + request-id + + +` + w.Write([]byte(fmt.Sprintf(respMsg, time.Now().Add(15*time.Minute).Format("2006-01-02T15:04:05Z")))) + })) + + s, err := NewSession(&aws.Config{Endpoint: aws.String(server.URL), DisableSSL: aws.Bool(true)}) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "AKID", creds.AccessKeyID) + assert.Equal(t, "SECRET", creds.SecretAccessKey) + assert.Equal(t, "SESSION_TOKEN", creds.SessionToken) + assert.Contains(t, creds.ProviderName, "AssumeRoleProvider") +} + +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) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "0") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "assume_role_w_creds") + + s, err := NewSession() + assert.NoError(t, err) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "assume_role_w_creds_akid", creds.AccessKeyID) + assert.Equal(t, "assume_role_w_creds_secret", creds.SecretAccessKey) + assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") +} + +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) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "assume_role_invalid_source_profile") + + s, err := NewSession() + assert.Error(t, err) + assert.Contains(t, err.Error(), "SharedConfigAssumeRoleError: failed to load assume role") + assert.Nil(t, s) +} + +func initSessionTestEnv() (oldEnv []string) { + oldEnv = stashEnv() + os.Setenv("AWS_CONFIG_FILE", "file_not_exists") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "file_not_exists") + + return oldEnv +} 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 new file mode 100644 index 0000000000..b58076f5e3 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go @@ -0,0 +1,295 @@ +package session + +import ( + "fmt" + "io/ioutil" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/go-ini/ini" +) + +const ( + // Static Credentials group + accessKeyIDKey = `aws_access_key_id` // group required + secretAccessKey = `aws_secret_access_key` // group required + sessionTokenKey = `aws_session_token` // optional + + // Assume Role Credentials group + roleArnKey = `role_arn` // group required + sourceProfileKey = `source_profile` // group required + externalIDKey = `external_id` // optional + mfaSerialKey = `mfa_serial` // optional + roleSessionNameKey = `role_session_name` // optional + + // Additional Config fields + regionKey = `region` + + // DefaultSharedConfigProfile is the default profile to be used when + // loading configuration from the config files if another profile name + // is not provided. + DefaultSharedConfigProfile = `default` +) + +type assumeRoleConfig struct { + RoleARN string + SourceProfile string + ExternalID string + MFASerial string + RoleSessionName string +} + +// sharedConfig represents the configuration fields of the SDK config files. +type sharedConfig struct { + // Credentials values from the config file. Both aws_access_key_id + // and aws_secret_access_key must be provided together in the same file + // to be considered valid. The values will be ignored if not a complete group. + // aws_session_token is an optional field that can be provided if both of the + // other two fields are also provided. + // + // aws_access_key_id + // aws_secret_access_key + // aws_session_token + Creds credentials.Value + + AssumeRole assumeRoleConfig + AssumeRoleSource *sharedConfig + + // Region is the region the SDK should use for looking up AWS service endpoints + // and signing requests. + // + // region + Region string +} + +type sharedConfigFile struct { + Filename string + IniData *ini.File +} + +// loadSharedConfig retrieves the configuration from the list of files +// using the profile provided. The order the files are listed will determine +// precedence. Values in subsequent files will overwrite values defined in +// earlier files. +// +// For example, given two files A and B. Both define credentials. If the order +// of the files are A then B, B's credential values will be used instead of A's. +// +// See sharedConfig.setFromFile for information how the config files +// will be loaded. +func loadSharedConfig(profile string, filenames []string) (sharedConfig, error) { + if len(profile) == 0 { + profile = DefaultSharedConfigProfile + } + + files, err := loadSharedConfigIniFiles(filenames) + if err != nil { + return sharedConfig{}, err + } + + cfg := sharedConfig{} + if err = cfg.setFromIniFiles(profile, files); err != nil { + return sharedConfig{}, err + } + + if len(cfg.AssumeRole.SourceProfile) > 0 { + if err := cfg.setAssumeRoleSource(profile, files); err != nil { + return sharedConfig{}, err + } + } + + return cfg, nil +} + +func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { + files := make([]sharedConfigFile, 0, len(filenames)) + + for _, filename := range filenames { + b, err := ioutil.ReadFile(filename) + if err != nil { + // Skip files which can't be opened and read for whatever reason + continue + } + + f, err := ini.Load(b) + if err != nil { + return nil, SharedConfigLoadError{Filename: filename} + } + + files = append(files, sharedConfigFile{ + Filename: filename, IniData: f, + }) + } + + return files, nil +} + +func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { + var assumeRoleSrc sharedConfig + + // Multiple level assume role chains are not support + if cfg.AssumeRole.SourceProfile == origProfile { + assumeRoleSrc = *cfg + assumeRoleSrc.AssumeRole = assumeRoleConfig{} + } else { + err := assumeRoleSrc.setFromIniFiles(cfg.AssumeRole.SourceProfile, files) + if err != nil { + return err + } + } + + if len(assumeRoleSrc.Creds.AccessKeyID) == 0 { + return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} + } + + cfg.AssumeRoleSource = &assumeRoleSrc + + return nil +} + +func (cfg *sharedConfig) setFromIniFiles(profile string, files []sharedConfigFile) error { + // Trim files from the list that don't exist. + for _, f := range files { + if err := cfg.setFromIniFile(profile, f); err != nil { + if _, ok := err.(SharedConfigProfileNotExistsError); ok { + // Ignore proviles missings + continue + } + return err + } + } + + return nil +} + +// setFromFile loads the configuration from the file using +// the profile provided. A sharedConfig pointer type value is used so that +// multiple config file loadings can be chained. +// +// Only loads complete logically grouped values, and will not set fields in cfg +// for incomplete grouped values in the config. Such as credentials. For example +// if a config file only includes aws_access_key_id but no aws_secret_access_key +// the aws_access_key_id will be ignored. +func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) error { + section, err := file.IniData.GetSection(profile) + if err != nil { + // Fallback to to alternate profile name: profile + section, err = file.IniData.GetSection(fmt.Sprintf("profile %s", profile)) + if err != nil { + return SharedConfigProfileNotExistsError{Profile: profile, Err: err} + } + } + + // Shared Credentials + akid := section.Key(accessKeyIDKey).String() + secret := section.Key(secretAccessKey).String() + if len(akid) > 0 && len(secret) > 0 { + cfg.Creds = credentials.Value{ + AccessKeyID: akid, + SecretAccessKey: secret, + SessionToken: section.Key(sessionTokenKey).String(), + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), + } + } + + // Assume Role + roleArn := section.Key(roleArnKey).String() + srcProfile := section.Key(sourceProfileKey).String() + if len(roleArn) > 0 && len(srcProfile) > 0 { + cfg.AssumeRole = assumeRoleConfig{ + RoleARN: roleArn, + SourceProfile: srcProfile, + ExternalID: section.Key(externalIDKey).String(), + MFASerial: section.Key(mfaSerialKey).String(), + RoleSessionName: section.Key(roleSessionNameKey).String(), + } + } + + // Region + if v := section.Key(regionKey).String(); len(v) > 0 { + cfg.Region = v + } + + return nil +} + +// SharedConfigLoadError is an error for the shared config file failed to load. +type SharedConfigLoadError struct { + Filename string + Err error +} + +// Code is the short id of the error. +func (e SharedConfigLoadError) Code() string { + return "SharedConfigLoadError" +} + +// Message is the description of the error +func (e SharedConfigLoadError) Message() string { + return fmt.Sprintf("failed to load config file, %s", e.Filename) +} + +// OrigErr is the underlying error that caused the failure. +func (e SharedConfigLoadError) OrigErr() error { + return e.Err +} + +// Error satisfies the error interface. +func (e SharedConfigLoadError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", e.Err) +} + +// SharedConfigProfileNotExistsError is an error for the shared config when +// the profile was not find in the config file. +type SharedConfigProfileNotExistsError struct { + Profile string + Err error +} + +// Code is the short id of the error. +func (e SharedConfigProfileNotExistsError) Code() string { + return "SharedConfigProfileNotExistsError" +} + +// Message is the description of the error +func (e SharedConfigProfileNotExistsError) Message() string { + return fmt.Sprintf("failed to get profile, %s", e.Profile) +} + +// OrigErr is the underlying error that caused the failure. +func (e SharedConfigProfileNotExistsError) OrigErr() error { + return e.Err +} + +// Error satisfies the error interface. +func (e SharedConfigProfileNotExistsError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", e.Err) +} + +// SharedConfigAssumeRoleError is an error for the shared config when the +// profile contains assume role information, but that information is invalid +// or not complete. +type SharedConfigAssumeRoleError struct { + RoleARN string +} + +// Code is the short id of the error. +func (e SharedConfigAssumeRoleError) Code() string { + return "SharedConfigAssumeRoleError" +} + +// Message is the description of the error +func (e SharedConfigAssumeRoleError) Message() string { + return fmt.Sprintf("failed to load assume role for %s, source profile has no shared credentials", + e.RoleARN) +} + +// OrigErr is the underlying error that caused the failure. +func (e SharedConfigAssumeRoleError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e SharedConfigAssumeRoleError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go new file mode 100644 index 0000000000..1a164d46d8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go @@ -0,0 +1,264 @@ +package session + +import ( + "fmt" + "path/filepath" + "testing" + + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/go-ini/ini" + "github.com/stretchr/testify/assert" +) + +var ( + testConfigFilename = filepath.Join("testdata", "shared_config") + testConfigOtherFilename = filepath.Join("testdata", "shared_config_other") +) + +func TestLoadSharedConfig(t *testing.T) { + cases := []struct { + Filenames []string + Profile string + Expected sharedConfig + Err error + }{ + { + Filenames: []string{"file_not_exists"}, + Profile: "default", + }, + { + Filenames: []string{testConfigFilename}, + Expected: sharedConfig{ + Region: "default_region", + }, + }, + { + Filenames: []string{testConfigOtherFilename, testConfigFilename}, + Profile: "config_file_load_order", + Expected: sharedConfig{ + Region: "shared_config_region", + Creds: credentials.Value{ + AccessKeyID: "shared_config_akid", + SecretAccessKey: "shared_config_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + }, + }, + { + Filenames: []string{testConfigFilename, testConfigOtherFilename}, + Profile: "config_file_load_order", + Expected: sharedConfig{ + Region: "shared_config_other_region", + Creds: credentials.Value{ + AccessKeyID: "shared_config_other_akid", + SecretAccessKey: "shared_config_other_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigOtherFilename), + }, + }, + }, + { + Filenames: []string{testConfigOtherFilename, testConfigFilename}, + Profile: "assume_role", + Expected: sharedConfig{ + AssumeRole: assumeRoleConfig{ + RoleARN: "assume_role_role_arn", + SourceProfile: "complete_creds", + }, + AssumeRoleSource: &sharedConfig{ + Creds: credentials.Value{ + AccessKeyID: "complete_creds_akid", + SecretAccessKey: "complete_creds_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + }, + }, + }, + { + Filenames: []string{testConfigOtherFilename, testConfigFilename}, + Profile: "assume_role_invalid_source_profile", + Expected: sharedConfig{ + AssumeRole: assumeRoleConfig{ + RoleARN: "assume_role_invalid_source_profile_role_arn", + SourceProfile: "profile_not_exists", + }, + }, + Err: SharedConfigAssumeRoleError{RoleARN: "assume_role_invalid_source_profile_role_arn"}, + }, + { + Filenames: []string{testConfigOtherFilename, testConfigFilename}, + Profile: "assume_role_w_creds", + Expected: sharedConfig{ + Creds: credentials.Value{ + AccessKeyID: "assume_role_w_creds_akid", + SecretAccessKey: "assume_role_w_creds_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + AssumeRole: assumeRoleConfig{ + RoleARN: "assume_role_w_creds_role_arn", + SourceProfile: "assume_role_w_creds", + ExternalID: "1234", + RoleSessionName: "assume_role_w_creds_session_name", + }, + AssumeRoleSource: &sharedConfig{ + Creds: credentials.Value{ + AccessKeyID: "assume_role_w_creds_akid", + SecretAccessKey: "assume_role_w_creds_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + }, + }, + }, + { + Filenames: []string{testConfigOtherFilename, testConfigFilename}, + Profile: "assume_role_wo_creds", + Expected: sharedConfig{ + AssumeRole: assumeRoleConfig{ + RoleARN: "assume_role_wo_creds_role_arn", + SourceProfile: "assume_role_wo_creds", + }, + }, + Err: SharedConfigAssumeRoleError{RoleARN: "assume_role_wo_creds_role_arn"}, + }, + { + Filenames: []string{filepath.Join("testdata", "shared_config_invalid_ini")}, + Profile: "profile_name", + Err: SharedConfigLoadError{Filename: filepath.Join("testdata", "shared_config_invalid_ini")}, + }, + } + + for i, c := range cases { + cfg, err := loadSharedConfig(c.Profile, c.Filenames) + if c.Err != nil { + assert.Contains(t, err.Error(), c.Err.Error(), "expected error, %d", i) + continue + } + + assert.NoError(t, err, "unexpected error, %d", i) + assert.Equal(t, c.Expected, cfg, "not equal, %d", i) + } +} + +func TestLoadSharedConfigFromFile(t *testing.T) { + filename := testConfigFilename + f, err := ini.Load(filename) + if err != nil { + t.Fatalf("failed to load test config file, %s, %v", filename, err) + } + iniFile := sharedConfigFile{IniData: f, Filename: filename} + + cases := []struct { + Profile string + Expected sharedConfig + Err error + }{ + { + Profile: "default", + Expected: sharedConfig{Region: "default_region"}, + }, + { + Profile: "alt_profile_name", + Expected: sharedConfig{Region: "alt_profile_name_region"}, + }, + { + Profile: "short_profile_name_first", + Expected: sharedConfig{Region: "short_profile_name_first_short"}, + }, + { + Profile: "partial_creds", + Expected: sharedConfig{}, + }, + { + Profile: "complete_creds", + Expected: sharedConfig{ + Creds: credentials.Value{ + AccessKeyID: "complete_creds_akid", + SecretAccessKey: "complete_creds_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + }, + }, + { + Profile: "complete_creds_with_token", + Expected: sharedConfig{ + Creds: credentials.Value{ + AccessKeyID: "complete_creds_with_token_akid", + SecretAccessKey: "complete_creds_with_token_secret", + SessionToken: "complete_creds_with_token_token", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + }, + }, + { + Profile: "full_profile", + Expected: sharedConfig{ + Creds: credentials.Value{ + AccessKeyID: "full_profile_akid", + SecretAccessKey: "full_profile_secret", + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), + }, + Region: "full_profile_region", + }, + }, + { + Profile: "partial_assume_role", + Expected: sharedConfig{}, + }, + { + Profile: "assume_role", + Expected: sharedConfig{ + AssumeRole: assumeRoleConfig{ + RoleARN: "assume_role_role_arn", + SourceProfile: "complete_creds", + }, + }, + }, + { + Profile: "does_not_exists", + Err: SharedConfigProfileNotExistsError{Profile: "does_not_exists"}, + }, + } + + for i, c := range cases { + cfg := sharedConfig{} + + err := cfg.setFromIniFile(c.Profile, iniFile) + if c.Err != nil { + assert.Contains(t, err.Error(), c.Err.Error(), "expected error, %d", i) + continue + } + + assert.NoError(t, err, "unexpected error, %d", i) + assert.Equal(t, c.Expected, cfg, "not equal, %d", i) + } +} + +func TestLoadSharedConfigIniFiles(t *testing.T) { + cases := []struct { + Filenames []string + Expected []sharedConfigFile + }{ + { + Filenames: []string{"not_exists", testConfigFilename}, + Expected: []sharedConfigFile{ + {Filename: testConfigFilename}, + }, + }, + { + Filenames: []string{testConfigFilename, testConfigOtherFilename}, + Expected: []sharedConfigFile{ + {Filename: testConfigFilename}, + {Filename: testConfigOtherFilename}, + }, + }, + } + + for i, c := range cases { + files, err := loadSharedConfigIniFiles(c.Filenames) + assert.NoError(t, err, "unexpected error, %d", i) + assert.Equal(t, len(c.Expected), len(files), "expected num files, %d", i) + + for i, expectedFile := range c.Expected { + assert.Equal(t, expectedFile.Filename, files[i].Filename) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config b/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config new file mode 100644 index 0000000000..e41fe21377 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config @@ -0,0 +1,60 @@ +[default] +s3 = + unsupported_key=123 + other_unsupported=abc + +region = default_region + +[profile alt_profile_name] +region = alt_profile_name_region + +[short_profile_name_first] +region = short_profile_name_first_short + +[profile short_profile_name_first] +region = short_profile_name_first_alt + +[partial_creds] +aws_access_key_id = partial_creds_akid + +[complete_creds] +aws_access_key_id = complete_creds_akid +aws_secret_access_key = complete_creds_secret + +[complete_creds_with_token] +aws_access_key_id = complete_creds_with_token_akid +aws_secret_access_key = complete_creds_with_token_secret +aws_session_token = complete_creds_with_token_token + +[full_profile] +aws_access_key_id = full_profile_akid +aws_secret_access_key = full_profile_secret +region = full_profile_region + +[config_file_load_order] +region = shared_config_region +aws_access_key_id = shared_config_akid +aws_secret_access_key = shared_config_secret + +[partial_assume_role] +role_arn = partial_assume_role_role_arn + +[assume_role] +role_arn = assume_role_role_arn +source_profile = complete_creds + +[assume_role_invalid_source_profile] +role_arn = assume_role_invalid_source_profile_role_arn +source_profile = profile_not_exists + +[assume_role_w_creds] +role_arn = assume_role_w_creds_role_arn +source_profile = assume_role_w_creds +external_id = 1234 +role_session_name = assume_role_w_creds_session_name +aws_access_key_id = assume_role_w_creds_akid +aws_secret_access_key = assume_role_w_creds_secret + +[assume_role_wo_creds] +role_arn = assume_role_wo_creds_role_arn +source_profile = assume_role_wo_creds diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_invalid_ini b/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_invalid_ini new file mode 100644 index 0000000000..4db038952a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_invalid_ini @@ -0,0 +1 @@ +[profile_nam diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_other b/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_other new file mode 100644 index 0000000000..615831b1af --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/testdata/shared_config_other @@ -0,0 +1,17 @@ +[default] +region = default_region + +[partial_creds] +aws_access_key_id = AKID + +[profile alt_profile_name] +region = alt_profile_name_region + +[creds_from_credentials] +aws_access_key_id = creds_from_config_akid +aws_secret_access_key = creds_from_config_secret + +[config_file_load_order] +region = shared_config_other_region +aws_access_key_id = shared_config_other_akid +aws_secret_access_key = shared_config_other_secret diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_4_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_4_test.go new file mode 100644 index 0000000000..e559838b84 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_4_test.go @@ -0,0 +1,40 @@ +// +build !go1.5 + +package v4_test + +import ( + "fmt" + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/stretchr/testify/assert" +) + +func TestStandaloneSign(t *testing.T) { + creds := unit.Session.Config.Credentials + signer := v4.NewSigner(creds) + + for _, c := range standaloneSignCases { + host := fmt.Sprintf("%s.%s.%s.amazonaws.com", + c.SubDomain, c.Region, c.Service) + + req, err := http.NewRequest("GET", fmt.Sprintf("https://%s", host), nil) + assert.NoError(t, err) + + req.URL.Path = c.OrigURI + req.URL.RawQuery = c.OrigQuery + req.URL.Opaque = fmt.Sprintf("//%s%s", host, c.EscapedURI) + opaqueURI := req.URL.Opaque + + _, err = signer.Sign(req, nil, c.Service, c.Region, time.Unix(0, 0)) + assert.NoError(t, err) + + actual := req.Header.Get("Authorization") + assert.Equal(t, c.ExpSig, actual) + assert.Equal(t, c.OrigURI, req.URL.Path) + assert.Equal(t, opaqueURI, req.URL.Opaque) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go new file mode 100644 index 0000000000..6f0d549d52 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go @@ -0,0 +1,40 @@ +// +build go1.5 + +package v4_test + +import ( + "fmt" + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/stretchr/testify/assert" +) + +func TestStandaloneSign(t *testing.T) { + creds := unit.Session.Config.Credentials + signer := v4.NewSigner(creds) + + for _, c := range standaloneSignCases { + host := fmt.Sprintf("https://%s.%s.%s.amazonaws.com", + c.SubDomain, c.Region, c.Service) + + req, err := http.NewRequest("GET", host, nil) + assert.NoError(t, err) + + // URL.EscapedPath() will be used by the signer to get the + // escaped form of the request's URI path. + req.URL.Path = c.OrigURI + req.URL.RawQuery = c.OrigQuery + + _, err = signer.Sign(req, nil, c.Service, c.Region, time.Unix(0, 0)) + assert.NoError(t, err) + + actual := req.Header.Get("Authorization") + assert.Equal(t, c.ExpSig, actual) + assert.Equal(t, c.OrigURI, req.URL.Path) + assert.Equal(t, c.EscapedURI, req.URL.EscapedPath()) + } +} 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 e4329c6249..f86293a607 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 @@ -7,11 +7,28 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "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 { + OrigURI string + OrigQuery string + Region, Service, SubDomain string + ExpSig string + EscapedURI string +}{ + { + OrigURI: `/logs-*/_search`, + OrigQuery: `pretty=true`, + Region: "us-west-2", Service: "es", SubDomain: "hostname-clusterkey", + EscapedURI: `/logs-%2A/_search`, + ExpSig: `AWS4-HMAC-SHA256 Credential=AKID/19700101/us-west-2/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=79d0760751907af16f64a537c1242416dacf51204a7dd5284492d15577973b91`, + }, +} + func TestPresignHandler(t *testing.T) { svc := s3.New(unit.Session) req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ @@ -75,3 +92,25 @@ func TestPresignRequest(t *testing.T) { assert.NotContains(t, urlstr, "+") // + encoded as %20 } + +func TestStandaloneSign_CustomURIEscape(t *testing.T) { + var expectSig = `AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=6601e883cc6d23871fd6c2a394c5677ea2b8c82b04a6446786d64cd74f520967` + + creds := unit.Session.Config.Credentials + signer := v4.NewSigner(creds, func(s *v4.Signer) { + s.DisableURIPathEscaping = true + }) + + host := "https://subdomain.us-east-1.es.amazonaws.com" + req, err := http.NewRequest("GET", host, nil) + assert.NoError(t, 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) + + actual := req.Header.Get("Authorization") + assert.Equal(t, expectSig, actual) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go new file mode 100644 index 0000000000..bd082e9d1f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go @@ -0,0 +1,24 @@ +// +build go1.5 + +package v4 + +import ( + "net/url" + "strings" +) + +func getURIPath(u *url.URL) string { + var uri string + + if len(u.Opaque) > 0 { + uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") + } else { + uri = u.EscapedPath() + } + + if len(uri) == 0 { + uri = "/" + } + + return uri +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path_1_4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path_1_4.go new file mode 100644 index 0000000000..796604121c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path_1_4.go @@ -0,0 +1,24 @@ +// +build !go1.5 + +package v4 + +import ( + "net/url" + "strings" +) + +func getURIPath(u *url.URL) string { + var uri string + + if len(u.Opaque) > 0 { + uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") + } else { + uri = u.Path + } + + if len(uri) == 0 { + uri = "/" + } + + return uri +} 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 f040f9ce99..986530b401 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 @@ -2,6 +2,48 @@ // // Provides request signing for request that need to be signed with // AWS V4 Signatures. +// +// Standalone Signer +// +// Generally using the signer outside of the SDK should not require any additional +// logic when using Go v1.5 or higher. The signer does this by taking advantage +// of the URL.EscapedPath method. If your request URI requires additional escaping +// you many need to use the URL.Opaque to define what the raw URI should be sent +// to the service as. +// +// The signer will first check the URL.Opaque field, and use its value if set. +// The signer does require the URL.Opaque field to be set in the form of: +// +// "///" +// +// // e.g. +// "//example.com/some/path" +// +// The leading "//" and hostname are required or the URL.Opaque escaping will +// not work correctly. +// +// If URL.Opaque is not set the signer will fallback to the URL.EscapedPath() +// method and using the returned value. If you're using Go v1.4 you must set +// URL.Opaque if the URI path needs escaping. If URL.Opaque is not set with +// Go v1.5 the signer will fallback to URL.Path. +// +// AWS v4 signature validation requires that the canonical string's URI path +// element must be the URI escaped form of the HTTP request's path. +// http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html +// +// The Go HTTP client will perform escaping automatically on the request. Some +// of these escaping may cause signature validation errors because the HTTP +// request differs from the URI path or query that the signature was generated. +// https://golang.org/pkg/net/url/#URL.EscapedPath +// +// Because of this, it is recommended that when using the signer outside of the +// SDK that explicitly escaping the request prior to being signed is preferable, +// and will help prevent signature validation errors. This can be done by setting +// the URL.Opaque or URL.RawPath. The SDK will use URL.Opaque first and then +// call URL.EscapedPath() if Opaque is not set. +// +// Test `TestStandaloneSign` provides a complete example of using the signer +// outside of the SDK and pre-escaping the URI path. package v4 import ( @@ -11,6 +53,7 @@ import ( "encoding/hex" "fmt" "io" + "io/ioutil" "net/http" "net/url" "sort" @@ -119,6 +162,15 @@ type Signer struct { // request's query string. DisableHeaderHoisting bool + // Disables the automatic escaping of the URI path of the request for the + // siganture's canonical string's path. For services that do not need additional + // escaping then use this to disable the signer escaping the path. + // + // S3 is an example of a service that does not need additional escaping. + // + // http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html + DisableURIPathEscaping bool + // currentTimeFn returns the time value which represents the current time. // This value should only be used for testing. If it is nil the default // time.Now will be used. @@ -150,6 +202,8 @@ type signingCtx struct { ExpireTime time.Duration SignedHeaderVals http.Header + DisableURIPathEscaping bool + credValues credentials.Value isPresign bool formattedTime string @@ -175,6 +229,12 @@ type signingCtx struct { // is not needed as the full request context will be captured by the http.Request // value. It is included for reference though. // +// Sign will set the request's Body to be the `body` parameter passed in. If +// the body is not already an io.ReadCloser, it will be wrapped within one. If +// a `nil` body parameter passed to Sign, the request's Body field will be +// also set to nil. Its important to note that this functionality will not +// change the request's ContentLength of the request. +// // Sign differs from Presign in that it will sign the request using HTTP // header values. This type of signing is intended for http.Request values that // will not be shared, or are shared in a way the header values on the request @@ -229,22 +289,18 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi } ctx := &signingCtx{ - Request: r, - Body: body, - Query: r.URL.Query(), - Time: signTime, - ExpireTime: exp, - isPresign: exp != 0, - ServiceName: service, - Region: region, + Request: r, + Body: body, + Query: r.URL.Query(), + Time: signTime, + ExpireTime: exp, + isPresign: exp != 0, + ServiceName: service, + Region: region, + DisableURIPathEscaping: v4.DisableURIPathEscaping, } if ctx.isRequestSigned() { - if !v4.Credentials.IsExpired() && currentTimeFn().Before(ctx.Time.Add(10*time.Minute)) { - // If the request is already signed, and the credentials have not - // expired, and the request is not too old ignore the signing request. - return ctx.SignedHeaderVals, nil - } ctx.Time = currentTimeFn() ctx.handlePresignRemoval() } @@ -258,6 +314,20 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi ctx.assignAmzQueryValues() ctx.build(v4.DisableHeaderHoisting) + // If the request is not presigned the body should be attached to it. This + // prevents the confusion of wanting to send a signed request without + // the body the request was signed for attached. + if !ctx.isPresign { + var reader io.ReadCloser + if body != nil { + var ok bool + if reader, ok = body.(io.ReadCloser); !ok { + reader = ioutil.NopCloser(body) + } + } + r.Body = reader + } + if v4.Debug.Matches(aws.LogDebugWithSigning) { v4.logSigningInfo(ctx) } @@ -338,6 +408,10 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time v4.Logger = req.Config.Logger v4.DisableHeaderHoisting = req.NotHoist v4.currentTimeFn = curTimeFn + if name == "s3" { + // S3 service should not have any escaping applied + v4.DisableURIPathEscaping = true + } }) signingTime := req.Time @@ -345,7 +419,9 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time signingTime = req.LastSignedAt } - signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.Body, name, region, req.ExpireTime, signingTime) + signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.GetBody(), + name, region, req.ExpireTime, signingTime, + ) if err != nil { req.Error = err req.SignedHeaderVals = nil @@ -356,7 +432,7 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time req.LastSignedAt = curTimeFn() } -const logSignInfoMsg = `DEBUG: Request Signiture: +const logSignInfoMsg = `DEBUG: Request Signature: ---[ CANONICAL STRING ]----------------------------- %s ---[ STRING TO SIGN ]-------------------------------- @@ -492,17 +568,10 @@ func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { func (ctx *signingCtx) buildCanonicalString() { ctx.Request.URL.RawQuery = strings.Replace(ctx.Query.Encode(), "+", "%20", -1) - uri := ctx.Request.URL.Opaque - if uri != "" { - uri = "/" + strings.Join(strings.Split(uri, "/")[3:], "/") - } else { - uri = ctx.Request.URL.Path - } - if uri == "" { - uri = "/" - } - if ctx.ServiceName != "s3" { + uri := getURIPath(ctx.Request.URL) + + if !ctx.DisableURIPathEscaping { uri = rest.EscapePath(uri, false) } @@ -545,7 +614,7 @@ func (ctx *signingCtx) buildBodyDigest() { } else { hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) } - if ctx.ServiceName == "s3" { + if ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { ctx.Request.Header.Set("X-Amz-Content-Sha256", hash) } } 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 5600a9b3dd..cf7a9acbc2 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 @@ -1,8 +1,11 @@ package v4 import ( + "bytes" "io" + "io/ioutil" "net/http" + "net/http/httptest" "strings" "testing" "time" @@ -111,7 +114,7 @@ func TestSignRequest(t *testing.T) { assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) } -func TestSignBody(t *testing.T) { +func TestSignBodyS3(t *testing.T) { req, body := buildRequest("s3", "us-east-1", "hello") signer := buildSigner() signer.Sign(req, body, "s3", "us-east-1", time.Now()) @@ -119,6 +122,14 @@ func TestSignBody(t *testing.T) { assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) } +func TestSignBodyGlacier(t *testing.T) { + req, body := buildRequest("glacier", "us-east-1", "hello") + 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) +} + func TestPresignEmptyBodyS3(t *testing.T) { req, body := buildRequest("s3", "us-east-1", "hello") signer := buildSigner() @@ -178,8 +189,12 @@ func TestIgnoreResignRequestWithValidCreds(t *testing.T) { SignSDKRequest(r) sig := r.HTTPRequest.Header.Get("Authorization") - SignSDKRequest(r) - assert.Equal(t, sig, r.HTTPRequest.Header.Get("Authorization")) + signSDKRequestWithCurrTime(r, func() time.Time { + // Simulate one second has passed so that signature's date changes + // when it is resigned. + return time.Now().Add(1 * time.Second) + }) + assert.NotEqual(t, sig, r.HTTPRequest.Header.Get("Authorization")) } func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { @@ -199,10 +214,14 @@ func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { r.ExpireTime = time.Minute * 10 SignSDKRequest(r) - sig := r.HTTPRequest.Header.Get("X-Amz-Signature") + sig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature") - SignSDKRequest(r) - assert.Equal(t, sig, r.HTTPRequest.Header.Get("X-Amz-Signature")) + signSDKRequestWithCurrTime(r, func() time.Time { + // Simulate one second has passed so that signature's date changes + // when it is resigned. + return time.Now().Add(1 * time.Second) + }) + assert.NotEqual(t, sig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature")) } func TestResignRequestExpiredCreds(t *testing.T) { @@ -280,7 +299,7 @@ func TestPreResignRequestExpiredCreds(t *testing.T) { creds.Expire() signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate the request occured 15 minutes in the past + // 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")) @@ -308,13 +327,63 @@ func TestResignRequestExpiredRequest(t *testing.T) { origSignedAt := r.LastSignedAt signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate the request occured 15 minutes in the past + // 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) } +func TestSignWithRequestBody(t *testing.T) { + creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") + signer := NewSigner(creds) + + expectBody := []byte("abc123") + + 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) + 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) + + resp, err := http.DefaultClient.Do(req) + assert.NoError(t, err) + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + +func TestSignWithRequestBody_Overwrite(t *testing.T) { + creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") + signer := NewSigner(creds) + + var expectBody []byte + + 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)) + w.WriteHeader(http.StatusOK) + })) + + req, err := http.NewRequest("GET", server.URL, strings.NewReader("invalid body")) + + _, err = signer.Sign(req, nil, "service", "region", time.Now()) + req.ContentLength = 0 + + assert.NoError(t, err) + + resp, err := http.DefaultClient.Do(req) + assert.NoError(t, err) + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + func BenchmarkPresignRequest(b *testing.B) { signer := buildSigner() req, body := buildRequest("dynamodb", "us-east-1", "{}") 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 438218867f..0c1e3df486 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.2.7" +const SDKVersion = "1.5.2" diff --git a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/gen/gen.go b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/gen/gen.go index 0dc6529423..286d4bfd7a 100644 --- a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/gen/gen.go +++ b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/gen/gen.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package main diff --git a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/rename.go b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/rename.go index 05d6f36265..234ae7ce67 100644 --- a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/rename.go +++ b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/rename.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package rename diff --git a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/renames.go b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/renames.go index 0d22f39ec9..55c7b4e676 100644 --- a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/renames.go +++ b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/rename/renames.go @@ -1,4 +1,4 @@ -// +build go1.5 +// +build go1.5,deprecated package rename diff --git a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/renamer.go b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/renamer.go index ed60e88dd0..ab516b8f05 100644 --- a/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/renamer.go +++ b/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/renamer.go @@ -1,8 +1,8 @@ -// +build go1.5 +// +build go1.5,deprecated package main -//go:generate go run gen/gen.go +//go:generate go run -tags deprecated gen/gen.go import ( "os" 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 f97b228fcb..10ad72767b 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/assert.go @@ -5,11 +5,10 @@ import ( "encoding/xml" "fmt" "net/url" + "reflect" "regexp" "sort" "testing" - - "github.com/stretchr/testify/assert" ) // Match is a testing helper to test for testing error by comparing expected @@ -33,9 +32,9 @@ func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) b return false } - assert.Equal(t, expectURL.Host, actualURL.Host, msgAndArgs...) - assert.Equal(t, expectURL.Scheme, actualURL.Scheme, msgAndArgs...) - assert.Equal(t, expectURL.Path, actualURL.Path, msgAndArgs...) + equal(t, expectURL.Host, actualURL.Host, msgAndArgs...) + equal(t, expectURL.Scheme, actualURL.Scheme, msgAndArgs...) + equal(t, expectURL.Path, actualURL.Path, msgAndArgs...) return AssertQuery(t, expectURL.Query().Encode(), actualURL.Query().Encode(), msgAndArgs...) } @@ -54,7 +53,7 @@ func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) } // Make sure the keys are the same - if !assert.Equal(t, queryValueKeys(expectQ), queryValueKeys(actualQ), msgAndArgs...) { + if !equal(t, queryValueKeys(expectQ), queryValueKeys(actualQ), msgAndArgs...) { return false } @@ -62,7 +61,7 @@ func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) sort.Strings(expectQVals) actualQVals := actualQ[k] sort.Strings(actualQVals) - assert.Equal(t, expectQVals, actualQVals, msgAndArgs...) + equal(t, expectQVals, actualQVals, msgAndArgs...) } return true @@ -82,7 +81,7 @@ func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{}) return false } - return assert.Equal(t, expectVal, actualVal, msgAndArgs...) + return equal(t, expectVal, actualVal, msgAndArgs...) } // AssertXML verifies that the expect xml string matches the actual. @@ -96,7 +95,39 @@ func AssertXML(t *testing.T, expect, actual string, container interface{}, msgAn if err := xml.Unmarshal([]byte(actual), &actualVal); err != nil { t.Errorf(errMsg("unable to parse actual XML", err, msgAndArgs...)) } - return assert.Equal(t, expectVal, actualVal, msgAndArgs...) + return equal(t, expectVal, actualVal, msgAndArgs...) +} + +// objectsAreEqual determines if two objects are considered equal. +// +// This function does no assertion of any kind. +// +// Based on github.com/stretchr/testify/assert.ObjectsAreEqual +// Copied locally to prevent non-test build dependencies on testify +func objectsAreEqual(expected, actual interface{}) bool { + if expected == nil || actual == nil { + return expected == actual + } + + return reflect.DeepEqual(expected, actual) +} + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +// +// Based on github.com/stretchr/testify/assert.Equal +// 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)) + return false + } + + return true } func errMsg(baseMsg string, err error, msgAndArgs ...interface{}) string { @@ -107,6 +138,8 @@ func errMsg(baseMsg string, err error, msgAndArgs ...interface{}) string { return fmt.Sprintf("%s%s, %v", message, baseMsg, err) } +// Based on github.com/stretchr/testify/assert.messageFromMsgAndArgs +// Copied locally to prevent non-test build dependencies on testify func messageFromMsgAndArgs(msgAndArgs []interface{}) string { if len(msgAndArgs) == 0 || msgAndArgs == nil { return "" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/client.go index fd95259e0f..ca64a44781 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/client.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/awstesting/mock" ) // NewClient creates and initializes a generic service client for testing. @@ -19,24 +18,3 @@ func NewClient(cfgs ...*aws.Config) *client.Client { return client.New(*def.Config, info, def.Handlers) } - -// NewMockClient creates and initializes a client that will connect to the -// mock server -func NewMockClient(cfgs ...*aws.Config) *client.Client { - c := mock.Session.ClientConfig("Mock", cfgs...) - - svc := client.New( - *c.Config, - metadata.ClientInfo{ - ServiceName: "Mock", - SigningRegion: c.SigningRegion, - Endpoint: c.Endpoint, - APIVersion: "2015-12-08", - JSONVersion: "1.1", - TargetPrefix: "MockServer", - }, - c.Handlers, - ) - - return svc -} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go new file mode 100644 index 0000000000..83632d1a36 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go @@ -0,0 +1,29 @@ +// +build integration + +//Package s3crypto provides gucumber integration tests support. +package s3crypto + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go/service/s3/s3crypto" + + "github.com/gucumber/gucumber" +) + +func init() { + gucumber.Before("@s3crypto", func() { + sess := session.New((&aws.Config{ + Region: aws.String("us-west-2"), + }).WithLogLevel(aws.LogDebugWithRequestRetries | aws.LogDebugWithRequestErrors)) + encryptionClient := s3crypto.NewEncryptionClient(sess, nil, func(c *s3crypto.EncryptionClient) { + }) + gucumber.World["encryptionClient"] = encryptionClient + + decryptionClient := s3crypto.NewDecryptionClient(sess) + gucumber.World["decryptionClient"] = decryptionClient + + gucumber.World["client"] = s3.New(sess) + }) +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature new file mode 100644 index 0000000000..a7d433a9da --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/s3_crypto.feature @@ -0,0 +1,18 @@ +# language: en +@s3crypto @client +Feature: S3 Integration Crypto Tests + + Scenario: Get all plaintext fixtures for symmetric masterkey aes cbc + When I get all fixtures for "aes_gcm" from "aws-s3-shared-tests" + Then I decrypt each fixture against "Java" "version_2" + And I compare the decrypted ciphertext to the plaintext + + Scenario: Uploading Go's SDK fixtures + When I get all fixtures for "aes_gcm" from "aws-s3-shared-tests" + Then I encrypt each fixture with "kms" "AWS_SDK_TEST_ALIAS" "us-west-2" and "aes_gcm" + And upload "Go" data with folder "version_2" + + Scenario: Get all plaintext fixtures for symmetric masterkey aes gcm + When I get all fixtures for "aes_gcm" from "aws-s3-shared-tests" + Then I decrypt each fixture against "Go" "version_2" + And I compare the decrypted ciphertext to the plaintext diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go new file mode 100644 index 0000000000..b558d8a715 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/stepdef.go @@ -0,0 +1,192 @@ +// +build integration + +// Package s3crypto contains shared step definitions that are used across integration tests +package s3crypto + +import ( + "bytes" + "encoding/base64" + "errors" + "io/ioutil" + "strings" + + "github.com/gucumber/gucumber" + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/kms" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go/service/s3/s3crypto" +) + +func init() { + gucumber.When(`^I get all fixtures for "(.+?)" from "(.+?)"$`, + func(cekAlg, bucket string) { + prefix := "plaintext_test_case_" + baseFolder := "crypto_tests/" + cekAlg + s3Client := gucumber.World["client"].(*s3.S3) + + out, err := s3Client.ListObjects(&s3.ListObjectsInput{ + Bucket: aws.String(bucket), + Prefix: aws.String(baseFolder + "/" + prefix), + }) + assert.NoError(gucumber.T, err) + + plaintexts := make(map[string][]byte) + for _, obj := range out.Contents { + plaintextKey := obj.Key + ptObj, err := s3Client.GetObject(&s3.GetObjectInput{ + Bucket: aws.String(bucket), + Key: plaintextKey, + }) + assert.NoError(gucumber.T, err) + caseKey := strings.TrimPrefix(*plaintextKey, baseFolder+"/"+prefix) + plaintext, err := ioutil.ReadAll(ptObj.Body) + assert.NoError(gucumber.T, err) + + plaintexts[caseKey] = plaintext + } + gucumber.World["baseFolder"] = baseFolder + gucumber.World["bucket"] = bucket + gucumber.World["plaintexts"] = plaintexts + }) + + gucumber.Then(`^I decrypt each fixture against "(.+?)" "(.+?)"$`, func(lang, version string) { + plaintexts := gucumber.World["plaintexts"].(map[string][]byte) + baseFolder := gucumber.World["baseFolder"].(string) + bucket := gucumber.World["bucket"].(string) + prefix := "ciphertext_test_case_" + s3Client := gucumber.World["client"].(*s3.S3) + s3CryptoClient := gucumber.World["decryptionClient"].(*s3crypto.DecryptionClient) + language := "language_" + lang + + ciphertexts := make(map[string][]byte) + for caseKey := range plaintexts { + cipherKey := baseFolder + "/" + version + "/" + language + "/" + prefix + caseKey + + // To get metadata for encryption key + ctObj, err := s3Client.GetObject(&s3.GetObjectInput{ + Bucket: aws.String(bucket), + Key: &cipherKey, + }) + if err != nil { + continue + } + + // We don't support wrap, so skip it + if *ctObj.Metadata["X-Amz-Wrap-Alg"] != "kms" { + continue + } + //masterkeyB64 := ctObj.Metadata["Masterkey"] + //masterkey, err := base64.StdEncoding.DecodeString(*masterkeyB64) + //assert.NoError(T, err) + + //s3CryptoClient.Config.MasterKey = masterkey + ctObj, err = s3CryptoClient.GetObject(&s3.GetObjectInput{ + Bucket: aws.String(bucket), + Key: &cipherKey, + }, + ) + assert.NoError(gucumber.T, err) + + ciphertext, err := ioutil.ReadAll(ctObj.Body) + assert.NoError(gucumber.T, err) + ciphertexts[caseKey] = ciphertext + } + gucumber.World["ciphertexts"] = ciphertexts + }) + + gucumber.And(`^I compare the decrypted ciphertext to the plaintext$`, func() { + plaintexts := gucumber.World["plaintexts"].(map[string][]byte) + ciphertexts := gucumber.World["ciphertexts"].(map[string][]byte) + for caseKey, ciphertext := range ciphertexts { + assert.Equal(gucumber.T, len(plaintexts[caseKey]), len(ciphertext)) + assert.True(gucumber.T, bytes.Equal(plaintexts[caseKey], ciphertext)) + } + }) + + gucumber.Then(`^I encrypt each fixture with "(.+?)" "(.+?)" "(.+?)" and "(.+?)"$`, func(kek, v1, v2, cek string) { + var handler s3crypto.CipherDataGenerator + var builder s3crypto.ContentCipherBuilder + switch kek { + case "kms": + arn, err := getAliasInformation(v1, v2) + assert.Nil(gucumber.T, err) + + b64Arn := base64.StdEncoding.EncodeToString([]byte(arn)) + assert.Nil(gucumber.T, err) + gucumber.World["Masterkey"] = b64Arn + + handler = s3crypto.NewKMSKeyGenerator(kms.New(session.New(&aws.Config{ + Region: &v2, + })), arn) + assert.Nil(gucumber.T, err) + default: + gucumber.T.Skip() + } + + switch cek { + case "aes_gcm": + builder = s3crypto.AESGCMContentCipherBuilder(handler) + default: + gucumber.T.Skip() + } + + sess := session.New(&aws.Config{ + Region: aws.String("us-west-2"), + }) + c := s3crypto.NewEncryptionClient(sess, builder, func(c *s3crypto.EncryptionClient) { + }) + gucumber.World["encryptionClient"] = c + gucumber.World["cek"] = cek + }) + + gucumber.And(`^upload "(.+?)" data with folder "(.+?)"$`, func(language, folder string) { + c := gucumber.World["encryptionClient"].(*s3crypto.EncryptionClient) + cek := gucumber.World["cek"].(string) + bucket := gucumber.World["bucket"].(string) + plaintexts := gucumber.World["plaintexts"].(map[string][]byte) + key := gucumber.World["Masterkey"].(string) + for caseKey, plaintext := range plaintexts { + input := &s3.PutObjectInput{ + Bucket: &bucket, + Key: aws.String("crypto_tests/" + cek + "/" + folder + "/language_" + language + "/ciphertext_test_case_" + caseKey), + Body: bytes.NewReader(plaintext), + Metadata: map[string]*string{ + "Masterkey": &key, + }, + } + + _, err := c.PutObject(input) + assert.Nil(gucumber.T, err) + } + }) +} + +func getAliasInformation(alias, region string) (string, error) { + arn := "" + svc := kms.New(session.New(&aws.Config{ + Region: ®ion, + })) + + truncated := true + var marker *string + for truncated { + out, err := svc.ListAliases(&kms.ListAliasesInput{ + Marker: marker, + }) + if err != nil { + return arn, err + } + for _, aliasEntry := range out.Aliases { + if *aliasEntry.AliasName == "alias/"+alias { + return *aliasEntry.AliasArn, nil + } + } + truncated = *out.Truncated + marker = out.NextMarker + } + + return "", errors.New("The alias " + alias + " does not exist in your account. Please add the proper alias to a key") +} 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 eccd6b60ef..3a0dd600e1 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 @@ -16,7 +16,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/awstesting/integration" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" @@ -58,7 +57,7 @@ func setup() { // Delete the bucket func teardown() { - svc := s3.New(session.New()) + svc := s3.New(integration.Session) objs, _ := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) for _, o := range objs.Contents { @@ -128,7 +127,7 @@ func TestUploadConcurrently(t *testing.T) { } func TestUploadFailCleanup(t *testing.T) { - svc := s3.New(session.New()) + svc := s3.New(integration.Session) // Break checksum on 2nd part so it fails part := 0 @@ -151,6 +150,7 @@ func TestUploadFailCleanup(t *testing.T) { 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() diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go index 7d49896269..88bcf1636a 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/integration.go @@ -15,7 +15,7 @@ import ( ) // Session is a shared session for all integration tests to use. -var Session = session.New() +var Session = session.Must(session.NewSession()) func init() { logLevel := Session.Config.LogLevel diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go index 471f486890..fdb6438273 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/acm/client.go @@ -6,11 +6,11 @@ package acm import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/acm" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@acm", func() { - World["client"] = acm.New(smoke.Session) + gucumber.Before("@acm", func() { + gucumber.World["client"] = acm.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go index 17e295b07d..10ee2de877 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/apigateway/client.go @@ -6,11 +6,11 @@ package apigateway import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/apigateway" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@apigateway", func() { - World["client"] = apigateway.New(smoke.Session) + gucumber.Before("@apigateway", func() { + gucumber.World["client"] = apigateway.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go index c29b647b6e..85a4dab86c 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/applicationdiscoveryservice/client.go @@ -7,11 +7,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/applicationdiscoveryservice" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@applicationdiscoveryservice", func() { - World["client"] = applicationdiscoveryservice.New(smoke.Session, &aws.Config{Region: aws.String("us-west-2")}) + gucumber.Before("@applicationdiscoveryservice", func() { + gucumber.World["client"] = applicationdiscoveryservice.New( + smoke.Session, &aws.Config{Region: aws.String("us-west-2")}, + ) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go index b05963b0e3..55c68d1cc9 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/autoscaling/client.go @@ -6,11 +6,11 @@ package autoscaling import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/autoscaling" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@autoscaling", func() { - World["client"] = autoscaling.New(smoke.Session) + gucumber.Before("@autoscaling", func() { + gucumber.World["client"] = autoscaling.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go index 835651ba27..079fde7881 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudformation/client.go @@ -6,11 +6,11 @@ package cloudformation import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudformation" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudformation", func() { - World["client"] = cloudformation.New(smoke.Session) + gucumber.Before("@cloudformation", func() { + gucumber.World["client"] = cloudformation.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go index 0031473e98..c958362e12 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudfront/client.go @@ -6,11 +6,11 @@ package cloudfront import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudfront" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudfront", func() { - World["client"] = cloudfront.New(smoke.Session) + gucumber.Before("@cloudfront", func() { + gucumber.World["client"] = cloudfront.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go index 0a413364b1..23f24beb16 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudhsm/client.go @@ -6,11 +6,11 @@ package cloudhsm import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudhsm" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudhsm", func() { - World["client"] = cloudhsm.New(smoke.Session) + gucumber.Before("@cloudhsm", func() { + gucumber.World["client"] = cloudhsm.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go index 721e225d6a..c346b28217 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudsearch/client.go @@ -6,11 +6,11 @@ package cloudsearch import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudsearch" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudsearch", func() { - World["client"] = cloudsearch.New(smoke.Session) + gucumber.Before("@cloudsearch", func() { + gucumber.World["client"] = cloudsearch.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go index 1b1c77edd8..97c7bfa47c 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/client.go @@ -6,11 +6,11 @@ package cloudtrail import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudtrail" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudtrail", func() { - World["client"] = cloudtrail.New(smoke.Session) + gucumber.Before("@cloudtrail", func() { + gucumber.World["client"] = cloudtrail.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature index 7b5166a76c..817ab5c463 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudtrail/cloudtrail.feature @@ -4,13 +4,9 @@ Feature: AWS CloudTrail Scenario: Making a request When I call the "DescribeTrails" API - Then the response should contain a "trailList" + Then the request should be successful Scenario: Handling errors When I attempt to call the "DeleteTrail" API with: | Name | faketrail | Then I expect the response error code to be "TrailNotFoundException" - And I expect the response error message to include: - """ - Unknown trail - """ diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go index 7fff575fec..ebc339d2dd 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatch/client.go @@ -6,11 +6,11 @@ package cloudwatch import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudwatch" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudwatch", func() { - World["client"] = cloudwatch.New(smoke.Session) + gucumber.Before("@cloudwatch", func() { + gucumber.World["client"] = cloudwatch.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go index b6ded13df9..75fa2c5565 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cloudwatchlogs/client.go @@ -6,11 +6,11 @@ package cloudwatchlogs import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cloudwatchlogs", func() { - World["client"] = cloudwatchlogs.New(smoke.Session) + gucumber.Before("@cloudwatchlogs", func() { + gucumber.World["client"] = cloudwatchlogs.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go index f65caf53d8..2f9da3419a 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codecommit/client.go @@ -6,11 +6,11 @@ package codecommit import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/codecommit" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@codecommit", func() { - World["client"] = codecommit.New(smoke.Session) + gucumber.Before("@codecommit", func() { + gucumber.World["client"] = codecommit.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go index bc9c76a765..29587b9e61 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codedeploy/client.go @@ -6,11 +6,11 @@ package codedeploy import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/codedeploy" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@codedeploy", func() { - World["client"] = codedeploy.New(smoke.Session) + gucumber.Before("@codedeploy", func() { + gucumber.World["client"] = codedeploy.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go index b3ef7cdb9b..edc34f61c2 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/codepipeline/client.go @@ -6,11 +6,11 @@ package codepipeline import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/codepipeline" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@codepipeline", func() { - World["client"] = codepipeline.New(smoke.Session) + gucumber.Before("@codepipeline", func() { + gucumber.World["client"] = codepipeline.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go index adf486107c..476169f5bb 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitoidentity/client.go @@ -6,11 +6,11 @@ package cognitoidentity import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cognitoidentity" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cognitoidentity", func() { - World["client"] = cognitoidentity.New(smoke.Session) + gucumber.Before("@cognitoidentity", func() { + gucumber.World["client"] = cognitoidentity.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go index 911c131e2a..585e47c64d 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/cognitosync/client.go @@ -6,11 +6,11 @@ package cognitosync import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/cognitosync" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@cognitosync", func() { - World["client"] = cognitosync.New(smoke.Session) + gucumber.Before("@cognitosync", func() { + gucumber.World["client"] = cognitosync.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go index f2cb1c831f..fed62290a7 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/configservice/client.go @@ -6,11 +6,11 @@ package configservice import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/configservice" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@configservice", func() { - World["client"] = configservice.New(smoke.Session) + gucumber.Before("@configservice", func() { + gucumber.World["client"] = configservice.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go index 665a628250..10bb6f1d8e 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/datapipeline/client.go @@ -6,11 +6,11 @@ package datapipeline import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/datapipeline" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@datapipeline", func() { - World["client"] = datapipeline.New(smoke.Session) + gucumber.Before("@datapipeline", func() { + gucumber.World["client"] = datapipeline.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go index c9ff570e1c..f1bcbf71b1 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/devicefarm/client.go @@ -7,13 +7,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/devicefarm" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@devicefarm", func() { + gucumber.Before("@devicefarm", func() { // FIXME remove custom region - World["client"] = devicefarm.New(smoke.Session, + gucumber.World["client"] = devicefarm.New(smoke.Session, aws.NewConfig().WithRegion("us-west-2")) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go index a11d937393..c86e5d8cf8 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directconnect/client.go @@ -6,11 +6,11 @@ package directconnect import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/directconnect" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@directconnect", func() { - World["client"] = directconnect.New(smoke.Session) + gucumber.Before("@directconnect", func() { + gucumber.World["client"] = directconnect.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go index aedcd281eb..ae2fbbac16 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/directoryservice/client.go @@ -6,11 +6,11 @@ package directoryservice import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/directoryservice" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@directoryservice", func() { - World["client"] = directoryservice.New(smoke.Session) + gucumber.Before("@directoryservice", func() { + gucumber.World["client"] = directoryservice.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go index 735d2f5ded..5e3d3fb5f7 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodb/client.go @@ -6,11 +6,11 @@ package dynamodb import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/dynamodb" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@dynamodb", func() { - World["client"] = dynamodb.New(smoke.Session) + gucumber.Before("@dynamodb", func() { + gucumber.World["client"] = dynamodb.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go index 083a49456d..64cedf2741 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/dynamodbstreams/client.go @@ -6,11 +6,11 @@ package dynamodbstreams import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/dynamodbstreams" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@dynamodbstreams", func() { - World["client"] = dynamodbstreams.New(smoke.Session) + gucumber.Before("@dynamodbstreams", func() { + gucumber.World["client"] = dynamodbstreams.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go index d83038b5fe..68201536c2 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ec2/client.go @@ -6,11 +6,11 @@ package ec2 import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/ec2" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@ec2", func() { - World["client"] = ec2.New(smoke.Session) + gucumber.Before("@ec2", func() { + gucumber.World["client"] = ec2.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go index 9251e9c751..0db822495b 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ecs/client.go @@ -7,13 +7,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/ecs" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@ecs", func() { + gucumber.Before("@ecs", func() { // FIXME remove custom region - World["client"] = ecs.New(smoke.Session, + gucumber.World["client"] = ecs.New(smoke.Session, aws.NewConfig().WithRegion("us-west-2")) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go index 3d382528ec..fba6a32aa8 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/efs/client.go @@ -7,13 +7,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/efs" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@efs", func() { + gucumber.Before("@efs", func() { // FIXME remove custom region - World["client"] = efs.New(smoke.Session, + gucumber.World["client"] = efs.New(smoke.Session, aws.NewConfig().WithRegion("us-west-2")) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go index a20580022b..386237fcf3 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticache/client.go @@ -6,11 +6,11 @@ package elasticache import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/elasticache" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@elasticache", func() { - World["client"] = elasticache.New(smoke.Session) + gucumber.Before("@elasticache", func() { + gucumber.World["client"] = elasticache.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go index ffe504ca6b..61cb2e1e74 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticbeanstalk/client.go @@ -6,11 +6,11 @@ package elasticbeanstalk import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@elasticbeanstalk", func() { - World["client"] = elasticbeanstalk.New(smoke.Session) + gucumber.Before("@elasticbeanstalk", func() { + gucumber.World["client"] = elasticbeanstalk.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go index 1dc4a430e4..6682a779c4 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elasticloadbalancing/client.go @@ -6,11 +6,11 @@ package elasticloadbalancing import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/elb" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@elasticloadbalancing", func() { - World["client"] = elb.New(smoke.Session) + gucumber.Before("@elasticloadbalancing", func() { + gucumber.World["client"] = elb.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go index 085966d529..7e29b47363 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/elastictranscoder/client.go @@ -6,11 +6,11 @@ package elastictranscoder import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/elastictranscoder" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@elastictranscoder", func() { - World["client"] = elastictranscoder.New(smoke.Session) + gucumber.Before("@elastictranscoder", func() { + gucumber.World["client"] = elastictranscoder.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go index 35b7f97d81..41295c77ac 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/emr/client.go @@ -6,11 +6,11 @@ package emr import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/emr" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@emr", func() { - World["client"] = emr.New(smoke.Session) + gucumber.Before("@emr", func() { + gucumber.World["client"] = emr.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go index a4213a9d95..33e59c4cb0 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/es/client.go @@ -6,11 +6,11 @@ package es import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/elasticsearchservice" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@es", func() { - World["client"] = elasticsearchservice.New(smoke.Session) + gucumber.Before("@es", func() { + gucumber.World["client"] = elasticsearchservice.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go index a051f43c74..26235abd11 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/glacier/client.go @@ -6,11 +6,11 @@ package glacier import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/glacier" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@glacier", func() { - World["client"] = glacier.New(smoke.Session) + gucumber.Before("@glacier", func() { + gucumber.World["client"] = glacier.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go index 00dc855b0f..d551c73fb4 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iam/client.go @@ -6,11 +6,11 @@ package iam import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/iam" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@iam", func() { - World["client"] = iam.New(smoke.Session) + gucumber.Before("@iam", func() { + gucumber.World["client"] = iam.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go index 86a2e9900b..30921c332d 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/client.go @@ -8,19 +8,19 @@ import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/iot" "github.com/aws/aws-sdk-go/service/iotdataplane" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@iotdataplane", func() { + gucumber.Before("@iotdataplane", func() { svc := iot.New(smoke.Session) result, err := svc.DescribeEndpoint(&iot.DescribeEndpointInput{}) if err != nil { - World["error"] = err + gucumber.World["error"] = err return } - World["client"] = iotdataplane.New(smoke.Session, aws.NewConfig(). + gucumber.World["client"] = iotdataplane.New(smoke.Session, aws.NewConfig(). WithEndpoint(*result.EndpointAddress)) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature index a6ced14d7b..515d9bb854 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/iotdataplane/iotdataplane.feature @@ -1,12 +1,9 @@ # language: en @iotdataplane @client + Feature: AWS IoT Data Plane Scenario: Handling errors When I attempt to call the "GetThingShadow" API with: - | ThingName | "fakeThing" | - Then I expect the response error code to be "InvalidRequestException" - And I expect the response error message to include: - """ - Invalid thing name - """ + | thingName | fake-thing | + Then I expect the response error code to be "ResourceNotFoundException" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go index 7e0c684f43..5081bfe0f3 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kinesis/client.go @@ -6,11 +6,11 @@ package kinesis import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/kinesis" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@kinesis", func() { - World["client"] = kinesis.New(smoke.Session) + gucumber.Before("@kinesis", func() { + gucumber.World["client"] = kinesis.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go index cf52a84abc..e9498b3004 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/kms/client.go @@ -6,11 +6,11 @@ package kms import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/kms" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@kms", func() { - World["client"] = kms.New(smoke.Session) + gucumber.Before("@kms", func() { + gucumber.World["client"] = kms.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go index 7934b7ccf1..257bc264bc 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/lambda/client.go @@ -6,11 +6,11 @@ package lambda import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/lambda" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@lambda", func() { - World["client"] = lambda.New(smoke.Session) + gucumber.Before("@lambda", func() { + gucumber.World["client"] = lambda.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go index fd3046400f..a8ba24c9c9 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/machinelearning/client.go @@ -6,11 +6,11 @@ package machinelearning import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/machinelearning" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@machinelearning", func() { - World["client"] = machinelearning.New(smoke.Session) + gucumber.Before("@machinelearning", func() { + gucumber.World["client"] = machinelearning.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go index 25279b04fe..8f3f537a3c 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/opsworks/client.go @@ -6,11 +6,11 @@ package opsworks import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/opsworks" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@opsworks", func() { - World["client"] = opsworks.New(smoke.Session) + gucumber.Before("@opsworks", func() { + gucumber.World["client"] = opsworks.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go index e3b3ad1cc9..a12c73bf3b 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/rds/client.go @@ -6,11 +6,11 @@ package rds import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/rds" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@rds", func() { - World["client"] = rds.New(smoke.Session) + gucumber.Before("@rds", func() { + gucumber.World["client"] = rds.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go index b8f971410c..9e6da95427 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/redshift/client.go @@ -6,11 +6,11 @@ package redshift import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/redshift" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@redshift", func() { - World["client"] = redshift.New(smoke.Session) + gucumber.Before("@redshift", func() { + gucumber.World["client"] = redshift.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go index 3b9d153d60..a55a14ee22 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53/client.go @@ -6,11 +6,11 @@ package route53 import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/route53" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@route53", func() { - World["client"] = route53.New(smoke.Session) + gucumber.Before("@route53", func() { + gucumber.World["client"] = route53.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go index 8f79136dc8..c47de45f0f 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/route53domains/client.go @@ -6,11 +6,11 @@ package route53domains import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/route53domains" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@route53domains", func() { - World["client"] = route53domains.New(smoke.Session) + gucumber.Before("@route53domains", func() { + gucumber.World["client"] = route53domains.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go index 905c725186..f81947ac68 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ses/client.go @@ -6,11 +6,11 @@ package ses import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/ses" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@ses", func() { - World["client"] = ses.New(smoke.Session) + gucumber.Before("@ses", func() { + gucumber.World["client"] = ses.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go index 317780fed9..dbb1338f9b 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/shared.go @@ -12,7 +12,7 @@ import ( "strconv" "strings" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" "github.com/stretchr/testify/assert" "github.com/aws/aws-sdk-go/aws" @@ -22,7 +22,7 @@ import ( ) // Session is a shared session for all integration smoke tests to use. -var Session = session.New() +var Session = session.Must(session.NewSession()) func init() { logLevel := Session.Config.LogLevel @@ -37,47 +37,47 @@ func init() { } Session.Config.LogLevel = logLevel - When(`^I call the "(.+?)" API$`, func(op string) { + gucumber.When(`^I call the "(.+?)" API$`, func(op string) { call(op, nil, false) }) - When(`^I call the "(.+?)" API with:$`, func(op string, args [][]string) { + gucumber.When(`^I call the "(.+?)" API with:$`, func(op string, args [][]string) { call(op, args, false) }) - Then(`^the value at "(.+?)" should be a list$`, func(member string) { - vals, _ := awsutil.ValuesAtPath(World["response"], member) - assert.NotNil(T, vals) + gucumber.Then(`^the value at "(.+?)" should be a list$`, func(member string) { + vals, _ := awsutil.ValuesAtPath(gucumber.World["response"], member) + assert.NotNil(gucumber.T, vals) }) - Then(`^the response should contain a "(.+?)"$`, func(member string) { - vals, _ := awsutil.ValuesAtPath(World["response"], member) - assert.NotEmpty(T, vals) + gucumber.Then(`^the response should contain a "(.+?)"$`, func(member string) { + vals, _ := awsutil.ValuesAtPath(gucumber.World["response"], member) + assert.NotEmpty(gucumber.T, vals) }) - When(`^I attempt to call the "(.+?)" API with:$`, func(op string, args [][]string) { + gucumber.When(`^I attempt to call the "(.+?)" API with:$`, func(op string, args [][]string) { call(op, args, true) }) - Then(`^I expect the response error code to be "(.+?)"$`, func(code string) { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") + gucumber.Then(`^I expect the response error code to be "(.+?)"$`, func(code string) { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") if ok { - assert.Equal(T, code, err.Code(), "Error: %v", err) + assert.Equal(gucumber.T, code, err.Code(), "Error: %v", err) } }) - And(`^I expect the response error message to include:$`, func(data string) { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") + gucumber.And(`^I expect the response error message to include:$`, func(data string) { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") if ok { - assert.Contains(T, err.Error(), data) + assert.Contains(gucumber.T, err.Error(), data) } }) - And(`^I expect the response error message to include one of:$`, func(table [][]string) { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") + gucumber.And(`^I expect the response error message to include one of:$`, func(table [][]string) { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") if ok { found := false for _, row := range table { @@ -87,46 +87,46 @@ func init() { } } - assert.True(T, found, fmt.Sprintf("no error messages matched: \"%s\"", err.Error())) + assert.True(gucumber.T, found, fmt.Sprintf("no error messages matched: \"%s\"", err.Error())) } }) - And(`^I expect the response error message not be empty$`, func() { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") - assert.NotEmpty(T, err.Message()) + gucumber.And(`^I expect the response error message not be empty$`, func() { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") + assert.NotEmpty(gucumber.T, err.Message()) }) - When(`^I call the "(.+?)" API with JSON:$`, func(s1 string, data string) { + gucumber.When(`^I call the "(.+?)" API with JSON:$`, func(s1 string, data string) { callWithJSON(s1, data, false) }) - When(`^I attempt to call the "(.+?)" API with JSON:$`, func(s1 string, data string) { + gucumber.When(`^I attempt to call the "(.+?)" API with JSON:$`, func(s1 string, data string) { callWithJSON(s1, data, true) }) - Then(`^the error code should be "(.+?)"$`, func(s1 string) { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") - assert.Equal(T, s1, err.Code()) + gucumber.Then(`^the error code should be "(.+?)"$`, func(s1 string) { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") + assert.Equal(gucumber.T, s1, err.Code()) }) - And(`^the error message should contain:$`, func(data string) { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") - assert.Contains(T, err.Error(), data) + gucumber.And(`^the error message should contain:$`, func(data string) { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") + assert.Contains(gucumber.T, err.Error(), data) }) - Then(`^the request should fail$`, func() { - err, ok := World["error"].(awserr.Error) - assert.True(T, ok, "no error returned") - assert.Error(T, err) + gucumber.Then(`^the request should fail$`, func() { + err, ok := gucumber.World["error"].(awserr.Error) + assert.True(gucumber.T, ok, "no error returned") + assert.Error(gucumber.T, err) }) - Then(`^the request should be successful$`, func() { - err, ok := World["error"].(awserr.Error) - assert.False(T, ok, "error returned") - assert.NoError(T, err) + gucumber.Then(`^the request should be successful$`, func() { + err, ok := gucumber.World["error"].(awserr.Error) + assert.False(gucumber.T, ok, "error returned") + assert.NoError(gucumber.T, err) }) } @@ -145,25 +145,25 @@ func findMethod(v reflect.Value, op string) *reflect.Value { return nil } -// call calls an operation on World["client"] by the name op using the args +// call calls an operation on gucumber.World["client"] by the name op using the args // table of arguments to set. func call(op string, args [][]string, allowError bool) { - v := reflect.ValueOf(World["client"]) + v := reflect.ValueOf(gucumber.World["client"]) if m := findMethod(v, op); m != nil { t := m.Type() in := reflect.New(t.In(0).Elem()) fillArgs(in, args) resps := m.Call([]reflect.Value{in}) - World["response"] = resps[0].Interface() - World["error"] = resps[1].Interface() + gucumber.World["response"] = resps[0].Interface() + gucumber.World["error"] = resps[1].Interface() if !allowError { - err, _ := World["error"].(error) - assert.NoError(T, err) + err, _ := gucumber.World["error"].(error) + assert.NoError(gucumber.T, err) } } else { - assert.Fail(T, "failed to find operation "+op) + assert.Fail(gucumber.T, "failed to find operation "+op) } } @@ -203,22 +203,22 @@ func fillArgs(in reflect.Value, args [][]string) { } func callWithJSON(op, j string, allowError bool) { - v := reflect.ValueOf(World["client"]) + v := reflect.ValueOf(gucumber.World["client"]) if m := findMethod(v, op); m != nil { t := m.Type() in := reflect.New(t.In(0).Elem()) fillJSON(in, j) resps := m.Call([]reflect.Value{in}) - World["response"] = resps[0].Interface() - World["error"] = resps[1].Interface() + gucumber.World["response"] = resps[0].Interface() + gucumber.World["error"] = resps[1].Interface() if !allowError { - err, _ := World["error"].(error) - assert.NoError(T, err) + err, _ := gucumber.World["error"].(error) + assert.NoError(gucumber.T, err) } } else { - assert.Fail(T, "failed to find operation "+op) + assert.Fail(gucumber.T, "failed to find operation "+op) } } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go index 7e3b5e0b3d..e8d9ec269a 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/simpledb/client.go @@ -6,11 +6,11 @@ package simpledb import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/simpledb" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@simpledb", func() { - World["client"] = simpledb.New(smoke.Session) + gucumber.Before("@simpledb", func() { + gucumber.World["client"] = simpledb.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go index 70483cb833..cbf990c0ee 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sns/client.go @@ -6,11 +6,11 @@ package sns import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/sns" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@sns", func() { - World["client"] = sns.New(smoke.Session) + gucumber.Before("@sns", func() { + gucumber.World["client"] = sns.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go index c364ef690d..884dbbdbd9 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sqs/client.go @@ -6,11 +6,11 @@ package sqs import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/sqs" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@sqs", func() { - World["client"] = sqs.New(smoke.Session) + gucumber.Before("@sqs", func() { + gucumber.World["client"] = sqs.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go index 20a8d4533f..af5e2aa50c 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/ssm/client.go @@ -6,11 +6,11 @@ package ssm import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/ssm" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@ssm", func() { - World["client"] = ssm.New(smoke.Session) + gucumber.Before("@ssm", func() { + gucumber.World["client"] = ssm.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go index 2c5579eb0d..44d37317a1 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/storagegateway/client.go @@ -6,11 +6,11 @@ package storagegateway import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/storagegateway" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@storagegateway", func() { - World["client"] = storagegateway.New(smoke.Session) + gucumber.Before("@storagegateway", func() { + gucumber.World["client"] = storagegateway.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go index 27584fb318..ed61e1b25e 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/sts/client.go @@ -6,11 +6,11 @@ package sts import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/sts" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@sts", func() { - World["client"] = sts.New(smoke.Session) + gucumber.Before("@sts", func() { + gucumber.World["client"] = sts.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go index a1e3e22957..9322d57883 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/support/client.go @@ -6,11 +6,11 @@ package support import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/support" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@support", func() { - World["client"] = support.New(smoke.Session) + gucumber.Before("@support", func() { + gucumber.World["client"] = support.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go index 29e9dbcfd4..09020a2f30 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/swf/client.go @@ -6,11 +6,11 @@ package swf import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/swf" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@swf", func() { - World["client"] = swf.New(smoke.Session) + gucumber.Before("@swf", func() { + gucumber.World["client"] = swf.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go index 3218b49159..898f848faf 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/waf/client.go @@ -6,11 +6,11 @@ package waf import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/waf" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@waf", func() { - World["client"] = waf.New(smoke.Session) + gucumber.Before("@waf", func() { + gucumber.World["client"] = waf.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go index 7e471feacd..320fb1adc5 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/smoke/workspaces/client.go @@ -6,11 +6,11 @@ package workspaces import ( "github.com/aws/aws-sdk-go/awstesting/integration/smoke" "github.com/aws/aws-sdk-go/service/workspaces" - . "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { - Before("@workspaces", func() { - World["client"] = workspaces.New(smoke.Session) + gucumber.Before("@workspaces", func() { + gucumber.World["client"] = workspaces.New(smoke.Session) }) } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go b/vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go new file mode 100644 index 0000000000..9f18007452 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/mock/mock.go @@ -0,0 +1,43 @@ +package mock + +import ( + "net/http" + "net/http/httptest" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/session" +) + +// Session is a mock session which is used to hit the mock server +var Session = session.Must(session.NewSession(&aws.Config{ + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL[7:]), +})) + +// server is the mock server that simply writes a 200 status back to the client +var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) +})) + +// NewMockClient creates and initializes a client that will connect to the +// mock server +func NewMockClient(cfgs ...*aws.Config) *client.Client { + c := Session.ClientConfig("Mock", cfgs...) + + svc := client.New( + *c.Config, + metadata.ClientInfo{ + ServiceName: "Mock", + SigningRegion: c.SigningRegion, + Endpoint: c.Endpoint, + APIVersion: "2015-12-08", + JSONVersion: "1.1", + TargetPrefix: "MockServer", + }, + c.Handlers, + ) + + return svc +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/mock/server.go b/vendor/github.com/aws/aws-sdk-go/awstesting/mock/server.go deleted file mode 100644 index 026f7beb2a..0000000000 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/mock/server.go +++ /dev/null @@ -1,20 +0,0 @@ -package mock - -import ( - "net/http" - "net/http/httptest" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" -) - -// Session is a mock session which is used to hit the mock server -var Session = session.New(&aws.Config{ - DisableSSL: aws.Bool(true), - Endpoint: aws.String(server.URL[7:]), -}) - -// server is the mock server that simply writes a 200 status back to the client -var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) -})) diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go index 5d49202f41..de136582ec 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/benchmarks.go @@ -13,7 +13,7 @@ import ( "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/awstesting/mock" - "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) // mapCreateClients allows for the creation of clients diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go index e63af38164..00c2e8122e 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/client.go @@ -4,7 +4,7 @@ package performance import ( - "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" ) func init() { diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go index 6dde8b5437..81596d1c88 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/init.go @@ -8,7 +8,7 @@ import ( "fmt" "runtime" - "github.com/lsegal/gucumber" + "github.com/gucumber/gucumber" "github.com/stretchr/testify/assert" "github.com/aws/aws-sdk-go/aws" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go index c1a46950d5..03c885fd9b 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/performance/logging.go @@ -10,7 +10,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" ) @@ -25,7 +25,7 @@ type logger interface { log(key string, data map[string]interface{}) error } -// init intializes the logger and uses dependecy injection for the +// init initializes the logger and uses dependency injection for the // outputer func newBenchmarkLogger(output string) (*benchmarkLogger, error) { b := &benchmarkLogger{} @@ -75,10 +75,10 @@ type outputer interface { type dynamodbOut struct { table string // table to write to in dynamodb region string - db *dynamodb.DynamoDB // the dynamodb session + db *dynamodb.DynamoDB // the dynamodb } -// init initializes dynamodbOut to have a new session +// init initializes dynamodbOut func newDynamodbOut(table, region string) *dynamodbOut { out := dynamodbOut{ table: table, @@ -86,7 +86,7 @@ func newDynamodbOut(table, region string) *dynamodbOut { } out.db = dynamodb.New( - session.New(), + unit.Session, &aws.Config{Region: &out.region}, ) return &out diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip index 70148d532d..6d51663f6b 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/sandbox/Dockerfile.golang-tip @@ -3,8 +3,7 @@ # https://github.com/docker-library/golang/blob/master/1.6/wheezy/Dockerfile FROM buildpack-deps:wheezy-scm -ENV GOLANG_VERSION tip -ENV GOLANG_SRC_REPO_URL https://go.googlesource.com/go +ENV GOLANG_SRC_REPO_URL https://github.com/golang/go ENV GOLANG_BOOTSTRAP_URL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz ENV GOLANG_BOOTSTRAP_SHA256 ce3140662f45356eb78bc16a88fc7cfb29fb00e18d7c632608245b789b2086d2 diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go b/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go index e3ec33a82f..1c6e605468 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/unit/unit.go @@ -8,6 +8,6 @@ import ( ) // Session is a shared session for unit tests to use. -var Session = session.New(aws.NewConfig(). +var Session = session.Must(session.NewSession(aws.NewConfig(). WithCredentials(credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")). - WithRegion("mock-region")) + WithRegion("mock-region"))) diff --git a/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/codewalk.html b/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/codewalk.html index 0f3d22a20c..37d4c10f0f 100644 --- a/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/codewalk.html +++ b/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/codewalk.html @@ -12,9 +12,6 @@
- - Pop Out Code -