aws-sdk 1.32.0 → 1.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -10
  3. data/bin/aws-rb +11 -1
  4. data/endpoints.json +191 -26
  5. data/lib/aws/api_config/AutoScaling-2011-01-01.yml +201 -0
  6. data/lib/aws/api_config/CloudFormation-2010-05-15.yml +15 -1
  7. data/lib/aws/api_config/CloudFront-2013-11-22.yml +2918 -0
  8. data/lib/aws/api_config/CloudFront-2014-01-31.yml +2934 -0
  9. data/lib/aws/api_config/CloudFront-2014-05-31.yml +3100 -0
  10. data/lib/aws/api_config/CloudSearch-2013-01-01.yml +1164 -0
  11. data/lib/aws/api_config/CloudTrail-2013-11-01.yml +4 -33
  12. data/lib/aws/api_config/DynamoDB-2012-08-10.yml +101 -1
  13. data/lib/aws/api_config/EC2-2013-08-15.yml +2 -2
  14. data/lib/aws/api_config/EC2-2013-10-01.yml +2 -2
  15. data/lib/aws/api_config/EC2-2013-10-15.yml +3 -78
  16. data/lib/aws/api_config/EC2-2014-02-01.yml +4755 -0
  17. data/lib/aws/api_config/EC2-2014-05-01.yml +4812 -0
  18. data/lib/aws/api_config/ELB-2012-06-01.yml +65 -1
  19. data/lib/aws/api_config/EMR-2009-03-31.yml +20 -1
  20. data/lib/aws/api_config/ElastiCache-2014-03-24.yml +1375 -0
  21. data/lib/aws/api_config/ElastiCache-2014-07-15.yml +1385 -0
  22. data/lib/aws/api_config/ElasticBeanstalk-2010-12-01.yml +8 -1
  23. data/lib/aws/api_config/ElasticTranscoder-2012-09-25.yml +798 -1
  24. data/lib/aws/api_config/IAM-2010-05-08.yml +44 -2
  25. data/lib/aws/api_config/Kinesis-2013-12-02.yml +1 -1
  26. data/lib/aws/api_config/OpsWorks-2013-02-18.yml +201 -1
  27. data/lib/aws/api_config/RDS-2013-09-09.yml +1 -2
  28. data/lib/aws/api_config/Redshift-2012-12-01.yml +25 -1
  29. data/lib/aws/api_config/Route53-2013-04-01.yml +889 -0
  30. data/lib/aws/api_config/SNS-2010-03-31.yml +16 -1
  31. data/lib/aws/api_config/SQS-2012-11-05.yml +86 -1
  32. data/lib/aws/api_config/STS-2011-06-15.yml +5 -1
  33. data/lib/aws/api_config/SimpleEmailService-2010-12-01.yml +1 -1
  34. data/lib/aws/api_config/Support-2013-04-15.yml +63 -0
  35. data/lib/aws/auto_scaling/group.rb +1 -1
  36. data/lib/aws/cloud_formation/stack_resource_collection.rb +1 -1
  37. data/lib/aws/cloud_front/client.rb +13 -1
  38. data/lib/aws/cloud_search/client.rb +6 -2
  39. data/lib/aws/cloud_watch/alarm.rb +3 -0
  40. data/lib/aws/core.rb +16 -1
  41. data/lib/aws/core/client.rb +10 -1
  42. data/lib/aws/core/configuration.rb +3 -2
  43. data/lib/aws/core/credential_providers.rb +130 -12
  44. data/lib/aws/core/http/connection_pool.rb +23 -3
  45. data/lib/aws/core/http/net_http_handler.rb +18 -21
  46. data/lib/aws/core/http/request.rb +10 -0
  47. data/lib/aws/core/ini_parser.rb +42 -0
  48. data/lib/aws/core/lazy_error_classes.rb +20 -2
  49. data/lib/aws/core/log_formatter.rb +1 -1
  50. data/lib/aws/core/model.rb +5 -0
  51. data/lib/aws/core/option_grammar.rb +9 -9
  52. data/lib/aws/core/policy.rb +2 -3
  53. data/lib/aws/core/response.rb +4 -0
  54. data/lib/aws/core/signers/version_4.rb +1 -1
  55. data/lib/aws/core/signers/version_4/chunk_signed_stream.rb +1 -1
  56. data/lib/aws/core/xml/frame.rb +1 -0
  57. data/lib/aws/core/xml/grammar.rb +1 -0
  58. data/lib/aws/dynamo_db.rb +16 -0
  59. data/lib/aws/dynamo_db/batch_write.rb +2 -0
  60. data/lib/aws/dynamo_db/table.rb +4 -8
  61. data/lib/aws/ec2.rb +1 -1
  62. data/lib/aws/ec2/client.rb +64 -1
  63. data/lib/aws/ec2/image_collection.rb +1 -2
  64. data/lib/aws/ec2/instance.rb +3 -3
  65. data/lib/aws/ec2/instance_collection.rb +14 -3
  66. data/lib/aws/ec2/snapshot_collection.rb +1 -1
  67. data/lib/aws/ec2/subnet_collection.rb +7 -3
  68. data/lib/aws/ec2/tagged_collection.rb +14 -0
  69. data/lib/aws/ec2/volume_collection.rb +4 -0
  70. data/lib/aws/ec2/vpc.rb +8 -0
  71. data/lib/aws/ec2/vpc_collection.rb +1 -1
  72. data/lib/aws/elasticache/client.rb +8 -2
  73. data/lib/aws/emr/job_flow_collection.rb +4 -6
  74. data/lib/aws/glacier.rb +4 -4
  75. data/lib/aws/glacier/vault.rb +1 -1
  76. data/lib/aws/iam/server_certificate.rb +24 -17
  77. data/lib/aws/iam/signing_certificate.rb +13 -1
  78. data/lib/aws/rails.rb +1 -1
  79. data/lib/aws/rds/db_instance.rb +5 -6
  80. data/lib/aws/record/abstract_base.rb +0 -1
  81. data/lib/aws/record/hash_model.rb +1 -1
  82. data/lib/aws/record/model.rb +1 -1
  83. data/lib/aws/route_53/client.rb +5 -2
  84. data/lib/aws/route_53/hosted_zone.rb +39 -16
  85. data/lib/aws/route_53/hosted_zone_collection.rb +2 -1
  86. data/lib/aws/s3/bucket_lifecycle_configuration.rb +22 -6
  87. data/lib/aws/s3/cipher_io.rb +1 -1
  88. data/lib/aws/s3/client.rb +155 -7
  89. data/lib/aws/s3/client/xml.rb +7 -0
  90. data/lib/aws/s3/multipart_upload.rb +3 -1
  91. data/lib/aws/s3/object_collection.rb +1 -1
  92. data/lib/aws/s3/presign_v4.rb +13 -4
  93. data/lib/aws/s3/s3_object.rb +3 -0
  94. data/lib/aws/simple_email_service.rb +13 -0
  95. data/lib/aws/simple_email_service/identity.rb +21 -0
  96. data/lib/aws/simple_workflow/decision_task.rb +2 -2
  97. data/lib/aws/simple_workflow/decision_task_collection.rb +0 -2
  98. data/lib/aws/simple_workflow/option_formatters.rb +1 -1
  99. data/lib/aws/simple_workflow/workflow_execution_collection.rb +2 -2
  100. data/lib/aws/simple_workflow/workflow_type.rb +0 -2
  101. data/lib/aws/sns/message.rb +11 -1
  102. data/lib/aws/sns/topic.rb +1 -1
  103. data/lib/aws/sns/topic_collection.rb +1 -1
  104. data/lib/aws/sqs/queue.rb +26 -14
  105. data/lib/aws/sqs/queue_collection.rb +4 -0
  106. data/lib/aws/sqs/received_message.rb +4 -0
  107. data/lib/aws/sts/client.rb +9 -0
  108. data/lib/aws/version.rb +1 -1
  109. metadata +113 -117
@@ -108,7 +108,7 @@ module AWS
108
108
  if free_space > 0
109
109
  @final = cipher.final
110
110
  chunk << @final[0..free_space-1]
111
- @final = @final[free_space-1..@final.size-1]
111
+ @final = @final[free_space..@final.size-1]
112
112
  @eof = true unless @final and @final.size > 0
113
113
  end
114
114
 
data/lib/aws/s3/client.rb CHANGED
@@ -1,4 +1,5 @@
1
- # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2011-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
3
  #
3
4
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
5
  # may not use this file except in compliance with the License. A copy of
@@ -236,7 +237,7 @@ module AWS
236
237
  end
237
238
 
238
239
  def md5 str
239
- Base64.encode64(Digest::MD5.digest(str)).strip
240
+ Base64.encode64(OpenSSL::Digest::MD5.digest(str)).strip
240
241
  end
241
242
 
242
243
  def parse_copy_part_response resp
@@ -291,6 +292,8 @@ module AWS
291
292
  'etag' => :etag,
292
293
  'x-amz-website-redirect-location' => :website_redirect_location,
293
294
  'accept-ranges' => :accept_ranges,
295
+ 'x-amz-server-side-encryption-customer-algorithm' => :sse_customer_algorithm,
296
+ 'x-amz-server-side-encryption-customer-key-MD5' => :sse_customer_key_md5
294
297
  }.each_pair do |header,method|
295
298
  if value = resp.http_response.header(header)
296
299
  resp.data[method] = value
@@ -1015,7 +1018,7 @@ module AWS
1015
1018
  # * `:permission` - (String) Logging permissions given to the Grantee
1016
1019
  # for the bucket. The bucket owner is automatically granted FULL_CONTROL
1017
1020
  # to all logs delivered to the bucket. This optional element enables
1018
- # you grant access to others. Valid Values: FULL_CONTROL | READ | WRITE
1021
+ # you grant access to others. Valid Values: FULL_CONTROL | READ | WRITE
1019
1022
  # @return [Core::Response]
1020
1023
  bucket_method(:put_bucket_logging, :put) do
1021
1024
  configure_request do |req, options|
@@ -1062,7 +1065,7 @@ module AWS
1062
1065
  xml = xml.doc.root.to_xml
1063
1066
  req.body = xml
1064
1067
  req.headers['content-md5'] = md5(xml)
1065
-
1068
+
1066
1069
  super(req, options)
1067
1070
 
1068
1071
  end
@@ -1352,6 +1355,18 @@ module AWS
1352
1355
  # @option options [String] :grant_read_acp
1353
1356
  # @option options [String] :grant_write_acp
1354
1357
  # @option options [String] :grant_full_control
1358
+ # @option options [String] :sse_customer_algorithm Specifies the
1359
+ # algorithm to use to when encrypting the object (e.g., AES256).
1360
+ # @option options [String] :sse_customer_key Specifies the
1361
+ # customer-provided encryption key for Amazon S3 to use in encrypting
1362
+ # data. This value is used to store the object and then it is
1363
+ # discarded; Amazon does not store the encryption key. The key must be
1364
+ # appropriate for use with the algorithm specified in the
1365
+ # `:sse_customer_algorithm` header.
1366
+ # @option options [String] :sse_customer_key_md5 Specifies the 128-bit
1367
+ # MD5 digest of the encryption key according to RFC 1321. Amazon S3
1368
+ # uses this header for a message integrity check to ensure the
1369
+ # encryption key was transmitted without error.
1355
1370
  # @return [Core::Response]
1356
1371
  #
1357
1372
  object_method(:put_object, :put, :header_options => {
@@ -1368,6 +1383,9 @@ module AWS
1368
1383
  :content_encoding => 'Content-Encoding',
1369
1384
  :content_type => 'Content-Type',
1370
1385
  :expires => 'Expires',
1386
+ :sse_customer_algorithm => 'x-amz-server-side-encryption-customer-algorithm',
1387
+ :sse_customer_key => 'x-amz-server-side-encryption-customer-key',
1388
+ :sse_customer_key_md5 => 'x-amz-server-side-encryption-customer-key-MD5',
1371
1389
  }) do
1372
1390
 
1373
1391
  configure_request do |request, options|
@@ -1419,6 +1437,18 @@ module AWS
1419
1437
  # is true if and only if the object ETag matches the value for
1420
1438
  # this option. If `:matches` is true, the `:data` value
1421
1439
  # of the response will be `nil`.
1440
+ # @option options [String] :sse_customer_algorithm Specifies the
1441
+ # algorithm to use to when encrypting the object (e.g., AES256).
1442
+ # @option options [String] :sse_customer_key Specifies the
1443
+ # customer-provided encryption key for Amazon S3 to use in encrypting
1444
+ # data. This value is used to store the object and then it is
1445
+ # discarded; Amazon does not store the encryption key. The key must be
1446
+ # appropriate for use with the algorithm specified in the
1447
+ # `:sse_customer_algorithm` header.
1448
+ # @option options [String] :sse_customer_key_md5 Specifies the 128-bit
1449
+ # MD5 digest of the encryption key according to RFC 1321. Amazon S3
1450
+ # uses this header for a message integrity check to ensure the
1451
+ # encryption key was transmitted without error.
1422
1452
  # @option options [Range<Integer>] :range A byte range of data to request.
1423
1453
  # @return [Core::Response]
1424
1454
  #
@@ -1427,7 +1457,10 @@ module AWS
1427
1457
  :if_modified_since => "If-Modified-Since",
1428
1458
  :if_unmodified_since => "If-Unmodified-Since",
1429
1459
  :if_match => "If-Match",
1430
- :if_none_match => "If-None-Match"
1460
+ :if_none_match => "If-None-Match",
1461
+ :sse_customer_algorithm => 'x-amz-server-side-encryption-customer-algorithm',
1462
+ :sse_customer_key => 'x-amz-server-side-encryption-customer-key',
1463
+ :sse_customer_key_md5 => 'x-amz-server-side-encryption-customer-key-MD5',
1431
1464
  }) do
1432
1465
  configure_request do |req, options|
1433
1466
 
@@ -1484,14 +1517,75 @@ module AWS
1484
1517
  # @option options [required,String] :bucket_name
1485
1518
  # @option options [required,String] :key
1486
1519
  # @option options [String] :version_id
1520
+ # @option options [Time] :if_modified_since If specified, the
1521
+ # response will contain an additional `:modified` value that
1522
+ # returns true if the object was modified after the given
1523
+ # time. If `:modified` is false, then the response
1524
+ # `:data` value will be `nil`.
1525
+ # @option options [Time] :if_unmodified_since If specified, the
1526
+ # response will contain an additional `:unmodified` value
1527
+ # that is true if the object was not modified after the
1528
+ # given time. If `:unmodified` returns false, the `:data`
1529
+ # value will be `nil`.
1530
+ # @option options [String] :if_match If specified, the response
1531
+ # will contain an additional `:matches` value that is true
1532
+ # if the object ETag matches the value for this option. If
1533
+ # `:matches` is false, the `:data` value of the
1534
+ # response will be `nil`.
1535
+ # @option options [String] :if_none_match If specified, the
1536
+ # response will contain an additional `:matches` value that
1537
+ # is true if and only if the object ETag matches the value for
1538
+ # this option. If `:matches` is true, the `:data` value
1539
+ # of the response will be `nil`.
1540
+ # @option options [String] :sse_customer_algorithm Specifies the
1541
+ # algorithm to use to when encrypting the object (e.g., AES256).
1542
+ # @option options [String] :sse_customer_key Specifies the
1543
+ # customer-provided encryption key for Amazon S3 to use in encrypting
1544
+ # data. This value is used to store the object and then it is
1545
+ # discarded; Amazon does not store the encryption key. The key must be
1546
+ # appropriate for use with the algorithm specified in the
1547
+ # `:sse_customer_algorithm` header.
1548
+ # @option options [String] :sse_customer_key_md5 Specifies the 128-bit
1549
+ # MD5 digest of the encryption key according to RFC 1321. Amazon S3
1550
+ # uses this header for a message integrity check to ensure the
1551
+ # encryption key was transmitted without error.
1552
+ # @option options [Range<Integer>] :range A byte range of data to request.
1487
1553
  # @return [Core::Response]
1488
- object_method(:head_object, :head) do
1554
+ object_method(:head_object, :head,
1555
+ :header_options => {
1556
+ :if_modified_since => "If-Modified-Since",
1557
+ :if_unmodified_since => "If-Unmodified-Since",
1558
+ :if_match => "If-Match",
1559
+ :if_none_match => "If-None-Match",
1560
+ :sse_customer_algorithm => 'x-amz-server-side-encryption-customer-algorithm',
1561
+ :sse_customer_key => 'x-amz-server-side-encryption-customer-key',
1562
+ :sse_customer_key_md5 => 'x-amz-server-side-encryption-customer-key-MD5',
1563
+ }) do
1489
1564
 
1490
1565
  configure_request do |req, options|
1491
1566
  super(req, options)
1492
1567
  if options[:version_id]
1493
1568
  req.add_param('versionId', options[:version_id])
1494
1569
  end
1570
+
1571
+ ["If-Modified-Since",
1572
+ "If-Unmodified-Since"].each do |date_header|
1573
+ case value = req.headers[date_header]
1574
+ when DateTime
1575
+ req.headers[date_header] = Time.parse(value.to_s).rfc2822
1576
+ when Time
1577
+ req.headers[date_header] = value.rfc2822
1578
+ end
1579
+ end
1580
+
1581
+ if options[:range]
1582
+ range = options[:range]
1583
+ if range.is_a?(Range)
1584
+ offset = range.exclude_end? ? -1 : 0
1585
+ range = "bytes=#{range.first}-#{range.last + offset}"
1586
+ end
1587
+ req.headers['Range'] = range
1588
+ end
1495
1589
  end
1496
1590
 
1497
1591
  process_response do |resp|
@@ -1605,6 +1699,18 @@ module AWS
1605
1699
  # @option options [String] :grant_read_acp
1606
1700
  # @option options [String] :grant_write_acp
1607
1701
  # @option options [String] :grant_full_control
1702
+ # @option options [String] :sse_customer_algorithm Specifies the
1703
+ # algorithm to use to when encrypting the object (e.g., AES256).
1704
+ # @option options [String] :sse_customer_key Specifies the
1705
+ # customer-provided encryption key for Amazon S3 to use in encrypting
1706
+ # data. This value is used to store the object and then it is
1707
+ # discarded; Amazon does not store the encryption key. The key must be
1708
+ # appropriate for use with the algorithm specified in the
1709
+ # `:sse_customer_algorithm` header.
1710
+ # @option options [String] :sse_customer_key_md5 Specifies the 128-bit
1711
+ # MD5 digest of the encryption key according to RFC 1321. Amazon S3
1712
+ # uses this header for a message integrity check to ensure the
1713
+ # encryption key was transmitted without error.
1608
1714
  # @return [Core::Response]
1609
1715
  object_method(:initiate_multipart_upload, :post, 'uploads',
1610
1716
  XML::InitiateMultipartUpload,
@@ -1621,6 +1727,9 @@ module AWS
1621
1727
  :content_encoding => 'Content-Encoding',
1622
1728
  :content_type => 'Content-Type',
1623
1729
  :expires => 'Expires',
1730
+ :sse_customer_algorithm => 'x-amz-server-side-encryption-customer-algorithm',
1731
+ :sse_customer_key => 'x-amz-server-side-encryption-customer-key',
1732
+ :sse_customer_key_md5 => 'x-amz-server-side-encryption-customer-key-MD5',
1624
1733
  }) do
1625
1734
 
1626
1735
  configure_request do |req, options|
@@ -1709,7 +1818,10 @@ module AWS
1709
1818
  # @return [Core::Response]
1710
1819
  object_method(:upload_part, :put,
1711
1820
  :header_options => {
1712
- :content_md5 => 'Content-MD5'
1821
+ :content_md5 => 'Content-MD5',
1822
+ :sse_customer_algorithm => 'x-amz-server-side-encryption-customer-algorithm',
1823
+ :sse_customer_key => 'x-amz-server-side-encryption-customer-key',
1824
+ :sse_customer_key_md5 => 'x-amz-server-side-encryption-customer-key-MD5',
1713
1825
  }) do
1714
1826
  configure_request do |request, options|
1715
1827
 
@@ -1834,6 +1946,12 @@ module AWS
1834
1946
  # Controls whether Reduced Redundancy Storage is enabled for
1835
1947
  # the object. Valid values are 'STANDARD' and
1836
1948
  # 'REDUCED_REDUNDANCY'.
1949
+ # @option options [String] :metadata_directive ('COPY') Specify 'COPY' or
1950
+ # 'REPLACE'.
1951
+ # @option options [String] :content_type
1952
+ # @option options [String] :content_encoding
1953
+ # @option options [String] :content_disposition
1954
+ # @option options [String] :cache_control
1837
1955
  # @option options [String] :expires The date and time at which the
1838
1956
  # object is no longer cacheable.
1839
1957
  # @option options [String] :grant_read
@@ -1841,6 +1959,29 @@ module AWS
1841
1959
  # @option options [String] :grant_read_acp
1842
1960
  # @option options [String] :grant_write_acp
1843
1961
  # @option options [String] :grant_full_control
1962
+ # @option options [String] :sse_customer_algorithm Specifies the
1963
+ # algorithm to use to when encrypting the object (e.g., AES256).
1964
+ # @option options [String] :sse_customer_key Specifies the
1965
+ # customer-provided encryption key for Amazon S3 to use in encrypting
1966
+ # data. This value is used to store the object and then it is
1967
+ # discarded; Amazon does not store the encryption key. The key must be
1968
+ # appropriate for use with the algorithm specified in the
1969
+ # `:sse_customer_algorithm` header.
1970
+ # @option options [String] :sse_customer_key_md5 Specifies the 128-bit
1971
+ # MD5 digest of the encryption key according to RFC 1321. Amazon S3
1972
+ # uses this header for a message integrity check to ensure the
1973
+ # encryption key was transmitted without error.
1974
+ # @option options [String] :copy_source_sse_customer_algorithm Specifies
1975
+ # the algorithm to use when decrypting the source object (e.g.,
1976
+ # AES256).
1977
+ # @option options [String] :copy_source_sse_customer_key Specifies the
1978
+ # customer-provided encryption key for Amazon S3 to use to decrypt the
1979
+ # source object. The encryption key provided in this header must be
1980
+ # one that was used when the source object was created.
1981
+ # @option options [String] :copy_source_sse_customer_key_md5 Specifies
1982
+ # the 128-bit MD5 digest of the encryption key according to RFC 1321.
1983
+ # Amazon S3 uses this header for a message integrity check to ensure
1984
+ # the encryption key was transmitted without error.
1844
1985
  # @return [Core::Response]
1845
1986
  object_method(:copy_object, :put, :header_options => {
1846
1987
  :website_redirect_location => 'x-amz-website-redirect-location',
@@ -1854,8 +1995,15 @@ module AWS
1854
1995
  :cache_control => 'Cache-Control',
1855
1996
  :metadata_directive => 'x-amz-metadata-directive',
1856
1997
  :content_type => 'Content-Type',
1998
+ :content_encoding => 'Content-Encoding',
1857
1999
  :content_disposition => 'Content-Disposition',
1858
2000
  :expires => 'Expires',
2001
+ :sse_customer_algorithm => 'x-amz-server-side-encryption-customer-algorithm',
2002
+ :sse_customer_key => 'x-amz-server-side-encryption-customer-key',
2003
+ :sse_customer_key_md5 => 'x-amz-server-side-encryption-customer-key-MD5',
2004
+ :copy_source_sse_customer_algorithm => 'x-amz-copy-source-server-side-encryption-customer-algorithm',
2005
+ :copy_source_sse_customer_key => 'x-amz-copy-source-server-side-encryption-customer-key',
2006
+ :copy_source_sse_customer_key_md5 => 'x-amz-copy-source-server-side-encryption-customer-key-MD5',
1859
2007
  }) do
1860
2008
 
1861
2009
  configure_request do |req, options|
@@ -192,6 +192,13 @@ module AWS
192
192
  element("Days") { integer_value }
193
193
  element("Date") { datetime_value }
194
194
  end
195
+ element("NoncurrentVersionTransition") do
196
+ element("NoncurrentDays") { integer_value }
197
+ element("StorageClass") { string_value }
198
+ end
199
+ element("NoncurrentVersionDays") do
200
+ element("NoncurrentDays") { integer_value }
201
+ end
195
202
  end
196
203
  end
197
204
 
@@ -30,6 +30,8 @@ module AWS
30
30
 
31
31
  include Core::Model
32
32
 
33
+ class EmptyUploadError < StandardError; end
34
+
33
35
  # @api private
34
36
  def initialize(object, id, options = {})
35
37
  @id = id
@@ -273,7 +275,7 @@ module AWS
273
275
  complete_opts = get_complete_opts(part_numbers)
274
276
  end
275
277
 
276
- raise "no parts uploaded" if complete_opts[:parts].empty?
278
+ raise EmptyUploadError.new("Unable to complete an empty upload.") if complete_opts[:parts].empty?
277
279
 
278
280
  resp = client.complete_multipart_upload(complete_opts)
279
281
  if resp.data[:version_id]
@@ -159,7 +159,7 @@ module AWS
159
159
  else
160
160
  msg = "objects must be keys (strings or hashes with :key and " +
161
161
  ":version_id), S3Objects or ObjectVersions, got " +
162
- object.class.name
162
+ obj.class.name
163
163
  raise ArgumentError, msg
164
164
  end
165
165
  end
@@ -39,7 +39,14 @@ module AWS
39
39
  # @return (see S3Object#url_for)
40
40
  def presign(method, options = {})
41
41
 
42
- now = Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
42
+ now = Time.now.utc
43
+ one_week = 60 * 60 * 24 * 7
44
+ if options[:expires] - now.to_i > one_week
45
+ msg = "presigned URLs using sigv4 may not expire more than one week out"
46
+ raise ArgumentError, msg
47
+ end
48
+
49
+ now = now.strftime("%Y%m%dT%H%M%SZ")
43
50
 
44
51
  request = build_request(method, options)
45
52
 
@@ -47,10 +54,8 @@ module AWS
47
54
  request.headers['host'] = request.host
48
55
  signed_headers = 'Host'
49
56
 
50
- # must be sent along with the PUT request headers
51
57
  if options[:acl]
52
- request.headers['X-Amz-Acl'] = options[:acl].to_s.gsub(/_/, '-')
53
- signed_headers << ';X-Amz-Acl'
58
+ request.add_param("X-Amz-Acl", options[:acl].to_s.gsub(/_/, '-'))
54
59
  end
55
60
 
56
61
  # must be sent along with the PUT request headers
@@ -66,10 +71,13 @@ module AWS
66
71
  end
67
72
  end
68
73
 
74
+ token = client.credential_provider.session_token
75
+
69
76
  request.add_param("X-Amz-Algorithm", "AWS4-HMAC-SHA256")
70
77
  request.add_param("X-Amz-Date", now)
71
78
  request.add_param("X-Amz-SignedHeaders", signed_headers)
72
79
  request.add_param("X-Amz-Expires", seconds_away(options[:expires]))
80
+ request.add_param('X-Amz-Security-Token', token) if token
73
81
  request.add_param("X-Amz-Credential", signer.credential(now))
74
82
  request.add_param("X-Amz-Signature", signature(request, now))
75
83
 
@@ -96,6 +104,7 @@ module AWS
96
104
  when :get, :read then :get_object
97
105
  when :put, :write then :put_object
98
106
  when :delete then :delete_object
107
+ when :head then :head_object
99
108
  else
100
109
  msg = "invalid method, expected :get, :put or :delete, got "
101
110
  msg << method.inspect
@@ -589,6 +589,8 @@ module AWS
589
589
  # @option options [String] :expires The date and time at which the
590
590
  # object is no longer cacheable.
591
591
  #
592
+ # @option options [String] :website_redirect_location
593
+ #
592
594
  # @return [S3Object, ObjectVersion] If the bucket has versioning
593
595
  # enabled, this methods returns an {ObjectVersion}, otherwise
594
596
  # this method returns `self`.
@@ -1179,6 +1181,7 @@ module AWS
1179
1181
  # * `:get` or `:read`
1180
1182
  # * `:put` or `:write`
1181
1183
  # * `:delete`
1184
+ # * `:head`
1182
1185
  #
1183
1186
  # @param [Hash] options Additional options for generating the URL.
1184
1187
  #
@@ -55,6 +55,19 @@ module AWS
55
55
  # This has only been tested with Rails 2.3 and Rails 3.0.
56
56
  #
57
57
  #
58
+ # Regions
59
+ #
60
+ # SES is not available in all regions. If you configure a default region
61
+ # where SES is not available, you will receive a network error. You
62
+ # can configure a default region and a default SES region:
63
+ #
64
+ # AWS.config(
65
+ # :region => 'ap-southeast-1',
66
+ # :ses => { :region => 'us-west-2' }
67
+ # )
68
+ #
69
+ # [Go here for a complete list of supported regions](http://docs.aws.amazon.com/general/latest/gr/rande.html#ses_region).
70
+ #
58
71
  # # Identities
59
72
  #
60
73
  # Before you can send emails, you need to verify one or more identities.
@@ -58,6 +58,8 @@ module AWS
58
58
 
59
59
  attribute :dkim_verification_status
60
60
 
61
+ mutable_attribute :delivery_topic_arn, :from => :delivery_topic
62
+
61
63
  mutable_attribute :bounce_topic_arn, :from => :bounce_topic
62
64
 
63
65
  mutable_attribute :complaint_topic_arn, :from => :complaint_topic
@@ -73,6 +75,7 @@ module AWS
73
75
  end
74
76
 
75
77
  provider(:get_identity_notification_attributes) do |provider|
78
+ provider.provides :delivery_topic_arn
76
79
  provider.provides :bounce_topic_arn
77
80
  provider.provides :complaint_topic_arn
78
81
  provider.provides :forwarding_enabled
@@ -96,6 +99,20 @@ module AWS
96
99
  end
97
100
  end
98
101
 
102
+ # @param [String,SNS::Topic] topic The topic (ARN string or topic
103
+ # object) that delivery notifications should be published to.
104
+ def delivery_topic= topic
105
+ arn = topic.respond_to?(:arn) ? topic.arn : topic
106
+ self.delivery_topic_arn = arn
107
+ end
108
+
109
+ # @return [SNS::Topic,nil]
110
+ def delivery_topic
111
+ if arn = delivery_topic_arn
112
+ SNS::Topic.new(arn, :config => config)
113
+ end
114
+ end
115
+
99
116
  # @param [String,SNS::Topic] topic The topic (ARN string or topic
100
117
  # object) that bounce notifications should be published to.
101
118
  def bounce_topic= topic
@@ -185,6 +202,10 @@ module AWS
185
202
  client_opts = {}
186
203
  client_opts[:identity] = identity
187
204
  case attr.name
205
+ when :delivery_topic_arn
206
+ method = :set_identity_notification_topic
207
+ client_opts[:notification_type] = 'Delivery'
208
+ client_opts[:sns_topic] = value if value
188
209
  when :bounce_topic_arn
189
210
  method = :set_identity_notification_topic
190
211
  client_opts[:notification_type] = 'Bounce'