aws-sdk-s3 1.121.0 → 1.136.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +99 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/bucket.rb +122 -60
- data/lib/aws-sdk-s3/bucket_acl.rb +9 -3
- data/lib/aws-sdk-s3/bucket_cors.rb +12 -4
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +12 -4
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +12 -4
- data/lib/aws-sdk-s3/bucket_logging.rb +9 -3
- data/lib/aws-sdk-s3/bucket_notification.rb +9 -3
- data/lib/aws-sdk-s3/bucket_policy.rb +12 -4
- data/lib/aws-sdk-s3/bucket_request_payment.rb +9 -3
- data/lib/aws-sdk-s3/bucket_tagging.rb +12 -4
- data/lib/aws-sdk-s3/bucket_versioning.rb +15 -5
- data/lib/aws-sdk-s3/bucket_website.rb +12 -4
- data/lib/aws-sdk-s3/client.rb +2017 -1674
- data/lib/aws-sdk-s3/client_api.rb +24 -0
- data/lib/aws-sdk-s3/customizations/bucket.rb +3 -1
- data/lib/aws-sdk-s3/customizations/errors.rb +1 -1
- data/lib/aws-sdk-s3/customizations/object.rb +91 -18
- data/lib/aws-sdk-s3/encryption/client.rb +6 -2
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
- data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
- data/lib/aws-sdk-s3/endpoint_parameters.rb +4 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +22 -246
- data/lib/aws-sdk-s3/endpoints.rb +1 -0
- data/lib/aws-sdk-s3/file_downloader.rb +170 -44
- data/lib/aws-sdk-s3/file_uploader.rb +8 -6
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +5 -3
- data/lib/aws-sdk-s3/multipart_upload.rb +27 -13
- data/lib/aws-sdk-s3/multipart_upload_part.rb +19 -9
- data/lib/aws-sdk-s3/object.rb +151 -105
- data/lib/aws-sdk-s3/object_acl.rb +14 -6
- data/lib/aws-sdk-s3/object_copier.rb +7 -5
- data/lib/aws-sdk-s3/object_multipart_copier.rb +33 -17
- data/lib/aws-sdk-s3/object_summary.rb +144 -89
- data/lib/aws-sdk-s3/object_version.rb +55 -21
- data/lib/aws-sdk-s3/presigned_post.rb +52 -43
- data/lib/aws-sdk-s3/presigner.rb +4 -2
- data/lib/aws-sdk-s3/resource.rb +7 -3
- data/lib/aws-sdk-s3/types.rb +854 -484
- data/lib/aws-sdk-s3.rb +1 -1
- metadata +6 -6
@@ -296,6 +296,7 @@ module Aws::S3
|
|
296
296
|
IsEnabled = Shapes::BooleanShape.new(name: 'IsEnabled')
|
297
297
|
IsLatest = Shapes::BooleanShape.new(name: 'IsLatest')
|
298
298
|
IsPublic = Shapes::BooleanShape.new(name: 'IsPublic')
|
299
|
+
IsRestoreInProgress = Shapes::BooleanShape.new(name: 'IsRestoreInProgress')
|
299
300
|
IsTruncated = Shapes::BooleanShape.new(name: 'IsTruncated')
|
300
301
|
JSONInput = Shapes::StructureShape.new(name: 'JSONInput')
|
301
302
|
JSONOutput = Shapes::StructureShape.new(name: 'JSONOutput')
|
@@ -409,6 +410,8 @@ module Aws::S3
|
|
409
410
|
ObjectVersionId = Shapes::StringShape.new(name: 'ObjectVersionId')
|
410
411
|
ObjectVersionList = Shapes::ListShape.new(name: 'ObjectVersionList', flattened: true)
|
411
412
|
ObjectVersionStorageClass = Shapes::StringShape.new(name: 'ObjectVersionStorageClass')
|
413
|
+
OptionalObjectAttributes = Shapes::StringShape.new(name: 'OptionalObjectAttributes')
|
414
|
+
OptionalObjectAttributesList = Shapes::ListShape.new(name: 'OptionalObjectAttributesList')
|
412
415
|
OutputLocation = Shapes::StructureShape.new(name: 'OutputLocation')
|
413
416
|
OutputSerialization = Shapes::StructureShape.new(name: 'OutputSerialization')
|
414
417
|
Owner = Shapes::StructureShape.new(name: 'Owner')
|
@@ -507,11 +510,13 @@ module Aws::S3
|
|
507
510
|
ResponseContentType = Shapes::StringShape.new(name: 'ResponseContentType')
|
508
511
|
ResponseExpires = Shapes::TimestampShape.new(name: 'ResponseExpires', timestampFormat: "rfc822")
|
509
512
|
Restore = Shapes::StringShape.new(name: 'Restore')
|
513
|
+
RestoreExpiryDate = Shapes::TimestampShape.new(name: 'RestoreExpiryDate')
|
510
514
|
RestoreObjectOutput = Shapes::StructureShape.new(name: 'RestoreObjectOutput')
|
511
515
|
RestoreObjectRequest = Shapes::StructureShape.new(name: 'RestoreObjectRequest')
|
512
516
|
RestoreOutputPath = Shapes::StringShape.new(name: 'RestoreOutputPath')
|
513
517
|
RestoreRequest = Shapes::StructureShape.new(name: 'RestoreRequest')
|
514
518
|
RestoreRequestType = Shapes::StringShape.new(name: 'RestoreRequestType')
|
519
|
+
RestoreStatus = Shapes::StructureShape.new(name: 'RestoreStatus')
|
515
520
|
Role = Shapes::StringShape.new(name: 'Role')
|
516
521
|
RoutingRule = Shapes::StructureShape.new(name: 'RoutingRule')
|
517
522
|
RoutingRules = Shapes::ListShape.new(name: 'RoutingRules')
|
@@ -1074,10 +1079,12 @@ module Aws::S3
|
|
1074
1079
|
FilterRuleList.member = Shapes::ShapeRef.new(shape: FilterRule)
|
1075
1080
|
|
1076
1081
|
GetBucketAccelerateConfigurationOutput.add_member(:status, Shapes::ShapeRef.new(shape: BucketAccelerateStatus, location_name: "Status"))
|
1082
|
+
GetBucketAccelerateConfigurationOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
1077
1083
|
GetBucketAccelerateConfigurationOutput.struct_class = Types::GetBucketAccelerateConfigurationOutput
|
1078
1084
|
|
1079
1085
|
GetBucketAccelerateConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam"=>{"name"=>"Bucket"}}))
|
1080
1086
|
GetBucketAccelerateConfigurationRequest.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
|
1087
|
+
GetBucketAccelerateConfigurationRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
|
1081
1088
|
GetBucketAccelerateConfigurationRequest.struct_class = Types::GetBucketAccelerateConfigurationRequest
|
1082
1089
|
|
1083
1090
|
GetBucketAclOutput.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
|
@@ -1664,6 +1671,7 @@ module Aws::S3
|
|
1664
1671
|
ListMultipartUploadsOutput.add_member(:uploads, Shapes::ShapeRef.new(shape: MultipartUploadList, location_name: "Upload"))
|
1665
1672
|
ListMultipartUploadsOutput.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
|
1666
1673
|
ListMultipartUploadsOutput.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
|
1674
|
+
ListMultipartUploadsOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
1667
1675
|
ListMultipartUploadsOutput.struct_class = Types::ListMultipartUploadsOutput
|
1668
1676
|
|
1669
1677
|
ListMultipartUploadsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam"=>{"name"=>"Bucket"}}))
|
@@ -1674,6 +1682,7 @@ module Aws::S3
|
|
1674
1682
|
ListMultipartUploadsRequest.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
|
1675
1683
|
ListMultipartUploadsRequest.add_member(:upload_id_marker, Shapes::ShapeRef.new(shape: UploadIdMarker, location: "querystring", location_name: "upload-id-marker"))
|
1676
1684
|
ListMultipartUploadsRequest.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
|
1685
|
+
ListMultipartUploadsRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
|
1677
1686
|
ListMultipartUploadsRequest.struct_class = Types::ListMultipartUploadsRequest
|
1678
1687
|
|
1679
1688
|
ListObjectVersionsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
|
@@ -1689,6 +1698,7 @@ module Aws::S3
|
|
1689
1698
|
ListObjectVersionsOutput.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location_name: "MaxKeys"))
|
1690
1699
|
ListObjectVersionsOutput.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
|
1691
1700
|
ListObjectVersionsOutput.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
|
1701
|
+
ListObjectVersionsOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
1692
1702
|
ListObjectVersionsOutput.struct_class = Types::ListObjectVersionsOutput
|
1693
1703
|
|
1694
1704
|
ListObjectVersionsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam"=>{"name"=>"Bucket"}}))
|
@@ -1699,6 +1709,8 @@ module Aws::S3
|
|
1699
1709
|
ListObjectVersionsRequest.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
|
1700
1710
|
ListObjectVersionsRequest.add_member(:version_id_marker, Shapes::ShapeRef.new(shape: VersionIdMarker, location: "querystring", location_name: "version-id-marker"))
|
1701
1711
|
ListObjectVersionsRequest.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
|
1712
|
+
ListObjectVersionsRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
|
1713
|
+
ListObjectVersionsRequest.add_member(:optional_object_attributes, Shapes::ShapeRef.new(shape: OptionalObjectAttributesList, location: "header", location_name: "x-amz-optional-object-attributes"))
|
1702
1714
|
ListObjectVersionsRequest.struct_class = Types::ListObjectVersionsRequest
|
1703
1715
|
|
1704
1716
|
ListObjectsOutput.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
|
@@ -1711,6 +1723,7 @@ module Aws::S3
|
|
1711
1723
|
ListObjectsOutput.add_member(:max_keys, Shapes::ShapeRef.new(shape: MaxKeys, location_name: "MaxKeys"))
|
1712
1724
|
ListObjectsOutput.add_member(:common_prefixes, Shapes::ShapeRef.new(shape: CommonPrefixList, location_name: "CommonPrefixes"))
|
1713
1725
|
ListObjectsOutput.add_member(:encoding_type, Shapes::ShapeRef.new(shape: EncodingType, location_name: "EncodingType"))
|
1726
|
+
ListObjectsOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
1714
1727
|
ListObjectsOutput.struct_class = Types::ListObjectsOutput
|
1715
1728
|
|
1716
1729
|
ListObjectsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam"=>{"name"=>"Bucket"}}))
|
@@ -1721,6 +1734,7 @@ module Aws::S3
|
|
1721
1734
|
ListObjectsRequest.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location: "querystring", location_name: "prefix"))
|
1722
1735
|
ListObjectsRequest.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
|
1723
1736
|
ListObjectsRequest.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
|
1737
|
+
ListObjectsRequest.add_member(:optional_object_attributes, Shapes::ShapeRef.new(shape: OptionalObjectAttributesList, location: "header", location_name: "x-amz-optional-object-attributes"))
|
1724
1738
|
ListObjectsRequest.struct_class = Types::ListObjectsRequest
|
1725
1739
|
|
1726
1740
|
ListObjectsV2Output.add_member(:is_truncated, Shapes::ShapeRef.new(shape: IsTruncated, location_name: "IsTruncated"))
|
@@ -1735,6 +1749,7 @@ module Aws::S3
|
|
1735
1749
|
ListObjectsV2Output.add_member(:continuation_token, Shapes::ShapeRef.new(shape: Token, location_name: "ContinuationToken"))
|
1736
1750
|
ListObjectsV2Output.add_member(:next_continuation_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "NextContinuationToken"))
|
1737
1751
|
ListObjectsV2Output.add_member(:start_after, Shapes::ShapeRef.new(shape: StartAfter, location_name: "StartAfter"))
|
1752
|
+
ListObjectsV2Output.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
1738
1753
|
ListObjectsV2Output.struct_class = Types::ListObjectsV2Output
|
1739
1754
|
|
1740
1755
|
ListObjectsV2Request.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam"=>{"name"=>"Bucket"}}))
|
@@ -1747,6 +1762,7 @@ module Aws::S3
|
|
1747
1762
|
ListObjectsV2Request.add_member(:start_after, Shapes::ShapeRef.new(shape: StartAfter, location: "querystring", location_name: "start-after"))
|
1748
1763
|
ListObjectsV2Request.add_member(:request_payer, Shapes::ShapeRef.new(shape: RequestPayer, location: "header", location_name: "x-amz-request-payer"))
|
1749
1764
|
ListObjectsV2Request.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
|
1765
|
+
ListObjectsV2Request.add_member(:optional_object_attributes, Shapes::ShapeRef.new(shape: OptionalObjectAttributesList, location: "header", location_name: "x-amz-optional-object-attributes"))
|
1750
1766
|
ListObjectsV2Request.struct_class = Types::ListObjectsV2Request
|
1751
1767
|
|
1752
1768
|
ListPartsOutput.add_member(:abort_date, Shapes::ShapeRef.new(shape: AbortDate, location: "header", location_name: "x-amz-abort-date"))
|
@@ -1860,6 +1876,7 @@ module Aws::S3
|
|
1860
1876
|
Object.add_member(:size, Shapes::ShapeRef.new(shape: Size, location_name: "Size"))
|
1861
1877
|
Object.add_member(:storage_class, Shapes::ShapeRef.new(shape: ObjectStorageClass, location_name: "StorageClass"))
|
1862
1878
|
Object.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
|
1879
|
+
Object.add_member(:restore_status, Shapes::ShapeRef.new(shape: RestoreStatus, location_name: "RestoreStatus"))
|
1863
1880
|
Object.struct_class = Types::Object
|
1864
1881
|
|
1865
1882
|
ObjectAlreadyInActiveTierError.struct_class = Types::ObjectAlreadyInActiveTierError
|
@@ -1907,10 +1924,13 @@ module Aws::S3
|
|
1907
1924
|
ObjectVersion.add_member(:is_latest, Shapes::ShapeRef.new(shape: IsLatest, location_name: "IsLatest"))
|
1908
1925
|
ObjectVersion.add_member(:last_modified, Shapes::ShapeRef.new(shape: LastModified, location_name: "LastModified"))
|
1909
1926
|
ObjectVersion.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
|
1927
|
+
ObjectVersion.add_member(:restore_status, Shapes::ShapeRef.new(shape: RestoreStatus, location_name: "RestoreStatus"))
|
1910
1928
|
ObjectVersion.struct_class = Types::ObjectVersion
|
1911
1929
|
|
1912
1930
|
ObjectVersionList.member = Shapes::ShapeRef.new(shape: ObjectVersion)
|
1913
1931
|
|
1932
|
+
OptionalObjectAttributesList.member = Shapes::ShapeRef.new(shape: OptionalObjectAttributes)
|
1933
|
+
|
1914
1934
|
OutputLocation.add_member(:s3, Shapes::ShapeRef.new(shape: S3Location, location_name: "S3"))
|
1915
1935
|
OutputLocation.struct_class = Types::OutputLocation
|
1916
1936
|
|
@@ -2384,6 +2404,10 @@ module Aws::S3
|
|
2384
2404
|
RestoreRequest.add_member(:output_location, Shapes::ShapeRef.new(shape: OutputLocation, location_name: "OutputLocation"))
|
2385
2405
|
RestoreRequest.struct_class = Types::RestoreRequest
|
2386
2406
|
|
2407
|
+
RestoreStatus.add_member(:is_restore_in_progress, Shapes::ShapeRef.new(shape: IsRestoreInProgress, location_name: "IsRestoreInProgress"))
|
2408
|
+
RestoreStatus.add_member(:restore_expiry_date, Shapes::ShapeRef.new(shape: RestoreExpiryDate, location_name: "RestoreExpiryDate"))
|
2409
|
+
RestoreStatus.struct_class = Types::RestoreStatus
|
2410
|
+
|
2387
2411
|
RoutingRule.add_member(:condition, Shapes::ShapeRef.new(shape: Condition, location_name: "Condition"))
|
2388
2412
|
RoutingRule.add_member(:redirect, Shapes::ShapeRef.new(shape: Redirect, required: true, location_name: "Redirect"))
|
2389
2413
|
RoutingRule.struct_class = Types::RoutingRule
|
@@ -134,7 +134,9 @@ module Aws
|
|
134
134
|
|
135
135
|
# @api private
|
136
136
|
def load
|
137
|
-
@data =
|
137
|
+
@data = Aws::Plugins::UserAgent.feature('resource') do
|
138
|
+
client.list_buckets.buckets.find { |b| b.name == name }
|
139
|
+
end
|
138
140
|
raise "unable to load bucket #{name}" if @data.nil?
|
139
141
|
|
140
142
|
self
|
@@ -8,7 +8,7 @@ module Aws
|
|
8
8
|
class PermanentRedirect < ServiceError
|
9
9
|
# @param [Seahorse::Client::RequestContext] context
|
10
10
|
# @param [String] message
|
11
|
-
# @param [Aws::S3::Types::PermanentRedirect]
|
11
|
+
# @param [Aws::S3::Types::PermanentRedirect] _data
|
12
12
|
def initialize(context, message, _data = Aws::EmptyStructure.new)
|
13
13
|
data = Aws::S3::Types::PermanentRedirect.new(message: message)
|
14
14
|
body = context.http_response.body_contents
|
@@ -46,6 +46,14 @@ module Aws
|
|
46
46
|
# different region. You do not need to specify this option
|
47
47
|
# if you have provided a `:source_client` or a `:content_length`.
|
48
48
|
#
|
49
|
+
# @option options [Boolean] :use_source_parts (false) Only used when
|
50
|
+
# `:multipart_copy` is `true`. Use part sizes defined on the source
|
51
|
+
# object if any exist. If copying or moving an object that
|
52
|
+
# is already multipart, this does not re-part the object, instead
|
53
|
+
# re-using the part definitions on the original. That means the etag
|
54
|
+
# and any checksums will not change. This is especially useful if the
|
55
|
+
# source object has parts with varied sizes.
|
56
|
+
#
|
49
57
|
# @example Basic object copy
|
50
58
|
#
|
51
59
|
# bucket = Aws::S3::Bucket.new('target-bucket')
|
@@ -68,11 +76,13 @@ module Aws
|
|
68
76
|
# @see #copy_to
|
69
77
|
#
|
70
78
|
def copy_from(source, options = {})
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
79
|
+
Aws::Plugins::UserAgent.feature('resource') do
|
80
|
+
if Hash === source && source[:copy_source]
|
81
|
+
# for backwards compatibility
|
82
|
+
@client.copy_object(source.merge(bucket: bucket_name, key: key))
|
83
|
+
else
|
84
|
+
ObjectCopier.new(self, options).copy_from(source, options)
|
85
|
+
end
|
76
86
|
end
|
77
87
|
end
|
78
88
|
|
@@ -109,7 +119,9 @@ module Aws
|
|
109
119
|
# object.copy_to('src-bucket/src-key', multipart_copy: true)
|
110
120
|
#
|
111
121
|
def copy_to(target, options = {})
|
112
|
-
|
122
|
+
Aws::Plugins::UserAgent.feature('resource') do
|
123
|
+
ObjectCopier.new(self, options).copy_to(target, options)
|
124
|
+
end
|
113
125
|
end
|
114
126
|
|
115
127
|
# Copies and deletes the current object. The object will only be deleted
|
@@ -341,6 +353,10 @@ module Aws
|
|
341
353
|
# obj.upload_stream do |write_stream|
|
342
354
|
# IO.copy_stream(STDIN, write_stream)
|
343
355
|
# end
|
356
|
+
# @param [Hash] options
|
357
|
+
# Additional options for {Client#create_multipart_upload},
|
358
|
+
# {Client#complete_multipart_upload},
|
359
|
+
# and {Client#upload_part} can be provided.
|
344
360
|
#
|
345
361
|
# @option options [Integer] :thread_count (10) The number of parallel
|
346
362
|
# multipart uploads
|
@@ -363,6 +379,9 @@ module Aws
|
|
363
379
|
# @return [Boolean] Returns `true` when the object is uploaded
|
364
380
|
# without any errors.
|
365
381
|
#
|
382
|
+
# @see Client#create_multipart_upload
|
383
|
+
# @see Client#complete_multipart_upload
|
384
|
+
# @see Client#upload_part
|
366
385
|
def upload_stream(options = {}, &block)
|
367
386
|
uploading_options = options.dup
|
368
387
|
uploader = MultipartStreamUploader.new(
|
@@ -371,10 +390,12 @@ module Aws
|
|
371
390
|
tempfile: uploading_options.delete(:tempfile),
|
372
391
|
part_size: uploading_options.delete(:part_size)
|
373
392
|
)
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
393
|
+
Aws::Plugins::UserAgent.feature('resource') do
|
394
|
+
uploader.upload(
|
395
|
+
uploading_options.merge(bucket: bucket_name, key: key),
|
396
|
+
&block
|
397
|
+
)
|
398
|
+
end
|
378
399
|
true
|
379
400
|
end
|
380
401
|
|
@@ -413,6 +434,13 @@ module Aws
|
|
413
434
|
# using an open Tempfile, rewind it before uploading or else the object
|
414
435
|
# will be empty.
|
415
436
|
#
|
437
|
+
# @param [Hash] options
|
438
|
+
# Additional options for {Client#put_object}
|
439
|
+
# when file sizes below the multipart threshold. For files larger than
|
440
|
+
# the multipart threshold, options for {Client#create_multipart_upload},
|
441
|
+
# {Client#complete_multipart_upload},
|
442
|
+
# and {Client#upload_part} can be provided.
|
443
|
+
#
|
416
444
|
# @option options [Integer] :multipart_threshold (104857600) Files larger
|
417
445
|
# than or equal to `:multipart_threshold` are uploaded using the S3
|
418
446
|
# multipart APIs.
|
@@ -434,16 +462,23 @@ module Aws
|
|
434
462
|
#
|
435
463
|
# @return [Boolean] Returns `true` when the object is uploaded
|
436
464
|
# without any errors.
|
465
|
+
#
|
466
|
+
# @see Client#put_object
|
467
|
+
# @see Client#create_multipart_upload
|
468
|
+
# @see Client#complete_multipart_upload
|
469
|
+
# @see Client#upload_part
|
437
470
|
def upload_file(source, options = {})
|
438
471
|
uploading_options = options.dup
|
439
472
|
uploader = FileUploader.new(
|
440
473
|
multipart_threshold: uploading_options.delete(:multipart_threshold),
|
441
474
|
client: client
|
442
475
|
)
|
443
|
-
response =
|
444
|
-
|
445
|
-
|
446
|
-
|
476
|
+
response = Aws::Plugins::UserAgent.feature('resource') do
|
477
|
+
uploader.upload(
|
478
|
+
source,
|
479
|
+
uploading_options.merge(bucket: bucket_name, key: key)
|
480
|
+
)
|
481
|
+
end
|
447
482
|
yield response if block_given?
|
448
483
|
true
|
449
484
|
end
|
@@ -459,8 +494,21 @@ module Aws
|
|
459
494
|
# # and the parts are downloaded in parallel
|
460
495
|
# obj.download_file('/path/to/very_large_file')
|
461
496
|
#
|
497
|
+
# You can provide a callback to monitor progress of the download:
|
498
|
+
#
|
499
|
+
# # bytes and part_sizes are each an array with 1 entry per part
|
500
|
+
# # part_sizes may not be known until the first bytes are retrieved
|
501
|
+
# progress = Proc.new do |bytes, part_sizes, file_size|
|
502
|
+
# puts bytes.map.with_index { |b, i| "Part #{i+1}: #{b} / #{part_sizes[i]}"}.join(' ') + "Total: #{100.0 * bytes.sum / file_size}%" }
|
503
|
+
# end
|
504
|
+
# obj.download_file('/path/to/file', progress_callback: progress)
|
505
|
+
#
|
462
506
|
# @param [String] destination Where to download the file to.
|
463
507
|
#
|
508
|
+
# @param [Hash] options
|
509
|
+
# Additional options for {Client#get_object} and #{Client#head_object}
|
510
|
+
# may be provided.
|
511
|
+
#
|
464
512
|
# @option options [String] mode `auto`, `single_request`, `get_range`
|
465
513
|
# `single_request` mode forces only 1 GET request is made in download,
|
466
514
|
# `get_range` mode allows `chunk_size` parameter to configured in
|
@@ -476,14 +524,39 @@ module Aws
|
|
476
524
|
# retrieve the object. For more about object versioning, see:
|
477
525
|
# https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectVersioning.html
|
478
526
|
#
|
527
|
+
# @option options [String] checksum_mode (ENABLED) When `ENABLED` and
|
528
|
+
# the object has a stored checksum, it will be used to validate the
|
529
|
+
# download and will raise an `Aws::Errors::ChecksumError` if
|
530
|
+
# checksum validation fails. You may provide a `on_checksum_validated`
|
531
|
+
# callback if you need to verify that validation occurred and which
|
532
|
+
# algorithm was used. To disable checksum validation, set
|
533
|
+
# `checksum_mode` to "DISABLED".
|
534
|
+
#
|
535
|
+
# @option options [Callable] on_checksum_validated Called each time a
|
536
|
+
# request's checksum is validated with the checksum algorithm and the
|
537
|
+
# response. For multipart downloads, this will be called for each
|
538
|
+
# part that is downloaded and validated.
|
539
|
+
#
|
540
|
+
# @option options [Proc] :progress_callback
|
541
|
+
# A Proc that will be called when each chunk of the download is received.
|
542
|
+
# It will be invoked with [bytes_read], [part_sizes], file_size.
|
543
|
+
# When the object is downloaded as parts (rather than by ranges), the
|
544
|
+
# part_sizes will not be known ahead of time and will be nil in the
|
545
|
+
# callback until the first bytes in the part are received.
|
546
|
+
#
|
479
547
|
# @return [Boolean] Returns `true` when the file is downloaded without
|
480
548
|
# any errors.
|
549
|
+
#
|
550
|
+
# @see Client#get_object
|
551
|
+
# @see Client#head_object
|
481
552
|
def download_file(destination, options = {})
|
482
553
|
downloader = FileDownloader.new(client: client)
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
554
|
+
Aws::Plugins::UserAgent.feature('resource') do
|
555
|
+
downloader.download(
|
556
|
+
destination,
|
557
|
+
options.merge(bucket: bucket_name, key: key)
|
558
|
+
)
|
559
|
+
end
|
487
560
|
true
|
488
561
|
end
|
489
562
|
end
|
@@ -270,7 +270,9 @@ module Aws
|
|
270
270
|
envelope_location: @envelope_location,
|
271
271
|
instruction_file_suffix: @instruction_file_suffix,
|
272
272
|
}
|
273
|
-
|
273
|
+
Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
|
274
|
+
req.send_request
|
275
|
+
end
|
274
276
|
end
|
275
277
|
|
276
278
|
# Gets an object from Amazon S3, decrypting data locally.
|
@@ -298,7 +300,9 @@ module Aws
|
|
298
300
|
envelope_location: envelope_location,
|
299
301
|
instruction_file_suffix: instruction_file_suffix,
|
300
302
|
}
|
301
|
-
|
303
|
+
Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
|
304
|
+
req.send_request(target: block)
|
305
|
+
end
|
302
306
|
end
|
303
307
|
|
304
308
|
private
|
@@ -17,11 +17,13 @@ module Aws
|
|
17
17
|
# envelope and encryption cipher.
|
18
18
|
def encryption_cipher
|
19
19
|
encryption_context = { "kms_cmk_id" => @kms_key_id }
|
20
|
-
key_data =
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
key_data = Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
|
21
|
+
@kms_client.generate_data_key(
|
22
|
+
key_id: @kms_key_id,
|
23
|
+
encryption_context: encryption_context,
|
24
|
+
key_spec: 'AES_256'
|
25
|
+
)
|
26
|
+
end
|
25
27
|
cipher = Utils.aes_encryption_cipher(:CBC)
|
26
28
|
cipher.key = key_data.plaintext
|
27
29
|
envelope = {
|
@@ -58,10 +60,12 @@ module Aws
|
|
58
60
|
"#{envelope['x-amz-wrap-alg']}"
|
59
61
|
end
|
60
62
|
|
61
|
-
key =
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
key = Aws::Plugins::UserAgent.feature('S3CryptoV1n') do
|
64
|
+
@kms_client.decrypt(
|
65
|
+
ciphertext_blob: decode64(envelope['x-amz-key-v2']),
|
66
|
+
encryption_context: encryption_context
|
67
|
+
).plaintext
|
68
|
+
end
|
65
69
|
|
66
70
|
iv = decode64(envelope['x-amz-iv'])
|
67
71
|
block_mode =
|
@@ -361,7 +361,9 @@ module Aws
|
|
361
361
|
instruction_file_suffix: @instruction_file_suffix,
|
362
362
|
kms_encryption_context: kms_encryption_context
|
363
363
|
}
|
364
|
-
|
364
|
+
Aws::Plugins::UserAgent.feature('S3CryptoV2') do
|
365
|
+
req.send_request
|
366
|
+
end
|
365
367
|
end
|
366
368
|
|
367
369
|
# Gets an object from Amazon S3, decrypting data locally.
|
@@ -414,7 +416,9 @@ module Aws
|
|
414
416
|
kms_allow_decrypt_with_any_cmk: kms_any_cmk_mode,
|
415
417
|
security_profile: security_profile
|
416
418
|
}
|
417
|
-
|
419
|
+
Aws::Plugins::UserAgent.feature('S3CryptoV2') do
|
420
|
+
req.send_request(target: block)
|
421
|
+
end
|
418
422
|
end
|
419
423
|
|
420
424
|
private
|
@@ -24,11 +24,13 @@ module Aws
|
|
24
24
|
def encryption_cipher(options = {})
|
25
25
|
validate_key_for_encryption
|
26
26
|
encryption_context = build_encryption_context(@content_encryption_schema, options)
|
27
|
-
key_data =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
key_data = Aws::Plugins::UserAgent.feature('S3CryptoV2') do
|
28
|
+
@kms_client.generate_data_key(
|
29
|
+
key_id: @kms_key_id,
|
30
|
+
encryption_context: encryption_context,
|
31
|
+
key_spec: 'AES_256'
|
32
|
+
)
|
33
|
+
end
|
32
34
|
cipher = Utils.aes_encryption_cipher(:GCM)
|
33
35
|
cipher.key = key_data.plaintext
|
34
36
|
envelope = {
|
@@ -83,7 +85,9 @@ module Aws
|
|
83
85
|
decrypt_options[:key_id] = @kms_key_id
|
84
86
|
end
|
85
87
|
|
86
|
-
key =
|
88
|
+
key = Aws::Plugins::UserAgent.feature('S3CryptoV2') do
|
89
|
+
@kms_client.decrypt(decrypt_options).plaintext
|
90
|
+
end
|
87
91
|
iv = decode64(envelope['x-amz-iv'])
|
88
92
|
block_mode =
|
89
93
|
case cek_alg
|
@@ -119,6 +119,10 @@ module Aws::S3
|
|
119
119
|
end
|
120
120
|
self[:endpoint] = options[:endpoint]
|
121
121
|
self[:force_path_style] = options[:force_path_style]
|
122
|
+
self[:force_path_style] = false if self[:force_path_style].nil?
|
123
|
+
if self[:force_path_style].nil?
|
124
|
+
raise ArgumentError, "Missing required EndpointParameter: :force_path_style"
|
125
|
+
end
|
122
126
|
self[:accelerate] = options[:accelerate]
|
123
127
|
self[:accelerate] = false if self[:accelerate].nil?
|
124
128
|
if self[:accelerate].nil?
|