@@ -304,6 +304,37 @@ final class CopyObjectRequest extends Input
304304 */
305305 private $ grantWriteAcp ;
306306
307+ /**
308+ * Copies the object if the entity tag (ETag) of the destination object matches the specified tag. If the ETag values do
309+ * not match, the operation returns a `412 Precondition Failed` error. If a concurrent operation occurs during the
310+ * upload S3 returns a `409 ConditionalRequestConflict` response. On a 409 failure you should fetch the object's ETag
311+ * and retry the upload.
312+ *
313+ * Expects the ETag value as a string.
314+ *
315+ * For more information about conditional requests, see RFC 7232 [^1].
316+ *
317+ * [^1]: https://tools.ietf.org/html/rfc7232
318+ *
319+ * @var string|null
320+ */
321+ private $ ifMatch ;
322+
323+ /**
324+ * Copies the object only if the object key name at the destination does not already exist in the bucket specified.
325+ * Otherwise, Amazon S3 returns a `412 Precondition Failed` error. If a concurrent operation occurs during the upload S3
326+ * returns a `409 ConditionalRequestConflict` response. On a 409 failure you should retry the upload.
327+ *
328+ * Expects the '*' (asterisk) character.
329+ *
330+ * For more information about conditional requests, see RFC 7232 [^1].
331+ *
332+ * [^1]: https://tools.ietf.org/html/rfc7232
333+ *
334+ * @var string|null
335+ */
336+ private $ ifNoneMatch ;
337+
307338 /**
308339 * The key of the destination object.
309340 *
@@ -718,6 +749,8 @@ final class CopyObjectRequest extends Input
718749 * GrantRead?: string|null,
719750 * GrantReadACP?: string|null,
720751 * GrantWriteACP?: string|null,
752+ * IfMatch?: string|null,
753+ * IfNoneMatch?: string|null,
721754 * Key?: string,
722755 * Metadata?: array<string, string>|null,
723756 * MetadataDirective?: MetadataDirective::*|null,
@@ -764,6 +797,8 @@ public function __construct(array $input = [])
764797 $ this ->grantRead = $ input ['GrantRead ' ] ?? null ;
765798 $ this ->grantReadAcp = $ input ['GrantReadACP ' ] ?? null ;
766799 $ this ->grantWriteAcp = $ input ['GrantWriteACP ' ] ?? null ;
800+ $ this ->ifMatch = $ input ['IfMatch ' ] ?? null ;
801+ $ this ->ifNoneMatch = $ input ['IfNoneMatch ' ] ?? null ;
767802 $ this ->key = $ input ['Key ' ] ?? null ;
768803 $ this ->metadata = $ input ['Metadata ' ] ?? null ;
769804 $ this ->metadataDirective = $ input ['MetadataDirective ' ] ?? null ;
@@ -810,6 +845,8 @@ public function __construct(array $input = [])
810845 * GrantRead?: string|null,
811846 * GrantReadACP?: string|null,
812847 * GrantWriteACP?: string|null,
848+ * IfMatch?: string|null,
849+ * IfNoneMatch?: string|null,
813850 * Key?: string,
814851 * Metadata?: array<string, string>|null,
815852 * MetadataDirective?: MetadataDirective::*|null,
@@ -967,6 +1004,16 @@ public function getGrantWriteAcp(): ?string
9671004 return $ this ->grantWriteAcp ;
9681005 }
9691006
1007+ public function getIfMatch (): ?string
1008+ {
1009+ return $ this ->ifMatch ;
1010+ }
1011+
1012+ public function getIfNoneMatch (): ?string
1013+ {
1014+ return $ this ->ifNoneMatch ;
1015+ }
1016+
9701017 public function getKey (): ?string
9711018 {
9721019 return $ this ->key ;
@@ -1141,6 +1188,12 @@ public function request(): Request
11411188 if (null !== $ this ->grantWriteAcp ) {
11421189 $ headers ['x-amz-grant-write-acp ' ] = $ this ->grantWriteAcp ;
11431190 }
1191+ if (null !== $ this ->ifMatch ) {
1192+ $ headers ['If-Match ' ] = $ this ->ifMatch ;
1193+ }
1194+ if (null !== $ this ->ifNoneMatch ) {
1195+ $ headers ['If-None-Match ' ] = $ this ->ifNoneMatch ;
1196+ }
11441197 if (null !== $ this ->metadataDirective ) {
11451198 if (!MetadataDirective::exists ($ this ->metadataDirective )) {
11461199 throw new InvalidArgument (\sprintf ('Invalid parameter "MetadataDirective" for "%s". The value "%s" is not a valid "MetadataDirective". ' , __CLASS__ , $ this ->metadataDirective ));
@@ -1427,6 +1480,20 @@ public function setGrantWriteAcp(?string $value): self
14271480 return $ this ;
14281481 }
14291482
1483+ public function setIfMatch (?string $ value ): self
1484+ {
1485+ $ this ->ifMatch = $ value ;
1486+
1487+ return $ this ;
1488+ }
1489+
1490+ public function setIfNoneMatch (?string $ value ): self
1491+ {
1492+ $ this ->ifNoneMatch = $ value ;
1493+
1494+ return $ this ;
1495+ }
1496+
14301497 public function setKey (?string $ value ): self
14311498 {
14321499 $ this ->key = $ value ;
0 commit comments