From b7c1929c8e8f6e014ee1aa2947e9be841317f21c Mon Sep 17 00:00:00 2001 From: Julien Vehent Date: Mon, 1 May 2017 18:37:35 -0400 Subject: [PATCH] Vendoring update, release 2.0.9 --- cmd/sops/version.go | 2 +- kms/mocks/KMSAPI.go | 1137 +- vendor/github.com/aws/aws-sdk-go/CHANGELOG.md | 357 + .../aws/aws-sdk-go/CHANGELOG_PENDING.md | 5 + .../github.com/aws/aws-sdk-go/CONTRIBUTING.md | 5 + vendor/github.com/aws/aws-sdk-go/Makefile | 6 +- vendor/github.com/aws/aws-sdk-go/README.md | 445 +- .../aws/aws-sdk-go/aws/client/client.go | 9 +- .../aws/aws-sdk-go/aws/client/client_test.go | 78 + .../aws-sdk-go/aws/client/default_retryer.go | 6 + .../github.com/aws/aws-sdk-go/aws/config.go | 15 + .../github.com/aws/aws-sdk-go/aws/context.go | 71 + .../aws/aws-sdk-go/aws/context_1_6.go | 41 + .../aws/aws-sdk-go/aws/context_1_7.go | 9 + .../aws/aws-sdk-go/aws/context_test.go | 37 + .../aws-sdk-go/aws/corehandlers/handlers.go | 116 +- .../aws/corehandlers/handlers_test.go | 121 + .../aws/credentials/chain_provider.go | 14 +- .../aws-sdk-go/aws/credentials/credentials.go | 33 +- .../aws/credentials/env_provider.go | 1 + .../stscreds/assume_role_provider.go | 2 +- .../aws/aws-sdk-go/aws/defaults/defaults.go | 47 +- .../aws-sdk-go/aws/defaults/defaults_test.go | 84 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 141 +- .../aws/aws-sdk-go/aws/endpoints/endpoints.go | 112 +- .../aws/endpoints/endpoints_test.go | 91 + .../aws/endpoints/v3model_codegen.go | 19 +- .../aws/aws-sdk-go/aws/jsonvalue.go | 12 + .../aws/request/connection_reset_error.go | 19 + .../connection_reset_error_appengine.go | 11 + .../connection_reset_error_appengine_test.go | 9 + .../request/connection_reset_error_test.go | 11 + .../aws/aws-sdk-go/aws/request/handlers.go | 66 +- .../aws-sdk-go/aws/request/handlers_test.go | 70 + .../aws/aws-sdk-go/aws/request/request.go | 166 +- .../aws-sdk-go/aws/request/request_context.go | 14 + .../aws/request/request_context_1_6.go | 14 + .../aws/request/request_context_test.go | 46 + .../aws/request/request_internal_test.go | 15 +- .../aws/request/request_pagination.go | 154 +- .../aws/request/request_pagination_test.go | 149 + .../aws-sdk-go/aws/request/request_test.go | 456 +- .../aws/aws-sdk-go/aws/request/retryer.go | 88 +- .../aws/request/timeout_read_closer.go | 94 + .../timeout_read_closer_benchmark_test.go | 76 + .../aws/request/timeout_read_closer_test.go | 118 + .../aws/aws-sdk-go/aws/request/waiter.go | 287 + .../aws/aws-sdk-go/aws/request/waiter_test.go | 636 ++ .../aws/session/custom_ca_bundle_test.go | 319 + .../aws/aws-sdk-go/aws/session/doc.go | 28 +- .../aws/aws-sdk-go/aws/session/env_config.go | 20 + .../aws-sdk-go/aws/session/env_config_test.go | 15 + .../aws/aws-sdk-go/aws/session/session.go | 91 +- .../aws/aws-sdk-go/aws/signer/v4/options.go | 7 + .../aws/aws-sdk-go/aws/signer/v4/v4.go | 27 +- vendor/github.com/aws/aws-sdk-go/aws/url.go | 12 + .../github.com/aws/aws-sdk-go/aws/url_1_7.go | 29 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../awstesting/cmd/bucket_cleanup/main.go | 94 + .../customizations/s3/s3crypto/client.go | 2 +- .../s3/s3crypto/s3_crypto.feature | 25 +- .../customizations/s3/s3crypto/stepdef.go | 12 +- .../s3/s3manager/bucket_region_test.go | 27 + .../s3/s3manager/integration_test.go | 121 +- .../aws/aws-sdk-go/awstesting/util.go | 27 + .../doc-src/aws-godoc/templates/godoc.html | 12 + .../aws-godoc/templates/package_service.html | 6 + .../doc-src/aws-godoc/templates/style.css | 24 +- vendor/github.com/aws/aws-sdk-go/doc.go | 405 + .../aws/endpoints/customEndpoint/README.md | 10 +- .../aws/endpoints/enumEndpoints/README.md | 4 +- .../example/aws/request/withContext/README.md | 13 + .../aws/request/withContext/withContext.go | 71 + .../service/dynamodb/scanItems/README.md | 5 +- .../service/dynamodb/unitTest/README.md | 5 +- .../service/ec2/filterInstances/README.md | 4 +- .../service/s3/concatObjects/README.md | 4 +- .../example/service/s3/listObjects/README.md | 4 +- .../s3/listObjectsConcurrently/README.md | 2 +- .../service/s3/putObjectAcl/putObjectAcl.go | 2 + .../sqs/mockingClientsForTests/README.md | 4 +- .../mockingClientsForTests/ifaceExample.go | 2 + .../ifaceExample_test.go | 2 + .../apis/apigateway/2015-07-09/api-2.json | 224 +- .../apis/apigateway/2015-07-09/docs-2.json | 169 +- .../apigateway/2015-07-09/paginators-1.json | 28 +- .../2016-02-06/api-2.json | 6 +- .../2016-02-06/docs-2.json | 42 +- .../2016-02-06/paginators-1.json | 16 +- .../apis/appstream/2016-12-01/api-2.json | 76 +- .../apis/appstream/2016-12-01/docs-2.json | 36 +- .../appstream/2016-12-01/paginators-1.json | 4 + .../models/apis/batch/2016-08-10/api-2.json | 41 +- .../models/apis/batch/2016-08-10/docs-2.json | 45 +- .../apis/batch/2016-08-10/paginators-1.json | 4 + .../models/apis/budgets/2016-10-20/api-2.json | 7 +- .../apis/budgets/2016-10-20/paginators-1.json | 4 + .../apis/clouddirectory/2016-05-10/api-2.json | 81 +- .../clouddirectory/2016-05-10/docs-2.json | 164 +- .../2016-05-10/paginators-1.json | 5 + .../apis/cloudformation/2010-05-15/api-2.json | 60 +- .../cloudformation/2010-05-15/docs-2.json | 31 +- .../cloudformation/2010-05-15/examples-1.json | 153 - .../2010-05-15/paginators-1.json | 12 +- .../cloudformation/2010-05-15/waiters-2.json | 25 + .../apis/cloudfront/2017-03-25/api-2.json | 2689 +++++ .../apis/cloudfront/2017-03-25/docs-2.json | 1449 +++ .../cloudfront/2017-03-25/examples-1.json | 83 + .../cloudfront/2017-03-25/paginators-1.json | 32 + .../apis/cloudfront/2017-03-25/waiters-2.json | 47 + .../apis/cloudtrail/2013-11-01/api-2.json | 5 + .../apis/cloudtrail/2013-11-01/docs-2.json | 26 +- .../cloudtrail/2013-11-01/paginators-1.json | 4 +- .../apis/codebuild/2016-10-06/docs-2.json | 2 +- .../codedeploy/2014-10-06/paginators-1.json | 32 +- .../apis/codestar/2017-04-19/api-2.json | 755 ++ .../apis/codestar/2017-04-19/docs-2.json | 474 + .../apis/codestar/2017-04-19/examples-1.json | 5 + .../codestar/2017-04-19/paginators-1.json | 4 + .../models/apis/config/2014-11-12/docs-2.json | 12 +- .../apis/devicefarm/2015-06-23/api-2.json | 299 +- .../apis/devicefarm/2015-06-23/docs-2.json | 251 +- .../devicefarm/2015-06-23/examples-1.json | 14 +- .../devicefarm/2015-06-23/paginators-1.json | 7 +- .../apis/directconnect/2012-10-25/api-2.json | 12 +- .../apis/directconnect/2012-10-25/docs-2.json | 2 +- .../apis/discovery/2015-11-01/api-2.json | 73 +- .../apis/discovery/2015-11-01/docs-2.json | 148 +- .../discovery/2015-11-01/paginators-1.json | 4 + .../models/apis/ec2/2016-11-15/api-2.json | 71 +- .../models/apis/ec2/2016-11-15/docs-2.json | 83 +- .../apis/elasticache/2015-02-02/api-2.json | 82 +- .../apis/elasticache/2015-02-02/docs-2.json | 79 +- .../elasticache/2015-02-02/examples-1.json | 1993 ++-- .../elasticache/2015-02-02/paginators-1.json | 36 +- .../2015-12-01/docs-2.json | 24 +- .../2015-12-01/waiters-2.json | 64 + .../elasticmapreduce/2009-03-31/api-2.json | 270 +- .../elasticmapreduce/2009-03-31/docs-2.json | 340 +- .../2009-03-31/paginators-1.json | 7 +- .../2009-03-31/waiters-2.json | 19 + .../models/apis/events/2015-10-07/api-2.json | 293 +- .../models/apis/events/2015-10-07/docs-2.json | 268 +- .../apis/events/2015-10-07/examples-1.json | 4 +- .../apis/events/2015-10-07/paginators-1.json | 4 + .../apis/gamelift/2015-10-01/api-2.json | 35 +- .../apis/gamelift/2015-10-01/docs-2.json | 123 +- .../models/apis/iam/2010-05-08/api-2.json | 106 +- .../models/apis/iam/2010-05-08/docs-2.json | 108 +- .../models/apis/kinesis/2013-12-02/api-2.json | 4 +- .../apis/kinesis/2013-12-02/docs-2.json | 4 +- .../apis/kinesis/2013-12-02/paginators-1.json | 2 +- .../apis/kinesis/2013-12-02/waiters-2.json | 12 + .../models/apis/kms/2014-11-01/docs-2.json | 16 +- .../apis/kms/2014-11-01/examples-1.json | 42 + .../models/apis/lambda/2015-03-31/api-2.json | 141 +- .../models/apis/lambda/2015-03-31/docs-2.json | 144 +- .../apis/lambda/2015-03-31/paginators-1.json | 6 +- .../apis/lex-models/2017-04-19/api-2.json | 1922 ++++ .../apis/lex-models/2017-04-19/docs-2.json | 1089 ++ .../lex-models/2017-04-19/examples-1.json | 5 + .../lex-models/2017-04-19/paginators-1.json | 54 + .../2015-07-01/api-2.json | 3 +- .../2015-07-01/docs-2.json | 4 +- .../2015-07-01/paginators-1.json | 4 + .../apis/monitoring/2010-08-01/api-2.json | 26 +- .../apis/monitoring/2010-08-01/docs-2.json | 20 +- .../monitoring/2010-08-01/paginators-1.json | 6 +- .../apis/opsworks/2013-02-18/api-2.json | 145 +- .../apis/opsworks/2013-02-18/docs-2.json | 185 +- .../opsworks/2013-02-18/paginators-1.json | 4 +- .../apis/opsworkscm/2016-11-01/api-2.json | 30 +- .../apis/opsworkscm/2016-11-01/docs-2.json | 107 +- .../opsworkscm/2016-11-01/paginators-1.json | 4 + .../apis/organizations/2016-11-28/docs-2.json | 2 +- .../organizations/2016-11-28/examples-1.json | 8 + .../apis/pinpoint/2016-12-01/api-2.json | 223 +- .../apis/pinpoint/2016-12-01/docs-2.json | 181 +- .../models/apis/polly/2016-06-10/api-2.json | 36 +- .../models/apis/polly/2016-06-10/docs-2.json | 28 +- .../apis/polly/2016-06-10/paginators-1.json | 4 + .../models/apis/rds/2013-01-10/docs-2.json | 2 +- .../models/apis/rds/2013-02-12/docs-2.json | 2 +- .../models/apis/rds/2013-09-09/docs-2.json | 2 +- .../models/apis/rds/2014-09-01/docs-2.json | 2 +- .../models/apis/rds/2014-10-31/api-2.json | 61 +- .../models/apis/rds/2014-10-31/docs-2.json | 74 +- .../apis/rds/2014-10-31/examples-1.json | 390 +- .../apis/redshift/2012-12-01/api-2.json | 73 +- .../apis/redshift/2012-12-01/docs-2.json | 39 +- .../redshift/2012-12-01/paginators-1.json | 32 +- .../apis/rekognition/2016-06-27/api-2.json | 45 + .../apis/rekognition/2016-06-27/docs-2.json | 44 +- .../2017-01-26/api-2.json | 331 + .../2017-01-26/docs-2.json | 253 + .../2017-01-26/examples-1.json | 5 + .../2017-01-26/paginators-1.json | 4 + .../apis/route53/2013-04-01/docs-2.json | 356 +- .../apis/route53domains/2014-05-15/api-2.json | 4 +- .../route53domains/2014-05-15/docs-2.json | 312 +- .../2014-05-15/paginators-1.json | 7 +- .../apis/runtime.lex/2016-11-28/api-2.json | 149 +- .../apis/runtime.lex/2016-11-28/docs-2.json | 116 +- .../apis/snowball/2016-06-30/api-2.json | 51 +- .../apis/snowball/2016-06-30/docs-2.json | 33 +- .../snowball/2016-06-30/paginators-1.json | 12 +- .../models/apis/sqs/2012-11-05/api-2.json | 4 +- .../models/apis/sqs/2012-11-05/docs-2.json | 60 +- .../apis/sqs/2012-11-05/paginators-1.json | 2 +- .../models/apis/ssm/2014-11-06/api-2.json | 42 +- .../models/apis/ssm/2014-11-06/docs-2.json | 145 +- .../apis/ssm/2014-11-06/paginators-1.json | 24 +- .../apis/storagegateway/2013-06-30/api-2.json | 43 +- .../storagegateway/2013-06-30/docs-2.json | 116 +- .../apis/workdocs/2016-05-01/api-2.json | 1781 ++++ .../apis/workdocs/2016-05-01/docs-2.json | 931 ++ .../apis/workdocs/2016-05-01/examples-1.json | 5 + .../workdocs/2016-05-01/paginators-1.json | 25 + .../models/endpoints/endpoints.json | 94 +- .../models/protocol_tests/generate.go | 70 +- .../protocol_tests/input/rest-json.json | 62 + .../models/protocol_tests/output/query.json | 3 +- .../protocol_tests/output/rest-json.json | 40 + .../aws/aws-sdk-go/private/model/api/api.go | 129 +- .../aws-sdk-go/private/model/api/api_test.go | 22 +- .../private/model/api/customization_passes.go | 50 +- .../aws-sdk-go/private/model/api/docstring.go | 49 +- .../private/model/api/docstring_test.go | 44 +- .../private/model/api/list_of_shame.go | 495 + .../aws-sdk-go/private/model/api/load_test.go | 6 +- .../aws-sdk-go/private/model/api/operation.go | 95 +- .../aws-sdk-go/private/model/api/passes.go | 33 +- .../private/model/api/passes_test.go | 169 + .../aws/aws-sdk-go/private/model/api/shape.go | 42 +- .../private/model/api/shapetag_test.go | 9 +- .../aws-sdk-go/private/model/api/waiters.go | 110 +- .../private/model/cli/gen-api/main.go | 30 +- .../private/protocol/ec2query/build_test.go | 290 +- .../protocol/ec2query/unmarshal_test.go | 245 +- .../private/protocol/jsonrpc/build_test.go | 438 +- .../protocol/jsonrpc/unmarshal_test.go | 203 +- .../private/protocol/protocol_test.go | 8 +- .../private/protocol/query/build_test.go | 725 +- .../private/protocol/query/unmarshal_test.go | 409 +- .../aws-sdk-go/private/protocol/rest/build.go | 46 +- .../private/protocol/rest/rest_test.go | 63 + .../private/protocol/rest/unmarshal.go | 29 +- .../private/protocol/restjson/build_test.go | 1230 ++- .../protocol/restjson/unmarshal_test.go | 463 +- .../private/protocol/restxml/build_test.go | 1243 ++- .../protocol/restxml/unmarshal_test.go | 381 +- .../private/protocol/xml/xmlutil/build.go | 1 - .../private/protocol/xml/xmlutil/unmarshal.go | 7 +- .../protocol/xml/xmlutil/unmarshal_test.go | 142 + .../protocol/xml/xmlutil/xml_to_struct.go | 13 +- .../xml/xmlutil/xml_to_struct_test.go | 17 +- .../aws/aws-sdk-go/private/waiter/waiter.go | 134 - .../aws-sdk-go/private/waiter/waiter_test.go | 401 - vendor/github.com/aws/aws-sdk-go/sdk.go | 7 - .../service/acm/acmiface/interface.go | 44 +- .../aws/aws-sdk-go/service/acm/api.go | 231 +- .../aws/aws-sdk-go/service/acm/doc.go | 84 + .../aws/aws-sdk-go/service/acm/errors.go | 2 +- .../aws-sdk-go/service/acm/examples_test.go | 2 +- .../aws/aws-sdk-go/service/acm/service.go | 14 +- .../aws/aws-sdk-go/service/apigateway/api.go | 3624 ++++++- .../apigateway/apigatewayiface/interface.go | 434 +- .../aws/aws-sdk-go/service/apigateway/doc.go | 82 + .../aws-sdk-go/service/apigateway/errors.go | 2 +- .../service/apigateway/examples_test.go | 150 +- .../aws-sdk-go/service/apigateway/service.go | 15 +- .../service/applicationautoscaling/api.go | 314 +- .../applicationautoscalingiface/interface.go | 34 +- .../service/applicationautoscaling/doc.go | 110 + .../service/applicationautoscaling/errors.go | 2 +- .../applicationautoscaling/examples_test.go | 2 +- .../service/applicationautoscaling/service.go | 36 +- .../applicationdiscoveryservice/api.go | 810 +- .../interface.go | 75 +- .../applicationdiscoveryservice/doc.go | 139 + .../applicationdiscoveryservice/errors.go | 2 +- .../examples_test.go | 52 +- .../applicationdiscoveryservice/service.go | 69 +- .../aws/aws-sdk-go/service/appstream/api.go | 467 +- .../appstream/appstreamiface/interface.go | 77 +- .../aws/aws-sdk-go/service/appstream/doc.go | 80 + .../aws-sdk-go/service/appstream/errors.go | 14 +- .../service/appstream/examples_test.go | 43 +- .../aws-sdk-go/service/appstream/service.go | 12 +- .../aws-sdk-go/service/appstream/waiters.go | 117 +- .../aws/aws-sdk-go/service/autoscaling/api.go | 1288 ++- .../autoscaling/autoscalingiface/interface.go | 222 +- .../aws/aws-sdk-go/service/autoscaling/doc.go | 82 + .../aws-sdk-go/service/autoscaling/errors.go | 2 +- .../service/autoscaling/examples_test.go | 2 +- .../aws-sdk-go/service/autoscaling/service.go | 14 +- .../aws-sdk-go/service/autoscaling/waiters.go | 157 +- .../aws/aws-sdk-go/service/batch/api.go | 530 +- .../service/batch/batchiface/interface.go | 67 +- .../aws/aws-sdk-go/service/batch/doc.go | 96 + .../aws/aws-sdk-go/service/batch/errors.go | 2 +- .../aws-sdk-go/service/batch/examples_test.go | 9 +- .../aws/aws-sdk-go/service/batch/service.go | 26 +- .../aws/aws-sdk-go/service/budgets/api.go | 255 +- .../service/budgets/budgetsiface/interface.go | 55 +- .../aws/aws-sdk-go/service/budgets/doc.go | 78 + .../aws/aws-sdk-go/service/budgets/errors.go | 2 +- .../service/budgets/examples_test.go | 2 +- .../aws/aws-sdk-go/service/budgets/service.go | 11 +- .../aws-sdk-go/service/clouddirectory/api.go | 2000 +++- .../clouddirectoryiface/interface.go | 215 +- .../aws-sdk-go/service/clouddirectory/doc.go | 85 + .../service/clouddirectory/errors.go | 2 +- .../service/clouddirectory/examples_test.go | 40 +- .../service/clouddirectory/service.go | 17 +- .../aws-sdk-go/service/cloudformation/api.go | 942 +- .../cloudformationiface/interface.go | 118 +- .../aws-sdk-go/service/cloudformation/doc.go | 98 + .../service/cloudformation/errors.go | 8 +- .../service/cloudformation/examples_test.go | 20 +- .../service/cloudformation/service.go | 28 +- .../service/cloudformation/waiters.go | 328 +- .../aws/aws-sdk-go/service/cloudfront/api.go | 1152 +- .../cloudfront/cloudfrontiface/interface.go | 118 +- .../aws/aws-sdk-go/service/cloudfront/doc.go | 83 + .../aws-sdk-go/service/cloudfront/errors.go | 10 +- .../service/cloudfront/examples_test.go | 26 +- .../aws-sdk-go/service/cloudfront/service.go | 17 +- .../service/cloudfront/sign/sign_cookie.go | 6 +- .../aws-sdk-go/service/cloudfront/waiters.go | 142 +- .../aws/aws-sdk-go/service/cloudhsm/api.go | 384 +- .../cloudhsm/cloudhsmiface/interface.go | 83 +- .../aws/aws-sdk-go/service/cloudhsm/doc.go | 80 + .../aws/aws-sdk-go/service/cloudhsm/errors.go | 2 +- .../service/cloudhsm/examples_test.go | 2 +- .../aws-sdk-go/service/cloudhsm/service.go | 11 +- .../aws/aws-sdk-go/service/cloudsearch/api.go | 460 +- .../cloudsearch/cloudsearchiface/interface.go | 99 +- .../aws/aws-sdk-go/service/cloudsearch/doc.go | 85 + .../aws-sdk-go/service/cloudsearch/errors.go | 2 +- .../service/cloudsearch/examples_test.go | 2 +- .../aws-sdk-go/service/cloudsearch/service.go | 16 +- .../service/cloudsearchdomain/api.go | 62 +- .../cloudsearchdomainiface/interface.go | 15 +- .../service/cloudsearchdomain/doc.go | 87 + .../service/cloudsearchdomain/errors.go | 2 +- .../cloudsearchdomain/examples_test.go | 2 +- .../service/cloudsearchdomain/service.go | 18 +- .../aws/aws-sdk-go/service/cloudtrail/api.go | 395 +- .../cloudtrail/cloudtrailiface/interface.go | 60 +- .../aws/aws-sdk-go/service/cloudtrail/doc.go | 100 + .../aws-sdk-go/service/cloudtrail/errors.go | 4 +- .../service/cloudtrail/examples_test.go | 8 +- .../aws-sdk-go/service/cloudtrail/service.go | 30 +- .../aws/aws-sdk-go/service/cloudwatch/api.go | 412 +- .../cloudwatch/cloudwatchiface/interface.go | 51 +- .../aws/aws-sdk-go/service/cloudwatch/doc.go | 94 + .../aws-sdk-go/service/cloudwatch/errors.go | 2 +- .../service/cloudwatch/examples_test.go | 10 +- .../aws-sdk-go/service/cloudwatch/service.go | 24 +- .../aws-sdk-go/service/cloudwatch/waiters.go | 52 +- .../service/cloudwatchevents/api.go | 912 +- .../cloudwatcheventsiface/interface.go | 51 +- .../service/cloudwatchevents/doc.go | 97 + .../service/cloudwatchevents/errors.go | 9 +- .../service/cloudwatchevents/examples_test.go | 33 +- .../service/cloudwatchevents/service.go | 25 +- .../aws-sdk-go/service/cloudwatchlogs/api.go | 795 +- .../cloudwatchlogsiface/interface.go | 122 +- .../aws-sdk-go/service/cloudwatchlogs/doc.go | 109 + .../service/cloudwatchlogs/errors.go | 2 +- .../service/cloudwatchlogs/examples_test.go | 2 +- .../service/cloudwatchlogs/service.go | 39 +- .../aws/aws-sdk-go/service/codebuild/api.go | 230 +- .../codebuild/codebuildiface/interface.go | 47 +- .../aws/aws-sdk-go/service/codebuild/doc.go | 123 + .../aws-sdk-go/service/codebuild/errors.go | 2 +- .../service/codebuild/examples_test.go | 2 +- .../aws-sdk-go/service/codebuild/service.go | 53 +- .../aws/aws-sdk-go/service/codecommit/api.go | 438 +- .../codecommit/codecommitiface/interface.go | 74 +- .../aws/aws-sdk-go/service/codecommit/doc.go | 141 + .../aws-sdk-go/service/codecommit/errors.go | 2 +- .../service/codecommit/examples_test.go | 2 +- .../aws-sdk-go/service/codecommit/service.go | 71 +- .../aws/aws-sdk-go/service/codedeploy/api.go | 1043 +- .../codedeploy/codedeployiface/interface.go | 158 +- .../aws/aws-sdk-go/service/codedeploy/doc.go | 132 + .../aws-sdk-go/service/codedeploy/errors.go | 2 +- .../service/codedeploy/examples_test.go | 2 +- .../aws-sdk-go/service/codedeploy/service.go | 62 +- .../aws-sdk-go/service/codedeploy/waiters.go | 62 +- .../aws-sdk-go/service/codepipeline/api.go | 498 +- .../codepipelineiface/interface.go | 107 +- .../aws-sdk-go/service/codepipeline/doc.go | 188 + .../aws-sdk-go/service/codepipeline/errors.go | 2 +- .../service/codepipeline/examples_test.go | 2 +- .../service/codepipeline/service.go | 118 +- .../aws/aws-sdk-go/service/codestar/api.go | 3195 ++++++ .../codestar/codestariface/interface.go | 124 + .../aws/aws-sdk-go/service/codestar/doc.go | 126 + .../aws/aws-sdk-go/service/codestar/errors.go | 91 + .../service/codestar/examples_test.go | 358 + .../aws-sdk-go/service/codestar/service.go | 95 + .../aws-sdk-go/service/cognitoidentity/api.go | 346 +- .../cognitoidentityiface/interface.go | 75 +- .../aws-sdk-go/service/cognitoidentity/doc.go | 111 + .../service/cognitoidentity/errors.go | 2 +- .../service/cognitoidentity/examples_test.go | 2 +- .../service/cognitoidentity/service.go | 41 +- .../service/cognitoidentityprovider/api.go | 1239 ++- .../cognitoidentityprovideriface/interface.go | 263 +- .../service/cognitoidentityprovider/doc.go | 87 + .../service/cognitoidentityprovider/errors.go | 2 +- .../cognitoidentityprovider/examples_test.go | 2 +- .../cognitoidentityprovider/service.go | 17 +- .../aws/aws-sdk-go/service/cognitosync/api.go | 327 +- .../cognitosync/cognitosynciface/interface.go | 71 +- .../aws/aws-sdk-go/service/cognitosync/doc.go | 97 + .../aws-sdk-go/service/cognitosync/errors.go | 2 +- .../service/cognitosync/examples_test.go | 2 +- .../aws-sdk-go/service/cognitosync/service.go | 27 +- .../aws-sdk-go/service/configservice/api.go | 609 +- .../configserviceiface/interface.go | 108 +- .../aws-sdk-go/service/configservice/doc.go | 103 + .../service/configservice/errors.go | 2 +- .../service/configservice/examples_test.go | 2 +- .../service/configservice/service.go | 33 +- .../service/costandusagereportservice/api.go | 98 +- .../interface.go | 16 +- .../service/costandusagereportservice/doc.go | 80 + .../costandusagereportservice/errors.go | 2 +- .../examples_test.go | 2 +- .../costandusagereportservice/service.go | 12 +- .../service/databasemigrationservice/api.go | 631 +- .../interface.go | 135 +- .../service/databasemigrationservice/doc.go | 86 + .../databasemigrationservice/errors.go | 2 +- .../databasemigrationservice/examples_test.go | 2 +- .../databasemigrationservice/service.go | 18 +- .../aws-sdk-go/service/datapipeline/api.go | 476 +- .../datapipelineiface/interface.go | 82 +- .../aws-sdk-go/service/datapipeline/doc.go | 101 + .../aws-sdk-go/service/datapipeline/errors.go | 2 +- .../service/datapipeline/examples_test.go | 2 +- .../service/datapipeline/service.go | 31 +- .../aws/aws-sdk-go/service/devicefarm/api.go | 3238 +++++- .../devicefarm/devicefarmiface/interface.go | 203 +- .../aws/aws-sdk-go/service/devicefarm/doc.go | 82 + .../aws-sdk-go/service/devicefarm/errors.go | 2 +- .../service/devicefarm/examples_test.go | 177 +- .../aws-sdk-go/service/devicefarm/service.go | 14 +- .../aws-sdk-go/service/directconnect/api.go | 737 +- .../directconnectiface/interface.go | 151 +- .../aws-sdk-go/service/directconnect/doc.go | 91 + .../service/directconnect/errors.go | 2 +- .../service/directconnect/examples_test.go | 2 +- .../service/directconnect/service.go | 23 +- .../service/directoryservice/api.go | 726 +- .../directoryserviceiface/interface.go | 155 +- .../service/directoryservice/doc.go | 92 + .../service/directoryservice/errors.go | 2 +- .../service/directoryservice/examples_test.go | 2 +- .../service/directoryservice/service.go | 22 +- .../aws/aws-sdk-go/service/dynamodb/api.go | 514 +- .../service/dynamodb/customizations.go | 23 +- .../service/dynamodb/customizations_test.go | 83 +- .../aws/aws-sdk-go/service/dynamodb/doc.go | 97 + .../aws-sdk-go/service/dynamodb/doc_custom.go | 84 + .../dynamodb/dynamodbattribute/decode.go | 64 +- .../dynamodb/dynamodbattribute/decode_test.go | 33 + .../service/dynamodb/dynamodbattribute/doc.go | 88 +- .../dynamodb/dynamodbattribute/encode.go | 58 +- .../dynamodb/dynamodbattribute/encode_test.go | 31 + .../service/dynamodb/dynamodbattribute/tag.go | 3 + .../dynamodb/dynamodbiface/interface.go | 85 +- .../aws/aws-sdk-go/service/dynamodb/errors.go | 2 +- .../service/dynamodb/examples_test.go | 2 +- .../aws-sdk-go/service/dynamodb/service.go | 27 +- .../aws-sdk-go/service/dynamodb/waiters.go | 102 +- .../aws-sdk-go/service/dynamodbstreams/api.go | 80 +- .../aws-sdk-go/service/dynamodbstreams/doc.go | 83 + .../dynamodbstreamsiface/interface.go | 19 +- .../service/dynamodbstreams/errors.go | 2 +- .../service/dynamodbstreams/examples_test.go | 2 +- .../service/dynamodbstreams/service.go | 15 +- .../aws/aws-sdk-go/service/ec2/api.go | 5126 ++++++++- .../aws/aws-sdk-go/service/ec2/doc.go | 83 + .../service/ec2/ec2iface/interface.go | 955 +- .../aws/aws-sdk-go/service/ec2/errors.go | 2 +- .../aws-sdk-go/service/ec2/examples_test.go | 62 +- .../aws/aws-sdk-go/service/ec2/service.go | 15 +- .../aws/aws-sdk-go/service/ec2/waiters.go | 1582 ++- .../aws/aws-sdk-go/service/ecr/api.go | 438 +- .../aws/aws-sdk-go/service/ecr/doc.go | 85 + .../service/ecr/ecriface/interface.go | 74 +- .../aws/aws-sdk-go/service/ecr/errors.go | 2 +- .../aws-sdk-go/service/ecr/examples_test.go | 2 +- .../aws/aws-sdk-go/service/ecr/service.go | 17 +- .../aws/aws-sdk-go/service/ecs/api.go | 815 +- .../aws/aws-sdk-go/service/ecs/doc.go | 91 + .../service/ecs/ecsiface/interface.go | 137 +- .../aws/aws-sdk-go/service/ecs/errors.go | 2 +- .../aws-sdk-go/service/ecs/examples_test.go | 2 +- .../aws/aws-sdk-go/service/ecs/service.go | 21 +- .../aws/aws-sdk-go/service/ecs/waiters.go | 217 +- .../aws/aws-sdk-go/service/efs/api.go | 213 +- .../aws/aws-sdk-go/service/efs/doc.go | 84 + .../service/efs/efsiface/interface.go | 47 +- .../aws/aws-sdk-go/service/efs/errors.go | 2 +- .../aws-sdk-go/service/efs/examples_test.go | 2 +- .../aws/aws-sdk-go/service/efs/service.go | 16 +- .../aws/aws-sdk-go/service/elasticache/api.go | 1526 ++- .../aws/aws-sdk-go/service/elasticache/doc.go | 90 + .../elasticache/elasticacheiface/interface.go | 173 +- .../aws-sdk-go/service/elasticache/errors.go | 22 +- .../service/elasticache/examples_test.go | 34 +- .../aws-sdk-go/service/elasticache/service.go | 20 +- .../aws-sdk-go/service/elasticache/waiters.go | 257 +- .../service/elasticbeanstalk/api.go | 820 +- .../service/elasticbeanstalk/doc.go | 96 + .../elasticbeanstalkiface/interface.go | 168 +- .../service/elasticbeanstalk/errors.go | 2 +- .../service/elasticbeanstalk/examples_test.go | 2 +- .../service/elasticbeanstalk/service.go | 26 +- .../service/elasticsearchservice/api.go | 325 +- .../service/elasticsearchservice/doc.go | 85 + .../elasticsearchserviceiface/interface.go | 57 +- .../service/elasticsearchservice/errors.go | 2 +- .../elasticsearchservice/examples_test.go | 2 +- .../service/elasticsearchservice/service.go | 15 +- .../service/elastictranscoder/api.go | 475 +- .../service/elastictranscoder/doc.go | 78 + .../elastictranscoderiface/interface.go | 76 +- .../service/elastictranscoder/errors.go | 2 +- .../elastictranscoder/examples_test.go | 2 +- .../service/elastictranscoder/service.go | 11 +- .../service/elastictranscoder/waiters.go | 62 +- .../aws/aws-sdk-go/service/elb/api.go | 573 +- .../aws/aws-sdk-go/service/elb/doc.go | 106 + .../service/elb/elbiface/interface.go | 119 +- .../aws/aws-sdk-go/service/elb/errors.go | 2 +- .../aws-sdk-go/service/elb/examples_test.go | 2 +- .../aws/aws-sdk-go/service/elb/service.go | 36 +- .../aws/aws-sdk-go/service/elb/waiters.go | 147 +- .../aws/aws-sdk-go/service/elbv2/api.go | 760 +- .../aws/aws-sdk-go/service/elbv2/doc.go | 125 + .../service/elbv2/elbv2iface/interface.go | 133 +- .../aws/aws-sdk-go/service/elbv2/errors.go | 4 +- .../aws-sdk-go/service/elbv2/examples_test.go | 2 +- .../aws/aws-sdk-go/service/elbv2/service.go | 55 +- .../aws/aws-sdk-go/service/elbv2/waiters.go | 168 + .../aws/aws-sdk-go/service/emr/api.go | 2667 ++++- .../aws/aws-sdk-go/service/emr/doc.go | 83 + .../service/emr/emriface/interface.go | 122 +- .../aws/aws-sdk-go/service/emr/errors.go | 2 +- .../aws-sdk-go/service/emr/examples_test.go | 192 +- .../aws/aws-sdk-go/service/emr/service.go | 15 +- .../aws/aws-sdk-go/service/emr/waiters.go | 176 +- .../aws/aws-sdk-go/service/firehose/api.go | 137 +- .../aws/aws-sdk-go/service/firehose/doc.go | 82 + .../aws/aws-sdk-go/service/firehose/errors.go | 2 +- .../service/firehose/examples_test.go | 2 +- .../firehose/firehoseiface/interface.go | 31 +- .../aws-sdk-go/service/firehose/service.go | 14 +- .../aws/aws-sdk-go/service/gamelift/api.go | 1321 ++- .../aws/aws-sdk-go/service/gamelift/doc.go | 291 + .../aws/aws-sdk-go/service/gamelift/errors.go | 2 +- .../service/gamelift/examples_test.go | 21 +- .../gamelift/gameliftiface/interface.go | 191 +- .../aws-sdk-go/service/gamelift/service.go | 209 +- .../aws/aws-sdk-go/service/glacier/api.go | 779 +- .../aws/aws-sdk-go/service/glacier/doc.go | 108 + .../aws/aws-sdk-go/service/glacier/errors.go | 2 +- .../service/glacier/examples_test.go | 2 +- .../service/glacier/glacieriface/interface.go | 141 +- .../aws/aws-sdk-go/service/glacier/service.go | 39 +- .../aws-sdk-go/service/glacier/treehash.go | 12 +- .../service/glacier/treehash_test.go | 45 +- .../aws/aws-sdk-go/service/glacier/waiters.go | 107 +- .../aws/aws-sdk-go/service/health/api.go | 266 +- .../aws/aws-sdk-go/service/health/doc.go | 117 + .../aws/aws-sdk-go/service/health/errors.go | 2 +- .../service/health/examples_test.go | 2 +- .../service/health/healthiface/interface.go | 31 +- .../aws/aws-sdk-go/service/health/service.go | 47 +- .../aws/aws-sdk-go/service/iam/api.go | 3748 ++++++- .../aws/aws-sdk-go/service/iam/doc.go | 132 + .../aws/aws-sdk-go/service/iam/errors.go | 11 +- .../aws-sdk-go/service/iam/examples_test.go | 48 +- .../service/iam/iamiface/interface.go | 507 +- .../aws/aws-sdk-go/service/iam/service.go | 62 +- .../aws/aws-sdk-go/service/iam/waiters.go | 107 +- .../aws/aws-sdk-go/service/inspector/api.go | 612 +- .../aws/aws-sdk-go/service/inspector/doc.go | 82 + .../aws-sdk-go/service/inspector/errors.go | 2 +- .../service/inspector/examples_test.go | 2 +- .../inspector/inspectoriface/interface.go | 131 +- .../aws-sdk-go/service/inspector/service.go | 14 +- .../aws/aws-sdk-go/service/iot/api.go | 1087 +- .../aws/aws-sdk-go/service/iot/doc.go | 85 + .../aws/aws-sdk-go/service/iot/errors.go | 2 +- .../aws-sdk-go/service/iot/examples_test.go | 2 +- .../service/iot/iotiface/interface.go | 231 +- .../aws/aws-sdk-go/service/iot/service.go | 16 +- .../aws-sdk-go/service/iotdataplane/api.go | 80 +- .../aws-sdk-go/service/iotdataplane/doc.go | 85 + .../aws-sdk-go/service/iotdataplane/errors.go | 2 +- .../service/iotdataplane/examples_test.go | 2 +- .../iotdataplaneiface/interface.go | 19 +- .../service/iotdataplane/service.go | 17 +- .../aws/aws-sdk-go/service/kinesis/api.go | 439 +- .../service/kinesis/customizations.go | 22 + .../service/kinesis/customizations_test.go | 89 + .../aws/aws-sdk-go/service/kinesis/doc.go | 81 + .../aws/aws-sdk-go/service/kinesis/errors.go | 2 +- .../service/kinesis/examples_test.go | 2 +- .../service/kinesis/kinesisiface/interface.go | 85 +- .../aws/aws-sdk-go/service/kinesis/service.go | 13 +- .../aws/aws-sdk-go/service/kinesis/waiters.go | 96 +- .../service/kinesisanalytics/api.go | 251 +- .../service/kinesisanalytics/doc.go | 78 + .../service/kinesisanalytics/errors.go | 2 +- .../service/kinesisanalytics/examples_test.go | 2 +- .../kinesisanalyticsiface/interface.go | 55 +- .../service/kinesisanalytics/service.go | 12 +- .../aws/aws-sdk-go/service/kms/api.go | 875 +- .../aws/aws-sdk-go/service/kms/doc.go | 150 + .../aws/aws-sdk-go/service/kms/errors.go | 2 +- .../aws-sdk-go/service/kms/examples_test.go | 2 +- .../service/kms/kmsiface/interface.go | 147 +- .../aws/aws-sdk-go/service/kms/service.go | 80 +- .../aws/aws-sdk-go/service/lambda/api.go | 1249 ++- .../aws/aws-sdk-go/service/lambda/doc.go | 84 + .../aws/aws-sdk-go/service/lambda/errors.go | 2 +- .../service/lambda/examples_test.go | 85 +- .../service/lambda/lambdaiface/interface.go | 111 +- .../aws/aws-sdk-go/service/lambda/service.go | 15 +- .../service/lexmodelbuildingservice/api.go | 9373 +++++++++++++++++ .../service/lexmodelbuildingservice/doc.go | 82 + .../service/lexmodelbuildingservice/errors.go | 61 + .../lexmodelbuildingservice/examples_test.go | 838 ++ .../lexmodelbuildingserviceiface/interface.go | 214 + .../lexmodelbuildingservice/service.go | 97 + .../service/lexruntimeservice/api.go | 853 +- .../service/lexruntimeservice/doc.go | 90 + .../service/lexruntimeservice/errors.go | 27 +- .../lexruntimeservice/examples_test.go | 29 +- .../lexruntimeserviceiface/interface.go | 13 +- .../service/lexruntimeservice/service.go | 22 +- .../aws/aws-sdk-go/service/lightsail/api.go | 897 +- .../aws/aws-sdk-go/service/lightsail/doc.go | 92 + .../aws-sdk-go/service/lightsail/errors.go | 2 +- .../service/lightsail/examples_test.go | 2 +- .../lightsail/lightsailiface/interface.go | 191 +- .../aws-sdk-go/service/lightsail/service.go | 22 +- .../aws-sdk-go/service/machinelearning/api.go | 684 +- .../aws-sdk-go/service/machinelearning/doc.go | 78 + .../service/machinelearning/errors.go | 2 +- .../service/machinelearning/examples_test.go | 2 +- .../machinelearningiface/interface.go | 123 +- .../service/machinelearning/service.go | 11 +- .../service/machinelearning/waiters.go | 207 +- .../marketplacecommerceanalytics/api.go | 47 +- .../marketplacecommerceanalytics/doc.go | 80 + .../marketplacecommerceanalytics/errors.go | 2 +- .../examples_test.go | 2 +- .../interface.go | 11 +- .../marketplacecommerceanalytics/service.go | 12 +- .../service/marketplacemetering/api.go | 61 +- .../service/marketplacemetering/doc.go | 100 + .../service/marketplacemetering/errors.go | 2 +- .../marketplacemetering/examples_test.go | 2 +- .../marketplacemeteringiface/interface.go | 15 +- .../service/marketplacemetering/service.go | 30 +- .../aws-sdk-go/service/mobileanalytics/api.go | 30 +- .../aws-sdk-go/service/mobileanalytics/doc.go | 79 + .../service/mobileanalytics/errors.go | 2 +- .../service/mobileanalytics/examples_test.go | 2 +- .../mobileanalyticsiface/interface.go | 7 +- .../service/mobileanalytics/service.go | 13 +- .../aws/aws-sdk-go/service/mturk/api.go | 1115 +- .../aws/aws-sdk-go/service/mturk/doc.go | 80 + .../aws/aws-sdk-go/service/mturk/errors.go | 2 +- .../aws-sdk-go/service/mturk/examples_test.go | 2 +- .../service/mturk/mturkiface/interface.go | 169 +- .../aws/aws-sdk-go/service/mturk/service.go | 11 +- .../aws/aws-sdk-go/service/opsworks/api.go | 2313 +++- .../aws/aws-sdk-go/service/opsworks/doc.go | 149 + .../aws/aws-sdk-go/service/opsworks/errors.go | 2 +- .../service/opsworks/examples_test.go | 48 +- .../opsworks/opsworksiface/interface.go | 290 +- .../aws-sdk-go/service/opsworks/service.go | 75 +- .../aws-sdk-go/service/opsworks/waiters.go | 452 +- .../aws/aws-sdk-go/service/opsworkscm/api.go | 626 +- .../aws/aws-sdk-go/service/opsworkscm/doc.go | 127 + .../aws-sdk-go/service/opsworkscm/errors.go | 2 +- .../service/opsworkscm/examples_test.go | 37 +- .../opsworkscm/opsworkscmiface/interface.go | 63 +- .../aws-sdk-go/service/opsworkscm/service.go | 44 +- .../aws-sdk-go/service/organizations/api.go | 745 +- .../aws-sdk-go/service/organizations/doc.go | 191 + .../service/organizations/errors.go | 2 +- .../service/organizations/examples_test.go | 2 +- .../organizationsiface/interface.go | 159 +- .../service/organizations/service.go | 121 +- .../aws/aws-sdk-go/service/pinpoint/api.go | 1565 ++- .../aws/aws-sdk-go/service/pinpoint/doc.go | 76 + .../aws/aws-sdk-go/service/pinpoint/errors.go | 2 +- .../service/pinpoint/examples_test.go | 90 +- .../pinpoint/pinpointiface/interface.go | 129 +- .../aws-sdk-go/service/pinpoint/service.go | 12 +- .../aws/aws-sdk-go/service/polly/api.go | 157 +- .../aws/aws-sdk-go/service/polly/doc.go | 86 + .../aws/aws-sdk-go/service/polly/errors.go | 15 +- .../aws-sdk-go/service/polly/examples_test.go | 8 +- .../service/polly/pollyiface/interface.go | 27 +- .../aws/aws-sdk-go/service/polly/service.go | 16 +- .../aws/aws-sdk-go/service/rds/api.go | 3100 +++++- .../aws-sdk-go/service/rds/customizations.go | 32 +- .../service/rds/customizations_test.go | 24 + .../aws/aws-sdk-go/service/rds/doc.go | 121 + .../aws/aws-sdk-go/service/rds/doc_custom.go | 25 + .../aws/aws-sdk-go/service/rds/errors.go | 6 +- .../aws-sdk-go/service/rds/examples_test.go | 286 +- .../service/rds/rdsiface/interface.go | 370 +- .../service/rds/rdsutils/connect.go | 66 + .../service/rds/rdsutils/connect_test.go | 21 + .../aws/aws-sdk-go/service/rds/service.go | 52 +- .../aws/aws-sdk-go/service/rds/waiters.go | 147 +- .../aws/aws-sdk-go/service/redshift/api.go | 2044 +++- .../aws/aws-sdk-go/service/redshift/doc.go | 103 + .../aws/aws-sdk-go/service/redshift/errors.go | 9 +- .../service/redshift/examples_test.go | 31 +- .../redshift/redshiftiface/interface.go | 272 +- .../aws-sdk-go/service/redshift/service.go | 33 +- .../aws-sdk-go/service/redshift/waiters.go | 222 +- .../aws/aws-sdk-go/service/rekognition/api.go | 585 +- .../aws/aws-sdk-go/service/rekognition/doc.go | 78 + .../aws-sdk-go/service/rekognition/errors.go | 2 +- .../service/rekognition/examples_test.go | 31 +- .../rekognition/rekognitioniface/interface.go | 51 +- .../aws-sdk-go/service/rekognition/service.go | 11 +- .../service/resourcegroupstaggingapi/api.go | 1159 ++ .../service/resourcegroupstaggingapi/doc.go | 116 + .../resourcegroupstaggingapi/errors.go | 33 + .../resourcegroupstaggingapi/examples_test.go | 151 + .../interface.go | 84 + .../resourcegroupstaggingapi/service.go | 95 + .../aws/aws-sdk-go/service/route53/api.go | 2403 +++-- .../aws/aws-sdk-go/service/route53/doc.go | 78 + .../aws/aws-sdk-go/service/route53/errors.go | 12 +- .../service/route53/examples_test.go | 2 +- .../service/route53/route53iface/interface.go | 203 +- .../aws/aws-sdk-go/service/route53/service.go | 12 +- .../aws/aws-sdk-go/service/route53/waiters.go | 52 +- .../aws-sdk-go/service/route53domains/api.go | 1496 ++- .../aws-sdk-go/service/route53domains/doc.go | 81 + .../service/route53domains/errors.go | 2 +- .../service/route53domains/examples_test.go | 2 +- .../route53domainsiface/interface.go | 97 +- .../service/route53domains/service.go | 12 +- .../aws/aws-sdk-go/service/s3/api.go | 1603 ++- .../aws-sdk-go/service/s3/bucket_location.go | 65 +- .../service/s3/bucket_location_test.go | 85 +- .../aws/aws-sdk-go/service/s3/doc.go | 78 + .../aws/aws-sdk-go/service/s3/doc_custom.go | 109 + .../aws/aws-sdk-go/service/s3/errors.go | 2 +- .../aws-sdk-go/service/s3/examples_test.go | 2 +- .../service/s3/host_style_bucket_test.go | 28 +- .../aws-sdk-go/service/s3/s3crypto/aes_cbc.go | 190 + .../s3/s3crypto/aes_cbc_content_cipher.go | 73 + .../s3crypto/aes_cbc_content_cipher_test.go | 20 + .../service/s3/s3crypto/aes_cbc_padder.go | 29 + .../s3/s3crypto/aes_cbc_padder_test.go | 41 + .../service/s3/s3crypto/aes_cbc_test.go | 501 + .../service/s3/s3crypto/cipher_builder.go | 4 +- .../service/s3/s3crypto/cipher_util.go | 26 +- .../service/s3/s3crypto/cipher_util_test.go | 7 + .../service/s3/s3crypto/decryption_client.go | 41 +- .../s3/s3crypto/decryption_client_test.go | 143 +- .../aws/aws-sdk-go/service/s3/s3crypto/doc.go | 4 +- .../service/s3/s3crypto/encryption_client.go | 15 + .../s3/s3crypto/encryption_client_test.go | 32 + .../aws-sdk-go/service/s3/s3crypto/padder.go | 35 + .../service/s3/s3crypto/pkcs7_padder.go | 80 + .../service/s3/s3crypto/pkcs7_padder_test.go | 57 + .../service/s3/s3iface/interface.go | 308 +- .../service/s3/s3manager/bucket_region.go | 83 + .../s3/s3manager/bucket_region_test.go | 92 + .../service/s3/s3manager/download.go | 80 +- .../service/s3/s3manager/download_test.go | 88 + .../s3/s3manager/s3manageriface/interface.go | 3 + .../aws-sdk-go/service/s3/s3manager/upload.go | 117 +- .../service/s3/s3manager/upload_test.go | 27 + .../aws/aws-sdk-go/service/s3/service.go | 12 +- .../service/s3/statusok_error_test.go | 2 +- .../aws-sdk-go/service/s3/unmarshal_error.go | 64 +- .../service/s3/unmarshal_error_test.go | 151 +- .../aws/aws-sdk-go/service/s3/waiters.go | 207 +- .../aws-sdk-go/service/servicecatalog/api.go | 821 +- .../aws-sdk-go/service/servicecatalog/doc.go | 92 + .../service/servicecatalog/errors.go | 2 +- .../service/servicecatalog/examples_test.go | 2 +- .../service/servicecatalog/service.go | 22 +- .../servicecatalogiface/interface.go | 175 +- .../aws/aws-sdk-go/service/ses/api.go | 972 +- .../aws/aws-sdk-go/service/ses/doc.go | 86 + .../aws/aws-sdk-go/service/ses/errors.go | 2 +- .../aws-sdk-go/service/ses/examples_test.go | 2 +- .../aws/aws-sdk-go/service/ses/service.go | 16 +- .../service/ses/sesiface/interface.go | 201 +- .../aws/aws-sdk-go/service/ses/waiters.go | 52 +- .../aws/aws-sdk-go/service/sfn/api.go | 475 +- .../aws/aws-sdk-go/service/sfn/doc.go | 95 + .../aws/aws-sdk-go/service/sfn/errors.go | 2 +- .../aws-sdk-go/service/sfn/examples_test.go | 2 +- .../aws/aws-sdk-go/service/sfn/service.go | 25 +- .../service/sfn/sfniface/interface.go | 75 +- .../aws/aws-sdk-go/service/shield/api.go | 175 +- .../aws/aws-sdk-go/service/shield/doc.go | 84 + .../aws/aws-sdk-go/service/shield/errors.go | 2 +- .../service/shield/examples_test.go | 2 +- .../aws/aws-sdk-go/service/shield/service.go | 16 +- .../service/shield/shieldiface/interface.go | 39 +- .../aws/aws-sdk-go/service/simpledb/api.go | 325 +- .../aws/aws-sdk-go/service/simpledb/doc.go | 92 + .../aws/aws-sdk-go/service/simpledb/errors.go | 2 +- .../service/simpledb/examples_test.go | 2 +- .../aws-sdk-go/service/simpledb/service.go | 24 +- .../simpledb/simpledbiface/interface.go | 45 +- .../aws/aws-sdk-go/service/sms/api.go | 361 +- .../aws/aws-sdk-go/service/sms/doc.go | 81 + .../aws/aws-sdk-go/service/sms/errors.go | 2 +- .../aws-sdk-go/service/sms/examples_test.go | 2 +- .../aws/aws-sdk-go/service/sms/service.go | 13 +- .../service/sms/smsiface/interface.go | 51 +- .../aws/aws-sdk-go/service/snowball/api.go | 532 +- .../aws/aws-sdk-go/service/snowball/doc.go | 87 + .../aws/aws-sdk-go/service/snowball/errors.go | 9 +- .../service/snowball/examples_test.go | 37 +- .../aws-sdk-go/service/snowball/service.go | 19 +- .../snowball/snowballiface/interface.go | 73 +- .../aws/aws-sdk-go/service/sns/api.go | 759 +- .../aws/aws-sdk-go/service/sns/doc.go | 92 + .../aws/aws-sdk-go/service/sns/errors.go | 2 +- .../aws-sdk-go/service/sns/examples_test.go | 2 +- .../aws/aws-sdk-go/service/sns/service.go | 22 +- .../service/sns/snsiface/interface.go | 128 +- .../aws/aws-sdk-go/service/sqs/api.go | 562 +- .../aws/aws-sdk-go/service/sqs/doc.go | 115 + .../aws/aws-sdk-go/service/sqs/errors.go | 2 +- .../aws-sdk-go/service/sqs/examples_test.go | 2 +- .../aws/aws-sdk-go/service/sqs/service.go | 45 +- .../service/sqs/sqsiface/interface.go | 71 +- .../aws/aws-sdk-go/service/ssm/api.go | 2112 +++- .../aws/aws-sdk-go/service/ssm/doc.go | 92 + .../aws/aws-sdk-go/service/ssm/errors.go | 24 +- .../aws-sdk-go/service/ssm/examples_test.go | 12 +- .../aws/aws-sdk-go/service/ssm/service.go | 24 +- .../service/ssm/ssmiface/interface.go | 329 +- .../aws-sdk-go/service/storagegateway/api.go | 1753 ++- .../aws-sdk-go/service/storagegateway/doc.go | 131 + .../service/storagegateway/errors.go | 2 +- .../service/storagegateway/examples_test.go | 27 +- .../service/storagegateway/service.go | 61 +- .../storagegatewayiface/interface.go | 255 +- .../aws/aws-sdk-go/service/sts/api.go | 137 +- .../aws/aws-sdk-go/service/sts/doc.go | 124 + .../aws/aws-sdk-go/service/sts/errors.go | 2 +- .../aws-sdk-go/service/sts/examples_test.go | 2 +- .../aws/aws-sdk-go/service/sts/service.go | 54 +- .../service/sts/stsiface/interface.go | 31 +- .../aws/aws-sdk-go/service/support/api.go | 344 +- .../aws/aws-sdk-go/service/support/doc.go | 129 + .../aws/aws-sdk-go/service/support/errors.go | 2 +- .../service/support/examples_test.go | 2 +- .../aws/aws-sdk-go/service/support/service.go | 59 +- .../service/support/supportiface/interface.go | 61 +- .../aws/aws-sdk-go/service/swf/api.go | 853 +- .../aws/aws-sdk-go/service/swf/doc.go | 90 + .../aws/aws-sdk-go/service/swf/errors.go | 2 +- .../aws-sdk-go/service/swf/examples_test.go | 2 +- .../aws/aws-sdk-go/service/swf/service.go | 21 +- .../service/swf/swfiface/interface.go | 134 +- .../aws/aws-sdk-go/service/waf/api.go | 726 +- .../aws/aws-sdk-go/service/waf/doc.go | 86 + .../aws/aws-sdk-go/service/waf/errors.go | 2 +- .../aws-sdk-go/service/waf/examples_test.go | 2 +- .../aws/aws-sdk-go/service/waf/service.go | 18 +- .../service/waf/wafiface/interface.go | 155 +- .../aws/aws-sdk-go/service/wafregional/api.go | 802 +- .../aws/aws-sdk-go/service/wafregional/doc.go | 88 + .../aws-sdk-go/service/wafregional/errors.go | 2 +- .../service/wafregional/examples_test.go | 2 +- .../aws-sdk-go/service/wafregional/service.go | 20 +- .../wafregional/wafregionaliface/interface.go | 171 +- .../aws/aws-sdk-go/service/workdocs/api.go | 6808 ++++++++++++ .../aws/aws-sdk-go/service/workdocs/doc.go | 110 + .../aws/aws-sdk-go/service/workdocs/errors.go | 105 + .../service/workdocs/examples_test.go | 703 ++ .../aws-sdk-go/service/workdocs/service.go | 94 + .../workdocs/workdocsiface/interface.go | 189 + .../aws/aws-sdk-go/service/workspaces/api.go | 381 +- .../aws/aws-sdk-go/service/workspaces/doc.go | 81 + .../aws-sdk-go/service/workspaces/errors.go | 2 +- .../service/workspaces/examples_test.go | 2 +- .../aws-sdk-go/service/workspaces/service.go | 13 +- .../workspaces/workspacesiface/interface.go | 62 +- .../aws/aws-sdk-go/service/xray/api.go | 118 +- .../aws/aws-sdk-go/service/xray/doc.go | 81 + .../aws/aws-sdk-go/service/xray/errors.go | 2 +- .../aws-sdk-go/service/xray/examples_test.go | 2 +- .../aws/aws-sdk-go/service/xray/service.go | 13 +- .../service/xray/xrayiface/interface.go | 27 +- .../vendor/github.com/go-ini/ini/.gitignore | 1 + .../vendor/github.com/go-ini/ini/.travis.yml | 17 + .../vendor/github.com/go-ini/ini/Makefile | 12 + .../vendor/github.com/go-ini/ini/README.md | 210 +- .../vendor/github.com/go-ini/ini/README_ZH.md | 214 +- .../vendor/github.com/go-ini/ini/error.go | 32 + .../vendor/github.com/go-ini/ini/ini.go | 1007 +- .../vendor/github.com/go-ini/ini/ini_test.go | 559 +- .../vendor/github.com/go-ini/ini/key.go | 703 ++ .../vendor/github.com/go-ini/ini/key_test.go | 573 + .../vendor/github.com/go-ini/ini/parser.go | 358 + .../github.com/go-ini/ini/parser_test.go | 42 + .../vendor/github.com/go-ini/ini/section.go | 234 + .../github.com/go-ini/ini/section_test.go | 75 + .../vendor/github.com/go-ini/ini/struct.go | 214 +- .../github.com/go-ini/ini/struct_test.go | 118 +- .../go-ini/ini/testdata/UTF-16-BE-BOM.ini | Bin 0 -> 56 bytes .../go-ini/ini/testdata/UTF-16-LE-BOM.ini | Bin 0 -> 56 bytes .../go-ini/ini/testdata/UTF-8-BOM.ini | 2 + .../github.com/go-ini/ini/testdata/aicc.ini | 11 + .../github.com/go-ini/ini/testdata/conf.ini | 2 +- vendor/github.com/go-ini/ini/ini.go | 62 +- vendor/github.com/go-ini/ini/ini_test.go | 61 +- vendor/github.com/go-ini/ini/key.go | 148 +- vendor/github.com/go-ini/ini/key_test.go | 36 + vendor/github.com/go-ini/ini/parser.go | 26 +- vendor/github.com/go-ini/ini/section.go | 28 +- vendor/github.com/go-ini/ini/struct.go | 45 +- vendor/github.com/go-ini/ini/struct_test.go | 16 +- vendor/github.com/gopherjs/gopherjs/README.md | 11 +- .../gopherjs/gopherjs/build/build.go | 9 +- .../github.com/gopherjs/gopherjs/circle.yml | 2 +- .../gopherjs/compiler/natives/fs_vfsdata.go | 112 +- .../src/net/http/cookiejar/example_test.go | 14 + .../compiler/natives/src/net/http/http.go | 10 +- .../natives/src/reflect/example_test.go | 14 + .../compiler/natives/src/testing/example.go | 70 + .../compiler/natives/src/testing/ioutil.go | 66 + .../gopherjs/compiler/prelude/jsmapping.go | 14 +- .../gopherjs/compiler/prelude/prelude.go | 3 - vendor/github.com/gopherjs/gopherjs/js/js.go | 2 +- .../gopherjs/gopherjs/js/js_test.go | 13 + .../gopherjs/tests/deferblock_test.go | 2 +- .../gopherjs/third_party/importer/export.go | 2 +- .../gopherjs/third_party/importer/import.go | 4 +- vendor/github.com/gopherjs/gopherjs/tool.go | 177 +- .../mozilla-services/yaml/decode_test.go | 11 +- .../mozilla-services/yaml/resolve.go | 11 +- .../mozilla-services/yaml/scannerc.go | 2 +- vendor/golang.org/x/crypto/acme/acme.go | 203 +- vendor/golang.org/x/crypto/acme/acme_test.go | 50 +- .../x/crypto/acme/autocert/autocert.go | 65 +- .../x/crypto/acme/autocert/autocert_test.go | 132 +- .../x/crypto/acme/autocert/cache.go | 14 +- .../x/crypto/acme/autocert/cache_test.go | 3 +- .../x/crypto/acme/autocert/example_test.go | 34 + .../x/crypto/acme/autocert/listener.go | 153 + .../x/crypto/acme/autocert/renewal.go | 17 +- .../x/crypto/acme/autocert/renewal_test.go | 7 +- vendor/golang.org/x/crypto/acme/jws.go | 2 +- vendor/golang.org/x/crypto/acme/jws_test.go | 177 +- vendor/golang.org/x/crypto/acme/types.go | 102 +- vendor/golang.org/x/crypto/acme/types_test.go | 63 + vendor/golang.org/x/crypto/blake2b/blake2b.go | 2 +- .../golang.org/x/crypto/blake2b/register.go | 32 + vendor/golang.org/x/crypto/blake2s/blake2s.go | 2 +- .../golang.org/x/crypto/blake2s/register.go | 21 + .../chacha20poly1305/chacha20poly1305.go | 2 +- vendor/golang.org/x/crypto/cryptobyte/asn1.go | 604 ++ .../x/crypto/cryptobyte/asn1_test.go | 285 + .../golang.org/x/crypto/cryptobyte/builder.go | 255 + .../x/crypto/cryptobyte/cryptobyte_test.go | 379 + .../x/crypto/cryptobyte/example_test.go | 120 + .../golang.org/x/crypto/cryptobyte/string.go | 157 + .../x/crypto/curve25519/cswap_amd64.s | 131 +- .../x/crypto/curve25519/curve25519.go | 23 +- .../x/crypto/curve25519/curve25519_test.go | 10 + vendor/golang.org/x/crypto/pkcs12/pkcs12.go | 4 + .../x/crypto/ssh/agent/client_test.go | 4 +- .../x/crypto/ssh/agent/example_test.go | 15 +- .../x/crypto/ssh/agent/server_test.go | 4 +- vendor/golang.org/x/crypto/ssh/certs.go | 2 +- vendor/golang.org/x/crypto/ssh/client.go | 56 +- vendor/golang.org/x/crypto/ssh/client_auth.go | 45 +- .../x/crypto/ssh/client_auth_test.go | 118 +- vendor/golang.org/x/crypto/ssh/client_test.go | 42 + vendor/golang.org/x/crypto/ssh/common.go | 14 +- vendor/golang.org/x/crypto/ssh/doc.go | 3 + .../golang.org/x/crypto/ssh/example_test.go | 57 +- vendor/golang.org/x/crypto/ssh/handshake.go | 53 +- .../golang.org/x/crypto/ssh/handshake_test.go | 29 + vendor/golang.org/x/crypto/ssh/keys.go | 90 +- .../x/crypto/ssh/knownhosts/knownhosts.go | 547 + .../crypto/ssh/knownhosts/knownhosts_test.go | 307 + vendor/golang.org/x/crypto/ssh/server.go | 33 + .../golang.org/x/crypto/ssh/session_test.go | 10 +- vendor/golang.org/x/crypto/ssh/streamlocal.go | 115 + vendor/golang.org/x/crypto/ssh/tcpip.go | 198 +- .../x/crypto/ssh/terminal/util_solaris.go | 63 +- .../golang.org/x/crypto/ssh/test/cert_test.go | 3 +- .../x/crypto/ssh/test/dial_unix_test.go | 128 + .../x/crypto/ssh/test/forward_unix_test.go | 62 +- .../x/crypto/ssh/test/tcpip_test.go | 46 - .../x/crypto/ssh/test/test_unix_test.go | 10 + .../golang.org/x/crypto/ssh/testdata/keys.go | 16 + vendor/golang.org/x/sys/unix/README.md | 173 + vendor/golang.org/x/sys/unix/dirent.go | 102 + vendor/golang.org/x/sys/unix/endian_big.go | 9 + vendor/golang.org/x/sys/unix/endian_little.go | 9 + vendor/golang.org/x/sys/unix/linux/Dockerfile | 48 + vendor/golang.org/x/sys/unix/linux/mkall.go | 379 + .../{mksysnum_linux.pl => linux/mksysnum.pl} | 25 +- .../unix/{types_linux.go => linux/types.go} | 89 +- vendor/golang.org/x/sys/unix/mkall.sh | 143 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 61 +- vendor/golang.org/x/sys/unix/mkpost.go | 74 +- vendor/golang.org/x/sys/unix/mksyscall.pl | 12 +- .../x/sys/unix/mksyscall_solaris.pl | 2 +- .../golang.org/x/sys/unix/mksysnum_darwin.pl | 2 +- .../x/sys/unix/mksysnum_dragonfly.pl | 2 +- .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 2 +- .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 2 +- .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 2 +- .../golang.org/x/sys/unix/openbsd_pledge.go | 38 + vendor/golang.org/x/sys/unix/openbsd_test.go | 113 + .../golang.org/x/sys/unix/syscall_darwin.go | 36 +- .../x/sys/unix/syscall_dragonfly.go | 64 +- .../golang.org/x/sys/unix/syscall_freebsd.go | 36 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 82 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 36 +- .../golang.org/x/sys/unix/syscall_openbsd.go | 36 +- .../golang.org/x/sys/unix/syscall_solaris.go | 38 +- vendor/golang.org/x/sys/unix/types_darwin.go | 2 +- .../golang.org/x/sys/unix/types_dragonfly.go | 2 +- vendor/golang.org/x/sys/unix/types_freebsd.go | 2 +- vendor/golang.org/x/sys/unix/types_netbsd.go | 2 +- vendor/golang.org/x/sys/unix/types_openbsd.go | 2 +- vendor/golang.org/x/sys/unix/types_solaris.go | 2 +- .../x/sys/unix/zerrors_dragonfly_amd64.go | 56 +- .../x/sys/unix/zerrors_linux_386.go | 300 +- .../x/sys/unix/zerrors_linux_amd64.go | 300 +- .../x/sys/unix/zerrors_linux_arm.go | 367 +- .../x/sys/unix/zerrors_linux_arm64.go | 218 +- .../x/sys/unix/zerrors_linux_mips.go | 339 +- .../x/sys/unix/zerrors_linux_mips64.go | 180 +- .../x/sys/unix/zerrors_linux_mips64le.go | 180 +- .../x/sys/unix/zerrors_linux_mipsle.go | 71 +- .../x/sys/unix/zerrors_linux_ppc64.go | 168 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 215 +- .../x/sys/unix/zerrors_linux_s390x.go | 104 +- .../x/sys/unix/zerrors_linux_sparc64.go | 29 + .../x/sys/unix/zsyscall_dragonfly_amd64.go | 13 +- .../x/sys/unix/zsyscall_linux_386.go | 19 +- .../x/sys/unix/zsyscall_linux_amd64.go | 19 +- .../x/sys/unix/zsyscall_linux_arm.go | 19 +- .../x/sys/unix/zsyscall_linux_arm64.go | 19 +- .../x/sys/unix/zsyscall_linux_mips.go | 19 +- .../x/sys/unix/zsyscall_linux_mips64.go | 19 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 19 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 19 +- .../x/sys/unix/zsyscall_linux_ppc64.go | 19 +- .../x/sys/unix/zsyscall_linux_ppc64le.go | 19 +- .../x/sys/unix/zsyscall_linux_s390x.go | 19 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 21 +- .../x/sys/unix/zsysnum_dragonfly_amd64.go | 21 +- .../x/sys/unix/zsysnum_linux_386.go | 39 +- .../x/sys/unix/zsysnum_linux_amd64.go | 24 +- .../x/sys/unix/zsysnum_linux_arm.go | 37 +- .../x/sys/unix/zsysnum_linux_arm64.go | 17 +- .../x/sys/unix/zsysnum_linux_mips.go | 27 +- .../x/sys/unix/zsysnum_linux_mips64.go | 11 +- .../x/sys/unix/zsysnum_linux_mips64le.go | 11 +- .../x/sys/unix/zsysnum_linux_mipsle.go | 27 +- .../x/sys/unix/zsysnum_linux_ppc64.go | 13 +- .../x/sys/unix/zsysnum_linux_ppc64le.go | 20 +- .../x/sys/unix/zsysnum_linux_s390x.go | 7 +- .../x/sys/unix/zsysnum_linux_sparc64.go | 2 +- .../x/sys/unix/ztypes_dragonfly_amd64.go | 6 +- .../golang.org/x/sys/unix/ztypes_linux_386.go | 42 +- .../x/sys/unix/ztypes_linux_amd64.go | 70 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 42 +- .../x/sys/unix/ztypes_linux_arm64.go | 72 +- .../x/sys/unix/ztypes_linux_mips.go | 39 +- .../x/sys/unix/ztypes_linux_mips64.go | 49 +- .../x/sys/unix/ztypes_linux_mips64le.go | 49 +- .../x/sys/unix/ztypes_linux_mipsle.go | 39 +- .../x/sys/unix/ztypes_linux_ppc64.go | 74 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 74 +- .../x/sys/unix/ztypes_linux_s390x.go | 42 +- .../x/sys/unix/ztypes_linux_sparc64.go | 9 + .../x/sys/windows/syscall_windows.go | 8 +- .../x/sys/windows/zsyscall_windows.go | 21 +- .../x/sys/windows/ztypes_windows.go | 6 +- 1108 files changed, 164355 insertions(+), 30280 deletions(-) create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/url.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go create mode 100644 vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/request/withContext/README.md create mode 100644 vendor/github.com/aws/aws-sdk-go/example/aws/request/withContext/withContext.go create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/appstream/2016-12-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/batch/2016-08-10/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/budgets/2016-10-20/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/cloudfront/2017-03-25/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/codestar/2017-04-19/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/discovery/2015-11-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/elasticloadbalancingv2/2015-12-01/waiters-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/events/2015-10-07/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/lex-models/2017-04-19/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/marketplacecommerceanalytics/2015-07-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/opsworkscm/2016-11-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/polly/2016-06-10/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/workdocs/2016-05-01/api-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/workdocs/2016-05-01/docs-2.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/workdocs/2016-05-01/examples-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/models/apis/workdocs/2016-05-01/paginators-1.json create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/list_of_shame.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/model/api/passes_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/waiter/waiter_test.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/sdk.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/acm/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/apigateway/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/applicationdiscoveryservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appstream/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/batch/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/budgets/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/clouddirectory/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudformation/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudfront/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudhsm/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudsearch/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudsearchdomain/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudtrail/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatch/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codebuild/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codecommit/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codedeploy/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codepipeline/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/codestariface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/codestar/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitoidentityprovider/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/cognitosync/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/configservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/datapipeline/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/devicefarm/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/directconnect/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/directoryservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodb/doc_custom.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/dynamodbstreams/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ecr/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ecs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/efs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticache/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/emr/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/firehose/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/gamelift/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/glacier/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/health/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/iam/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/inspector/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/iot/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/iotdataplane/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesis/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kinesisanalytics/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/kms/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lambda/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/lexmodelbuildingserviceiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lexruntimeservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/machinelearning/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplacecommerceanalytics/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/marketplacemetering/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mobileanalytics/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/mturk/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworks/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/opsworkscm/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/organizations/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/pinpoint/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/polly/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/doc_custom.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/redshift/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/rekognition/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/route53domains/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_cbc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_cbc_content_cipher.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_cbc_content_cipher_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_cbc_padder.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_cbc_padder_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/aes_cbc_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/padder.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/pkcs7_padder.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3crypto/pkcs7_padder_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/bucket_region.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/bucket_region_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/servicecatalog/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ses/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sfn/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/shield/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/simpledb/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sms/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/snowball/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sns/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sqs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/ssm/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/storagegateway/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/support/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/swf/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/waf/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/wafregional/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/examples_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/service.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workdocs/workdocsiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/workspaces/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/xray/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/.travis.yml create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/Makefile create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/error.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/key.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/key_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/parser.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/parser_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/section.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/section_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/testdata/UTF-16-BE-BOM.ini create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/testdata/UTF-16-LE-BOM.ini create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/testdata/UTF-8-BOM.ini create mode 100644 vendor/github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini/testdata/aicc.ini create mode 100644 vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/cookiejar/example_test.go create mode 100644 vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/example_test.go create mode 100644 vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/example.go create mode 100644 vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/ioutil.go create mode 100644 vendor/golang.org/x/crypto/acme/autocert/example_test.go create mode 100644 vendor/golang.org/x/crypto/acme/autocert/listener.go create mode 100644 vendor/golang.org/x/crypto/acme/types_test.go create mode 100644 vendor/golang.org/x/crypto/blake2b/register.go create mode 100644 vendor/golang.org/x/crypto/blake2s/register.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/asn1.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/asn1_test.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/builder.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/cryptobyte_test.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/example_test.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/string.go create mode 100644 vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go create mode 100644 vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/streamlocal.go create mode 100644 vendor/golang.org/x/crypto/ssh/test/dial_unix_test.go delete mode 100644 vendor/golang.org/x/crypto/ssh/test/tcpip_test.go create mode 100644 vendor/golang.org/x/sys/unix/README.md create mode 100644 vendor/golang.org/x/sys/unix/dirent.go create mode 100644 vendor/golang.org/x/sys/unix/endian_big.go create mode 100644 vendor/golang.org/x/sys/unix/endian_little.go create mode 100644 vendor/golang.org/x/sys/unix/linux/Dockerfile create mode 100644 vendor/golang.org/x/sys/unix/linux/mkall.go rename vendor/golang.org/x/sys/unix/{mksysnum_linux.pl => linux/mksysnum.pl} (63%) rename vendor/golang.org/x/sys/unix/{types_linux.go => linux/types.go} (85%) create mode 100644 vendor/golang.org/x/sys/unix/openbsd_pledge.go create mode 100644 vendor/golang.org/x/sys/unix/openbsd_test.go diff --git a/cmd/sops/version.go b/cmd/sops/version.go index 445d23c88..6f97bcd81 100644 --- a/cmd/sops/version.go +++ b/cmd/sops/version.go @@ -10,7 +10,7 @@ import ( "gopkg.in/urfave/cli.v1" ) -const version = "2.0.8" +const version = "2.0.9" func printVersion(c *cli.Context) { out := fmt.Sprintf("%s %s", c.App.Name, c.App.Version) diff --git a/kms/mocks/KMSAPI.go b/kms/mocks/KMSAPI.go index c4dd55a5d..bbc2995eb 100644 --- a/kms/mocks/KMSAPI.go +++ b/kms/mocks/KMSAPI.go @@ -1,7 +1,8 @@ package mocks +import aws "github.com/aws/aws-sdk-go/aws" import kms "github.com/aws/aws-sdk-go/service/kms" -import kmsiface "github.com/aws/aws-sdk-go/service/kms/kmsiface" + import mock "github.com/stretchr/testify/mock" import request "github.com/aws/aws-sdk-go/aws/request" @@ -58,6 +59,36 @@ func (_m *KMSAPI) CancelKeyDeletionRequest(_a0 *kms.CancelKeyDeletionInput) (*re return r0, r1 } +// CancelKeyDeletionWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) CancelKeyDeletionWithContext(_a0 aws.Context, _a1 *kms.CancelKeyDeletionInput, _a2 ...request.Option) (*kms.CancelKeyDeletionOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.CancelKeyDeletionOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.CancelKeyDeletionInput, ...request.Option) *kms.CancelKeyDeletionOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.CancelKeyDeletionOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.CancelKeyDeletionInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // CreateAlias provides a mock function with given fields: _a0 func (_m *KMSAPI) CreateAlias(_a0 *kms.CreateAliasInput) (*kms.CreateAliasOutput, error) { ret := _m.Called(_a0) @@ -106,6 +137,36 @@ func (_m *KMSAPI) CreateAliasRequest(_a0 *kms.CreateAliasInput) (*request.Reques return r0, r1 } +// CreateAliasWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) CreateAliasWithContext(_a0 aws.Context, _a1 *kms.CreateAliasInput, _a2 ...request.Option) (*kms.CreateAliasOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.CreateAliasOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.CreateAliasInput, ...request.Option) *kms.CreateAliasOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.CreateAliasOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.CreateAliasInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // CreateGrant provides a mock function with given fields: _a0 func (_m *KMSAPI) CreateGrant(_a0 *kms.CreateGrantInput) (*kms.CreateGrantOutput, error) { ret := _m.Called(_a0) @@ -154,6 +215,36 @@ func (_m *KMSAPI) CreateGrantRequest(_a0 *kms.CreateGrantInput) (*request.Reques return r0, r1 } +// CreateGrantWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) CreateGrantWithContext(_a0 aws.Context, _a1 *kms.CreateGrantInput, _a2 ...request.Option) (*kms.CreateGrantOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.CreateGrantOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.CreateGrantInput, ...request.Option) *kms.CreateGrantOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.CreateGrantOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.CreateGrantInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // CreateKey provides a mock function with given fields: _a0 func (_m *KMSAPI) CreateKey(_a0 *kms.CreateKeyInput) (*kms.CreateKeyOutput, error) { ret := _m.Called(_a0) @@ -202,6 +293,36 @@ func (_m *KMSAPI) CreateKeyRequest(_a0 *kms.CreateKeyInput) (*request.Request, * return r0, r1 } +// CreateKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) CreateKeyWithContext(_a0 aws.Context, _a1 *kms.CreateKeyInput, _a2 ...request.Option) (*kms.CreateKeyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.CreateKeyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.CreateKeyInput, ...request.Option) *kms.CreateKeyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.CreateKeyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.CreateKeyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Decrypt provides a mock function with given fields: _a0 func (_m *KMSAPI) Decrypt(_a0 *kms.DecryptInput) (*kms.DecryptOutput, error) { ret := _m.Called(_a0) @@ -250,6 +371,36 @@ func (_m *KMSAPI) DecryptRequest(_a0 *kms.DecryptInput) (*request.Request, *kms. return r0, r1 } +// DecryptWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) DecryptWithContext(_a0 aws.Context, _a1 *kms.DecryptInput, _a2 ...request.Option) (*kms.DecryptOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.DecryptOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.DecryptInput, ...request.Option) *kms.DecryptOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.DecryptOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.DecryptInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // DeleteAlias provides a mock function with given fields: _a0 func (_m *KMSAPI) DeleteAlias(_a0 *kms.DeleteAliasInput) (*kms.DeleteAliasOutput, error) { ret := _m.Called(_a0) @@ -298,6 +449,36 @@ func (_m *KMSAPI) DeleteAliasRequest(_a0 *kms.DeleteAliasInput) (*request.Reques return r0, r1 } +// DeleteAliasWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) DeleteAliasWithContext(_a0 aws.Context, _a1 *kms.DeleteAliasInput, _a2 ...request.Option) (*kms.DeleteAliasOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.DeleteAliasOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.DeleteAliasInput, ...request.Option) *kms.DeleteAliasOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.DeleteAliasOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.DeleteAliasInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // DeleteImportedKeyMaterial provides a mock function with given fields: _a0 func (_m *KMSAPI) DeleteImportedKeyMaterial(_a0 *kms.DeleteImportedKeyMaterialInput) (*kms.DeleteImportedKeyMaterialOutput, error) { ret := _m.Called(_a0) @@ -346,6 +527,36 @@ func (_m *KMSAPI) DeleteImportedKeyMaterialRequest(_a0 *kms.DeleteImportedKeyMat return r0, r1 } +// DeleteImportedKeyMaterialWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) DeleteImportedKeyMaterialWithContext(_a0 aws.Context, _a1 *kms.DeleteImportedKeyMaterialInput, _a2 ...request.Option) (*kms.DeleteImportedKeyMaterialOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.DeleteImportedKeyMaterialOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.DeleteImportedKeyMaterialInput, ...request.Option) *kms.DeleteImportedKeyMaterialOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.DeleteImportedKeyMaterialOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.DeleteImportedKeyMaterialInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // DescribeKey provides a mock function with given fields: _a0 func (_m *KMSAPI) DescribeKey(_a0 *kms.DescribeKeyInput) (*kms.DescribeKeyOutput, error) { ret := _m.Called(_a0) @@ -394,6 +605,36 @@ func (_m *KMSAPI) DescribeKeyRequest(_a0 *kms.DescribeKeyInput) (*request.Reques return r0, r1 } +// DescribeKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) DescribeKeyWithContext(_a0 aws.Context, _a1 *kms.DescribeKeyInput, _a2 ...request.Option) (*kms.DescribeKeyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.DescribeKeyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.DescribeKeyInput, ...request.Option) *kms.DescribeKeyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.DescribeKeyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.DescribeKeyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // DisableKey provides a mock function with given fields: _a0 func (_m *KMSAPI) DisableKey(_a0 *kms.DisableKeyInput) (*kms.DisableKeyOutput, error) { ret := _m.Called(_a0) @@ -490,6 +731,66 @@ func (_m *KMSAPI) DisableKeyRotationRequest(_a0 *kms.DisableKeyRotationInput) (* return r0, r1 } +// DisableKeyRotationWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) DisableKeyRotationWithContext(_a0 aws.Context, _a1 *kms.DisableKeyRotationInput, _a2 ...request.Option) (*kms.DisableKeyRotationOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.DisableKeyRotationOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.DisableKeyRotationInput, ...request.Option) *kms.DisableKeyRotationOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.DisableKeyRotationOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.DisableKeyRotationInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DisableKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) DisableKeyWithContext(_a0 aws.Context, _a1 *kms.DisableKeyInput, _a2 ...request.Option) (*kms.DisableKeyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.DisableKeyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.DisableKeyInput, ...request.Option) *kms.DisableKeyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.DisableKeyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.DisableKeyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // EnableKey provides a mock function with given fields: _a0 func (_m *KMSAPI) EnableKey(_a0 *kms.EnableKeyInput) (*kms.EnableKeyOutput, error) { ret := _m.Called(_a0) @@ -586,6 +887,66 @@ func (_m *KMSAPI) EnableKeyRotationRequest(_a0 *kms.EnableKeyRotationInput) (*re return r0, r1 } +// EnableKeyRotationWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) EnableKeyRotationWithContext(_a0 aws.Context, _a1 *kms.EnableKeyRotationInput, _a2 ...request.Option) (*kms.EnableKeyRotationOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.EnableKeyRotationOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.EnableKeyRotationInput, ...request.Option) *kms.EnableKeyRotationOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.EnableKeyRotationOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.EnableKeyRotationInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EnableKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) EnableKeyWithContext(_a0 aws.Context, _a1 *kms.EnableKeyInput, _a2 ...request.Option) (*kms.EnableKeyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.EnableKeyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.EnableKeyInput, ...request.Option) *kms.EnableKeyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.EnableKeyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.EnableKeyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Encrypt provides a mock function with given fields: _a0 func (_m *KMSAPI) Encrypt(_a0 *kms.EncryptInput) (*kms.EncryptOutput, error) { ret := _m.Called(_a0) @@ -634,6 +995,36 @@ func (_m *KMSAPI) EncryptRequest(_a0 *kms.EncryptInput) (*request.Request, *kms. return r0, r1 } +// EncryptWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) EncryptWithContext(_a0 aws.Context, _a1 *kms.EncryptInput, _a2 ...request.Option) (*kms.EncryptOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.EncryptOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.EncryptInput, ...request.Option) *kms.EncryptOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.EncryptOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.EncryptInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GenerateDataKey provides a mock function with given fields: _a0 func (_m *KMSAPI) GenerateDataKey(_a0 *kms.GenerateDataKeyInput) (*kms.GenerateDataKeyOutput, error) { ret := _m.Called(_a0) @@ -682,6 +1073,36 @@ func (_m *KMSAPI) GenerateDataKeyRequest(_a0 *kms.GenerateDataKeyInput) (*reques return r0, r1 } +// GenerateDataKeyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) GenerateDataKeyWithContext(_a0 aws.Context, _a1 *kms.GenerateDataKeyInput, _a2 ...request.Option) (*kms.GenerateDataKeyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.GenerateDataKeyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.GenerateDataKeyInput, ...request.Option) *kms.GenerateDataKeyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.GenerateDataKeyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.GenerateDataKeyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GenerateDataKeyWithoutPlaintext provides a mock function with given fields: _a0 func (_m *KMSAPI) GenerateDataKeyWithoutPlaintext(_a0 *kms.GenerateDataKeyWithoutPlaintextInput) (*kms.GenerateDataKeyWithoutPlaintextOutput, error) { ret := _m.Called(_a0) @@ -730,6 +1151,36 @@ func (_m *KMSAPI) GenerateDataKeyWithoutPlaintextRequest(_a0 *kms.GenerateDataKe return r0, r1 } +// GenerateDataKeyWithoutPlaintextWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) GenerateDataKeyWithoutPlaintextWithContext(_a0 aws.Context, _a1 *kms.GenerateDataKeyWithoutPlaintextInput, _a2 ...request.Option) (*kms.GenerateDataKeyWithoutPlaintextOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.GenerateDataKeyWithoutPlaintextOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.GenerateDataKeyWithoutPlaintextInput, ...request.Option) *kms.GenerateDataKeyWithoutPlaintextOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.GenerateDataKeyWithoutPlaintextOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.GenerateDataKeyWithoutPlaintextInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GenerateRandom provides a mock function with given fields: _a0 func (_m *KMSAPI) GenerateRandom(_a0 *kms.GenerateRandomInput) (*kms.GenerateRandomOutput, error) { ret := _m.Called(_a0) @@ -778,6 +1229,36 @@ func (_m *KMSAPI) GenerateRandomRequest(_a0 *kms.GenerateRandomInput) (*request. return r0, r1 } +// GenerateRandomWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) GenerateRandomWithContext(_a0 aws.Context, _a1 *kms.GenerateRandomInput, _a2 ...request.Option) (*kms.GenerateRandomOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.GenerateRandomOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.GenerateRandomInput, ...request.Option) *kms.GenerateRandomOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.GenerateRandomOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.GenerateRandomInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetKeyPolicy provides a mock function with given fields: _a0 func (_m *KMSAPI) GetKeyPolicy(_a0 *kms.GetKeyPolicyInput) (*kms.GetKeyPolicyOutput, error) { ret := _m.Called(_a0) @@ -826,6 +1307,36 @@ func (_m *KMSAPI) GetKeyPolicyRequest(_a0 *kms.GetKeyPolicyInput) (*request.Requ return r0, r1 } +// GetKeyPolicyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) GetKeyPolicyWithContext(_a0 aws.Context, _a1 *kms.GetKeyPolicyInput, _a2 ...request.Option) (*kms.GetKeyPolicyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.GetKeyPolicyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.GetKeyPolicyInput, ...request.Option) *kms.GetKeyPolicyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.GetKeyPolicyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.GetKeyPolicyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetKeyRotationStatus provides a mock function with given fields: _a0 func (_m *KMSAPI) GetKeyRotationStatus(_a0 *kms.GetKeyRotationStatusInput) (*kms.GetKeyRotationStatusOutput, error) { ret := _m.Called(_a0) @@ -874,6 +1385,36 @@ func (_m *KMSAPI) GetKeyRotationStatusRequest(_a0 *kms.GetKeyRotationStatusInput return r0, r1 } +// GetKeyRotationStatusWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) GetKeyRotationStatusWithContext(_a0 aws.Context, _a1 *kms.GetKeyRotationStatusInput, _a2 ...request.Option) (*kms.GetKeyRotationStatusOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.GetKeyRotationStatusOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.GetKeyRotationStatusInput, ...request.Option) *kms.GetKeyRotationStatusOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.GetKeyRotationStatusOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.GetKeyRotationStatusInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetParametersForImport provides a mock function with given fields: _a0 func (_m *KMSAPI) GetParametersForImport(_a0 *kms.GetParametersForImportInput) (*kms.GetParametersForImportOutput, error) { ret := _m.Called(_a0) @@ -922,6 +1463,36 @@ func (_m *KMSAPI) GetParametersForImportRequest(_a0 *kms.GetParametersForImportI return r0, r1 } +// GetParametersForImportWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) GetParametersForImportWithContext(_a0 aws.Context, _a1 *kms.GetParametersForImportInput, _a2 ...request.Option) (*kms.GetParametersForImportOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.GetParametersForImportOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.GetParametersForImportInput, ...request.Option) *kms.GetParametersForImportOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.GetParametersForImportOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.GetParametersForImportInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ImportKeyMaterial provides a mock function with given fields: _a0 func (_m *KMSAPI) ImportKeyMaterial(_a0 *kms.ImportKeyMaterialInput) (*kms.ImportKeyMaterialOutput, error) { ret := _m.Called(_a0) @@ -970,6 +1541,36 @@ func (_m *KMSAPI) ImportKeyMaterialRequest(_a0 *kms.ImportKeyMaterialInput) (*re return r0, r1 } +// ImportKeyMaterialWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ImportKeyMaterialWithContext(_a0 aws.Context, _a1 *kms.ImportKeyMaterialInput, _a2 ...request.Option) (*kms.ImportKeyMaterialOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ImportKeyMaterialOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ImportKeyMaterialInput, ...request.Option) *kms.ImportKeyMaterialOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ImportKeyMaterialOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ImportKeyMaterialInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListAliases provides a mock function with given fields: _a0 func (_m *KMSAPI) ListAliases(_a0 *kms.ListAliasesInput) (*kms.ListAliasesOutput, error) { ret := _m.Called(_a0) @@ -1007,6 +1608,27 @@ func (_m *KMSAPI) ListAliasesPages(_a0 *kms.ListAliasesInput, _a1 func(*kms.List return r0 } +// ListAliasesPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 +func (_m *KMSAPI) ListAliasesPagesWithContext(_a0 aws.Context, _a1 *kms.ListAliasesInput, _a2 func(*kms.ListAliasesOutput, bool) bool, _a3 ...request.Option) error { + _va := make([]interface{}, len(_a3)) + for _i := range _a3 { + _va[_i] = _a3[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1, _a2) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 error + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListAliasesInput, func(*kms.ListAliasesOutput, bool) bool, ...request.Option) error); ok { + r0 = rf(_a0, _a1, _a2, _a3...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // ListAliasesRequest provides a mock function with given fields: _a0 func (_m *KMSAPI) ListAliasesRequest(_a0 *kms.ListAliasesInput) (*request.Request, *kms.ListAliasesOutput) { ret := _m.Called(_a0) @@ -1032,6 +1654,36 @@ func (_m *KMSAPI) ListAliasesRequest(_a0 *kms.ListAliasesInput) (*request.Reques return r0, r1 } +// ListAliasesWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ListAliasesWithContext(_a0 aws.Context, _a1 *kms.ListAliasesInput, _a2 ...request.Option) (*kms.ListAliasesOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ListAliasesOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListAliasesInput, ...request.Option) *kms.ListAliasesOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ListAliasesOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ListAliasesInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListGrants provides a mock function with given fields: _a0 func (_m *KMSAPI) ListGrants(_a0 *kms.ListGrantsInput) (*kms.ListGrantsResponse, error) { ret := _m.Called(_a0) @@ -1069,6 +1721,27 @@ func (_m *KMSAPI) ListGrantsPages(_a0 *kms.ListGrantsInput, _a1 func(*kms.ListGr return r0 } +// ListGrantsPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 +func (_m *KMSAPI) ListGrantsPagesWithContext(_a0 aws.Context, _a1 *kms.ListGrantsInput, _a2 func(*kms.ListGrantsResponse, bool) bool, _a3 ...request.Option) error { + _va := make([]interface{}, len(_a3)) + for _i := range _a3 { + _va[_i] = _a3[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1, _a2) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 error + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListGrantsInput, func(*kms.ListGrantsResponse, bool) bool, ...request.Option) error); ok { + r0 = rf(_a0, _a1, _a2, _a3...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // ListGrantsRequest provides a mock function with given fields: _a0 func (_m *KMSAPI) ListGrantsRequest(_a0 *kms.ListGrantsInput) (*request.Request, *kms.ListGrantsResponse) { ret := _m.Called(_a0) @@ -1094,6 +1767,36 @@ func (_m *KMSAPI) ListGrantsRequest(_a0 *kms.ListGrantsInput) (*request.Request, return r0, r1 } +// ListGrantsWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ListGrantsWithContext(_a0 aws.Context, _a1 *kms.ListGrantsInput, _a2 ...request.Option) (*kms.ListGrantsResponse, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ListGrantsResponse + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListGrantsInput, ...request.Option) *kms.ListGrantsResponse); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ListGrantsResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ListGrantsInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListKeyPolicies provides a mock function with given fields: _a0 func (_m *KMSAPI) ListKeyPolicies(_a0 *kms.ListKeyPoliciesInput) (*kms.ListKeyPoliciesOutput, error) { ret := _m.Called(_a0) @@ -1131,6 +1834,27 @@ func (_m *KMSAPI) ListKeyPoliciesPages(_a0 *kms.ListKeyPoliciesInput, _a1 func(* return r0 } +// ListKeyPoliciesPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 +func (_m *KMSAPI) ListKeyPoliciesPagesWithContext(_a0 aws.Context, _a1 *kms.ListKeyPoliciesInput, _a2 func(*kms.ListKeyPoliciesOutput, bool) bool, _a3 ...request.Option) error { + _va := make([]interface{}, len(_a3)) + for _i := range _a3 { + _va[_i] = _a3[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1, _a2) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 error + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListKeyPoliciesInput, func(*kms.ListKeyPoliciesOutput, bool) bool, ...request.Option) error); ok { + r0 = rf(_a0, _a1, _a2, _a3...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // ListKeyPoliciesRequest provides a mock function with given fields: _a0 func (_m *KMSAPI) ListKeyPoliciesRequest(_a0 *kms.ListKeyPoliciesInput) (*request.Request, *kms.ListKeyPoliciesOutput) { ret := _m.Called(_a0) @@ -1156,6 +1880,36 @@ func (_m *KMSAPI) ListKeyPoliciesRequest(_a0 *kms.ListKeyPoliciesInput) (*reques return r0, r1 } +// ListKeyPoliciesWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ListKeyPoliciesWithContext(_a0 aws.Context, _a1 *kms.ListKeyPoliciesInput, _a2 ...request.Option) (*kms.ListKeyPoliciesOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ListKeyPoliciesOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListKeyPoliciesInput, ...request.Option) *kms.ListKeyPoliciesOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ListKeyPoliciesOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ListKeyPoliciesInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListKeys provides a mock function with given fields: _a0 func (_m *KMSAPI) ListKeys(_a0 *kms.ListKeysInput) (*kms.ListKeysOutput, error) { ret := _m.Called(_a0) @@ -1193,6 +1947,27 @@ func (_m *KMSAPI) ListKeysPages(_a0 *kms.ListKeysInput, _a1 func(*kms.ListKeysOu return r0 } +// ListKeysPagesWithContext provides a mock function with given fields: _a0, _a1, _a2, _a3 +func (_m *KMSAPI) ListKeysPagesWithContext(_a0 aws.Context, _a1 *kms.ListKeysInput, _a2 func(*kms.ListKeysOutput, bool) bool, _a3 ...request.Option) error { + _va := make([]interface{}, len(_a3)) + for _i := range _a3 { + _va[_i] = _a3[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1, _a2) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 error + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListKeysInput, func(*kms.ListKeysOutput, bool) bool, ...request.Option) error); ok { + r0 = rf(_a0, _a1, _a2, _a3...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // ListKeysRequest provides a mock function with given fields: _a0 func (_m *KMSAPI) ListKeysRequest(_a0 *kms.ListKeysInput) (*request.Request, *kms.ListKeysOutput) { ret := _m.Called(_a0) @@ -1218,6 +1993,36 @@ func (_m *KMSAPI) ListKeysRequest(_a0 *kms.ListKeysInput) (*request.Request, *km return r0, r1 } +// ListKeysWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ListKeysWithContext(_a0 aws.Context, _a1 *kms.ListKeysInput, _a2 ...request.Option) (*kms.ListKeysOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ListKeysOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListKeysInput, ...request.Option) *kms.ListKeysOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ListKeysOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ListKeysInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListResourceTags provides a mock function with given fields: _a0 func (_m *KMSAPI) ListResourceTags(_a0 *kms.ListResourceTagsInput) (*kms.ListResourceTagsOutput, error) { ret := _m.Called(_a0) @@ -1266,6 +2071,36 @@ func (_m *KMSAPI) ListResourceTagsRequest(_a0 *kms.ListResourceTagsInput) (*requ return r0, r1 } +// ListResourceTagsWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ListResourceTagsWithContext(_a0 aws.Context, _a1 *kms.ListResourceTagsInput, _a2 ...request.Option) (*kms.ListResourceTagsOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ListResourceTagsOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListResourceTagsInput, ...request.Option) *kms.ListResourceTagsOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ListResourceTagsOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ListResourceTagsInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListRetirableGrants provides a mock function with given fields: _a0 func (_m *KMSAPI) ListRetirableGrants(_a0 *kms.ListRetirableGrantsInput) (*kms.ListGrantsResponse, error) { ret := _m.Called(_a0) @@ -1314,6 +2149,36 @@ func (_m *KMSAPI) ListRetirableGrantsRequest(_a0 *kms.ListRetirableGrantsInput) return r0, r1 } +// ListRetirableGrantsWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ListRetirableGrantsWithContext(_a0 aws.Context, _a1 *kms.ListRetirableGrantsInput, _a2 ...request.Option) (*kms.ListGrantsResponse, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ListGrantsResponse + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ListRetirableGrantsInput, ...request.Option) *kms.ListGrantsResponse); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ListGrantsResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ListRetirableGrantsInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // PutKeyPolicy provides a mock function with given fields: _a0 func (_m *KMSAPI) PutKeyPolicy(_a0 *kms.PutKeyPolicyInput) (*kms.PutKeyPolicyOutput, error) { ret := _m.Called(_a0) @@ -1362,6 +2227,36 @@ func (_m *KMSAPI) PutKeyPolicyRequest(_a0 *kms.PutKeyPolicyInput) (*request.Requ return r0, r1 } +// PutKeyPolicyWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) PutKeyPolicyWithContext(_a0 aws.Context, _a1 *kms.PutKeyPolicyInput, _a2 ...request.Option) (*kms.PutKeyPolicyOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.PutKeyPolicyOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.PutKeyPolicyInput, ...request.Option) *kms.PutKeyPolicyOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.PutKeyPolicyOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.PutKeyPolicyInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ReEncrypt provides a mock function with given fields: _a0 func (_m *KMSAPI) ReEncrypt(_a0 *kms.ReEncryptInput) (*kms.ReEncryptOutput, error) { ret := _m.Called(_a0) @@ -1410,6 +2305,36 @@ func (_m *KMSAPI) ReEncryptRequest(_a0 *kms.ReEncryptInput) (*request.Request, * return r0, r1 } +// ReEncryptWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ReEncryptWithContext(_a0 aws.Context, _a1 *kms.ReEncryptInput, _a2 ...request.Option) (*kms.ReEncryptOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ReEncryptOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ReEncryptInput, ...request.Option) *kms.ReEncryptOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ReEncryptOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ReEncryptInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // RetireGrant provides a mock function with given fields: _a0 func (_m *KMSAPI) RetireGrant(_a0 *kms.RetireGrantInput) (*kms.RetireGrantOutput, error) { ret := _m.Called(_a0) @@ -1458,6 +2383,36 @@ func (_m *KMSAPI) RetireGrantRequest(_a0 *kms.RetireGrantInput) (*request.Reques return r0, r1 } +// RetireGrantWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) RetireGrantWithContext(_a0 aws.Context, _a1 *kms.RetireGrantInput, _a2 ...request.Option) (*kms.RetireGrantOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.RetireGrantOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.RetireGrantInput, ...request.Option) *kms.RetireGrantOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.RetireGrantOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.RetireGrantInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // RevokeGrant provides a mock function with given fields: _a0 func (_m *KMSAPI) RevokeGrant(_a0 *kms.RevokeGrantInput) (*kms.RevokeGrantOutput, error) { ret := _m.Called(_a0) @@ -1506,6 +2461,36 @@ func (_m *KMSAPI) RevokeGrantRequest(_a0 *kms.RevokeGrantInput) (*request.Reques return r0, r1 } +// RevokeGrantWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) RevokeGrantWithContext(_a0 aws.Context, _a1 *kms.RevokeGrantInput, _a2 ...request.Option) (*kms.RevokeGrantOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.RevokeGrantOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.RevokeGrantInput, ...request.Option) *kms.RevokeGrantOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.RevokeGrantOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.RevokeGrantInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ScheduleKeyDeletion provides a mock function with given fields: _a0 func (_m *KMSAPI) ScheduleKeyDeletion(_a0 *kms.ScheduleKeyDeletionInput) (*kms.ScheduleKeyDeletionOutput, error) { ret := _m.Called(_a0) @@ -1554,6 +2539,36 @@ func (_m *KMSAPI) ScheduleKeyDeletionRequest(_a0 *kms.ScheduleKeyDeletionInput) return r0, r1 } +// ScheduleKeyDeletionWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) ScheduleKeyDeletionWithContext(_a0 aws.Context, _a1 *kms.ScheduleKeyDeletionInput, _a2 ...request.Option) (*kms.ScheduleKeyDeletionOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.ScheduleKeyDeletionOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.ScheduleKeyDeletionInput, ...request.Option) *kms.ScheduleKeyDeletionOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.ScheduleKeyDeletionOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.ScheduleKeyDeletionInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // TagResource provides a mock function with given fields: _a0 func (_m *KMSAPI) TagResource(_a0 *kms.TagResourceInput) (*kms.TagResourceOutput, error) { ret := _m.Called(_a0) @@ -1602,6 +2617,36 @@ func (_m *KMSAPI) TagResourceRequest(_a0 *kms.TagResourceInput) (*request.Reques return r0, r1 } +// TagResourceWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) TagResourceWithContext(_a0 aws.Context, _a1 *kms.TagResourceInput, _a2 ...request.Option) (*kms.TagResourceOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.TagResourceOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.TagResourceInput, ...request.Option) *kms.TagResourceOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.TagResourceOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.TagResourceInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // UntagResource provides a mock function with given fields: _a0 func (_m *KMSAPI) UntagResource(_a0 *kms.UntagResourceInput) (*kms.UntagResourceOutput, error) { ret := _m.Called(_a0) @@ -1650,6 +2695,36 @@ func (_m *KMSAPI) UntagResourceRequest(_a0 *kms.UntagResourceInput) (*request.Re return r0, r1 } +// UntagResourceWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) UntagResourceWithContext(_a0 aws.Context, _a1 *kms.UntagResourceInput, _a2 ...request.Option) (*kms.UntagResourceOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.UntagResourceOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.UntagResourceInput, ...request.Option) *kms.UntagResourceOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.UntagResourceOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.UntagResourceInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // UpdateAlias provides a mock function with given fields: _a0 func (_m *KMSAPI) UpdateAlias(_a0 *kms.UpdateAliasInput) (*kms.UpdateAliasOutput, error) { ret := _m.Called(_a0) @@ -1698,6 +2773,36 @@ func (_m *KMSAPI) UpdateAliasRequest(_a0 *kms.UpdateAliasInput) (*request.Reques return r0, r1 } +// UpdateAliasWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) UpdateAliasWithContext(_a0 aws.Context, _a1 *kms.UpdateAliasInput, _a2 ...request.Option) (*kms.UpdateAliasOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.UpdateAliasOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.UpdateAliasInput, ...request.Option) *kms.UpdateAliasOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.UpdateAliasOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.UpdateAliasInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // UpdateKeyDescription provides a mock function with given fields: _a0 func (_m *KMSAPI) UpdateKeyDescription(_a0 *kms.UpdateKeyDescriptionInput) (*kms.UpdateKeyDescriptionOutput, error) { ret := _m.Called(_a0) @@ -1746,4 +2851,32 @@ func (_m *KMSAPI) UpdateKeyDescriptionRequest(_a0 *kms.UpdateKeyDescriptionInput return r0, r1 } -var _ kmsiface.KMSAPI = (*KMSAPI)(nil) +// UpdateKeyDescriptionWithContext provides a mock function with given fields: _a0, _a1, _a2 +func (_m *KMSAPI) UpdateKeyDescriptionWithContext(_a0 aws.Context, _a1 *kms.UpdateKeyDescriptionInput, _a2 ...request.Option) (*kms.UpdateKeyDescriptionOutput, error) { + _va := make([]interface{}, len(_a2)) + for _i := range _a2 { + _va[_i] = _a2[_i] + } + var _ca []interface{} + _ca = append(_ca, _a0, _a1) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *kms.UpdateKeyDescriptionOutput + if rf, ok := ret.Get(0).(func(aws.Context, *kms.UpdateKeyDescriptionInput, ...request.Option) *kms.UpdateKeyDescriptionOutput); ok { + r0 = rf(_a0, _a1, _a2...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kms.UpdateKeyDescriptionOutput) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(aws.Context, *kms.UpdateKeyDescriptionInput, ...request.Option) error); ok { + r1 = rf(_a0, _a1, _a2...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md index b0be92383..f5a8b9db3 100644 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md @@ -1,3 +1,360 @@ +Release v1.8.19 (2017-04-28) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service waiters and paginators + * Adding back the removed waiters and paginators. + +Release v1.8.18 (2017-04-28) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service API, documentation, waiters, paginators, and examples + * API update for CloudFormation: New optional parameter ClientRequestToken which can be used as an idempotency token to safely retry certain operations as well as tagging StackEvents. +* `service/rds`: Updates service API, documentation, and examples + * The DescribeDBClusterSnapshots API now returns a SourceDBClusterSnapshotArn field which identifies the source DB cluster snapshot of a copied snapshot. +* `service/rekognition`: Updates service API + * Fix for missing file type check +* `service/snowball`: Updates service API, documentation, and paginators + * The Snowball API has a new exception that can be thrown for list operation requests. +* `service/sqs`: Updates service API, documentation, and paginators + * Adding server-side encryption (SSE) support to SQS by integrating with AWS KMS; adding new queue attributes to SQS CreateQueue, SetQueueAttributes and GetQueueAttributes APIs to support SSE. + +Release v1.8.17 (2017-04-26) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/rds`: Updates service API and documentation + * With Amazon Relational Database Service (Amazon RDS) running MySQL or Amazon Aurora, you can now authenticate to your DB instance using IAM database authentication. + +Release v1.8.16 (2017-04-21) +=== + +### Service Client Updates +* `service/appstream`: Updates service API, documentation, and paginators + * The new feature named "Default Internet Access" will enable Internet access from AppStream 2.0 instances - image builders and fleet instances. Admins will check a flag either through AWS management console for AppStream 2.0 or through API while creating an image builder or while creating/updating a fleet. +* `service/kinesis`: Updates service API, documentation, waiters, and paginators + * Adds a new waiter, StreamNotExists, to Kinesis. + +### SDK Enhancements +* `aws/endpoints`: Add utilities improving endpoints lookup (#1218) + * Adds several utilities to the endpoints packages to make looking up partitions, regions, and services easier. + * Fixes #994 + +### SDK Bugs +* `private/protocol/xml/xmlutil`: Fix unmarshaling dropping errors (#1219) + * The XML unmarshaler would drop any serialization or body read error that occurred on the floor effectively hiding any errors that would occur. + * Fixes #1205 +Release v1.8.15 (2017-04-20) +=== + +### Service Client Updates +* `service/devicefarm`: Updates service API and documentation + * API Update for AWS Device Farm: Support for Deals and Promotions +* `service/directconnect`: Updates service documentation + * Documentation updates for AWS Direct Connect. +* `service/elbv2`: Updates service waiters +* `service/kms`: Updates service documentation and examples + * Doc-only update for Key Management Service (KMS): Update docs for GrantConstraints and GenerateRandom +* `service/route53`: Updates service documentation + * Release notes: SDK documentation now includes examples for ChangeResourceRecordSets for all types of resource record set, such as weighted, alias, and failover. +* `service/route53domains`: Updates service API, documentation, and paginators + * Adding examples and other documentation updates. + +### SDK Enhancements +* `service/s3`: Add utilities to make getting a bucket's region easier (#1207) + * Adds two features which make it easier to get a bucket's region, `s3.NormalizeBucketLocation` and `s3manager.GetBucketRegion`. + +### SDK Bugs +* `service/s3`: Fix HeadObject's incorrect documented error codes (#1213) + * The HeadObject's model incorrectly states that the operation can return the NoSuchKey error code. + * Fixes #1208 + +Release v1.8.14 (2017-04-19) +=== + +### Service Client Updates +* `service/apigateway`: Updates service API and documentation + * Add support for "embed" property. +* `service/codestar`: Adds new service + * AWS CodeStar is a cloud-based service for creating, managing, and working with software development projects on AWS. An AWS CodeStar project creates and integrates AWS services for your project development toolchain. AWS CodeStar also manages the permissions required for project users. +* `service/ec2`: Updates service API and documentation + * Adds support for creating an Amazon FPGA Image (AFI) from a specified design checkpoint (DCP). +* `service/iam`: Updates service API and documentation + * This changes introduces a new IAM role type, Service Linked Role, which works like a normal role but must be managed via services' control. +* `service/lambda`: Updates service API and documentation + * Lambda integration with CloudDebugger service to enable customers to enable tracing for the Lambda functions and send trace information to the CloudDebugger service. +* `service/lexmodelbuildingservice`: Adds new service +* `service/polly`: Updates service API, documentation, and paginators + * API Update for Amazon Polly: Add support for speech marks +* `service/rekognition`: Updates service API and documentation + * Given an image, the API detects explicit or suggestive adult content in the image and returns a list of corresponding labels with confidence scores, as well as a taxonomy (parent-child relation) for each label. + +Release v1.8.13 (2017-04-18) +=== + +### Service Client Updates +* `service/lambda`: Updates service API and documentation + * You can use tags to group and filter your Lambda functions, making it easier to analyze them for billing allocation purposes. For more information, see Tagging Lambda Functions. You can now write or upgrade your Lambda functions using Python version 3.6. For more information, see Programming Model for Authoring Lambda Functions in Python. Note: Features will be rolled out in the US regions on 4/19. + +### SDK Enhancements +* `aws/request`: add support for appengine's custom standard library (#1190) + * Remove syscall error checking on appengine platforms. + +Release v1.8.12 (2017-04-11) +=== + +### Service Client Updates +* `service/apigateway`: Updates service API and documentation + * API Gateway request validators +* `service/batch`: Updates service API and documentation + * API Update for AWS Batch: Customer provided AMI for MANAGED Compute Environment +* `service/gamelift`: Updates service API and documentation + * Allows developers to utilize an improved workflow when calling our Queues API and introduces a new feature that allows developers to specify a maximum allowable latency per Queue. +* `service/opsworks`: Updates service API, documentation, and paginators + * Cloudwatch Logs agent configuration can now be attached to OpsWorks Layers using CreateLayer and UpdateLayer. OpsWorks will then automatically install and manage the CloudWatch Logs agent on the instances part of the OpsWorks Layer. + +### SDK Bugs +* `aws/client`: Fix clients polluting handler list (#1197) + * Fixes the clients potentially polluting the passed in handler list with the client's customizations. This change ensures every client always works with a clean copy of the request handlers and it cannot pollute the handlers back upstream. + * Fixes #1184 +* `aws/request`: Fix waiter error match condition (#1195) + * Fixes the waiters's matching overwriting the request's err, effectively ignoring the error condition. This broke waiters with the FailureWaiterState matcher state. +Release v1.8.11 (2017-04-07) +=== + +### Service Client Updates +* `service/redshift`: Updates service API, documentation, and paginators + * This update adds the GetClusterCredentials API which is used to get temporary login credentials to the cluster. AccountWithRestoreAccess now has a new member AccountAlias, this is the identifier of the AWS support account authorized to restore the specified snapshot. This is added to support the feature where the customer can share their snapshot with the Amazon Redshift Support Account without having to manually specify the AWS Redshift Service account ID on the AWS Console/API. + +Release v1.8.10 (2017-04-06) +=== + +### Service Client Updates +* `service/elbv2`: Updates service documentation + +Release v1.8.9 (2017-04-05) +=== + +### Service Client Updates +* `service/elasticache`: Updates service API, documentation, paginators, and examples + * ElastiCache added support for testing the Elasticache Multi-AZ feature with Automatic Failover. + +Release v1.8.8 (2017-04-04) +=== + +### Service Client Updates +* `service/cloudwatch`: Updates service API, documentation, and paginators + * Amazon Web Services announced the immediate availability of two additional alarm configuration rules for Amazon CloudWatch Alarms. The first rule is for configuring missing data treatment. Customers have the options to treat missing data as alarm threshold breached, alarm threshold not breached, maintain alarm state and the current default treatment. The second rule is for alarms based on percentiles metrics that can trigger unnecassarily if the percentile is calculated from a small number of samples. The new rule can treat percentiles with low sample counts as same as missing data. If the first rule is enabled, the same treatment will be applied when an alarm encounters a percentile with low sample counts. + +Release v1.8.7 (2017-04-03) +=== + +### Service Client Updates +* `service/lexruntimeservice`: Updates service API and documentation + * Adds support to PostContent for speech input + +### SDK Enhancements +* `aws/request`: Improve handler copy, push back, push front performance (#1171) + * Minor optimization to the handler list's handling of copying and pushing request handlers to the handler list. +* Update codegen header to use Go std wording (#1172) + * Go recently accepted the proposal for standard generated file header wording in, https://golang.org/s/generatedcode. + +### SDK Bugs +* `service/dynamodb`: Fix DynamoDB using custom retryer (#1170) + * Fixes (#1139) the DynamoDB service client clobbering any custom retryer that was passed into the service client or Session's config. +Release v1.8.6 (2017-04-01) +=== + +### Service Client Updates +* `service/clouddirectory`: Updates service API and documentation + * ListObjectAttributes now supports filtering by facet. +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.8.5 (2017-03-30) +=== + +### Service Client Updates +* `service/cloudformation`: Updates service waiters and paginators + * Adding paginators for ListExports and ListImports +* `service/cloudfront`: Adds new service + * Amazon CloudFront now supports user configurable HTTP Read and Keep-Alive Idle Timeouts for your Custom Origin Servers +* `service/configservice`: Updates service documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/resourcegroupstaggingapi`: Adds new service +* `service/storagegateway`: Updates service API and documentation + * File gateway mode in AWS Storage gateway provides access to objects in S3 as files on a Network File System (NFS) mount point. Once a file share is created, any changes made externally to the S3 bucket will not be reflected by the gateway. Using the cache refresh feature in this update, the customer can trigger an on-demand scan of the keys in their S3 bucket and refresh the file namespace cached on the gateway. It takes as an input the fileShare ARN and refreshes the cache for only that file share. Additionally there is new functionality on file gateway that allows you configure what squash options they would like on their file share, this allows a customer to configure their gateway to not squash root permissions. This can be done by setting options in NfsOptions for CreateNfsFileShare and UpdateNfsFileShare APIs. + +Release v1.8.4 (2017-03-28) +=== + +### Service Client Updates +* `service/batch`: Updates service API, documentation, and paginators + * Customers can now provide a retryStrategy as part of the RegisterJobDefinition and SubmitJob API calls. The retryStrategy object has a number value for attempts. This is the number of non successful executions before a job is considered FAILED. In addition, the JobDetail object now has an attempts field and shows all execution attempts. +* `service/ec2`: Updates service API and documentation + * Customers can now tag their Amazon EC2 Instances and Amazon EBS Volumes at + the time of their creation. You can do this from the EC2 Instance launch + wizard or through the RunInstances or CreateVolume APIs. By tagging + resources at the time of creation, you can eliminate the need to run custom + tagging scripts after resource creation. In addition, you can now set + resource-level permissions on the CreateVolume, CreateTags, DeleteTags, and + the RunInstances APIs. This allows you to implement stronger security + policies by giving you more granular control over which users and groups + have access to these APIs. You can also enforce the use of tagging and + control what tag keys and values are set on your resources. When you combine + tag usage and resource-level IAM policies together, you can ensure your + instances and volumes are properly secured upon creation and achieve more + accurate cost allocation reporting. These new features are provided at no + additional cost. + +### SDK Enhancements +* `aws/request`: Add retry support for RequestTimeoutException (#1158) + * Adds support for retrying RequestTimeoutException error code that is returned by some services. + +### SDK Bugs +* `private/model/api`: Fix Waiter and Paginators panic on nil param inputs (#1157) + * Corrects the code generation for Paginators and waiters that caused a panic if nil input parameters were used with the operations. +Release v1.8.3 (2017-03-27) +=== + +## Service Client Updates +* `service/ssm`: Updates service API, documentation, and paginators + * Updated validation rules for SendCommand and RegisterTaskWithMaintenanceWindow APIs. +Release v1.8.2 (2017-03-24) +=== + +Service Client Updates +--- +* `service/applicationautoscaling`: Updates service API, documentation, and paginators + * Application AutoScaling is launching support for a new target resource (AppStream 2.0 Fleets) as a scalable target. +* `service/cloudtrail`: Updates service API and documentation + * Doc-only Update for CloudTrail: Add required parameters for GetEventSelectors and PutEventSelectors + +Release v1.8.1 (2017-03-23) +=== + +Service Client Updates +--- +* `service/applicationdiscoveryservice`: Updates service API, documentation, and paginators + * Adds export configuration options to the AWS Discovery Service API. +* `service/elbv2`: Updates waiters +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lambda`: Updates service API and paginators + * Adds support for new runtime Node.js v6.10 for AWS Lambda service + +Release v1.8.0 (2017-03-22) +=== + +Service Client Updates +--- +* `service/codebuild`: Updates service documentation +* `service/directconnect`: Updates service API + * Deprecated DescribeConnectionLoa, DescribeInterconnectLoa, AllocateConnectionOnInterconnect and DescribeConnectionsOnInterconnect operations in favor of DescribeLoa, DescribeLoa, AllocateHostedConnection and DescribeHostedConnections respectively. +* `service/marketplacecommerceanalytics`: Updates service API, documentation, and paginators + * This update adds a new data set, us_sales_and_use_tax_records, which enables AWS Marketplace sellers to programmatically access to their U.S. Sales and Use Tax report data. +* `service/pinpoint`: Updates service API and documentation + * Amazon Pinpoint User Segmentation + * Added ability to segment endpoints by user attributes in addition to endpoint attributes. Amazon Pinpoint Event Stream Preview + * Added functionality to publish raw app analytics and campaign events data as events streams to Kinesis and Kinesis Firehose + * The feature provides developers with increased flexibility of exporting raw events to S3, Redshift, Elasticsearch using a Kinesis Firehose stream or enable real time event processing use cases using a Kinesis stream +* `service/rekognition`: Updates service documentation. + +SDK Features +--- +* `aws/request`: Add support for context.Context to SDK API operation requests (#1132) + * Adds support for context.Context to the SDK by adding `WithContext` methods for each API operation, Paginators and Waiters. e.g `PutObjectWithContext`. This change also adds the ability to provide request functional options to the method calls instead of requiring you to use the `Request` API operation method (e.g `PutObjectRequest`). + * Adds a `Complete` Request handler list that will be called ever time a request is completed. This includes both success and failure. Complete will only be called once per API operation request. + * `private/waiter` package moved from the private group to `aws/request/waiter` and made publicly available. + * Adds Context support to all API operations, Waiters(WaitUntil) and Paginators(Pages) methods. + * Adds Context support for s3manager and s3crypto clients. + +SDK Enhancements +--- +* `aws/signer/v4`: Adds support for unsigned payload signer config (#1130) + * Adds configuration option to the v4.Signer to specify the request's body should not be signed. This will only correclty function on services that support unsigned payload. e.g. S3, Glacier. + +SDK Bug Fixes +--- +* `service/s3`: Fix S3 HostID to be available in S3 request error message (#1131) + * Adds a new type s3.RequestFailure which exposes the S3 HostID value from a S3 API operation response. This is helpful when you have an error with S3, and need to contact support. Both RequestID and HostID are needed. +* `private/model/api`: Do not return a link if uid is empty (#1133) + * Fixes SDK's doc generation to not generate API reference doc links if the SDK us unable to create a valid link. +* `aws/request`: Optimization to handler list copy to prevent multiple alloc calls. (#1134) +Release v1.7.9 (2017-03-13) +=== + +Service Client Updates +--- +* `service/devicefarm`: Updates service API, documentation, paginators, and examples + * Network shaping allows users to simulate network connections and conditions while testing their Android, iOS, and web apps with AWS Device Farm. +* `service/cloudwatchevents`: Updates service API, documentation, and examples + +SDK Enhancement +=== +* `aws/session`: Add support for side loaded CA bundles (#1117) + * Adds supports for side loading Certificate Authority bundle files to the SDK using AWS_CA_BUNDLE environment variable or CustomCABundle session option. +* `service/s3/s3crypto`: Add support for AES/CBC/PKCS5Padding (#1124) + +SDK Bug +=== +* `service/rds`: Fixing issue when not providing `SourceRegion` on cross +region operations (#1127) +* `service/rds`: Enables cross region for `CopyDBClusterSnapshot` and +`CreateDBCluster` (#1128) + +Release v1.7.8 (2017-03-10) +=== + +Service Client Updates +--- +* `service/codedeploy`: Updates service paginators + * Add paginators for Codedeploy +* `service/emr`: Updates service API, documentation, and paginators + * This release includes support for instance fleets in Amazon EMR. + +Release v1.7.7 (2017-03-09) +=== + +Service Client Updates +--- +* `service/apigateway`: Updates service API, documentation, and paginators + * API Gateway has added support for ACM certificates on custom domain names. Both Amazon-issued certificates and uploaded third-part certificates are supported. +* `service/clouddirectory`: Updates service API, documentation, and paginators + * Introduces a new Cloud Directory API that enables you to retrieve all available parent paths for any type of object (a node, leaf node, policy node, and index node) in a hierarchy. + +Release v1.7.6 (2017-03-09) +=== + +Service Client Updates +--- +* `service/organizations`: Updates service documentation and examples + * Doc-only Update for Organizations: Add SDK Code Snippets +* `service/workdocs`: Adds new service + * The Administrative SDKs for Amazon WorkDocs provides full administrator level access to WorkDocs site resources, allowing developers to integrate their applications to manage WorkDocs users, content and permissions programmatically + +Release v1.7.5 (2017-03-08) +=== + +Service Client Updates +--- +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/rds`: Updates service API and documentation + * Add support to using encrypted clusters as cross-region replication masters. Update CopyDBClusterSnapshot API to support encrypted cross region copy of Aurora cluster snapshots. + +Release v1.7.4 (2017-03-06) +=== + +Service Client Updates +--- +* `service/budgets`: Updates service API and paginators + * When creating or editing a budget via the AWS Budgets API you can define notifications that are sent to subscribers when the actual or forecasted value for cost or usage exceeds the notificationThreshold associated with the budget notification object. Starting today, the maximum allowed value for the notificationThreshold was raised from 100 to 300. This change was made to give you more flexibility when setting budget notifications. +* `service/cloudtrail`: Updates service documentation and paginators + * Doc-only update for AWSCloudTrail: Updated links/descriptions +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/opsworkscm`: Updates service API, documentation, and paginators + * OpsWorks for Chef Automate has added a new field "AssociatePublicIpAddress" to the CreateServer request, "CloudFormationStackArn" to the Server model and "TERMINATED" server state. + Release v1.7.3 (2017-02-28) === diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md index e69de29bb..8a1927a39 100644 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md @@ -0,0 +1,5 @@ +### SDK Features + +### SDK Enhancements + +### SDK Bugs diff --git a/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md b/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md index 81edbfaeb..7c0186f0c 100644 --- a/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md +++ b/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md @@ -64,6 +64,11 @@ Please be aware of the following notes prior to opening a pull request: SDK's test coverage percentage are unlikely to be merged until tests have been added. +5. The JSON files under the SDK's `models` folder are sourced from outside the SDK. + Such as `models/apis/ec2/2016-11-15/api.json`. We will not accept pull requests + directly on these models. If you discover an issue with the models please + create a Github [issue](issues) describing the issue. + ### Testing To run the tests locally, running the `make unit` command will `go get` the diff --git a/vendor/github.com/aws/aws-sdk-go/Makefile b/vendor/github.com/aws/aws-sdk-go/Makefile index fc2bc0cef..e73585b78 100644 --- a/vendor/github.com/aws/aws-sdk-go/Makefile +++ b/vendor/github.com/aws/aws-sdk-go/Makefile @@ -5,6 +5,7 @@ LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)' LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be ' LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be ' LINTIGNOREDEPS='vendor/.+\.go' +LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form' UNIT_TEST_TAGS="example codegen" SDK_WITH_VENDOR_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/src") @@ -64,6 +65,9 @@ integration: get-deps-tests integ-custom smoke-tests performance integ-custom: go test -tags "integration" ./awstesting/integration/customizations/... +cleanup-integ: + go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration" + smoke-tests: get-deps-tests gucumber -go-tags "integration" ./awstesting/integration/smoke @@ -123,7 +127,7 @@ verify: get-deps-verify lint vet lint: @echo "go lint SDK and vendor packages" @lint=`if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then golint ./...; else echo "skipping golint"; fi`; \ - lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD}`; \ + lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT}`; \ echo "$$lint"; \ if [ "$$lint" != "" ] && [ "$$lint" != "skipping golint" ]; then exit 1; fi diff --git a/vendor/github.com/aws/aws-sdk-go/README.md b/vendor/github.com/aws/aws-sdk-go/README.md index 8247981b7..73031f256 100644 --- a/vendor/github.com/aws/aws-sdk-go/README.md +++ b/vendor/github.com/aws/aws-sdk-go/README.md @@ -1,11 +1,6 @@ -# AWS SDK for Go +[![API Reference](http://img.shields.io/badge/api-reference-blue.svg)](http://docs.aws.amazon.com/sdk-for-go/api) [![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) [![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt) - -[![API Reference](http://img.shields.io/badge/api-reference-blue.svg)](http://docs.aws.amazon.com/sdk-for-go/api) -[![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) -[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt) - +# AWS SDK for Go aws-sdk-go is the official AWS SDK for the Go programming language. @@ -33,6 +28,7 @@ These two processes will still include the `vendor` folder and it should be dele ## Getting Help Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests. + * Ask a question on [StackOverflow](http://stackoverflow.com/) and tag it with the [`aws-sdk-go`](http://stackoverflow.com/questions/tagged/aws-sdk-go) tag. * Come join the AWS SDK for Go community chat on [gitter](https://gitter.im/aws/aws-sdk-go). * Open a support ticket with [AWS Support](http://docs.aws.amazon.com/awssupport/latest/user/getting-started.html). @@ -40,9 +36,9 @@ Please use these community resources for getting help. We use the GitHub issues ## Opening Issues -If you encounter a bug with the AWS SDK for Go we would like to hear about it. Search the [existing issues]( https://github.com/aws/aws-sdk-go/issues) and see if others are also experiencing the issue before opening a new issue. Please include the version of AWS SDK for Go, Go language, and OS you’re using. Please also include repro case when appropriate. +If you encounter a bug with the AWS SDK for Go we would like to hear about it. Search the [existing issues](https://github.com/aws/aws-sdk-go/issues) and see if others are also experiencing the issue before opening a new issue. Please include the version of AWS SDK for Go, Go language, and OS you’re using. Please also include repro case when appropriate. -The GitHub issues are intended for bug reports and feature requests. For help and questions with using AWS SDK for GO please make use of the resources listed in the [Getting Help]( https://github.com/aws/aws-sdk-go#getting-help) section. Keeping the list of open issues lean will help us respond in a timely manner. +The GitHub issues are intended for bug reports and feature requests. For help and questions with using AWS SDK for GO please make use of the resources listed in the [Getting Help](https://github.com/aws/aws-sdk-go#getting-help) section. Keeping the list of open issues lean will help us respond in a timely manner. ## Reference Documentation @@ -54,80 +50,397 @@ The GitHub issues are intended for bug reports and feature requests. For help an [`SDK Examples`](https://github.com/aws/aws-sdk-go/tree/master/example) - Included in the SDK's repo are a several hand crafted examples using the SDK features and AWS services. -## Configuring Credentials +## Overview of SDK's Packages + +The SDK is composed of two main components, SDK core, and service clients. +The SDK core packages are all available under the aws package at the root of +the SDK. Each client for a supported AWS service is available within its own +package under the service folder at the root of the SDK. + + * aws - SDK core, provides common shared types such as Config, Logger, + and utilities to make working with API parameters easier. + + * awserr - Provides the error interface that the SDK will use for all + errors that occur in the SDK's processing. This includes service API + response errors as well. The Error type is made up of a code and message. + Cast the SDK's returned error type to awserr.Error and call the Code + method to compare returned error to specific error codes. See the package's + documentation for additional values that can be extracted such as RequestID. + + * credentials - Provides the types and built in credentials providers + the SDK will use to retrieve AWS credentials to make API requests with. + Nested under this folder are also additional credentials providers such as + stscreds for assuming IAM roles, and ec2rolecreds for EC2 Instance roles. + + * endpoints - Provides the AWS Regions and Endpoints metadata for the SDK. + Use this to lookup AWS service endpoint information such as which services + are in a region, and what regions a service is in. Constants are also provided + for all region identifiers, e.g UsWest2RegionID for "us-west-2". + + * session - Provides initial default configuration, and load + configuration from external sources such as environment and shared + credentials file. + + * request - Provides the API request sending, and retry logic for the SDK. + This package also includes utilities for defining your own request + retryer, and configuring how the SDK processes the request. + + * service - Clients for AWS services. All services supported by the SDK are + available under this folder. + +## How to Use the SDK's AWS Service Clients + +The SDK includes the Go types and utilities you can use to make requests to +AWS service APIs. Within the service folder at the root of the SDK you'll find +a package for each AWS service the SDK supports. All service clients follows +a common pattern of creation and usage. + +When creating a client for an AWS service you'll first need to have a Session +value constructed. The Session provides shared configuration that can be shared +between your service clients. When service clients are created you can pass +in additional configuration via the aws.Config type to override configuration +provided by in the Session to create service client instances with custom +configuration. + +Once the service's client is created you can use it to make API requests the +AWS service. These clients are safe to use concurrently. + +## Configuring the SDK + +In the AWS SDK for Go, you can configure settings for service clients, such +as the log level and maximum number of retries. Most settings are optional; +however, for each service client, you must specify a region and your credentials. +The SDK uses these values to send requests to the correct AWS region and sign +requests with the correct credentials. You can specify these values as part +of a session or as environment variables. -Before using the SDK, ensure that you've configured credentials. The best -way to configure credentials on a development machine is to use the -`~/.aws/credentials` file, which might look like: +See the SDK's [configuration guide][config_guide] for more information. +See the [session][session_pkg] package documentation for more information on how to use Session +with the SDK. + +See the [Config][config_typ] type in the [aws][aws_pkg] package for more information on configuration +options. + +[config_guide]: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html +[session_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ +[config_typ]: https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +[aws_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/ + +### Configuring Credentials + +When using the SDK you'll generally need your AWS credentials to authenticate +with AWS services. The SDK supports multiple methods of supporting these +credentials. By default the SDK will source credentials automatically from +its default credential chain. See the session package for more information +on this chain, and how to configure it. The common items in the credential +chain are the following: + + * Environment Credentials - Set of environment variables that are useful + when sub processes are created for specific roles. + + * Shared Credentials file (~/.aws/credentials) - This file stores your + credentials based on a profile name and is useful for local development. + + * EC2 Instance Role Credentials - Use EC2 Instance Role to assign credentials + to application running on an EC2 instance. This removes the need to manage + credential files in production. + +Credentials can be configured in code as well by setting the Config's Credentials +value to a custom provider or using one of the providers included with the +SDK to bypass the default credential chain and use a custom one. This is +helpful when you want to instruct the SDK to only use a specific set of +credentials or providers. + +This example creates a credential provider for assuming an IAM role, "myRoleARN" +and configures the S3 service client to use that role for API requests. + +```go + // Initial credentials loaded from SDK's default credential chain. Such as + // the environment, shared credentials (~/.aws/credentials), or EC2 Instance + // Role. These credentials will be used to to make the STS Assume Role API. + sess := session.Must(session.NewSession()) + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. + creds := stscreds.NewCredentials(sess, "myRoleArn") + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds})/ ``` -[default] -aws_access_key_id = AKID1234567890 -aws_secret_access_key = MY-SECRET-KEY + +See the [credentials][credentials_pkg] package documentation for more information on credential +providers included with the SDK, and how to customize the SDK's usage of +credentials. + +The SDK has support for the shared configuration file (~/.aws/config). This +support can be enabled by setting the environment variable, "AWS_SDK_LOAD_CONFIG=1", +or enabling the feature in code when creating a Session via the +Option's SharedConfigState parameter. + +```go + sess := session.Must(session.NewSessionWithOptions(session.Options{ + SharedConfigState: session.SharedConfigEnable, + })) ``` -You can learn more about the credentials file from this -[blog post](http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs). +[credentials_pkg]: ttps://docs.aws.amazon.com/sdk-for-go/api/aws/credentials + +### Configuring AWS Region -Alternatively, you can set the following environment variables: +In addition to the credentials you'll need to specify the region the SDK +will use to make AWS API requests to. In the SDK you can specify the region +either with an environment variable, or directly in code when a Session or +service client is created. The last value specified in code wins if the region +is specified multiple ways. +To set the region via the environment variable set the "AWS_REGION" to the +region you want to the SDK to use. Using this method to set the region will +allow you to run your application in multiple regions without needing additional +code in the application to select the region. + + AWS_REGION=us-west-2 + +The endpoints package includes constants for all regions the SDK knows. The +values are all suffixed with RegionID. These values are helpful, because they +reduce the need to type the region string manually. + +To set the region on a Session use the aws package's Config struct parameter +Region to the AWS region you want the service clients created from the session to +use. This is helpful when you want to create multiple service clients, and +all of the clients make API requests to the same region. + +```go + sess := session.Must(session.NewSession(&aws.Config{ + Region: aws.String(endpoints.UsWest2RegionID), + })) +``` + +See the [endpoints][endpoints_pkg] package for the AWS Regions and Endpoints metadata. + +In addition to setting the region when creating a Session you can also set +the region on a per service client bases. This overrides the region of a +Session. This is helpful when you want to create service clients in specific +regions different from the Session's region. + +```go + svc := s3.New(sess, &aws.Config{ + Region: aws.String(ednpoints.UsWest2RegionID), + }) ``` -AWS_ACCESS_KEY_ID=AKID1234567890 -AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY + +See the [Config][config_typ] type in the [aws][aws_pkg] package for more information and additional +options such as setting the Endpoint, and other service client configuration options. + +[endpoints_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/endpoints/ + +## Making API Requests + +Once the client is created you can make an API request to the service. +Each API method takes a input parameter, and returns the service response +and an error. The SDK provides methods for making the API call in multiple ways. + +In this list we'll use the S3 ListObjects API as an example for the different +ways of making API requests. + + * ListObjects - Base API operation that will make the API request to the service. + + * ListObjectsRequest - API methods suffixed with Request will construct the + API request, but not send it. This is also helpful when you want to get a + presigned URL for a request, and share the presigned URL instead of your + application making the request directly. + + * ListObjectsPages - Same as the base API operation, but uses a callback to + automatically handle pagination of the API's response. + + * ListObjectsWithContext - Same as base API operation, but adds support for + the Context pattern. This is helpful for controlling the canceling of in + flight requests. See the Go standard library context package for more + information. This method also takes request package's Option functional + options as the variadic argument for modifying how the request will be + made, or extracting information from the raw HTTP response. + + * ListObjectsPagesWithContext - same as ListObjectsPages, but adds support for + the Context pattern. Similar to ListObjectsWithContext this method also + takes the request package's Option function option types as the variadic + argument. + +In addition to the API operations the SDK also includes several higher level +methods that abstract checking for and waiting for an AWS resource to be in +a desired state. In this list we'll use WaitUntilBucketExists to demonstrate +the different forms of waiters. + + * WaitUntilBucketExists. - Method to make API request to query an AWS service for + a resource's state. Will return successfully when that state is accomplished. + + * WaitUntilBucketExistsWithContext - Same as WaitUntilBucketExists, but adds + support for the Context pattern. In addition these methods take request + package's WaiterOptions to configure the waiter, and how underlying request + will be made by the SDK. + +The API method will document which error codes the service might return for +the operation. These errors will also be available as const strings prefixed +with "ErrCode" in the service client's package. If there are no errors listed +in the API's SDK documentation you'll need to consult the AWS service's API +documentation for the errors that could be returned. + +```go + ctx := context.Background() + + result, err := svc.GetObjectWithContext(ctx, &s3.GetObjectInput{ + Bucket: aws.String("my-bucket"), + Key: aws.String("my-key"), + }) + if err != nil { + // Cast err to awserr.Error to handle specific error codes. + aerr, ok := err.(awserr.Error) + if ok && aerr.Code() == s3.ErrCodeNoSuchKey { + // Specific error code handling + } + return err + } + + // Make sure to close the body when done with it for S3 GetObject APIs or + // will leak connections. + defer result.Body.Close() + + fmt.Println("Object Size:", aws.StringValue(result.ContentLength)) ``` -### 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. +### API Request Pagination and Resource Waiters -## Using the Go SDK +Pagination helper methods are suffixed with "Pages", and provide the +functionality needed to round trip API page requests. Pagination methods +take a callback function that will be called for each page of the API's response. -To use a service in the SDK, create a service variable by calling the `New()` -function. Once you have a service client, you can call API operations which each -return response data and a possible error. +```go + objects := []string{} + err := svc.ListObjectsPagesWithContext(ctx, &s3.ListObjectsInput{ + Bucket: aws.String(myBucket), + }, func(p *s3.ListObjectsOutput, lastPage bool) bool { + for _, o := range p.Contents { + objects = append(objects, aws.StringValue(o.Key)) + } + return true // continue paging + }) + if err != nil { + panic(fmt.Sprintf("failed to list objects for bucket, %s, %v", myBucket, err)) + } + + fmt.Println("Objects in bucket:", objects) +``` -To list a set of instance IDs from EC2, you could run: +Waiter helper methods provide the functionality to wait for an AWS resource +state. These methods abstract the logic needed to to check the state of an +AWS resource, and wait until that resource is in a desired state. The waiter +will block until the resource is in the state that is desired, an error occurs, +or the waiter times out. If a resource times out the error code returned will +be request.WaiterResourceNotReadyErrorCode. ```go -package main - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ec2" -) - -func main() { - sess, err := session.NewSession() - if err != nil { - panic(err) - } - - // Create an EC2 service object in the "us-west-2" region - // Note that you can also configure your region globally by - // exporting the AWS_REGION environment variable - svc := ec2.New(sess, &aws.Config{Region: aws.String("us-west-2")}) - - // Call the DescribeInstances Operation - resp, err := svc.DescribeInstances(nil) - if err != nil { - panic(err) - } - - // resp has all of the response data, pull out instance IDs: - fmt.Println("> Number of reservation sets: ", len(resp.Reservations)) - for idx, res := range resp.Reservations { - fmt.Println(" > Number of instances: ", len(res.Instances)) - for _, inst := range resp.Reservations[idx].Instances { - fmt.Println(" - Instance ID: ", *inst.InstanceId) - } - } -} + err := svc.WaitUntilBucketExistsWithContext(ctx, &s3.HeadBucketInput{ + Bucket: aws.String(myBucket), + }) + if err != nil { + aerr, ok := err.(awserr.Error) + if ok && aerr.Code() == request.WaiterResourceNotReadyErrorCode { + fmt.Fprintf(os.Stderr, "timed out while waiting for bucket to exist") + } + panic(fmt.Errorf("failed to wait for bucket to exist, %v", err)) + } + fmt.Println("Bucket", myBucket, "exists") ``` -You can find more information and operations in our -[API documentation](http://docs.aws.amazon.com/sdk-for-go/api/). +## Complete SDK Example + +This example shows a complete working Go file which will upload a file to S3 +and use the Context pattern to implement timeout logic that will cancel the +request if it takes too long. This example highlights how to use sessions, +create a service client, make a request, handle the error, and process the +response. + +```go + package main + + import ( + "context" + "flag" + "fmt" + "os" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" + ) + + // Uploads a file to S3 given a bucket and object key. Also takes a duration + // value to terminate the update if it doesn't complete within that time. + // + // The AWS Region needs to be provided in the AWS shared config or on the + // environment variable as `AWS_REGION`. Credentials also must be provided + // Will default to shared config file, but can load from environment if provided. + // + // Usage: + // # Upload myfile.txt to myBucket/myKey. Must complete within 10 minutes or will fail + // go run withContext.go -b mybucket -k myKey -d 10m < myfile.txt + func main() { + var bucket, key string + var timeout time.Duration + + flag.StringVar(&bucket, "b", "", "Bucket name.") + flag.StringVar(&key, "k", "", "Object key name.") + flag.DurationVar(&timeout, "d", 0, "Upload timeout.") + flag.Parse() + + // All clients require a Session. The Session provides the client with + // shared configuration such as region, endpoint, and credentials. A + // Session should be shared where possible to take advantage of + // configuration and credential caching. See the session package for + // more information. + sess := session.Must(session.NewSession()) + + // Create a new instance of the service's client with a Session. + // Optional aws.Config values can also be provided as variadic arguments + // to the New function. This option allows you to provide service + // specific configuration. + svc := s3.New(sess) + + // Create a context with a timeout that will abort the upload if it takes + // more than the passed in timeout. + ctx := context.Background() + var cancelFn func() + if timeout > 0 { + ctx, cancelFn = context.WithTimeout(ctx, timeout) + } + // Ensure the context is canceled to prevent leaking. + // See context package for more information, https://golang.org/pkg/context/ + defer cancelFn() + + // Uploads the object to S3. The Context will interrupt the request if the + // timeout expires. + _, err := svc.PutObjectWithContext(ctx, &s3.PutObjectInput{ + Bucket: aws.String(bucket), + Key: aws.String(key), + Body: os.Stdin, + }) + if err != nil { + if aerr, ok := err.(awserr.Error); ok && aerr.Code() == request.CanceledErrorCode { + // If the SDK can determine the request or retry delay was canceled + // by a context the CanceledErrorCode error code will be returned. + fmt.Fprintf(os.Stderr, "upload canceled due to timeout, %v\n", err) + } else { + fmt.Fprintf(os.Stderr, "failed to upload object, %v\n", err) + } + os.Exit(1) + } + + fmt.Printf("successfully uploaded file to %s/%s\n", bucket, key) + } +``` ## License diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go index 17fc76a0f..48b0fbd93 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 @@ -5,6 +5,7 @@ import ( "net/http/httputil" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" ) @@ -46,7 +47,7 @@ func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, op svc := &Client{ Config: cfg, ClientInfo: info, - Handlers: handlers, + Handlers: handlers.Copy(), } switch retryer, ok := cfg.Retryer.(request.Retryer); { @@ -86,8 +87,8 @@ func (c *Client) AddDebugHandlers() { return } - c.Handlers.Send.PushFront(logRequest) - c.Handlers.Send.PushBack(logResponse) + c.Handlers.Send.PushFrontNamed(request.NamedHandler{Name: "awssdk.client.LogRequest", Fn: logRequest}) + c.Handlers.Send.PushBackNamed(request.NamedHandler{Name: "awssdk.client.LogResponse", Fn: logResponse}) } const logReqMsg = `DEBUG: Request %s/%s Details: @@ -105,6 +106,7 @@ func logRequest(r *request.Request) { dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) if err != nil { r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) + r.Error = awserr.New(request.ErrCodeRead, "an error occurred during request body reading", err) return } @@ -135,6 +137,7 @@ func logResponse(r *request.Request) { dumpedBody, err := httputil.DumpResponse(r.HTTPResponse, logBody) if err != nil { r.Config.Logger.Log(fmt.Sprintf(logRespErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) + r.Error = awserr.New(request.ErrCodeRead, "an error occurred during response body reading", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go new file mode 100644 index 000000000..30d3b9997 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go @@ -0,0 +1,78 @@ +package client + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" +) + +func pushBackTestHandler(name string, list *request.HandlerList) *bool { + called := false + (*list).PushBackNamed(request.NamedHandler{ + Name: name, + Fn: func(r *request.Request) { + called = true + }, + }) + + return &called +} + +func pushFrontTestHandler(name string, list *request.HandlerList) *bool { + called := false + (*list).PushFrontNamed(request.NamedHandler{ + Name: name, + Fn: func(r *request.Request) { + called = true + }, + }) + + return &called +} + +func TestNewClient_CopyHandlers(t *testing.T) { + handlers := request.Handlers{} + firstCalled := pushBackTestHandler("first", &handlers.Send) + secondCalled := pushBackTestHandler("second", &handlers.Send) + + var clientHandlerCalled *bool + c := New(aws.Config{}, metadata.ClientInfo{}, handlers, + func(c *Client) { + clientHandlerCalled = pushFrontTestHandler("client handler", &c.Handlers.Send) + }, + ) + + if e, a := 2, handlers.Send.Len(); e != a { + t.Errorf("expect %d original handlers, got %d", e, a) + } + if e, a := 3, c.Handlers.Send.Len(); e != a { + t.Errorf("expect %d client handlers, got %d", e, a) + } + + handlers.Send.Run(nil) + if !*firstCalled { + t.Errorf("expect first handler to of been called") + } + *firstCalled = false + if !*secondCalled { + t.Errorf("expect second handler to of been called") + } + *secondCalled = false + if *clientHandlerCalled { + t.Errorf("expect client handler to not of been called, but was") + } + + c.Handlers.Send.Run(nil) + if !*firstCalled { + t.Errorf("expect client's first handler to of been called") + } + if !*secondCalled { + t.Errorf("expect client's second handler to of been called") + } + if !*clientHandlerCalled { + t.Errorf("expect client's client handler to of been called") + } + +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index 43a3676b7..1313478f2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -54,6 +54,12 @@ func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { // ShouldRetry returns true if the request should be retried. func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { + // If one of the other handlers already set the retry state + // we don't want to override it based on the service's state + if r.Retryable != nil { + return *r.Retryable + } + if r.HTTPResponse.StatusCode >= 500 { return true } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index f5a7c3792..d1f31f1c6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -53,6 +53,13 @@ type Config struct { // to use based on region. EndpointResolver endpoints.Resolver + // EnforceShouldRetryCheck is used in the AfterRetryHandler to always call + // ShouldRetry regardless of whether or not if request.Retryable is set. + // This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck + // is not set, then ShouldRetry will only be called if request.Retryable is nil. + // Proper handling of the request.Retryable field is important when setting this field. + EnforceShouldRetryCheck *bool + // The region to send requests to. This parameter is required and must // be configured globally or on a per-client basis unless otherwise // noted. A full list of regions is found in the "Regions and Endpoints" @@ -187,6 +194,10 @@ type Config struct { // request delays. This value should only be used for testing. To adjust // the delay of a request see the aws/client.DefaultRetryer and // aws/request.Retryer. + // + // SleepDelay will prevent any Context from being used for canceling retry + // delay of an API operation. It is recommended to not use SleepDelay at all + // and specify a Retryer instead. SleepDelay func(time.Duration) // DisableRestProtocolURICleaning will not clean the URL path when making rest protocol requests. @@ -439,6 +450,10 @@ func mergeInConfig(dst *Config, other *Config) { if other.DisableRestProtocolURICleaning != nil { dst.DisableRestProtocolURICleaning = other.DisableRestProtocolURICleaning } + + if other.EnforceShouldRetryCheck != nil { + dst.EnforceShouldRetryCheck = other.EnforceShouldRetryCheck + } } // Copy will return a shallow copy of the Config object. If any additional diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context.go b/vendor/github.com/aws/aws-sdk-go/aws/context.go new file mode 100644 index 000000000..79f426853 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context.go @@ -0,0 +1,71 @@ +package aws + +import ( + "time" +) + +// Context is an copy of the Go v1.7 stdlib's context.Context interface. +// It is represented as a SDK interface to enable you to use the "WithContext" +// API methods with Go v1.6 and a Context type such as golang.org/x/net/context. +// +// See https://golang.org/pkg/context on how to use contexts. +type Context interface { + // Deadline returns the time when work done on behalf of this context + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. + Deadline() (deadline time.Time, ok bool) + + // Done returns a channel that's closed when work done on behalf of this + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. + Done() <-chan struct{} + + // Err returns a non-nil error value after Done is closed. Err returns + // Canceled if the context was canceled or DeadlineExceeded if the + // context's deadline passed. No other values for Err are defined. + // After Done is closed, successive calls to Err return the same value. + Err() error + + // Value returns the value associated with this context for key, or nil + // if no value is associated with key. Successive calls to Value with + // the same key returns the same result. + // + // Use context values only for request-scoped data that transits + // processes and API boundaries, not for passing optional parameters to + // functions. + Value(key interface{}) interface{} +} + +// BackgroundContext returns a context that will never be canceled, has no +// values, and no deadline. This context is used by the SDK to provide +// backwards compatibility with non-context API operations and functionality. +// +// Go 1.6 and before: +// This context function is equivalent to context.Background in the Go stdlib. +// +// Go 1.7 and later: +// The context returned will be the value returned by context.Background() +// +// See https://golang.org/pkg/context for more information on Contexts. +func BackgroundContext() Context { + return backgroundCtx +} + +// SleepWithContext will wait for the timer duration to expire, or the context +// is canceled. Which ever happens first. If the context is canceled the Context's +// error will be returned. +// +// Expects Context to always return a non-nil error if the Done channel is closed. +func SleepWithContext(ctx Context, dur time.Duration) error { + t := time.NewTimer(dur) + defer t.Stop() + + select { + case <-t.C: + break + case <-ctx.Done(): + return ctx.Err() + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go new file mode 100644 index 000000000..e8cf93d26 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go @@ -0,0 +1,41 @@ +// +build !go1.7 + +package aws + +import "time" + +// An emptyCtx is a copy of the the Go 1.7 context.emptyCtx type. This +// is copied to provide a 1.6 and 1.5 safe version of context that is compatible +// with Go 1.7's Context. +// +// An emptyCtx is never canceled, has no values, and has no deadline. It is not +// struct{}, since vars of this type must have distinct addresses. +type emptyCtx int + +func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { + return +} + +func (*emptyCtx) Done() <-chan struct{} { + return nil +} + +func (*emptyCtx) Err() error { + return nil +} + +func (*emptyCtx) Value(key interface{}) interface{} { + return nil +} + +func (e *emptyCtx) String() string { + switch e { + case backgroundCtx: + return "aws.BackgroundContext" + } + return "unknown empty Context" +} + +var ( + backgroundCtx = new(emptyCtx) +) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go new file mode 100644 index 000000000..064f75c92 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go @@ -0,0 +1,9 @@ +// +build go1.7 + +package aws + +import "context" + +var ( + backgroundCtx = context.Background() +) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_test.go b/vendor/github.com/aws/aws-sdk-go/aws/context_test.go new file mode 100644 index 000000000..d80a1bb6d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_test.go @@ -0,0 +1,37 @@ +package aws_test + +import ( + "fmt" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/awstesting" +) + +func TestSleepWithContext(t *testing.T) { + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + + err := aws.SleepWithContext(ctx, 1*time.Millisecond) + if err != nil { + t.Errorf("expect context to not be canceled, got %v", err) + } +} + +func TestSleepWithContext_Canceled(t *testing.T) { + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + + expectErr := fmt.Errorf("context canceled") + + ctx.Error = expectErr + close(ctx.DoneCh) + + err := aws.SleepWithContext(ctx, 1*time.Millisecond) + if err == nil { + t.Fatalf("expect error, did not get one") + } + + if e, a := expectErr, err; e != a { + t.Errorf("expect %v error, got %v", e, a) + } +} 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 8a7bafc78..25b461c31 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -27,7 +27,7 @@ type lener interface { // or will use the HTTPRequest.Header's "Content-Length" if defined. If unable // to determine request body length and no "Content-Length" was specified it will panic. // -// The Content-Length will only be aded to the request if the length of the body +// The Content-Length will only be added to the request if the length of the body // is greater than 0. If the body is empty or the current `Content-Length` // header is <= 0, the header will also be stripped. var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *request.Request) { @@ -71,8 +71,8 @@ var reStatusCode = regexp.MustCompile(`^(\d{3})`) // ValidateReqSigHandler is a request handler to ensure that the request's // signature doesn't expire before it is sent. This can happen when a request -// is built and signed signficantly before it is sent. Or significant delays -// occur whne retrying requests that would cause the signature to expire. +// is built and signed significantly before it is sent. Or significant delays +// occur when retrying requests that would cause the signature to expire. var ValidateReqSigHandler = request.NamedHandler{ Name: "core.ValidateReqSigHandler", Fn: func(r *request.Request) { @@ -98,44 +98,79 @@ var ValidateReqSigHandler = request.NamedHandler{ } // SendHandler is a request handler to send service request using HTTP client. -var SendHandler = request.NamedHandler{Name: "core.SendHandler", Fn: func(r *request.Request) { - var err error - r.HTTPResponse, err = r.Config.HTTPClient.Do(r.HTTPRequest) - if err != nil { - // Prevent leaking if an HTTPResponse was returned. Clean up - // the body. - if r.HTTPResponse != nil { - r.HTTPResponse.Body.Close() +var SendHandler = request.NamedHandler{ + Name: "core.SendHandler", + Fn: func(r *request.Request) { + sender := sendFollowRedirects + if r.DisableFollowRedirects { + sender = sendWithoutFollowRedirects } - // Capture the case where url.Error is returned for error processing - // response. e.g. 301 without location header comes back as string - // error and r.HTTPResponse is nil. Other url redirect errors will - // comeback in a similar method. - if e, ok := err.(*url.Error); ok && e.Err != nil { - if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { - code, _ := strconv.ParseInt(s[1], 10, 64) - r.HTTPResponse = &http.Response{ - StatusCode: int(code), - Status: http.StatusText(int(code)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - return - } + + var err error + r.HTTPResponse, err = sender(r) + if err != nil { + handleSendError(r, err) } - if r.HTTPResponse == nil { - // Add a dummy request response object to ensure the HTTPResponse - // value is consistent. + }, +} + +func sendFollowRedirects(r *request.Request) (*http.Response, error) { + return r.Config.HTTPClient.Do(r.HTTPRequest) +} + +func sendWithoutFollowRedirects(r *request.Request) (*http.Response, error) { + transport := r.Config.HTTPClient.Transport + if transport == nil { + transport = http.DefaultTransport + } + + return transport.RoundTrip(r.HTTPRequest) +} + +func handleSendError(r *request.Request, err error) { + // Prevent leaking if an HTTPResponse was returned. Clean up + // the body. + if r.HTTPResponse != nil { + r.HTTPResponse.Body.Close() + } + // Capture the case where url.Error is returned for error processing + // response. e.g. 301 without location header comes back as string + // error and r.HTTPResponse is nil. Other URL redirect errors will + // comeback in a similar method. + if e, ok := err.(*url.Error); ok && e.Err != nil { + if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { + code, _ := strconv.ParseInt(s[1], 10, 64) r.HTTPResponse = &http.Response{ - StatusCode: int(0), - Status: http.StatusText(int(0)), + StatusCode: int(code), + Status: http.StatusText(int(code)), Body: ioutil.NopCloser(bytes.NewReader([]byte{})), } + return } - // Catch all other request errors. - r.Error = awserr.New("RequestError", "send request failed", err) - r.Retryable = aws.Bool(true) // network errors are retryable } -}} + if r.HTTPResponse == nil { + // Add a dummy request response object to ensure the HTTPResponse + // value is consistent. + r.HTTPResponse = &http.Response{ + StatusCode: int(0), + Status: http.StatusText(int(0)), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + } + // Catch all other request errors. + r.Error = awserr.New("RequestError", "send request failed", err) + r.Retryable = aws.Bool(true) // network errors are retryable + + // Override the error with a context canceled error, if that was canceled. + ctx := r.Context() + select { + case <-ctx.Done(): + r.Error = awserr.New(request.CanceledErrorCode, + "request context canceled", ctx.Err()) + r.Retryable = aws.Bool(false) + default: + } +} // ValidateResponseHandler is a request handler to validate service response. var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseHandler", Fn: func(r *request.Request) { @@ -150,13 +185,22 @@ var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseH var AfterRetryHandler = request.NamedHandler{Name: "core.AfterRetryHandler", Fn: func(r *request.Request) { // If one of the other handlers already set the retry state // we don't want to override it based on the service's state - if r.Retryable == nil { + if r.Retryable == nil || aws.BoolValue(r.Config.EnforceShouldRetryCheck) { r.Retryable = aws.Bool(r.ShouldRetry(r)) } if r.WillRetry() { r.RetryDelay = r.RetryRules(r) - r.Config.SleepDelay(r.RetryDelay) + + if sleepFn := r.Config.SleepDelay; sleepFn != nil { + // Support SleepDelay for backwards compatibility and testing + sleepFn(r.RetryDelay) + } else if err := aws.SleepWithContext(r.Context(), r.RetryDelay); err != nil { + r.Error = awserr.New(request.CanceledErrorCode, + "request context canceled", err) + r.Retryable = aws.Bool(false) + return + } // when the expired token exception occurs the credentials // need to be expired locally so that the next request to 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 799285198..fe7d3c9bc 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 @@ -96,6 +96,94 @@ func TestAfterRetryRefreshCreds(t *testing.T) { assert.True(t, credProvider.retrieveCalled) } +func TestAfterRetryWithContextCanceled(t *testing.T) { + c := awstesting.NewClient() + + req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)} + req.SetContext(ctx) + + req.Error = fmt.Errorf("some error") + req.Retryable = aws.Bool(true) + req.HTTPResponse = &http.Response{ + StatusCode: 500, + } + + close(ctx.DoneCh) + ctx.Error = fmt.Errorf("context canceled") + + corehandlers.AfterRetryHandler.Fn(req) + + if req.Error == nil { + t.Fatalf("expect error but didn't receive one") + } + + aerr := req.Error.(awserr.Error) + + if e, a := request.CanceledErrorCode, aerr.Code(); e != a { + t.Errorf("expect %q, error code got %q", e, a) + } +} + +func TestAfterRetryWithContext(t *testing.T) { + c := awstesting.NewClient() + + req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)} + req.SetContext(ctx) + + req.Error = fmt.Errorf("some error") + req.Retryable = aws.Bool(true) + req.HTTPResponse = &http.Response{ + StatusCode: 500, + } + + corehandlers.AfterRetryHandler.Fn(req) + + if req.Error != nil { + t.Fatalf("expect no error, got %v", req.Error) + } + if e, a := 1, req.RetryCount; e != a { + t.Errorf("expect retry count to be %d, got %d", e, a) + } +} + +func TestSendWithContextCanceled(t *testing.T) { + c := awstesting.NewClient(&aws.Config{ + SleepDelay: func(dur time.Duration) { + t.Errorf("SleepDelay should not be called") + }, + }) + + req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)} + req.SetContext(ctx) + + req.Error = fmt.Errorf("some error") + req.Retryable = aws.Bool(true) + req.HTTPResponse = &http.Response{ + StatusCode: 500, + } + + close(ctx.DoneCh) + ctx.Error = fmt.Errorf("context canceled") + + corehandlers.SendHandler.Fn(req) + + if req.Error == nil { + t.Fatalf("expect error but didn't receive one") + } + + aerr := req.Error.(awserr.Error) + + if e, a := request.CanceledErrorCode, aerr.Code(); e != a { + t.Errorf("expect %q, error code got %q", e, a) + } +} + type testSendHandlerTransport struct{} func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, error) { @@ -118,6 +206,39 @@ func TestSendHandlerError(t *testing.T) { assert.NotNil(t, r.HTTPResponse) } +func TestSendWithoutFollowRedirects(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/original": + w.Header().Set("Location", "/redirected") + w.WriteHeader(301) + case "/redirected": + t.Fatalf("expect not to redirect, but was") + } + })) + + svc := awstesting.NewClient(&aws.Config{ + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL), + }) + svc.Handlers.Clear() + svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) + + r := svc.NewRequest(&request.Operation{ + Name: "Operation", + HTTPPath: "/original", + }, nil, nil) + r.DisableFollowRedirects = true + + err := r.Send() + if err != nil { + t.Errorf("expect no error, got %v", err) + } + if e, a := 301, r.HTTPResponse.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } +} + func TestValidateReqSigHandler(t *testing.T) { cases := []struct { Req *request.Request diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go index 6efc77bf0..f298d6596 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go @@ -13,7 +13,7 @@ var ( // // @readonly ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", - `no valid providers in chain. Deprecated. + `no valid providers in chain. Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, nil) ) @@ -39,16 +39,18 @@ var ( // does not return any credentials ChainProvider will return the error // ErrNoValidProvidersFoundInChain // -// creds := NewChainCredentials( -// []Provider{ -// &EnvProvider{}, -// &EC2RoleProvider{ +// creds := credentials.NewChainCredentials( +// []credentials.Provider{ +// &credentials.EnvProvider{}, +// &ec2rolecreds.EC2RoleProvider{ // Client: ec2metadata.New(sess), // }, // }) // // // Usage of ChainCredentials with aws.Config -// svc := ec2.New(&aws.Config{Credentials: creds}) +// svc := ec2.New(session.Must(session.NewSession(&aws.Config{ +// Credentials: creds, +// }))) // type ChainProvider struct { Providers []Provider diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 7b8ebf5f9..42416fc2f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -14,7 +14,7 @@ // // Example of using the environment variable credentials. // -// creds := NewEnvCredentials() +// creds := credentials.NewEnvCredentials() // // // Retrieve the credentials value // credValue, err := creds.Get() @@ -26,7 +26,7 @@ // This may be helpful to proactively expire credentials and refresh them sooner // than they would naturally expire on their own. // -// creds := NewCredentials(&EC2RoleProvider{}) +// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{}) // creds.Expire() // credsValue, err := creds.Get() // // New credentials will be retrieved instead of from cache. @@ -43,7 +43,7 @@ // func (m *MyProvider) Retrieve() (Value, error) {...} // func (m *MyProvider) IsExpired() bool {...} // -// creds := NewCredentials(&MyProvider{}) +// creds := credentials.NewCredentials(&MyProvider{}) // credValue, err := creds.Get() // package credentials @@ -60,7 +60,9 @@ import ( // when making service API calls. For example, when accessing public // s3 buckets. // -// svc := s3.New(&aws.Config{Credentials: AnonymousCredentials}) +// svc := s3.New(session.Must(session.NewSession(&aws.Config{ +// Credentials: credentials.AnonymousCredentials, +// }))) // // Access public S3 buckets. // // @readonly @@ -88,7 +90,7 @@ type Value struct { // The Provider should not need to implement its own mutexes, because // that will be managed by Credentials. type Provider interface { - // Refresh returns nil if it successfully retrieved the value. + // Retrieve returns nil if it successfully retrieved the value. // Error is returned if the value were not obtainable, or empty. Retrieve() (Value, error) @@ -97,6 +99,27 @@ type Provider interface { IsExpired() bool } +// An ErrorProvider is a stub credentials provider that always returns an error +// this is used by the SDK when construction a known provider is not possible +// due to an error. +type ErrorProvider struct { + // The error to be returned from Retrieve + Err error + + // The provider name to set on the Retrieved returned Value + ProviderName string +} + +// Retrieve will always return the error that the ErrorProvider was created with. +func (p ErrorProvider) Retrieve() (Value, error) { + return Value{ProviderName: p.ProviderName}, p.Err +} + +// IsExpired will always return not expired. +func (p ErrorProvider) IsExpired() bool { + return false +} + // A Expiry provides shared expiration logic to be used by credentials // providers to implement expiry functionality. // diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go index 96655bc46..c14231a16 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go @@ -29,6 +29,7 @@ var ( // Environment variables used: // // * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY +// // * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY type EnvProvider struct { retrieved bool diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index b84062332..4108e433e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -12,7 +12,7 @@ between multiple Credentials, Sessions or service clients. Assume Role To assume an IAM role using STS with the SDK you can create a new Credentials -with the SDKs's stscreds package. +with the SDKs's stscreds package. // Initial credentials loaded from SDK's default credential chain. Such as // the environment, shared credentials (~/.aws/credentials), or EC2 Instance diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go index 0ef55040a..07afe3b8e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -10,10 +10,12 @@ package defaults import ( "fmt" "net/http" + "net/url" "os" "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" @@ -56,7 +58,6 @@ func Config() *aws.Config { WithMaxRetries(aws.UseServiceDefaultRetries). WithLogger(aws.NewDefaultLogger()). WithLogLevel(aws.LogOff). - WithSleepDelay(time.Sleep). WithEndpointResolver(endpoints.DefaultResolver()) } @@ -97,23 +98,51 @@ func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credenti }) } -// RemoteCredProvider returns a credenitials provider for the default remote +const ( + httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" + ecsCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" +) + +// RemoteCredProvider returns a credentials provider for the default remote // endpoints such as EC2 or ECS Roles. func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - ecsCredURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") + if u := os.Getenv(httpProviderEnvVar); len(u) > 0 { + return localHTTPCredProvider(cfg, handlers, u) + } - if len(ecsCredURI) > 0 { - return ecsCredProvider(cfg, handlers, ecsCredURI) + if uri := os.Getenv(ecsCredsProviderEnvVar); len(uri) > 0 { + u := fmt.Sprintf("http://169.254.170.2%s", uri) + return httpCredProvider(cfg, handlers, u) } return ec2RoleProvider(cfg, handlers) } -func ecsCredProvider(cfg aws.Config, handlers request.Handlers, uri string) credentials.Provider { - const host = `169.254.170.2` +func localHTTPCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { + var errMsg string + + parsed, err := url.Parse(u) + if err != nil { + errMsg = fmt.Sprintf("invalid URL, %v", err) + } else if host := aws.URLHostname(parsed); !(host == "localhost" || host == "127.0.0.1") { + errMsg = fmt.Sprintf("invalid host address, %q, only localhost and 127.0.0.1 are valid.", host) + } + + if len(errMsg) > 0 { + if cfg.Logger != nil { + cfg.Logger.Log("Ignoring, HTTP credential provider", errMsg, err) + } + return credentials.ErrorProvider{ + Err: awserr.New("CredentialsEndpointError", errMsg, err), + ProviderName: endpointcreds.ProviderName, + } + } + + return httpCredProvider(cfg, handlers, u) +} - return endpointcreds.NewProviderClient(cfg, handlers, - fmt.Sprintf("http://%s%s", host, uri), +func httpCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { + return endpointcreds.NewProviderClient(cfg, handlers, u, func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute }, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go index bea61dea8..d3e4a86b6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go @@ -6,39 +6,83 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" "github.com/aws/aws-sdk-go/aws/request" - "github.com/stretchr/testify/assert" ) -func TestECSCredProvider(t *testing.T) { - defer os.Clearenv() - os.Setenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", "/abc/123") +func TestHTTPCredProvider(t *testing.T) { + cases := []struct { + Host string + Fail bool + }{ + {"localhost", false}, {"127.0.0.1", false}, + {"www.example.com", true}, {"169.254.170.2", true}, + } - provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + defer os.Clearenv() - assert.NotNil(t, provider) + for i, c := range cases { + u := fmt.Sprintf("http://%s/abc/123", c.Host) + os.Setenv(httpProviderEnvVar, u) - ecsProvider, ok := provider.(*endpointcreds.Provider) - assert.NotNil(t, ecsProvider) - assert.True(t, ok) + provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + if provider == nil { + t.Fatalf("%d, expect provider not to be nil, but was", i) + } - assert.Equal(t, fmt.Sprintf("http://169.254.170.2/abc/123"), - ecsProvider.Client.Endpoint) + if c.Fail { + creds, err := provider.Retrieve() + if err == nil { + t.Fatalf("%d, expect error but got none", i) + } else { + aerr := err.(awserr.Error) + if e, a := "CredentialsEndpointError", aerr.Code(); e != a { + t.Errorf("%d, expect %s error code, got %s", i, e, a) + } + } + if e, a := endpointcreds.ProviderName, creds.ProviderName; e != a { + t.Errorf("%d, expect %s provider name got %s", i, e, a) + } + } else { + httpProvider := provider.(*endpointcreds.Provider) + if e, a := u, httpProvider.Client.Endpoint; e != a { + t.Errorf("%d, expect %q endpoint, got %q", i, e, a) + } + } + } } -func TestDefaultEC2RoleProvider(t *testing.T) { - provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) +func TestECSCredProvider(t *testing.T) { + defer os.Clearenv() + os.Setenv(ecsCredsProviderEnvVar, "/abc/123") - assert.NotNil(t, provider) + provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + if provider == nil { + t.Fatalf("expect provider not to be nil, but was") + } - ec2Provider, ok := provider.(*ec2rolecreds.EC2RoleProvider) - assert.NotNil(t, ec2Provider) - assert.True(t, ok) + httpProvider := provider.(*endpointcreds.Provider) + if httpProvider == nil { + t.Fatalf("expect provider not to be nil, but was") + } + if e, a := "http://169.254.170.2/abc/123", httpProvider.Client.Endpoint; e != a { + t.Errorf("expect %q endpoint, got %q", e, a) + } +} - fmt.Println(ec2Provider.Client.Endpoint) +func TestDefaultEC2RoleProvider(t *testing.T) { + provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) + if provider == nil { + t.Fatalf("expect provider not to be nil, but was") + } - assert.Equal(t, fmt.Sprintf("http://169.254.169.254/latest"), - ec2Provider.Client.Endpoint) + ec2Provider := provider.(*ec2rolecreds.EC2RoleProvider) + if ec2Provider == nil { + t.Fatalf("expect provider not to be nil, but was") + } + if e, a := "http://169.254.169.254/latest", ec2Provider.Client.Endpoint; e != a { + t.Errorf("expect %q endpoint, got %q", e, a) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 53616560d..90558c44b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. package endpoints @@ -103,9 +103,12 @@ const ( MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. + ModelsLexServiceID = "models.lex" // ModelsLex. MonitoringServiceID = "monitoring" // Monitoring. + MturkRequesterServiceID = "mturk-requester" // MturkRequester. OpsworksServiceID = "opsworks" // Opsworks. OpsworksCmServiceID = "opsworks-cm" // OpsworksCm. + OrganizationsServiceID = "organizations" // Organizations. PinpointServiceID = "pinpoint" // Pinpoint. PollyServiceID = "polly" // Polly. RdsServiceID = "rds" // Rds. @@ -129,8 +132,10 @@ const ( StsServiceID = "sts" // Sts. SupportServiceID = "support" // Support. SwfServiceID = "swf" // Swf. + TaggingServiceID = "tagging" // Tagging. WafServiceID = "waf" // Waf. WafRegionalServiceID = "waf-regional" // WafRegional. + WorkdocsServiceID = "workdocs" // Workdocs. WorkspacesServiceID = "workspaces" // Workspaces. XrayServiceID = "xray" // Xray. ) @@ -138,17 +143,20 @@ const ( // DefaultResolver returns an Endpoint resolver that will be able // to resolve endpoints for: AWS Standard, AWS China, and AWS GovCloud (US). // -// Casting the return value of this func to a EnumPartitions will -// allow you to get a list of the partitions in the order the endpoints -// will be resolved in. +// Use DefaultPartitions() to get the list of the default partitions. +func DefaultResolver() Resolver { + return defaultPartitions +} + +// DefaultPartitions returns a list of the partitions the SDK is bundled +// with. The available partitions are: AWS Standard, AWS China, and AWS GovCloud (US). // -// resolver := endpoints.DefaultResolver() -// partitions := resolver.(endpoints.EnumPartitions).Partitions() +// partitions := endpoints.DefaultPartitions // for _, p := range partitions { // // ... inspect partitions // } -func DefaultResolver() Resolver { - return defaultPartitions +func DefaultPartitions() []Partition { + return defaultPartitions.Partitions() } var defaultPartitions = partitions{ @@ -246,6 +254,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, @@ -342,6 +351,7 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -432,10 +442,14 @@ var awsPartition = partition{ "codebuild": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "codecommit": service{ @@ -488,6 +502,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -501,6 +516,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -514,6 +530,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -749,10 +766,11 @@ var awsPartition = partition{ "elasticfilesystem": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "elasticloadbalancing": service{ @@ -831,8 +849,10 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -848,6 +868,7 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -958,6 +979,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -1014,6 +1036,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, @@ -1075,10 +1098,13 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, @@ -1089,6 +1115,16 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "models.lex": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "lex", + }, + }, + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, "monitoring": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -1110,6 +1146,16 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "mturk-requester": service{ + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "sandbox": endpoint{ + Hostname: "mturk-requester-sandbox.us-east-1.amazonaws.com", + }, + "us-east-1": endpoint{}, + }, + }, "opsworks": service{ Endpoints: endpoints{ @@ -1136,6 +1182,19 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "organizations": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "organizations.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, "pinpoint": service{ Defaults: endpoint{ CredentialScope: credentialScope{ @@ -1346,7 +1405,6 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -1421,6 +1479,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1532,6 +1591,25 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "tagging": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "waf": service{ PartitionEndpoint: "aws-global", IsRegionalized: boxedFalse, @@ -1554,6 +1632,17 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "workdocs": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "workspaces": service{ Endpoints: endpoints{ @@ -1632,6 +1721,12 @@ var awscnPartition = partition{ "cn-north-1": endpoint{}, }, }, + "codedeploy": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "config": service{ Endpoints: endpoints{ @@ -1809,6 +1904,12 @@ var awscnPartition = partition{ }, "swf": service{ + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "tagging": service{ + Endpoints: endpoints{ "cn-north-1": endpoint{}, }, @@ -1946,6 +2047,12 @@ var awsusgovPartition = partition{ }, }, }, + "kinesis": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "kms": service{ Endpoints: endpoints{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go index 37e19ab00..9c3eedb48 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go @@ -124,6 +124,49 @@ type EnumPartitions interface { Partitions() []Partition } +// RegionsForService returns a map of regions for the partition and service. +// If either the partition or service does not exist false will be returned +// as the second parameter. +// +// This example shows how to get the regions for DynamoDB in the AWS partition. +// rs, exists := endpoints.RegionsForService(endpoints.DefaultPartitions(), endpoints.AwsPartitionID, endpoints.DynamodbServiceID) +// +// This is equivalent to using the partition directly. +// rs := endpoints.AwsPartition().Services()[endpoints.DynamodbServiceID].Regions() +func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool) { + for _, p := range ps { + if p.ID() != partitionID { + continue + } + if _, ok := p.p.Services[serviceID]; !ok { + break + } + + s := Service{ + id: serviceID, + p: p.p, + } + return s.Regions(), true + } + + return map[string]Region{}, false +} + +// PartitionForRegion returns the first partition which includes the region +// passed in. This includes both known regions and regions which match +// a pattern supported by the partition which may include regions that are +// not explicitly known by the partition. Use the Regions method of the +// returned Partition if explicit support is needed. +func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { + for _, p := range ps { + if _, ok := p.p.Regions[regionID]; ok || p.p.RegionRegex.MatchString(regionID) { + return p, true + } + } + + return Partition{}, false +} + // A Partition provides the ability to enumerate the partition's regions // and services. type Partition struct { @@ -132,7 +175,7 @@ type Partition struct { } // ID returns the identifier of the partition. -func (p *Partition) ID() string { return p.id } +func (p Partition) ID() string { return p.id } // EndpointFor attempts to resolve the endpoint based on service and region. // See Options for information on configuring how the endpoint is resolved. @@ -155,13 +198,13 @@ func (p *Partition) ID() string { return p.id } // Errors that can be returned. // * UnknownServiceError // * UnknownEndpointError -func (p *Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { +func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { return p.p.EndpointFor(service, region, opts...) } // Regions returns a map of Regions indexed by their ID. This is useful for // enumerating over the regions in a partition. -func (p *Partition) Regions() map[string]Region { +func (p Partition) Regions() map[string]Region { rs := map[string]Region{} for id := range p.p.Regions { rs[id] = Region{ @@ -175,7 +218,7 @@ func (p *Partition) Regions() map[string]Region { // Services returns a map of Service indexed by their ID. This is useful for // enumerating over the services in a partition. -func (p *Partition) Services() map[string]Service { +func (p Partition) Services() map[string]Service { ss := map[string]Service{} for id := range p.p.Services { ss[id] = Service{ @@ -195,16 +238,16 @@ type Region struct { } // ID returns the region's identifier. -func (r *Region) ID() string { return r.id } +func (r Region) ID() string { return r.id } // ResolveEndpoint resolves an endpoint from the context of the region given // a service. See Partition.EndpointFor for usage and errors that can be returned. -func (r *Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error) { +func (r Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error) { return r.p.EndpointFor(service, r.id, opts...) } // Services returns a list of all services that are known to be in this region. -func (r *Region) Services() map[string]Service { +func (r Region) Services() map[string]Service { ss := map[string]Service{} for id, s := range r.p.Services { if _, ok := s.Endpoints[r.id]; ok { @@ -226,17 +269,38 @@ type Service struct { } // ID returns the identifier for the service. -func (s *Service) ID() string { return s.id } +func (s Service) ID() string { return s.id } // ResolveEndpoint resolves an endpoint from the context of a service given // a region. See Partition.EndpointFor for usage and errors that can be returned. -func (s *Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error) { +func (s Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error) { return s.p.EndpointFor(s.id, region, opts...) } +// Regions returns a map of Regions that the service is present in. +// +// A region is the AWS region the service exists in. Whereas a Endpoint is +// an URL that can be resolved to a instance of a service. +func (s Service) Regions() map[string]Region { + rs := map[string]Region{} + for id := range s.p.Services[s.id].Endpoints { + if _, ok := s.p.Regions[id]; ok { + rs[id] = Region{ + id: id, + p: s.p, + } + } + } + + return rs +} + // Endpoints returns a map of Endpoints indexed by their ID for all known // endpoints for a service. -func (s *Service) Endpoints() map[string]Endpoint { +// +// A region is the AWS region the service exists in. Whereas a Endpoint is +// an URL that can be resolved to a instance of a service. +func (s Service) Endpoints() map[string]Endpoint { es := map[string]Endpoint{} for id := range s.p.Services[s.id].Endpoints { es[id] = Endpoint{ @@ -259,15 +323,15 @@ type Endpoint struct { } // ID returns the identifier for an endpoint. -func (e *Endpoint) ID() string { return e.id } +func (e Endpoint) ID() string { return e.id } // ServiceID returns the identifier the endpoint belongs to. -func (e *Endpoint) ServiceID() string { return e.serviceID } +func (e Endpoint) ServiceID() string { return e.serviceID } // ResolveEndpoint resolves an endpoint from the context of a service and // region the endpoint represents. See Partition.EndpointFor for usage and // errors that can be returned. -func (e *Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error) { +func (e Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error) { return e.p.EndpointFor(e.serviceID, e.id, opts...) } @@ -300,28 +364,6 @@ type EndpointNotFoundError struct { Region string } -//// NewEndpointNotFoundError builds and returns NewEndpointNotFoundError. -//func NewEndpointNotFoundError(p, s, r string) EndpointNotFoundError { -// return EndpointNotFoundError{ -// awsError: awserr.New("EndpointNotFoundError", "unable to find endpoint", nil), -// Partition: p, -// Service: s, -// Region: r, -// } -//} -// -//// Error returns string representation of the error. -//func (e EndpointNotFoundError) Error() string { -// extra := fmt.Sprintf("partition: %q, service: %q, region: %q", -// e.Partition, e.Service, e.Region) -// return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -//} -// -//// String returns the string representation of the error. -//func (e EndpointNotFoundError) String() string { -// return e.Error() -//} - // A UnknownServiceError is returned when the service does not resolve to an // endpoint. Includes a list of all known services for the partition. Returned // when a partition does not support the service. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go index 8877d7bd4..9c0e09db6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go @@ -84,6 +84,22 @@ func TestEnumRegionServices(t *testing.T) { } } +func TestEnumServiceRegions(t *testing.T) { + p := testPartitions[0].Partition() + + rs := p.Services()["service1"].Regions() + if e, a := 2, len(rs); e != a { + t.Errorf("expect %d regions, got %d", e, a) + } + + if _, ok := rs["us-east-1"]; !ok { + t.Errorf("expect region to be found") + } + if _, ok := rs["us-west-2"]; !ok { + t.Errorf("expect region to be found") + } +} + func TestEnumServicesEndpoints(t *testing.T) { p := testPartitions[0].Partition() @@ -242,3 +258,78 @@ func TestOptionsSet(t *testing.T) { t.Errorf("expect %v options got %v", expect, actual) } } + +func TestRegionsForService(t *testing.T) { + ps := DefaultPartitions() + + var expect map[string]Region + var serviceID string + for _, s := range ps[0].Services() { + expect = s.Regions() + serviceID = s.ID() + if len(expect) > 0 { + break + } + } + + actual, ok := RegionsForService(ps, ps[0].ID(), serviceID) + if !ok { + t.Fatalf("expect regions to be found, was not") + } + + if len(actual) == 0 { + t.Fatalf("expect service %s to have regions", serviceID) + } + if e, a := len(expect), len(actual); e != a { + t.Fatalf("expect %d regions, got %d", e, a) + } + + for id, r := range actual { + if e, a := id, r.ID(); e != a { + t.Errorf("expect %s region id, got %s", e, a) + } + if _, ok := expect[id]; !ok { + t.Errorf("expect %s region to be found", id) + } + } +} + +func TestRegionsForService_NotFound(t *testing.T) { + ps := testPartitions.Partitions() + + actual, ok := RegionsForService(ps, ps[0].ID(), "service-not-exists") + if ok { + t.Fatalf("expect no regions to be found, but were") + } + if len(actual) != 0 { + t.Errorf("expect no regions, got %v", actual) + } +} + +func TestPartitionForRegion(t *testing.T) { + ps := DefaultPartitions() + expect := ps[len(ps)%2] + + var regionID string + for id := range expect.Regions() { + regionID = id + break + } + + actual, ok := PartitionForRegion(ps, regionID) + if !ok { + t.Fatalf("expect partition to be found") + } + if e, a := expect.ID(), actual.ID(); e != a { + t.Errorf("expect %s partition, got %s", e, a) + } +} + +func TestPartitionForRegion_NotFound(t *testing.T) { + ps := DefaultPartitions() + + actual, ok := PartitionForRegion(ps, "regionNotExists") + if ok { + t.Errorf("expect no partition to be found, got %v", actual) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go index 1e7369dbf..05e92df22 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go @@ -158,7 +158,7 @@ var funcMap = template.FuncMap{ const v3Tmpl = ` {{ define "defaults" -}} -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. package endpoints @@ -209,17 +209,20 @@ import ( // DefaultResolver returns an Endpoint resolver that will be able // to resolve endpoints for: {{ ListPartitionNames . }}. // - // Casting the return value of this func to a EnumPartitions will - // allow you to get a list of the partitions in the order the endpoints - // will be resolved in. + // Use DefaultPartitions() to get the list of the default partitions. + func DefaultResolver() Resolver { + return defaultPartitions + } + + // DefaultPartitions returns a list of the partitions the SDK is bundled + // with. The available partitions are: {{ ListPartitionNames . }}. // - // resolver := endpoints.DefaultResolver() - // partitions := resolver.(endpoints.EnumPartitions).Partitions() + // partitions := endpoints.DefaultPartitions // for _, p := range partitions { // // ... inspect partitions // } - func DefaultResolver() Resolver { - return defaultPartitions + func DefaultPartitions() []Partition { + return defaultPartitions.Partitions() } var defaultPartitions = partitions{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go new file mode 100644 index 000000000..91a6f277a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go @@ -0,0 +1,12 @@ +package aws + +// JSONValue is a representation of a grab bag type that will be marshaled +// into a json string. This type can be used just like any other map. +// +// Example: +// +// values := aws.JSONValue{ +// "Foo": "Bar", +// } +// values["Baz"] = "Qux" +type JSONValue map[string]interface{} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go new file mode 100644 index 000000000..10fc8cb24 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go @@ -0,0 +1,19 @@ +// +build !appengine + +package request + +import ( + "net" + "os" + "syscall" +) + +func isErrConnectionReset(err error) bool { + if opErr, ok := err.(*net.OpError); ok { + if sysErr, ok := opErr.Err.(*os.SyscallError); ok { + return sysErr.Err == syscall.ECONNRESET + } + } + + return false +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine.go new file mode 100644 index 000000000..996196e73 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine.go @@ -0,0 +1,11 @@ +// +build appengine + +package request + +import ( + "strings" +) + +func isErrConnectionReset(err error) bool { + return strings.Contains(err.Error(), "connection reset") +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine_test.go new file mode 100644 index 000000000..29660da23 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_appengine_test.go @@ -0,0 +1,9 @@ +// +build appengine + +package request_test + +import ( + "errors" +) + +var stubConnectionResetError = errors.New("connection reset") diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go new file mode 100644 index 000000000..f02c507d5 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go @@ -0,0 +1,11 @@ +// +build !appengine + +package request_test + +import ( + "net" + "os" + "syscall" +) + +var stubConnectionResetError = &net.OpError{Err: &os.SyscallError{Syscall: "read", Err: syscall.ECONNRESET}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 5279c19c0..6c14336f6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -18,6 +18,7 @@ type Handlers struct { UnmarshalError HandlerList Retry HandlerList AfterRetry HandlerList + Complete HandlerList } // Copy returns of this handler's lists. @@ -33,6 +34,7 @@ func (h *Handlers) Copy() Handlers { UnmarshalMeta: h.UnmarshalMeta.copy(), Retry: h.Retry.copy(), AfterRetry: h.AfterRetry.copy(), + Complete: h.Complete.copy(), } } @@ -48,6 +50,7 @@ func (h *Handlers) Clear() { h.ValidateResponse.Clear() h.Retry.Clear() h.AfterRetry.Clear() + h.Complete.Clear() } // A HandlerListRunItem represents an entry in the HandlerList which @@ -85,13 +88,17 @@ func (l *HandlerList) copy() HandlerList { n := HandlerList{ AfterEachFn: l.AfterEachFn, } - n.list = append([]NamedHandler{}, l.list...) + if len(l.list) == 0 { + return n + } + + n.list = append(make([]NamedHandler, 0, len(l.list)), l.list...) return n } // Clear clears the handler list. func (l *HandlerList) Clear() { - l.list = []NamedHandler{} + l.list = l.list[0:0] } // Len returns the number of handlers in the list. @@ -101,33 +108,54 @@ func (l *HandlerList) Len() int { // PushBack pushes handler f to the back of the handler list. func (l *HandlerList) PushBack(f func(*Request)) { - l.list = append(l.list, NamedHandler{"__anonymous", f}) -} - -// PushFront pushes handler f to the front of the handler list. -func (l *HandlerList) PushFront(f func(*Request)) { - l.list = append([]NamedHandler{{"__anonymous", f}}, l.list...) + l.PushBackNamed(NamedHandler{"__anonymous", f}) } // PushBackNamed pushes named handler f to the back of the handler list. func (l *HandlerList) PushBackNamed(n NamedHandler) { + if cap(l.list) == 0 { + l.list = make([]NamedHandler, 0, 5) + } l.list = append(l.list, n) } +// PushFront pushes handler f to the front of the handler list. +func (l *HandlerList) PushFront(f func(*Request)) { + l.PushFrontNamed(NamedHandler{"__anonymous", f}) +} + // PushFrontNamed pushes named handler f to the front of the handler list. func (l *HandlerList) PushFrontNamed(n NamedHandler) { - l.list = append([]NamedHandler{n}, l.list...) + if cap(l.list) == len(l.list) { + // Allocating new list required + l.list = append([]NamedHandler{n}, l.list...) + } else { + // Enough room to prepend into list. + l.list = append(l.list, NamedHandler{}) + copy(l.list[1:], l.list) + l.list[0] = n + } } // Remove removes a NamedHandler n func (l *HandlerList) Remove(n NamedHandler) { - newlist := []NamedHandler{} - for _, m := range l.list { - if m.Name != n.Name { - newlist = append(newlist, m) + l.RemoveByName(n.Name) +} + +// RemoveByName removes a NamedHandler by name. +func (l *HandlerList) RemoveByName(name string) { + for i := 0; i < len(l.list); i++ { + m := l.list[i] + if m.Name == name { + // Shift array preventing creating new arrays + copy(l.list[i:], l.list[i+1:]) + l.list[len(l.list)-1] = NamedHandler{} + l.list = l.list[:len(l.list)-1] + + // decrement list so next check to length is correct + i-- } } - l.list = newlist } // Run executes all handlers in the list with a given request object. @@ -163,6 +191,16 @@ func HandlerListStopOnError(item HandlerListRunItem) bool { return item.Request.Error == nil } +// WithAppendUserAgent will add a string to the user agent prefixed with a +// single white space. +func WithAppendUserAgent(s string) Option { + return func(r *Request) { + r.Handlers.Build.PushBack(func(r2 *Request) { + AddToUserAgent(r, s) + }) + } +} + // MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request // header. If the extra parameters are provided they will be added as metadata to the // name/version pair resulting in the following format. 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 b32a6510d..e375a998f 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 @@ -7,6 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/service/s3" ) func TestHandlerList(t *testing.T) { @@ -85,3 +87,71 @@ func TestStopHandlers(t *testing.T) { assert.Equal(t, 2, called, "Expect only two handlers to be called") } + +func BenchmarkNewRequest(b *testing.B) { + svc := s3.New(unit.Session) + + for i := 0; i < b.N; i++ { + r, _ := svc.GetObjectRequest(nil) + if r == nil { + b.Fatal("r should not be nil") + } + } +} + +func BenchmarkHandlersCopy(b *testing.B) { + handlers := request.Handlers{} + + handlers.Validate.PushBack(func(r *request.Request) {}) + handlers.Validate.PushBack(func(r *request.Request) {}) + handlers.Build.PushBack(func(r *request.Request) {}) + handlers.Build.PushBack(func(r *request.Request) {}) + handlers.Send.PushBack(func(r *request.Request) {}) + handlers.Send.PushBack(func(r *request.Request) {}) + handlers.Unmarshal.PushBack(func(r *request.Request) {}) + handlers.Unmarshal.PushBack(func(r *request.Request) {}) + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + if e, a := handlers.Validate.Len(), h.Validate.Len(); e != a { + b.Fatalf("expected %d handlers got %d", e, a) + } + } +} + +func BenchmarkHandlersPushBack(b *testing.B) { + handlers := request.Handlers{} + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + h.Validate.PushBack(func(r *request.Request) {}) + h.Validate.PushBack(func(r *request.Request) {}) + h.Validate.PushBack(func(r *request.Request) {}) + h.Validate.PushBack(func(r *request.Request) {}) + } +} + +func BenchmarkHandlersPushFront(b *testing.B) { + handlers := request.Handlers{} + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + } +} + +func BenchmarkHandlersClear(b *testing.B) { + handlers := request.Handlers{} + + for i := 0; i < b.N; i++ { + h := handlers.Copy() + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Validate.PushFront(func(r *request.Request) {}) + h.Clear() + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 77312bb66..4f4f1123a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -16,6 +16,24 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" ) +const ( + // ErrCodeSerialization is the serialization error code that is received + // during protocol unmarshaling. + ErrCodeSerialization = "SerializationError" + + // ErrCodeRead is an error that is returned during HTTP reads. + ErrCodeRead = "ReadError" + + // ErrCodeResponseTimeout is the connection timeout error that is recieved + // during body reads. + ErrCodeResponseTimeout = "ResponseTimeout" + + // CanceledErrorCode is the error code that will be returned by an + // API request that was canceled. Requests given a aws.Context may + // return this error when canceled. + CanceledErrorCode = "RequestCanceled" +) + // A Request is the service request to be made. type Request struct { Config aws.Config @@ -23,30 +41,33 @@ type Request struct { Handlers Handlers Retryer - Time time.Time - ExpireTime time.Duration - Operation *Operation - HTTPRequest *http.Request - HTTPResponse *http.Response - Body io.ReadSeeker - BodyStart int64 // offset from beginning of Body that the request body starts - Params interface{} - Error error - Data interface{} - RequestID string - RetryCount int - Retryable *bool - RetryDelay time.Duration - NotHoist bool - SignedHeaderVals http.Header - LastSignedAt time.Time + Time time.Time + ExpireTime time.Duration + Operation *Operation + HTTPRequest *http.Request + HTTPResponse *http.Response + Body io.ReadSeeker + BodyStart int64 // offset from beginning of Body that the request body starts + Params interface{} + Error error + Data interface{} + RequestID string + RetryCount int + Retryable *bool + RetryDelay time.Duration + NotHoist bool + SignedHeaderVals http.Header + LastSignedAt time.Time + DisableFollowRedirects bool + + context aws.Context built bool - // Need to persist an intermideant body betweend the input Body and HTTP + // Need to persist an intermediate body between 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. + // safe to use concurrently and wrap the input Body for each HTTP request. safeBody *offsetReader } @@ -60,14 +81,6 @@ type Operation struct { BeforePresignFn func(r *Request) error } -// Paginator keeps track of pagination configuration for an API operation. -type Paginator struct { - InputTokens []string - OutputTokens []string - LimitToken string - TruncationToken string -} - // New returns a new Request pointer for the service API // operation and parameters. // @@ -111,6 +124,94 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, return r } +// A Option is a functional option that can augment or modify a request when +// using a WithContext API operation method. +type Option func(*Request) + +// WithGetResponseHeader builds a request Option which will retrieve a single +// header value from the HTTP Response. If there are multiple values for the +// header key use WithGetResponseHeaders instead to access the http.Header +// map directly. The passed in val pointer must be non-nil. +// +// This Option can be used multiple times with a single API operation. +// +// var id2, versionID string +// svc.PutObjectWithContext(ctx, params, +// request.WithGetResponseHeader("x-amz-id-2", &id2), +// request.WithGetResponseHeader("x-amz-version-id", &versionID), +// ) +func WithGetResponseHeader(key string, val *string) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *val = req.HTTPResponse.Header.Get(key) + }) + } +} + +// WithGetResponseHeaders builds a request Option which will retrieve the +// headers from the HTTP response and assign them to the passed in headers +// variable. The passed in headers pointer must be non-nil. +// +// var headers http.Header +// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) +func WithGetResponseHeaders(headers *http.Header) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *headers = req.HTTPResponse.Header + }) + } +} + +// WithLogLevel is a request option that will set the request to use a specific +// log level when the request is made. +// +// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody) +func WithLogLevel(l aws.LogLevelType) Option { + return func(r *Request) { + r.Config.LogLevel = aws.LogLevel(l) + } +} + +// ApplyOptions will apply each option to the request calling them in the order +// the were provided. +func (r *Request) ApplyOptions(opts ...Option) { + for _, opt := range opts { + opt(r) + } +} + +// Context will always returns a non-nil context. If Request does not have a +// context aws.BackgroundContext will be returned. +func (r *Request) Context() aws.Context { + if r.context != nil { + return r.context + } + return aws.BackgroundContext() +} + +// SetContext adds a Context to the current request that can be used to cancel +// a in-flight request. The Context value must not be nil, or this method will +// panic. +// +// Unlike http.Request.WithContext, SetContext does not return a copy of the +// Request. It is not safe to use use a single Request value for multiple +// requests. A new Request should be created for each API operation request. +// +// Go 1.6 and below: +// The http.Request's Cancel field will be set to the Done() value of +// the context. This will overwrite the Cancel field's value. +// +// Go 1.7 and above: +// The http.Request.WithContext will be used to set the context on the underlying +// http.Request. This will create a shallow copy of the http.Request. The SDK +// may create sub contexts in the future for nested requests such as retries. +func (r *Request) SetContext(ctx aws.Context) { + if ctx == nil { + panic("context cannot be nil") + } + setRequestContext(r, ctx) +} + // WillRetry returns if the request's can be retried. func (r *Request) WillRetry() bool { return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() @@ -262,7 +363,7 @@ func (r *Request) ResetBody() { // Related golang/go#18257 l, err := computeBodyLength(r.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed to compute request body size", err) + r.Error = awserr.New(ErrCodeSerialization, "failed to compute request body size", err) return } @@ -344,6 +445,12 @@ func (r *Request) GetBody() io.ReadSeeker { // // Send will not close the request.Request's body. func (r *Request) Send() error { + defer func() { + // Regardless of success or failure of the request trigger the Complete + // request handlers. + r.Handlers.Complete.Run(r) + }() + for { if aws.BoolValue(r.Retryable) { if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { @@ -446,6 +553,9 @@ func shouldRetryCancel(r *Request) bool { timeoutErr := false errStr := r.Error.Error() if ok { + if awsErr.Code() == CanceledErrorCode { + return false + } err := awsErr.OrigErr() netErr, netOK := err.(net.Error) timeoutErr = netOK && netErr.Temporary() diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go new file mode 100644 index 000000000..a7365cd1e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go @@ -0,0 +1,14 @@ +// +build go1.7 + +package request + +import "github.com/aws/aws-sdk-go/aws" + +// setContext updates the Request to use the passed in context for cancellation. +// Context will also be used for request retry delay. +// +// Creates shallow copy of the http.Request with the WithContext method. +func setRequestContext(r *Request, ctx aws.Context) { + r.context = ctx + r.HTTPRequest = r.HTTPRequest.WithContext(ctx) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go new file mode 100644 index 000000000..307fa0705 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go @@ -0,0 +1,14 @@ +// +build !go1.7 + +package request + +import "github.com/aws/aws-sdk-go/aws" + +// setContext updates the Request to use the passed in context for cancellation. +// Context will also be used for request retry delay. +// +// Creates shallow copy of the http.Request with the WithContext method. +func setRequestContext(r *Request, ctx aws.Context) { + r.context = ctx + r.HTTPRequest.Cancel = ctx.Done() +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go new file mode 100644 index 000000000..2af286756 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go @@ -0,0 +1,46 @@ +package request_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting" +) + +func TestRequest_SetContext(t *testing.T) { + svc := awstesting.NewClient() + svc.Handlers.Clear() + svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) + + r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + r.SetContext(ctx) + + ctx.Error = fmt.Errorf("context canceled") + close(ctx.DoneCh) + + err := r.Send() + if err == nil { + t.Fatalf("expected error, got none") + } + + // Only check against canceled because go 1.6 will not use the context's + // Err(). + if e, a := "canceled", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %q to be in %q, but was not", e, a) + } +} + +func TestRequest_SetContextPanic(t *testing.T) { + defer func() { + if r := recover(); r == nil { + t.Fatalf("expect SetContext to panic, did not") + } + }() + r := &request.Request{} + + r.SetContext(nil) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go index 660f4d49e..966f93455 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go @@ -2,8 +2,6 @@ package request import ( "testing" - - "github.com/stretchr/testify/assert" ) func TestCopy(t *testing.T) { @@ -15,6 +13,15 @@ func TestCopy(t *testing.T) { req.Handlers = handlers r := req.copy() - assert.NotEqual(t, req, r) - assert.Equal(t, req.Operation.HTTPMethod, r.Operation.HTTPMethod) + + if r == req { + t.Fatal("expect request pointer copy to be different") + } + if r.Operation == req.Operation { + t.Errorf("expect request operation pointer to be different") + } + + if e, a := req.Operation.HTTPMethod, r.Operation.HTTPMethod; e != a { + t.Errorf("expect %q http method, got %q", e, a) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go index 2939ec473..59de6736b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go @@ -2,29 +2,125 @@ package request import ( "reflect" + "sync/atomic" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" ) -//type Paginater interface { -// HasNextPage() bool -// NextPage() *Request -// EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error -//} +// A Pagination provides paginating of SDK API operations which are paginatable. +// Generally you should not use this type directly, but use the "Pages" API +// operations method to automatically perform pagination for you. Such as, +// "S3.ListObjectsPages", and "S3.ListObjectsPagesWithContext" methods. +// +// Pagination differs from a Paginator type in that pagination is the type that +// does the pagination between API operations, and Paginator defines the +// configuration that will be used per page request. +// +// cont := true +// for p.Next() && cont { +// data := p.Page().(*s3.ListObjectsOutput) +// // process the page's data +// } +// return p.Err() +// +// See service client API operation Pages methods for examples how the SDK will +// use the Pagination type. +type Pagination struct { + // Function to return a Request value for each pagination request. + // Any configuration or handlers that need to be applied to the request + // prior to getting the next page should be done here before the request + // returned. + // + // NewRequest should always be built from the same API operations. It is + // undefined if different API operations are returned on subsequent calls. + NewRequest func() (*Request, error) -// HasNextPage returns true if this request has more pages of data available. -func (r *Request) HasNextPage() bool { - return len(r.nextPageTokens()) > 0 + started bool + nextTokens []interface{} + + err error + curPage interface{} } -// nextPageTokens returns the tokens to use when asking for the next page of -// data. +// HasNextPage will return true if Pagination is able to determine that the API +// operation has additional pages. False will be returned if there are no more +// pages remaining. +// +// Will always return true if Next has not been called yet. +func (p *Pagination) HasNextPage() bool { + return !(p.started && len(p.nextTokens) == 0) +} + +// Err returns the error Pagination encountered when retrieving the next page. +func (p *Pagination) Err() error { + return p.err +} + +// Page returns the current page. Page should only be called after a successful +// call to Next. It is undefined what Page will return if Page is called after +// Next returns false. +func (p *Pagination) Page() interface{} { + return p.curPage +} + +// Next will attempt to retrieve the next page for the API operation. When a page +// is retrieved true will be returned. If the page cannot be retrieved, or there +// are no more pages false will be returned. +// +// Use the Page method to retrieve the current page data. The data will need +// to be cast to the API operation's output type. +// +// Use the Err method to determine if an error occurred if Page returns false. +func (p *Pagination) Next() bool { + if !p.HasNextPage() { + return false + } + + req, err := p.NewRequest() + if err != nil { + p.err = err + return false + } + + if p.started { + for i, intok := range req.Operation.InputTokens { + awsutil.SetValueAtPath(req.Params, intok, p.nextTokens[i]) + } + } + p.started = true + + err = req.Send() + if err != nil { + p.err = err + return false + } + + p.nextTokens = req.nextPageTokens() + p.curPage = req.Data + + return true +} + +// A Paginator is the configuration data that defines how an API operation +// should be paginated. This type is used by the API service models to define +// the generated pagination config for service APIs. +// +// The Pagination type is what provides iterating between pages of an API. It +// is only used to store the token metadata the SDK should use for performing +// pagination. +type Paginator struct { + InputTokens []string + OutputTokens []string + LimitToken string + TruncationToken string +} + +// nextPageTokens returns the tokens to use when asking for the next page of data. func (r *Request) nextPageTokens() []interface{} { if r.Operation.Paginator == nil { return nil } - if r.Operation.TruncationToken != "" { tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken) if len(tr) == 0 { @@ -61,9 +157,40 @@ func (r *Request) nextPageTokens() []interface{} { return tokens } +// Ensure a deprecated item is only logged once instead of each time its used. +func logDeprecatedf(logger aws.Logger, flag *int32, msg string) { + if logger == nil { + return + } + if atomic.CompareAndSwapInt32(flag, 0, 1) { + logger.Log(msg) + } +} + +var ( + logDeprecatedHasNextPage int32 + logDeprecatedNextPage int32 + logDeprecatedEachPage int32 +) + +// HasNextPage returns true if this request has more pages of data available. +// +// Deprecated Use Pagination type for configurable pagination of API operations +func (r *Request) HasNextPage() bool { + logDeprecatedf(r.Config.Logger, &logDeprecatedHasNextPage, + "Request.HasNextPage deprecated. Use Pagination type for configurable pagination of API operations") + + return len(r.nextPageTokens()) > 0 +} + // NextPage returns a new Request that can be executed to return the next // page of result data. Call .Send() on this request to execute it. +// +// Deprecated Use Pagination type for configurable pagination of API operations func (r *Request) NextPage() *Request { + logDeprecatedf(r.Config.Logger, &logDeprecatedNextPage, + "Request.NextPage deprecated. Use Pagination type for configurable pagination of API operations") + tokens := r.nextPageTokens() if len(tokens) == 0 { return nil @@ -90,7 +217,12 @@ func (r *Request) NextPage() *Request { // as the structure "T". The lastPage value represents whether the page is // the last page of data or not. The return value of this function should // return true to keep iterating or false to stop. +// +// Deprecated Use Pagination type for configurable pagination of API operations func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error { + logDeprecatedf(r.Config.Logger, &logDeprecatedEachPage, + "Request.EachPage deprecated. Use Pagination type for configurable pagination of API operations") + for page := r; page != nil; page = page.NextPage() { if err := page.Send(); err != nil { return err diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go index 725ea25cb..73a95bad8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go @@ -7,6 +7,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/unit" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/route53" @@ -380,6 +381,154 @@ func TestPaginationNilToken(t *testing.T) { assert.Equal(t, []string{"first.example.com.", "second.example.com.", "third.example.com."}, results) } +func TestPaginationNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { + r.Data = &s3.ListObjectsOutput{} + }) + + gotToEnd := false + numPages := 0 + err := client.ListObjectsPages(nil, func(p *s3.ListObjectsOutput, last bool) bool { + numPages++ + if last { + gotToEnd = true + } + return true + }) + + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, numPages; e != a { + t.Errorf("expect %d number pages but got %d", e, a) + } + if !gotToEnd { + t.Errorf("expect to of gotten to end, did not") + } +} + +func TestPaginationWithContextNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { + r.Data = &s3.ListObjectsOutput{} + }) + + gotToEnd := false + numPages := 0 + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + err := client.ListObjectsPagesWithContext(ctx, nil, func(p *s3.ListObjectsOutput, last bool) bool { + numPages++ + if last { + gotToEnd = true + } + return true + }) + + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, numPages; e != a { + t.Errorf("expect %d number pages but got %d", e, a) + } + if !gotToEnd { + t.Errorf("expect to of gotten to end, did not") + } +} + +type testPageInput struct { + NextToken string +} +type testPageOutput struct { + Value string + NextToken *string +} + +func TestPagination_Standalone(t *testing.T) { + expect := []struct { + Value, PrevToken, NextToken string + }{ + {"FirstValue", "InitalToken", "FirstToken"}, + {"SecondValue", "FirstToken", "SecondToken"}, + {"ThirdValue", "SecondToken", ""}, + } + input := testPageInput{ + NextToken: expect[0].PrevToken, + } + + c := awstesting.NewClient() + i := 0 + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + r := c.NewRequest( + &request.Operation{ + Name: "Operation", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + }, + }, + &input, &testPageOutput{}, + ) + // Setup handlers for testing + r.Handlers.Clear() + r.Handlers.Build.PushBack(func(req *request.Request) { + in := req.Params.(*testPageInput) + if e, a := expect[i].PrevToken, in.NextToken; e != a { + t.Errorf("%d, expect NextToken input %q, got %q", i, e, a) + } + }) + r.Handlers.Unmarshal.PushBack(func(req *request.Request) { + out := &testPageOutput{ + Value: expect[i].Value, + } + if len(expect[i].NextToken) > 0 { + out.NextToken = aws.String(expect[i].NextToken) + } + req.Data = out + }) + return r, nil + }, + } + + for p.Next() { + data := p.Page().(*testPageOutput) + + if e, a := expect[i].Value, data.Value; e != a { + t.Errorf("%d, expect Value to be %q, got %q", i, e, a) + } + if e, a := expect[i].NextToken, aws.StringValue(data.NextToken); e != a { + t.Errorf("%d, expect NextToken to be %q, got %q", i, e, a) + } + + i++ + } + if e, a := len(expect), i; e != a { + t.Errorf("expected to process %d pages, did %d", e, a) + } + if err := p.Err(); err != nil { + t.Fatalf("%d, expected no error, got %v", i, err) + } +} + // Benchmarks var benchResps = []*dynamodb.ListTablesOutput{ {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go index 213dcdb8e..c741b5ee6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go @@ -3,23 +3,29 @@ package request_test import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" "net/http" "net/http/httptest" + "reflect" "runtime" "strconv" "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" "github.com/aws/aws-sdk-go/private/protocol/rest" ) @@ -91,9 +97,15 @@ func TestRequestRecoverRetry5xx(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 2, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } // test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry` @@ -117,9 +129,15 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 2, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } // test that retries don't occur for 4xx status codes with a response type that can't be retried @@ -135,15 +153,22 @@ func TestRequest4xxUnretryable(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 401, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + aerr := err.(awserr.RequestFailure) + if e, a := 401, aerr.StatusCode(); e != a { + t.Errorf("expect %d status code, got %d", e, a) + } + if e, a := "SignatureDoesNotMatch", aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := "Signature does not match.", aerr.Message(); e != a { + t.Errorf("expect %q error message, got %q", e, a) + } + if e, a := 0, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) } - assert.Equal(t, "SignatureDoesNotMatch", err.(awserr.Error).Code()) - assert.Equal(t, "Signature does not match.", err.(awserr.Error).Message()) - assert.Equal(t, 0, int(r.RetryCount)) } func TestRequestExhaustRetries(t *testing.T) { @@ -171,22 +196,31 @@ func TestRequestExhaustRetries(t *testing.T) { }) r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 500, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + aerr := err.(awserr.RequestFailure) + if e, a := 500, aerr.StatusCode(); e != a { + t.Errorf("expect %d status code, got %d", e, a) + } + if e, a := "UnknownError", aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := "An error occurred.", aerr.Message(); e != a { + t.Errorf("expect %q error message, got %q", e, a) + } + if e, a := 3, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) } - assert.Equal(t, "UnknownError", err.(awserr.Error).Code()) - assert.Equal(t, "An error occurred.", err.(awserr.Error).Message()) - assert.Equal(t, 3, int(r.RetryCount)) expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}} for i, v := range delays { min := expectDelays[i].min * time.Millisecond max := expectDelays[i].max * time.Millisecond - assert.True(t, min <= v && v <= max, - "Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max) + if !(min <= v && v <= max) { + t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", + i, v, min, max) + } } } @@ -222,14 +256,26 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } - assert.False(t, credExpiredBeforeRetry, "Expect valid creds before retry check") - assert.True(t, credExpiredAfterRetry, "Expect expired creds after retry check") - assert.False(t, s.Config.Credentials.IsExpired(), "Expect valid creds after cred expired recovery") + if credExpiredBeforeRetry { + t.Errorf("Expect valid creds before retry check") + } + if !credExpiredAfterRetry { + t.Errorf("Expect expired creds after retry check") + } + if s.Config.Credentials.IsExpired() { + t.Errorf("Expect valid creds after cred expired recovery") + } - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if e, a := 1, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } func TestMakeAddtoUserAgentHandler(t *testing.T) { @@ -238,7 +284,9 @@ func TestMakeAddtoUserAgentHandler(t *testing.T) { r.HTTPRequest.Header.Set("User-Agent", "foo/bar") fn(r) - assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) + if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a { + t.Errorf("expect %q user agent, got %q", e, a) + } } func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { @@ -247,7 +295,9 @@ func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { r.HTTPRequest.Header.Set("User-Agent", "foo/bar") fn(r) - assert.Equal(t, "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent")) + if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a { + t.Errorf("expect %q user agent, got %q", e, a) + } } func TestRequestUserAgent(t *testing.T) { @@ -256,11 +306,15 @@ func TestRequestUserAgent(t *testing.T) { req := s.NewRequest(&request.Operation{Name: "Operation"}, nil, &testData{}) req.HTTPRequest.Header.Set("User-Agent", "foo/bar") - assert.NoError(t, req.Build()) + if err := req.Build(); err != nil { + t.Fatalf("expect no error, got %v", err) + } expectUA := fmt.Sprintf("foo/bar %s/%s (%s; %s; %s)", aws.SDKName, aws.SDKVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH) - assert.Equal(t, expectUA, req.HTTPRequest.Header.Get("User-Agent")) + if e, a := expectUA, req.HTTPRequest.Header.Get("User-Agent"); e != a { + t.Errorf("expect %q user agent, got %q", e, a) + } } func TestRequestThrottleRetries(t *testing.T) { @@ -288,22 +342,31 @@ func TestRequestThrottleRetries(t *testing.T) { }) r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) err := r.Send() - assert.NotNil(t, err) - if e, ok := err.(awserr.RequestFailure); ok { - assert.Equal(t, 500, e.StatusCode()) - } else { - assert.Fail(t, "Expected error to be a service failure") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + aerr := err.(awserr.RequestFailure) + if e, a := 500, aerr.StatusCode(); e != a { + t.Errorf("expect %d status code, got %d", e, a) + } + if e, a := "Throttling", aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := "An error occurred.", aerr.Message(); e != a { + t.Errorf("expect %q error message, got %q", e, a) + } + if e, a := 3, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) } - assert.Equal(t, "Throttling", err.(awserr.Error).Code()) - assert.Equal(t, "An error occurred.", err.(awserr.Error).Message()) - assert.Equal(t, 3, int(r.RetryCount)) expectDelays := []struct{ min, max time.Duration }{{500, 999}, {1000, 1998}, {2000, 3996}} for i, v := range delays { min := expectDelays[i].min * time.Millisecond max := expectDelays[i].max * time.Millisecond - assert.True(t, min <= v && v <= max, - "Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max) + if !(min <= v && v <= max) { + t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", + i, v, min, max) + } } } @@ -339,9 +402,15 @@ func TestRequestRecoverTimeoutWithNilBody(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } func TestRequestRecoverTimeoutWithNilResponse(t *testing.T) { @@ -376,9 +445,15 @@ func TestRequestRecoverTimeoutWithNilResponse(t *testing.T) { out := &testData{} r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 1, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } + if e, a := 1, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if e, a := "valid", out.Data; e != a { + t.Errorf("expect %q output got %q", e, a) + } } func TestRequest_NoBody(t *testing.T) { @@ -438,3 +513,280 @@ func TestRequest_NoBody(t *testing.T) { } } } + +func TestIsSerializationErrorRetryable(t *testing.T) { + testCases := []struct { + err error + expected bool + }{ + { + err: awserr.New(request.ErrCodeSerialization, "foo error", nil), + expected: false, + }, + { + err: awserr.New("ErrFoo", "foo error", nil), + expected: false, + }, + { + err: nil, + expected: false, + }, + { + err: awserr.New(request.ErrCodeSerialization, "foo error", stubConnectionResetError), + expected: true, + }, + } + + for i, c := range testCases { + r := &request.Request{ + Error: c.err, + } + if r.IsErrorRetryable() != c.expected { + t.Errorf("Case %d: Expected %v, but received %v", i+1, c.expected, !c.expected) + } + } +} + +func TestWithLogLevel(t *testing.T) { + r := &request.Request{} + + opt := request.WithLogLevel(aws.LogDebugWithHTTPBody) + r.ApplyOptions(opt) + + if !r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) { + t.Errorf("expect log level to be set, but was not, %v", + r.Config.LogLevel.Value()) + } +} + +func TestWithGetResponseHeader(t *testing.T) { + r := &request.Request{} + + var val, val2 string + r.ApplyOptions( + request.WithGetResponseHeader("x-a-header", &val), + request.WithGetResponseHeader("x-second-header", &val2), + ) + + r.HTTPResponse = &http.Response{ + Header: func() http.Header { + h := http.Header{} + h.Set("x-a-header", "first") + h.Set("x-second-header", "second") + return h + }(), + } + r.Handlers.Complete.Run(r) + + if e, a := "first", val; e != a { + t.Errorf("expect %q header value got %q", e, a) + } + if e, a := "second", val2; e != a { + t.Errorf("expect %q header value got %q", e, a) + } +} + +func TestWithGetResponseHeaders(t *testing.T) { + r := &request.Request{} + + var headers http.Header + opt := request.WithGetResponseHeaders(&headers) + + r.ApplyOptions(opt) + + r.HTTPResponse = &http.Response{ + Header: func() http.Header { + h := http.Header{} + h.Set("x-a-header", "headerValue") + return h + }(), + } + r.Handlers.Complete.Run(r) + + if e, a := "headerValue", headers.Get("x-a-header"); e != a { + t.Errorf("expect %q header value got %q", e, a) + } +} + +type connResetCloser struct { +} + +func (rc *connResetCloser) Read(b []byte) (int, error) { + return 0, stubConnectionResetError +} + +func (rc *connResetCloser) Close() error { + return nil +} + +func TestSerializationErrConnectionReset(t *testing.T) { + count := 0 + handlers := request.Handlers{} + handlers.Send.PushBack(func(r *request.Request) { + count++ + r.HTTPResponse = &http.Response{} + r.HTTPResponse.Body = &connResetCloser{} + }) + + handlers.Sign.PushBackNamed(v4.SignRequestHandler) + handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) + + op := &request.Operation{ + Name: "op", + HTTPMethod: "POST", + HTTPPath: "/", + } + + meta := metadata.ClientInfo{ + ServiceName: "fooService", + SigningName: "foo", + SigningRegion: "foo", + Endpoint: "localhost", + APIVersion: "2001-01-01", + JSONVersion: "1.1", + TargetPrefix: "Foo", + } + cfg := unit.Session.Config.Copy() + cfg.MaxRetries = aws.Int(5) + + req := request.New( + *cfg, + meta, + handlers, + client.DefaultRetryer{NumMaxRetries: 5}, + op, + &struct { + }{}, + &struct { + }{}, + ) + + osErr := stubConnectionResetError + req.ApplyOptions(request.WithResponseReadTimeout(time.Second)) + err := req.Send() + if err == nil { + t.Error("Expected rror 'SerializationError', but received nil") + } + if aerr, ok := err.(awserr.Error); ok && aerr.Code() != "SerializationError" { + t.Errorf("Expected 'SerializationError', but received %q", aerr.Code()) + } else if !ok { + t.Errorf("Expected 'awserr.Error', but received %v", reflect.TypeOf(err)) + } else if aerr.OrigErr().Error() != osErr.Error() { + t.Errorf("Expected %q, but received %q", osErr.Error(), aerr.OrigErr().Error()) + } + + if count != 6 { + t.Errorf("Expected '6', but received %d", count) + } +} + +type testRetryer struct { + shouldRetry bool +} + +func (d *testRetryer) MaxRetries() int { + return 3 +} + +// RetryRules returns the delay duration before retrying this request again +func (d *testRetryer) RetryRules(r *request.Request) time.Duration { + return time.Duration(time.Millisecond) +} + +func (d *testRetryer) ShouldRetry(r *request.Request) bool { + d.shouldRetry = true + if r.Retryable != nil { + return *r.Retryable + } + + if r.HTTPResponse.StatusCode >= 500 { + return true + } + return r.IsErrorRetryable() +} + +func TestEnforceShouldRetryCheck(t *testing.T) { + tp := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + ResponseHeaderTimeout: 1 * time.Millisecond, + } + + client := &http.Client{Transport: tp} + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + time.Sleep(5 * time.Millisecond) + })) + + retryer := &testRetryer{} + s := awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + MaxRetries: aws.Int(0), + Endpoint: aws.String(server.URL), + DisableSSL: aws.Bool(true), + Retryer: retryer, + HTTPClient: client, + EnforceShouldRetryCheck: aws.Bool(true), + }) + + s.Handlers.Validate.Clear() + s.Handlers.Unmarshal.PushBack(unmarshal) + s.Handlers.UnmarshalError.PushBack(unmarshalError) + + out := &testData{} + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) + err := r.Send() + if err == nil { + t.Fatalf("expect error, but got nil") + } + if e, a := 3, int(r.RetryCount); e != a { + t.Errorf("expect %d retry count, got %d", e, a) + } + if !retryer.shouldRetry { + t.Errorf("expect 'true' for ShouldRetry, but got %v", retryer.shouldRetry) + } +} + +type errReader struct { + err error +} + +func (reader *errReader) Read(b []byte) (int, error) { + return 0, reader.err +} + +func (reader *errReader) Close() error { + return nil +} + +func TestLoggerNotIgnoringErrors(t *testing.T) { + s := awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + MaxRetries: aws.Int(0), + DisableSSL: aws.Bool(true), + LogLevel: aws.LogLevel(aws.LogDebugWithHTTPBody), + }) + + s.Handlers.Validate.Clear() + s.Handlers.Send.Clear() + s.Handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{StatusCode: 200, Body: &errReader{errors.New("Foo error")}} + }) + s.AddDebugHandlers() + + out := &testData{} + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) + err := r.Send() + if err == nil { + t.Error("expected error, but got nil") + } + + if aerr, ok := err.(awserr.Error); !ok { + t.Errorf("expected awserr.Error, but got different error, %v", err) + } else if aerr.Code() != request.ErrCodeRead { + t.Errorf("expected %q, but received %q", request.ErrCodeRead, aerr.Code()) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index ebd60ccc4..7af81de2a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -26,8 +26,10 @@ func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { // retryableCodes is a collection of service response codes which are retry-able // without any further action. var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "RequestTimeout": {}, + "RequestError": {}, + "RequestTimeout": {}, + ErrCodeResponseTimeout: {}, + "RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout } var throttleCodes = map[string]struct{}{ @@ -68,35 +70,85 @@ func isCodeExpiredCreds(code string) bool { return ok } +var validParentCodes = map[string]struct{}{ + ErrCodeSerialization: struct{}{}, + ErrCodeRead: struct{}{}, +} + +func isNestedErrorRetryable(parentErr awserr.Error) bool { + if parentErr == nil { + return false + } + + if _, ok := validParentCodes[parentErr.Code()]; !ok { + return false + } + + err := parentErr.OrigErr() + if err == nil { + return false + } + + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) + } + + return isErrConnectionReset(err) +} + // IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if the request has no Error set. -func (r *Request) IsErrorRetryable() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeRetryable(err.Code()) +// Returns false if error is nil. +func IsErrorRetryable(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) || isNestedErrorRetryable(aerr) } } return false } // IsErrorThrottle returns whether the error is to be throttled based on its code. -// Returns false if the request has no Error set -func (r *Request) IsErrorThrottle() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeThrottle(err.Code()) +// Returns false if error is nil. +func IsErrorThrottle(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeThrottle(aerr.Code()) } } return false } -// IsErrorExpired returns whether the error code is a credential expiry error. -// Returns false if the request has no Error set. -func (r *Request) IsErrorExpired() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeExpiredCreds(err.Code()) +// IsErrorExpiredCreds returns whether the error code is a credential expiry error. +// Returns false if error is nil. +func IsErrorExpiredCreds(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeExpiredCreds(aerr.Code()) } } return false } + +// IsErrorRetryable returns whether the error is retryable, based on its Code. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorRetryable +func (r *Request) IsErrorRetryable() bool { + return IsErrorRetryable(r.Error) +} + +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set +// +// Alias for the utility function IsErrorThrottle +func (r *Request) IsErrorThrottle() bool { + return IsErrorThrottle(r.Error) +} + +// IsErrorExpired returns whether the error code is a credential expiry error. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorExpiredCreds +func (r *Request) IsErrorExpired() bool { + return IsErrorExpiredCreds(r.Error) +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go new file mode 100644 index 000000000..09a44eb98 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go @@ -0,0 +1,94 @@ +package request + +import ( + "io" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +var timeoutErr = awserr.New( + ErrCodeResponseTimeout, + "read on body has reached the timeout limit", + nil, +) + +type readResult struct { + n int + err error +} + +// timeoutReadCloser will handle body reads that take too long. +// We will return a ErrReadTimeout error if a timeout occurs. +type timeoutReadCloser struct { + reader io.ReadCloser + duration time.Duration +} + +// Read will spin off a goroutine to call the reader's Read method. We will +// select on the timer's channel or the read's channel. Whoever completes first +// will be returned. +func (r *timeoutReadCloser) Read(b []byte) (int, error) { + timer := time.NewTimer(r.duration) + c := make(chan readResult, 1) + + go func() { + n, err := r.reader.Read(b) + timer.Stop() + c <- readResult{n: n, err: err} + }() + + select { + case data := <-c: + return data.n, data.err + case <-timer.C: + return 0, timeoutErr + } +} + +func (r *timeoutReadCloser) Close() error { + return r.reader.Close() +} + +const ( + // HandlerResponseTimeout is what we use to signify the name of the + // response timeout handler. + HandlerResponseTimeout = "ResponseTimeoutHandler" +) + +// adaptToResponseTimeoutError is a handler that will replace any top level error +// to a ErrCodeResponseTimeout, if its child is that. +func adaptToResponseTimeoutError(req *Request) { + if err, ok := req.Error.(awserr.Error); ok { + aerr, ok := err.OrigErr().(awserr.Error) + if ok && aerr.Code() == ErrCodeResponseTimeout { + req.Error = aerr + } + } +} + +// WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. +// This will allow for per read timeouts. If a timeout occurred, we will return the +// ErrCodeResponseTimeout. +// +// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) +func WithResponseReadTimeout(duration time.Duration) Option { + return func(r *Request) { + + var timeoutHandler = NamedHandler{ + HandlerResponseTimeout, + func(req *Request) { + req.HTTPResponse.Body = &timeoutReadCloser{ + reader: req.HTTPResponse.Body, + duration: duration, + } + }} + + // remove the handler so we are not stomping over any new durations. + r.Handlers.Send.RemoveByName(HandlerResponseTimeout) + r.Handlers.Send.PushBackNamed(timeoutHandler) + + r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) + r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go new file mode 100644 index 000000000..33e1b2d18 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go @@ -0,0 +1,76 @@ +package request_test + +import ( + "bytes" + "io/ioutil" + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +func BenchmarkTimeoutReadCloser(b *testing.B) { + resp := ` + { + "Bar": "qux" + } + ` + + handlers := request.Handlers{} + + handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: http.StatusOK, + Body: ioutil.NopCloser(bytes.NewBuffer([]byte(resp))), + } + }) + handlers.Sign.PushBackNamed(v4.SignRequestHandler) + handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + op := &request.Operation{ + Name: "op", + HTTPMethod: "POST", + HTTPPath: "/", + } + + meta := metadata.ClientInfo{ + ServiceName: "fooService", + SigningName: "foo", + SigningRegion: "foo", + Endpoint: "localhost", + APIVersion: "2001-01-01", + JSONVersion: "1.1", + TargetPrefix: "Foo", + } + + req := request.New( + *unit.Session.Config, + meta, + handlers, + client.DefaultRetryer{NumMaxRetries: 5}, + op, + &struct { + Foo *string + }{}, + &struct { + Bar *string + }{}, + ) + + req.ApplyOptions(request.WithResponseReadTimeout(15 * time.Second)) + for i := 0; i < b.N; i++ { + err := req.Send() + if err != nil { + b.Errorf("Expected no error, but received %v", err) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go new file mode 100644 index 000000000..c814158da --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go @@ -0,0 +1,118 @@ +package request + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +type testReader struct { + duration time.Duration + count int +} + +func (r *testReader) Read(b []byte) (int, error) { + if r.count > 0 { + r.count-- + return len(b), nil + } + time.Sleep(r.duration) + return 0, io.EOF +} + +func (r *testReader) Close() error { + return nil +} + +func TestTimeoutReadCloser(t *testing.T) { + reader := timeoutReadCloser{ + reader: &testReader{ + duration: time.Second, + count: 5, + }, + duration: time.Millisecond, + } + b := make([]byte, 100) + _, err := reader.Read(b) + if err != nil { + t.Log(err) + } +} + +func TestTimeoutReadCloserSameDuration(t *testing.T) { + reader := timeoutReadCloser{ + reader: &testReader{ + duration: time.Millisecond, + count: 5, + }, + duration: time.Millisecond, + } + b := make([]byte, 100) + _, err := reader.Read(b) + if err != nil { + t.Log(err) + } +} + +func TestWithResponseReadTimeout(t *testing.T) { + r := Request{ + HTTPResponse: &http.Response{ + Body: ioutil.NopCloser(bytes.NewReader(nil)), + }, + } + r.ApplyOptions(WithResponseReadTimeout(time.Second)) + err := r.Send() + if err != nil { + t.Error(err) + } + v, ok := r.HTTPResponse.Body.(*timeoutReadCloser) + if !ok { + t.Error("Expected the body to be a timeoutReadCloser") + } + if v.duration != time.Second { + t.Errorf("Expected %v, but receive %v\n", time.Second, v.duration) + } +} + +func TestAdaptToResponseTimeout(t *testing.T) { + testCases := []struct { + childErr error + r Request + expectedRootCode string + }{ + { + childErr: awserr.New(ErrCodeResponseTimeout, "timeout!", nil), + r: Request{ + Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout, "timeout!", nil)), + }, + expectedRootCode: ErrCodeResponseTimeout, + }, + { + childErr: awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil), + r: Request{ + Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil)), + }, + expectedRootCode: "ErrTest", + }, + { + r: Request{ + Error: awserr.New("ErrTest", "FooBar", nil), + }, + expectedRootCode: "ErrTest", + }, + } + + for i, c := range testCases { + adaptToResponseTimeoutError(&c.r) + if aerr, ok := c.r.Error.(awserr.Error); !ok { + t.Errorf("Case %d: Expected 'awserr', but received %v", i+1, c.r.Error) + } else if aerr.Code() != c.expectedRootCode { + t.Errorf("Case %d: Expected %q, but received %s", i+1, c.expectedRootCode, aerr.Code()) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go new file mode 100644 index 000000000..854b0854a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go @@ -0,0 +1,287 @@ +package request + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/awsutil" +) + +// WaiterResourceNotReadyErrorCode is the error code returned by a waiter when +// the waiter's max attempts have been exhausted. +const WaiterResourceNotReadyErrorCode = "ResourceNotReady" + +// A WaiterOption is a function that will update the Waiter value's fields to +// configure the waiter. +type WaiterOption func(*Waiter) + +// WithWaiterMaxAttempts returns the maximum number of times the waiter should +// attempt to check the resource for the target state. +func WithWaiterMaxAttempts(max int) WaiterOption { + return func(w *Waiter) { + w.MaxAttempts = max + } +} + +// WaiterDelay will return a delay the waiter should pause between attempts to +// check the resource state. The passed in attempt is the number of times the +// Waiter has checked the resource state. +// +// Attempt is the number of attempts the Waiter has made checking the resource +// state. +type WaiterDelay func(attempt int) time.Duration + +// ConstantWaiterDelay returns a WaiterDelay that will always return a constant +// delay the waiter should use between attempts. It ignores the number of +// attempts made. +func ConstantWaiterDelay(delay time.Duration) WaiterDelay { + return func(attempt int) time.Duration { + return delay + } +} + +// WithWaiterDelay will set the Waiter to use the WaiterDelay passed in. +func WithWaiterDelay(delayer WaiterDelay) WaiterOption { + return func(w *Waiter) { + w.Delay = delayer + } +} + +// WithWaiterLogger returns a waiter option to set the logger a waiter +// should use to log warnings and errors to. +func WithWaiterLogger(logger aws.Logger) WaiterOption { + return func(w *Waiter) { + w.Logger = logger + } +} + +// WithWaiterRequestOptions returns a waiter option setting the request +// options for each request the waiter makes. Appends to waiter's request +// options already set. +func WithWaiterRequestOptions(opts ...Option) WaiterOption { + return func(w *Waiter) { + w.RequestOptions = append(w.RequestOptions, opts...) + } +} + +// A Waiter provides the functionality to performing blocking call which will +// wait for an resource state to be satisfied a service. +// +// This type should not be used directly. The API operations provided in the +// service packages prefixed with "WaitUntil" should be used instead. +type Waiter struct { + Name string + Acceptors []WaiterAcceptor + Logger aws.Logger + + MaxAttempts int + Delay WaiterDelay + + RequestOptions []Option + NewRequest func([]Option) (*Request, error) +} + +// ApplyOptions updates the waiter with the list of waiter options provided. +func (w *Waiter) ApplyOptions(opts ...WaiterOption) { + for _, fn := range opts { + fn(w) + } +} + +// WaiterState are states the waiter uses based on WaiterAcceptor definitions +// to identify if the resource state the waiter is waiting on has occurred. +type WaiterState int + +// String returns the string representation of the waiter state. +func (s WaiterState) String() string { + switch s { + case SuccessWaiterState: + return "success" + case FailureWaiterState: + return "failure" + case RetryWaiterState: + return "retry" + default: + return "unknown waiter state" + } +} + +// States the waiter acceptors will use to identify target resource states. +const ( + SuccessWaiterState WaiterState = iota // waiter successful + FailureWaiterState // waiter failed + RetryWaiterState // waiter needs to be retried +) + +// WaiterMatchMode is the mode that the waiter will use to match the WaiterAcceptor +// definition's Expected attribute. +type WaiterMatchMode int + +// Modes the waiter will use when inspecting API response to identify target +// resource states. +const ( + PathAllWaiterMatch WaiterMatchMode = iota // match on all paths + PathWaiterMatch // match on specific path + PathAnyWaiterMatch // match on any path + PathListWaiterMatch // match on list of paths + StatusWaiterMatch // match on status code + ErrorWaiterMatch // match on error +) + +// String returns the string representation of the waiter match mode. +func (m WaiterMatchMode) String() string { + switch m { + case PathAllWaiterMatch: + return "pathAll" + case PathWaiterMatch: + return "path" + case PathAnyWaiterMatch: + return "pathAny" + case PathListWaiterMatch: + return "pathList" + case StatusWaiterMatch: + return "status" + case ErrorWaiterMatch: + return "error" + default: + return "unknown waiter match mode" + } +} + +// WaitWithContext will make requests for the API operation using NewRequest to +// build API requests. The request's response will be compared against the +// Waiter's Acceptors to determine the successful state of the resource the +// waiter is inspecting. +// +// The passed in context must not be nil. If it is nil a panic will occur. The +// Context will be used to cancel the waiter's pending requests and retry delays. +// Use aws.BackgroundContext if no context is available. +// +// The waiter will continue until the target state defined by the Acceptors, +// or the max attempts expires. +// +// Will return the WaiterResourceNotReadyErrorCode error code if the waiter's +// retryer ShouldRetry returns false. This normally will happen when the max +// wait attempts expires. +func (w Waiter) WaitWithContext(ctx aws.Context) error { + + for attempt := 1; ; attempt++ { + req, err := w.NewRequest(w.RequestOptions) + if err != nil { + waiterLogf(w.Logger, "unable to create request %v", err) + return err + } + req.Handlers.Build.PushBack(MakeAddToUserAgentFreeFormHandler("Waiter")) + err = req.Send() + + // See if any of the acceptors match the request's response, or error + for _, a := range w.Acceptors { + if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched { + return matchErr + } + } + + // The Waiter should only check the resource state MaxAttempts times + // This is here instead of in the for loop above to prevent delaying + // unnecessary when the waiter will not retry. + if attempt == w.MaxAttempts { + break + } + + // Delay to wait before inspecting the resource again + delay := w.Delay(attempt) + if sleepFn := req.Config.SleepDelay; sleepFn != nil { + // Support SleepDelay for backwards compatibility and testing + sleepFn(delay) + } else if err := aws.SleepWithContext(ctx, delay); err != nil { + return awserr.New(CanceledErrorCode, "waiter context canceled", err) + } + } + + return awserr.New(WaiterResourceNotReadyErrorCode, "exceeded wait attempts", nil) +} + +// A WaiterAcceptor provides the information needed to wait for an API operation +// to complete. +type WaiterAcceptor struct { + State WaiterState + Matcher WaiterMatchMode + Argument string + Expected interface{} +} + +// match returns if the acceptor found a match with the passed in request +// or error. True is returned if the acceptor made a match, error is returned +// if there was an error attempting to perform the match. +func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err error) (bool, error) { + result := false + var vals []interface{} + + switch a.Matcher { + case PathAllWaiterMatch, PathWaiterMatch: + // Require all matches to be equal for result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + if len(vals) == 0 { + break + } + result = true + for _, val := range vals { + if !awsutil.DeepEqual(val, a.Expected) { + result = false + break + } + } + case PathAnyWaiterMatch: + // Only a single match needs to equal for the result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + for _, val := range vals { + if awsutil.DeepEqual(val, a.Expected) { + result = true + break + } + } + case PathListWaiterMatch: + // ignored matcher + case StatusWaiterMatch: + s := a.Expected.(int) + result = s == req.HTTPResponse.StatusCode + case ErrorWaiterMatch: + if aerr, ok := err.(awserr.Error); ok { + result = aerr.Code() == a.Expected.(string) + } + default: + waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s", + name, a.Matcher) + } + + if !result { + // If there was no matching result found there is nothing more to do + // for this response, retry the request. + return false, nil + } + + switch a.State { + case SuccessWaiterState: + // waiter completed + return true, nil + case FailureWaiterState: + // Waiter failure state triggered + return true, awserr.New(WaiterResourceNotReadyErrorCode, + "failed waiting for successful resource state", err) + case RetryWaiterState: + // clear the error and retry the operation + return false, nil + default: + waiterLogf(l, "WARNING: Waiter %s encountered unexpected state: %s", + name, a.State) + return false, nil + } +} + +func waiterLogf(logger aws.Logger, msg string, args ...interface{}) { + if logger != nil { + logger.Log(fmt.Sprintf(msg, args...)) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go new file mode 100644 index 000000000..f49901b97 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go @@ -0,0 +1,636 @@ +package request_test + +import ( + "bytes" + "fmt" + "io/ioutil" + "net/http" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/service/s3" +) + +type mockClient struct { + *client.Client +} +type MockInput struct{} +type MockOutput struct { + States []*MockState +} +type MockState struct { + State *string +} + +func (c *mockClient) MockRequest(input *MockInput) (*request.Request, *MockOutput) { + op := &request.Operation{ + Name: "Mock", + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &MockInput{} + } + + output := &MockOutput{} + req := c.NewRequest(op, input, output) + req.Data = output + return req, output +} + +func BuildNewMockRequest(c *mockClient, in *MockInput) func([]request.Option) (*request.Request, error) { + return func(opts []request.Option) (*request.Request, error) { + req, _ := c.MockRequest(in) + req.ApplyOptions(opts...) + return req, nil + } +} + +func TestWaiterPathAll(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("pending")}, + }, + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("running")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + w := request.Waiter{ + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, + Argument: "States[].State", + Expected: "running", + }, + }, + NewRequest: BuildNewMockRequest(svc, &MockInput{}), + } + + err := w.WaitWithContext(aws.BackgroundContext()) + assert.NoError(t, err) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterPath(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("pending")}, + }, + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("running")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + w := request.Waiter{ + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, + Argument: "States[].State", + Expected: "running", + }, + }, + NewRequest: BuildNewMockRequest(svc, &MockInput{}), + } + + err := w.WaitWithContext(aws.BackgroundContext()) + assert.NoError(t, err) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterFailure(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 2 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("pending")}, + }, + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("stopping")}, + }, + }, + } + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + + w := request.Waiter{ + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, + Argument: "States[].State", + Expected: "running", + }, + { + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, + Argument: "States[].State", + Expected: "stopping", + }, + }, + NewRequest: BuildNewMockRequest(svc, &MockInput{}), + } + + err := w.WaitWithContext(aws.BackgroundContext()).(awserr.Error) + assert.Error(t, err) + assert.Equal(t, request.WaiterResourceNotReadyErrorCode, err.Code()) + assert.Equal(t, "failed waiting for successful resource state", err.Message()) + assert.Equal(t, 3, numBuiltReq) + assert.Equal(t, 3, reqNum) +} + +func TestWaiterError(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.UnmarshalError.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + resps := []*MockOutput{ + { // Request 1 + States: []*MockState{ + {State: aws.String("pending")}, + {State: aws.String("pending")}, + }, + }, + { // Request 1, error case retry + }, + { // Request 2, error case failure + }, + { // Request 3 + States: []*MockState{ + {State: aws.String("running")}, + {State: aws.String("running")}, + }, + }, + } + reqErrs := make([]error, len(resps)) + reqErrs[1] = awserr.New("MockException", "mock exception message", nil) + reqErrs[2] = awserr.New("FailureException", "mock failure exception message", nil) + + numBuiltReq := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + numBuiltReq++ + }) + svc.Handlers.Send.PushBack(func(r *request.Request) { + code := 200 + if reqNum == 1 { + code = 400 + } + r.HTTPResponse = &http.Response{ + StatusCode: code, + Status: http.StatusText(code), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + }) + svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { + if reqNum >= len(resps) { + assert.Fail(t, "too many polling requests made") + return + } + r.Data = resps[reqNum] + reqNum++ + }) + svc.Handlers.UnmarshalMeta.PushBack(func(r *request.Request) { + // If there was an error unmarshal error will be called instead of unmarshal + // need to increment count here also + if err := reqErrs[reqNum]; err != nil { + r.Error = err + reqNum++ + } + }) + + w := request.Waiter{ + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, + Argument: "States[].State", + Expected: "running", + }, + { + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, + Argument: "", + Expected: "MockException", + }, + { + State: request.FailureWaiterState, + Matcher: request.ErrorWaiterMatch, + Argument: "", + Expected: "FailureException", + }, + }, + NewRequest: BuildNewMockRequest(svc, &MockInput{}), + } + + err := w.WaitWithContext(aws.BackgroundContext()) + if err == nil { + t.Fatalf("expected error, but did not get one") + } + aerr := err.(awserr.Error) + if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := 3, numBuiltReq; e != a { + t.Errorf("expect %d built requests got %d", e, a) + } + if e, a := 3, reqNum; e != a { + t.Errorf("expect %d reqNum got %d", e, a) + } +} + +func TestWaiterStatus(t *testing.T) { + svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ + Region: aws.String("mock-region"), + })} + svc.Handlers.Send.Clear() // mock sending + svc.Handlers.Unmarshal.Clear() + svc.Handlers.UnmarshalMeta.Clear() + svc.Handlers.ValidateResponse.Clear() + + reqNum := 0 + svc.Handlers.Build.PushBack(func(r *request.Request) { + reqNum++ + }) + svc.Handlers.Send.PushBack(func(r *request.Request) { + code := 200 + if reqNum == 3 { + code = 404 + r.Error = awserr.New("NotFound", "Not Found", nil) + } + r.HTTPResponse = &http.Response{ + StatusCode: code, + Status: http.StatusText(code), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + }) + + w := request.Waiter{ + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(0), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, + Argument: "", + Expected: 404, + }, + }, + NewRequest: BuildNewMockRequest(svc, &MockInput{}), + } + + err := w.WaitWithContext(aws.BackgroundContext()) + assert.NoError(t, err) + assert.Equal(t, 3, reqNum) +} + +func TestWaiter_ApplyOptions(t *testing.T) { + w := request.Waiter{} + + logger := aws.NewDefaultLogger() + + w.ApplyOptions( + request.WithWaiterLogger(logger), + request.WithWaiterRequestOptions(request.WithLogLevel(aws.LogDebug)), + request.WithWaiterMaxAttempts(2), + request.WithWaiterDelay(request.ConstantWaiterDelay(5*time.Second)), + ) + + if e, a := logger, w.Logger; e != a { + t.Errorf("expect logger to be set, and match, was not, %v, %v", e, a) + } + + if len(w.RequestOptions) != 1 { + t.Fatalf("expect request options to be set to only a single option, %v", w.RequestOptions) + } + r := request.Request{} + r.ApplyOptions(w.RequestOptions...) + if e, a := aws.LogDebug, r.Config.LogLevel.Value(); e != a { + t.Errorf("expect %v loglevel got %v", e, a) + } + + if e, a := 2, w.MaxAttempts; e != a { + t.Errorf("expect %d retryer max attempts, got %d", e, a) + } + if e, a := 5*time.Second, w.Delay(0); e != a { + t.Errorf("expect %d retryer delay, got %d", e, a) + } +} + +func TestWaiter_WithContextCanceled(t *testing.T) { + c := awstesting.NewClient() + + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + reqCount := 0 + + w := request.Waiter{ + Name: "TestWaiter", + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, + Expected: 200, + }, + }, + Logger: aws.NewDefaultLogger(), + NewRequest: func(opts []request.Option) (*request.Request, error) { + req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + req.HTTPResponse = &http.Response{StatusCode: http.StatusNotFound} + req.Handlers.Clear() + req.Data = struct{}{} + req.Handlers.Send.PushBack(func(r *request.Request) { + if reqCount == 1 { + ctx.Error = fmt.Errorf("context canceled") + close(ctx.DoneCh) + } + reqCount++ + }) + + return req, nil + }, + } + + err := w.WaitWithContext(ctx) + + if err == nil { + t.Fatalf("expect waiter to be canceled.") + } + aerr := err.(awserr.Error) + if e, a := request.CanceledErrorCode, aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := 2, reqCount; e != a { + t.Errorf("expect %d requests, got %d", e, a) + } +} + +func TestWaiter_WithContext(t *testing.T) { + c := awstesting.NewClient() + + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + reqCount := 0 + + statuses := []int{http.StatusNotFound, http.StatusOK} + + w := request.Waiter{ + Name: "TestWaiter", + MaxAttempts: 10, + Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, + Expected: 200, + }, + }, + Logger: aws.NewDefaultLogger(), + NewRequest: func(opts []request.Option) (*request.Request, error) { + req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + req.HTTPResponse = &http.Response{StatusCode: statuses[reqCount]} + req.Handlers.Clear() + req.Data = struct{}{} + req.Handlers.Send.PushBack(func(r *request.Request) { + if reqCount == 1 { + ctx.Error = fmt.Errorf("context canceled") + close(ctx.DoneCh) + } + reqCount++ + }) + + return req, nil + }, + } + + err := w.WaitWithContext(ctx) + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := 2, reqCount; e != a { + t.Errorf("expect %d requests, got %d", e, a) + } +} + +func TestWaiter_AttemptsExpires(t *testing.T) { + c := awstesting.NewClient() + + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + reqCount := 0 + + w := request.Waiter{ + Name: "TestWaiter", + MaxAttempts: 2, + Delay: request.ConstantWaiterDelay(1 * time.Millisecond), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, + Expected: 200, + }, + }, + Logger: aws.NewDefaultLogger(), + NewRequest: func(opts []request.Option) (*request.Request, error) { + req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + req.HTTPResponse = &http.Response{StatusCode: http.StatusNotFound} + req.Handlers.Clear() + req.Data = struct{}{} + req.Handlers.Send.PushBack(func(r *request.Request) { + reqCount++ + }) + + return req, nil + }, + } + + err := w.WaitWithContext(ctx) + + if err == nil { + t.Fatalf("expect error did not get one") + } + aerr := err.(awserr.Error) + if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + if e, a := 2, reqCount; e != a { + t.Errorf("expect %d requests, got %d", e, a) + } +} + +func TestWaiterNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: http.StatusOK, + } + }) + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + client.Config.SleepDelay = func(dur time.Duration) {} + + // Ensure waiters do not panic on nil input. It doesn't make sense to + // call a waiter without an input, Validation will + err := client.WaitUntilBucketExists(nil) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } +} + +func TestWaiterWithContextNilInput(t *testing.T) { + // Code generation doesn't have a great way to verify the code is correct + // other than being run via unit tests in the SDK. This should be fixed + // So code generation can be validated independently. + + client := s3.New(unit.Session) + client.Handlers.Validate.Clear() + client.Handlers.Send.Clear() // mock sending + client.Handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: http.StatusOK, + } + }) + client.Handlers.Unmarshal.Clear() + client.Handlers.UnmarshalMeta.Clear() + client.Handlers.ValidateResponse.Clear() + + // Ensure waiters do not panic on nil input + ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} + err := client.WaitUntilBucketExistsWithContext(ctx, nil, + request.WithWaiterDelay(request.ConstantWaiterDelay(0)), + request.WithWaiterMaxAttempts(1), + ) + if err != nil { + t.Fatalf("expect no error, but got %v", err) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go new file mode 100644 index 000000000..8a5a3a04e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go @@ -0,0 +1,319 @@ +package session + +import ( + "bytes" + "crypto/tls" + "io/ioutil" + "net" + "net/http" + "net/http/httptest" + "os" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/stretchr/testify/assert" +) + +func createTLSServer(cert, key []byte, done <-chan struct{}) (*httptest.Server, error) { + c, err := tls.X509KeyPair(cert, key) + if err != nil { + return nil, err + } + + s := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + })) + s.TLS = &tls.Config{ + Certificates: []tls.Certificate{c}, + } + s.TLS.BuildNameToCertificate() + s.StartTLS() + + go func() { + <-done + s.Close() + }() + + return s, nil +} + +func setupTestCAFile(b []byte) (string, error) { + bundleFile, err := ioutil.TempFile(os.TempDir(), "aws-sdk-go-session-test") + if err != nil { + return "", err + } + + _, err = bundleFile.Write(b) + if err != nil { + return "", err + } + + defer bundleFile.Close() + return bundleFile.Name(), nil +} + +func TestNewSession_WithCustomCABundle_Env(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + done := make(chan struct{}) + server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) + assert.NoError(t, err) + + // Write bundle to file + caFilename, err := setupTestCAFile(testTLSBundleCA) + defer func() { + os.Remove(caFilename) + }() + assert.NoError(t, err) + + os.Setenv("AWS_CA_BUNDLE", caFilename) + + s, err := NewSession(&aws.Config{ + HTTPClient: &http.Client{}, + Endpoint: aws.String(server.URL), + Region: aws.String("mock-region"), + Credentials: credentials.AnonymousCredentials, + }) + assert.NoError(t, err) + assert.NotNil(t, s) + + req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) + resp, err := s.Config.HTTPClient.Do(req) + assert.NoError(t, err) + + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + +func TestNewSession_WithCustomCABundle_EnvNotExists(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_CA_BUNDLE", "file-not-exists") + + s, err := NewSession() + assert.Error(t, err) + assert.Equal(t, "LoadCustomCABundleError", err.(awserr.Error).Code()) + assert.Nil(t, s) +} + +func TestNewSession_WithCustomCABundle_Option(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + done := make(chan struct{}) + server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) + assert.NoError(t, err) + + s, err := NewSessionWithOptions(Options{ + Config: aws.Config{ + HTTPClient: &http.Client{}, + Endpoint: aws.String(server.URL), + Region: aws.String("mock-region"), + Credentials: credentials.AnonymousCredentials, + }, + CustomCABundle: bytes.NewReader(testTLSBundleCA), + }) + assert.NoError(t, err) + assert.NotNil(t, s) + + req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) + resp, err := s.Config.HTTPClient.Do(req) + assert.NoError(t, err) + + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + +func TestNewSession_WithCustomCABundle_OptionPriority(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + done := make(chan struct{}) + server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) + assert.NoError(t, err) + + os.Setenv("AWS_CA_BUNDLE", "file-not-exists") + + s, err := NewSessionWithOptions(Options{ + Config: aws.Config{ + HTTPClient: &http.Client{}, + Endpoint: aws.String(server.URL), + Region: aws.String("mock-region"), + Credentials: credentials.AnonymousCredentials, + }, + CustomCABundle: bytes.NewReader(testTLSBundleCA), + }) + assert.NoError(t, err) + assert.NotNil(t, s) + + req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) + resp, err := s.Config.HTTPClient.Do(req) + assert.NoError(t, err) + + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + +type mockRoundTripper struct{} + +func (m *mockRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { + return nil, nil +} + +func TestNewSession_WithCustomCABundle_UnsupportedTransport(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + s, err := NewSessionWithOptions(Options{ + Config: aws.Config{ + HTTPClient: &http.Client{ + Transport: &mockRoundTripper{}, + }, + }, + CustomCABundle: bytes.NewReader(testTLSBundleCA), + }) + assert.Error(t, err) + assert.Equal(t, "LoadCustomCABundleError", err.(awserr.Error).Code()) + assert.Contains(t, err.(awserr.Error).Message(), "transport unsupported type") + assert.Nil(t, s) +} + +func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + done := make(chan struct{}) + server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) + assert.NoError(t, err) + + s, err := NewSessionWithOptions(Options{ + Config: aws.Config{ + Endpoint: aws.String(server.URL), + Region: aws.String("mock-region"), + Credentials: credentials.AnonymousCredentials, + HTTPClient: &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + DualStack: true, + }).Dial, + TLSHandshakeTimeout: 2 * time.Second, + }, + }, + }, + CustomCABundle: bytes.NewReader(testTLSBundleCA), + }) + assert.NoError(t, err) + assert.NotNil(t, s) + + req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) + resp, err := s.Config.HTTPClient.Do(req) + assert.NoError(t, err) + + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + +/* Cert generation steps +# Create the CA key +openssl genrsa -des3 -out ca.key 1024 + +# Create the CA Cert +openssl req -new -sha256 -x509 -days 3650 \ + -subj "/C=GO/ST=Gopher/O=Testing ROOT CA" \ + -key ca.key -out ca.crt + +# Create config +cat > csr_details.txt <<-EOF + +[req] +default_bits = 1024 +prompt = no +default_md = sha256 +req_extensions = SAN +distinguished_name = dn + +[ dn ] +C=GO +ST=Gopher +O=Testing Certificate +OU=Testing IP + +[SAN] +subjectAltName = IP:127.0.0.1 +EOF + +# Create certificate signing request +openssl req -new -sha256 -nodes -newkey rsa:1024 \ + -config <( cat csr_details.txt ) \ + -keyout ia.key -out ia.csr + +# Create a signed certificate +openssl x509 -req -days 3650 \ + -CAcreateserial \ + -extfile <( cat csr_details.txt ) \ + -extensions SAN \ + -CA ca.crt -CAkey ca.key -in ia.csr -out ia.crt + +# Verify +openssl req -noout -text -in ia.csr +openssl x509 -noout -text -in ia.crt +*/ +var ( + // ca.crt + testTLSBundleCA = []byte(`-----BEGIN CERTIFICATE----- +MIICiTCCAfKgAwIBAgIJAJ5X1olt05XjMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QTAeFw0xNzAzMDkwMDAyMDZaFw0yNzAzMDcwMDAyMDZaMDgxCzAJBgNVBAYTAkdP +MQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBDQTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw/8DN+t9XQR60jx42rsQ2WE2Dx85rb3n +GQxnKZZLNddsT8rDyxJNP18aFalbRbFlyln5fxWxZIblu9Xkm/HRhOpbSimSqo1y +uDx21NVZ1YsOvXpHby71jx3gPrrhSc/t/zikhi++6D/C6m1CiIGuiJ0GBiJxtrub +UBMXT0QtI2ECAwEAAaOBmjCBlzAdBgNVHQ4EFgQU8XG3X/YHBA6T04kdEkq6+4GV +YykwaAYDVR0jBGEwX4AU8XG3X/YHBA6T04kdEkq6+4GVYymhPKQ6MDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QYIJAJ5X1olt05XjMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADgYEAeILv +z49+uxmPcfOZzonuOloRcpdvyjiXblYxbzz6ch8GsE7Q886FTZbvwbgLhzdwSVgG +G8WHkodDUsymVepdqAamS3f8PdCUk8xIk9mop8LgaB9Ns0/TssxDvMr3sOD2Grb3 +xyWymTWMcj6uCiEBKtnUp4rPiefcvCRYZ17/hLE= +-----END CERTIFICATE----- +`) + + // ai.crt + testTLSBundleCert = []byte(`-----BEGIN CERTIFICATE----- +MIICGjCCAYOgAwIBAgIJAIIu+NOoxxM0MA0GCSqGSIb3DQEBBQUAMDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QTAeFw0xNzAzMDkwMDAzMTRaFw0yNzAzMDcwMDAzMTRaMFExCzAJBgNVBAYTAkdP +MQ8wDQYDVQQIDAZHb3BoZXIxHDAaBgNVBAoME1Rlc3RpbmcgQ2VydGlmaWNhdGUx +EzARBgNVBAsMClRlc3RpbmcgSVAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AN1hWHeioo/nASvbrjwCQzXCiWiEzGkw353NxsAB54/NqDL3LXNATtiSJu8kJBrm +Ah12IFLtWLGXjGjjYlHbQWnOR6awveeXnQZukJyRWh7m/Qlt9Ho0CgZE1U+832ac +5GWVldNxW1Lz4I+W9/ehzqe8I80RS6eLEKfUFXGiW+9RAgMBAAGjEzARMA8GA1Ud +EQQIMAaHBH8AAAEwDQYJKoZIhvcNAQEFBQADgYEAdF4WQHfVdPCbgv9sxgJjcR1H +Hgw9rZ47gO1IiIhzglnLXQ6QuemRiHeYFg4kjcYBk1DJguxzDTGnUwhUXOibAB+S +zssmrkdYYvn9aUhjc3XK3tjAoDpsPpeBeTBamuUKDHoH/dNRXxerZ8vu6uPR3Pgs +5v/KCV6IAEcvNyOXMPo= +-----END CERTIFICATE----- +`) + + // ai.key + testTLSBundleKey = []byte(`-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDdYVh3oqKP5wEr2648AkM1wolohMxpMN+dzcbAAeePzagy9y1z +QE7YkibvJCQa5gIddiBS7Vixl4xo42JR20FpzkemsL3nl50GbpCckVoe5v0JbfR6 +NAoGRNVPvN9mnORllZXTcVtS8+CPlvf3oc6nvCPNEUunixCn1BVxolvvUQIDAQAB +AoGBAMISrcirddGrlLZLLrKC1ULS2T0cdkqdQtwHYn4+7S5+/z42vMx1iumHLsSk +rVY7X41OWkX4trFxhvEIrc/O48bo2zw78P7flTxHy14uxXnllU8cLThE29SlUU7j +AVBNxJZMsXMlS/DowwD4CjFe+x4Pu9wZcReF2Z9ntzMpySABAkEA+iWoJCPE2JpS +y78q3HYYgpNY3gF3JqQ0SI/zTNkb3YyEIUffEYq0Y9pK13HjKtdsSuX4osTIhQkS ++UgRp6tCAQJBAOKPYTfQ2FX8ijgUpHZRuEAVaxASAS0UATiLgzXxLvOh/VC2at5x +wjOX6sD65pPz/0D8Qj52Cq6Q1TQ+377SDVECQAIy0od+yPweXxvrUjUd1JlRMjbB +TIrKZqs8mKbUQapw0bh5KTy+O1elU4MRPS3jNtBxtP25PQnuSnxmZcFTgAECQFzg +DiiFcsn9FuRagfkHExMiNJuH5feGxeFaP9WzI144v9GAllrOI6Bm3JNzx2ZLlg4b +20Qju8lIEj6yr6JYFaECQHM1VSojGRKpOl9Ox/R4yYSA9RV5Gyn00/aJNxVYyPD5 +i3acL2joQm2kLD/LO8paJ4+iQdRXCOMMIpjxSNjGQjQ= +-----END RSA PRIVATE KEY----- +`) +) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go index 9975e320c..2fe35e74d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -23,7 +23,7 @@ additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. Alternatively you can explicitly create a Session with shared config enabled. To do this you can use NewSessionWithOptions to configure how the Session will be created. Using the NewSessionWithOptions with SharedConfigState set to -SharedConfigEnabled will create the session as if the AWS_SDK_LOAD_CONFIG +SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG environment variable was set. Creating Sessions @@ -84,7 +84,7 @@ override the shared config state (AWS_SDK_LOAD_CONFIG). // Force enable Shared Config support sess := session.Must(session.NewSessionWithOptions(session.Options{ - SharedConfigState: SharedConfigEnable, + SharedConfigState: session.SharedConfigEnable, })) Adding Handlers @@ -96,7 +96,7 @@ 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 := session.Must(session.NewSession()) - + sess.Handlers.Send.PushFront(func(r *request.Request) { // Log every request made and its payload logger.Println("Request: %s/%s, Payload: %s", @@ -169,8 +169,8 @@ session option must be set to SharedConfigEnable, or AWS_SDK_LOAD_CONFIG environment variable set. The shared configuration instructs the SDK to assume an IAM role with MFA -when the mfa_serial configuration field is set in the shared config -(~/.aws/config) or shared credentials (~/.aws/credentials) file. +when the mfa_serial configuration field is set in the shared config +(~/.aws/config) or shared credentials (~/.aws/credentials) file. If mfa_serial is set in the configuration, the SDK will assume the role, and the AssumeRoleTokenProvider session option is not set an an error will @@ -251,6 +251,24 @@ $HOME/.aws/config on Linux/Unix based systems, and AWS_CONFIG_FILE=$HOME/my_shared_config +Path to a custom Credentials Authority (CA) bundle PEM file that the SDK +will use instead of the default system's root CA bundle. Use this only +if you want to replace the CA bundle the SDK uses for TLS requests. + + AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle + +Enabling this option will attempt to merge the Transport into the SDK's HTTP +client. If the client's Transport is not a http.Transport an error will be +returned. If the Transport's TLS config is set this option will cause the SDK +to overwrite the Transport's TLS config's RootCAs value. If the CA bundle file +contains multiple certificates all of them will be loaded. + +The Session option CustomCABundle is also available when creating sessions +to also enable this feature. CustomCABundle session option field has priority +over the AWS_CA_BUNDLE environment variable, and will be used if both are set. +Setting a custom HTTPClient in the aws.Config options will override this setting. +To use this option and custom HTTP client, the HTTP client needs to be provided +when creating the session. Not the service client. */ 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 index d2f0c8448..e6278a782 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -75,6 +75,24 @@ type envConfig struct { // // AWS_CONFIG_FILE=$HOME/my_shared_config SharedConfigFile string + + // Sets the path to a custom Credentials Authroity (CA) Bundle PEM file + // that the SDK will use instead of the the system's root CA bundle. + // Only use this if you want to configure the SDK to use a custom set + // of CAs. + // + // Enabling this option will attempt to merge the Transport + // into the SDK's HTTP client. If the client's Transport is + // not a http.Transport an error will be returned. If the + // Transport's TLS config is set this option will cause the + // SDK to overwrite the Transport's TLS config's RootCAs value. + // + // Setting a custom HTTPClient in the aws.Config options will override this setting. + // To use this option and custom HTTP client, the HTTP client needs to be provided + // when creating the session. Not the service client. + // + // AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle + CustomCABundle string } var ( @@ -150,6 +168,8 @@ func envConfigLoad(enableSharedConfig bool) envConfig { cfg.SharedCredentialsFile = sharedCredentialsFilename() cfg.SharedConfigFile = sharedConfigFilename() + cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE") + return cfg } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go index 5a6aa7d87..162a71054 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go @@ -94,6 +94,7 @@ func TestLoadEnvConfig(t *testing.T) { cases := []struct { Env map[string]string Region, Profile string + CustomCABundle string UseSharedConfigCall bool }{ { @@ -182,6 +183,19 @@ func TestLoadEnvConfig(t *testing.T) { Region: "default_region", Profile: "default_profile", UseSharedConfigCall: true, }, + { + Env: map[string]string{ + "AWS_CA_BUNDLE": "custom_ca_bundle", + }, + CustomCABundle: "custom_ca_bundle", + }, + { + Env: map[string]string{ + "AWS_CA_BUNDLE": "custom_ca_bundle", + }, + CustomCABundle: "custom_ca_bundle", + UseSharedConfigCall: true, + }, } for _, c := range cases { @@ -200,6 +214,7 @@ func TestLoadEnvConfig(t *testing.T) { assert.Equal(t, c.Region, cfg.Region) assert.Equal(t, c.Profile, cfg.Profile) + assert.Equal(t, c.CustomCABundle, cfg.CustomCABundle) } } 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 42ab3632e..4792d3ae8 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,7 +1,13 @@ package session import ( + "crypto/tls" + "crypto/x509" "fmt" + "io" + "io/ioutil" + "net/http" + "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" @@ -92,9 +98,10 @@ func New(cfgs ...*aws.Config) *Session { // control through code how the Session will be created. Such as specifying the // config profile, and controlling if shared config is enabled or not. func NewSession(cfgs ...*aws.Config) (*Session, error) { - envCfg := loadEnvConfig() + opts := Options{} + opts.Config.MergeIn(cfgs...) - return newSession(Options{}, envCfg, cfgs...) + return NewSessionWithOptions(opts) } // SharedConfigState provides the ability to optionally override the state @@ -167,6 +174,21 @@ type Options struct { // This field is only used if the shared configuration is enabled, and // the config enables assume role wit MFA via the mfa_serial field. AssumeRoleTokenProvider func() (string, error) + + // Reader for a custom Credentials Authority (CA) bundle in PEM format that + // the SDK will use instead of the default system's root CA bundle. Use this + // only if you want to replace the CA bundle the SDK uses for TLS requests. + // + // Enabling this option will attempt to merge the Transport into the SDK's HTTP + // client. If the client's Transport is not a http.Transport an error will be + // returned. If the Transport's TLS config is set this option will cause the SDK + // to overwrite the Transport's TLS config's RootCAs value. If the CA + // bundle reader contains multiple certificates all of them will be loaded. + // + // The Session option CustomCABundle is also available when creating sessions + // to also enable this feature. CustomCABundle session option field has priority + // over the AWS_CA_BUNDLE environment variable, and will be used if both are set. + CustomCABundle io.Reader } // NewSessionWithOptions returns a new Session created from SDK defaults, config files, @@ -196,7 +218,7 @@ type Options struct { // // // Force enable Shared Config support // sess := session.Must(session.NewSessionWithOptions(session.Options{ -// SharedConfigState: SharedConfigEnable, +// SharedConfigState: session.SharedConfigEnable, // })) func NewSessionWithOptions(opts Options) (*Session, error) { var envCfg envConfig @@ -217,6 +239,17 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg.EnableSharedConfig = true } + // Only use AWS_CA_BUNDLE if session option is not provided. + if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { + f, err := os.Open(envCfg.CustomCABundle) + if err != nil { + return nil, awserr.New("LoadCustomCABundleError", + "failed to open custom CA bundle PEM file", err) + } + defer f.Close() + opts.CustomCABundle = f + } + return newSession(opts, envCfg, &opts.Config) } @@ -297,9 +330,61 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, initHandlers(s) + // Setup HTTP client with custom cert bundle if enabled + if opts.CustomCABundle != nil { + if err := loadCustomCABundle(s, opts.CustomCABundle); err != nil { + return nil, err + } + } + return s, nil } +func loadCustomCABundle(s *Session, bundle io.Reader) error { + var t *http.Transport + switch v := s.Config.HTTPClient.Transport.(type) { + case *http.Transport: + t = v + default: + if s.Config.HTTPClient.Transport != nil { + return awserr.New("LoadCustomCABundleError", + "unable to load custom CA bundle, HTTPClient's transport unsupported type", nil) + } + } + if t == nil { + t = &http.Transport{} + } + + p, err := loadCertPool(bundle) + if err != nil { + return err + } + if t.TLSClientConfig == nil { + t.TLSClientConfig = &tls.Config{} + } + t.TLSClientConfig.RootCAs = p + + s.Config.HTTPClient.Transport = t + + return nil +} + +func loadCertPool(r io.Reader) (*x509.CertPool, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, awserr.New("LoadCustomCABundleError", + "failed to read custom CA bundle PEM file", err) + } + + p := x509.NewCertPool() + if !p.AppendCertsFromPEM(b) { + return nil, awserr.New("LoadCustomCABundleError", + "failed to load custom CA bundle PEM file", err) + } + + return p, nil +} + func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { // Merge in user provided configuration cfg.MergeIn(userCfg) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go new file mode 100644 index 000000000..6aa2ed241 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go @@ -0,0 +1,7 @@ +package v4 + +// WithUnsignedPayload will enable and set the UnsignedPayload field to +// true of the signer. +func WithUnsignedPayload(v4 *Signer) { + v4.UnsignedPayload = true +} 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 98bfe742b..434ac872d 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 @@ -194,6 +194,10 @@ type Signer struct { // This value should only be used for testing. If it is nil the default // time.Now will be used. currentTimeFn func() time.Time + + // UnsignedPayload will prevent signing of the payload. This will only + // work for services that have support for this. + UnsignedPayload bool } // NewSigner returns a Signer pointer configured with the credentials and optional @@ -227,6 +231,7 @@ type signingCtx struct { isPresign bool formattedTime string formattedShortTime string + unsignedPayload bool bodyDigest string signedHeaders string @@ -317,6 +322,7 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi ServiceName: service, Region: region, DisableURIPathEscaping: v4.DisableURIPathEscaping, + unsignedPayload: v4.UnsignedPayload, } for key := range ctx.Query { @@ -409,7 +415,18 @@ var SignRequestHandler = request.NamedHandler{ func SignSDKRequest(req *request.Request) { signSDKRequestWithCurrTime(req, time.Now) } -func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time) { + +// BuildNamedHandler will build a generic handler for signing. +func BuildNamedHandler(name string, opts ...func(*Signer)) request.NamedHandler { + return request.NamedHandler{ + Name: name, + Fn: func(req *request.Request) { + signSDKRequestWithCurrTime(req, time.Now, opts...) + }, + } +} + +func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time, opts ...func(*Signer)) { // If the request does not need to be signed ignore the signing of the // request if the AnonymousCredentials object is used. if req.Config.Credentials == credentials.AnonymousCredentials { @@ -441,6 +458,10 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time v4.DisableRequestBodyOverwrite = true }) + for _, opt := range opts { + opt(v4) + } + signingTime := req.Time if !req.LastSignedAt.IsZero() { signingTime = req.LastSignedAt @@ -634,14 +655,14 @@ func (ctx *signingCtx) buildSignature() { func (ctx *signingCtx) buildBodyDigest() { hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") if hash == "" { - if ctx.isPresign && ctx.ServiceName == "s3" { + if ctx.unsignedPayload || (ctx.isPresign && ctx.ServiceName == "s3") { hash = "UNSIGNED-PAYLOAD" } else if ctx.Body == nil { hash = emptyStringSHA256 } else { hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) } - if ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { + if ctx.unsignedPayload || 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/url.go b/vendor/github.com/aws/aws-sdk-go/aws/url.go new file mode 100644 index 000000000..6192b2455 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/url.go @@ -0,0 +1,12 @@ +// +build go1.8 + +package aws + +import "net/url" + +// URLHostname will extract the Hostname without port from the URL value. +// +// Wrapper of net/url#URL.Hostname for backwards Go version compatibility. +func URLHostname(url *url.URL) string { + return url.Hostname() +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go new file mode 100644 index 000000000..0210d2720 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go @@ -0,0 +1,29 @@ +// +build !go1.8 + +package aws + +import ( + "net/url" + "strings" +) + +// URLHostname will extract the Hostname without port from the URL value. +// +// Copy of Go 1.8's net/url#URL.Hostname functionality. +func URLHostname(url *url.URL) string { + return stripPort(url.Host) + +} + +// stripPort is copy of Go 1.8 url#URL.Hostname functionality. +// https://golang.org/src/net/url/url.go +func stripPort(hostport string) string { + colon := strings.IndexByte(hostport, ':') + if colon == -1 { + return hostport + } + if i := strings.IndexByte(hostport, ']'); i != -1 { + return strings.TrimPrefix(hostport[:i], "[") + } + return hostport[:colon] +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 8f1879722..eeb6467a2 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.7.3" +const SDKVersion = "1.8.19" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go b/vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go new file mode 100644 index 000000000..8425c39a6 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/cmd/bucket_cleanup/main.go @@ -0,0 +1,94 @@ +// +build integration + +package main + +import ( + "fmt" + "os" + "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" +) + +// Searches the buckets of an account that match the prefix, and deletes +// those buckets, and all objects within. Before deleting will prompt user +// to confirm bucket should be deleted. Positive confirmation is required. +// +// Usage: +// go run deleteBuckets.go +func main() { + sess := session.Must(session.NewSession()) + + svc := s3.New(sess) + buckets, err := svc.ListBuckets(&s3.ListBucketsInput{}) + if err != nil { + panic(fmt.Sprintf("failed to list buckets, %v", err)) + } + + if len(os.Args) < 2 { + fmt.Fprintln(os.Stderr, "bucket prefix required") + os.Exit(1) + } + bucketPrefix := os.Args[1] + + var failed bool + for _, b := range buckets.Buckets { + bucket := aws.StringValue(b.Name) + + if !strings.HasPrefix(bucket, bucketPrefix) { + continue + } + + fmt.Printf("Delete bucket %q? [y/N]: ", bucket) + var v string + if _, err := fmt.Scanln(&v); err != nil || !(v == "Y" || v == "y") { + fmt.Println("\tSkipping") + continue + } + + fmt.Println("\tDeleting") + if err := deleteBucket(svc, bucket); err != nil { + fmt.Fprintf(os.Stderr, "failed to delete bucket %q, %v", bucket, err) + failed = true + } + } + + if failed { + os.Exit(1) + } +} + +func deleteBucket(svc *s3.S3, bucket string) error { + bucketName := &bucket + + objs, err := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q objects, %v", bucketName, err) + } + + for _, o := range objs.Contents { + svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key}) + } + + uploads, err := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q multipart objects, %v", bucketName, err) + } + + for _, u := range uploads.Uploads { + svc.AbortMultipartUpload(&s3.AbortMultipartUploadInput{ + Bucket: bucketName, + Key: u.Key, + UploadId: u.UploadId, + }) + } + + _, err = svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to delete bucket %q, %v", bucketName, err) + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3crypto/client.go index 83632d1a3..eb16be6d8 100644 --- 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 @@ -16,7 +16,7 @@ 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 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 index a7d433a9d..81abc1a53 100644 --- 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 @@ -2,17 +2,32 @@ @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: Uploading Go's SDK fixtures + When I get all fixtures for "aes_cbc" from "aws-s3-shared-tests" + Then I encrypt each fixture with "kms" "AWS_SDK_TEST_ALIAS" "us-west-2" and "aes_cbc" + 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 + + Scenario: Get all plaintext fixtures for symmetric masterkey aes cbc + When I get all fixtures for "aes_cbc" from "aws-s3-shared-tests" + Then I decrypt each fixture against "Go" "version_2" + And I compare the decrypted ciphertext to the plaintext + + 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 "Java" "version_2" + And I compare the decrypted ciphertext to the plaintext + + Scenario: Get all plaintext fixtures for symmetric masterkey aes cbc + When I get all fixtures for "aes_cbc" from "aws-s3-shared-tests" + Then I decrypt each fixture against "Java" "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 index b558d8a71..7d58e1939 100644 --- 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 @@ -75,14 +75,10 @@ func init() { } // We don't support wrap, so skip it - if *ctObj.Metadata["X-Amz-Wrap-Alg"] != "kms" { + if ctObj.Metadata["X-Amz-Wrap-Alg"] == nil || *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, @@ -94,12 +90,12 @@ func init() { assert.NoError(gucumber.T, err) ciphertexts[caseKey] = ciphertext } - gucumber.World["ciphertexts"] = ciphertexts + gucumber.World["decrypted"] = 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) + ciphertexts := gucumber.World["decrypted"].(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)) @@ -129,6 +125,8 @@ func init() { switch cek { case "aes_gcm": builder = s3crypto.AESGCMContentCipherBuilder(handler) + case "aes_cbc": + builder = s3crypto.AESCBCContentCipherBuilder(handler, s3crypto.AESCBCPadder) default: gucumber.T.Skip() } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go new file mode 100644 index 000000000..823b2c1dc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/bucket_region_test.go @@ -0,0 +1,27 @@ +// +build integration + +package s3manager + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/awstesting/integration" + "github.com/aws/aws-sdk-go/service/s3/s3manager" +) + +func TestGetBucketRegion(t *testing.T) { + expectRegion := aws.StringValue(integration.Session.Config.Region) + + ctx := aws.BackgroundContext() + region, err := s3manager.GetBucketRegion(ctx, integration.Session, + aws.StringValue(bucketName), expectRegion) + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + if e, a := expectRegion, region; e != a { + t.Errorf("expect %s bucket region, got %s", e, a) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go index 3a0dd600e..87536435e 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/integration/customizations/s3/s3manager/integration_test.go @@ -1,6 +1,6 @@ // +build integration -// Package s3manager provides +// Package s3manager provides integration tests for the service/s3/s3manager package package s3manager import ( @@ -9,12 +9,13 @@ import ( "fmt" "io" "os" + "regexp" + "strings" "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/awstesting/integration" "github.com/aws/aws-sdk-go/service/s3" @@ -26,45 +27,64 @@ var integMD512MB = fmt.Sprintf("%x", md5.Sum(integBuf12MB)) var bucketName *string func TestMain(m *testing.M) { - setup() - defer teardown() // only called if we panic - result := m.Run() - teardown() - os.Exit(result) + if err := setup(); err != nil { + panic(fmt.Sprintf("failed to setup integration test, %v", err)) + } + + var result int + + defer func() { + if err := teardown(); err != nil { + fmt.Fprintf(os.Stderr, "teardown failed, %v", err) + } + if r := recover(); r != nil { + fmt.Println("S3Manager integration test hit a panic,", r) + result = 1 + } + os.Exit(result) + }() + + result = m.Run() } -func setup() { - // Create a bucket for testing +func setup() error { svc := s3.New(integration.Session) + + // Create a bucket for testing bucketName = aws.String( fmt.Sprintf("aws-sdk-go-integration-%d-%s", time.Now().Unix(), integration.UniqueID())) - for i := 0; i < 10; i++ { - _, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName}) - if err == nil { - break - } + _, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to create bucket %q, %v", *bucketName, err) } - for { - _, err := svc.HeadBucket(&s3.HeadBucketInput{Bucket: bucketName}) - if err == nil { - break - } - time.Sleep(1 * time.Second) + err = svc.WaitUntilBucketExists(&s3.HeadBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to wait for bucket %q to exist, %v", bucketName, err) } + + return nil } // Delete the bucket -func teardown() { +func teardown() error { svc := s3.New(integration.Session) - objs, _ := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) + objs, err := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q objects, %v", bucketName, err) + } + for _, o := range objs.Contents { svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key}) } - uploads, _ := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName}) + uploads, err := svc.ListMultipartUploads(&s3.ListMultipartUploadsInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to list bucket %q multipart objects, %v", bucketName, err) + } + for _, u := range uploads.Uploads { svc.AbortMultipartUpload(&s3.AbortMultipartUploadInput{ Bucket: bucketName, @@ -73,7 +93,12 @@ func teardown() { }) } - svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) + _, err = svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) + if err != nil { + return fmt.Errorf("failed to delete bucket %q, %v", bucketName, err) + } + + return nil } type dlwriter struct { @@ -106,8 +131,12 @@ func validate(t *testing.T, key string, md5value string) { w := newDLWriter(1024 * 1024 * 20) n, err := mgr.Download(w, params) - assert.NoError(t, err) - assert.Equal(t, md5value, fmt.Sprintf("%x", md5.Sum(w.buf[0:n]))) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := md5value, fmt.Sprintf("%x", md5.Sum(w.buf[0:n])); e != a { + t.Errorf("expect %s md5 value, got %s", e, a) + } } func TestUploadConcurrently(t *testing.T) { @@ -119,9 +148,17 @@ func TestUploadConcurrently(t *testing.T) { Body: bytes.NewReader(integBuf12MB), }) - assert.NoError(t, err) - assert.NotEqual(t, "", out.UploadID) - assert.Regexp(t, `^https?://.+/`+key+`$`, out.Location) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if len(out.UploadID) == 0 { + t.Errorf("expect upload ID but was empty") + } + + re := regexp.MustCompile(`^https?://.+/` + key + `$`) + if e, a := re.String(), out.Location; !re.MatchString(a) { + t.Errorf("expect %s to match URL regexp %q, did not", e, a) + } validate(t, key, integMD512MB) } @@ -149,15 +186,25 @@ func TestUploadFailCleanup(t *testing.T) { Key: &key, Body: bytes.NewReader(integBuf12MB), }) - assert.Error(t, err) - assert.NotContains(t, err.Error(), "MissingRegion") + if err == nil { + t.Fatalf("expect error, but did not get one") + } + + aerr := err.(awserr.Error) + if e, a := "MissingRegion", aerr.Code(); strings.Contains(a, e) { + t.Errorf("expect %q to not be in error code %q", e, a) + } + uploadID := "" - if merr, ok := err.(s3manager.MultiUploadFailure); ok { - uploadID = merr.UploadID() + merr := err.(s3manager.MultiUploadFailure) + if uploadID = merr.UploadID(); len(uploadID) == 0 { + t.Errorf("expect upload ID to not be empty, but was") } - assert.NotEmpty(t, uploadID) _, err = svc.ListParts(&s3.ListPartsInput{ - Bucket: bucketName, Key: &key, UploadId: &uploadID}) - assert.Error(t, err) + Bucket: bucketName, Key: &key, UploadId: &uploadID, + }) + if err == nil { + t.Errorf("expect error for list parts, but got none") + } } diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go index 77c296e99..fde4dcc4a 100644 --- a/vendor/github.com/aws/aws-sdk-go/awstesting/util.go +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/util.go @@ -2,6 +2,7 @@ package awstesting import ( "io" + "time" "github.com/aws/aws-sdk-go/private/util" ) @@ -65,3 +66,29 @@ func (r *ReadCloser) Close() error { func SortedKeys(m map[string]interface{}) []string { return util.SortedKeys(m) } + +// A FakeContext provides a simple stub implementation of a Context +type FakeContext struct { + Error error + DoneCh chan struct{} +} + +// Deadline always will return not set +func (c *FakeContext) Deadline() (deadline time.Time, ok bool) { + return time.Time{}, false +} + +// Done returns a read channel for listening to the Done event +func (c *FakeContext) Done() <-chan struct{} { + return c.DoneCh +} + +// Err returns the error, is nil if not set. +func (c *FakeContext) Err() error { + return c.Error +} + +// Value ignores the Value and always returns nil +func (c *FakeContext) Value(key interface{}) interface{} { + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html b/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html index ba90a442e..7d81f71d5 100644 --- a/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html +++ b/vendor/github.com/aws/aws-sdk-go/doc-src/aws-godoc/templates/godoc.html @@ -16,6 +16,18 @@ + + +