Skip to content

Commit 7b9cbfd

Browse files
Update generated code (#1806)
update generated code
1 parent 409f70c commit 7b9cbfd

11 files changed

+328
-21
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: Add support for the new optional bucket-region and prefix query parameters in the ListBuckets API. For ListBuckets requests that express pagination, Amazon S3 will now return both the bucket names and associated AWS regions in the response.
8+
- AWS api-change: Add support for conditional deletes for the S3 DeleteObject and DeleteObjects APIs. Add support for write offset bytes option used to append to objects with the S3 PutObject API.
89

910
### Changed
1011

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace AsyncAws\S3\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* The existing object was created with a different encryption type. Subsequent write requests must include the
9+
* appropriate encryption parameters in the request or while creating the session.
10+
*/
11+
final class EncryptionTypeMismatchException extends ClientException
12+
{
13+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace AsyncAws\S3\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* You may receive this error in multiple cases. Depending on the reason for the error, you may receive one of the
9+
* messages below:
10+
*
11+
* - Cannot specify both a write offset value and user-defined object metadata for existing objects.
12+
* - Checksum Type mismatch occurred, expected checksum Type: sha1, actual checksum Type: crc32c.
13+
* - Request body cannot be empty when 'write offset' is specified.
14+
*/
15+
final class InvalidRequestException extends ClientException
16+
{
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\S3\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* The write offset value that you specified does not match the current object size.
9+
*/
10+
final class InvalidWriteOffsetException extends ClientException
11+
{
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace AsyncAws\S3\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* You have attempted to add more parts than the maximum of 10000 that are allowed for this object. You can use the
9+
* CopyObject operation to copy this object to another and then add more data to the newly copied object.
10+
*/
11+
final class TooManyPartsException extends ClientException
12+
{
13+
}

src/Input/AbortMultipartUploadRequest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,26 @@ final class AbortMultipartUploadRequest extends Input
7575
*/
7676
private $expectedBucketOwner;
7777

78+
/**
79+
* If present, this header aborts an in progress multipart upload only if it was initiated on the provided timestamp. If
80+
* the initiated timestamp of the multipart upload does not match the provided value, the operation returns a `412
81+
* Precondition Failed` error. If the initiated timestamp matches or if the multipart upload doesn’t exist, the
82+
* operation returns a `204 Success (No Content)` response.
83+
*
84+
* > This functionality is only supported for directory buckets.
85+
*
86+
* @var \DateTimeImmutable|null
87+
*/
88+
private $ifMatchInitiatedTime;
89+
7890
/**
7991
* @param array{
8092
* Bucket?: string,
8193
* Key?: string,
8294
* UploadId?: string,
8395
* RequestPayer?: null|RequestPayer::*,
8496
* ExpectedBucketOwner?: null|string,
97+
* IfMatchInitiatedTime?: null|\DateTimeImmutable|string,
8598
* '@region'?: string|null,
8699
* } $input
87100
*/
@@ -92,6 +105,7 @@ public function __construct(array $input = [])
92105
$this->uploadId = $input['UploadId'] ?? null;
93106
$this->requestPayer = $input['RequestPayer'] ?? null;
94107
$this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null;
108+
$this->ifMatchInitiatedTime = !isset($input['IfMatchInitiatedTime']) ? null : ($input['IfMatchInitiatedTime'] instanceof \DateTimeImmutable ? $input['IfMatchInitiatedTime'] : new \DateTimeImmutable($input['IfMatchInitiatedTime']));
95109
parent::__construct($input);
96110
}
97111

@@ -102,6 +116,7 @@ public function __construct(array $input = [])
102116
* UploadId?: string,
103117
* RequestPayer?: null|RequestPayer::*,
104118
* ExpectedBucketOwner?: null|string,
119+
* IfMatchInitiatedTime?: null|\DateTimeImmutable|string,
105120
* '@region'?: string|null,
106121
* }|AbortMultipartUploadRequest $input
107122
*/
@@ -120,6 +135,11 @@ public function getExpectedBucketOwner(): ?string
120135
return $this->expectedBucketOwner;
121136
}
122137

138+
public function getIfMatchInitiatedTime(): ?\DateTimeImmutable
139+
{
140+
return $this->ifMatchInitiatedTime;
141+
}
142+
123143
public function getKey(): ?string
124144
{
125145
return $this->key;
@@ -154,6 +174,9 @@ public function request(): Request
154174
if (null !== $this->expectedBucketOwner) {
155175
$headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner;
156176
}
177+
if (null !== $this->ifMatchInitiatedTime) {
178+
$headers['x-amz-if-match-initiated-time'] = $this->ifMatchInitiatedTime->setTimezone(new \DateTimeZone('GMT'))->format(\DateTimeInterface::RFC7231);
179+
}
157180

158181
// Prepare query
159182
$query = [];
@@ -195,6 +218,13 @@ public function setExpectedBucketOwner(?string $value): self
195218
return $this;
196219
}
197220

221+
public function setIfMatchInitiatedTime(?\DateTimeImmutable $value): self
222+
{
223+
$this->ifMatchInitiatedTime = $value;
224+
225+
return $this;
226+
}
227+
198228
public function setKey(?string $value): self
199229
{
200230
$this->key = $value;

src/Input/DeleteObjectRequest.php

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,46 @@ final class DeleteObjectRequest extends Input
9696
*/
9797
private $expectedBucketOwner;
9898

99+
/**
100+
* The `If-Match` header field makes the request method conditional on ETags. If the ETag value does not match, the
101+
* operation returns a `412 Precondition Failed` error. If the ETag matches or if the object doesn't exist, the
102+
* operation will return a `204 Success (No Content) response`.
103+
*
104+
* For more information about conditional requests, see RFC 7232 [^1].
105+
*
106+
* > This functionality is only supported for directory buckets.
107+
*
108+
* [^1]: https://docs.aws.amazon.com/https:/tools.ietf.org/html/rfc7232
109+
*
110+
* @var string|null
111+
*/
112+
private $ifMatch;
113+
114+
/**
115+
* If present, the object is deleted only if its modification times matches the provided `Timestamp`. If the `Timestamp`
116+
* values do not match, the operation returns a `412 Precondition Failed` error. If the `Timestamp` matches or if the
117+
* object doesn’t exist, the operation returns a `204 Success (No Content)` response.
118+
*
119+
* > This functionality is only supported for directory buckets.
120+
*
121+
* @var \DateTimeImmutable|null
122+
*/
123+
private $ifMatchLastModifiedTime;
124+
125+
/**
126+
* If present, the object is deleted only if its size matches the provided size in bytes. If the `Size` value does not
127+
* match, the operation returns a `412 Precondition Failed` error. If the `Size` matches or if the object doesn’t
128+
* exist, the operation returns a `204 Success (No Content)` response.
129+
*
130+
* > This functionality is only supported for directory buckets.
131+
*
132+
* ! You can use the `If-Match`, `x-amz-if-match-last-modified-time` and `x-amz-if-match-size` conditional headers in
133+
* ! conjunction with each-other or individually.
134+
*
135+
* @var int|null
136+
*/
137+
private $ifMatchSize;
138+
99139
/**
100140
* @param array{
101141
* Bucket?: string,
@@ -105,6 +145,9 @@ final class DeleteObjectRequest extends Input
105145
* RequestPayer?: null|RequestPayer::*,
106146
* BypassGovernanceRetention?: null|bool,
107147
* ExpectedBucketOwner?: null|string,
148+
* IfMatch?: null|string,
149+
* IfMatchLastModifiedTime?: null|\DateTimeImmutable|string,
150+
* IfMatchSize?: null|int,
108151
* '@region'?: string|null,
109152
* } $input
110153
*/
@@ -117,6 +160,9 @@ public function __construct(array $input = [])
117160
$this->requestPayer = $input['RequestPayer'] ?? null;
118161
$this->bypassGovernanceRetention = $input['BypassGovernanceRetention'] ?? null;
119162
$this->expectedBucketOwner = $input['ExpectedBucketOwner'] ?? null;
163+
$this->ifMatch = $input['IfMatch'] ?? null;
164+
$this->ifMatchLastModifiedTime = !isset($input['IfMatchLastModifiedTime']) ? null : ($input['IfMatchLastModifiedTime'] instanceof \DateTimeImmutable ? $input['IfMatchLastModifiedTime'] : new \DateTimeImmutable($input['IfMatchLastModifiedTime']));
165+
$this->ifMatchSize = $input['IfMatchSize'] ?? null;
120166
parent::__construct($input);
121167
}
122168

@@ -129,6 +175,9 @@ public function __construct(array $input = [])
129175
* RequestPayer?: null|RequestPayer::*,
130176
* BypassGovernanceRetention?: null|bool,
131177
* ExpectedBucketOwner?: null|string,
178+
* IfMatch?: null|string,
179+
* IfMatchLastModifiedTime?: null|\DateTimeImmutable|string,
180+
* IfMatchSize?: null|int,
132181
* '@region'?: string|null,
133182
* }|DeleteObjectRequest $input
134183
*/
@@ -152,6 +201,21 @@ public function getExpectedBucketOwner(): ?string
152201
return $this->expectedBucketOwner;
153202
}
154203

204+
public function getIfMatch(): ?string
205+
{
206+
return $this->ifMatch;
207+
}
208+
209+
public function getIfMatchLastModifiedTime(): ?\DateTimeImmutable
210+
{
211+
return $this->ifMatchLastModifiedTime;
212+
}
213+
214+
public function getIfMatchSize(): ?int
215+
{
216+
return $this->ifMatchSize;
217+
}
218+
155219
public function getKey(): ?string
156220
{
157221
return $this->key;
@@ -197,6 +261,15 @@ public function request(): Request
197261
if (null !== $this->expectedBucketOwner) {
198262
$headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner;
199263
}
264+
if (null !== $this->ifMatch) {
265+
$headers['If-Match'] = $this->ifMatch;
266+
}
267+
if (null !== $this->ifMatchLastModifiedTime) {
268+
$headers['x-amz-if-match-last-modified-time'] = $this->ifMatchLastModifiedTime->setTimezone(new \DateTimeZone('GMT'))->format(\DateTimeInterface::RFC7231);
269+
}
270+
if (null !== $this->ifMatchSize) {
271+
$headers['x-amz-if-match-size'] = (string) $this->ifMatchSize;
272+
}
200273

201274
// Prepare query
202275
$query = [];
@@ -244,6 +317,27 @@ public function setExpectedBucketOwner(?string $value): self
244317
return $this;
245318
}
246319

320+
public function setIfMatch(?string $value): self
321+
{
322+
$this->ifMatch = $value;
323+
324+
return $this;
325+
}
326+
327+
public function setIfMatchLastModifiedTime(?\DateTimeImmutable $value): self
328+
{
329+
$this->ifMatchLastModifiedTime = $value;
330+
331+
return $this;
332+
}
333+
334+
public function setIfMatchSize(?int $value): self
335+
{
336+
$this->ifMatchSize = $value;
337+
338+
return $this;
339+
}
340+
247341
public function setKey(?string $value): self
248342
{
249343
$this->key = $value;

src/Input/PutObjectRequest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,17 @@ final class PutObjectRequest extends Input
323323
*/
324324
private $key;
325325

326+
/**
327+
* Specifies the offset for appending data to existing objects in bytes. The offset must be equal to the size of the
328+
* existing object being appended to. If no object exists, setting this header to 0 will create a new object.
329+
*
330+
* > This functionality is only supported for objects in the Amazon S3 Express One Zone storage class in directory
331+
* > buckets.
332+
*
333+
* @var int|null
334+
*/
335+
private $writeOffsetBytes;
336+
326337
/**
327338
* A map of metadata to store with the object in S3.
328339
*
@@ -592,6 +603,7 @@ final class PutObjectRequest extends Input
592603
* GrantReadACP?: null|string,
593604
* GrantWriteACP?: null|string,
594605
* Key?: string,
606+
* WriteOffsetBytes?: null|int,
595607
* Metadata?: null|array<string, string>,
596608
* ServerSideEncryption?: null|ServerSideEncryption::*,
597609
* StorageClass?: null|StorageClass::*,
@@ -635,6 +647,7 @@ public function __construct(array $input = [])
635647
$this->grantReadAcp = $input['GrantReadACP'] ?? null;
636648
$this->grantWriteAcp = $input['GrantWriteACP'] ?? null;
637649
$this->key = $input['Key'] ?? null;
650+
$this->writeOffsetBytes = $input['WriteOffsetBytes'] ?? null;
638651
$this->metadata = $input['Metadata'] ?? null;
639652
$this->serverSideEncryption = $input['ServerSideEncryption'] ?? null;
640653
$this->storageClass = $input['StorageClass'] ?? null;
@@ -678,6 +691,7 @@ public function __construct(array $input = [])
678691
* GrantReadACP?: null|string,
679692
* GrantWriteACP?: null|string,
680693
* Key?: string,
694+
* WriteOffsetBytes?: null|int,
681695
* Metadata?: null|array<string, string>,
682696
* ServerSideEncryption?: null|ServerSideEncryption::*,
683697
* StorageClass?: null|StorageClass::*,
@@ -919,6 +933,11 @@ public function getWebsiteRedirectLocation(): ?string
919933
return $this->websiteRedirectLocation;
920934
}
921935

936+
public function getWriteOffsetBytes(): ?int
937+
{
938+
return $this->writeOffsetBytes;
939+
}
940+
922941
/**
923942
* @internal
924943
*/
@@ -989,6 +1008,9 @@ public function request(): Request
9891008
if (null !== $this->grantWriteAcp) {
9901009
$headers['x-amz-grant-write-acp'] = $this->grantWriteAcp;
9911010
}
1011+
if (null !== $this->writeOffsetBytes) {
1012+
$headers['x-amz-write-offset-bytes'] = (string) $this->writeOffsetBytes;
1013+
}
9921014
if (null !== $this->serverSideEncryption) {
9931015
if (!ServerSideEncryption::exists($this->serverSideEncryption)) {
9941016
throw new InvalidArgument(\sprintf('Invalid parameter "ServerSideEncryption" for "%s". The value "%s" is not a valid "ServerSideEncryption".', __CLASS__, $this->serverSideEncryption));
@@ -1369,4 +1391,11 @@ public function setWebsiteRedirectLocation(?string $value): self
13691391

13701392
return $this;
13711393
}
1394+
1395+
public function setWriteOffsetBytes(?int $value): self
1396+
{
1397+
$this->writeOffsetBytes = $value;
1398+
1399+
return $this;
1400+
}
13721401
}

0 commit comments

Comments
 (0)