Skip to content

Commit cc963de

Browse files
Update generated code (#1364)
* update generated code * Apply suggestions from code review Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
1 parent 1d431a9 commit cc963de

File tree

9 files changed

+149
-2
lines changed

9 files changed

+149
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
### Added
66

77
- AWS enhancement: Documentation updates.
8+
- AWS api-change: Release Lambda RuntimeManagementConfig, enabling customers to better manage runtime updates to their Lambda functions. This release adds two new APIs, GetRuntimeManagementConfig and PutRuntimeManagementConfig, as well as support on existing Create/Get/Update function APIs.
9+
- AWS api-change: Added `ap-southeast-4` region.
810

911
## 1.8.0
1012

src/Exception/SnapStartException.php

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

88
/**
9-
* The runtime restore hook encountered an error. For more information, check the Amazon CloudWatch logs.
9+
* The `afterRestore()`runtime hook encountered an error. For more information, check the Amazon CloudWatch logs.
10+
*
11+
* @see https://docs.aws.amazon.com/lambda/latest/dg/snapstart-runtime-hooks.html
1012
*/
1113
final class SnapStartException extends ClientException
1214
{

src/Exception/SnapStartTimeoutException.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-
* The runtime restore hook failed to complete within the timeout limit (2 seconds).
9+
* Lambda couldn't restore the snapshot within the timeout limit.
1010
*/
1111
final class SnapStartTimeoutException extends ClientException
1212
{

src/LambdaClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ protected function getEndpointMetadata(?string $region): array
393393
case 'ap-southeast-1':
394394
case 'ap-southeast-2':
395395
case 'ap-southeast-3':
396+
case 'ap-southeast-4':
396397
case 'ca-central-1':
397398
case 'eu-central-1':
398399
case 'eu-central-2':

src/Result/ListFunctionsResponse.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use AsyncAws\Lambda\ValueObject\ImageConfigError;
1919
use AsyncAws\Lambda\ValueObject\ImageConfigResponse;
2020
use AsyncAws\Lambda\ValueObject\Layer;
21+
use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig;
22+
use AsyncAws\Lambda\ValueObject\RuntimeVersionError;
2123
use AsyncAws\Lambda\ValueObject\SnapStartResponse;
2224
use AsyncAws\Lambda\ValueObject\TracingConfigResponse;
2325
use AsyncAws\Lambda\ValueObject\VpcConfigResponse;
@@ -225,6 +227,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi
225227
'Architectures' => !isset($json['Architectures']) ? null : $this->populateResultArchitecturesList($json['Architectures']),
226228
'EphemeralStorage' => empty($json['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($json['EphemeralStorage']),
227229
'SnapStart' => empty($json['SnapStart']) ? null : $this->populateResultSnapStartResponse($json['SnapStart']),
230+
'RuntimeVersionConfig' => empty($json['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($json['RuntimeVersionConfig']),
228231
]);
229232
}
230233

@@ -289,6 +292,22 @@ private function populateResultLayersReferenceList(array $json): array
289292
return $items;
290293
}
291294

295+
private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig
296+
{
297+
return new RuntimeVersionConfig([
298+
'RuntimeVersionArn' => isset($json['RuntimeVersionArn']) ? (string) $json['RuntimeVersionArn'] : null,
299+
'Error' => empty($json['Error']) ? null : $this->populateResultRuntimeVersionError($json['Error']),
300+
]);
301+
}
302+
303+
private function populateResultRuntimeVersionError(array $json): RuntimeVersionError
304+
{
305+
return new RuntimeVersionError([
306+
'ErrorCode' => isset($json['ErrorCode']) ? (string) $json['ErrorCode'] : null,
307+
'Message' => isset($json['Message']) ? (string) $json['Message'] : null,
308+
]);
309+
}
310+
292311
/**
293312
* @return string[]
294313
*/

src/Result/ListVersionsByFunctionResponse.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use AsyncAws\Lambda\ValueObject\ImageConfigError;
1919
use AsyncAws\Lambda\ValueObject\ImageConfigResponse;
2020
use AsyncAws\Lambda\ValueObject\Layer;
21+
use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig;
22+
use AsyncAws\Lambda\ValueObject\RuntimeVersionError;
2123
use AsyncAws\Lambda\ValueObject\SnapStartResponse;
2224
use AsyncAws\Lambda\ValueObject\TracingConfigResponse;
2325
use AsyncAws\Lambda\ValueObject\VpcConfigResponse;
@@ -223,6 +225,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi
223225
'Architectures' => !isset($json['Architectures']) ? null : $this->populateResultArchitecturesList($json['Architectures']),
224226
'EphemeralStorage' => empty($json['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($json['EphemeralStorage']),
225227
'SnapStart' => empty($json['SnapStart']) ? null : $this->populateResultSnapStartResponse($json['SnapStart']),
228+
'RuntimeVersionConfig' => empty($json['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($json['RuntimeVersionConfig']),
226229
]);
227230
}
228231

@@ -287,6 +290,22 @@ private function populateResultLayersReferenceList(array $json): array
287290
return $items;
288291
}
289292

293+
private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig
294+
{
295+
return new RuntimeVersionConfig([
296+
'RuntimeVersionArn' => isset($json['RuntimeVersionArn']) ? (string) $json['RuntimeVersionArn'] : null,
297+
'Error' => empty($json['Error']) ? null : $this->populateResultRuntimeVersionError($json['Error']),
298+
]);
299+
}
300+
301+
private function populateResultRuntimeVersionError(array $json): RuntimeVersionError
302+
{
303+
return new RuntimeVersionError([
304+
'ErrorCode' => isset($json['ErrorCode']) ? (string) $json['ErrorCode'] : null,
305+
'Message' => isset($json['Message']) ? (string) $json['Message'] : null,
306+
]);
307+
}
308+
290309
/**
291310
* @return string[]
292311
*/

src/ValueObject/FunctionConfiguration.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ final class FunctionConfiguration
201201
*/
202202
private $snapStart;
203203

204+
/**
205+
* The ARN of the runtime and any errors that occured.
206+
*/
207+
private $runtimeVersionConfig;
208+
204209
/**
205210
* @param array{
206211
* FunctionName?: null|string,
@@ -237,6 +242,7 @@ final class FunctionConfiguration
237242
* Architectures?: null|list<Architecture::*>,
238243
* EphemeralStorage?: null|EphemeralStorage|array,
239244
* SnapStart?: null|SnapStartResponse|array,
245+
* RuntimeVersionConfig?: null|RuntimeVersionConfig|array,
240246
* } $input
241247
*/
242248
public function __construct(array $input)
@@ -275,6 +281,7 @@ public function __construct(array $input)
275281
$this->architectures = $input['Architectures'] ?? null;
276282
$this->ephemeralStorage = isset($input['EphemeralStorage']) ? EphemeralStorage::create($input['EphemeralStorage']) : null;
277283
$this->snapStart = isset($input['SnapStart']) ? SnapStartResponse::create($input['SnapStart']) : null;
284+
$this->runtimeVersionConfig = isset($input['RuntimeVersionConfig']) ? RuntimeVersionConfig::create($input['RuntimeVersionConfig']) : null;
278285
}
279286

280287
public static function create($input): self
@@ -423,6 +430,11 @@ public function getRuntime(): ?string
423430
return $this->runtime;
424431
}
425432

433+
public function getRuntimeVersionConfig(): ?RuntimeVersionConfig
434+
{
435+
return $this->runtimeVersionConfig;
436+
}
437+
426438
public function getSigningJobArn(): ?string
427439
{
428440
return $this->signingJobArn;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\ValueObject;
4+
5+
/**
6+
* The ARN of the runtime and any errors that occured.
7+
*/
8+
final class RuntimeVersionConfig
9+
{
10+
/**
11+
* The ARN of the runtime version you want the function to use.
12+
*/
13+
private $runtimeVersionArn;
14+
15+
/**
16+
* Error response when Lambda is unable to retrieve the runtime version for a function.
17+
*/
18+
private $error;
19+
20+
/**
21+
* @param array{
22+
* RuntimeVersionArn?: null|string,
23+
* Error?: null|RuntimeVersionError|array,
24+
* } $input
25+
*/
26+
public function __construct(array $input)
27+
{
28+
$this->runtimeVersionArn = $input['RuntimeVersionArn'] ?? null;
29+
$this->error = isset($input['Error']) ? RuntimeVersionError::create($input['Error']) : null;
30+
}
31+
32+
public static function create($input): self
33+
{
34+
return $input instanceof self ? $input : new self($input);
35+
}
36+
37+
public function getError(): ?RuntimeVersionError
38+
{
39+
return $this->error;
40+
}
41+
42+
public function getRuntimeVersionArn(): ?string
43+
{
44+
return $this->runtimeVersionArn;
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace AsyncAws\Lambda\ValueObject;
4+
5+
/**
6+
* Error response when Lambda is unable to retrieve the runtime version for a function.
7+
*/
8+
final class RuntimeVersionError
9+
{
10+
/**
11+
* The error code.
12+
*/
13+
private $errorCode;
14+
15+
/**
16+
* The error message.
17+
*/
18+
private $message;
19+
20+
/**
21+
* @param array{
22+
* ErrorCode?: null|string,
23+
* Message?: null|string,
24+
* } $input
25+
*/
26+
public function __construct(array $input)
27+
{
28+
$this->errorCode = $input['ErrorCode'] ?? null;
29+
$this->message = $input['Message'] ?? null;
30+
}
31+
32+
public static function create($input): self
33+
{
34+
return $input instanceof self ? $input : new self($input);
35+
}
36+
37+
public function getErrorCode(): ?string
38+
{
39+
return $this->errorCode;
40+
}
41+
42+
public function getMessage(): ?string
43+
{
44+
return $this->message;
45+
}
46+
}

0 commit comments

Comments
 (0)