aws-sdk-s3 1.127.0 → 1.141.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/bucket.rb +421 -81
  5. data/lib/aws-sdk-s3/bucket_acl.rb +9 -9
  6. data/lib/aws-sdk-s3/bucket_cors.rb +12 -12
  7. data/lib/aws-sdk-s3/bucket_lifecycle.rb +12 -12
  8. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +12 -12
  9. data/lib/aws-sdk-s3/bucket_logging.rb +16 -9
  10. data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
  11. data/lib/aws-sdk-s3/bucket_policy.rb +58 -14
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +9 -9
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +12 -12
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +27 -27
  15. data/lib/aws-sdk-s3/bucket_website.rb +12 -12
  16. data/lib/aws-sdk-s3/client.rb +5707 -2536
  17. data/lib/aws-sdk-s3/client_api.rb +111 -16
  18. data/lib/aws-sdk-s3/customizations/errors.rb +1 -1
  19. data/lib/aws-sdk-s3/customizations/object.rb +63 -0
  20. data/lib/aws-sdk-s3/customizations.rb +5 -0
  21. data/lib/aws-sdk-s3/endpoint_parameters.rb +36 -0
  22. data/lib/aws-sdk-s3/endpoint_provider.rb +104 -246
  23. data/lib/aws-sdk-s3/endpoints.rb +440 -0
  24. data/lib/aws-sdk-s3/express_credentials.rb +55 -0
  25. data/lib/aws-sdk-s3/express_credentials_cache.rb +30 -0
  26. data/lib/aws-sdk-s3/express_credentials_provider.rb +36 -0
  27. data/lib/aws-sdk-s3/file_downloader.rb +142 -21
  28. data/lib/aws-sdk-s3/multipart_file_uploader.rb +0 -1
  29. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +0 -1
  30. data/lib/aws-sdk-s3/multipart_upload.rb +69 -16
  31. data/lib/aws-sdk-s3/multipart_upload_part.rb +160 -35
  32. data/lib/aws-sdk-s3/object.rb +1504 -235
  33. data/lib/aws-sdk-s3/object_acl.rb +29 -15
  34. data/lib/aws-sdk-s3/object_multipart_copier.rb +33 -17
  35. data/lib/aws-sdk-s3/object_summary.rb +1367 -254
  36. data/lib/aws-sdk-s3/object_version.rb +297 -42
  37. data/lib/aws-sdk-s3/plugins/endpoints.rb +13 -2
  38. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +90 -0
  39. data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
  40. data/lib/aws-sdk-s3/plugins/md5s.rb +2 -1
  41. data/lib/aws-sdk-s3/presigned_post.rb +52 -43
  42. data/lib/aws-sdk-s3/presigner.rb +2 -2
  43. data/lib/aws-sdk-s3/resource.rb +83 -11
  44. data/lib/aws-sdk-s3/types.rb +4500 -1351
  45. data/lib/aws-sdk-s3.rb +1 -1
  46. metadata +11 -7
@@ -315,26 +315,28 @@ module Aws
315
315
 
316
316
  # @!group Fields
317
317
 
318
- # The key to use for the uploaded object. You can use `${filename}`
319
- # as a variable in the key. This will be replaced with the name
320
- # of the file as provided by the user.
318
+ # @!method key(key)
319
+ # The key to use for the uploaded object. You can use `${filename}`
320
+ # as a variable in the key. This will be replaced with the name
321
+ # of the file as provided by the user.
321
322
  #
322
- # For example, if the key is given as `/user/betty/${filename}` and
323
- # the file uploaded is named `lolcatz.jpg`, the resultant key will
324
- # be `/user/betty/lolcatz.jpg`.
323
+ # For example, if the key is given as `/user/betty/${filename}` and
324
+ # the file uploaded is named `lolcatz.jpg`, the resultant key will
325
+ # be `/user/betty/lolcatz.jpg`.
325
326
  #
326
- # @param [String] key
327
- # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)
328
- # @return [self]
327
+ # @param [String] key
328
+ # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)
329
+ # @return [self]
329
330
  define_field(:key) do |key|
330
331
  @key_set = true
331
332
  with('key', key)
332
333
  end
333
334
 
334
- # Specify a prefix the uploaded
335
- # @param [String] prefix
336
- # @see #key
337
- # @return [self]
335
+ # @!method key_starts_with(prefix)
336
+ # Specify a prefix the uploaded
337
+ # @param [String] prefix
338
+ # @see #key
339
+ # @return [self]
338
340
  define_field(:key_starts_with) do |prefix|
339
341
  @key_set = true
340
342
  starts_with('key', prefix)
@@ -412,26 +414,29 @@ module Aws
412
414
  # @return [self]
413
415
  define_field(:content_encoding, 'Content-Encoding', starts_with: true)
414
416
 
415
- # The date and time at which the object is no longer cacheable.
416
- # @note This does not affect the expiration of the presigned post
417
- # signature.
418
- # @param [Time] time
419
- # @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
420
- # @return [self]
417
+ # @!method expires(time)
418
+ # The date and time at which the object is no longer cacheable.
419
+ # @note This does not affect the expiration of the presigned post
420
+ # signature.
421
+ # @param [Time] time
422
+ # @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
423
+ # @return [self]
421
424
  define_field(:expires) do |time|
422
425
  with('Expires', time.httpdate)
423
426
  end
424
427
 
425
- # @param [String] prefix
426
- # @see #expires
427
- # @return [self]
428
+ # @!method expires_starts_with(prefix)
429
+ # @param [String] prefix
430
+ # @see #expires
431
+ # @return [self]
428
432
  define_field(:expires_starts_with) do |prefix|
429
433
  starts_with('Expires', prefix)
430
434
  end
431
435
 
432
- # The minimum and maximum allowable size for the uploaded content.
433
- # @param [Range<Integer>] byte_range
434
- # @return [self]
436
+ # @!method content_length_range(byte_range)
437
+ # The minimum and maximum allowable size for the uploaded content.
438
+ # @param [Range<Integer>] byte_range
439
+ # @return [self]
435
440
  define_field(:content_length_range) do |byte_range|
436
441
  min = byte_range.begin
437
442
  max = byte_range.end
@@ -507,10 +512,11 @@ module Aws
507
512
  # @return [self]
508
513
  define_field(:website_redirect_location, 'x-amz-website-redirect-location')
509
514
 
510
- # Metadata hash to store with the uploaded object. Hash keys will be
511
- # prefixed with "x-amz-meta-".
512
- # @param [Hash<String,String>] hash
513
- # @return [self]
515
+ # @!method metadata(hash)
516
+ # Metadata hash to store with the uploaded object. Hash keys will be
517
+ # prefixed with "x-amz-meta-".
518
+ # @param [Hash<String,String>] hash
519
+ # @return [self]
514
520
  define_field(:metadata) do |hash|
515
521
  hash.each do |key, value|
516
522
  with("x-amz-meta-#{key}", value)
@@ -518,10 +524,11 @@ module Aws
518
524
  self
519
525
  end
520
526
 
521
- # Specify allowable prefix for each key in the metadata hash.
522
- # @param [Hash<String,String>] hash
523
- # @see #metadata
524
- # @return [self]
527
+ # @!method metadata_starts_with(hash)
528
+ # Specify allowable prefix for each key in the metadata hash.
529
+ # @param [Hash<String,String>] hash
530
+ # @see #metadata
531
+ # @return [self]
525
532
  define_field(:metadata_starts_with) do |hash|
526
533
  hash.each do |key, value|
527
534
  starts_with("x-amz-meta-#{key}", value)
@@ -571,24 +578,26 @@ module Aws
571
578
  'x-amz-server-side-encryption-customer-algorithm'
572
579
  )
573
580
 
574
- # Specifies the customer-provided encryption key for Amazon S3 to use
575
- # in encrypting data. This value is used to store the object and then
576
- # it is discarded; Amazon does not store the encryption key.
581
+ # @!method server_side_encryption_customer_key(value)
582
+ # Specifies the customer-provided encryption key for Amazon S3 to use
583
+ # in encrypting data. This value is used to store the object and then
584
+ # it is discarded; Amazon does not store the encryption key.
577
585
  #
578
- # You must also call {#server_side_encryption_customer_algorithm}.
586
+ # You must also call {#server_side_encryption_customer_algorithm}.
579
587
  #
580
- # @param [String] value
581
- # @see #server_side_encryption_customer_algorithm
582
- # @return [self]
588
+ # @param [String] value
589
+ # @see #server_side_encryption_customer_algorithm
590
+ # @return [self]
583
591
  define_field(:server_side_encryption_customer_key) do |value|
584
592
  field_name = 'x-amz-server-side-encryption-customer-key'
585
593
  with(field_name, base64(value))
586
594
  with(field_name + '-MD5', base64(OpenSSL::Digest::MD5.digest(value)))
587
595
  end
588
596
 
589
- # @param [String] prefix
590
- # @see #server_side_encryption_customer_key
591
- # @return [self]
597
+ # @!method server_side_encryption_customer_key_starts_with(prefix)
598
+ # @param [String] prefix
599
+ # @see #server_side_encryption_customer_key
600
+ # @return [self]
592
601
  define_field(:server_side_encryption_customer_key_starts_with) do |prefix|
593
602
  field_name = 'x-amz-server-side-encryption-customer-key'
594
603
  starts_with(field_name, prefix)
@@ -232,8 +232,8 @@ module Aws
232
232
  end
233
233
  signer = Aws::Sigv4::Signer.new(
234
234
  service: auth_scheme['signingName'] || 's3',
235
- region: region || context.config.region,
236
- credentials_provider: context.config.credentials,
235
+ region: context[:sigv4_region] || region || context.config.region,
236
+ credentials_provider: context[:sigv4_credentials] || context.config.credentials,
237
237
  signing_algorithm: scheme_name.to_sym,
238
238
  uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
239
239
  unsigned_headers: unsigned_headers,
@@ -41,7 +41,15 @@ module Aws::S3
41
41
  # acl: "private", # accepts private, public-read, public-read-write, authenticated-read
42
42
  # bucket: "BucketName", # required
43
43
  # create_bucket_configuration: {
44
- # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
44
+ # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-south-2, ap-southeast-1, ap-southeast-2, ap-southeast-3, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
45
+ # location: {
46
+ # type: "AvailabilityZone", # accepts AvailabilityZone
47
+ # name: "LocationNameAsString",
48
+ # },
49
+ # bucket: {
50
+ # data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone
51
+ # type: "Directory", # accepts Directory
52
+ # },
45
53
  # },
46
54
  # grant_full_control: "GrantFullControl",
47
55
  # grant_read: "GrantRead",
@@ -54,44 +62,108 @@ module Aws::S3
54
62
  # @param [Hash] options ({})
55
63
  # @option options [String] :acl
56
64
  # The canned ACL to apply to the bucket.
65
+ #
66
+ # <note markdown="1"> This functionality is not supported for directory buckets.
67
+ #
68
+ # </note>
57
69
  # @option options [required, String] :bucket
58
70
  # The name of the bucket to create.
71
+ #
72
+ # **General purpose buckets** - For information about bucket naming
73
+ # restrictions, see [Bucket naming rules][1] in the *Amazon S3 User
74
+ # Guide*.
75
+ #
76
+ # <b>Directory buckets </b> - When you use this operation with a
77
+ # directory bucket, you must use path-style requests in the format
78
+ # `https://s3express-control.region_code.amazonaws.com/bucket-name `.
79
+ # Virtual-hosted-style requests aren't supported. Directory bucket
80
+ # names must be unique in the chosen Availability Zone. Bucket names
81
+ # must also follow the format ` bucket_base_name--az_id--x-s3` (for
82
+ # example, ` DOC-EXAMPLE-BUCKET--usw2-az2--x-s3`). For information about
83
+ # bucket naming restrictions, see [Directory bucket naming rules][2] in
84
+ # the *Amazon S3 User Guide*
85
+ #
86
+ #
87
+ #
88
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
89
+ # [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html
59
90
  # @option options [Types::CreateBucketConfiguration] :create_bucket_configuration
60
91
  # The configuration information for the bucket.
61
92
  # @option options [String] :grant_full_control
62
93
  # Allows grantee the read, write, read ACP, and write ACP permissions on
63
94
  # the bucket.
95
+ #
96
+ # <note markdown="1"> This functionality is not supported for directory buckets.
97
+ #
98
+ # </note>
64
99
  # @option options [String] :grant_read
65
100
  # Allows grantee to list the objects in the bucket.
101
+ #
102
+ # <note markdown="1"> This functionality is not supported for directory buckets.
103
+ #
104
+ # </note>
66
105
  # @option options [String] :grant_read_acp
67
106
  # Allows grantee to read the bucket ACL.
107
+ #
108
+ # <note markdown="1"> This functionality is not supported for directory buckets.
109
+ #
110
+ # </note>
68
111
  # @option options [String] :grant_write
69
112
  # Allows grantee to create new objects in the bucket.
70
113
  #
71
114
  # For the bucket and object owners of existing objects, also allows
72
115
  # deletions and overwrites of those objects.
116
+ #
117
+ # <note markdown="1"> This functionality is not supported for directory buckets.
118
+ #
119
+ # </note>
73
120
  # @option options [String] :grant_write_acp
74
121
  # Allows grantee to write the ACL for the applicable bucket.
122
+ #
123
+ # <note markdown="1"> This functionality is not supported for directory buckets.
124
+ #
125
+ # </note>
75
126
  # @option options [Boolean] :object_lock_enabled_for_bucket
76
127
  # Specifies whether you want S3 Object Lock to be enabled for the new
77
128
  # bucket.
129
+ #
130
+ # <note markdown="1"> This functionality is not supported for directory buckets.
131
+ #
132
+ # </note>
78
133
  # @option options [String] :object_ownership
79
134
  # The container element for object ownership for a bucket's ownership
80
135
  # controls.
81
136
  #
82
- # BucketOwnerPreferred - Objects uploaded to the bucket change ownership
83
- # to the bucket owner if the objects are uploaded with the
137
+ # `BucketOwnerPreferred` - Objects uploaded to the bucket change
138
+ # ownership to the bucket owner if the objects are uploaded with the
84
139
  # `bucket-owner-full-control` canned ACL.
85
140
  #
86
- # ObjectWriter - The uploading account will own the object if the object
87
- # is uploaded with the `bucket-owner-full-control` canned ACL.
141
+ # `ObjectWriter` - The uploading account will own the object if the
142
+ # object is uploaded with the `bucket-owner-full-control` canned ACL.
143
+ #
144
+ # `BucketOwnerEnforced` - Access control lists (ACLs) are disabled and
145
+ # no longer affect permissions. The bucket owner automatically owns and
146
+ # has full control over every object in the bucket. The bucket only
147
+ # accepts PUT requests that don't specify an ACL or specify bucket
148
+ # owner full control ACLs (such as the predefined
149
+ # `bucket-owner-full-control` canned ACL or a custom ACL in XML format
150
+ # that grants the same permissions).
151
+ #
152
+ # By default, `ObjectOwnership` is set to `BucketOwnerEnforced` and ACLs
153
+ # are disabled. We recommend keeping ACLs disabled, except in uncommon
154
+ # use cases where you must control access for each object individually.
155
+ # For more information about S3 Object Ownership, see [Controlling
156
+ # ownership of objects and disabling ACLs for your bucket][1] in the
157
+ # *Amazon S3 User Guide*.
158
+ #
159
+ # <note markdown="1"> This functionality is not supported for directory buckets. Directory
160
+ # buckets use the bucket owner enforced setting for S3 Object Ownership.
161
+ #
162
+ # </note>
163
+ #
164
+ #
88
165
  #
89
- # BucketOwnerEnforced - Access control lists (ACLs) are disabled and no
90
- # longer affect permissions. The bucket owner automatically owns and has
91
- # full control over every object in the bucket. The bucket only accepts
92
- # PUT requests that don't specify an ACL or bucket owner full control
93
- # ACLs, such as the `bucket-owner-full-control` canned ACL or an
94
- # equivalent form of this ACL expressed in the XML format.
166
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
95
167
  # @return [Bucket]
96
168
  def create_bucket(options = {})
97
169
  Aws::Plugins::UserAgent.feature('resource') do