aws-sdk-s3 1.235.0 → 1.245.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 +56 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/client.rb +131 -69
- data/lib/aws-sdk-s3/client_api.rb +28 -0
- data/lib/aws-sdk-s3/express_credentials.rb +4 -1
- data/lib/aws-sdk-s3/express_credentials_provider.rb +23 -12
- data/lib/aws-sdk-s3/multipart_upload.rb +13 -0
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +10 -2
- data/lib/aws-sdk-s3/presigned_post.rb +50 -1
- data/lib/aws-sdk-s3/presigner.rb +1 -1
- data/lib/aws-sdk-s3/types.rb +177 -203
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/client.rbs +13 -3
- data/sig/multipart_upload.rbs +3 -0
- data/sig/params.rbs +17 -0
- data/sig/types.rbs +27 -0
- metadata +3 -3
|
@@ -607,9 +607,12 @@ module Aws::S3
|
|
|
607
607
|
ReplicaModifications = Shapes::StructureShape.new(name: 'ReplicaModifications')
|
|
608
608
|
ReplicaModificationsStatus = Shapes::StringShape.new(name: 'ReplicaModificationsStatus')
|
|
609
609
|
ReplicationConfiguration = Shapes::StructureShape.new(name: 'ReplicationConfiguration')
|
|
610
|
+
ReplicationPrefixList = Shapes::ListShape.new(name: 'ReplicationPrefixList')
|
|
610
611
|
ReplicationRule = Shapes::StructureShape.new(name: 'ReplicationRule')
|
|
611
612
|
ReplicationRuleAndOperator = Shapes::StructureShape.new(name: 'ReplicationRuleAndOperator')
|
|
612
613
|
ReplicationRuleFilter = Shapes::StructureShape.new(name: 'ReplicationRuleFilter')
|
|
614
|
+
ReplicationRuleNotOperator = Shapes::StructureShape.new(name: 'ReplicationRuleNotOperator')
|
|
615
|
+
ReplicationRuleOrOperator = Shapes::StructureShape.new(name: 'ReplicationRuleOrOperator')
|
|
613
616
|
ReplicationRuleStatus = Shapes::StringShape.new(name: 'ReplicationRuleStatus')
|
|
614
617
|
ReplicationRules = Shapes::ListShape.new(name: 'ReplicationRules', flattened: true)
|
|
615
618
|
ReplicationStatus = Shapes::StringShape.new(name: 'ReplicationStatus')
|
|
@@ -727,6 +730,8 @@ module Aws::S3
|
|
|
727
730
|
UploadPartCopyRequest = Shapes::StructureShape.new(name: 'UploadPartCopyRequest')
|
|
728
731
|
UploadPartOutput = Shapes::StructureShape.new(name: 'UploadPartOutput')
|
|
729
732
|
UploadPartRequest = Shapes::StructureShape.new(name: 'UploadPartRequest')
|
|
733
|
+
UseSourceMultiRegionKey = Shapes::StructureShape.new(name: 'UseSourceMultiRegionKey')
|
|
734
|
+
UseSourceMultiRegionKeyStatus = Shapes::StringShape.new(name: 'UseSourceMultiRegionKeyStatus')
|
|
730
735
|
UserMetadata = Shapes::ListShape.new(name: 'UserMetadata')
|
|
731
736
|
Value = Shapes::StringShape.new(name: 'Value')
|
|
732
737
|
VersionCount = Shapes::IntegerShape.new(name: 'VersionCount')
|
|
@@ -745,6 +750,7 @@ module Aws::S3
|
|
|
745
750
|
AbortIncompleteMultipartUpload.struct_class = Types::AbortIncompleteMultipartUpload
|
|
746
751
|
|
|
747
752
|
AbortMultipartUploadOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
|
753
|
+
AbortMultipartUploadOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
|
|
748
754
|
AbortMultipartUploadOutput.struct_class = Types::AbortMultipartUploadOutput
|
|
749
755
|
|
|
750
756
|
AbortMultipartUploadRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam" => {"name" => "Bucket"}}))
|
|
@@ -1136,6 +1142,7 @@ module Aws::S3
|
|
|
1136
1142
|
CreateMultipartUploadOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
|
1137
1143
|
CreateMultipartUploadOutput.add_member(:checksum_algorithm, Shapes::ShapeRef.new(shape: ChecksumAlgorithm, location: "header", location_name: "x-amz-checksum-algorithm"))
|
|
1138
1144
|
CreateMultipartUploadOutput.add_member(:checksum_type, Shapes::ShapeRef.new(shape: ChecksumType, location: "header", location_name: "x-amz-checksum-type"))
|
|
1145
|
+
CreateMultipartUploadOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
|
|
1139
1146
|
CreateMultipartUploadOutput.struct_class = Types::CreateMultipartUploadOutput
|
|
1140
1147
|
|
|
1141
1148
|
CreateMultipartUploadRequest.add_member(:acl, Shapes::ShapeRef.new(shape: ObjectCannedACL, location: "header", location_name: "x-amz-acl"))
|
|
@@ -1362,6 +1369,7 @@ module Aws::S3
|
|
|
1362
1369
|
Encryption.struct_class = Types::Encryption
|
|
1363
1370
|
|
|
1364
1371
|
EncryptionConfiguration.add_member(:replica_kms_key_id, Shapes::ShapeRef.new(shape: ReplicaKmsKeyID, location_name: "ReplicaKmsKeyID"))
|
|
1372
|
+
EncryptionConfiguration.add_member(:use_source_multi_region_key, Shapes::ShapeRef.new(shape: UseSourceMultiRegionKey, location_name: "UseSourceMultiRegionKey"))
|
|
1365
1373
|
EncryptionConfiguration.struct_class = Types::EncryptionConfiguration
|
|
1366
1374
|
|
|
1367
1375
|
EncryptionTypeList.member = Shapes::ShapeRef.new(shape: EncryptionType, location_name: "EncryptionType")
|
|
@@ -2289,6 +2297,7 @@ module Aws::S3
|
|
|
2289
2297
|
ListPartsOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
|
2290
2298
|
ListPartsOutput.add_member(:checksum_algorithm, Shapes::ShapeRef.new(shape: ChecksumAlgorithm, location_name: "ChecksumAlgorithm"))
|
|
2291
2299
|
ListPartsOutput.add_member(:checksum_type, Shapes::ShapeRef.new(shape: ChecksumType, location_name: "ChecksumType"))
|
|
2300
|
+
ListPartsOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
|
|
2292
2301
|
ListPartsOutput.struct_class = Types::ListPartsOutput
|
|
2293
2302
|
|
|
2294
2303
|
ListPartsRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket", metadata: {"contextParam" => {"name" => "Bucket"}}))
|
|
@@ -2370,6 +2379,7 @@ module Aws::S3
|
|
|
2370
2379
|
MultipartUpload.add_member(:initiator, Shapes::ShapeRef.new(shape: Initiator, location_name: "Initiator"))
|
|
2371
2380
|
MultipartUpload.add_member(:checksum_algorithm, Shapes::ShapeRef.new(shape: ChecksumAlgorithm, location_name: "ChecksumAlgorithm"))
|
|
2372
2381
|
MultipartUpload.add_member(:checksum_type, Shapes::ShapeRef.new(shape: ChecksumType, location_name: "ChecksumType"))
|
|
2382
|
+
MultipartUpload.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
|
|
2373
2383
|
MultipartUpload.struct_class = Types::MultipartUpload
|
|
2374
2384
|
|
|
2375
2385
|
MultipartUploadList.member = Shapes::ShapeRef.new(shape: MultipartUpload)
|
|
@@ -3009,6 +3019,8 @@ module Aws::S3
|
|
|
3009
3019
|
ReplicationConfiguration.add_member(:rules, Shapes::ShapeRef.new(shape: ReplicationRules, required: true, location_name: "Rule"))
|
|
3010
3020
|
ReplicationConfiguration.struct_class = Types::ReplicationConfiguration
|
|
3011
3021
|
|
|
3022
|
+
ReplicationPrefixList.member = Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix")
|
|
3023
|
+
|
|
3012
3024
|
ReplicationRule.add_member(:id, Shapes::ShapeRef.new(shape: ID, location_name: "ID"))
|
|
3013
3025
|
ReplicationRule.add_member(:priority, Shapes::ShapeRef.new(shape: Priority, location_name: "Priority"))
|
|
3014
3026
|
ReplicationRule.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, deprecated: true, location_name: "Prefix"))
|
|
@@ -3022,13 +3034,24 @@ module Aws::S3
|
|
|
3022
3034
|
|
|
3023
3035
|
ReplicationRuleAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
|
|
3024
3036
|
ReplicationRuleAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened" => true}))
|
|
3037
|
+
ReplicationRuleAndOperator.add_member(:not, Shapes::ShapeRef.new(shape: ReplicationRuleNotOperator, location_name: "Not"))
|
|
3025
3038
|
ReplicationRuleAndOperator.struct_class = Types::ReplicationRuleAndOperator
|
|
3026
3039
|
|
|
3027
3040
|
ReplicationRuleFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
|
|
3028
3041
|
ReplicationRuleFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
|
|
3029
3042
|
ReplicationRuleFilter.add_member(:and, Shapes::ShapeRef.new(shape: ReplicationRuleAndOperator, location_name: "And"))
|
|
3043
|
+
ReplicationRuleFilter.add_member(:not, Shapes::ShapeRef.new(shape: ReplicationRuleNotOperator, location_name: "Not"))
|
|
3030
3044
|
ReplicationRuleFilter.struct_class = Types::ReplicationRuleFilter
|
|
3031
3045
|
|
|
3046
|
+
ReplicationRuleNotOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
|
|
3047
|
+
ReplicationRuleNotOperator.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
|
|
3048
|
+
ReplicationRuleNotOperator.add_member(:or, Shapes::ShapeRef.new(shape: ReplicationRuleOrOperator, location_name: "Or"))
|
|
3049
|
+
ReplicationRuleNotOperator.struct_class = Types::ReplicationRuleNotOperator
|
|
3050
|
+
|
|
3051
|
+
ReplicationRuleOrOperator.add_member(:prefixes, Shapes::ShapeRef.new(shape: ReplicationPrefixList, location_name: "Prefix", metadata: {"flattened" => true}))
|
|
3052
|
+
ReplicationRuleOrOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened" => true}))
|
|
3053
|
+
ReplicationRuleOrOperator.struct_class = Types::ReplicationRuleOrOperator
|
|
3054
|
+
|
|
3032
3055
|
ReplicationRules.member = Shapes::ShapeRef.new(shape: ReplicationRule)
|
|
3033
3056
|
|
|
3034
3057
|
ReplicationTime.add_member(:status, Shapes::ShapeRef.new(shape: ReplicationTimeStatus, required: true, location_name: "Status"))
|
|
@@ -3302,6 +3325,7 @@ module Aws::S3
|
|
|
3302
3325
|
UploadPartCopyOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
|
|
3303
3326
|
UploadPartCopyOutput.add_member(:bucket_key_enabled, Shapes::ShapeRef.new(shape: BucketKeyEnabled, location: "header", location_name: "x-amz-server-side-encryption-bucket-key-enabled"))
|
|
3304
3327
|
UploadPartCopyOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
|
3328
|
+
UploadPartCopyOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
|
|
3305
3329
|
UploadPartCopyOutput.struct_class = Types::UploadPartCopyOutput
|
|
3306
3330
|
UploadPartCopyOutput[:payload] = :copy_part_result
|
|
3307
3331
|
UploadPartCopyOutput[:payload_member] = UploadPartCopyOutput.member(:copy_part_result)
|
|
@@ -3344,6 +3368,7 @@ module Aws::S3
|
|
|
3344
3368
|
UploadPartOutput.add_member(:ssekms_key_id, Shapes::ShapeRef.new(shape: SSEKMSKeyId, location: "header", location_name: "x-amz-server-side-encryption-aws-kms-key-id"))
|
|
3345
3369
|
UploadPartOutput.add_member(:bucket_key_enabled, Shapes::ShapeRef.new(shape: BucketKeyEnabled, location: "header", location_name: "x-amz-server-side-encryption-bucket-key-enabled"))
|
|
3346
3370
|
UploadPartOutput.add_member(:request_charged, Shapes::ShapeRef.new(shape: RequestCharged, location: "header", location_name: "x-amz-request-charged"))
|
|
3371
|
+
UploadPartOutput.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location: "header", location_name: "x-amz-version-id"))
|
|
3347
3372
|
UploadPartOutput.struct_class = Types::UploadPartOutput
|
|
3348
3373
|
|
|
3349
3374
|
UploadPartRequest.add_member(:body, Shapes::ShapeRef.new(shape: Body, location_name: "Body", metadata: {"streaming" => true}))
|
|
@@ -3373,6 +3398,9 @@ module Aws::S3
|
|
|
3373
3398
|
UploadPartRequest[:payload] = :body
|
|
3374
3399
|
UploadPartRequest[:payload_member] = UploadPartRequest.member(:body)
|
|
3375
3400
|
|
|
3401
|
+
UseSourceMultiRegionKey.add_member(:status, Shapes::ShapeRef.new(shape: UseSourceMultiRegionKeyStatus, required: true, location_name: "Status"))
|
|
3402
|
+
UseSourceMultiRegionKey.struct_class = Types::UseSourceMultiRegionKey
|
|
3403
|
+
|
|
3376
3404
|
UserMetadata.member = Shapes::ShapeRef.new(shape: MetadataEntry, location_name: "MetadataEntry")
|
|
3377
3405
|
|
|
3378
3406
|
VersioningConfiguration.add_member(:mfa_delete, Shapes::ShapeRef.new(shape: MFADelete, location_name: "MfaDelete"))
|
|
@@ -14,6 +14,7 @@ module Aws
|
|
|
14
14
|
|
|
15
15
|
def initialize(options = {})
|
|
16
16
|
@client = options[:client]
|
|
17
|
+
@base_credentials = options[:base_credentials]
|
|
17
18
|
@create_session_params = {}
|
|
18
19
|
options.each_pair do |key, value|
|
|
19
20
|
if self.class.create_session_options.include?(key)
|
|
@@ -30,7 +31,9 @@ module Aws
|
|
|
30
31
|
private
|
|
31
32
|
|
|
32
33
|
def refresh
|
|
33
|
-
|
|
34
|
+
request = @client.build_request(:create_session, @create_session_params)
|
|
35
|
+
request.context[:sigv4_credentials] = @base_credentials if @base_credentials
|
|
36
|
+
c = request.send_request.credentials
|
|
34
37
|
@credentials = Credentials.new(
|
|
35
38
|
c.access_key_id,
|
|
36
39
|
c.secret_access_key,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
3
5
|
module Aws
|
|
4
6
|
module S3
|
|
5
7
|
# @api private
|
|
@@ -10,9 +12,12 @@ module Aws
|
|
|
10
12
|
# Returns Credentials class for S3 Express. Accepts CreateSession
|
|
11
13
|
# params as options. See {Client#create_session} for details.
|
|
12
14
|
class ExpressCredentialsProvider
|
|
15
|
+
CACHE_KEY_SECRET = SecureRandom.random_bytes(64)
|
|
16
|
+
private_constant :CACHE_KEY_SECRET
|
|
17
|
+
|
|
13
18
|
# @param [Hash] options
|
|
14
19
|
# @option options [Client] :client The S3 client used to create the
|
|
15
|
-
# session.
|
|
20
|
+
# session when one is not given to {#express_credentials_for}.
|
|
16
21
|
# @option options [String] :session_mode (see: {Client#create_session})
|
|
17
22
|
# @option options [Boolean] :caching (true) When true, credentials will
|
|
18
23
|
# be cached.
|
|
@@ -27,11 +32,12 @@ module Aws
|
|
|
27
32
|
@cache = Aws::S3.express_credentials_cache
|
|
28
33
|
end
|
|
29
34
|
|
|
30
|
-
def express_credentials_for(bucket)
|
|
35
|
+
def express_credentials_for(bucket, client = @client)
|
|
36
|
+
credentials = client.config.credentials&.credentials
|
|
31
37
|
if @caching
|
|
32
|
-
cached_credentials_for(bucket)
|
|
38
|
+
cached_credentials_for(bucket, client, credentials)
|
|
33
39
|
else
|
|
34
|
-
new_credentials_for(bucket)
|
|
40
|
+
new_credentials_for(bucket, client, credentials)
|
|
35
41
|
end
|
|
36
42
|
end
|
|
37
43
|
|
|
@@ -39,18 +45,23 @@ module Aws
|
|
|
39
45
|
|
|
40
46
|
private
|
|
41
47
|
|
|
42
|
-
def cached_credentials_for(bucket)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
def cached_credentials_for(bucket, client, credentials)
|
|
49
|
+
@cache[cache_key(bucket, credentials)] ||= new_credentials_for(bucket, client, credentials)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def cache_key(bucket, credentials)
|
|
53
|
+
identity = "#{credentials&.access_key_id}#{credentials&.secret_access_key}"
|
|
54
|
+
"#{OpenSSL::HMAC.hexdigest('SHA256', CACHE_KEY_SECRET, identity)}#{bucket}"
|
|
48
55
|
end
|
|
49
56
|
|
|
50
|
-
def new_credentials_for(bucket)
|
|
57
|
+
def new_credentials_for(bucket, client, credentials)
|
|
58
|
+
# Sign with this snapshot, but report the provider's UserAgent metrics.
|
|
59
|
+
credentials = credentials&.dup
|
|
60
|
+
credentials&.metrics = client.config.credentials.metrics
|
|
51
61
|
ExpressCredentials.new(
|
|
52
62
|
bucket: bucket,
|
|
53
|
-
client:
|
|
63
|
+
client: client,
|
|
64
|
+
base_credentials: credentials,
|
|
54
65
|
**@options
|
|
55
66
|
)
|
|
56
67
|
end
|
|
@@ -117,6 +117,19 @@ module Aws::S3
|
|
|
117
117
|
data[:checksum_type]
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
# Version ID of the object.
|
|
121
|
+
#
|
|
122
|
+
# Returns the Version ID of the object for the multipart upload, if
|
|
123
|
+
# bucket versioning is enabled.
|
|
124
|
+
#
|
|
125
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
|
126
|
+
#
|
|
127
|
+
# </note>
|
|
128
|
+
# @return [String]
|
|
129
|
+
def version_id
|
|
130
|
+
data[:version_id]
|
|
131
|
+
end
|
|
132
|
+
|
|
120
133
|
# @!endgroup
|
|
121
134
|
|
|
122
135
|
# @return [Client]
|
|
@@ -35,8 +35,7 @@ for different buckets.
|
|
|
35
35
|
if context[:auth_scheme]['name'] == 'sigv4-s3express' &&
|
|
36
36
|
!context.config.disable_s3_express_session_auth
|
|
37
37
|
bucket = context.params[:bucket]
|
|
38
|
-
|
|
39
|
-
credentials = credentials_provider.express_credentials_for(bucket)
|
|
38
|
+
credentials = express_credentials_for(context, bucket)
|
|
40
39
|
context[:sigv4_credentials] = credentials # Sign will use this
|
|
41
40
|
end
|
|
42
41
|
|
|
@@ -45,6 +44,15 @@ for different buckets.
|
|
|
45
44
|
|
|
46
45
|
private
|
|
47
46
|
|
|
47
|
+
def express_credentials_for(context, bucket)
|
|
48
|
+
provider = context.config.express_credentials_provider
|
|
49
|
+
if provider.is_a?(ExpressCredentialsProvider)
|
|
50
|
+
provider.express_credentials_for(bucket, context.client)
|
|
51
|
+
else
|
|
52
|
+
provider.express_credentials_for(bucket)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
48
56
|
def with_metric(credentials, &block)
|
|
49
57
|
return block.call unless credentials
|
|
50
58
|
|
|
@@ -155,7 +155,7 @@ module Aws
|
|
|
155
155
|
#
|
|
156
156
|
# The string `${filename}` is automatically replaced with the name of the
|
|
157
157
|
# file provided by the user and is recognized by all form fields. It is
|
|
158
|
-
# not supported with `starts_with` conditions.
|
|
158
|
+
# not supported with `starts_with` conditions or {#tagging}.
|
|
159
159
|
#
|
|
160
160
|
# If the browser or client provides a full or partial path to the file,
|
|
161
161
|
# only the text following the last slash (/) or backslash (\) will be used
|
|
@@ -175,6 +175,28 @@ module Aws
|
|
|
175
175
|
# })
|
|
176
176
|
# ```
|
|
177
177
|
#
|
|
178
|
+
# ### Object Tags
|
|
179
|
+
#
|
|
180
|
+
# Use `:tagging` or {#tagging} to add tags to the uploaded object. Pass
|
|
181
|
+
# the same structure as the `:tagging` parameter of
|
|
182
|
+
# {Client#put_object_tagging}. The SDK serializes it to XML and adds
|
|
183
|
+
# an exact-match condition to the POST policy.
|
|
184
|
+
#
|
|
185
|
+
# ```ruby
|
|
186
|
+
# post = bucket.presigned_post(
|
|
187
|
+
# key: 'object-key',
|
|
188
|
+
# tagging: { tag_set: [{ key: 'project', value: 'example' }] }
|
|
189
|
+
# )
|
|
190
|
+
#
|
|
191
|
+
# # Or set tags on an existing presigned post:
|
|
192
|
+
# post = bucket.presigned_post(key: 'object-key')
|
|
193
|
+
# post.tagging(tag_set: [{ key: 'project', value: 'example' }])
|
|
194
|
+
# ```
|
|
195
|
+
#
|
|
196
|
+
# Include `post.fields['tagging']` unchanged in the submitted form.
|
|
197
|
+
# When rendering it as an HTML input value, HTML-escape it just like
|
|
198
|
+
# the other form fields.
|
|
199
|
+
#
|
|
178
200
|
class PresignedPost
|
|
179
201
|
@@allowed_fields = []
|
|
180
202
|
|
|
@@ -240,6 +262,8 @@ module Aws
|
|
|
240
262
|
# See {PresignedPost#server_side_encryption_customer_key}.
|
|
241
263
|
# @option options [String] :server_side_encryption_customer_key_starts_with
|
|
242
264
|
# See {PresignedPost#server_side_encryption_customer_key_starts_with}.
|
|
265
|
+
# @option options [Hash, Types::Tagging] :tagging
|
|
266
|
+
# See {PresignedPost#tagging}.
|
|
243
267
|
def initialize(credentials, bucket_region, bucket_name, options = {})
|
|
244
268
|
@credentials = credentials.credentials
|
|
245
269
|
@bucket_region = bucket_region
|
|
@@ -605,6 +629,31 @@ module Aws
|
|
|
605
629
|
|
|
606
630
|
# @!endgroup
|
|
607
631
|
|
|
632
|
+
# @!group Object Tagging
|
|
633
|
+
|
|
634
|
+
# @!method tagging(value)
|
|
635
|
+
# Tags to store with the uploaded object. Accepts the same structure
|
|
636
|
+
# as the `:tagging` parameter of {Client#put_object_tagging}, containing
|
|
637
|
+
# a required `:tag_set` array of tags with `:key` and `:value` strings.
|
|
638
|
+
# Serializes the tags to XML and requires an exact match in the POST
|
|
639
|
+
# policy. The `${filename}` variable is not supported in tags.
|
|
640
|
+
#
|
|
641
|
+
# @example
|
|
642
|
+
# post.tagging(tag_set: [{ key: 'project', value: 'example' }])
|
|
643
|
+
#
|
|
644
|
+
# @param [Hash, Types::Tagging] value
|
|
645
|
+
# @raise [ArgumentError] If the tagging parameters are invalid.
|
|
646
|
+
# @see Client#put_object_tagging
|
|
647
|
+
# @return [self]
|
|
648
|
+
define_field(:tagging) do |value|
|
|
649
|
+
rules = Client.api.operation(:put_object_tagging).input.shape.member(:tagging)
|
|
650
|
+
value = Aws::ParamConverter.convert(rules, value)
|
|
651
|
+
Aws::ParamValidator.validate!(rules, value)
|
|
652
|
+
with('tagging', Aws::Xml::Builder.new(rules).serialize(value))
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
# @!endgroup
|
|
656
|
+
|
|
608
657
|
private
|
|
609
658
|
|
|
610
659
|
def with(field_name, value)
|