Skip to content

Commit b625f34

Browse files
Update generated code (#1300)
* update generated code * Update src/Service/Sns/CHANGELOG.md Co-authored-by: Jérémy Derussé <[email protected]>
1 parent 7e6e31a commit b625f34

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
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: Added `fips-us-gov-east-1` and `fips-us-gov-west-1` regions
8+
- AWS api-change: Amazon SNS introduces the Data Protection Policy APIs, which enable customers to attach a data protection policy to an SNS topic. This allows topic owners to enable the new message data protection feature to audit and block sensitive data that is exchanged through their topics.
89

910
## 1.3.0
1011

src/Exception/ValidationException.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace AsyncAws\Sns\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
use Symfony\Contracts\HttpClient\ResponseInterface;
7+
8+
/**
9+
* Indicates that a parameter in the request is invalid.
10+
*/
11+
final class ValidationException extends ClientException
12+
{
13+
protected function populateResult(ResponseInterface $response): void
14+
{
15+
$data = new \SimpleXMLElement($response->getContent(false));
16+
if (0 < $data->Error->count()) {
17+
$data = $data->Error;
18+
}
19+
$this->message = (string) $data->message;
20+
}
21+
}

src/Input/CreateTopicInput.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,19 @@ final class CreateTopicInput extends Input
3636
*/
3737
private $tags;
3838

39+
/**
40+
* The body of the policy document you want to use for this topic.
41+
*
42+
* @var string|null
43+
*/
44+
private $dataProtectionPolicy;
45+
3946
/**
4047
* @param array{
4148
* Name?: string,
4249
* Attributes?: array<string, string>,
4350
* Tags?: Tag[],
51+
* DataProtectionPolicy?: string,
4452
* @region?: string,
4553
* } $input
4654
*/
@@ -49,6 +57,7 @@ public function __construct(array $input = [])
4957
$this->name = $input['Name'] ?? null;
5058
$this->attributes = $input['Attributes'] ?? null;
5159
$this->tags = isset($input['Tags']) ? array_map([Tag::class, 'create'], $input['Tags']) : null;
60+
$this->dataProtectionPolicy = $input['DataProtectionPolicy'] ?? null;
5261
parent::__construct($input);
5362
}
5463

@@ -65,6 +74,11 @@ public function getAttributes(): array
6574
return $this->attributes ?? [];
6675
}
6776

77+
public function getDataProtectionPolicy(): ?string
78+
{
79+
return $this->dataProtectionPolicy;
80+
}
81+
6882
public function getName(): ?string
6983
{
7084
return $this->name;
@@ -109,6 +123,13 @@ public function setAttributes(array $value): self
109123
return $this;
110124
}
111125

126+
public function setDataProtectionPolicy(?string $value): self
127+
{
128+
$this->dataProtectionPolicy = $value;
129+
130+
return $this;
131+
}
132+
112133
public function setName(?string $value): self
113134
{
114135
$this->name = $value;
@@ -150,6 +171,9 @@ private function requestBody(): array
150171
}
151172
}
152173
}
174+
if (null !== $v = $this->dataProtectionPolicy) {
175+
$payload['DataProtectionPolicy'] = $v;
176+
}
153177

154178
return $payload;
155179
}

src/SnsClient.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use AsyncAws\Sns\Exception\TagPolicyException;
3535
use AsyncAws\Sns\Exception\TooManyEntriesInBatchRequestException;
3636
use AsyncAws\Sns\Exception\TopicLimitExceededException;
37+
use AsyncAws\Sns\Exception\ValidationException;
3738
use AsyncAws\Sns\Input\CreatePlatformEndpointInput;
3839
use AsyncAws\Sns\Input\CreateTopicInput;
3940
use AsyncAws\Sns\Input\DeleteEndpointInput;
@@ -108,6 +109,7 @@ public function createPlatformEndpoint($input): CreateEndpointResponse
108109
* Name: string,
109110
* Attributes?: array<string, string>,
110111
* Tags?: Tag[],
112+
* DataProtectionPolicy?: string,
111113
* @region?: string,
112114
* }|CreateTopicInput $input
113115
*
@@ -271,6 +273,7 @@ public function listSubscriptionsByTopic($input): ListSubscriptionsByTopicRespon
271273
* @throws KMSThrottlingException
272274
* @throws KMSAccessDeniedException
273275
* @throws InvalidSecurityException
276+
* @throws ValidationException
274277
*/
275278
public function publish($input): PublishResponse
276279
{
@@ -290,6 +293,7 @@ public function publish($input): PublishResponse
290293
'KMSThrottling' => KMSThrottlingException::class,
291294
'KMSAccessDenied' => KMSAccessDeniedException::class,
292295
'InvalidSecurity' => InvalidSecurityException::class,
296+
'ValidationException' => ValidationException::class,
293297
]]));
294298

295299
return new PublishResponse($response);
@@ -328,6 +332,7 @@ public function publish($input): PublishResponse
328332
* @throws KMSThrottlingException
329333
* @throws KMSAccessDeniedException
330334
* @throws InvalidSecurityException
335+
* @throws ValidationException
331336
*/
332337
public function publishBatch($input): PublishBatchResponse
333338
{
@@ -352,6 +357,7 @@ public function publishBatch($input): PublishBatchResponse
352357
'KMSThrottling' => KMSThrottlingException::class,
353358
'KMSAccessDenied' => KMSAccessDeniedException::class,
354359
'InvalidSecurity' => InvalidSecurityException::class,
360+
'ValidationException' => ValidationException::class,
355361
]]));
356362

357363
return new PublishBatchResponse($response);

0 commit comments

Comments
 (0)