Skip to content

Commit e65dfe1

Browse files
Update generated code (#1107)
* update generated code * Fix psalm false report Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
1 parent 99deec9 commit e65dfe1

14 files changed

+227
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
### Added
1414

1515
- AWS api-change: Lambda Python 3.9 runtime launch
16+
- AWS api-change: Adds support for Lambda functions powered by AWS Graviton2 processors. Customers can now select the CPU architecture for their functions.
1617

1718
## 1.4.0
1819

src/Enum/Architecture.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\Enum;
4+
5+
final class Architecture
6+
{
7+
public const ARM64 = 'arm64';
8+
public const X86_64 = 'x86_64';
9+
10+
public static function exists(string $value): bool
11+
{
12+
return isset([
13+
self::ARM64 => true,
14+
self::X86_64 => true,
15+
][$value]);
16+
}
17+
}

src/Enum/LogType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace AsyncAws\Lambda\Enum;
44

55
/**
6-
* Set to `Tail` to include the execution log in the response.
6+
* Set to `Tail` to include the execution log in the response. Applies to synchronously invoked functions only.
77
*/
88
final class LogType
99
{

src/Exception/EFSIOException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Symfony\Contracts\HttpClient\ResponseInterface;
77

88
/**
9-
* An error occured when reading from or writing to a connected file system.
9+
* An error occurred when reading from or writing to a connected file system.
1010
*/
1111
final class EFSIOException extends ClientException
1212
{

src/Input/InvocationRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class InvocationRequest extends Input
2828
private $invocationType;
2929

3030
/**
31-
* Set to `Tail` to include the execution log in the response.
31+
* Set to `Tail` to include the execution log in the response. Applies to synchronously invoked functions only.
3232
*
3333
* @var LogType::*|null
3434
*/

src/Input/ListLayerVersionsRequest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AsyncAws\Core\Input;
77
use AsyncAws\Core\Request;
88
use AsyncAws\Core\Stream\StreamFactory;
9+
use AsyncAws\Lambda\Enum\Architecture;
910
use AsyncAws\Lambda\Enum\Runtime;
1011

1112
final class ListLayerVersionsRequest extends Input
@@ -40,12 +41,22 @@ final class ListLayerVersionsRequest extends Input
4041
*/
4142
private $maxItems;
4243

44+
/**
45+
* The compatible instruction set architecture.
46+
*
47+
* @see https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html
48+
*
49+
* @var Architecture::*|null
50+
*/
51+
private $compatibleArchitecture;
52+
4353
/**
4454
* @param array{
4555
* CompatibleRuntime?: Runtime::*,
4656
* LayerName?: string,
4757
* Marker?: string,
4858
* MaxItems?: int,
59+
* CompatibleArchitecture?: Architecture::*,
4960
* @region?: string,
5061
* } $input
5162
*/
@@ -55,6 +66,7 @@ public function __construct(array $input = [])
5566
$this->layerName = $input['LayerName'] ?? null;
5667
$this->marker = $input['Marker'] ?? null;
5768
$this->maxItems = $input['MaxItems'] ?? null;
69+
$this->compatibleArchitecture = $input['CompatibleArchitecture'] ?? null;
5870
parent::__construct($input);
5971
}
6072

@@ -63,6 +75,14 @@ public static function create($input): self
6375
return $input instanceof self ? $input : new self($input);
6476
}
6577

78+
/**
79+
* @return Architecture::*|null
80+
*/
81+
public function getCompatibleArchitecture(): ?string
82+
{
83+
return $this->compatibleArchitecture;
84+
}
85+
6686
/**
6787
* @return Runtime::*|null
6888
*/
@@ -108,6 +128,12 @@ public function request(): Request
108128
if (null !== $this->maxItems) {
109129
$query['MaxItems'] = (string) $this->maxItems;
110130
}
131+
if (null !== $this->compatibleArchitecture) {
132+
if (!Architecture::exists($this->compatibleArchitecture)) {
133+
throw new InvalidArgument(sprintf('Invalid parameter "CompatibleArchitecture" for "%s". The value "%s" is not a valid "Architecture".', __CLASS__, $this->compatibleArchitecture));
134+
}
135+
$query['CompatibleArchitecture'] = $this->compatibleArchitecture;
136+
}
111137

112138
// Prepare URI
113139
$uri = [];
@@ -124,6 +150,16 @@ public function request(): Request
124150
return new Request('GET', $uriString, $query, $headers, StreamFactory::create($body));
125151
}
126152

153+
/**
154+
* @param Architecture::*|null $value
155+
*/
156+
public function setCompatibleArchitecture(?string $value): self
157+
{
158+
$this->compatibleArchitecture = $value;
159+
160+
return $this;
161+
}
162+
127163
/**
128164
* @param Runtime::*|null $value
129165
*/

src/Input/PublishLayerVersionRequest.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AsyncAws\Core\Input;
77
use AsyncAws\Core\Request;
88
use AsyncAws\Core\Stream\StreamFactory;
9+
use AsyncAws\Lambda\Enum\Architecture;
910
use AsyncAws\Lambda\Enum\Runtime;
1011
use AsyncAws\Lambda\ValueObject\LayerVersionContentInput;
1112

@@ -52,13 +53,23 @@ final class PublishLayerVersionRequest extends Input
5253
*/
5354
private $licenseInfo;
5455

56+
/**
57+
* A list of compatible instruction set architectures.
58+
*
59+
* @see https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html
60+
*
61+
* @var list<Architecture::*>|null
62+
*/
63+
private $compatibleArchitectures;
64+
5565
/**
5666
* @param array{
5767
* LayerName?: string,
5868
* Description?: string,
5969
* Content?: LayerVersionContentInput|array,
6070
* CompatibleRuntimes?: list<Runtime::*>,
6171
* LicenseInfo?: string,
72+
* CompatibleArchitectures?: list<Architecture::*>,
6273
* @region?: string,
6374
* } $input
6475
*/
@@ -69,6 +80,7 @@ public function __construct(array $input = [])
6980
$this->content = isset($input['Content']) ? LayerVersionContentInput::create($input['Content']) : null;
7081
$this->compatibleRuntimes = $input['CompatibleRuntimes'] ?? null;
7182
$this->licenseInfo = $input['LicenseInfo'] ?? null;
83+
$this->compatibleArchitectures = $input['CompatibleArchitectures'] ?? null;
7284
parent::__construct($input);
7385
}
7486

@@ -77,6 +89,14 @@ public static function create($input): self
7789
return $input instanceof self ? $input : new self($input);
7890
}
7991

92+
/**
93+
* @return list<Architecture::*>
94+
*/
95+
public function getCompatibleArchitectures(): array
96+
{
97+
return $this->compatibleArchitectures ?? [];
98+
}
99+
80100
/**
81101
* @return list<Runtime::*>
82102
*/
@@ -132,6 +152,16 @@ public function request(): Request
132152
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));
133153
}
134154

155+
/**
156+
* @param list<Architecture::*> $value
157+
*/
158+
public function setCompatibleArchitectures(array $value): self
159+
{
160+
$this->compatibleArchitectures = $value;
161+
162+
return $this;
163+
}
164+
135165
/**
136166
* @param list<Runtime::*> $value
137167
*/
@@ -195,6 +225,17 @@ private function requestBody(): array
195225
if (null !== $v = $this->licenseInfo) {
196226
$payload['LicenseInfo'] = $v;
197227
}
228+
if (null !== $v = $this->compatibleArchitectures) {
229+
$index = -1;
230+
$payload['CompatibleArchitectures'] = [];
231+
foreach ($v as $listValue) {
232+
++$index;
233+
if (!Architecture::exists($listValue)) {
234+
throw new InvalidArgument(sprintf('Invalid parameter "CompatibleArchitectures" for "%s". The value "%s" is not a valid "Architecture".', __CLASS__, $listValue));
235+
}
236+
$payload['CompatibleArchitectures'][$index] = $listValue;
237+
}
238+
}
198239

199240
return $payload;
200241
}

src/LambdaClient.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use AsyncAws\Core\Configuration;
99
use AsyncAws\Core\RequestContext;
1010
use AsyncAws\Core\Result;
11+
use AsyncAws\Lambda\Enum\Architecture;
1112
use AsyncAws\Lambda\Enum\FunctionVersion;
1213
use AsyncAws\Lambda\Enum\InvocationType;
1314
use AsyncAws\Lambda\Enum\LogType;
@@ -247,7 +248,8 @@ public function listFunctions($input = []): ListFunctionsResponse
247248

248249
/**
249250
* Lists the versions of an Lambda layer. Versions that have been deleted aren't listed. Specify a runtime identifier to
250-
* list only versions that indicate that they're compatible with that runtime.
251+
* list only versions that indicate that they're compatible with that runtime. Specify a compatible architecture to
252+
* include only layer versions that are compatible with that architecture.
251253
*
252254
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
253255
* @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
@@ -259,6 +261,7 @@ public function listFunctions($input = []): ListFunctionsResponse
259261
* LayerName: string,
260262
* Marker?: string,
261263
* MaxItems?: int,
264+
* CompatibleArchitecture?: Architecture::*,
262265
* @region?: string,
263266
* }|ListLayerVersionsRequest $input
264267
*
@@ -327,6 +330,7 @@ public function listVersionsByFunction($input): ListVersionsByFunctionResponse
327330
* Content: LayerVersionContentInput|array,
328331
* CompatibleRuntimes?: list<Runtime::*>,
329332
* LicenseInfo?: string,
333+
* CompatibleArchitectures?: list<Architecture::*>,
330334
* @region?: string,
331335
* }|PublishLayerVersionRequest $input
332336
*

src/Result/ListFunctionsResponse.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use AsyncAws\Core\Exception\InvalidArgument;
66
use AsyncAws\Core\Response;
77
use AsyncAws\Core\Result;
8+
use AsyncAws\Lambda\Enum\Architecture;
89
use AsyncAws\Lambda\Input\ListFunctionsRequest;
910
use AsyncAws\Lambda\LambdaClient;
1011
use AsyncAws\Lambda\ValueObject\DeadLetterConfig;
@@ -105,6 +106,22 @@ protected function populateResult(Response $response): void
105106
$this->functions = empty($data['Functions']) ? [] : $this->populateResultFunctionList($data['Functions']);
106107
}
107108

109+
/**
110+
* @return list<Architecture::*>
111+
*/
112+
private function populateResultArchitecturesList(array $json): array
113+
{
114+
$items = [];
115+
foreach ($json as $item) {
116+
$a = isset($item) ? (string) $item : null;
117+
if (null !== $a) {
118+
$items[] = $a;
119+
}
120+
}
121+
122+
return $items;
123+
}
124+
108125
/**
109126
* @return array<string, string>
110127
*/
@@ -197,6 +214,7 @@ private function populateResultFunctionList(array $json): array
197214
]),
198215
'SigningProfileVersionArn' => isset($item['SigningProfileVersionArn']) ? (string) $item['SigningProfileVersionArn'] : null,
199216
'SigningJobArn' => isset($item['SigningJobArn']) ? (string) $item['SigningJobArn'] : null,
217+
'Architectures' => !isset($item['Architectures']) ? null : $this->populateResultArchitecturesList($item['Architectures']),
200218
]);
201219
}
202220

src/Result/ListLayerVersionsResponse.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use AsyncAws\Core\Exception\InvalidArgument;
66
use AsyncAws\Core\Response;
77
use AsyncAws\Core\Result;
8+
use AsyncAws\Lambda\Enum\Architecture;
89
use AsyncAws\Lambda\Enum\Runtime;
910
use AsyncAws\Lambda\Input\ListLayerVersionsRequest;
1011
use AsyncAws\Lambda\LambdaClient;
@@ -94,6 +95,22 @@ protected function populateResult(Response $response): void
9495
$this->layerVersions = empty($data['LayerVersions']) ? [] : $this->populateResultLayerVersionsList($data['LayerVersions']);
9596
}
9697

98+
/**
99+
* @return list<Architecture::*>
100+
*/
101+
private function populateResultCompatibleArchitectures(array $json): array
102+
{
103+
$items = [];
104+
foreach ($json as $item) {
105+
$a = isset($item) ? (string) $item : null;
106+
if (null !== $a) {
107+
$items[] = $a;
108+
}
109+
}
110+
111+
return $items;
112+
}
113+
97114
/**
98115
* @return list<Runtime::*>
99116
*/
@@ -124,6 +141,7 @@ private function populateResultLayerVersionsList(array $json): array
124141
'CreatedDate' => isset($item['CreatedDate']) ? (string) $item['CreatedDate'] : null,
125142
'CompatibleRuntimes' => !isset($item['CompatibleRuntimes']) ? null : $this->populateResultCompatibleRuntimes($item['CompatibleRuntimes']),
126143
'LicenseInfo' => isset($item['LicenseInfo']) ? (string) $item['LicenseInfo'] : null,
144+
'CompatibleArchitectures' => !isset($item['CompatibleArchitectures']) ? null : $this->populateResultCompatibleArchitectures($item['CompatibleArchitectures']),
127145
]);
128146
}
129147

src/Result/ListVersionsByFunctionResponse.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use AsyncAws\Core\Exception\InvalidArgument;
66
use AsyncAws\Core\Response;
77
use AsyncAws\Core\Result;
8+
use AsyncAws\Lambda\Enum\Architecture;
89
use AsyncAws\Lambda\Input\ListVersionsByFunctionRequest;
910
use AsyncAws\Lambda\LambdaClient;
1011
use AsyncAws\Lambda\ValueObject\DeadLetterConfig;
@@ -103,6 +104,22 @@ protected function populateResult(Response $response): void
103104
$this->versions = empty($data['Versions']) ? [] : $this->populateResultFunctionList($data['Versions']);
104105
}
105106

107+
/**
108+
* @return list<Architecture::*>
109+
*/
110+
private function populateResultArchitecturesList(array $json): array
111+
{
112+
$items = [];
113+
foreach ($json as $item) {
114+
$a = isset($item) ? (string) $item : null;
115+
if (null !== $a) {
116+
$items[] = $a;
117+
}
118+
}
119+
120+
return $items;
121+
}
122+
106123
/**
107124
* @return array<string, string>
108125
*/
@@ -195,6 +212,7 @@ private function populateResultFunctionList(array $json): array
195212
]),
196213
'SigningProfileVersionArn' => isset($item['SigningProfileVersionArn']) ? (string) $item['SigningProfileVersionArn'] : null,
197214
'SigningJobArn' => isset($item['SigningJobArn']) ? (string) $item['SigningJobArn'] : null,
215+
'Architectures' => !isset($item['Architectures']) ? null : $this->populateResultArchitecturesList($item['Architectures']),
198216
]);
199217
}
200218

0 commit comments

Comments
 (0)