aws-sdk-core 2.0.0.rc6 → 2.0.0.rc7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +48 -18
  4. data/apis/AutoScaling-2011-01-01.json +14 -6
  5. data/apis/CloudFormation-2010-05-15.json +6 -6
  6. data/apis/CloudFront-2012-05-05.json +5 -6
  7. data/apis/CloudFront-2013-05-12.json +5 -6
  8. data/apis/CloudFront-2013-08-26.json +5 -6
  9. data/apis/CloudFront-2013-11-11.json +5 -6
  10. data/apis/CloudFront-2013-11-22.json +5557 -0
  11. data/apis/CloudFront-2014-01-31.json +5627 -0
  12. data/apis/CloudSearch-2011-02-01.json +136 -4
  13. data/apis/CloudSearch-2013-01-01.json +3515 -0
  14. data/apis/CloudTrail-2013-11-01.json +288 -0
  15. data/apis/CloudWatch-2010-08-01.json +6 -6
  16. data/apis/DataPipeline-2012-10-29.json +0 -1
  17. data/apis/DirectConnect-2012-10-25.json +5 -6
  18. data/apis/DynamoDB-2011-12-05.json +6 -6
  19. data/apis/DynamoDB-2012-08-10.json +307 -6
  20. data/apis/EC2-2013-06-15.json +6 -6
  21. data/apis/EC2-2013-10-01.json +6 -6
  22. data/apis/EC2-2013-10-15.json +6 -6
  23. data/apis/EC2-2014-02-01.json +15189 -0
  24. data/apis/EMR-2009-03-31.json +8 -8
  25. data/apis/ElastiCache-2012-11-15.json +6 -6
  26. data/apis/ElastiCache-2013-06-15.json +6 -6
  27. data/apis/ElastiCache-2014-03-24.json +4344 -0
  28. data/apis/ElasticBeanstalk-2010-12-01.json +6 -7
  29. data/apis/ElasticLoadBalancing-2012-06-01.json +216 -6
  30. data/apis/ElasticTranscoder-2012-09-25.json +4 -5
  31. data/apis/Glacier-2012-06-01.json +5 -5
  32. data/apis/IAM-2010-05-08.json +6 -6
  33. data/apis/ImportExport-2010-06-01.json +5 -6
  34. data/apis/Kinesis-2013-12-02.json +2 -3
  35. data/apis/OpsWorks-2013-02-18.json +149 -2
  36. data/apis/RDS-2013-01-10.json +6 -6
  37. data/apis/RDS-2013-02-12.json +6 -6
  38. data/apis/RDS-2013-05-15.json +6 -6
  39. data/apis/RDS-2013-09-09.json +6 -6
  40. data/apis/Redshift-2012-12-01.json +64 -5
  41. data/apis/Route53-2012-12-12.json +5 -6
  42. data/apis/Route53-2013-04-01.json +37 -6
  43. data/apis/S3-2006-03-01.json +8 -7
  44. data/apis/SDB-2009-04-15.json +5 -6
  45. data/apis/SES-2010-12-01.json +0 -1
  46. data/apis/SNS-2010-03-31.json +6 -6
  47. data/apis/SQS-2012-11-05.json +154 -6
  48. data/apis/STS-2011-06-15.json +14 -6
  49. data/apis/SWF-2012-01-25.json +6 -6
  50. data/apis/StorageGateway-2012-06-30.json +16 -16
  51. data/apis/StorageGateway-2013-06-30.json +21 -21
  52. data/apis/Support-2013-04-15.json +0 -1
  53. data/apis/configuration/endpoints.json +258 -154
  54. data/apis/source/autoscaling-2011-01-01.json +19 -19
  55. data/apis/source/cloudformation-2010-05-15.json +17 -17
  56. data/apis/source/cloudfront-2013-11-22.json +8898 -0
  57. data/apis/source/cloudfront-2013-11-22.paginators.json +32 -0
  58. data/apis/source/cloudfront-2013-11-22.waiters.json +29 -0
  59. data/apis/source/cloudfront-2014-01-31.json +8975 -0
  60. data/apis/source/cloudfront-2014-01-31.normal.json +2905 -0
  61. data/apis/source/cloudfront-2014-01-31.paginators.json +32 -0
  62. data/apis/source/cloudfront-2014-01-31.waiters.json +29 -0
  63. data/apis/source/cloudsearch-2011-02-01.json +286 -8
  64. data/apis/source/cloudsearch-2013-01-01.json +5547 -0
  65. data/apis/source/cloudsearch-2013-01-01.paginators.json +20 -0
  66. data/apis/source/cloudtrail-2013-11-01.json +539 -0
  67. data/apis/source/cloudtrail-2013-11-01.paginators.json +7 -0
  68. data/apis/source/dynamodb-2011-12-05.json +19 -0
  69. data/apis/source/dynamodb-2012-08-10.json +415 -2
  70. data/apis/source/ec2-2014-02-01.json +20576 -0
  71. data/apis/source/ec2-2014-02-01.paginators.json +126 -0
  72. data/apis/source/ec2-2014-02-01.waiters.json +146 -0
  73. data/apis/source/elasticache-2014-03-24.json +6463 -0
  74. data/apis/source/elasticache-2014-03-24.paginators.json +70 -0
  75. data/apis/source/elasticloadbalancing-2012-06-01.json +455 -164
  76. data/apis/source/elasticloadbalancing-2012-06-01.normal.json +2107 -0
  77. data/apis/source/kinesis-2013-12-02.json +5 -5
  78. data/apis/source/kinesis-2013-12-02.normal.json +761 -0
  79. data/apis/source/kinesis-2013-12-02.paginators.json +6 -6
  80. data/apis/source/opsworks-2013-02-18.json +242 -39
  81. data/apis/source/opsworks-2013-02-18.paginators.json +3 -0
  82. data/apis/source/redshift-2012-12-01.json +180 -91
  83. data/apis/source/route53-2013-04-01.json +68 -4
  84. data/apis/source/sqs-2012-11-05.json +237 -7
  85. data/apis/source/sts-2011-06-15.json +18 -2
  86. data/bin/aws.rb +7 -7
  87. data/doc-src/plugins/apis.rb +1 -1
  88. data/features/cloudtrail/client.feature +17 -0
  89. data/features/cloudtrail/step_definitions.rb +6 -0
  90. data/features/datapipeline/client.feature +1 -1
  91. data/lib/aws.rb +21 -5
  92. data/lib/aws/api/service_translators/s3.rb +1 -0
  93. data/lib/aws/api/translator.rb +1 -2
  94. data/lib/aws/credential_provider_chain.rb +62 -0
  95. data/lib/aws/credentials.rb +4 -1
  96. data/lib/aws/errors.rb +4 -0
  97. data/lib/aws/plugins/credentials.rb +24 -31
  98. data/lib/aws/plugins/s3_location_constraint.rb +38 -0
  99. data/lib/aws/shared_credentials.rb +105 -0
  100. data/lib/aws/structure.rb +1 -0
  101. data/lib/aws/util.rb +18 -19
  102. data/lib/aws/version.rb +1 -1
  103. data/spec/aws/credentials_spec.rb +8 -0
  104. data/spec/aws/plugins/credentials_spec.rb +71 -15
  105. data/spec/aws/plugins/s3_location_constraint_spec.rb +48 -0
  106. data/spec/aws/shared_credentials_spec.rb +68 -0
  107. data/spec/aws/util_spec.rb +107 -0
  108. data/spec/aws_spec.rb +6 -0
  109. data/spec/fixtures/credentials/mock_shared_credentials +14 -0
  110. data/spec/fixtures/operations/s3/create_bucket_with_implied_location_constraint.yml +23 -0
  111. data/spec/spec_helper.rb +4 -0
  112. data/tasks/test.rake +10 -7
  113. data/vendor/seahorse/lib/seahorse/client/param_converter.rb +2 -2
  114. metadata +43 -3
  115. data/lib/aws/plugins/instance_profile_credentials.rb +0 -14
@@ -8,7 +8,7 @@
8
8
  "global_endpoint": "sts.amazonaws.com",
9
9
  "endpoint_prefix": "sts",
10
10
  "xmlnamespace": "https://sts.amazonaws.com/doc/2011-06-15/",
11
- "documentation": "\n\t\t<fullname>AWS Security Token Service</fullname>\n\n\t\t<p> The AWS Security Token Service (AWS STS) is a web service that enables you to request temporary,\n\t\t\tlimited-privilege credentials for AWS Identity and Access Management (AWS IAM) users or for users that you authenticate\n\t\t\t(federated users). This guide provides descriptions of the AWS STS API. For more detailed\n\t\t\tinformation about using this service, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UsingSTS/Welcome.html\" target=\"_blank\">Using\n\t\t\t\tTemporary Security Credentials</a>. </p>\n\n\t\t<note> As an alternative to using the API, you can use one of the AWS SDKs, which consist of\n\t\t\tlibraries and sample code for various programming languages and platforms (Java, Ruby, .NET,\n\t\t\tiOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to\n\t\t\tAWS STS. For example, the SDKs take care of cryptographically signing requests, managing\n\t\t\terrors, and retrying requests automatically. For information about the AWS SDKs, including how\n\t\t\tto download and install them, see the <a href=\"http://aws.amazon.com/tools/\">Tools for Amazon\n\t\t\t\tWeb Services page</a>. </note>\n\n\t\t<p> For information about setting up signatures and authorization through the API, go to <a href=\"http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html\" target=\"_blank\">Signing AWS API Requests</a> in the <i>AWS General Reference</i>. For\n\t\t\tgeneral information about the Query API, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html\" target=\"_blank\">Making Query Requests</a> in <i>Using IAM</i>. For information about using\n\t\t\tsecurity tokens with other AWS products, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UsingSTS/UsingTokens.html\">Using Temporary\n\t\t\t\tSecurity Credentials to Access AWS</a> in <i>Using Temporary Security Credentials</i>. </p>\n\n\t\t<p> If you're new to AWS and need additional technical information about a specific AWS product,\n\t\t\tyou can find the product's technical documentation at <a href=\"http://aws.amazon.com/documentation/\" target=\"_blank\">http://aws.amazon.com/documentation/</a>. </p>\n\n\t\t<p><b>Endpoints</b></p>\n\t\t<p>For information about AWS STS endpoints, see <a href=\"http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region\" target=\"_blank\">Regions and Endpoints</a> in the <i>AWS General Reference</i>.</p>\n\n\t\t<p><b>Recording API requests</b></p>\n\t\t<p>AWS STS supports AWS CloudTrail, which is a service that records AWS calls for your AWS account and delivers \n\t\t\tlog files to an Amazon S3 bucket. By using information collected by CloudTrail, you can determine what \n\t\t\trequests were successfully made to AWS STS, who made the request, when it was made, and so on. To learn more about \n\t\t\tCloudTrail, including how to turn it on and find your log files, see the \n\t\t\t<a href=\"http://docs.aws.amazon.com/awscloudtrail/latest/userguide/whatisawscloudtrail.html\">AWS CloudTrail User Guide</a>.</p>\n\n\n\t",
11
+ "documentation": "\n\t\t<fullname>AWS Security Token Service</fullname>\n\n\t\t<p> The AWS Security Token Service (AWS STS) is a web service that enables you to request temporary,\n\t\t\tlimited-privilege credentials for AWS Identity and Access Management (AWS IAM) users or for users that you authenticate\n\t\t\t(federated users). This guide provides descriptions of the AWS STS API. For more detailed\n\t\t\tinformation about using this service, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UsingSTS/Welcome.html\" target=\"_blank\">Using\n\t\t\t\tTemporary Security Credentials</a>. </p>\n\n\t\t<note> As an alternative to using the API, you can use one of the AWS SDKs, which consist of\n\t\t\tlibraries and sample code for various programming languages and platforms (Java, Ruby, .NET,\n\t\t\tiOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to\n\t\t\tAWS STS. For example, the SDKs take care of cryptographically signing requests, managing\n\t\t\terrors, and retrying requests automatically. For information about the AWS SDKs, including how\n\t\t\tto download and install them, see the <a href=\"http://aws.amazon.com/tools/\">Tools for Amazon\n\t\t\t\tWeb Services page</a>. </note>\n\n\t\t<p> For information about setting up signatures and authorization through the API, go to <a href=\"http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html\" target=\"_blank\">Signing AWS API Requests</a> in the <i>AWS General Reference</i>. For\n\t\t\tgeneral information about the Query API, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html\" target=\"_blank\">Making Query Requests</a> in <i>Using IAM</i>. For information about using\n\t\t\tsecurity tokens with other AWS products, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UsingSTS/UsingTokens.html\">Using Temporary\n\t\t\t\tSecurity Credentials to Access AWS</a> in <i>Using Temporary Security Credentials</i>. </p>\n\n\t\t<p> If you're new to AWS and need additional technical information about a specific AWS product,\n\t\t\tyou can find the product's technical documentation at <a href=\"http://aws.amazon.com/documentation/\" target=\"_blank\">http://aws.amazon.com/documentation/</a>. </p>\n\n\t\t<p>\n\t\t\t<b>Endpoints</b>\n\t\t</p>\n\t\t<p>For information about AWS STS endpoints, see <a href=\"http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region\" target=\"_blank\">Regions and Endpoints</a> in the <i>AWS General Reference</i>.</p>\n\t",
12
12
  "operations": {
13
13
  "AssumeRole": {
14
14
  "name": "AssumeRole",
@@ -55,6 +55,22 @@
55
55
  "max_length": 96,
56
56
  "pattern": "[\\w+=,.@:-]*",
57
57
  "documentation": "\n\t\t<p> A unique identifier that is used by third parties to assume a role in their customers'\n\t\t\taccounts. For each role that the third party can assume, they should instruct their customers\n\t\t\tto create a role with the external ID that the third party generated. Each time the third\n\t\t\tparty assumes the role, they must pass the customer's external ID. The external ID is useful\n\t\t\tin order to help third parties bind a role to the customer who created it. For more\n\t\t\tinformation about the external ID, see <a href=\"http://docs.aws.amazon.com/STS/latest/UsingSTS/sts-delegating-externalid.html\" target=\"_blank\">About the External ID</a> in <i>Using Temporary Security Credentials</i>.\n\t\t</p>\n\t"
58
+ },
59
+ "SerialNumber": {
60
+ "shape_name": "serialNumberType",
61
+ "type": "string",
62
+ "min_length": 9,
63
+ "max_length": 256,
64
+ "pattern": "[\\w+=/:,.@-]*",
65
+ "documentation": null
66
+ },
67
+ "TokenCode": {
68
+ "shape_name": "tokenCodeType",
69
+ "type": "string",
70
+ "min_length": 6,
71
+ "max_length": 6,
72
+ "pattern": "[\\d]*",
73
+ "documentation": null
58
74
  }
59
75
  },
60
76
  "documentation": null
@@ -804,7 +820,7 @@
804
820
  "errors": [
805
821
 
806
822
  ],
807
- "documentation": "\n\t\t<p> Returns a set of temporary credentials for an AWS account or IAM user. The credentials\n\t\t\tconsist of an access key ID, a secret access key, and a security token. Typically, you use\n\t\t\t\t<code>GetSessionToken</code> if you want use MFA to protect programmatic calls to specific\n\t\t\tAWS APIs like Amazon EC2 <code>StopInstances</code>. MFA-enabled IAM users would need to call\n\t\t\t\t<code>GetSessionToken</code> and submit an MFA code that is associated with their MFA\n\t\t\tdevice. Using the temporary security credentials that are returned from the call, IAM users\n\t\t\tcan then make programmatic calls to APIs that require MFA authentication. </p>\n\n\t\t<p> The <code>GetSessionToken</code> action must be called by using the long-term AWS security\n\t\t\tcredentials of the AWS account or an IAM user. Credentials that are created by IAM users are\n\t\t\tvalid for the duration that you specify, between 900 seconds (15 minutes) and 129600 seconds\n\t\t\t(36 hours); credentials that are created by using account credentials have a maximum duration\n\t\t\tof 3600 seconds (1 hour). </p>\n\t\t\n\t\t<p>The permissions associated with the temporary security credentials returned by <code>GetSessionToken</code>\n\t\t\tare based on the permissions associated with account or IAM user whose credentials are used to \n\t\t\tcall the action. If <code>GetSessionToken</code> is called using root account credentials, the\n\t\t\ttemporary credentials have root account permissions. Similarly, if <code>GetSessionToken</code>\n\t\t\tis called using the credentials of an IAM user, the temporary credentials have the same \n\t\t\tpermissions as the IAM user.\n\t\t</p>\n\t\t\n\t\t<p>For more information about using <code>GetSessionToken</code> to create temporary\n\t\t\tcredentials, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UserGuide/CreatingSessionTokens.html\" target=\"_blank\"> Creating Temporary Credentials to Enable Access for IAM Users </a> in\n\t\t\t\t<i>Using IAM</i>. \n\t\t</p>\n\n\t\t<examples>\n\t\t\t<queryrequest>\n\t\t\t\thttps://sts.amazonaws.com/\n?Version=2011-06-15\n&Action=GetSessionToken\n&DurationSeconds=3600\n&SerialNumber=YourMFADeviceSerialNumber\n&TokenCode=123456\n&AUTHPARAMS\n\t\t\t</queryrequest>\n\n\t\t\t<queryresponse>\n\t\t\t\t<GetSessionTokenResponse xmlns=\"https://sts.amazonaws.com/doc/2011-06-15/\">\n <GetSessionTokenResult>\n <Credentials>\n <SessionToken>\n AQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh3c/L\n To6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4IgRmpRV3z\n rkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15fjrBs2+cTQtp\n Z3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE\n </SessionToken>\n <SecretAccessKey>\n wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY\n </SecretAccessKey>\n <Expiration>2011-07-11T19:55:29.611Z</Expiration>\n <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>\n </Credentials>\n </GetSessionTokenResult>\n <ResponseMetadata>\n <RequestId>58c5dbae-abef-11e0-8cfe-09039844ac7d</RequestId>\n </ResponseMetadata>\n</GetSessionTokenResponse>\n\t\t\t</queryresponse>\n\t\t</examples>\n\t"
823
+ "documentation": "\n\t\t<p> Returns a set of temporary credentials for an AWS account or IAM user. The credentials\n\t\t\tconsist of an access key ID, a secret access key, and a security token. Typically, you use\n\t\t\t\t<code>GetSessionToken</code> if you want use MFA to protect programmatic calls to specific\n\t\t\tAWS APIs like Amazon EC2 <code>StopInstances</code>. MFA-enabled IAM users would need to call\n\t\t\t\t<code>GetSessionToken</code> and submit an MFA code that is associated with their MFA\n\t\t\tdevice. Using the temporary security credentials that are returned from the call, IAM users\n\t\t\tcan then make programmatic calls to APIs that require MFA authentication. </p>\n\n\t\t<p> The <code>GetSessionToken</code> action must be called by using the long-term AWS security\n\t\t\tcredentials of the AWS account or an IAM user. Credentials that are created by IAM users are\n\t\t\tvalid for the duration that you specify, between 900 seconds (15 minutes) and 129600 seconds\n\t\t\t(36 hours); credentials that are created by using account credentials have a maximum duration\n\t\t\tof 3600 seconds (1 hour). </p>\n\n\t\t<p>Optionally, you can pass an AWS IAM access policy to this operation. The temporary security credentials that \n\t\t\tare returned by the operation have the permissions that are associated with the entity that is making \n\t\t\tthe <code>GetSessionToken</code> call, except for any permissions explicitly denied by the policy you pass.\n\t\t\tThis gives you a way to further restrict the permissions for the resulting temporary security credentials. These policies and any \n\t\t\tapplicable resource-based policies are evaluated when calls to AWS are made using the temporary security credentials. \n\t\t</p>\n\t\t\n\t\t<p>For more information about using <code>GetSessionToken</code> to create temporary\n\t\t\tcredentials, go to <a href=\"http://docs.aws.amazon.com/IAM/latest/UserGuide/CreatingSessionTokens.html\" target=\"_blank\"> Creating Temporary Credentials to Enable Access for IAM Users </a> in\n\t\t\t\t<i>Using IAM</i>. \n\t\t</p>\n\n\t\t<examples>\n\t\t\t<queryrequest>\n\t\t\t\thttps://sts.amazonaws.com/\n?Version=2011-06-15\n&Action=GetSessionToken\n&DurationSeconds=3600\n&SerialNumber=YourMFADeviceSerialNumber\n&TokenCode=123456\n&AUTHPARAMS\n\t\t\t</queryrequest>\n\n\t\t\t<queryresponse>\n\t\t\t\t<GetSessionTokenResponse xmlns=\"https://sts.amazonaws.com/doc/2011-06-15/\">\n <GetSessionTokenResult>\n <Credentials>\n <SessionToken>\n AQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh3c/L\n To6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4IgRmpRV3z\n rkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15fjrBs2+cTQtp\n Z3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE\n </SessionToken>\n <SecretAccessKey>\n wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY\n </SecretAccessKey>\n <Expiration>2011-07-11T19:55:29.611Z</Expiration>\n <AccessKeyId>AKIAIOSFODNN7EXAMPLE</AccessKeyId>\n </Credentials>\n </GetSessionTokenResult>\n <ResponseMetadata>\n <RequestId>58c5dbae-abef-11e0-8cfe-09039844ac7d</RequestId>\n </ResponseMetadata>\n</GetSessionTokenResponse>\n\t\t\t</queryresponse>\n\t\t</examples>\n\t"
808
824
  }
809
825
  }
810
826
  }
data/bin/aws.rb CHANGED
@@ -18,13 +18,13 @@ end
18
18
 
19
19
  # setup default options, check ENV for most
20
20
  options = {
21
- :repl => env_bool('AWSRB', nil),
22
- :log => env_bool('AWSRB_LOG', true),
23
- :color => env_bool('AWSRB_COLOR', true),
24
- :debug => env_bool('AWSRB_DEBUG', false),
25
- :load_paths => [],
26
- :require => [],
27
- :execute => [],
21
+ repl: env_bool('AWSRB', nil),
22
+ log: env_bool('AWSRB_LOG', true),
23
+ color: env_bool('AWSRB_COLOR', true),
24
+ debug: env_bool('AWSRB_DEBUG', false),
25
+ load_paths: [],
26
+ require: [],
27
+ execute: [],
28
28
  }
29
29
 
30
30
  OptionParser.new do |opts|
@@ -241,7 +241,7 @@ def document_svc_api_operation(svc_name, client, method_name, operation)
241
241
  #{documentor.api_ref(operation)}
242
242
  #{tabs}
243
243
  @param [Hash] params ({})
244
- @return [Seahorse::Client::Response]
244
+ @return [PageableResponse]
245
245
  #{errors}
246
246
  DOCSTRING
247
247
 
@@ -0,0 +1,17 @@
1
+ # language: en
2
+ @cloudtrail @client
3
+ Feature: AWS CloudTrail
4
+
5
+ Scenario: Making a basic request
6
+ When I call the "DescribeTrails" API
7
+ Then the response should contain a "trailList"
8
+
9
+ Scenario: Error handling
10
+ When I attempt to call the "CreateTrail" API with:
11
+ | Name | example |
12
+ | S3BucketName | not-my-bucket-123 |
13
+ Then I expect the response error code to be "S3BucketDoesNotExistException"
14
+ And I expect the response error message to include:
15
+ """
16
+ S3 bucket does not exist!
17
+ """
@@ -0,0 +1,6 @@
1
+ Before("@cloudtrail") do
2
+ @cloudtrail = @client = Aws.cloudtrail
3
+ end
4
+
5
+ After("@cloudtrail") do
6
+ end
@@ -12,5 +12,5 @@ Feature: AWS Data Pipeline
12
12
  Then I expect the response error code to be "PipelineNotFoundException"
13
13
  And I expect the response error message to include:
14
14
  """
15
- fake-id pipeline does not exist
15
+ does not exist
16
16
  """
data/lib/aws.rb CHANGED
@@ -9,6 +9,7 @@ module Aws
9
9
  @config = {}
10
10
 
11
11
  autoload :Credentials, "#{SRC}/credentials"
12
+ autoload :CredentialProviderChain, "#{SRC}/credential_provider_chain"
12
13
  autoload :Errors, "#{SRC}/errors"
13
14
  autoload :ErrorHandler, "#{SRC}/error_handler"
14
15
  autoload :InstanceProfileCredentials, "#{SRC}/instance_profile_credentials"
@@ -16,6 +17,7 @@ module Aws
16
17
  autoload :RequestHandler, "#{SRC}/request_handler"
17
18
  autoload :ResponseHandler, "#{SRC}/response_handler"
18
19
  autoload :Service, "#{SRC}/service"
20
+ autoload :SharedCredentials, "#{SRC}/shared_credentials"
19
21
  autoload :Structure, "#{SRC}/structure"
20
22
  autoload :TimestampFormatter, "#{SRC}/timestamp_formatter"
21
23
  autoload :TreeHash, "#{SRC}/tree_hash"
@@ -64,7 +66,6 @@ module Aws
64
66
  autoload :GlacierApiVersion, "#{SRC}/plugins/glacier_api_version"
65
67
  autoload :GlacierChecksums, "#{SRC}/plugins/glacier_checksums"
66
68
  autoload :GlobalConfiguration, "#{SRC}/plugins/global_configuration"
67
- autoload :InstanceProfileCredentials, "#{SRC}/plugins/instance_profile_credentials"
68
69
  autoload :JsonProtocol, "#{SRC}/plugins/json_protocol"
69
70
  autoload :JsonRpcHeaders, "#{SRC}/plugins/json_rpc_headers"
70
71
  autoload :QueryProtocol, "#{SRC}/plugins/query_protocol"
@@ -77,6 +78,7 @@ module Aws
77
78
  autoload :S3Md5s, "#{SRC}/plugins/s3_md5s"
78
79
  autoload :S3Redirects, "#{SRC}/plugins/s3_redirects"
79
80
  autoload :S3Signer, "#{SRC}/plugins/s3_signer"
81
+ autoload :S3LocationConstraint, "#{SRC}/plugins/s3_location_constraint"
80
82
  autoload :SignatureV2, "#{SRC}/plugins/signature_v2"
81
83
  autoload :SignatureV3, "#{SRC}/plugins/signature_v3"
82
84
  autoload :SignatureV4, "#{SRC}/plugins/signature_v4"
@@ -167,15 +169,29 @@ module Aws
167
169
  # @return [Class<Service>]
168
170
  def add_service(name, apis = [])
169
171
  svc_class = const_set(name, Service.define(name.downcase.to_sym, apis))
170
- service_classes[svc_class.identifier] = svc_class
171
- self.class.send(:define_method, svc_class.identifier) do |options = {}|
172
- svc_class.new(options)
173
- end
172
+ add_helper(svc_class.identifier, svc_class)
174
173
  svc_class
175
174
  end
176
175
 
177
176
  private
178
177
 
178
+ # Defines a `Aws.svcname` helper method. This method accepts a hash
179
+ # of configuration options.
180
+ #
181
+ # s3 = Aws.s3(http_wire_trace:true)
182
+ # #=> Aws::S3::V20060301
183
+ #
184
+ # s3.config.http_wire_trace
185
+ # #=> true
186
+ #
187
+ def add_helper(method_name, svc_class)
188
+ service_classes[method_name] = svc_class
189
+ define_method(method_name) do |options = {}|
190
+ svc_class.new(options)
191
+ end
192
+ module_function(method_name)
193
+ end
194
+
179
195
  # @return Returns a hash of API paths grouped by their service class names.
180
196
  def bundled_apis
181
197
  Dir.glob(File.join(GEM_ROOT, 'apis', '*.json')).group_by do |path|
@@ -6,6 +6,7 @@ module Aws::Api::ServiceTranslators::S3
6
6
  api.plugins << "Aws::Plugins::S3GetBucketLocationFix"
7
7
  api.plugins << "Aws::Plugins::S3Md5s"
8
8
  api.plugins << "Aws::Plugins::S3Redirects"
9
+ api.plugins << "Aws::Plugins::S3LocationConstraint"
9
10
  end
10
11
  end
11
12
  end
@@ -12,7 +12,6 @@ module Aws
12
12
  Aws::Plugins::RetryErrors
13
13
  Aws::Plugins::GlobalConfiguration
14
14
  Aws::Plugins::RegionalEndpoint
15
- Aws::Plugins::InstanceProfileCredentials
16
15
  Aws::Plugins::ResponsePaging
17
16
  Aws::Plugins::Credentials
18
17
  )
@@ -150,7 +149,7 @@ module Aws
150
149
  end
151
150
  @properties['metadata'] ||= {}
152
151
  @properties['metadata']['endpoint_prefix'] = prefix
153
- @properties['metadata']['regional_endpoints'] = regions unless regions.empty?
152
+ @properties['metadata']['regional_endpoints'] = Hash[regions.sort] unless regions.empty?
154
153
  end
155
154
 
156
155
  def set_operations(operations)
@@ -0,0 +1,62 @@
1
+ module Aws
2
+ class CredentialProviderChain
3
+
4
+ def initialize(config, foo=nil)
5
+ @config = config
6
+ @foo = foo
7
+ end
8
+
9
+ def resolve
10
+ providers.each do |method_name, options={}|
11
+ credentials = send(method_name, options.merge(config: @config))
12
+ return credentials if credentials.set?
13
+ end
14
+ nil
15
+ end
16
+
17
+ private
18
+
19
+ def providers
20
+ [
21
+ [:static_credentials],
22
+ [:env_credentials, { prefix: 'AWS' }],
23
+ [:env_credentials, { prefix: 'AMAZON' }],
24
+ [:env_credentials, { key:'AWS_ACCESS_KEY', secret:'AWS_SECRET_KEY' }],
25
+ [:shared_credentials],
26
+ [:instance_profile_credentials],
27
+ ]
28
+ end
29
+
30
+ def static_credentials(options)
31
+ config = options[:config]
32
+ Credentials.new(
33
+ config.access_key_id,
34
+ config.secret_access_key,
35
+ config.session_token)
36
+ end
37
+
38
+ def env_credentials(options)
39
+ env_keys = []
40
+ if prefix = options[:prefix]
41
+ env_keys << "#{prefix}_ACCESS_KEY_ID"
42
+ env_keys << "#{prefix}_SECRET_ACCESS_KEY"
43
+ env_keys << "#{prefix}_SESSION_TOKEN"
44
+ else
45
+ env_keys << options[:key]
46
+ env_keys << options[:secret]
47
+ end
48
+ Credentials.new(*ENV.values_at(*env_keys))
49
+ end
50
+
51
+ def shared_credentials(options = {})
52
+ c = SharedCredentials.new(profile_name: options[:config].profile)
53
+ puts c.inspect if @foo
54
+ c
55
+ end
56
+
57
+ def instance_profile_credentials(*args)
58
+ InstanceProfileCredentials.new
59
+ end
60
+
61
+ end
62
+ end
@@ -22,7 +22,10 @@ module Aws
22
22
  # @return [Boolean] Returns `true` if the access key id and secret
23
23
  # access key are both set.
24
24
  def set?
25
- !!(access_key_id && secret_access_key)
25
+ !access_key_id.nil? &&
26
+ !access_key_id.empty? &&
27
+ !secret_access_key.nil? &&
28
+ !secret_access_key.empty?
26
29
  end
27
30
 
28
31
  # Removing the secret access key from the default inspect string.
@@ -30,6 +30,10 @@ module Aws
30
30
  # version is found based on configuration.
31
31
  class NoSuchApiVersionError < RuntimeError; end
32
32
 
33
+ # Raised when a {Service} is constructed and the specified shared
34
+ # credentials profile does not exist.
35
+ class NoSuchProfileError < RuntimeError; end
36
+
33
37
  # Raised when a {Service} is constructed and credentials are not
34
38
  # set, or the set credentials are empty.
35
39
  class MissingCredentialsError < RuntimeError; end
@@ -1,47 +1,40 @@
1
1
  module Aws
2
2
  module Plugins
3
3
 
4
- # @seahorse.client.option [String] :access_key_id Your AWS account
5
- # access key ID. Defaults to `ENV['AWS_ACCESS_KEY']`.
6
- # Also checks `AWS_ACCESS_KEY_ID` and `AMAZON_ACCESS_KEY_ID`.
4
+ # @seahorse.client.option [required, Credentials] :credentials Your
5
+ # AWS credentials. The following locations will be searched in order
6
+ # for credentials:
7
7
  #
8
- # @seahorse.client.option [String] :secret_access_key Your AWS account
9
- # secret access key. Defaults to `ENV['AWS_SECRET_KEY']`.
10
- # Also checks `AWS_SECRET_ACCESS_KEY` and `AMAZON_SECRET_ACCESS_KEY`.
8
+ # * `:access_key_id`, `:secret_access_key`, and `:session_token` options
9
+ # * ENV['AWS_ACCESS_KEY'], ENV['SECRET_ACCESS_KEY']
10
+ # * `HOME/.aws/credentials` shared credentials file
11
+ # * EC2 instance profile credentials
11
12
  #
12
- # @seahorse.client.option [String] :session_token If your credentials
13
- # are temporary session credentials, this should be the
14
- # session token. Defaults to `ENV['AWS_SESSION_TOKEN']`.
15
- # Also checks `AMAZON_SESSION_TOKEN`.
13
+ # @seahorse.client.option [String] :profile Used when loading credentials
14
+ # from the shared credentials file at HOME/.aws/credentials. When not
15
+ # specified, 'default' is used.
16
16
  #
17
- # @seahorse.client.option [Credentials] :credentials
18
- # Your AWS account credentials. Defaults to a new {Credentials} object
19
- # populated by `:access_key_id`, `:secret_access_key` and
20
- # `:session_token`.
17
+ # @seahorse.client.option [String] :access_key_id Used to set credentials
18
+ # statically.
19
+ #
20
+ # @seahorse.client.option [String] :secret_access_key_id Used to set
21
+ # credentials statically.
22
+ #
23
+ # @seahorse.client.option [String] :session_token Used to set credentials
24
+ # statically.
21
25
  #
22
26
  class Credentials < Seahorse::Client::Plugin
23
27
 
24
- option(:access_key_id) {
25
- keys = %w(AWS_ACCESS_KEY AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID)
26
- ENV.values_at(*keys).compact.first
27
- }
28
+ option(:access_key_id)
29
+
30
+ option(:secret_access_key)
28
31
 
29
- option(:secret_access_key) {
30
- keys = %w(AWS_SECRET_KEY AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY)
31
- ENV.values_at(*keys).compact.first
32
- }
32
+ option(:session_token)
33
33
 
34
- option(:session_token) {
35
- keys = %w(AWS_SESSION_TOKEN AMAZON_SESSION_TOKEN)
36
- ENV.values_at(*keys).compact.first
37
- }
34
+ option(:profile)
38
35
 
39
36
  option(:credentials) do |config|
40
- credentials = Aws::Credentials.new(
41
- config.access_key_id,
42
- config.secret_access_key,
43
- config.session_token)
44
- credentials.set? ? credentials : nil
37
+ CredentialProviderChain.new(config).resolve
45
38
  end
46
39
 
47
40
  def after_initialize(client)
@@ -0,0 +1,38 @@
1
+ module Aws
2
+ module Plugins
3
+ class S3LocationConstraint < Seahorse::Client::Plugin
4
+
5
+ class Handler < Seahorse::Client::Handler
6
+
7
+ def call(context)
8
+
9
+ s3_endpoint = context.config.endpoint
10
+ s3_endpoint = s3_endpoint.host if s3_endpoint.respond_to?(:host)
11
+
12
+ region = context.config.region
13
+ create_bucket_params = context.params[:create_bucket_configuration]
14
+ location_constraint = nil
15
+
16
+ if create_bucket_params
17
+ location_constraint = create_bucket_params[:location_constraint]
18
+ end
19
+
20
+ unless s3_endpoint.match(/s3\.amazonaws\.com$/) || location_constraint
21
+ set_location_constraint(context, region)
22
+ end
23
+
24
+ @handler.call(context)
25
+ end
26
+
27
+ def set_location_constraint(context, region)
28
+ context.params[:create_bucket_configuration] ||= {}
29
+ context.params[:create_bucket_configuration][:location_constraint] = region
30
+ end
31
+
32
+ end
33
+
34
+ handler(Handler, step: :initialize, operations: [:create_bucket])
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,105 @@
1
+ module Aws
2
+ class SharedCredentials < Credentials
3
+
4
+ # @api private
5
+ KEY_MAP = {
6
+ 'aws_access_key_id' => 'access_key_id',
7
+ 'aws_secret_access_key' => 'secret_access_key',
8
+ 'aws_session_token' => 'session_token',
9
+ }
10
+
11
+ # Constructs a new SharedCredentials object. This will load AWS access
12
+ # credentials from an ini file, which supports profiles. The default
13
+ # profile name is 'default'. You can specify the profile name with the
14
+ # `ENV['AWS_PROFILE']` or with the `:profile_name` option.
15
+ #
16
+ # @option [String] :path Path to the shared file. Defaults
17
+ # to "#{Dir.home}/.aws/credentials".
18
+ #
19
+ # @option [String] :profile_name Defaults to 'default' or
20
+ # `ENV['AWS_PROFILE']`.
21
+ #
22
+ def initialize(options = {})
23
+ @path = options[:path] || default_path
24
+ @profile_name = options[:profile_name]
25
+ @profile_name ||= ENV['AWS_PROFILE']
26
+ @profile_name ||= 'default'
27
+ load_from_path if loadable?
28
+ end
29
+
30
+ # @return [String]
31
+ attr_reader :path
32
+
33
+ # @return [String]
34
+ attr_reader :profile_name
35
+
36
+ # @api private
37
+ def inspect
38
+ parts = [
39
+ self.class.name,
40
+ "profile_name=#{profile_name.inspect}",
41
+ "path=#{path.inspect}",
42
+ ]
43
+ "#<#{parts.join(' ')}>"
44
+ end
45
+
46
+ # @return [Boolean] Returns `true` if a credential file
47
+ # exists and has appropriate read permissions at {path}.
48
+ # @note This method does not indicate if the file found at {path}
49
+ # will be parsable, only if it can be read.
50
+ def loadable?
51
+ !path.nil? && File.exists?(path) && File.readable?(path)
52
+ end
53
+
54
+ private
55
+
56
+ def default_path
57
+ File.join(Dir.home, '.aws', 'credentials')
58
+ rescue ArgumentError
59
+ # Dir.home raises ArgumentError when ENV['home'] is not set
60
+ nil
61
+ end
62
+
63
+ def load_from_path
64
+ profile = load_profile
65
+ KEY_MAP.each do |source, target|
66
+ if profile.key?(source)
67
+ instance_variable_set("@#{target}", profile[source])
68
+ end
69
+ end
70
+ end
71
+
72
+ def load_profile
73
+ if profile = profiles[profile_name]
74
+ profile
75
+ else
76
+ msg = "Profile `#{profile_name}' not found in #{path}"
77
+ raise Errors::NoSuchProfileError, msg
78
+ end
79
+ end
80
+
81
+ def profiles
82
+ ini_parse(File.read(path))
83
+ end
84
+
85
+ def ini_parse(file)
86
+ current_section = {}
87
+ map = {}
88
+ file.lines.each do |line|
89
+ line = line.split(/^|\s;/).first # remove comments
90
+ section = line.match(/^\s*\[([^\[\]]+)\]\s*$/) unless line.nil?
91
+ if section
92
+ current_section = section[1]
93
+ elsif current_section
94
+ item = line.match(/^\s*(.+?)\s*=\s*(.+)\s*$/) unless line.nil?
95
+ if item
96
+ map[current_section] = map[current_section] || {}
97
+ map[current_section][item[1]] = item[2]
98
+ end
99
+ end
100
+ end
101
+ map
102
+ end
103
+
104
+ end
105
+ end