Skip to content

Commit e2d92ad

Browse files
Update generated code (#1809)
update generated code
1 parent 4909584 commit e2d92ad

File tree

6 files changed

+83
-2
lines changed

6 files changed

+83
-2
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variables": {
3-
"${LATEST}": "3.330.0"
3+
"${LATEST}": "3.330.1"
44
},
55
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
66
"services": {

src/Service/S3/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: Amazon Simple Storage Service / Features: Add support for ETag based conditional writes in PutObject and CompleteMultiPartUpload APIs to prevent unintended object modifications.
8+
59
## 2.5.0
610

711
### Added

src/Service/S3/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"extra": {
3232
"branch-alias": {
33-
"dev-master": "2.5-dev"
33+
"dev-master": "2.6-dev"
3434
}
3535
}
3636
}

src/Service/S3/src/Input/CompleteMultipartUploadRequest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

src/Service/S3/src/Input/PutObjectRequest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,25 @@ final class PutObjectRequest extends Input
251251
*/
252252
private $expires;
253253

254+
/**
255+
* Uploads the object only if the ETag (entity tag) value provided during the WRITE operation matches the ETag of the
256+
* object in S3. If the ETag values do not match, the operation returns a `412 Precondition Failed` error.
257+
*
258+
* If a conflicting operation occurs during the upload S3 returns a `409 ConditionalRequestConflict` response. On a 409
259+
* failure you should fetch the object's ETag and retry the upload.
260+
*
261+
* Expects the ETag value as a string.
262+
*
263+
* For more information about conditional requests, see RFC 7232 [^1], or Conditional requests [^2] in the *Amazon S3
264+
* User Guide*.
265+
*
266+
* [^1]: https://tools.ietf.org/html/rfc7232
267+
* [^2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html
268+
*
269+
* @var string|null
270+
*/
271+
private $ifMatch;
272+
254273
/**
255274
* Uploads the object only if the object key name does not already exist in the bucket specified. Otherwise, Amazon S3
256275
* returns a `412 Precondition Failed` error.
@@ -597,6 +616,7 @@ final class PutObjectRequest extends Input
597616
* ChecksumSHA1?: null|string,
598617
* ChecksumSHA256?: null|string,
599618
* Expires?: null|\DateTimeImmutable|string,
619+
* IfMatch?: null|string,
600620
* IfNoneMatch?: null|string,
601621
* GrantFullControl?: null|string,
602622
* GrantRead?: null|string,
@@ -641,6 +661,7 @@ public function __construct(array $input = [])
641661
$this->checksumSha1 = $input['ChecksumSHA1'] ?? null;
642662
$this->checksumSha256 = $input['ChecksumSHA256'] ?? null;
643663
$this->expires = !isset($input['Expires']) ? null : ($input['Expires'] instanceof \DateTimeImmutable ? $input['Expires'] : new \DateTimeImmutable($input['Expires']));
664+
$this->ifMatch = $input['IfMatch'] ?? null;
644665
$this->ifNoneMatch = $input['IfNoneMatch'] ?? null;
645666
$this->grantFullControl = $input['GrantFullControl'] ?? null;
646667
$this->grantRead = $input['GrantRead'] ?? null;
@@ -685,6 +706,7 @@ public function __construct(array $input = [])
685706
* ChecksumSHA1?: null|string,
686707
* ChecksumSHA256?: null|string,
687708
* Expires?: null|\DateTimeImmutable|string,
709+
* IfMatch?: null|string,
688710
* IfNoneMatch?: null|string,
689711
* GrantFullControl?: null|string,
690712
* GrantRead?: null|string,
@@ -835,6 +857,11 @@ public function getGrantWriteAcp(): ?string
835857
return $this->grantWriteAcp;
836858
}
837859

860+
public function getIfMatch(): ?string
861+
{
862+
return $this->ifMatch;
863+
}
864+
838865
public function getIfNoneMatch(): ?string
839866
{
840867
return $this->ifNoneMatch;
@@ -993,6 +1020,9 @@ public function request(): Request
9931020
if (null !== $this->expires) {
9941021
$headers['Expires'] = $this->expires->setTimezone(new \DateTimeZone('GMT'))->format(\DateTimeInterface::RFC7231);
9951022
}
1023+
if (null !== $this->ifMatch) {
1024+
$headers['If-Match'] = $this->ifMatch;
1025+
}
9961026
if (null !== $this->ifNoneMatch) {
9971027
$headers['If-None-Match'] = $this->ifNoneMatch;
9981028
}
@@ -1262,6 +1292,13 @@ public function setGrantWriteAcp(?string $value): self
12621292
return $this;
12631293
}
12641294

1295+
public function setIfMatch(?string $value): self
1296+
{
1297+
$this->ifMatch = $value;
1298+
1299+
return $this;
1300+
}
1301+
12651302
public function setIfNoneMatch(?string $value): self
12661303
{
12671304
$this->ifNoneMatch = $value;

src/Service/S3/src/S3Client.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ public function bucketNotExists($input): BucketNotExistsWaiter
347347
* ChecksumSHA256?: null|string,
348348
* RequestPayer?: null|RequestPayer::*,
349349
* ExpectedBucketOwner?: null|string,
350+
* IfMatch?: null|string,
350351
* IfNoneMatch?: null|string,
351352
* SSECustomerAlgorithm?: null|string,
352353
* SSECustomerKey?: null|string,
@@ -2467,6 +2468,7 @@ public function putBucketTagging($input): Result
24672468
* ChecksumSHA1?: null|string,
24682469
* ChecksumSHA256?: null|string,
24692470
* Expires?: null|\DateTimeImmutable|string,
2471+
* IfMatch?: null|string,
24702472
* IfNoneMatch?: null|string,
24712473
* GrantFullControl?: null|string,
24722474
* GrantRead?: null|string,

0 commit comments

Comments
 (0)