diff --git a/manifest.json b/manifest.json index 9f05b5787..0e58e12f2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "variables": { - "${LATEST}": "3.394.8" + "${LATEST}": "3.394.10" }, "endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json", "services": { diff --git a/src/Service/S3/CHANGELOG.md b/src/Service/S3/CHANGELOG.md index c23fe0239..97f2fa35c 100644 --- a/src/Service/S3/CHANGELOG.md +++ b/src/Service/S3/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - AWS api-change: AWS Backup now lets you create read-only access points for Amazon S3 recovery points, enabling you to access backup data using S3 APIs without initiating a restore. +- AWS api-change: Adds support for Amazon S3 Object Lock variable retention. Existing S3 APIs that support S3 Object Lock parameters now support two new parameters EventHold and EventHoldDuration at the object level, and DefaultEventHoldDuration at the bucket level. ## 3.4.1 diff --git a/src/Service/S3/src/Enum/Event.php b/src/Service/S3/src/Enum/Event.php index f1654c7b7..c07a15133 100644 --- a/src/Service/S3/src/Enum/Event.php +++ b/src/Service/S3/src/Enum/Event.php @@ -28,6 +28,7 @@ final class Event public const S3_OBJECT_RESTORE_COMPLETED = 's3:ObjectRestore:Completed'; public const S3_OBJECT_RESTORE_DELETE = 's3:ObjectRestore:Delete'; public const S3_OBJECT_RESTORE_POST = 's3:ObjectRestore:Post'; + public const S3_OBJECT_RETENTION_PUT = 's3:ObjectRetention:Put'; public const S3_OBJECT_TAGGING_ALL = 's3:ObjectTagging:*'; public const S3_OBJECT_TAGGING_DELETE = 's3:ObjectTagging:Delete'; public const S3_OBJECT_TAGGING_PUT = 's3:ObjectTagging:Put'; @@ -65,6 +66,7 @@ public static function exists(string $value): bool self::S3_OBJECT_RESTORE_COMPLETED => true, self::S3_OBJECT_RESTORE_DELETE => true, self::S3_OBJECT_RESTORE_POST => true, + self::S3_OBJECT_RETENTION_PUT => true, self::S3_OBJECT_TAGGING_ALL => true, self::S3_OBJECT_TAGGING_DELETE => true, self::S3_OBJECT_TAGGING_PUT => true, diff --git a/src/Service/S3/src/Enum/ObjectLockEventHold.php b/src/Service/S3/src/Enum/ObjectLockEventHold.php new file mode 100644 index 000000000..2acce4a1c --- /dev/null +++ b/src/Service/S3/src/Enum/ObjectLockEventHold.php @@ -0,0 +1,21 @@ + true, + self::ON => true, + ][$value]); + } +} diff --git a/src/Service/S3/src/Input/CopyObjectRequest.php b/src/Service/S3/src/Input/CopyObjectRequest.php index bd7e7eaae..efbb46b97 100644 --- a/src/Service/S3/src/Input/CopyObjectRequest.php +++ b/src/Service/S3/src/Input/CopyObjectRequest.php @@ -10,6 +10,7 @@ use AsyncAws\S3\Enum\ChecksumAlgorithm; use AsyncAws\S3\Enum\MetadataDirective; use AsyncAws\S3\Enum\ObjectCannedACL; +use AsyncAws\S3\Enum\ObjectLockEventHold; use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus; use AsyncAws\S3\Enum\ObjectLockMode; use AsyncAws\S3\Enum\RequestPayer; @@ -257,7 +258,7 @@ final class CopyObjectRequest extends Input /** * The date and time at which the object is no longer cacheable. * - * @var \DateTimeImmutable|null + * @var string|null */ private $expires; @@ -741,6 +742,33 @@ final class CopyObjectRequest extends Input */ private $objectLockLegalHoldStatus; + /** + * The event hold status to apply to the object copy. Set to `ON` to enable or `OFF` to disable. + * + * > This functionality is not supported for directory buckets. + * + * @var ObjectLockEventHold::*|null + */ + private $objectLockEventHold; + + /** + * The event hold duration in days to apply to the object copy. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationDays; + + /** + * The event hold duration in years to apply to the object copy. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationYears; + /** * The account ID of the expected destination bucket owner. If the account ID that you provide does not match the actual * owner of the destination bucket, the request fails with the HTTP status code `403 Forbidden` (access denied). @@ -772,7 +800,7 @@ final class CopyObjectRequest extends Input * CopySourceIfModifiedSince?: \DateTimeImmutable|string|null, * CopySourceIfNoneMatch?: string|null, * CopySourceIfUnmodifiedSince?: \DateTimeImmutable|string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * GrantFullControl?: string|null, * GrantRead?: string|null, * GrantReadACP?: string|null, @@ -801,6 +829,9 @@ final class CopyObjectRequest extends Input * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * ExpectedSourceBucketOwner?: string|null, * '@region'?: string|null, @@ -821,7 +852,7 @@ public function __construct(array $input = []) $this->copySourceIfModifiedSince = !isset($input['CopySourceIfModifiedSince']) ? null : ($input['CopySourceIfModifiedSince'] instanceof \DateTimeImmutable ? $input['CopySourceIfModifiedSince'] : new \DateTimeImmutable($input['CopySourceIfModifiedSince'])); $this->copySourceIfNoneMatch = $input['CopySourceIfNoneMatch'] ?? null; $this->copySourceIfUnmodifiedSince = !isset($input['CopySourceIfUnmodifiedSince']) ? null : ($input['CopySourceIfUnmodifiedSince'] instanceof \DateTimeImmutable ? $input['CopySourceIfUnmodifiedSince'] : new \DateTimeImmutable($input['CopySourceIfUnmodifiedSince'])); - $this->expires = !isset($input['Expires']) ? null : ($input['Expires'] instanceof \DateTimeImmutable ? $input['Expires'] : new \DateTimeImmutable($input['Expires'])); + $this->expires = $input['Expires'] ?? null; $this->grantFullControl = $input['GrantFullControl'] ?? null; $this->grantRead = $input['GrantRead'] ?? null; $this->grantReadAcp = $input['GrantReadACP'] ?? null; @@ -850,6 +881,9 @@ public function __construct(array $input = []) $this->objectLockMode = $input['ObjectLockMode'] ?? null; $this->objectLockRetainUntilDate = !isset($input['ObjectLockRetainUntilDate']) ? null : ($input['ObjectLockRetainUntilDate'] instanceof \DateTimeImmutable ? $input['ObjectLockRetainUntilDate'] : new \DateTimeImmutable($input['ObjectLockRetainUntilDate'])); $this->objectLockLegalHoldStatus = $input['ObjectLockLegalHoldStatus'] ?? null; + $this->objectLockEventHold = $input['ObjectLockEventHold'] ?? null; + $this->objectLockEventHoldDurationDays = $input['ObjectLockEventHoldDurationDays'] ?? null; + $this->objectLockEventHoldDurationYears = $input['ObjectLockEventHoldDurationYears'] ?? null; $this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null; $this->expectedSourceBucketOwner = $input['ExpectedSourceBucketOwner'] ?? null; parent::__construct($input); @@ -870,7 +904,7 @@ public function __construct(array $input = []) * CopySourceIfModifiedSince?: \DateTimeImmutable|string|null, * CopySourceIfNoneMatch?: string|null, * CopySourceIfUnmodifiedSince?: \DateTimeImmutable|string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * GrantFullControl?: string|null, * GrantRead?: string|null, * GrantReadACP?: string|null, @@ -899,6 +933,9 @@ public function __construct(array $input = []) * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * ExpectedSourceBucketOwner?: string|null, * '@region'?: string|null, @@ -1018,7 +1055,7 @@ public function getExpectedSourceBucketOwner(): ?string return $this->expectedSourceBucketOwner; } - public function getExpires(): ?\DateTimeImmutable + public function getExpires(): ?string { return $this->expires; } @@ -1074,6 +1111,24 @@ public function getMetadataDirective(): ?string return $this->metadataDirective; } + /** + * @return ObjectLockEventHold::*|null + */ + public function getObjectLockEventHold(): ?string + { + return $this->objectLockEventHold; + } + + public function getObjectLockEventHoldDurationDays(): ?int + { + return $this->objectLockEventHoldDurationDays; + } + + public function getObjectLockEventHoldDurationYears(): ?int + { + return $this->objectLockEventHoldDurationYears; + } + /** * @return ObjectLockLegalHoldStatus::*|null */ @@ -1215,7 +1270,7 @@ public function request(): Request $headers['x-amz-copy-source-if-unmodified-since'] = $this->copySourceIfUnmodifiedSince->setTimezone(new \DateTimeZone('GMT'))->format('D, d M Y H:i:s \G\M\T'); } if (null !== $this->expires) { - $headers['Expires'] = $this->expires->setTimezone(new \DateTimeZone('GMT'))->format('D, d M Y H:i:s \G\M\T'); + $headers['Expires'] = $this->expires; } if (null !== $this->grantFullControl) { $headers['x-amz-grant-full-control'] = $this->grantFullControl; @@ -1327,6 +1382,19 @@ public function request(): Request } $headers['x-amz-object-lock-legal-hold'] = $this->objectLockLegalHoldStatus; } + if (null !== $this->objectLockEventHold) { + if (!ObjectLockEventHold::exists($this->objectLockEventHold)) { + /** @psalm-suppress NoValue */ + throw new InvalidArgument(\sprintf('Invalid parameter "ObjectLockEventHold" for "%s". The value "%s" is not a valid "ObjectLockEventHold".', __CLASS__, $this->objectLockEventHold)); + } + $headers['x-amz-object-lock-event-hold'] = $this->objectLockEventHold; + } + if (null !== $this->objectLockEventHoldDurationDays) { + $headers['x-amz-object-lock-event-hold-duration-days'] = (string) $this->objectLockEventHoldDurationDays; + } + if (null !== $this->objectLockEventHoldDurationYears) { + $headers['x-amz-object-lock-event-hold-duration-years'] = (string) $this->objectLockEventHoldDurationYears; + } if (null !== $this->expectedBucketOwner) { $headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner; } @@ -1510,7 +1578,7 @@ public function setExpectedSourceBucketOwner(?string $value): self return $this; } - public function setExpires(?\DateTimeImmutable $value): self + public function setExpires(?string $value): self { $this->expires = $value; @@ -1586,6 +1654,30 @@ public function setMetadataDirective(?string $value): self return $this; } + /** + * @param ObjectLockEventHold::*|null $value + */ + public function setObjectLockEventHold(?string $value): self + { + $this->objectLockEventHold = $value; + + return $this; + } + + public function setObjectLockEventHoldDurationDays(?int $value): self + { + $this->objectLockEventHoldDurationDays = $value; + + return $this; + } + + public function setObjectLockEventHoldDurationYears(?int $value): self + { + $this->objectLockEventHoldDurationYears = $value; + + return $this; + } + /** * @param ObjectLockLegalHoldStatus::*|null $value */ diff --git a/src/Service/S3/src/Input/CreateMultipartUploadRequest.php b/src/Service/S3/src/Input/CreateMultipartUploadRequest.php index 4c5f2f48d..08fe21450 100644 --- a/src/Service/S3/src/Input/CreateMultipartUploadRequest.php +++ b/src/Service/S3/src/Input/CreateMultipartUploadRequest.php @@ -9,6 +9,7 @@ use AsyncAws\S3\Enum\ChecksumAlgorithm; use AsyncAws\S3\Enum\ChecksumType; use AsyncAws\S3\Enum\ObjectCannedACL; +use AsyncAws\S3\Enum\ObjectLockEventHold; use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus; use AsyncAws\S3\Enum\ObjectLockMode; use AsyncAws\S3\Enum\RequestPayer; @@ -116,7 +117,7 @@ final class CreateMultipartUploadRequest extends Input /** * The date and time at which the object is no longer cacheable. * - * @var \DateTimeImmutable|null + * @var string|null */ private $expires; @@ -515,6 +516,33 @@ final class CreateMultipartUploadRequest extends Input */ private $objectLockLegalHoldStatus; + /** + * Specifies the event hold status to apply to the uploaded object. Set to `ON` to enable or `OFF` to disable. + * + * > This functionality is not supported for directory buckets. + * + * @var ObjectLockEventHold::*|null + */ + private $objectLockEventHold; + + /** + * Specifies the event hold duration in days to apply to the uploaded object. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationDays; + + /** + * Specifies the event hold duration in years to apply to the uploaded object. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationYears; + /** * The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of * the bucket, the request fails with the HTTP status code `403 Forbidden` (access denied). @@ -552,7 +580,7 @@ final class CreateMultipartUploadRequest extends Input * ContentEncoding?: string|null, * ContentLanguage?: string|null, * ContentType?: string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * GrantFullControl?: string|null, * GrantRead?: string|null, * GrantReadACP?: string|null, @@ -573,6 +601,9 @@ final class CreateMultipartUploadRequest extends Input * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * ChecksumAlgorithm?: ChecksumAlgorithm::*|null, * ChecksumType?: ChecksumType::*|null, @@ -588,7 +619,7 @@ public function __construct(array $input = []) $this->contentEncoding = $input['ContentEncoding'] ?? null; $this->contentLanguage = $input['ContentLanguage'] ?? null; $this->contentType = $input['ContentType'] ?? null; - $this->expires = !isset($input['Expires']) ? null : ($input['Expires'] instanceof \DateTimeImmutable ? $input['Expires'] : new \DateTimeImmutable($input['Expires'])); + $this->expires = $input['Expires'] ?? null; $this->grantFullControl = $input['GrantFullControl'] ?? null; $this->grantRead = $input['GrantRead'] ?? null; $this->grantReadAcp = $input['GrantReadACP'] ?? null; @@ -609,6 +640,9 @@ public function __construct(array $input = []) $this->objectLockMode = $input['ObjectLockMode'] ?? null; $this->objectLockRetainUntilDate = !isset($input['ObjectLockRetainUntilDate']) ? null : ($input['ObjectLockRetainUntilDate'] instanceof \DateTimeImmutable ? $input['ObjectLockRetainUntilDate'] : new \DateTimeImmutable($input['ObjectLockRetainUntilDate'])); $this->objectLockLegalHoldStatus = $input['ObjectLockLegalHoldStatus'] ?? null; + $this->objectLockEventHold = $input['ObjectLockEventHold'] ?? null; + $this->objectLockEventHoldDurationDays = $input['ObjectLockEventHoldDurationDays'] ?? null; + $this->objectLockEventHoldDurationYears = $input['ObjectLockEventHoldDurationYears'] ?? null; $this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null; $this->checksumAlgorithm = $input['ChecksumAlgorithm'] ?? null; $this->checksumType = $input['ChecksumType'] ?? null; @@ -624,7 +658,7 @@ public function __construct(array $input = []) * ContentEncoding?: string|null, * ContentLanguage?: string|null, * ContentType?: string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * GrantFullControl?: string|null, * GrantRead?: string|null, * GrantReadACP?: string|null, @@ -645,6 +679,9 @@ public function __construct(array $input = []) * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * ChecksumAlgorithm?: ChecksumAlgorithm::*|null, * ChecksumType?: ChecksumType::*|null, @@ -720,7 +757,7 @@ public function getExpectedBucketOwner(): ?string return $this->expectedBucketOwner; } - public function getExpires(): ?\DateTimeImmutable + public function getExpires(): ?string { return $this->expires; } @@ -758,6 +795,24 @@ public function getMetadata(): array return $this->metadata ?? []; } + /** + * @return ObjectLockEventHold::*|null + */ + public function getObjectLockEventHold(): ?string + { + return $this->objectLockEventHold; + } + + public function getObjectLockEventHoldDurationDays(): ?int + { + return $this->objectLockEventHoldDurationDays; + } + + public function getObjectLockEventHoldDurationYears(): ?int + { + return $this->objectLockEventHoldDurationYears; + } + /** * @return ObjectLockLegalHoldStatus::*|null */ @@ -868,7 +923,7 @@ public function request(): Request $headers['Content-Type'] = $this->contentType; } if (null !== $this->expires) { - $headers['Expires'] = $this->expires->setTimezone(new \DateTimeZone('GMT'))->format('D, d M Y H:i:s \G\M\T'); + $headers['Expires'] = $this->expires; } if (null !== $this->grantFullControl) { $headers['x-amz-grant-full-control'] = $this->grantFullControl; @@ -944,6 +999,19 @@ public function request(): Request } $headers['x-amz-object-lock-legal-hold'] = $this->objectLockLegalHoldStatus; } + if (null !== $this->objectLockEventHold) { + if (!ObjectLockEventHold::exists($this->objectLockEventHold)) { + /** @psalm-suppress NoValue */ + throw new InvalidArgument(\sprintf('Invalid parameter "ObjectLockEventHold" for "%s". The value "%s" is not a valid "ObjectLockEventHold".', __CLASS__, $this->objectLockEventHold)); + } + $headers['x-amz-object-lock-event-hold'] = $this->objectLockEventHold; + } + if (null !== $this->objectLockEventHoldDurationDays) { + $headers['x-amz-object-lock-event-hold-duration-days'] = (string) $this->objectLockEventHoldDurationDays; + } + if (null !== $this->objectLockEventHoldDurationYears) { + $headers['x-amz-object-lock-event-hold-duration-years'] = (string) $this->objectLockEventHoldDurationYears; + } if (null !== $this->expectedBucketOwner) { $headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner; } @@ -1075,7 +1143,7 @@ public function setExpectedBucketOwner(?string $value): self return $this; } - public function setExpires(?\DateTimeImmutable $value): self + public function setExpires(?string $value): self { $this->expires = $value; @@ -1127,6 +1195,30 @@ public function setMetadata(array $value): self return $this; } + /** + * @param ObjectLockEventHold::*|null $value + */ + public function setObjectLockEventHold(?string $value): self + { + $this->objectLockEventHold = $value; + + return $this; + } + + public function setObjectLockEventHoldDurationDays(?int $value): self + { + $this->objectLockEventHoldDurationDays = $value; + + return $this; + } + + public function setObjectLockEventHoldDurationYears(?int $value): self + { + $this->objectLockEventHoldDurationYears = $value; + + return $this; + } + /** * @param ObjectLockLegalHoldStatus::*|null $value */ diff --git a/src/Service/S3/src/Input/PutObjectRequest.php b/src/Service/S3/src/Input/PutObjectRequest.php index 577d76d27..e7fd7ca97 100644 --- a/src/Service/S3/src/Input/PutObjectRequest.php +++ b/src/Service/S3/src/Input/PutObjectRequest.php @@ -8,6 +8,7 @@ use AsyncAws\Core\Stream\StreamFactory; use AsyncAws\S3\Enum\ChecksumAlgorithm; use AsyncAws\S3\Enum\ObjectCannedACL; +use AsyncAws\S3\Enum\ObjectLockEventHold; use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus; use AsyncAws\S3\Enum\ObjectLockMode; use AsyncAws\S3\Enum\RequestPayer; @@ -321,7 +322,7 @@ final class PutObjectRequest extends Input * * [^1]: https://www.rfc-editor.org/rfc/rfc7234#section-5.3 * - * @var \DateTimeImmutable|null + * @var string|null */ private $expires; @@ -667,6 +668,33 @@ final class PutObjectRequest extends Input */ private $objectLockLegalHoldStatus; + /** + * Specifies the event hold status to apply to this object. Set to `ON` to enable or `OFF` to disable. + * + * > This functionality is not supported for directory buckets. + * + * @var ObjectLockEventHold::*|null + */ + private $objectLockEventHold; + + /** + * Specifies the event hold duration in days to apply to this object. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationDays; + + /** + * Specifies the event hold duration in years to apply to this object. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationYears; + /** * The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of * the bucket, the request fails with the HTTP status code `403 Forbidden` (access denied). @@ -698,7 +726,7 @@ final class PutObjectRequest extends Input * ChecksumXXHASH64?: string|null, * ChecksumXXHASH3?: string|null, * ChecksumXXHASH128?: string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * IfMatch?: string|null, * IfNoneMatch?: string|null, * GrantFullControl?: string|null, @@ -722,6 +750,9 @@ final class PutObjectRequest extends Input * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * '@region'?: string|null, * } $input @@ -749,7 +780,7 @@ public function __construct(array $input = []) $this->checksumXxhash64 = $input['ChecksumXXHASH64'] ?? null; $this->checksumXxhash3 = $input['ChecksumXXHASH3'] ?? null; $this->checksumXxhash128 = $input['ChecksumXXHASH128'] ?? null; - $this->expires = !isset($input['Expires']) ? null : ($input['Expires'] instanceof \DateTimeImmutable ? $input['Expires'] : new \DateTimeImmutable($input['Expires'])); + $this->expires = $input['Expires'] ?? null; $this->ifMatch = $input['IfMatch'] ?? null; $this->ifNoneMatch = $input['IfNoneMatch'] ?? null; $this->grantFullControl = $input['GrantFullControl'] ?? null; @@ -773,6 +804,9 @@ public function __construct(array $input = []) $this->objectLockMode = $input['ObjectLockMode'] ?? null; $this->objectLockRetainUntilDate = !isset($input['ObjectLockRetainUntilDate']) ? null : ($input['ObjectLockRetainUntilDate'] instanceof \DateTimeImmutable ? $input['ObjectLockRetainUntilDate'] : new \DateTimeImmutable($input['ObjectLockRetainUntilDate'])); $this->objectLockLegalHoldStatus = $input['ObjectLockLegalHoldStatus'] ?? null; + $this->objectLockEventHold = $input['ObjectLockEventHold'] ?? null; + $this->objectLockEventHoldDurationDays = $input['ObjectLockEventHoldDurationDays'] ?? null; + $this->objectLockEventHoldDurationYears = $input['ObjectLockEventHoldDurationYears'] ?? null; $this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null; parent::__construct($input); } @@ -800,7 +834,7 @@ public function __construct(array $input = []) * ChecksumXXHASH64?: string|null, * ChecksumXXHASH3?: string|null, * ChecksumXXHASH128?: string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * IfMatch?: string|null, * IfNoneMatch?: string|null, * GrantFullControl?: string|null, @@ -824,6 +858,9 @@ public function __construct(array $input = []) * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * '@region'?: string|null, * }|PutObjectRequest $input @@ -957,7 +994,7 @@ public function getExpectedBucketOwner(): ?string return $this->expectedBucketOwner; } - public function getExpires(): ?\DateTimeImmutable + public function getExpires(): ?string { return $this->expires; } @@ -1005,6 +1042,24 @@ public function getMetadata(): array return $this->metadata ?? []; } + /** + * @return ObjectLockEventHold::*|null + */ + public function getObjectLockEventHold(): ?string + { + return $this->objectLockEventHold; + } + + public function getObjectLockEventHoldDurationDays(): ?int + { + return $this->objectLockEventHoldDurationDays; + } + + public function getObjectLockEventHoldDurationYears(): ?int + { + return $this->objectLockEventHoldDurationYears; + } + /** * @return ObjectLockLegalHoldStatus::*|null */ @@ -1163,7 +1218,7 @@ public function request(): Request $headers['x-amz-checksum-xxhash128'] = $this->checksumXxhash128; } if (null !== $this->expires) { - $headers['Expires'] = $this->expires->setTimezone(new \DateTimeZone('GMT'))->format('D, d M Y H:i:s \G\M\T'); + $headers['Expires'] = $this->expires; } if (null !== $this->ifMatch) { $headers['If-Match'] = $this->ifMatch; @@ -1248,6 +1303,19 @@ public function request(): Request } $headers['x-amz-object-lock-legal-hold'] = $this->objectLockLegalHoldStatus; } + if (null !== $this->objectLockEventHold) { + if (!ObjectLockEventHold::exists($this->objectLockEventHold)) { + /** @psalm-suppress NoValue */ + throw new InvalidArgument(\sprintf('Invalid parameter "ObjectLockEventHold" for "%s". The value "%s" is not a valid "ObjectLockEventHold".', __CLASS__, $this->objectLockEventHold)); + } + $headers['x-amz-object-lock-event-hold'] = $this->objectLockEventHold; + } + if (null !== $this->objectLockEventHoldDurationDays) { + $headers['x-amz-object-lock-event-hold-duration-days'] = (string) $this->objectLockEventHoldDurationDays; + } + if (null !== $this->objectLockEventHoldDurationYears) { + $headers['x-amz-object-lock-event-hold-duration-years'] = (string) $this->objectLockEventHoldDurationYears; + } if (null !== $this->expectedBucketOwner) { $headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner; } @@ -1449,7 +1517,7 @@ public function setExpectedBucketOwner(?string $value): self return $this; } - public function setExpires(?\DateTimeImmutable $value): self + public function setExpires(?string $value): self { $this->expires = $value; @@ -1515,6 +1583,30 @@ public function setMetadata(array $value): self return $this; } + /** + * @param ObjectLockEventHold::*|null $value + */ + public function setObjectLockEventHold(?string $value): self + { + $this->objectLockEventHold = $value; + + return $this; + } + + public function setObjectLockEventHoldDurationDays(?int $value): self + { + $this->objectLockEventHoldDurationDays = $value; + + return $this; + } + + public function setObjectLockEventHoldDurationYears(?int $value): self + { + $this->objectLockEventHoldDurationYears = $value; + + return $this; + } + /** * @param ObjectLockLegalHoldStatus::*|null $value */ diff --git a/src/Service/S3/src/Result/GetObjectOutput.php b/src/Service/S3/src/Result/GetObjectOutput.php index 53be22bbe..f7f66318a 100644 --- a/src/Service/S3/src/Result/GetObjectOutput.php +++ b/src/Service/S3/src/Result/GetObjectOutput.php @@ -6,6 +6,7 @@ use AsyncAws\Core\Result; use AsyncAws\Core\Stream\ResultStream; use AsyncAws\S3\Enum\ChecksumType; +use AsyncAws\S3\Enum\ObjectLockEventHold; use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus; use AsyncAws\S3\Enum\ObjectLockMode; use AsyncAws\S3\Enum\ReplicationStatus; @@ -95,7 +96,7 @@ class GetObjectOutput extends Result private $etag; /** - * The Base64 encoded, 32-bit `CRC32` checksum of the object. This checksum is only present if the object was uploaded + * The Base64 encoded, 32-bit `CRC32` checksum of the object. This checksum is only present if the checksum was uploaded * with the object. For more information, see Checking object integrity [^1] in the *Amazon S3 User Guide*. * * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html @@ -272,7 +273,7 @@ class GetObjectOutput extends Result /** * The date and time at which the object is no longer cacheable. * - * @var \DateTimeImmutable|null + * @var string|null */ private $expires; @@ -413,6 +414,34 @@ class GetObjectOutput extends Result */ private $objectLockLegalHoldStatus; + /** + * The event hold status for this object. This header is only returned if the requester has the `s3:GetObjectRetention` + * permission. + * + * > This functionality is not supported for directory buckets. + * + * @var ObjectLockEventHold::*|null + */ + private $objectLockEventHold; + + /** + * The event hold duration in days for this object. Only returned when the event hold is enabled. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationDays; + + /** + * The event hold duration in years for this object. Only returned when the event hold is enabled. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationYears; + public function getAcceptRanges(): ?string { $this->initialize(); @@ -584,7 +613,7 @@ public function getExpiration(): ?string return $this->expiration; } - public function getExpires(): ?\DateTimeImmutable + public function getExpires(): ?string { $this->initialize(); @@ -615,6 +644,30 @@ public function getMissingMeta(): ?int return $this->missingMeta; } + /** + * @return ObjectLockEventHold::*|null + */ + public function getObjectLockEventHold(): ?string + { + $this->initialize(); + + return $this->objectLockEventHold; + } + + public function getObjectLockEventHoldDurationDays(): ?int + { + $this->initialize(); + + return $this->objectLockEventHoldDurationDays; + } + + public function getObjectLockEventHoldDurationYears(): ?int + { + $this->initialize(); + + return $this->objectLockEventHoldDurationYears; + } + /** * @return ObjectLockLegalHoldStatus::*|null */ @@ -768,7 +821,7 @@ protected function populateResult(Response $response): void $this->contentLanguage = $headers['content-language'][0] ?? null; $this->contentRange = $headers['content-range'][0] ?? null; $this->contentType = $headers['content-type'][0] ?? null; - $this->expires = isset($headers['expires'][0]) ? new \DateTimeImmutable($headers['expires'][0]) : null; + $this->expires = $headers['expires'][0] ?? null; $this->websiteRedirectLocation = $headers['x-amz-website-redirect-location'][0] ?? null; $this->serverSideEncryption = $headers['x-amz-server-side-encryption'][0] ?? null; $this->sseCustomerAlgorithm = $headers['x-amz-server-side-encryption-customer-algorithm'][0] ?? null; @@ -783,6 +836,9 @@ protected function populateResult(Response $response): void $this->objectLockMode = $headers['x-amz-object-lock-mode'][0] ?? null; $this->objectLockRetainUntilDate = isset($headers['x-amz-object-lock-retain-until-date'][0]) ? new \DateTimeImmutable($headers['x-amz-object-lock-retain-until-date'][0]) : null; $this->objectLockLegalHoldStatus = $headers['x-amz-object-lock-legal-hold'][0] ?? null; + $this->objectLockEventHold = $headers['x-amz-object-lock-event-hold'][0] ?? null; + $this->objectLockEventHoldDurationDays = isset($headers['x-amz-object-lock-event-hold-duration-days'][0]) ? (int) $headers['x-amz-object-lock-event-hold-duration-days'][0] : null; + $this->objectLockEventHoldDurationYears = isset($headers['x-amz-object-lock-event-hold-duration-years'][0]) ? (int) $headers['x-amz-object-lock-event-hold-duration-years'][0] : null; $this->metadata = []; foreach ($headers as $name => $value) { diff --git a/src/Service/S3/src/Result/HeadObjectOutput.php b/src/Service/S3/src/Result/HeadObjectOutput.php index 563e1bd87..231abb1f6 100644 --- a/src/Service/S3/src/Result/HeadObjectOutput.php +++ b/src/Service/S3/src/Result/HeadObjectOutput.php @@ -6,6 +6,7 @@ use AsyncAws\Core\Result; use AsyncAws\S3\Enum\ArchiveStatus; use AsyncAws\S3\Enum\ChecksumType; +use AsyncAws\S3\Enum\ObjectLockEventHold; use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus; use AsyncAws\S3\Enum\ObjectLockMode; use AsyncAws\S3\Enum\ReplicationStatus; @@ -291,7 +292,7 @@ class HeadObjectOutput extends Result /** * The date and time at which the object is no longer cacheable. * - * @var \DateTimeImmutable|null + * @var string|null */ private $expires; @@ -467,6 +468,34 @@ class HeadObjectOutput extends Result */ private $objectLockLegalHoldStatus; + /** + * The event hold status for this object. This header is only returned if the requester has the `s3:GetObjectRetention` + * permission. + * + * > This functionality is not supported for directory buckets. + * + * @var ObjectLockEventHold::*|null + */ + private $objectLockEventHold; + + /** + * The event hold duration in days for this object. Only returned when the event hold is enabled. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationDays; + + /** + * The event hold duration in years for this object. Only returned when the event hold is enabled. + * + * > This functionality is not supported for directory buckets. + * + * @var int|null + */ + private $objectLockEventHoldDurationYears; + public function getAcceptRanges(): ?string { $this->initialize(); @@ -641,7 +670,7 @@ public function getExpiration(): ?string return $this->expiration; } - public function getExpires(): ?\DateTimeImmutable + public function getExpires(): ?string { $this->initialize(); @@ -672,6 +701,30 @@ public function getMissingMeta(): ?int return $this->missingMeta; } + /** + * @return ObjectLockEventHold::*|null + */ + public function getObjectLockEventHold(): ?string + { + $this->initialize(); + + return $this->objectLockEventHold; + } + + public function getObjectLockEventHoldDurationDays(): ?int + { + $this->initialize(); + + return $this->objectLockEventHoldDurationDays; + } + + public function getObjectLockEventHoldDurationYears(): ?int + { + $this->initialize(); + + return $this->objectLockEventHoldDurationYears; + } + /** * @return ObjectLockLegalHoldStatus::*|null */ @@ -826,7 +879,7 @@ protected function populateResult(Response $response): void $this->contentLanguage = $headers['content-language'][0] ?? null; $this->contentType = $headers['content-type'][0] ?? null; $this->contentRange = $headers['content-range'][0] ?? null; - $this->expires = isset($headers['expires'][0]) ? new \DateTimeImmutable($headers['expires'][0]) : null; + $this->expires = $headers['expires'][0] ?? null; $this->websiteRedirectLocation = $headers['x-amz-website-redirect-location'][0] ?? null; $this->serverSideEncryption = $headers['x-amz-server-side-encryption'][0] ?? null; $this->sseCustomerAlgorithm = $headers['x-amz-server-side-encryption-customer-algorithm'][0] ?? null; @@ -841,6 +894,9 @@ protected function populateResult(Response $response): void $this->objectLockMode = $headers['x-amz-object-lock-mode'][0] ?? null; $this->objectLockRetainUntilDate = isset($headers['x-amz-object-lock-retain-until-date'][0]) ? new \DateTimeImmutable($headers['x-amz-object-lock-retain-until-date'][0]) : null; $this->objectLockLegalHoldStatus = $headers['x-amz-object-lock-legal-hold'][0] ?? null; + $this->objectLockEventHold = $headers['x-amz-object-lock-event-hold'][0] ?? null; + $this->objectLockEventHoldDurationDays = isset($headers['x-amz-object-lock-event-hold-duration-days'][0]) ? (int) $headers['x-amz-object-lock-event-hold-duration-days'][0] : null; + $this->objectLockEventHoldDurationYears = isset($headers['x-amz-object-lock-event-hold-duration-years'][0]) ? (int) $headers['x-amz-object-lock-event-hold-duration-years'][0] : null; $this->metadata = []; foreach ($headers as $name => $value) { diff --git a/src/Service/S3/src/S3Client.php b/src/Service/S3/src/S3Client.php index 6fd65bfea..595e75ce8 100644 --- a/src/Service/S3/src/S3Client.php +++ b/src/Service/S3/src/S3Client.php @@ -17,6 +17,7 @@ use AsyncAws\S3\Enum\EncodingType; use AsyncAws\S3\Enum\MetadataDirective; use AsyncAws\S3\Enum\ObjectCannedACL; +use AsyncAws\S3\Enum\ObjectLockEventHold; use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus; use AsyncAws\S3\Enum\ObjectLockMode; use AsyncAws\S3\Enum\ObjectOwnership; @@ -558,7 +559,7 @@ public function completeMultipartUpload($input): CompleteMultipartUploadOutput * CopySourceIfModifiedSince?: \DateTimeImmutable|string|null, * CopySourceIfNoneMatch?: string|null, * CopySourceIfUnmodifiedSince?: \DateTimeImmutable|string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * GrantFullControl?: string|null, * GrantRead?: string|null, * GrantReadACP?: string|null, @@ -587,6 +588,9 @@ public function completeMultipartUpload($input): CompleteMultipartUploadOutput * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * ExpectedSourceBucketOwner?: string|null, * '@region'?: string|null, @@ -943,7 +947,7 @@ public function createBucket($input): CreateBucketOutput * ContentEncoding?: string|null, * ContentLanguage?: string|null, * ContentType?: string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * GrantFullControl?: string|null, * GrantRead?: string|null, * GrantReadACP?: string|null, @@ -964,6 +968,9 @@ public function createBucket($input): CreateBucketOutput * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * ChecksumAlgorithm?: ChecksumAlgorithm::*|null, * ChecksumType?: ChecksumType::*|null, @@ -3030,7 +3037,7 @@ public function putBucketVersioning($input): Result * ChecksumXXHASH64?: string|null, * ChecksumXXHASH3?: string|null, * ChecksumXXHASH128?: string|null, - * Expires?: \DateTimeImmutable|string|null, + * Expires?: string|null, * IfMatch?: string|null, * IfNoneMatch?: string|null, * GrantFullControl?: string|null, @@ -3054,6 +3061,9 @@ public function putBucketVersioning($input): Result * ObjectLockMode?: ObjectLockMode::*|null, * ObjectLockRetainUntilDate?: \DateTimeImmutable|string|null, * ObjectLockLegalHoldStatus?: ObjectLockLegalHoldStatus::*|null, + * ObjectLockEventHold?: ObjectLockEventHold::*|null, + * ObjectLockEventHoldDurationDays?: int|null, + * ObjectLockEventHoldDurationYears?: int|null, * ExpectedBucketOwner?: string|null, * '@region'?: string|null, * }|PutObjectRequest $input diff --git a/src/Service/S3/src/ValueObject/CopyObjectResult.php b/src/Service/S3/src/ValueObject/CopyObjectResult.php index c1a4c312e..340f431e6 100644 --- a/src/Service/S3/src/ValueObject/CopyObjectResult.php +++ b/src/Service/S3/src/ValueObject/CopyObjectResult.php @@ -34,7 +34,7 @@ final class CopyObjectResult private $checksumType; /** - * The Base64 encoded, 32-bit `CRC32` checksum of the object. This checksum is only present if the object was uploaded + * The Base64 encoded, 32-bit `CRC32` checksum of the object. This checksum is only present if the checksum was uploaded * with the object. For more information, see Checking object integrity [^1] in the *Amazon S3 User Guide*. * * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html