aws-sdk-s3 1.119.2 → 1.158.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +263 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-sdk-s3/access_grants_credentials.rb +57 -0
  5. data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +250 -0
  6. data/lib/aws-sdk-s3/bucket.rb +573 -133
  7. data/lib/aws-sdk-s3/bucket_acl.rb +18 -12
  8. data/lib/aws-sdk-s3/bucket_cors.rb +24 -16
  9. data/lib/aws-sdk-s3/bucket_lifecycle.rb +24 -16
  10. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +24 -16
  11. data/lib/aws-sdk-s3/bucket_logging.rb +25 -12
  12. data/lib/aws-sdk-s3/bucket_notification.rb +12 -6
  13. data/lib/aws-sdk-s3/bucket_policy.rb +70 -18
  14. data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
  15. data/lib/aws-sdk-s3/bucket_request_payment.rb +18 -12
  16. data/lib/aws-sdk-s3/bucket_tagging.rb +24 -16
  17. data/lib/aws-sdk-s3/bucket_versioning.rb +42 -32
  18. data/lib/aws-sdk-s3/bucket_website.rb +24 -16
  19. data/lib/aws-sdk-s3/client.rb +6866 -3226
  20. data/lib/aws-sdk-s3/client_api.rb +162 -21
  21. data/lib/aws-sdk-s3/customizations/bucket.rb +3 -1
  22. data/lib/aws-sdk-s3/customizations/errors.rb +16 -3
  23. data/lib/aws-sdk-s3/customizations/object.rb +91 -18
  24. data/lib/aws-sdk-s3/customizations.rb +8 -0
  25. data/lib/aws-sdk-s3/encryption/client.rb +6 -2
  26. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
  27. data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
  28. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
  29. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
  30. data/lib/aws-sdk-s3/endpoint_parameters.rb +44 -0
  31. data/lib/aws-sdk-s3/endpoint_provider.rb +186 -327
  32. data/lib/aws-sdk-s3/endpoints.rb +540 -0
  33. data/lib/aws-sdk-s3/express_credentials.rb +55 -0
  34. data/lib/aws-sdk-s3/express_credentials_provider.rb +59 -0
  35. data/lib/aws-sdk-s3/file_downloader.rb +169 -44
  36. data/lib/aws-sdk-s3/file_uploader.rb +8 -6
  37. data/lib/aws-sdk-s3/multipart_file_uploader.rb +4 -4
  38. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +10 -7
  39. data/lib/aws-sdk-s3/multipart_upload.rb +81 -20
  40. data/lib/aws-sdk-s3/multipart_upload_part.rb +169 -38
  41. data/lib/aws-sdk-s3/object.rb +1590 -275
  42. data/lib/aws-sdk-s3/object_acl.rb +38 -18
  43. data/lib/aws-sdk-s3/object_copier.rb +7 -5
  44. data/lib/aws-sdk-s3/object_multipart_copier.rb +42 -24
  45. data/lib/aws-sdk-s3/object_summary.rb +1437 -285
  46. data/lib/aws-sdk-s3/object_version.rb +350 -51
  47. data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
  48. data/lib/aws-sdk-s3/plugins/endpoints.rb +14 -2
  49. data/lib/aws-sdk-s3/plugins/express_session_auth.rb +97 -0
  50. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +53 -16
  51. data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
  52. data/lib/aws-sdk-s3/plugins/md5s.rb +2 -1
  53. data/lib/aws-sdk-s3/plugins/s3_signer.rb +20 -13
  54. data/lib/aws-sdk-s3/presigned_post.rb +52 -43
  55. data/lib/aws-sdk-s3/presigner.rb +8 -4
  56. data/lib/aws-sdk-s3/resource.rb +99 -21
  57. data/lib/aws-sdk-s3/types.rb +5285 -1632
  58. data/lib/aws-sdk-s3.rb +1 -1
  59. data/sig/bucket.rbs +212 -0
  60. data/sig/bucket_acl.rbs +78 -0
  61. data/sig/bucket_cors.rbs +69 -0
  62. data/sig/bucket_lifecycle.rbs +88 -0
  63. data/sig/bucket_lifecycle_configuration.rbs +111 -0
  64. data/sig/bucket_logging.rbs +76 -0
  65. data/sig/bucket_notification.rbs +114 -0
  66. data/sig/bucket_policy.rbs +59 -0
  67. data/sig/bucket_request_payment.rbs +54 -0
  68. data/sig/bucket_tagging.rbs +65 -0
  69. data/sig/bucket_versioning.rbs +77 -0
  70. data/sig/bucket_website.rbs +93 -0
  71. data/sig/client.rbs +2385 -0
  72. data/sig/customizations/bucket.rbs +19 -0
  73. data/sig/customizations/object.rbs +38 -0
  74. data/sig/customizations/object_summary.rbs +35 -0
  75. data/sig/errors.rbs +34 -0
  76. data/sig/multipart_upload.rbs +110 -0
  77. data/sig/multipart_upload_part.rbs +105 -0
  78. data/sig/object.rbs +442 -0
  79. data/sig/object_acl.rbs +86 -0
  80. data/sig/object_summary.rbs +334 -0
  81. data/sig/object_version.rbs +137 -0
  82. data/sig/resource.rbs +128 -0
  83. data/sig/types.rbs +2575 -0
  84. data/sig/waiters.rbs +95 -0
  85. metadata +43 -11
@@ -49,7 +49,8 @@ module Aws
49
49
  # before the presigned URL expires. Defaults to 15 minutes. As signature
50
50
  # version 4 has a maximum expiry time of one week for presigned URLs,
51
51
  # attempts to set this value to greater than one week (604800) will
52
- # raise an exception.
52
+ # raise an exception. The min value of this option and the credentials
53
+ # expiration time is used in the presigned URL.
53
54
  #
54
55
  # @option params [Time] :time (Time.now) The starting time for when the
55
56
  # presigned url becomes active.
@@ -96,7 +97,8 @@ module Aws
96
97
  # before the presigned URL expires. Defaults to 15 minutes. As signature
97
98
  # version 4 has a maximum expiry time of one week for presigned URLs,
98
99
  # attempts to set this value to greater than one week (604800) will
99
- # raise an exception.
100
+ # raise an exception. The min value of this option and the credentials
101
+ # expiration time is used in the presigned URL.
100
102
  #
101
103
  # @option params [Time] :time (Time.now) The starting time for when the
102
104
  # presigned url becomes active.
@@ -197,6 +199,8 @@ module Aws
197
199
  req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
198
200
  req.handlers.remove(Aws::Plugins::Sign::Handler)
199
201
  req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
202
+ req.handlers.remove(Aws::Rest::ContentTypeHandler)
203
+ req.handlers.remove(Aws::Plugins::InvocationId::Handler)
200
204
 
201
205
  req.handle(step: :send) do |context|
202
206
  # if an endpoint was not provided, force secure or insecure
@@ -230,8 +234,8 @@ module Aws
230
234
  end
231
235
  signer = Aws::Sigv4::Signer.new(
232
236
  service: auth_scheme['signingName'] || 's3',
233
- region: region || context.config.region,
234
- credentials_provider: context.config.credentials,
237
+ region: context[:sigv4_region] || region || context.config.region,
238
+ credentials_provider: context[:sigv4_credentials] || context.config.credentials,
235
239
  signing_algorithm: scheme_name.to_sym,
236
240
  uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
237
241
  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,47 +62,113 @@ 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-az1--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*.
88
158
  #
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.
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
+ #
165
+ #
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
- @client.create_bucket(options)
169
+ Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
170
+ @client.create_bucket(options)
171
+ end
98
172
  Bucket.new(
99
173
  name: options[:bucket],
100
174
  client: @client
@@ -119,16 +193,20 @@ module Aws::S3
119
193
  # @return [Bucket::Collection]
120
194
  def buckets(options = {})
121
195
  batches = Enumerator.new do |y|
122
- batch = []
123
- resp = @client.list_buckets(options)
124
- resp.data.buckets.each do |b|
125
- batch << Bucket.new(
126
- name: b.name,
127
- data: b,
128
- client: @client
129
- )
196
+ resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
197
+ @client.list_buckets(options)
198
+ end
199
+ resp.each_page do |page|
200
+ batch = []
201
+ page.data.buckets.each do |b|
202
+ batch << Bucket.new(
203
+ name: b.name,
204
+ data: b,
205
+ client: @client
206
+ )
207
+ end
208
+ y.yield(batch)
130
209
  end
131
- y.yield(batch)
132
210
  end
133
211
  Bucket::Collection.new(batches)
134
212
  end