aws-sdk-s3 1.119.1 → 1.132.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +97 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/bucket.rb +108 -55
- 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 +1740 -1441
- 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 +27 -0
- data/lib/aws-sdk-s3/customizations/object.rb +49 -18
- data/lib/aws-sdk-s3/customizations/types/permanent_redirect.rb +26 -0
- data/lib/aws-sdk-s3/customizations.rb +2 -0
- 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 +103 -327
- data/lib/aws-sdk-s3/endpoints.rb +1 -0
- data/lib/aws-sdk-s3/file_downloader.rb +61 -25
- 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 +12 -4
- data/lib/aws-sdk-s3/multipart_upload_part.rb +10 -4
- data/lib/aws-sdk-s3/object.rb +105 -77
- data/lib/aws-sdk-s3/object_acl.rb +9 -3
- 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 +103 -64
- data/lib/aws-sdk-s3/object_version.rb +35 -9
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +13 -11
- 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 +711 -405
- data/lib/aws-sdk-s3.rb +1 -1
- metadata +8 -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
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module S3
|
5
|
+
module Errors
|
6
|
+
# Hijack PermanentRedirect dynamic error to also include endpoint
|
7
|
+
# and bucket.
|
8
|
+
class PermanentRedirect < ServiceError
|
9
|
+
# @param [Seahorse::Client::RequestContext] context
|
10
|
+
# @param [String] message
|
11
|
+
# @param [Aws::S3::Types::PermanentRedirect] _data
|
12
|
+
def initialize(context, message, _data = Aws::EmptyStructure.new)
|
13
|
+
data = Aws::S3::Types::PermanentRedirect.new(message: message)
|
14
|
+
body = context.http_response.body_contents
|
15
|
+
if (endpoint = body.match(/<Endpoint>(.+?)<\/Endpoint>/))
|
16
|
+
data.endpoint = endpoint[1]
|
17
|
+
end
|
18
|
+
if (bucket = body.match(/<Bucket>(.+?)<\/Bucket>/))
|
19
|
+
data.bucket = bucket[1]
|
20
|
+
end
|
21
|
+
data.region = context.http_response.headers['x-amz-bucket-region']
|
22
|
+
super(context, message, data)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -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
|
@@ -371,10 +383,12 @@ module Aws
|
|
371
383
|
tempfile: uploading_options.delete(:tempfile),
|
372
384
|
part_size: uploading_options.delete(:part_size)
|
373
385
|
)
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
386
|
+
Aws::Plugins::UserAgent.feature('resource') do
|
387
|
+
uploader.upload(
|
388
|
+
uploading_options.merge(bucket: bucket_name, key: key),
|
389
|
+
&block
|
390
|
+
)
|
391
|
+
end
|
378
392
|
true
|
379
393
|
end
|
380
394
|
|
@@ -440,10 +454,12 @@ module Aws
|
|
440
454
|
multipart_threshold: uploading_options.delete(:multipart_threshold),
|
441
455
|
client: client
|
442
456
|
)
|
443
|
-
response =
|
444
|
-
|
445
|
-
|
446
|
-
|
457
|
+
response = Aws::Plugins::UserAgent.feature('resource') do
|
458
|
+
uploader.upload(
|
459
|
+
source,
|
460
|
+
uploading_options.merge(bucket: bucket_name, key: key)
|
461
|
+
)
|
462
|
+
end
|
447
463
|
yield response if block_given?
|
448
464
|
true
|
449
465
|
end
|
@@ -476,14 +492,29 @@ module Aws
|
|
476
492
|
# retrieve the object. For more about object versioning, see:
|
477
493
|
# https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectVersioning.html
|
478
494
|
#
|
495
|
+
# @option options [String] checksum_mode (ENABLED) When `ENABLED` and
|
496
|
+
# the object has a stored checksum, it will be used to validate the
|
497
|
+
# download and will raise an `Aws::Errors::ChecksumError` if
|
498
|
+
# checksum validation fails. You may provide a `on_checksum_validated`
|
499
|
+
# callback if you need to verify that validation occurred and which
|
500
|
+
# algorithm was used. To disable checksum validation, set
|
501
|
+
# `checksum_mode` to "DISABLED".
|
502
|
+
#
|
503
|
+
# @option options [Callable] on_checksum_validated Called each time a
|
504
|
+
# request's checksum is validated with the checksum algorithm and the
|
505
|
+
# response. For multipart downloads, this will be called for each
|
506
|
+
# part that is downloaded and validated.
|
507
|
+
#
|
479
508
|
# @return [Boolean] Returns `true` when the file is downloaded without
|
480
509
|
# any errors.
|
481
510
|
def download_file(destination, options = {})
|
482
511
|
downloader = FileDownloader.new(client: client)
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
512
|
+
Aws::Plugins::UserAgent.feature('resource') do
|
513
|
+
downloader.download(
|
514
|
+
destination,
|
515
|
+
options.merge(bucket: bucket_name, key: key)
|
516
|
+
)
|
517
|
+
end
|
487
518
|
true
|
488
519
|
end
|
489
520
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module S3
|
5
|
+
module Types
|
6
|
+
# This error is not modeled.
|
7
|
+
#
|
8
|
+
# The bucket you are attempting to access must be addressed using the
|
9
|
+
# specified endpoint. Please send all future requests to this endpoint.
|
10
|
+
#
|
11
|
+
# @!attribute [rw] endpoint
|
12
|
+
# @return [String]
|
13
|
+
#
|
14
|
+
# @!attribute [rw] bucket
|
15
|
+
# @return [String]
|
16
|
+
#
|
17
|
+
# @!attribute [rw] message
|
18
|
+
# @return [String]
|
19
|
+
#
|
20
|
+
class PermanentRedirect < Struct.new(:endpoint, :bucket, :region, :message)
|
21
|
+
SENSITIVE = []
|
22
|
+
include Aws::Structure
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -18,10 +18,12 @@ require 'aws-sdk-s3/presigner'
|
|
18
18
|
|
19
19
|
# customizations to generated classes
|
20
20
|
require 'aws-sdk-s3/customizations/bucket'
|
21
|
+
require 'aws-sdk-s3/customizations/errors'
|
21
22
|
require 'aws-sdk-s3/customizations/object'
|
22
23
|
require 'aws-sdk-s3/customizations/object_summary'
|
23
24
|
require 'aws-sdk-s3/customizations/multipart_upload'
|
24
25
|
require 'aws-sdk-s3/customizations/types/list_object_versions_output'
|
26
|
+
require 'aws-sdk-s3/customizations/types/permanent_redirect'
|
25
27
|
|
26
28
|
[
|
27
29
|
Aws::S3::Object::Collection,
|
@@ -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?
|