aws-sdk-core 2.4.0 → 3.53.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -0
- data/ca-bundle.crt +3615 -3541
- data/lib/aws-sdk-core.rb +96 -408
- data/lib/aws-sdk-core/async_client_stubs.rb +80 -0
- data/lib/aws-sdk-core/binary.rb +6 -0
- data/lib/aws-sdk-core/binary/decode_handler.rb +56 -0
- data/lib/aws-sdk-core/binary/encode_handler.rb +32 -0
- data/lib/aws-sdk-core/binary/event_builder.rb +122 -0
- data/lib/aws-sdk-core/binary/event_parser.rb +134 -0
- data/lib/aws-sdk-core/binary/event_stream_decoder.rb +62 -0
- data/lib/aws-sdk-core/binary/event_stream_encoder.rb +53 -0
- data/lib/aws-sdk-core/client_side_monitoring/publisher.rb +41 -0
- data/lib/aws-sdk-core/client_side_monitoring/request_metrics.rb +197 -0
- data/lib/aws-sdk-core/client_stubs.rb +73 -10
- data/lib/aws-sdk-core/credential_provider.rb +2 -0
- data/lib/aws-sdk-core/credential_provider_chain.rb +22 -5
- data/lib/aws-sdk-core/ecs_credentials.rb +3 -3
- data/lib/aws-sdk-core/endpoint_cache.rb +188 -0
- data/lib/aws-sdk-core/errors.rb +174 -10
- data/lib/aws-sdk-core/event_emitter.rb +62 -0
- data/lib/aws-sdk-core/ini_parser.rb +1 -0
- data/lib/aws-sdk-core/instance_profile_credentials.rb +21 -12
- data/lib/aws-sdk-core/json.rb +4 -5
- data/lib/aws-sdk-core/json/builder.rb +4 -2
- data/lib/aws-sdk-core/json/error_handler.rb +19 -2
- data/lib/aws-sdk-core/json/handler.rb +22 -3
- data/lib/aws-sdk-core/json/parser.rb +1 -1
- data/lib/aws-sdk-core/log/param_filter.rb +4 -3
- data/lib/aws-sdk-core/pageable_response.rb +1 -0
- data/lib/aws-sdk-core/pager.rb +30 -25
- data/lib/aws-sdk-core/param_converter.rb +3 -3
- data/lib/aws-sdk-core/param_validator.rb +56 -21
- data/lib/aws-sdk-core/plugins/api_key.rb +52 -0
- data/lib/aws-sdk-core/plugins/apig_authorizer_token.rb +30 -0
- data/lib/aws-sdk-core/plugins/apig_credentials_configuration.rb +34 -0
- data/lib/aws-sdk-core/plugins/apig_user_agent.rb +37 -0
- data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +256 -0
- data/lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb +84 -0
- data/lib/aws-sdk-core/plugins/credentials_configuration.rb +62 -0
- data/lib/aws-sdk-core/plugins/endpoint_discovery.rb +160 -0
- data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +63 -0
- data/lib/aws-sdk-core/plugins/event_stream_configuration.rb +30 -0
- data/lib/aws-sdk-core/plugins/global_configuration.rb +19 -10
- data/lib/aws-sdk-core/plugins/helpful_socket_errors.rb +41 -0
- data/lib/aws-sdk-core/plugins/idempotency_token.rb +36 -0
- data/lib/aws-sdk-core/plugins/invocation_id.rb +33 -0
- data/lib/aws-sdk-core/plugins/jsonvalue_converter.rb +29 -0
- data/lib/aws-sdk-core/plugins/logging.rb +18 -18
- data/lib/aws-sdk-core/plugins/param_converter.rb +9 -5
- data/lib/aws-sdk-core/plugins/param_validator.rb +8 -5
- data/lib/aws-sdk-core/plugins/protocols/api_gateway.rb +10 -0
- data/lib/aws-sdk-core/plugins/protocols/ec2.rb +2 -1
- data/lib/aws-sdk-core/plugins/protocols/json_rpc.rb +13 -12
- data/lib/aws-sdk-core/plugins/protocols/query.rb +2 -2
- data/lib/aws-sdk-core/plugins/regional_endpoint.rb +28 -16
- data/lib/aws-sdk-core/plugins/response_paging.rb +5 -18
- data/lib/aws-sdk-core/plugins/retry_errors.rb +97 -23
- data/lib/aws-sdk-core/plugins/signature_v2.rb +51 -0
- data/lib/aws-sdk-core/plugins/signature_v4.rb +141 -0
- data/lib/aws-sdk-core/plugins/stub_responses.rb +35 -18
- data/lib/aws-sdk-core/plugins/transfer_encoding.rb +53 -0
- data/lib/aws-sdk-core/plugins/user_agent.rb +23 -6
- data/lib/aws-sdk-core/process_credentials.rb +76 -0
- data/lib/aws-sdk-core/query.rb +5 -0
- data/lib/aws-sdk-core/query/ec2_param_builder.rb +9 -3
- data/lib/aws-sdk-core/query/handler.rb +20 -16
- data/lib/aws-sdk-core/query/param_builder.rb +10 -4
- data/lib/aws-sdk-core/refreshing_credentials.rb +1 -1
- data/lib/aws-sdk-core/resources/collection.rb +121 -0
- data/lib/aws-sdk-core/rest.rb +10 -0
- data/lib/aws-sdk-core/rest/handler.rb +1 -0
- data/lib/aws-sdk-core/rest/request/builder.rb +2 -1
- data/lib/aws-sdk-core/rest/request/endpoint.rb +11 -66
- data/lib/aws-sdk-core/rest/request/headers.rb +20 -1
- data/lib/aws-sdk-core/rest/request/querystring_builder.rb +103 -0
- data/lib/aws-sdk-core/rest/response/body.rb +14 -1
- data/lib/aws-sdk-core/rest/response/headers.rb +9 -0
- data/lib/aws-sdk-core/rest/response/parser.rb +18 -14
- data/lib/aws-sdk-core/shared_config.rb +132 -18
- data/lib/aws-sdk-core/shared_credentials.rb +2 -0
- data/lib/aws-sdk-core/structure.rb +21 -11
- data/lib/aws-sdk-core/stubbing/data_applicator.rb +1 -1
- data/lib/aws-sdk-core/stubbing/empty_stub.rb +10 -3
- data/lib/aws-sdk-core/stubbing/protocols/api_gateway.rb +8 -0
- data/lib/aws-sdk-core/stubbing/protocols/ec2.rb +1 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +99 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +5 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +9 -5
- data/lib/aws-sdk-core/stubbing/stub_data.rb +16 -3
- data/lib/aws-sdk-core/util.rb +66 -0
- data/lib/aws-sdk-core/waiters.rb +3 -0
- data/lib/aws-sdk-core/waiters/poller.rb +5 -7
- data/lib/aws-sdk-core/waiters/waiter.rb +1 -0
- data/lib/aws-sdk-core/xml.rb +9 -0
- data/lib/aws-sdk-core/xml/builder.rb +11 -5
- data/lib/aws-sdk-core/xml/error_handler.rb +27 -5
- data/lib/aws-sdk-core/xml/parser.rb +1 -11
- data/lib/aws-sdk-core/xml/parser/engines/ox.rb +5 -1
- data/lib/aws-sdk-core/xml/parser/frame.rb +6 -6
- data/lib/aws-sdk-sts.rb +45 -0
- data/lib/aws-sdk-sts/client.rb +1761 -0
- data/lib/aws-sdk-sts/client_api.rb +304 -0
- data/lib/aws-sdk-sts/customizations.rb +0 -0
- data/lib/aws-sdk-sts/errors.rb +142 -0
- data/lib/aws-sdk-sts/resource.rb +23 -0
- data/lib/aws-sdk-sts/types.rb +1279 -0
- data/lib/seahorse.rb +60 -60
- data/lib/seahorse/client/async_base.rb +50 -0
- data/lib/seahorse/client/async_response.rb +62 -0
- data/lib/seahorse/client/base.rb +2 -8
- data/lib/seahorse/client/configuration.rb +9 -1
- data/lib/seahorse/client/h2/connection.rb +244 -0
- data/lib/seahorse/client/h2/handler.rb +151 -0
- data/lib/seahorse/client/http/async_response.rb +42 -0
- data/lib/seahorse/client/http/response.rb +10 -5
- data/lib/seahorse/client/logging/formatter.rb +5 -1
- data/lib/seahorse/client/logging/handler.rb +2 -0
- data/lib/seahorse/client/net_http/connection_pool.rb +27 -11
- data/lib/seahorse/client/net_http/handler.rb +10 -2
- data/lib/seahorse/client/net_http/patches.rb +9 -1
- data/lib/seahorse/client/networking_error.rb +28 -0
- data/lib/seahorse/client/plugin.rb +66 -6
- data/lib/seahorse/client/plugin_list.rb +3 -1
- data/lib/seahorse/client/plugins/content_length.rb +7 -2
- data/lib/seahorse/client/plugins/endpoint.rb +14 -10
- data/lib/seahorse/client/plugins/h2.rb +64 -0
- data/lib/seahorse/client/plugins/logging.rb +17 -19
- data/lib/seahorse/client/plugins/net_http.rb +23 -15
- data/lib/seahorse/client/plugins/raise_response_errors.rb +4 -4
- data/lib/seahorse/client/plugins/response_target.rb +10 -1
- data/lib/seahorse/client/request_context.rb +5 -0
- data/lib/seahorse/client/response.rb +9 -20
- data/lib/seahorse/model/api.rb +37 -0
- data/lib/seahorse/model/authorizer.rb +21 -0
- data/lib/seahorse/model/operation.rb +20 -0
- data/lib/seahorse/model/shapes.rb +44 -2
- data/lib/seahorse/util.rb +1 -21
- metadata +112 -359
- data/apis/acm/2015-12-08/api-2.json +0 -495
- data/apis/acm/2015-12-08/examples-1.json +0 -5
- data/apis/acm/2015-12-08/paginators-1.json +0 -10
- data/apis/apigateway/2015-07-09/api-2.json +0 -3347
- data/apis/apigateway/2015-07-09/examples-1.json +0 -5
- data/apis/apigateway/2015-07-09/paginators-1.json +0 -52
- data/apis/application-autoscaling/2016-02-06/api-2.json +0 -502
- data/apis/application-autoscaling/2016-02-06/examples-1.json +0 -5
- data/apis/application-autoscaling/2016-02-06/paginators-1.json +0 -22
- data/apis/autoscaling/2011-01-01/api-2.json +0 -2038
- data/apis/autoscaling/2011-01-01/examples-1.json +0 -5
- data/apis/autoscaling/2011-01-01/paginators-1.json +0 -52
- data/apis/autoscaling/2011-01-01/resources-1.json +0 -1613
- data/apis/autoscaling/2011-01-01/waiters-2.json +0 -62
- data/apis/cloudformation/2010-05-15/api-2.json +0 -1299
- data/apis/cloudformation/2010-05-15/examples-1.json +0 -5
- data/apis/cloudformation/2010-05-15/paginators-1.json +0 -27
- data/apis/cloudformation/2010-05-15/resources-1.json +0 -202
- data/apis/cloudformation/2010-05-15/waiters-2.json +0 -235
- data/apis/cloudfront/2016-01-28/api-2.json +0 -2218
- data/apis/cloudfront/2016-01-28/examples-1.json +0 -5
- data/apis/cloudfront/2016-01-28/paginators-1.json +0 -32
- data/apis/cloudfront/2016-01-28/waiters-2.json +0 -47
- data/apis/cloudhsm/2014-05-30/api-2.json +0 -877
- data/apis/cloudhsm/2014-05-30/examples-1.json +0 -5
- data/apis/cloudsearch/2013-01-01/api-2.json +0 -2001
- data/apis/cloudsearch/2013-01-01/paginators-1.json +0 -20
- data/apis/cloudsearchdomain/2013-01-01/api-2.json +0 -373
- data/apis/cloudsearchdomain/2013-01-01/examples-1.json +0 -5
- data/apis/cloudtrail/2013-11-01/api-2.json +0 -801
- data/apis/cloudtrail/2013-11-01/examples-1.json +0 -5
- data/apis/cloudtrail/2013-11-01/paginators-1.json +0 -7
- data/apis/codecommit/2015-04-13/api-2.json +0 -916
- data/apis/codecommit/2015-04-13/examples-1.json +0 -5
- data/apis/codecommit/2015-04-13/paginators-1.json +0 -14
- data/apis/codedeploy/2014-10-06/api-2.json +0 -1954
- data/apis/codedeploy/2014-10-06/examples-1.json +0 -5
- data/apis/codedeploy/2014-10-06/paginators-1.json +0 -34
- data/apis/codepipeline/2015-07-09/api-2.json +0 -1633
- data/apis/codepipeline/2015-07-09/examples-1.json +0 -902
- data/apis/cognito-identity/2014-06-30/api-2.json +0 -859
- data/apis/cognito-identity/2014-06-30/examples-1.json +0 -5
- data/apis/cognito-idp/2016-04-18/api-2.json +0 -1657
- data/apis/cognito-idp/2016-04-18/examples-1.json +0 -5
- data/apis/cognito-sync/2014-06-30/api-2.json +0 -1874
- data/apis/config/2014-11-12/api-2.json +0 -1303
- data/apis/config/2014-11-12/examples-1.json +0 -5
- data/apis/config/2014-11-12/paginators-1.json +0 -10
- data/apis/datapipeline/2012-10-29/api-2.json +0 -1167
- data/apis/datapipeline/2012-10-29/paginators-1.json +0 -26
- data/apis/devicefarm/2015-06-23/api-2.json +0 -2030
- data/apis/devicefarm/2015-06-23/examples-1.json +0 -5
- data/apis/devicefarm/2015-06-23/paginators-1.json +0 -74
- data/apis/directconnect/2012-10-25/api-2.json +0 -793
- data/apis/directconnect/2012-10-25/examples-1.json +0 -5
- data/apis/directconnect/2012-10-25/paginators-1.json +0 -22
- data/apis/discovery/2015-11-01/api-2.json +0 -556
- data/apis/discovery/2015-11-01/examples-1.json +0 -5
- data/apis/dms/2016-01-01/api-2.json +0 -1469
- data/apis/dms/2016-01-01/examples-1.json +0 -5
- data/apis/ds/2015-04-16/api-2.json +0 -1674
- data/apis/ds/2015-04-16/examples-1.json +0 -5
- data/apis/dynamodb/2012-08-10/api-2.json +0 -1200
- data/apis/dynamodb/2012-08-10/examples-1.json +0 -5
- data/apis/dynamodb/2012-08-10/paginators-1.json +0 -26
- data/apis/dynamodb/2012-08-10/resources-1.json +0 -136
- data/apis/dynamodb/2012-08-10/waiters-2.json +0 -35
- data/apis/ec2/2015-10-01/api-2.json +0 -13759
- data/apis/ec2/2015-10-01/examples-1.json +0 -5
- data/apis/ec2/2015-10-01/paginators-1.json +0 -138
- data/apis/ec2/2015-10-01/resources-1.json +0 -2582
- data/apis/ec2/2015-10-01/waiters-2.json +0 -593
- data/apis/ec2/2016-04-01/api-2.json +0 -13842
- data/apis/ec2/2016-04-01/examples-1.json +0 -5
- data/apis/ec2/2016-04-01/paginators-1.json +0 -138
- data/apis/ec2/2016-04-01/resources-1.json +0 -2582
- data/apis/ec2/2016-04-01/waiters-2.json +0 -593
- data/apis/ecr/2015-09-21/api-2.json +0 -849
- data/apis/ecr/2015-09-21/examples-1.json +0 -5
- data/apis/ecs/2014-11-13/api-2.json +0 -1396
- data/apis/ecs/2014-11-13/examples-1.json +0 -5
- data/apis/ecs/2014-11-13/paginators-1.json +0 -40
- data/apis/ecs/2014-11-13/waiters-2.json +0 -93
- data/apis/elasticache/2015-02-02/api-2.json +0 -2426
- data/apis/elasticache/2015-02-02/examples-1.json +0 -5
- data/apis/elasticache/2015-02-02/paginators-1.json +0 -76
- data/apis/elasticache/2015-02-02/waiters-2.json +0 -143
- data/apis/elasticbeanstalk/2010-12-01/api-2.json +0 -1894
- data/apis/elasticbeanstalk/2010-12-01/examples-1.json +0 -1109
- data/apis/elasticbeanstalk/2010-12-01/paginators-1.json +0 -25
- data/apis/elasticfilesystem/2015-02-01/api-2.json +0 -713
- data/apis/elasticfilesystem/2015-02-01/examples-1.json +0 -5
- data/apis/elasticloadbalancing/2012-06-01/api-2.json +0 -2145
- data/apis/elasticloadbalancing/2012-06-01/paginators-1.json +0 -18
- data/apis/elasticloadbalancing/2012-06-01/waiters-2.json +0 -49
- data/apis/elasticmapreduce/2009-03-31/api-2.json +0 -1341
- data/apis/elasticmapreduce/2009-03-31/examples-1.json +0 -5
- data/apis/elasticmapreduce/2009-03-31/paginators-1.json +0 -32
- data/apis/elasticmapreduce/2009-03-31/waiters-2.json +0 -67
- data/apis/elastictranscoder/2012-09-25/api-2.json +0 -1807
- data/apis/elastictranscoder/2012-09-25/paginators-1.json +0 -24
- data/apis/elastictranscoder/2012-09-25/waiters-2.json +0 -30
- data/apis/email/2010-12-01/api-2.json +0 -1791
- data/apis/email/2010-12-01/examples-1.json +0 -5
- data/apis/email/2010-12-01/paginators-1.json +0 -13
- data/apis/email/2010-12-01/waiters-2.json +0 -18
- data/apis/es/2015-01-01/api-2.json +0 -764
- data/apis/events/2015-10-07/api-2.json +0 -643
- data/apis/events/2015-10-07/examples-1.json +0 -5
- data/apis/firehose/2015-08-04/api-2.json +0 -719
- data/apis/gamelift/2015-10-01/api-2.json +0 -2307
- data/apis/gamelift/2015-10-01/examples-1.json +0 -5
- data/apis/glacier/2012-06-01/api-2.json +0 -2144
- data/apis/glacier/2012-06-01/paginators-1.json +0 -28
- data/apis/glacier/2012-06-01/resources-1.json +0 -563
- data/apis/glacier/2012-06-01/waiters-2.json +0 -39
- data/apis/iam/2010-05-08/api-2.json +0 -4514
- data/apis/iam/2010-05-08/examples-1.json +0 -5
- data/apis/iam/2010-05-08/paginators-1.json +0 -198
- data/apis/iam/2010-05-08/resources-1.json +0 -1740
- data/apis/iam/2010-05-08/waiters-2.json +0 -39
- data/apis/importexport/2010-06-01/api-2.json +0 -666
- data/apis/importexport/2010-06-01/paginators-1.json +0 -11
- data/apis/inspector/2016-02-16/api-2.json +0 -1964
- data/apis/inspector/2016-02-16/examples-1.json +0 -5
- data/apis/iot-data/2015-05-28/api-2.json +0 -263
- data/apis/iot/2015-05-28/api-2.json +0 -3800
- data/apis/iot/2015-05-28/examples-1.json +0 -5
- data/apis/kinesis/2013-12-02/api-2.json +0 -822
- data/apis/kinesis/2013-12-02/examples-1.json +0 -5
- data/apis/kinesis/2013-12-02/paginators-1.json +0 -18
- data/apis/kinesis/2013-12-02/waiters-2.json +0 -18
- data/apis/kms/2014-11-01/api-2.json +0 -1209
- data/apis/kms/2014-11-01/examples-1.json +0 -5
- data/apis/kms/2014-11-01/paginators-1.json +0 -32
- data/apis/lambda/2014-11-11/api-2.json +0 -667
- data/apis/lambda/2014-11-11/paginators-1.json +0 -16
- data/apis/lambda/2015-03-31/api-2.json +0 -1342
- data/apis/lambda/2015-03-31/examples-1.json +0 -5
- data/apis/lambda/2015-03-31/paginators-1.json +0 -16
- data/apis/logs/2014-03-28/api-2.json +0 -1138
- data/apis/logs/2014-03-28/examples-1.json +0 -5
- data/apis/logs/2014-03-28/paginators-1.json +0 -49
- data/apis/machinelearning/2014-12-12/api-2.json +0 -1947
- data/apis/machinelearning/2014-12-12/paginators-1.json +0 -28
- data/apis/machinelearning/2014-12-12/waiters-2.json +0 -81
- data/apis/marketplacecommerceanalytics/2015-07-01/api-2.json +0 -120
- data/apis/marketplacecommerceanalytics/2015-07-01/examples-1.json +0 -5
- data/apis/meteringmarketplace/2016-01-14/api-2.json +0 -127
- data/apis/meteringmarketplace/2016-01-14/examples-1.json +0 -5
- data/apis/monitoring/2010-08-01/api-2.json +0 -790
- data/apis/monitoring/2010-08-01/examples-1.json +0 -5
- data/apis/monitoring/2010-08-01/paginators-1.json +0 -24
- data/apis/monitoring/2010-08-01/resources-1.json +0 -346
- data/apis/monitoring/2010-08-01/waiters-2.json +0 -18
- data/apis/opsworks/2013-02-18/api-2.json +0 -2606
- data/apis/opsworks/2013-02-18/examples-1.json +0 -5
- data/apis/opsworks/2013-02-18/paginators-1.json +0 -55
- data/apis/opsworks/2013-02-18/resources-1.json +0 -173
- data/apis/opsworks/2013-02-18/waiters-2.json +0 -295
- data/apis/rds/2014-10-31/api-2.json +0 -4757
- data/apis/rds/2014-10-31/examples-1.json +0 -5
- data/apis/rds/2014-10-31/paginators-1.json +0 -110
- data/apis/rds/2014-10-31/resources-1.json +0 -3272
- data/apis/rds/2014-10-31/waiters-2.json +0 -102
- data/apis/redshift/2012-12-01/api-2.json +0 -3768
- data/apis/redshift/2012-12-01/examples-1.json +0 -5
- data/apis/redshift/2012-12-01/paginators-1.json +0 -94
- data/apis/redshift/2012-12-01/waiters-2.json +0 -97
- data/apis/route53/2013-04-01/api-2.json +0 -3245
- data/apis/route53/2013-04-01/examples-1.json +0 -5
- data/apis/route53/2013-04-01/paginators-1.json +0 -33
- data/apis/route53/2013-04-01/waiters-2.json +0 -18
- data/apis/route53domains/2014-05-15/api-2.json +0 -1197
- data/apis/route53domains/2014-05-15/paginators-1.json +0 -17
- data/apis/s3/2006-03-01/api-2.json +0 -4517
- data/apis/s3/2006-03-01/examples-1.json +0 -5
- data/apis/s3/2006-03-01/paginators-1.json +0 -66
- data/apis/s3/2006-03-01/resources-1.json +0 -1176
- data/apis/s3/2006-03-01/waiters-2.json +0 -73
- data/apis/sdb/2009-04-15/api-2.json +0 -954
- data/apis/sdb/2009-04-15/paginators-1.json +0 -15
- data/apis/servicecatalog/2015-12-10/api-2.json +0 -749
- data/apis/servicecatalog/2015-12-10/examples-1.json +0 -5
- data/apis/sns/2010-03-31/api-2.json +0 -1139
- data/apis/sns/2010-03-31/paginators-1.json +0 -29
- data/apis/sns/2010-03-31/resources-1.json +0 -327
- data/apis/sqs/2012-11-05/api-2.json +0 -950
- data/apis/sqs/2012-11-05/examples-1.json +0 -44
- data/apis/sqs/2012-11-05/paginators-1.json +0 -7
- data/apis/ssm/2014-11-06/api-2.json +0 -1796
- data/apis/ssm/2014-11-06/examples-1.json +0 -5
- data/apis/ssm/2014-11-06/paginators-1.json +0 -34
- data/apis/storagegateway/2013-06-30/api-2.json +0 -2275
- data/apis/storagegateway/2013-06-30/examples-1.json +0 -5
- data/apis/storagegateway/2013-06-30/paginators-1.json +0 -52
- data/apis/streams.dynamodb/2012-08-10/api-2.json +0 -397
- data/apis/streams.dynamodb/2012-08-10/examples-1.json +0 -5
- data/apis/sts/2011-06-15/api-2.json +0 -521
- data/apis/sts/2011-06-15/examples-1.json +0 -5
- data/apis/support/2013-04-15/api-2.json +0 -869
- data/apis/support/2013-04-15/paginators-1.json +0 -25
- data/apis/swf/2012-01-25/api-2.json +0 -2838
- data/apis/swf/2012-01-25/paginators-1.json +0 -46
- data/apis/waf/2015-08-24/api-2.json +0 -1959
- data/apis/waf/2015-08-24/examples-1.json +0 -5
- data/apis/workspaces/2015-04-08/api-2.json +0 -632
- data/apis/workspaces/2015-04-08/examples-1.json +0 -5
- data/apis/workspaces/2015-04-08/paginators-1.json +0 -20
- data/bin/aws.rb +0 -180
- data/endpoints.json +0 -1460
- data/lib/aws-sdk-core/acm.rb +0 -6
- data/lib/aws-sdk-core/api/builder.rb +0 -106
- data/lib/aws-sdk-core/api/customizations.rb +0 -217
- data/lib/aws-sdk-core/api/docs/builder.rb +0 -220
- data/lib/aws-sdk-core/api/docs/client_type_documenter.rb +0 -109
- data/lib/aws-sdk-core/api/docs/docstring_provider.rb +0 -75
- data/lib/aws-sdk-core/api/docs/operation_documenter.rb +0 -138
- data/lib/aws-sdk-core/api/docs/param_formatter.rb +0 -163
- data/lib/aws-sdk-core/api/docs/request_syntax_example.rb +0 -22
- data/lib/aws-sdk-core/api/docs/response_structure_example.rb +0 -91
- data/lib/aws-sdk-core/api/docs/shared_example.rb +0 -100
- data/lib/aws-sdk-core/api/docs/utils.rb +0 -133
- data/lib/aws-sdk-core/api/shape_map.rb +0 -142
- data/lib/aws-sdk-core/apigateway.rb +0 -6
- data/lib/aws-sdk-core/applicationautoscaling.rb +0 -6
- data/lib/aws-sdk-core/applicationdiscoveryservice.rb +0 -5
- data/lib/aws-sdk-core/autoscaling.rb +0 -8
- data/lib/aws-sdk-core/checksums.rb +0 -51
- data/lib/aws-sdk-core/client.rb +0 -57
- data/lib/aws-sdk-core/client_waiters.rb +0 -120
- data/lib/aws-sdk-core/cloudformation.rb +0 -8
- data/lib/aws-sdk-core/cloudfront.rb +0 -15
- data/lib/aws-sdk-core/cloudfront/url_signer.rb +0 -167
- data/lib/aws-sdk-core/cloudhsm.rb +0 -5
- data/lib/aws-sdk-core/cloudsearch.rb +0 -5
- data/lib/aws-sdk-core/cloudsearchdomain.rb +0 -5
- data/lib/aws-sdk-core/cloudtrail.rb +0 -6
- data/lib/aws-sdk-core/cloudwatch.rb +0 -8
- data/lib/aws-sdk-core/cloudwatchevents.rb +0 -5
- data/lib/aws-sdk-core/cloudwatchlogs.rb +0 -6
- data/lib/aws-sdk-core/codecommit.rb +0 -6
- data/lib/aws-sdk-core/codedeploy.rb +0 -6
- data/lib/aws-sdk-core/codepipeline.rb +0 -5
- data/lib/aws-sdk-core/cognitoidentity.rb +0 -5
- data/lib/aws-sdk-core/cognitoidentityprovider.rb +0 -5
- data/lib/aws-sdk-core/cognitosync.rb +0 -4
- data/lib/aws-sdk-core/configservice.rb +0 -6
- data/lib/aws-sdk-core/databasemigrationservice.rb +0 -5
- data/lib/aws-sdk-core/datapipeline.rb +0 -5
- data/lib/aws-sdk-core/devicefarm.rb +0 -6
- data/lib/aws-sdk-core/directconnect.rb +0 -6
- data/lib/aws-sdk-core/directoryservice.rb +0 -5
- data/lib/aws-sdk-core/dynamodb.rb +0 -40
- data/lib/aws-sdk-core/dynamodb/attribute_value.rb +0 -108
- data/lib/aws-sdk-core/dynamodbstreams.rb +0 -5
- data/lib/aws-sdk-core/ec2.rb +0 -8
- data/lib/aws-sdk-core/ecr.rb +0 -5
- data/lib/aws-sdk-core/ecs.rb +0 -7
- data/lib/aws-sdk-core/efs.rb +0 -5
- data/lib/aws-sdk-core/elasticache.rb +0 -7
- data/lib/aws-sdk-core/elasticbeanstalk.rb +0 -6
- data/lib/aws-sdk-core/elasticloadbalancing.rb +0 -6
- data/lib/aws-sdk-core/elasticsearchservice.rb +0 -4
- data/lib/aws-sdk-core/elastictranscoder.rb +0 -6
- data/lib/aws-sdk-core/empty_structure.rb +0 -3
- data/lib/aws-sdk-core/emr.rb +0 -7
- data/lib/aws-sdk-core/endpoint_provider.rb +0 -95
- data/lib/aws-sdk-core/firehose.rb +0 -4
- data/lib/aws-sdk-core/gamelift.rb +0 -5
- data/lib/aws-sdk-core/glacier.rb +0 -7
- data/lib/aws-sdk-core/iam.rb +0 -8
- data/lib/aws-sdk-core/importexport.rb +0 -5
- data/lib/aws-sdk-core/inspector.rb +0 -5
- data/lib/aws-sdk-core/iot.rb +0 -5
- data/lib/aws-sdk-core/iotdataplane.rb +0 -4
- data/lib/aws-sdk-core/kinesis.rb +0 -7
- data/lib/aws-sdk-core/kms.rb +0 -6
- data/lib/aws-sdk-core/lambda.rb +0 -6
- data/lib/aws-sdk-core/lambdapreview.rb +0 -5
- data/lib/aws-sdk-core/machinelearning.rb +0 -6
- data/lib/aws-sdk-core/marketplacecommerceanalytics.rb +0 -5
- data/lib/aws-sdk-core/marketplacemetering.rb +0 -5
- data/lib/aws-sdk-core/opsworks.rb +0 -8
- data/lib/aws-sdk-core/partitions.rb +0 -174
- data/lib/aws-sdk-core/partitions/partition.rb +0 -95
- data/lib/aws-sdk-core/partitions/partition_list.rb +0 -60
- data/lib/aws-sdk-core/partitions/region.rb +0 -78
- data/lib/aws-sdk-core/partitions/service.rb +0 -84
- data/lib/aws-sdk-core/plugins/api_gateway_header.rb +0 -19
- data/lib/aws-sdk-core/plugins/csd_conditional_signing.rb +0 -30
- data/lib/aws-sdk-core/plugins/dynamodb_crc32_validation.rb +0 -52
- data/lib/aws-sdk-core/plugins/dynamodb_extended_retries.rb +0 -22
- data/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb +0 -209
- data/lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb +0 -87
- data/lib/aws-sdk-core/plugins/ec2_region_validation.rb +0 -17
- data/lib/aws-sdk-core/plugins/glacier_account_id.rb +0 -19
- data/lib/aws-sdk-core/plugins/glacier_api_version.rb +0 -19
- data/lib/aws-sdk-core/plugins/glacier_checksums.rb +0 -87
- data/lib/aws-sdk-core/plugins/machine_learning_predict_endpoint.rb +0 -20
- data/lib/aws-sdk-core/plugins/request_signer.rb +0 -138
- data/lib/aws-sdk-core/plugins/route_53_id_fix.rb +0 -55
- data/lib/aws-sdk-core/plugins/s3_accelerate.rb +0 -73
- data/lib/aws-sdk-core/plugins/s3_bucket_dns.rb +0 -86
- data/lib/aws-sdk-core/plugins/s3_bucket_name_restrictions.rb +0 -21
- data/lib/aws-sdk-core/plugins/s3_expect_100_continue.rb +0 -27
- data/lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb +0 -21
- data/lib/aws-sdk-core/plugins/s3_http_200_errors.rb +0 -45
- data/lib/aws-sdk-core/plugins/s3_location_constraint.rb +0 -31
- data/lib/aws-sdk-core/plugins/s3_md5s.rb +0 -50
- data/lib/aws-sdk-core/plugins/s3_redirects.rb +0 -37
- data/lib/aws-sdk-core/plugins/s3_request_signer.rb +0 -166
- data/lib/aws-sdk-core/plugins/s3_sse_cpk.rb +0 -64
- data/lib/aws-sdk-core/plugins/s3_url_encoded_keys.rb +0 -92
- data/lib/aws-sdk-core/plugins/sqs_md5s.rb +0 -162
- data/lib/aws-sdk-core/plugins/sqs_queue_urls.rb +0 -34
- data/lib/aws-sdk-core/plugins/swf_read_timeouts.rb +0 -23
- data/lib/aws-sdk-core/rds.rb +0 -8
- data/lib/aws-sdk-core/redshift.rb +0 -7
- data/lib/aws-sdk-core/route53.rb +0 -7
- data/lib/aws-sdk-core/route53domains.rb +0 -5
- data/lib/aws-sdk-core/s3.rb +0 -26
- data/lib/aws-sdk-core/s3/bucket_region_cache.rb +0 -75
- data/lib/aws-sdk-core/s3/presigner.rb +0 -113
- data/lib/aws-sdk-core/service.rb +0 -4
- data/lib/aws-sdk-core/servicecatalog.rb +0 -5
- data/lib/aws-sdk-core/ses.rb +0 -7
- data/lib/aws-sdk-core/signers/base.rb +0 -31
- data/lib/aws-sdk-core/signers/s3.rb +0 -184
- data/lib/aws-sdk-core/signers/v2.rb +0 -51
- data/lib/aws-sdk-core/signers/v3.rb +0 -34
- data/lib/aws-sdk-core/signers/v4.rb +0 -233
- data/lib/aws-sdk-core/simpledb.rb +0 -5
- data/lib/aws-sdk-core/sns.rb +0 -6
- data/lib/aws-sdk-core/sqs.rb +0 -6
- data/lib/aws-sdk-core/ssm.rb +0 -6
- data/lib/aws-sdk-core/storagegateway.rb +0 -6
- data/lib/aws-sdk-core/sts.rb +0 -5
- data/lib/aws-sdk-core/support.rb +0 -5
- data/lib/aws-sdk-core/swf.rb +0 -5
- data/lib/aws-sdk-core/tree_hash.rb +0 -69
- data/lib/aws-sdk-core/version.rb +0 -3
- data/lib/aws-sdk-core/waf.rb +0 -5
- data/lib/aws-sdk-core/waiters/null_provider.rb +0 -12
- data/lib/aws-sdk-core/waiters/provider.rb +0 -35
- data/lib/aws-sdk-core/workspaces.rb +0 -6
- data/lib/seahorse/client/plugins/restful_bindings.rb +0 -127
- data/service-models.json +0 -285
@@ -1,113 +0,0 @@
|
|
1
|
-
module Aws
|
2
|
-
module S3
|
3
|
-
|
4
|
-
# Allows you to create presigned URLs for S3 operations.
|
5
|
-
#
|
6
|
-
# Example Use:
|
7
|
-
#
|
8
|
-
# signer = Aws::S3::Presigner.new
|
9
|
-
# url = signer.presigned_url(:get_object, bucket: "bucket", key: "key")
|
10
|
-
#
|
11
|
-
class Presigner
|
12
|
-
|
13
|
-
# @api private
|
14
|
-
ONE_WEEK = 60 * 60 * 24 * 7
|
15
|
-
|
16
|
-
# @api private
|
17
|
-
FIFTEEN_MINUTES = 60 * 15
|
18
|
-
|
19
|
-
# @option options [Client] :client Optionally provide an existing
|
20
|
-
# S3 client
|
21
|
-
def initialize(options = {})
|
22
|
-
@client = options[:client] || Aws::S3::Client.new
|
23
|
-
end
|
24
|
-
|
25
|
-
# @param [Symbol] method Symbolized method name of the operation you want
|
26
|
-
# to presign.
|
27
|
-
#
|
28
|
-
# @option params [Integer] :expires_in (900) The number of seconds
|
29
|
-
# before the presigned URL expires. Defaults to 15 minutes.
|
30
|
-
#
|
31
|
-
# @option params [Boolean] :secure (true) When `false`, a HTTP URL
|
32
|
-
# is returned instead of the default HTTPS URL.
|
33
|
-
#
|
34
|
-
# @option params [Boolean] :virtual_host (false) When `true`, the
|
35
|
-
# bucket name will be used as the hostname. This will cause
|
36
|
-
# the returned URL to be 'http' and not 'https'.
|
37
|
-
#
|
38
|
-
# @raise [ArgumentError] Raises an ArgumentError if `:expires_in`
|
39
|
-
# exceeds one week.
|
40
|
-
#
|
41
|
-
def presigned_url(method, params = {})
|
42
|
-
if params[:key].nil? or params[:key] == ''
|
43
|
-
raise ArgumentError, ":key must not be blank"
|
44
|
-
end
|
45
|
-
virtual_host = !!params.delete(:virtual_host)
|
46
|
-
scheme = http_scheme(params, virtual_host)
|
47
|
-
|
48
|
-
req = @client.build_request(method, params)
|
49
|
-
use_bucket_as_hostname(req) if virtual_host
|
50
|
-
sign_but_dont_send(req, expires_in(params), scheme)
|
51
|
-
req.send_request.data
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def http_scheme(params, virtual_host)
|
57
|
-
if params.delete(:secure) == false || virtual_host
|
58
|
-
'http'
|
59
|
-
else
|
60
|
-
@client.config.endpoint.scheme
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def expires_in(params)
|
65
|
-
if expires_in = params.delete(:expires_in)
|
66
|
-
if expires_in > ONE_WEEK
|
67
|
-
msg = "expires_in value of #{expires_in} exceeds one-week maximum"
|
68
|
-
raise ArgumentError, msg
|
69
|
-
end
|
70
|
-
expires_in
|
71
|
-
else
|
72
|
-
FIFTEEN_MINUTES
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def use_bucket_as_hostname(req)
|
77
|
-
req.handlers.remove(Plugins::S3BucketDns::Handler)
|
78
|
-
req.handle do |context|
|
79
|
-
uri = context.http_request.endpoint
|
80
|
-
uri.host = context.params[:bucket]
|
81
|
-
uri.path.sub!("/#{context.params[:bucket]}", '')
|
82
|
-
uri.scheme = 'http'
|
83
|
-
uri.port = 80
|
84
|
-
@handler.call(context)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def sign_but_dont_send(req, expires_in, scheme)
|
89
|
-
req.handlers.remove(Plugins::S3RequestSigner::SigningHandler)
|
90
|
-
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
91
|
-
req.handle(step: :send) do |context|
|
92
|
-
if scheme != context.http_request.endpoint.scheme
|
93
|
-
endpoint = context.http_request.endpoint.dup
|
94
|
-
endpoint.scheme = scheme
|
95
|
-
endpoint.port = (scheme == 'http' ? 80 : 443)
|
96
|
-
context.http_request.endpoint = URI.parse(endpoint.to_s)
|
97
|
-
end
|
98
|
-
signer = Signers::V4.new(
|
99
|
-
context.config.credentials, 's3',
|
100
|
-
context.config.region
|
101
|
-
)
|
102
|
-
url = signer.presigned_url(
|
103
|
-
context.http_request,
|
104
|
-
expires_in: expires_in,
|
105
|
-
body_digest: "UNSIGNED-PAYLOAD"
|
106
|
-
)
|
107
|
-
Seahorse::Client::Response.new(context: context, data: url)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
data/lib/aws-sdk-core/service.rb
DELETED
data/lib/aws-sdk-core/ses.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Aws.add_service(:SES, {
|
2
|
-
api: "#{Aws::API_DIR}/email/2010-12-01/api-2.json",
|
3
|
-
docs: "#{Aws::API_DIR}/email/2010-12-01/docs-2.json",
|
4
|
-
examples: "#{Aws::API_DIR}/email/2010-12-01/examples-1.json",
|
5
|
-
paginators: "#{Aws::API_DIR}/email/2010-12-01/paginators-1.json",
|
6
|
-
waiters: "#{Aws::API_DIR}/email/2010-12-01/waiters-2.json",
|
7
|
-
})
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
|
3
|
-
module Aws
|
4
|
-
module Signers
|
5
|
-
class Base
|
6
|
-
|
7
|
-
# @param [Credentials] credentials
|
8
|
-
def initialize(credentials)
|
9
|
-
@credentials = credentials.credentials
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def sha256_hmac(value)
|
15
|
-
Base64.encode64(
|
16
|
-
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
|
17
|
-
@credentials.secret_access_key, value)
|
18
|
-
).strip
|
19
|
-
end
|
20
|
-
|
21
|
-
class << self
|
22
|
-
|
23
|
-
# @param [Seahorse::Client::RequestContext] context
|
24
|
-
def sign(context)
|
25
|
-
new(context.config.credentials).sign(context.http_request)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,184 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'time'
|
3
|
-
require 'openssl'
|
4
|
-
require 'webrick/httputils'
|
5
|
-
|
6
|
-
module Aws
|
7
|
-
module Signers
|
8
|
-
class S3
|
9
|
-
|
10
|
-
SIGNED_QUERYSTRING_PARAMS = Set.new(%w(
|
11
|
-
|
12
|
-
acl delete cors lifecycle location logging notification partNumber
|
13
|
-
policy requestPayment restore tagging torrent uploadId uploads
|
14
|
-
versionId versioning versions website replication requestPayment
|
15
|
-
accelerate
|
16
|
-
|
17
|
-
response-content-type response-content-language
|
18
|
-
response-expires response-cache-control
|
19
|
-
response-content-disposition response-content-encoding
|
20
|
-
|
21
|
-
))
|
22
|
-
|
23
|
-
def self.sign(context)
|
24
|
-
new(
|
25
|
-
context.config.credentials,
|
26
|
-
context.params,
|
27
|
-
context.config.force_path_style
|
28
|
-
).sign(context.http_request)
|
29
|
-
end
|
30
|
-
|
31
|
-
# @param [CredentialProvider] credentials
|
32
|
-
def initialize(credentials, params, force_path_style)
|
33
|
-
@credentials = credentials.credentials
|
34
|
-
@params = Query::ParamList.new
|
35
|
-
params.each_pair do |param_name, param_value|
|
36
|
-
@params.set(param_name, param_value)
|
37
|
-
end
|
38
|
-
@force_path_style = force_path_style
|
39
|
-
end
|
40
|
-
|
41
|
-
attr_reader :credentials, :params
|
42
|
-
|
43
|
-
def sign(request)
|
44
|
-
if token = credentials.session_token
|
45
|
-
request.headers["X-Amz-Security-Token"] = token
|
46
|
-
end
|
47
|
-
request.headers['Authorization'] = authorization(request)
|
48
|
-
end
|
49
|
-
|
50
|
-
def authorization(request)
|
51
|
-
"AWS #{credentials.access_key_id}:#{signature(request)}"
|
52
|
-
end
|
53
|
-
|
54
|
-
def signature(request)
|
55
|
-
string_to_sign = string_to_sign(request)
|
56
|
-
signature = digest(credentials.secret_access_key, string_to_sign)
|
57
|
-
uri_escape(signature)
|
58
|
-
end
|
59
|
-
|
60
|
-
def digest(secret, string_to_sign)
|
61
|
-
Base64.encode64(hmac(secret, string_to_sign)).strip
|
62
|
-
end
|
63
|
-
|
64
|
-
def hmac(key, value)
|
65
|
-
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), key, value)
|
66
|
-
end
|
67
|
-
|
68
|
-
# From the S3 developer guide:
|
69
|
-
#
|
70
|
-
# StringToSign =
|
71
|
-
# HTTP-Verb ` "\n" `
|
72
|
-
# content-md5 ` "\n" `
|
73
|
-
# content-type ` "\n" `
|
74
|
-
# date ` "\n" `
|
75
|
-
# CanonicalizedAmzHeaders + CanonicalizedResource;
|
76
|
-
#
|
77
|
-
def string_to_sign(request)
|
78
|
-
[
|
79
|
-
request.http_method,
|
80
|
-
request.headers.values_at('Content-Md5', 'Content-Type').join("\n"),
|
81
|
-
signing_string_date(request),
|
82
|
-
canonicalized_headers(request),
|
83
|
-
canonicalized_resource(request.endpoint),
|
84
|
-
].flatten.compact.join("\n")
|
85
|
-
end
|
86
|
-
|
87
|
-
def signing_string_date(request)
|
88
|
-
# if a date is provided via x-amz-date then we should omit the
|
89
|
-
# Date header from the signing string (should appear as a blank line)
|
90
|
-
if request.headers.detect{|k,v| k.to_s =~ /^x-amz-date$/i }
|
91
|
-
''
|
92
|
-
else
|
93
|
-
request.headers['Date'] = Time.now.httpdate
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# CanonicalizedAmzHeaders
|
98
|
-
#
|
99
|
-
# See the developer guide for more information on how this element
|
100
|
-
# is generated.
|
101
|
-
#
|
102
|
-
def canonicalized_headers(request)
|
103
|
-
x_amz = request.headers.select{|k, v| k =~ /^x-amz-/i }
|
104
|
-
x_amz = x_amz.collect{|k, v| [k.downcase, v] }
|
105
|
-
x_amz = x_amz.sort_by{|k, v| k }
|
106
|
-
x_amz = x_amz.collect{|k, v| "#{k}:#{v.to_s.strip}" }.join("\n")
|
107
|
-
x_amz == '' ? nil : x_amz
|
108
|
-
end
|
109
|
-
|
110
|
-
# From the S3 developer guide
|
111
|
-
#
|
112
|
-
# CanonicalizedResource =
|
113
|
-
# [ "/" ` Bucket ] `
|
114
|
-
# <HTTP-Request-URI, protocol name up to the querystring> +
|
115
|
-
# [ sub-resource, if present. e.g. "?acl", "?location",
|
116
|
-
# "?logging", or "?torrent"];
|
117
|
-
#
|
118
|
-
# @api private
|
119
|
-
def canonicalized_resource(endpoint)
|
120
|
-
|
121
|
-
parts = []
|
122
|
-
|
123
|
-
# virtual hosted-style requests require the hostname to appear
|
124
|
-
# in the canonicalized resource prefixed by a forward slash.
|
125
|
-
if bucket = params[:bucket]
|
126
|
-
bucket = bucket.value
|
127
|
-
ssl = endpoint.scheme == 'https'
|
128
|
-
if Plugins::S3BucketDns.dns_compatible?(bucket, ssl) && !@force_path_style
|
129
|
-
parts << "/#{bucket}"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
# append the path name (no querystring)
|
134
|
-
parts << endpoint.path
|
135
|
-
|
136
|
-
# lastly any sub resource querystring params need to be appened
|
137
|
-
# in lexigraphical ordered joined by '&' and prefixed by '?'
|
138
|
-
params = signed_querystring_params(endpoint)
|
139
|
-
|
140
|
-
unless params.empty?
|
141
|
-
parts << '?'
|
142
|
-
parts << params.sort.collect{|p| p.to_s }.join('&')
|
143
|
-
end
|
144
|
-
|
145
|
-
parts.join
|
146
|
-
end
|
147
|
-
|
148
|
-
def signed_querystring_params(endpoint)
|
149
|
-
endpoint.query.to_s.split('&').select do |p|
|
150
|
-
SIGNED_QUERYSTRING_PARAMS.include?(p.split('=')[0])
|
151
|
-
end.map { |p| CGI.unescape(p) }
|
152
|
-
end
|
153
|
-
|
154
|
-
def uri_escape(s)
|
155
|
-
|
156
|
-
#URI.escape(s)
|
157
|
-
|
158
|
-
# URI.escape is deprecated, replacing it with escape from webrick
|
159
|
-
# to squelch the massive number of warnings generated from Ruby.
|
160
|
-
# The following script was used to determine the differences
|
161
|
-
# between the various escape methods available. The webrick
|
162
|
-
# escape only had two differences and it is available in the
|
163
|
-
# standard lib.
|
164
|
-
#
|
165
|
-
# (0..255).each {|c|
|
166
|
-
# s = [c].pack("C")
|
167
|
-
# e = [
|
168
|
-
# CGI.escape(s),
|
169
|
-
# ERB::Util.url_encode(s),
|
170
|
-
# URI.encode_www_form_component(s),
|
171
|
-
# WEBrick::HTTPUtils.escape_form(s),
|
172
|
-
# WEBrick::HTTPUtils.escape(s),
|
173
|
-
# URI.escape(s),
|
174
|
-
# ]
|
175
|
-
# next if e.uniq.length == 1
|
176
|
-
# puts("%5s %5s %5s %5s %5s %5s %5s" % ([s.inspect] + e))
|
177
|
-
# }
|
178
|
-
#
|
179
|
-
WEBrick::HTTPUtils.escape(s).gsub('%5B', '[').gsub('%5D', ']')
|
180
|
-
end
|
181
|
-
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Aws
|
2
|
-
module Signers
|
3
|
-
class V2 < Base
|
4
|
-
|
5
|
-
# @param [Http::Request] http_request
|
6
|
-
def sign(http_request)
|
7
|
-
params = http_request.body.param_list
|
8
|
-
params.set('AWSAccessKeyId', @credentials.access_key_id)
|
9
|
-
params.set('SecurityToken', @credentials.session_token) if
|
10
|
-
@credentials.session_token
|
11
|
-
params.set('Timestamp', Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
12
|
-
params.set('SignatureVersion', '2')
|
13
|
-
params.set('SignatureMethod', 'HmacSHA256')
|
14
|
-
params.delete('Signature')
|
15
|
-
params.set('Signature', signature(http_request, params))
|
16
|
-
http_request.body = params.to_io
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def signature(http_request, params)
|
22
|
-
sha256_hmac(string_to_sign(http_request, params))
|
23
|
-
end
|
24
|
-
|
25
|
-
def string_to_sign(http_request, params)
|
26
|
-
[
|
27
|
-
http_request.http_method,
|
28
|
-
host(http_request.endpoint),
|
29
|
-
path(http_request.endpoint),
|
30
|
-
params.to_s,
|
31
|
-
].join("\n")
|
32
|
-
end
|
33
|
-
|
34
|
-
def host(endpoint)
|
35
|
-
host = endpoint.host.downcase
|
36
|
-
if
|
37
|
-
(endpoint.scheme == 'http' && endpoint.port != 80) ||
|
38
|
-
(endpoint.scheme == 'https' && endpoint.port != 443)
|
39
|
-
then
|
40
|
-
host += ":#{endpoint.port}"
|
41
|
-
end
|
42
|
-
host
|
43
|
-
end
|
44
|
-
|
45
|
-
def path(endpoint)
|
46
|
-
endpoint.path == '' ? '/' : endpoint.path
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
require 'base64'
|
3
|
-
require 'openssl'
|
4
|
-
|
5
|
-
module Aws
|
6
|
-
# @api private
|
7
|
-
module Signers
|
8
|
-
class V3 < Base
|
9
|
-
|
10
|
-
def sign(http_req)
|
11
|
-
|
12
|
-
date = Time.now.httpdate
|
13
|
-
http_req.headers['Date'] = date
|
14
|
-
|
15
|
-
if @credentials.session_token
|
16
|
-
http_req.headers['X-Amz-Security-Token'] = @credentials.session_token
|
17
|
-
end
|
18
|
-
|
19
|
-
parts = []
|
20
|
-
parts << "AWS3-HTTPS AWSAccessKeyId=#{@credentials.access_key_id}"
|
21
|
-
parts << "Algorithm=HmacSHA256"
|
22
|
-
parts << "Signature=#{signature(date)}"
|
23
|
-
http_req.headers['X-Amzn-Authorization'] = parts.join(',')
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def signature(date)
|
29
|
-
sha256_hmac(date)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,233 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
require 'openssl'
|
3
|
-
|
4
|
-
module Aws
|
5
|
-
module Signers
|
6
|
-
class V4
|
7
|
-
|
8
|
-
BLACKLIST_HEADERS = [
|
9
|
-
'cache-control',
|
10
|
-
'content-length',
|
11
|
-
'expect',
|
12
|
-
'max-forwards',
|
13
|
-
'pragma',
|
14
|
-
'te',
|
15
|
-
'if-match',
|
16
|
-
'if-none-match',
|
17
|
-
'if-modified-since',
|
18
|
-
'if-unmodified-since',
|
19
|
-
'if-range',
|
20
|
-
'accept',
|
21
|
-
'authorization',
|
22
|
-
'proxy-authorization',
|
23
|
-
'from',
|
24
|
-
'referer',
|
25
|
-
'user-agent'
|
26
|
-
]
|
27
|
-
|
28
|
-
def self.sign(context)
|
29
|
-
new(
|
30
|
-
context.config.credentials,
|
31
|
-
context.config.sigv4_name,
|
32
|
-
context.config.sigv4_region
|
33
|
-
).sign(context.http_request)
|
34
|
-
end
|
35
|
-
|
36
|
-
# @param [Credentials] credentials
|
37
|
-
# @param [String] service_name The name used by the service in
|
38
|
-
# signing signature version 4 requests. This is generally
|
39
|
-
# the endpoint prefix.
|
40
|
-
# @param [String] region The region (e.g. 'us-west-1') the request
|
41
|
-
# will be made to.
|
42
|
-
def initialize(credentials, service_name, region)
|
43
|
-
@service_name = service_name
|
44
|
-
@credentials = credentials.credentials
|
45
|
-
@region = EndpointProvider.signing_region(region, service_name)
|
46
|
-
end
|
47
|
-
|
48
|
-
# @param [Seahorse::Client::Http::Request] req
|
49
|
-
# @return [Seahorse::Client::Http::Request] the signed request.
|
50
|
-
def sign(req)
|
51
|
-
datetime = Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
|
52
|
-
body_digest = req.headers['X-Amz-Content-Sha256'] || hexdigest(req.body)
|
53
|
-
req.headers['X-Amz-Date'] = datetime
|
54
|
-
req.headers['Host'] = host(req.endpoint)
|
55
|
-
req.headers['X-Amz-Security-Token'] = @credentials.session_token if
|
56
|
-
@credentials.session_token
|
57
|
-
req.headers['X-Amz-Content-Sha256'] ||= body_digest
|
58
|
-
req.headers['Authorization'] = authorization(req, datetime, body_digest)
|
59
|
-
req
|
60
|
-
end
|
61
|
-
|
62
|
-
# Generates an returns a presigned URL.
|
63
|
-
# @param [Seahorse::Client::Http::Request] request
|
64
|
-
# @option options [required, Integer<Seconds>] :expires_in
|
65
|
-
# @option options [optional, String] :body_digest The SHA256 hexdigest of
|
66
|
-
# the payload to sign. For S3, this should be the string literal
|
67
|
-
# `UNSIGNED-PAYLOAD`.
|
68
|
-
# @return [String]
|
69
|
-
# @api private
|
70
|
-
def presigned_url(request, options = {})
|
71
|
-
now = Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
|
72
|
-
body_digest = options[:body_digest] || hexdigest(request.body)
|
73
|
-
|
74
|
-
request.headers['Host'] = host(request.endpoint)
|
75
|
-
request.headers.delete('User-Agent')
|
76
|
-
|
77
|
-
params = Aws::Query::ParamList.new
|
78
|
-
|
79
|
-
request.headers.keys.each do |key|
|
80
|
-
if key.match(/^x-amz/i)
|
81
|
-
params.set(key, request.headers.delete(key))
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
params.set("X-Amz-Algorithm", "AWS4-HMAC-SHA256")
|
86
|
-
params.set("X-Amz-Credential", credential(now))
|
87
|
-
params.set("X-Amz-Date", now)
|
88
|
-
params.set("X-Amz-Expires", options[:expires_in].to_s)
|
89
|
-
params.set("X-Amz-SignedHeaders", signed_headers(request))
|
90
|
-
params.set('X-Amz-Security-Token', @credentials.session_token) if
|
91
|
-
@credentials.session_token
|
92
|
-
|
93
|
-
endpoint = request.endpoint
|
94
|
-
if endpoint.query
|
95
|
-
endpoint.query += '&' + params.to_s
|
96
|
-
else
|
97
|
-
endpoint.query = params.to_s
|
98
|
-
end
|
99
|
-
endpoint.to_s + '&X-Amz-Signature=' + signature(request, now, body_digest)
|
100
|
-
end
|
101
|
-
|
102
|
-
def authorization(request, datetime, body_digest)
|
103
|
-
parts = []
|
104
|
-
parts << "AWS4-HMAC-SHA256 Credential=#{credential(datetime)}"
|
105
|
-
parts << "SignedHeaders=#{signed_headers(request)}"
|
106
|
-
parts << "Signature=#{signature(request, datetime, body_digest)}"
|
107
|
-
parts.join(', ')
|
108
|
-
end
|
109
|
-
|
110
|
-
def credential(datetime)
|
111
|
-
"#{@credentials.access_key_id}/#{credential_scope(datetime)}"
|
112
|
-
end
|
113
|
-
|
114
|
-
def signature(request, datetime, body_digest)
|
115
|
-
k_secret = @credentials.secret_access_key
|
116
|
-
k_date = hmac("AWS4" + k_secret, datetime[0,8])
|
117
|
-
k_region = hmac(k_date, @region)
|
118
|
-
k_service = hmac(k_region, @service_name)
|
119
|
-
k_credentials = hmac(k_service, 'aws4_request')
|
120
|
-
hexhmac(k_credentials, string_to_sign(request, datetime, body_digest))
|
121
|
-
end
|
122
|
-
|
123
|
-
def string_to_sign(request, datetime, body_digest)
|
124
|
-
parts = []
|
125
|
-
parts << 'AWS4-HMAC-SHA256'
|
126
|
-
parts << datetime
|
127
|
-
parts << credential_scope(datetime)
|
128
|
-
parts << hexdigest(canonical_request(request, body_digest))
|
129
|
-
parts.join("\n")
|
130
|
-
end
|
131
|
-
|
132
|
-
def credential_scope(datetime)
|
133
|
-
parts = []
|
134
|
-
parts << datetime[0,8]
|
135
|
-
parts << @region
|
136
|
-
parts << @service_name
|
137
|
-
parts << 'aws4_request'
|
138
|
-
parts.join("/")
|
139
|
-
end
|
140
|
-
|
141
|
-
def canonical_request(request, body_digest)
|
142
|
-
[
|
143
|
-
request.http_method,
|
144
|
-
path(request.endpoint),
|
145
|
-
normalized_querystring(request.endpoint.query || ''),
|
146
|
-
canonical_headers(request) + "\n",
|
147
|
-
signed_headers(request),
|
148
|
-
body_digest
|
149
|
-
].join("\n")
|
150
|
-
end
|
151
|
-
|
152
|
-
def path(uri)
|
153
|
-
path = uri.path == '' ? '/' : uri.path
|
154
|
-
if @service_name == 's3'
|
155
|
-
path
|
156
|
-
else
|
157
|
-
Seahorse::Util.uri_path_escape(path)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
def normalized_querystring(querystring)
|
162
|
-
params = querystring.split('&')
|
163
|
-
params = params.map { |p| p.match(/=/) ? p : p + '=' }
|
164
|
-
# We have to sort by param name and preserve order of params that
|
165
|
-
# have the same name. Default sort <=> in JRuby will swap members
|
166
|
-
# occasionally when <=> is 0 (considered still sorted), but this
|
167
|
-
# causes our normalized query string to not match the sent querystring.
|
168
|
-
# When names match, we then sort by their original order
|
169
|
-
params = params.each.with_index.sort do |a, b|
|
170
|
-
a, a_offset = a
|
171
|
-
a_name = a.split('=')[0]
|
172
|
-
b, b_offset = b
|
173
|
-
b_name = b.split('=')[0]
|
174
|
-
if a_name == b_name
|
175
|
-
a_offset <=> b_offset
|
176
|
-
else
|
177
|
-
a_name <=> b_name
|
178
|
-
end
|
179
|
-
end.map(&:first).join('&')
|
180
|
-
end
|
181
|
-
|
182
|
-
def signed_headers(request)
|
183
|
-
request.headers.keys.inject([]) do |signed_headers, header_key|
|
184
|
-
header_key = header_key.downcase
|
185
|
-
unless BLACKLIST_HEADERS.include?(header_key)
|
186
|
-
signed_headers << header_key
|
187
|
-
end
|
188
|
-
signed_headers
|
189
|
-
end.sort.join(';')
|
190
|
-
end
|
191
|
-
|
192
|
-
def canonical_headers(request)
|
193
|
-
headers = []
|
194
|
-
request.headers.each_pair do |k,v|
|
195
|
-
k = k.downcase
|
196
|
-
headers << [k,v] unless BLACKLIST_HEADERS.include?(k)
|
197
|
-
end
|
198
|
-
headers = headers.sort_by(&:first)
|
199
|
-
headers.map{|k,v| "#{k}:#{canonical_header_value(v.to_s)}" }.join("\n")
|
200
|
-
end
|
201
|
-
|
202
|
-
def canonical_header_value(value)
|
203
|
-
value.match(/^".*"$/) ? value : value.gsub(/\s+/, ' ').strip
|
204
|
-
end
|
205
|
-
|
206
|
-
def host(uri)
|
207
|
-
if standard_port?(uri)
|
208
|
-
uri.host
|
209
|
-
else
|
210
|
-
"#{uri.host}:#{uri.port}"
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
def standard_port?(uri)
|
215
|
-
(uri.scheme == 'http' && uri.port == 80) ||
|
216
|
-
(uri.scheme == 'https' && uri.port == 443)
|
217
|
-
end
|
218
|
-
|
219
|
-
def hexdigest(value)
|
220
|
-
Aws::Checksums.sha256_hexdigest(value)
|
221
|
-
end
|
222
|
-
|
223
|
-
def hmac(key, value)
|
224
|
-
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, value)
|
225
|
-
end
|
226
|
-
|
227
|
-
def hexhmac(key, value)
|
228
|
-
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), key, value)
|
229
|
-
end
|
230
|
-
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|