From 9cab4641d077b99ffac9ff29ec1661160900a0aa Mon Sep 17 00:00:00 2001 From: AsyncAws <61784373+async-aws-bot@users.noreply.github.com> Date: Thu, 23 Nov 2023 02:05:42 -0800 Subject: [PATCH] Update generated code (#1601) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update generated code * Disable tests using fakesqs * Update SQS test to be compatible with JSON API --------- Co-authored-by: Jérémy Derussé --- CHANGELOG.md | 5 + src/Enum/ApplicationLogLevel.php | 25 ++++ src/Enum/LogFormat.php | 17 +++ src/Enum/Runtime.php | 8 ++ src/Enum/SystemLogLevel.php | 19 +++ .../UpdateFunctionConfigurationRequest.php | 26 ++++ src/LambdaClient.php | 8 +- src/Result/FunctionConfiguration.php | 26 ++++ src/Result/ListFunctionsResponse.php | 12 ++ src/Result/ListVersionsByFunctionResponse.php | 12 ++ src/ValueObject/FunctionConfiguration.php | 15 ++ src/ValueObject/LoggingConfig.php | 136 ++++++++++++++++++ 12 files changed, 307 insertions(+), 2 deletions(-) create mode 100644 src/Enum/ApplicationLogLevel.php create mode 100644 src/Enum/LogFormat.php create mode 100644 src/Enum/SystemLogLevel.php create mode 100644 src/ValueObject/LoggingConfig.php diff --git a/CHANGELOG.md b/CHANGELOG.md index a64d1d8..ce759f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ ### Added - AWS api-change: Adds support for Lambda functions to access Dual-Stack subnets over IPv6, via an opt-in flag in CreateFunction and UpdateFunctionConfiguration APIs +- AWS api-change: Adds support for logging configuration in Lambda Functions. Customers will have more control how their function logs are captured and to which cloud watch log group they are delivered also. +- AWS api-change: Add Java 21 (java21) support to AWS Lambda +- AWS api-change: Add Python 3.12 (python3.12) support to AWS Lambda +- AWS api-change: Add Custom runtime on Amazon Linux 2023 (provided.al2023) support to AWS Lambda. +- AWS api-change: Add Node 20 (nodejs20.x) support to AWS Lambda. ## 2.1.0 diff --git a/src/Enum/ApplicationLogLevel.php b/src/Enum/ApplicationLogLevel.php new file mode 100644 index 0000000..2ee1013 --- /dev/null +++ b/src/Enum/ApplicationLogLevel.php @@ -0,0 +1,25 @@ + true, + self::ERROR => true, + self::FATAL => true, + self::INFO => true, + self::TRACE => true, + self::WARN => true, + ][$value]); + } +} diff --git a/src/Enum/LogFormat.php b/src/Enum/LogFormat.php new file mode 100644 index 0000000..ed250cd --- /dev/null +++ b/src/Enum/LogFormat.php @@ -0,0 +1,17 @@ + true, + self::TEXT => true, + ][$value]); + } +} diff --git a/src/Enum/Runtime.php b/src/Enum/Runtime.php index 2d86825..49cc525 100644 --- a/src/Enum/Runtime.php +++ b/src/Enum/Runtime.php @@ -12,6 +12,7 @@ final class Runtime public const GO_1_X = 'go1.x'; public const JAVA_11 = 'java11'; public const JAVA_17 = 'java17'; + public const JAVA_21 = 'java21'; public const JAVA_8 = 'java8'; public const JAVA_8_AL_2 = 'java8.al2'; public const NODEJS = 'nodejs'; @@ -20,15 +21,18 @@ final class Runtime public const NODEJS_14_X = 'nodejs14.x'; public const NODEJS_16_X = 'nodejs16.x'; public const NODEJS_18_X = 'nodejs18.x'; + public const NODEJS_20_X = 'nodejs20.x'; public const NODEJS_4_3 = 'nodejs4.3'; public const NODEJS_4_3_EDGE = 'nodejs4.3-edge'; public const NODEJS_6_10 = 'nodejs6.10'; public const NODEJS_8_10 = 'nodejs8.10'; public const PROVIDED = 'provided'; public const PROVIDED_AL_2 = 'provided.al2'; + public const PROVIDED_AL_2023 = 'provided.al2023'; public const PYTHON_2_7 = 'python2.7'; public const PYTHON_3_10 = 'python3.10'; public const PYTHON_3_11 = 'python3.11'; + public const PYTHON_3_12 = 'python3.12'; public const PYTHON_3_6 = 'python3.6'; public const PYTHON_3_7 = 'python3.7'; public const PYTHON_3_8 = 'python3.8'; @@ -48,6 +52,7 @@ public static function exists(string $value): bool self::GO_1_X => true, self::JAVA_11 => true, self::JAVA_17 => true, + self::JAVA_21 => true, self::JAVA_8 => true, self::JAVA_8_AL_2 => true, self::NODEJS => true, @@ -56,15 +61,18 @@ public static function exists(string $value): bool self::NODEJS_14_X => true, self::NODEJS_16_X => true, self::NODEJS_18_X => true, + self::NODEJS_20_X => true, self::NODEJS_4_3 => true, self::NODEJS_4_3_EDGE => true, self::NODEJS_6_10 => true, self::NODEJS_8_10 => true, self::PROVIDED => true, self::PROVIDED_AL_2 => true, + self::PROVIDED_AL_2023 => true, self::PYTHON_2_7 => true, self::PYTHON_3_10 => true, self::PYTHON_3_11 => true, + self::PYTHON_3_12 => true, self::PYTHON_3_6 => true, self::PYTHON_3_7 => true, self::PYTHON_3_8 => true, diff --git a/src/Enum/SystemLogLevel.php b/src/Enum/SystemLogLevel.php new file mode 100644 index 0000000..49cff1c --- /dev/null +++ b/src/Enum/SystemLogLevel.php @@ -0,0 +1,19 @@ + true, + self::INFO => true, + self::WARN => true, + ][$value]); + } +} diff --git a/src/Input/UpdateFunctionConfigurationRequest.php b/src/Input/UpdateFunctionConfigurationRequest.php index 6c0f95e..a5a2e37 100644 --- a/src/Input/UpdateFunctionConfigurationRequest.php +++ b/src/Input/UpdateFunctionConfigurationRequest.php @@ -12,6 +12,7 @@ use AsyncAws\Lambda\ValueObject\EphemeralStorage; use AsyncAws\Lambda\ValueObject\FileSystemConfig; use AsyncAws\Lambda\ValueObject\ImageConfig; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\SnapStart; use AsyncAws\Lambda\ValueObject\TracingConfig; use AsyncAws\Lambda\ValueObject\VpcConfig; @@ -196,6 +197,13 @@ final class UpdateFunctionConfigurationRequest extends Input */ private $snapStart; + /** + * The function's Amazon CloudWatch Logs configuration settings. + * + * @var LoggingConfig|null + */ + private $loggingConfig; + /** * @param array{ * FunctionName?: string, @@ -216,6 +224,7 @@ final class UpdateFunctionConfigurationRequest extends Input * ImageConfig?: null|ImageConfig|array, * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStart|array, + * LoggingConfig?: null|LoggingConfig|array, * '@region'?: string|null, * } $input */ @@ -239,6 +248,7 @@ public function __construct(array $input = []) $this->imageConfig = isset($input['ImageConfig']) ? ImageConfig::create($input['ImageConfig']) : null; $this->ephemeralStorage = isset($input['EphemeralStorage']) ? EphemeralStorage::create($input['EphemeralStorage']) : null; $this->snapStart = isset($input['SnapStart']) ? SnapStart::create($input['SnapStart']) : null; + $this->loggingConfig = isset($input['LoggingConfig']) ? LoggingConfig::create($input['LoggingConfig']) : null; parent::__construct($input); } @@ -262,6 +272,7 @@ public function __construct(array $input = []) * ImageConfig?: null|ImageConfig|array, * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStart|array, + * LoggingConfig?: null|LoggingConfig|array, * '@region'?: string|null, * }|UpdateFunctionConfigurationRequest $input */ @@ -326,6 +337,11 @@ public function getLayers(): array return $this->layers ?? []; } + public function getLoggingConfig(): ?LoggingConfig + { + return $this->loggingConfig; + } + public function getMemorySize(): ?int { return $this->memorySize; @@ -472,6 +488,13 @@ public function setLayers(array $value): self return $this; } + public function setLoggingConfig(?LoggingConfig $value): self + { + $this->loggingConfig = $value; + + return $this; + } + public function setMemorySize(?int $value): self { $this->memorySize = $value; @@ -599,6 +622,9 @@ private function requestBody(): array if (null !== $v = $this->snapStart) { $payload['SnapStart'] = $v->requestBody(); } + if (null !== $v = $this->loggingConfig) { + $payload['LoggingConfig'] = $v->requestBody(); + } return $payload; } diff --git a/src/LambdaClient.php b/src/LambdaClient.php index 9b94b0c..117fe37 100644 --- a/src/LambdaClient.php +++ b/src/LambdaClient.php @@ -72,6 +72,7 @@ use AsyncAws\Lambda\ValueObject\FileSystemConfig; use AsyncAws\Lambda\ValueObject\ImageConfig; use AsyncAws\Lambda\ValueObject\LayerVersionContentInput; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\SnapStart; use AsyncAws\Lambda\ValueObject\TracingConfig; use AsyncAws\Lambda\ValueObject\VpcConfig; @@ -196,8 +197,10 @@ public function getFunctionConfiguration($input): FunctionConfiguration } /** - * Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. To - * invoke a function asynchronously, set `InvocationType` to `Event`. + * Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. By + * default, Lambda invokes your function synchronously (i.e. the`InvocationType` is `RequestResponse`). To invoke a + * function asynchronously, set `InvocationType` to `Event`. Lambda passes the `ClientContext` object to your function + * for synchronous invocations only. * * For synchronous invocation [^1], details about the function response, including errors, are included in the response * body and headers. For either invocation type, you can find more information in the execution log [^2] and trace [^3]. @@ -508,6 +511,7 @@ public function publishLayerVersion($input): PublishLayerVersionResponse * ImageConfig?: null|ImageConfig|array, * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStart|array, + * LoggingConfig?: null|LoggingConfig|array, * '@region'?: string|null, * }|UpdateFunctionConfigurationRequest $input * diff --git a/src/Result/FunctionConfiguration.php b/src/Result/FunctionConfiguration.php index 5285d32..d679bfa 100644 --- a/src/Result/FunctionConfiguration.php +++ b/src/Result/FunctionConfiguration.php @@ -20,6 +20,7 @@ use AsyncAws\Lambda\ValueObject\ImageConfigError; use AsyncAws\Lambda\ValueObject\ImageConfigResponse; use AsyncAws\Lambda\ValueObject\Layer; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionError; use AsyncAws\Lambda\ValueObject\SnapStartResponse; @@ -301,6 +302,13 @@ class FunctionConfiguration extends Result */ private $runtimeVersionConfig; + /** + * The function's Amazon CloudWatch Logs configuration settings. + * + * @var LoggingConfig|null + */ + private $loggingConfig; + /** * @return list */ @@ -442,6 +450,13 @@ public function getLayers(): array return $this->layers; } + public function getLoggingConfig(): ?LoggingConfig + { + $this->initialize(); + + return $this->loggingConfig; + } + public function getMasterArn(): ?string { $this->initialize(); @@ -612,6 +627,7 @@ protected function populateResult(Response $response): void $this->ephemeralStorage = empty($data['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($data['EphemeralStorage']); $this->snapStart = empty($data['SnapStart']) ? null : $this->populateResultSnapStartResponse($data['SnapStart']); $this->runtimeVersionConfig = empty($data['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($data['RuntimeVersionConfig']); + $this->loggingConfig = empty($data['LoggingConfig']) ? null : $this->populateResultLoggingConfig($data['LoggingConfig']); } /** @@ -742,6 +758,16 @@ private function populateResultLayersReferenceList(array $json): array return $items; } + private function populateResultLoggingConfig(array $json): LoggingConfig + { + return new LoggingConfig([ + 'LogFormat' => isset($json['LogFormat']) ? (string) $json['LogFormat'] : null, + 'ApplicationLogLevel' => isset($json['ApplicationLogLevel']) ? (string) $json['ApplicationLogLevel'] : null, + 'SystemLogLevel' => isset($json['SystemLogLevel']) ? (string) $json['SystemLogLevel'] : null, + 'LogGroup' => isset($json['LogGroup']) ? (string) $json['LogGroup'] : null, + ]); + } + private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig { return new RuntimeVersionConfig([ diff --git a/src/Result/ListFunctionsResponse.php b/src/Result/ListFunctionsResponse.php index 031bb7a..e13edd1 100644 --- a/src/Result/ListFunctionsResponse.php +++ b/src/Result/ListFunctionsResponse.php @@ -18,6 +18,7 @@ use AsyncAws\Lambda\ValueObject\ImageConfigError; use AsyncAws\Lambda\ValueObject\ImageConfigResponse; use AsyncAws\Lambda\ValueObject\Layer; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionError; use AsyncAws\Lambda\ValueObject\SnapStartResponse; @@ -232,6 +233,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi 'EphemeralStorage' => empty($json['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($json['EphemeralStorage']), 'SnapStart' => empty($json['SnapStart']) ? null : $this->populateResultSnapStartResponse($json['SnapStart']), 'RuntimeVersionConfig' => empty($json['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($json['RuntimeVersionConfig']), + 'LoggingConfig' => empty($json['LoggingConfig']) ? null : $this->populateResultLoggingConfig($json['LoggingConfig']), ]); } @@ -296,6 +298,16 @@ private function populateResultLayersReferenceList(array $json): array return $items; } + private function populateResultLoggingConfig(array $json): LoggingConfig + { + return new LoggingConfig([ + 'LogFormat' => isset($json['LogFormat']) ? (string) $json['LogFormat'] : null, + 'ApplicationLogLevel' => isset($json['ApplicationLogLevel']) ? (string) $json['ApplicationLogLevel'] : null, + 'SystemLogLevel' => isset($json['SystemLogLevel']) ? (string) $json['SystemLogLevel'] : null, + 'LogGroup' => isset($json['LogGroup']) ? (string) $json['LogGroup'] : null, + ]); + } + private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig { return new RuntimeVersionConfig([ diff --git a/src/Result/ListVersionsByFunctionResponse.php b/src/Result/ListVersionsByFunctionResponse.php index 24fa42e..136da1e 100644 --- a/src/Result/ListVersionsByFunctionResponse.php +++ b/src/Result/ListVersionsByFunctionResponse.php @@ -18,6 +18,7 @@ use AsyncAws\Lambda\ValueObject\ImageConfigError; use AsyncAws\Lambda\ValueObject\ImageConfigResponse; use AsyncAws\Lambda\ValueObject\Layer; +use AsyncAws\Lambda\ValueObject\LoggingConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionConfig; use AsyncAws\Lambda\ValueObject\RuntimeVersionError; use AsyncAws\Lambda\ValueObject\SnapStartResponse; @@ -230,6 +231,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi 'EphemeralStorage' => empty($json['EphemeralStorage']) ? null : $this->populateResultEphemeralStorage($json['EphemeralStorage']), 'SnapStart' => empty($json['SnapStart']) ? null : $this->populateResultSnapStartResponse($json['SnapStart']), 'RuntimeVersionConfig' => empty($json['RuntimeVersionConfig']) ? null : $this->populateResultRuntimeVersionConfig($json['RuntimeVersionConfig']), + 'LoggingConfig' => empty($json['LoggingConfig']) ? null : $this->populateResultLoggingConfig($json['LoggingConfig']), ]); } @@ -294,6 +296,16 @@ private function populateResultLayersReferenceList(array $json): array return $items; } + private function populateResultLoggingConfig(array $json): LoggingConfig + { + return new LoggingConfig([ + 'LogFormat' => isset($json['LogFormat']) ? (string) $json['LogFormat'] : null, + 'ApplicationLogLevel' => isset($json['ApplicationLogLevel']) ? (string) $json['ApplicationLogLevel'] : null, + 'SystemLogLevel' => isset($json['SystemLogLevel']) ? (string) $json['SystemLogLevel'] : null, + 'LogGroup' => isset($json['LogGroup']) ? (string) $json['LogGroup'] : null, + ]); + } + private function populateResultRuntimeVersionConfig(array $json): RuntimeVersionConfig { return new RuntimeVersionConfig([ diff --git a/src/ValueObject/FunctionConfiguration.php b/src/ValueObject/FunctionConfiguration.php index 1375e98..83a9d40 100644 --- a/src/ValueObject/FunctionConfiguration.php +++ b/src/ValueObject/FunctionConfiguration.php @@ -285,6 +285,13 @@ final class FunctionConfiguration */ private $runtimeVersionConfig; + /** + * The function's Amazon CloudWatch Logs configuration settings. + * + * @var LoggingConfig|null + */ + private $loggingConfig; + /** * @param array{ * FunctionName?: null|string, @@ -322,6 +329,7 @@ final class FunctionConfiguration * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStartResponse|array, * RuntimeVersionConfig?: null|RuntimeVersionConfig|array, + * LoggingConfig?: null|LoggingConfig|array, * } $input */ public function __construct(array $input) @@ -361,6 +369,7 @@ public function __construct(array $input) $this->ephemeralStorage = isset($input['EphemeralStorage']) ? EphemeralStorage::create($input['EphemeralStorage']) : null; $this->snapStart = isset($input['SnapStart']) ? SnapStartResponse::create($input['SnapStart']) : null; $this->runtimeVersionConfig = isset($input['RuntimeVersionConfig']) ? RuntimeVersionConfig::create($input['RuntimeVersionConfig']) : null; + $this->loggingConfig = isset($input['LoggingConfig']) ? LoggingConfig::create($input['LoggingConfig']) : null; } /** @@ -400,6 +409,7 @@ public function __construct(array $input) * EphemeralStorage?: null|EphemeralStorage|array, * SnapStart?: null|SnapStartResponse|array, * RuntimeVersionConfig?: null|RuntimeVersionConfig|array, + * LoggingConfig?: null|LoggingConfig|array, * }|FunctionConfiguration $input */ public static function create($input): self @@ -512,6 +522,11 @@ public function getLayers(): array return $this->layers ?? []; } + public function getLoggingConfig(): ?LoggingConfig + { + return $this->loggingConfig; + } + public function getMasterArn(): ?string { return $this->masterArn; diff --git a/src/ValueObject/LoggingConfig.php b/src/ValueObject/LoggingConfig.php new file mode 100644 index 0000000..39734ae --- /dev/null +++ b/src/ValueObject/LoggingConfig.php @@ -0,0 +1,136 @@ +`. To use a different log group, enter an existing log + * group or enter a new log group name. + * + * @var string|null + */ + private $logGroup; + + /** + * @param array{ + * LogFormat?: null|LogFormat::*, + * ApplicationLogLevel?: null|ApplicationLogLevel::*, + * SystemLogLevel?: null|SystemLogLevel::*, + * LogGroup?: null|string, + * } $input + */ + public function __construct(array $input) + { + $this->logFormat = $input['LogFormat'] ?? null; + $this->applicationLogLevel = $input['ApplicationLogLevel'] ?? null; + $this->systemLogLevel = $input['SystemLogLevel'] ?? null; + $this->logGroup = $input['LogGroup'] ?? null; + } + + /** + * @param array{ + * LogFormat?: null|LogFormat::*, + * ApplicationLogLevel?: null|ApplicationLogLevel::*, + * SystemLogLevel?: null|SystemLogLevel::*, + * LogGroup?: null|string, + * }|LoggingConfig $input + */ + public static function create($input): self + { + return $input instanceof self ? $input : new self($input); + } + + /** + * @return ApplicationLogLevel::*|null + */ + public function getApplicationLogLevel(): ?string + { + return $this->applicationLogLevel; + } + + /** + * @return LogFormat::*|null + */ + public function getLogFormat(): ?string + { + return $this->logFormat; + } + + public function getLogGroup(): ?string + { + return $this->logGroup; + } + + /** + * @return SystemLogLevel::*|null + */ + public function getSystemLogLevel(): ?string + { + return $this->systemLogLevel; + } + + /** + * @internal + */ + public function requestBody(): array + { + $payload = []; + if (null !== $v = $this->logFormat) { + if (!LogFormat::exists($v)) { + throw new InvalidArgument(sprintf('Invalid parameter "LogFormat" for "%s". The value "%s" is not a valid "LogFormat".', __CLASS__, $v)); + } + $payload['LogFormat'] = $v; + } + if (null !== $v = $this->applicationLogLevel) { + if (!ApplicationLogLevel::exists($v)) { + throw new InvalidArgument(sprintf('Invalid parameter "ApplicationLogLevel" for "%s". The value "%s" is not a valid "ApplicationLogLevel".', __CLASS__, $v)); + } + $payload['ApplicationLogLevel'] = $v; + } + if (null !== $v = $this->systemLogLevel) { + if (!SystemLogLevel::exists($v)) { + throw new InvalidArgument(sprintf('Invalid parameter "SystemLogLevel" for "%s". The value "%s" is not a valid "SystemLogLevel".', __CLASS__, $v)); + } + $payload['SystemLogLevel'] = $v; + } + if (null !== $v = $this->logGroup) { + $payload['LogGroup'] = $v; + } + + return $payload; + } +}