Skip to content

Commit f5a2709

Browse files
Update generated code (#1752)
update generated code
1 parent 9fb09eb commit f5a2709

6 files changed

+199
-92
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- AWS api-change: Amazon Simple Storage Service / Features : Adds support for pagination in the S3 ListBuckets API.
8+
- AWS api-change: Amazon Simple Storage Service / Features : Add support for conditional writes for PutObject and CompleteMultipartUpload APIs.
89

910
### Changed
1011

src/Input/CompleteMultipartUploadRequest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,25 @@ final class CompleteMultipartUploadRequest extends Input
127127
*/
128128
private $expectedBucketOwner;
129129

130+
/**
131+
* Uploads the object only if the object key name does not already exist in the bucket specified. Otherwise, Amazon S3
132+
* 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 re-initiate the multipart upload with `CreateMultipartUpload` and re-upload each part.
136+
*
137+
* Expects the '*' (asterisk) character.
138+
*
139+
* For more information about conditional requests, see RFC 7232 [^1], or Conditional requests [^2] in the *Amazon S3
140+
* User Guide*.
141+
*
142+
* [^1]: https://tools.ietf.org/html/rfc7232
143+
* [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
144+
*
145+
* @var string|null
146+
*/
147+
private $ifNoneMatch;
148+
130149
/**
131150
* The server-side encryption (SSE) algorithm used to encrypt the object. This parameter is required only when the
132151
* object was created using a checksum algorithm or if your bucket policy requires the use of SSE-C. For more
@@ -178,6 +197,7 @@ final class CompleteMultipartUploadRequest extends Input
178197
* ChecksumSHA256?: null|string,
179198
* RequestPayer?: null|RequestPayer::*,
180199
* ExpectedBucketOwner?: null|string,
200+
* IfNoneMatch?: null|string,
181201
* SSECustomerAlgorithm?: null|string,
182202
* SSECustomerKey?: null|string,
183203
* SSECustomerKeyMD5?: null|string,
@@ -196,6 +216,7 @@ public function __construct(array $input = [])
196216
$this->checksumSha256 = $input['ChecksumSHA256'] ?? null;
197217
$this->requestPayer = $input['RequestPayer'] ?? null;
198218
$this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null;
219+
$this->ifNoneMatch = $input['IfNoneMatch'] ?? null;
199220
$this->sseCustomerAlgorithm = $input['SSECustomerAlgorithm'] ?? null;
200221
$this->sseCustomerKey = $input['SSECustomerKey'] ?? null;
201222
$this->sseCustomerKeyMd5 = $input['SSECustomerKeyMD5'] ?? null;
@@ -214,6 +235,7 @@ public function __construct(array $input = [])
214235
* ChecksumSHA256?: null|string,
215236
* RequestPayer?: null|RequestPayer::*,
216237
* ExpectedBucketOwner?: null|string,
238+
* IfNoneMatch?: null|string,
217239
* SSECustomerAlgorithm?: null|string,
218240
* SSECustomerKey?: null|string,
219241
* SSECustomerKeyMD5?: null|string,
@@ -255,6 +277,11 @@ public function getExpectedBucketOwner(): ?string
255277
return $this->expectedBucketOwner;
256278
}
257279

280+
public function getIfNoneMatch(): ?string
281+
{
282+
return $this->ifNoneMatch;
283+
}
284+
258285
public function getKey(): ?string
259286
{
260287
return $this->key;
@@ -321,6 +348,9 @@ public function request(): Request
321348
if (null !== $this->expectedBucketOwner) {
322349
$headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner;
323350
}
351+
if (null !== $this->ifNoneMatch) {
352+
$headers['If-None-Match'] = $this->ifNoneMatch;
353+
}
324354
if (null !== $this->sseCustomerAlgorithm) {
325355
$headers['x-amz-server-side-encryption-customer-algorithm'] = $this->sseCustomerAlgorithm;
326356
}
@@ -403,6 +433,13 @@ public function setExpectedBucketOwner(?string $value): self
403433
return $this;
404434
}
405435

436+
public function setIfNoneMatch(?string $value): self
437+
{
438+
$this->ifNoneMatch = $value;
439+
440+
return $this;
441+
}
442+
406443
public function setKey(?string $value): self
407444
{
408445
$this->key = $value;

src/Input/GetObjectRequest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ final class GetObjectRequest extends Input
290290
/**
291291
* To retrieve the checksum, this mode must be enabled.
292292
*
293+
* In addition, if you enable checksum mode and the object is uploaded with a checksum [^1] and encrypted with an Key
294+
* Management Service (KMS) key, you must have permission to use the `kms:Decrypt` action to retrieve the checksum.
295+
*
296+
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
297+
*
293298
* @var ChecksumMode::*|null
294299
*/
295300
private $checksumMode;

src/Input/HeadObjectRequest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,10 @@ final class HeadObjectRequest extends Input
244244
/**
245245
* To retrieve the checksum, this parameter must be enabled.
246246
*
247-
* In addition, if you enable `ChecksumMode` and the object is encrypted with Amazon Web Services Key Management Service
248-
* (Amazon Web Services KMS), you must have permission to use the `kms:Decrypt` action for the request to succeed.
247+
* In addition, if you enable checksum mode and the object is uploaded with a checksum [^1] and encrypted with an Key
248+
* Management Service (KMS) key, you must have permission to use the `kms:Decrypt` action to retrieve the checksum.
249+
*
250+
* [^1]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html
249251
*
250252
* @var ChecksumMode::*|null
251253
*/

src/Input/PutObjectRequest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,25 @@ final class PutObjectRequest extends Input
246246
*/
247247
private $expires;
248248

249+
/**
250+
* Uploads the object only if the object key name does not already exist in the bucket specified. Otherwise, Amazon S3
251+
* returns a `412 Precondition Failed` error.
252+
*
253+
* If a conflicting operation occurs during the upload S3 returns a `409 ConditionalRequestConflict` response. On a 409
254+
* failure you should retry the upload.
255+
*
256+
* Expects the '*' (asterisk) character.
257+
*
258+
* For more information about conditional requests, see RFC 7232 [^1], or Conditional requests [^2] in the *Amazon S3
259+
* User Guide*.
260+
*
261+
* [^1]: https://tools.ietf.org/html/rfc7232
262+
* [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
263+
*
264+
* @var string|null
265+
*/
266+
private $ifNoneMatch;
267+
249268
/**
250269
* Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
251270
*
@@ -506,6 +525,7 @@ final class PutObjectRequest extends Input
506525
* ChecksumSHA1?: null|string,
507526
* ChecksumSHA256?: null|string,
508527
* Expires?: null|\DateTimeImmutable|string,
528+
* IfNoneMatch?: null|string,
509529
* GrantFullControl?: null|string,
510530
* GrantRead?: null|string,
511531
* GrantReadACP?: null|string,
@@ -548,6 +568,7 @@ public function __construct(array $input = [])
548568
$this->checksumSha1 = $input['ChecksumSHA1'] ?? null;
549569
$this->checksumSha256 = $input['ChecksumSHA256'] ?? null;
550570
$this->expires = !isset($input['Expires']) ? null : ($input['Expires'] instanceof \DateTimeImmutable ? $input['Expires'] : new \DateTimeImmutable($input['Expires']));
571+
$this->ifNoneMatch = $input['IfNoneMatch'] ?? null;
551572
$this->grantFullControl = $input['GrantFullControl'] ?? null;
552573
$this->grantRead = $input['GrantRead'] ?? null;
553574
$this->grantReadAcp = $input['GrantReadACP'] ?? null;
@@ -590,6 +611,7 @@ public function __construct(array $input = [])
590611
* ChecksumSHA1?: null|string,
591612
* ChecksumSHA256?: null|string,
592613
* Expires?: null|\DateTimeImmutable|string,
614+
* IfNoneMatch?: null|string,
593615
* GrantFullControl?: null|string,
594616
* GrantRead?: null|string,
595617
* GrantReadACP?: null|string,
@@ -738,6 +760,11 @@ public function getGrantWriteAcp(): ?string
738760
return $this->grantWriteAcp;
739761
}
740762

763+
public function getIfNoneMatch(): ?string
764+
{
765+
return $this->ifNoneMatch;
766+
}
767+
741768
public function getKey(): ?string
742769
{
743770
return $this->key;
@@ -886,6 +913,9 @@ public function request(): Request
886913
if (null !== $this->expires) {
887914
$headers['Expires'] = $this->expires->setTimezone(new \DateTimeZone('GMT'))->format(\DateTimeInterface::RFC7231);
888915
}
916+
if (null !== $this->ifNoneMatch) {
917+
$headers['If-None-Match'] = $this->ifNoneMatch;
918+
}
889919
if (null !== $this->grantFullControl) {
890920
$headers['x-amz-grant-full-control'] = $this->grantFullControl;
891921
}
@@ -1149,6 +1179,13 @@ public function setGrantWriteAcp(?string $value): self
11491179
return $this;
11501180
}
11511181

1182+
public function setIfNoneMatch(?string $value): self
1183+
{
1184+
$this->ifNoneMatch = $value;
1185+
1186+
return $this;
1187+
}
1188+
11521189
public function setKey(?string $value): self
11531190
{
11541191
$this->key = $value;

0 commit comments

Comments
 (0)