Skip to content

Commit 552da3a

Browse files
Update generated code (#1710)
* update generated code * Fix test --------- Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
1 parent 887181f commit 552da3a

File tree

6 files changed

+81
-7
lines changed

6 files changed

+81
-7
lines changed

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: This release adds MessageSystemAttributeNames to ReceiveMessageRequest to replace AttributeNames.
8+
59
### Changed
610

711
- AWS enhancement: Documentation updates.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"extra": {
3030
"branch-alias": {
31-
"dev-master": "2.0-dev"
31+
"dev-master": "2.1-dev"
3232
}
3333
}
3434
}

src/Input/ReceiveMessageRequest.php

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,37 @@ final class ReceiveMessageRequest extends Input
2626
*/
2727
private $attributeNames;
2828

29+
/**
30+
* A list of attributes that need to be returned along with each message. These attributes include:
31+
*
32+
* - `All` – Returns all values.
33+
* - `ApproximateFirstReceiveTimestamp` – Returns the time the message was first received from the queue (epoch time
34+
* [^1] in milliseconds).
35+
* - `ApproximateReceiveCount` – Returns the number of times a message has been received across all queues but not
36+
* deleted.
37+
* - `AWSTraceHeader` – Returns the X-Ray trace header string.
38+
* - `SenderId`
39+
*
40+
* - For a user, returns the user ID, for example `ABCDEFGHI1JKLMNOPQ23R`.
41+
* - For an IAM role, returns the IAM role ID, for example `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
42+
*
43+
* - `SentTimestamp` – Returns the time the message was sent to the queue (epoch time [^2] in milliseconds).
44+
* - `SqsManagedSseEnabled` – Enables server-side queue encryption using SQS owned encryption keys. Only one
45+
* server-side encryption option is supported per queue (for example, SSE-KMS [^3] or SSE-SQS [^4]).
46+
* - `MessageDeduplicationId` – Returns the value provided by the producer that calls the `SendMessage` action.
47+
* - `MessageGroupId` – Returns the value provided by the producer that calls the `SendMessage` action. Messages with
48+
* the same `MessageGroupId` are returned in sequence.
49+
* - `SequenceNumber` – Returns the value provided by Amazon SQS.
50+
*
51+
* [^1]: http://en.wikipedia.org/wiki/Unix_time
52+
* [^2]: http://en.wikipedia.org/wiki/Unix_time
53+
* [^3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
54+
* [^4]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
55+
*
56+
* @var list<MessageSystemAttributeName::*>|null
57+
*/
58+
private $messageSystemAttributeNames;
59+
2960
/**
3061
* The name of the message attribute, where *N* is the index.
3162
*
@@ -62,7 +93,7 @@ final class ReceiveMessageRequest extends Input
6293
/**
6394
* The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a
6495
* message is available, the call returns sooner than `WaitTimeSeconds`. If no messages are available and the wait time
65-
* expires, the call returns successfully with an empty list of messages.
96+
* expires, the call does not return a message list.
6697
*
6798
* ! To avoid HTTP errors, ensure that the HTTP response timeout for `ReceiveMessage` requests is longer than the
6899
* ! `WaitTimeSeconds` parameter. For example, with the Java SDK, you can set HTTP transport settings using the
@@ -86,8 +117,6 @@ final class ReceiveMessageRequest extends Input
86117
* - You can use `ReceiveRequestAttemptId` only for 5 minutes after a `ReceiveMessage` action.
87118
* - When you set `FifoQueue`, a caller of the `ReceiveMessage` action can provide a `ReceiveRequestAttemptId`
88119
* explicitly.
89-
* - If a caller of the `ReceiveMessage` action doesn't provide a `ReceiveRequestAttemptId`, Amazon SQS generates a
90-
* `ReceiveRequestAttemptId`.
91120
* - It is possible to retry the `ReceiveMessage` action with the same `ReceiveRequestAttemptId` if none of the messages
92121
* have been modified (deleted or had their visibility changes).
93122
* - During a visibility timeout, subsequent calls with the same `ReceiveRequestAttemptId` return the same messages and
@@ -125,6 +154,7 @@ final class ReceiveMessageRequest extends Input
125154
* @param array{
126155
* QueueUrl?: string,
127156
* AttributeNames?: null|array<MessageSystemAttributeName::*>,
157+
* MessageSystemAttributeNames?: null|array<MessageSystemAttributeName::*>,
128158
* MessageAttributeNames?: null|string[],
129159
* MaxNumberOfMessages?: null|int,
130160
* VisibilityTimeout?: null|int,
@@ -137,6 +167,7 @@ public function __construct(array $input = [])
137167
{
138168
$this->queueUrl = $input['QueueUrl'] ?? null;
139169
$this->attributeNames = $input['AttributeNames'] ?? null;
170+
$this->messageSystemAttributeNames = $input['MessageSystemAttributeNames'] ?? null;
140171
$this->messageAttributeNames = $input['MessageAttributeNames'] ?? null;
141172
$this->maxNumberOfMessages = $input['MaxNumberOfMessages'] ?? null;
142173
$this->visibilityTimeout = $input['VisibilityTimeout'] ?? null;
@@ -149,6 +180,7 @@ public function __construct(array $input = [])
149180
* @param array{
150181
* QueueUrl?: string,
151182
* AttributeNames?: null|array<MessageSystemAttributeName::*>,
183+
* MessageSystemAttributeNames?: null|array<MessageSystemAttributeName::*>,
152184
* MessageAttributeNames?: null|string[],
153185
* MaxNumberOfMessages?: null|int,
154186
* VisibilityTimeout?: null|int,
@@ -163,10 +195,14 @@ public static function create($input): self
163195
}
164196

165197
/**
198+
* @deprecated
199+
*
166200
* @return list<MessageSystemAttributeName::*>
167201
*/
168202
public function getAttributeNames(): array
169203
{
204+
@trigger_error(sprintf('The property "AttributeNames" of "%s" is deprecated by AWS.', __CLASS__), \E_USER_DEPRECATED);
205+
170206
return $this->attributeNames ?? [];
171207
}
172208

@@ -183,6 +219,14 @@ public function getMessageAttributeNames(): array
183219
return $this->messageAttributeNames ?? [];
184220
}
185221

222+
/**
223+
* @return list<MessageSystemAttributeName::*>
224+
*/
225+
public function getMessageSystemAttributeNames(): array
226+
{
227+
return $this->messageSystemAttributeNames ?? [];
228+
}
229+
186230
public function getQueueUrl(): ?string
187231
{
188232
return $this->queueUrl;
@@ -229,10 +273,13 @@ public function request(): Request
229273
}
230274

231275
/**
276+
* @deprecated
277+
*
232278
* @param list<MessageSystemAttributeName::*> $value
233279
*/
234280
public function setAttributeNames(array $value): self
235281
{
282+
@trigger_error(sprintf('The property "AttributeNames" of "%s" is deprecated by AWS.', __CLASS__), \E_USER_DEPRECATED);
236283
$this->attributeNames = $value;
237284

238285
return $this;
@@ -255,6 +302,16 @@ public function setMessageAttributeNames(array $value): self
255302
return $this;
256303
}
257304

305+
/**
306+
* @param list<MessageSystemAttributeName::*> $value
307+
*/
308+
public function setMessageSystemAttributeNames(array $value): self
309+
{
310+
$this->messageSystemAttributeNames = $value;
311+
312+
return $this;
313+
}
314+
258315
public function setQueueUrl(?string $value): self
259316
{
260317
$this->queueUrl = $value;
@@ -291,6 +348,7 @@ private function requestBody(): array
291348
}
292349
$payload['QueueUrl'] = $v;
293350
if (null !== $v = $this->attributeNames) {
351+
@trigger_error(sprintf('The property "AttributeNames" of "%s" is deprecated by AWS.', __CLASS__), \E_USER_DEPRECATED);
294352
$index = -1;
295353
$payload['AttributeNames'] = [];
296354
foreach ($v as $listValue) {
@@ -301,6 +359,17 @@ private function requestBody(): array
301359
$payload['AttributeNames'][$index] = $listValue;
302360
}
303361
}
362+
if (null !== $v = $this->messageSystemAttributeNames) {
363+
$index = -1;
364+
$payload['MessageSystemAttributeNames'] = [];
365+
foreach ($v as $listValue) {
366+
++$index;
367+
if (!MessageSystemAttributeName::exists($listValue)) {
368+
throw new InvalidArgument(sprintf('Invalid parameter "MessageSystemAttributeNames" for "%s". The value "%s" is not a valid "MessageSystemAttributeName".', __CLASS__, $listValue));
369+
}
370+
$payload['MessageSystemAttributeNames'][$index] = $listValue;
371+
}
372+
}
304373
if (null !== $v = $this->messageAttributeNames) {
305374
$index = -1;
306375
$payload['MessageAttributeNames'] = [];

src/Input/SendMessageRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ final class SendMessageRequest extends Input
134134
* - `ReceiveMessage` might return messages with multiple `MessageGroupId` values. For each `MessageGroupId`, the
135135
* messages are sorted by time sent. The caller can't specify a `MessageGroupId`.
136136
*
137-
* The length of `MessageGroupId` is 128 characters. Valid values: alphanumeric characters and punctuation
137+
* The maximum length of `MessageGroupId` is 128 characters. Valid values: alphanumeric characters and punctuation
138138
* `(!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)`.
139139
*
140140
* For best practices of using `MessageGroupId`, see Using the MessageGroupId Property [^1] in the *Amazon SQS Developer

src/SqsClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ public function queueExists($input): QueueExistsWaiter
632632
* @param array{
633633
* QueueUrl: string,
634634
* AttributeNames?: null|array<MessageSystemAttributeName::*>,
635+
* MessageSystemAttributeNames?: null|array<MessageSystemAttributeName::*>,
635636
* MessageAttributeNames?: null|string[],
636637
* MaxNumberOfMessages?: null|int,
637638
* VisibilityTimeout?: null|int,

tests/Unit/Input/ReceiveMessageRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function testRequest(): void
1212
{
1313
$input = new ReceiveMessageRequest([
1414
'QueueUrl' => 'queueUrl',
15-
'AttributeNames' => [MessageSystemAttributeName::MESSAGE_GROUP_ID, MessageSystemAttributeName::MESSAGE_DEDUPLICATION_ID],
15+
'MessageSystemAttributeNames' => [MessageSystemAttributeName::MESSAGE_GROUP_ID, MessageSystemAttributeName::MESSAGE_DEDUPLICATION_ID],
1616
'MessageAttributeNames' => ['Attribute1'],
1717
'MaxNumberOfMessages' => 5,
1818
'VisibilityTimeout' => 15,
@@ -28,7 +28,7 @@ public function testRequest(): void
2828
2929
{
3030
"QueueUrl": "queueUrl",
31-
"AttributeNames": ["MessageGroupId", "MessageDeduplicationId"],
31+
"MessageSystemAttributeNames": ["MessageGroupId", "MessageDeduplicationId"],
3232
"MessageAttributeNames": ["Attribute1"],
3333
"MaxNumberOfMessages": 5,
3434
"VisibilityTimeout": 15,

0 commit comments

Comments
 (0)