Skip to content

Commit 9d6a68e

Browse files
Update generated code (#1836)
update generated code
1 parent d6556d0 commit 9d6a68e

34 files changed

+860
-244
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: This change enhances integrity protections for new SDK requests to S3. S3 SDKs now support the CRC64NVME checksum algorithm, full object checksums for multipart S3 objects, and new default integrity protections for S3 requests.
8+
59
## 2.7.0
610

711
### Added

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"extra": {
3232
"branch-alias": {
33-
"dev-master": "2.7-dev"
33+
"dev-master": "2.8-dev"
3434
}
3535
}
3636
}

src/Enum/ChecksumAlgorithm.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ final class ChecksumAlgorithm
66
{
77
public const CRC32 = 'CRC32';
88
public const CRC32C = 'CRC32C';
9+
public const CRC64NVME = 'CRC64NVME';
910
public const SHA1 = 'SHA1';
1011
public const SHA256 = 'SHA256';
1112

@@ -14,6 +15,7 @@ public static function exists(string $value): bool
1415
return isset([
1516
self::CRC32 => true,
1617
self::CRC32C => true,
18+
self::CRC64NVME => true,
1719
self::SHA1 => true,
1820
self::SHA256 => true,
1921
][$value]);

src/Enum/ChecksumType.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace AsyncAws\S3\Enum;
4+
5+
final class ChecksumType
6+
{
7+
public const COMPOSITE = 'COMPOSITE';
8+
public const FULL_OBJECT = 'FULL_OBJECT';
9+
10+
public static function exists(string $value): bool
11+
{
12+
return isset([
13+
self::COMPOSITE => true,
14+
self::FULL_OBJECT => true,
15+
][$value]);
16+
}
17+
}

src/Input/CompleteMultipartUploadRequest.php

+100-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AsyncAws\Core\Input;
77
use AsyncAws\Core\Request;
88
use AsyncAws\Core\Stream\StreamFactory;
9+
use AsyncAws\S3\Enum\ChecksumType;
910
use AsyncAws\S3\Enum\RequestPayer;
1011
use AsyncAws\S3\ValueObject\CompletedMultipartUpload;
1112

@@ -73,7 +74,7 @@ final class CompleteMultipartUploadRequest extends Input
7374

7475
/**
7576
* This header can be used as a data integrity check to verify that the data received is the same data that was
76-
* originally sent. This header specifies the base64-encoded, 32-bit CRC-32 checksum of the object. For more
77+
* originally sent. This header specifies the Base64 encoded, 32-bit `CRC-32` checksum of the object. For more
7778
* information, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
7879
*
7980
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
@@ -84,7 +85,7 @@ final class CompleteMultipartUploadRequest extends Input
8485

8586
/**
8687
* This header can be used as a data integrity check to verify that the data received is the same data that was
87-
* originally sent. This header specifies the base64-encoded, 32-bit CRC-32C checksum of the object. For more
88+
* originally sent. This header specifies the Base64 encoded, 32-bit `CRC-32C` checksum of the object. For more
8889
* information, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
8990
*
9091
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
@@ -95,8 +96,20 @@ final class CompleteMultipartUploadRequest extends Input
9596

9697
/**
9798
* This header can be used as a data integrity check to verify that the data received is the same data that was
98-
* originally sent. This header specifies the base64-encoded, 160-bit SHA-1 digest of the object. For more information,
99-
* see Checking object integrity [^1] in the *Amazon S3 User Guide*.
99+
* originally sent. This header specifies the Base64 encoded, 64-bit `CRC-64NVME` checksum of the object. The
100+
* `CRC-64NVME` checksum is always a full object checksum. For more information, see Checking object integrity in the
101+
* Amazon S3 User Guide [^1].
102+
*
103+
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
104+
*
105+
* @var string|null
106+
*/
107+
private $checksumCrc64Nvme;
108+
109+
/**
110+
* This header can be used as a data integrity check to verify that the data received is the same data that was
111+
* originally sent. This header specifies the Base64 encoded, 160-bit `SHA-1` digest of the object. For more
112+
* information, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
100113
*
101114
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
102115
*
@@ -106,7 +119,7 @@ final class CompleteMultipartUploadRequest extends Input
106119

107120
/**
108121
* This header can be used as a data integrity check to verify that the data received is the same data that was
109-
* originally sent. This header specifies the base64-encoded, 256-bit SHA-256 digest of the object. For more
122+
* originally sent. This header specifies the Base64 encoded, 256-bit `SHA-256` digest of the object. For more
110123
* information, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
111124
*
112125
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
@@ -115,6 +128,25 @@ final class CompleteMultipartUploadRequest extends Input
115128
*/
116129
private $checksumSha256;
117130

131+
/**
132+
* This header specifies the checksum type of the object, which determines how part-level checksums are combined to
133+
* create an object-level checksum for multipart objects. You can use this header as a data integrity check to verify
134+
* that the checksum type that is received is the same checksum that was specified. If the checksum type doesn’t match
135+
* the checksum type that was specified for the object during the `CreateMultipartUpload` request, it’ll result in a
136+
* `BadDigest` error. For more information, see Checking object integrity in the Amazon S3 User Guide.
137+
*
138+
* @var ChecksumType::*|null
139+
*/
140+
private $checksumType;
141+
142+
/**
143+
* The expected total object size of the multipart upload request. If there’s a mismatch between the specified object
144+
* size value and the actual object size value, it results in an `HTTP 400 InvalidRequest` error.
145+
*
146+
* @var int|null
147+
*/
148+
private $mpuObjectSize;
149+
118150
/**
119151
* @var RequestPayer::*|null
120152
*/
@@ -214,8 +246,11 @@ final class CompleteMultipartUploadRequest extends Input
214246
* UploadId?: string,
215247
* ChecksumCRC32?: null|string,
216248
* ChecksumCRC32C?: null|string,
249+
* ChecksumCRC64NVME?: null|string,
217250
* ChecksumSHA1?: null|string,
218251
* ChecksumSHA256?: null|string,
252+
* ChecksumType?: null|ChecksumType::*,
253+
* MpuObjectSize?: null|int,
219254
* RequestPayer?: null|RequestPayer::*,
220255
* ExpectedBucketOwner?: null|string,
221256
* IfMatch?: null|string,
@@ -234,8 +269,11 @@ public function __construct(array $input = [])
234269
$this->uploadId = $input['UploadId'] ?? null;
235270
$this->checksumCrc32 = $input['ChecksumCRC32'] ?? null;
236271
$this->checksumCrc32C = $input['ChecksumCRC32C'] ?? null;
272+
$this->checksumCrc64Nvme = $input['ChecksumCRC64NVME'] ?? null;
237273
$this->checksumSha1 = $input['ChecksumSHA1'] ?? null;
238274
$this->checksumSha256 = $input['ChecksumSHA256'] ?? null;
275+
$this->checksumType = $input['ChecksumType'] ?? null;
276+
$this->mpuObjectSize = $input['MpuObjectSize'] ?? null;
239277
$this->requestPayer = $input['RequestPayer'] ?? null;
240278
$this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null;
241279
$this->ifMatch = $input['IfMatch'] ?? null;
@@ -254,8 +292,11 @@ public function __construct(array $input = [])
254292
* UploadId?: string,
255293
* ChecksumCRC32?: null|string,
256294
* ChecksumCRC32C?: null|string,
295+
* ChecksumCRC64NVME?: null|string,
257296
* ChecksumSHA1?: null|string,
258297
* ChecksumSHA256?: null|string,
298+
* ChecksumType?: null|ChecksumType::*,
299+
* MpuObjectSize?: null|int,
259300
* RequestPayer?: null|RequestPayer::*,
260301
* ExpectedBucketOwner?: null|string,
261302
* IfMatch?: null|string,
@@ -286,6 +327,11 @@ public function getChecksumCrc32C(): ?string
286327
return $this->checksumCrc32C;
287328
}
288329

330+
public function getChecksumCrc64Nvme(): ?string
331+
{
332+
return $this->checksumCrc64Nvme;
333+
}
334+
289335
public function getChecksumSha1(): ?string
290336
{
291337
return $this->checksumSha1;
@@ -296,6 +342,14 @@ public function getChecksumSha256(): ?string
296342
return $this->checksumSha256;
297343
}
298344

345+
/**
346+
* @return ChecksumType::*|null
347+
*/
348+
public function getChecksumType(): ?string
349+
{
350+
return $this->checksumType;
351+
}
352+
299353
public function getExpectedBucketOwner(): ?string
300354
{
301355
return $this->expectedBucketOwner;
@@ -316,6 +370,11 @@ public function getKey(): ?string
316370
return $this->key;
317371
}
318372

373+
public function getMpuObjectSize(): ?int
374+
{
375+
return $this->mpuObjectSize;
376+
}
377+
319378
public function getMultipartUpload(): ?CompletedMultipartUpload
320379
{
321380
return $this->multipartUpload;
@@ -362,12 +421,24 @@ public function request(): Request
362421
if (null !== $this->checksumCrc32C) {
363422
$headers['x-amz-checksum-crc32c'] = $this->checksumCrc32C;
364423
}
424+
if (null !== $this->checksumCrc64Nvme) {
425+
$headers['x-amz-checksum-crc64nvme'] = $this->checksumCrc64Nvme;
426+
}
365427
if (null !== $this->checksumSha1) {
366428
$headers['x-amz-checksum-sha1'] = $this->checksumSha1;
367429
}
368430
if (null !== $this->checksumSha256) {
369431
$headers['x-amz-checksum-sha256'] = $this->checksumSha256;
370432
}
433+
if (null !== $this->checksumType) {
434+
if (!ChecksumType::exists($this->checksumType)) {
435+
throw new InvalidArgument(\sprintf('Invalid parameter "ChecksumType" for "%s". The value "%s" is not a valid "ChecksumType".', __CLASS__, $this->checksumType));
436+
}
437+
$headers['x-amz-checksum-type'] = $this->checksumType;
438+
}
439+
if (null !== $this->mpuObjectSize) {
440+
$headers['x-amz-mp-object-size'] = (string) $this->mpuObjectSize;
441+
}
371442
if (null !== $this->requestPayer) {
372443
if (!RequestPayer::exists($this->requestPayer)) {
373444
throw new InvalidArgument(\sprintf('Invalid parameter "RequestPayer" for "%s". The value "%s" is not a valid "RequestPayer".', __CLASS__, $this->requestPayer));
@@ -444,6 +515,13 @@ public function setChecksumCrc32C(?string $value): self
444515
return $this;
445516
}
446517

518+
public function setChecksumCrc64Nvme(?string $value): self
519+
{
520+
$this->checksumCrc64Nvme = $value;
521+
522+
return $this;
523+
}
524+
447525
public function setChecksumSha1(?string $value): self
448526
{
449527
$this->checksumSha1 = $value;
@@ -458,6 +536,16 @@ public function setChecksumSha256(?string $value): self
458536
return $this;
459537
}
460538

539+
/**
540+
* @param ChecksumType::*|null $value
541+
*/
542+
public function setChecksumType(?string $value): self
543+
{
544+
$this->checksumType = $value;
545+
546+
return $this;
547+
}
548+
461549
public function setExpectedBucketOwner(?string $value): self
462550
{
463551
$this->expectedBucketOwner = $value;
@@ -486,6 +574,13 @@ public function setKey(?string $value): self
486574
return $this;
487575
}
488576

577+
public function setMpuObjectSize(?int $value): self
578+
{
579+
$this->mpuObjectSize = $value;
580+
581+
return $this;
582+
}
583+
489584
public function setMultipartUpload(?CompletedMultipartUpload $value): self
490585
{
491586
$this->multipartUpload = $value;

src/Input/CreateMultipartUploadRequest.php

+39-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use AsyncAws\Core\Request;
88
use AsyncAws\Core\Stream\StreamFactory;
99
use AsyncAws\S3\Enum\ChecksumAlgorithm;
10+
use AsyncAws\S3\Enum\ChecksumType;
1011
use AsyncAws\S3\Enum\ObjectCannedACL;
1112
use AsyncAws\S3\Enum\ObjectLockLegalHoldStatus;
1213
use AsyncAws\S3\Enum\ObjectLockMode;
@@ -435,7 +436,7 @@ final class CreateMultipartUploadRequest extends Input
435436

436437
/**
437438
* Specifies the Amazon Web Services KMS Encryption Context to use for object encryption. The value of this header is a
438-
* Base64-encoded string of a UTF-8 encoded JSON, which contains the encryption context as key-value pairs.
439+
* Base64 encoded string of a UTF-8 encoded JSON, which contains the encryption context as key-value pairs.
439440
*
440441
* **Directory buckets** - You can optionally provide an explicit encryption context value. The value must match the
441442
* default encryption context - the bucket Amazon Resource Name (ARN). An additional encryption context value is not
@@ -527,6 +528,16 @@ final class CreateMultipartUploadRequest extends Input
527528
*/
528529
private $checksumAlgorithm;
529530

531+
/**
532+
* Indicates the checksum type that you want Amazon S3 to use to calculate the object’s checksum value. For more
533+
* information, see Checking object integrity in the Amazon S3 User Guide [^1].
534+
*
535+
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
536+
*
537+
* @var ChecksumType::*|null
538+
*/
539+
private $checksumType;
540+
530541
/**
531542
* @param array{
532543
* ACL?: null|ObjectCannedACL::*,
@@ -559,6 +570,7 @@ final class CreateMultipartUploadRequest extends Input
559570
* ObjectLockLegalHoldStatus?: null|ObjectLockLegalHoldStatus::*,
560571
* ExpectedBucketOwner?: null|string,
561572
* ChecksumAlgorithm?: null|ChecksumAlgorithm::*,
573+
* ChecksumType?: null|ChecksumType::*,
562574
* '@region'?: string|null,
563575
* } $input
564576
*/
@@ -594,6 +606,7 @@ public function __construct(array $input = [])
594606
$this->objectLockLegalHoldStatus = $input['ObjectLockLegalHoldStatus'] ?? null;
595607
$this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null;
596608
$this->checksumAlgorithm = $input['ChecksumAlgorithm'] ?? null;
609+
$this->checksumType = $input['ChecksumType'] ?? null;
597610
parent::__construct($input);
598611
}
599612

@@ -629,6 +642,7 @@ public function __construct(array $input = [])
629642
* ObjectLockLegalHoldStatus?: null|ObjectLockLegalHoldStatus::*,
630643
* ExpectedBucketOwner?: null|string,
631644
* ChecksumAlgorithm?: null|ChecksumAlgorithm::*,
645+
* ChecksumType?: null|ChecksumType::*,
632646
* '@region'?: string|null,
633647
* }|CreateMultipartUploadRequest $input
634648
*/
@@ -668,6 +682,14 @@ public function getChecksumAlgorithm(): ?string
668682
return $this->checksumAlgorithm;
669683
}
670684

685+
/**
686+
* @return ChecksumType::*|null
687+
*/
688+
public function getChecksumType(): ?string
689+
{
690+
return $this->checksumType;
691+
}
692+
671693
public function getContentDisposition(): ?string
672694
{
673695
return $this->contentDisposition;
@@ -920,6 +942,12 @@ public function request(): Request
920942
}
921943
$headers['x-amz-checksum-algorithm'] = $this->checksumAlgorithm;
922944
}
945+
if (null !== $this->checksumType) {
946+
if (!ChecksumType::exists($this->checksumType)) {
947+
throw new InvalidArgument(\sprintf('Invalid parameter "ChecksumType" for "%s". The value "%s" is not a valid "ChecksumType".', __CLASS__, $this->checksumType));
948+
}
949+
$headers['x-amz-checksum-type'] = $this->checksumType;
950+
}
923951
if (null !== $this->metadata) {
924952
foreach ($this->metadata as $key => $value) {
925953
$headers["x-amz-meta-$key"] = $value;
@@ -989,6 +1017,16 @@ public function setChecksumAlgorithm(?string $value): self
9891017
return $this;
9901018
}
9911019

1020+
/**
1021+
* @param ChecksumType::*|null $value
1022+
*/
1023+
public function setChecksumType(?string $value): self
1024+
{
1025+
$this->checksumType = $value;
1026+
1027+
return $this;
1028+
}
1029+
9921030
public function setContentDisposition(?string $value): self
9931031
{
9941032
$this->contentDisposition = $value;

0 commit comments

Comments
 (0)