@@ -127,6 +127,26 @@ final class CompleteMultipartUploadRequest extends Input
127127 */
128128 private $ expectedBucketOwner ;
129129
130+ /**
131+ * Uploads the object only if the ETag (entity tag) value provided during the WRITE operation matches the ETag of the
132+ * object in S3. If the ETag values do not match, the operation returns a `412 Precondition Failed` error.
133+ *
134+ * If a conflicting operation occurs during the upload S3 returns a `409 ConditionalRequestConflict` response. On a 409
135+ * failure you should fetch the object's ETag, re-initiate the multipart upload with `CreateMultipartUpload`, and
136+ * re-upload each part.
137+ *
138+ * Expects the ETag value as a string.
139+ *
140+ * For more information about conditional requests, see RFC 7232 [^1], or Conditional requests [^2] in the *Amazon S3
141+ * User Guide*.
142+ *
143+ * [^1]: https://tools.ietf.org/html/rfc7232
144+ * [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
145+ *
146+ * @var string|null
147+ */
148+ private $ ifMatch ;
149+
130150 /**
131151 * Uploads the object only if the object key name does not already exist in the bucket specified. Otherwise, Amazon S3
132152 * returns a `412 Precondition Failed` error.
@@ -197,6 +217,7 @@ final class CompleteMultipartUploadRequest extends Input
197217 * ChecksumSHA256?: null|string,
198218 * RequestPayer?: null|RequestPayer::*,
199219 * ExpectedBucketOwner?: null|string,
220+ * IfMatch?: null|string,
200221 * IfNoneMatch?: null|string,
201222 * SSECustomerAlgorithm?: null|string,
202223 * SSECustomerKey?: null|string,
@@ -216,6 +237,7 @@ public function __construct(array $input = [])
216237 $ this ->checksumSha256 = $ input ['ChecksumSHA256 ' ] ?? null ;
217238 $ this ->requestPayer = $ input ['RequestPayer ' ] ?? null ;
218239 $ this ->expectedBucketOwner = $ input ['ExpectedBucketOwner ' ] ?? null ;
240+ $ this ->ifMatch = $ input ['IfMatch ' ] ?? null ;
219241 $ this ->ifNoneMatch = $ input ['IfNoneMatch ' ] ?? null ;
220242 $ this ->sseCustomerAlgorithm = $ input ['SSECustomerAlgorithm ' ] ?? null ;
221243 $ this ->sseCustomerKey = $ input ['SSECustomerKey ' ] ?? null ;
@@ -235,6 +257,7 @@ public function __construct(array $input = [])
235257 * ChecksumSHA256?: null|string,
236258 * RequestPayer?: null|RequestPayer::*,
237259 * ExpectedBucketOwner?: null|string,
260+ * IfMatch?: null|string,
238261 * IfNoneMatch?: null|string,
239262 * SSECustomerAlgorithm?: null|string,
240263 * SSECustomerKey?: null|string,
@@ -277,6 +300,11 @@ public function getExpectedBucketOwner(): ?string
277300 return $ this ->expectedBucketOwner ;
278301 }
279302
303+ public function getIfMatch (): ?string
304+ {
305+ return $ this ->ifMatch ;
306+ }
307+
280308 public function getIfNoneMatch (): ?string
281309 {
282310 return $ this ->ifNoneMatch ;
@@ -348,6 +376,9 @@ public function request(): Request
348376 if (null !== $ this ->expectedBucketOwner ) {
349377 $ headers ['x-amz-expected-bucket-owner ' ] = $ this ->expectedBucketOwner ;
350378 }
379+ if (null !== $ this ->ifMatch ) {
380+ $ headers ['If-Match ' ] = $ this ->ifMatch ;
381+ }
351382 if (null !== $ this ->ifNoneMatch ) {
352383 $ headers ['If-None-Match ' ] = $ this ->ifNoneMatch ;
353384 }
@@ -433,6 +464,13 @@ public function setExpectedBucketOwner(?string $value): self
433464 return $ this ;
434465 }
435466
467+ public function setIfMatch (?string $ value ): self
468+ {
469+ $ this ->ifMatch = $ value ;
470+
471+ return $ this ;
472+ }
473+
436474 public function setIfNoneMatch (?string $ value ): self
437475 {
438476 $ this ->ifNoneMatch = $ value ;
0 commit comments