Light, fluffy, and always free - The AWS Local Emulator alternative
fix(lambda): add missing FunctionConfiguration fields and fix response shape (#546)
Hector Venturace6045739211
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.javanew file mode 100644index 0000000000..e258b2404c--- /dev/null+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.java@@ -0,0 +1,221 @@+package com.floci.test;++import org.junit.jupiter.api.*;+import software.amazon.awssdk.core.SdkBytes;+import software.amazon.awssdk.services.lambda.LambdaClient;+import software.amazon.awssdk.services.lambda.model.*;+import software.amazon.awssdk.services.lambda.model.Runtime;++import java.time.OffsetDateTime;+import java.time.format.DateTimeFormatter;++import static org.assertj.core.api.Assertions.*;++/**+ * Compatibility tests for #471 — UpdateFunctionConfiguration missing fields.+ *+ * Verifies that CreateFunction and UpdateFunctionConfiguration accept and round-trip+ * Architectures, EphemeralStorage, TracingConfig, DeadLetterConfig, Environment,+ * CodeSha256, and LastModified via the AWS SDK for Java v2.+ */+@DisplayName("#471 — FunctionConfiguration fields")+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)+class LambdaFunctionConfigTest {++ private static LambdaClient lambda;+ private static final String ROLE = "arn:aws:iam::000000000000:role/lambda-role";++ // Shared function used across ordered tests+ private static final String FN = TestFixtures.uniqueName("fn-config");+ private static String revisionId;++ @BeforeAll+ static void setup() {+ lambda = TestFixtures.lambdaClient();+ }++ @AfterAll+ static void cleanup() {+ if (lambda != null) {+ try {+ lambda.deleteFunction(DeleteFunctionRequest.builder().functionName(FN).build());+ } catch (Exception ignored) {}+ lambda.close();+ }+ }++ // ─── CreateFunction ──────────────────────────────────────────────────────++ @Test+ @Order(1)+ @DisplayName("createFunction includes CodeSha256 and ISO-8601 LastModified in response")+ void createFunctionResponseHasCodeSha256AndLastModified() {+ CreateFunctionResponse resp = lambda.createFunction(CreateFunctionRequest.builder()+ .functionName(FN)+ .runtime(Runtime.NODEJS20_X)+ .role(ROLE)+ .handler("index.handler")+ .code(FunctionCode.builder()+ .zipFile(SdkBytes.fromByteArray(LambdaUtils.minimalZip()))+ .build())+ .build());++ assertThat(resp.codeSha256())+ .as("CodeSha256 must be a non-empty Base64 string")+ .isNotNull().isNotEmpty();++ assertThat(resp.lastModified())+ .as("LastModified must be a non-null ISO-8601 string")+ .isNotNull().isNotEmpty();++ // Verify it parses as a valid ISO-8601 date-time with offset+ assertThatCode(() -> OffsetDateTime.parse(resp.lastModified(),+ DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")))+ .as("LastModified must parse as yyyy-MM-dd'T'HH:mm:ss.SSSZ")+ .doesNotThrowAnyException();++ revisionId = resp.revisionId();+ }++ @Test+ @Order(2)+ @DisplayName("getFunctionConfiguration returns default Architectures, EphemeralStorage, TracingConfig, Environment")+ void getFunctionConfigurationHasDefaults() {+ GetFunctionConfigurationResponse resp = lambda.getFunctionConfiguration(+ GetFunctionConfigurationRequest.builder().functionName(FN).build());++ assertThat(resp.architectures())+ .as("default Architectures must be [x86_64]")+ .containsExactly(Architecture.X86_64);++ assertThat(resp.ephemeralStorage())+ .as("default EphemeralStorage must be present")+ .isNotNull();+ assertThat(resp.ephemeralStorage().size())+ .as("default EphemeralStorage.Size must be 512")+ .isEqualTo(512);++ assertThat(resp.tracingConfig())+ .as("TracingConfig must always be present")+ .isNotNull();+ assertThat(resp.tracingConfig().modeAsString())+ .as("default TracingConfig.Mode must be PassThrough")+ .isEqualTo("PassThrough");++ // Environment block must always be present (even when empty)+ assertThat(resp.environment())+ .as("Environment must always be present in the response")+ .isNotNull();+ }++ // ─── UpdateFunctionConfiguration ─────────────────────────────────────────++ @Test+ @Order(3)+ @DisplayName("updateFunctionConfiguration round-trips EphemeralStorage and TracingConfig")+ void updateFunctionConfigurationRoundTripsNewFields() {+ UpdateFunctionConfigurationResponse resp = lambda.updateFunctionConfiguration(+ UpdateFunctionConfigurationRequest.builder()+ .functionName(FN)+ .timeout(60)+ .ephemeralStorage(EphemeralStorage.builder().size(1024).build())+ .tracingConfig(TracingConfig.builder().mode(TracingMode.ACTIVE).build())+ .build());++ assertThat(resp.ephemeralStorage().size())+ .as("EphemeralStorage.Size must be updated to 1024")+ .isEqualTo(1024);++ assertThat(resp.tracingConfig().modeAsString())+ .as("TracingConfig.Mode must be updated to Active")+ .isEqualTo("Active");++ assertThat(resp.timeout())+ .as("Timeout must be updated to 60")+ .isEqualTo(60);++ // Verify update persists via a subsequent get+ GetFunctionConfigurationResponse getResp = lambda.getFunctionConfiguration(+ GetFunctionConfigurationRequest.builder().functionName(FN).build());++ assertThat(getResp.ephemeralStorage().size()).isEqualTo(1024);+ assertThat(getResp.tracingConfig().modeAsString()).isEqualTo("Active");+ }++ @Test+ @Order(3)+ @DisplayName("createFunction with arm64 architecture round-trips via getFunction")+ void createFunctionWithArm64ArchitectureRoundTrips() {+ String armFn = TestFixtures.uniqueName("fn-arm64");+ try {+ CreateFunctionResponse resp = lambda.createFunction(CreateFunctionRequest.builder()+ .functionName(armFn)+ .runtime(Runtime.NODEJS20_X)+ .role(ROLE)+ .handler("index.handler")+ .architectures(java.util.List.of(Architecture.ARM64))+ .code(FunctionCode.builder()+ .zipFile(SdkBytes.fromByteArray(LambdaUtils.minimalZip()))+ .build())+ .build());++ assertThat(resp.architectures())+ .as("createFunction must persist arm64 architecture")+ .containsExactly(Architecture.ARM64);++ GetFunctionConfigurationResponse getResp = lambda.getFunctionConfiguration(+ GetFunctionConfigurationRequest.builder().functionName(armFn).build());++ assertThat(getResp.architectures())+ .as("getFunctionConfiguration must return arm64 architecture")+ .containsExactly(Architecture.ARM64);+ } finally {+ try {+ lambda.deleteFunction(DeleteFunctionRequest.builder().functionName(armFn).build());+ } catch (Exception ignored) {}+ }+ }++ @Test+ @Order(4)+ @DisplayName("updateFunctionConfiguration with stale RevisionId returns 412")+ void updateFunctionConfigurationStaleRevisionIdThrows412() {+ assertThatThrownBy(() -> lambda.updateFunctionConfiguration(+ UpdateFunctionConfigurationRequest.builder()+ .functionName(FN)+ .timeout(10)+ .revisionId("00000000-0000-0000-0000-000000000000")+ .build()))+ .as("Stale RevisionId must throw PreconditionFailedException (412)")+ .isInstanceOf(PreconditionFailedException.class);+ }++ @Test+ @Order(5)+ @DisplayName("updateFunctionConfiguration with environment variables round-trips correctly")+ void updateFunctionConfigurationEnvironmentRoundTrips() {+ UpdateFunctionConfigurationResponse resp = lambda.updateFunctionConfiguration(+ UpdateFunctionConfigurationRequest.builder()+ .functionName(FN)+ .environment(Environment.builder()+ .variables(java.util.Map.of("KEY_A", "value-a", "KEY_B", "value-b"))+ .build())+ .build());++ assertThat(resp.environment()).isNotNull();+ assertThat(resp.environment().variables())+ .containsEntry("KEY_A", "value-a")+ .containsEntry("KEY_B", "value-b");++ // Clear environment — response must still include the Environment block+ UpdateFunctionConfigurationResponse cleared = lambda.updateFunctionConfiguration(+ UpdateFunctionConfigurationRequest.builder()+ .functionName(FN)+ .environment(Environment.builder().build())+ .build());++ assertThat(cleared.environment())+ .as("Environment block must be present even after clearing variables")+ .isNotNull();+ }+}diff --git a/compatibility-tests/sdk-test-python/tests/test_lambda_function_config.py b/compatibility-tests/sdk-test-python/tests/test_lambda_function_config.pynew file mode 100644index 0000000000..ee5f278678--- /dev/null+++ b/compatibility-tests/sdk-test-python/tests/test_lambda_function_config.py@@ -0,0 +1,282 @@+"""#471 — FunctionConfiguration fields compatibility tests.++Verifies that CreateFunction and UpdateFunctionConfiguration accept and round-trip+Architectures, EphemeralStorage, TracingConfig, DeadLetterConfig, Environment,+CodeSha256, and LastModified via the AWS SDK for Python (boto3).+"""++import re+import pytest+from botocore.exceptions import ClientError++ROLE = "arn:aws:iam::000000000000:role/lambda-role"++# ISO-8601 pattern AWS Lambda returns: 2024-01-15T10:30:00.000+0000+_LAST_MODIFIED_RE = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[+-]\d{4}$")+++class TestFunctionConfigurationDefaults:+ """createFunction response includes all required fields with correct defaults."""++ def test_create_function_has_code_sha256(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ resp = lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ assert resp.get("CodeSha256"), "CodeSha256 must be a non-empty string"+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_create_function_has_iso8601_last_modified(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ resp = lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ last_modified = resp.get("LastModified", "")+ assert _LAST_MODIFIED_RE.match(last_modified), (+ f"LastModified must match yyyy-MM-dd'T'HH:mm:ss.SSSZ, got: {last_modified!r}"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_get_function_configuration_default_architectures(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ resp = lambda_client.get_function_configuration(FunctionName=fn)+ assert resp.get("Architectures") == ["x86_64"], (+ f"default Architectures must be ['x86_64'], got: {resp.get('Architectures')}"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_get_function_configuration_default_ephemeral_storage(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ resp = lambda_client.get_function_configuration(FunctionName=fn)+ ephemeral = resp.get("EphemeralStorage")+ assert ephemeral is not None, "EphemeralStorage must always be present"+ assert ephemeral.get("Size") == 512, (+ f"default EphemeralStorage.Size must be 512, got: {ephemeral.get('Size')}"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_get_function_configuration_default_tracing_config(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ resp = lambda_client.get_function_configuration(FunctionName=fn)+ tracing = resp.get("TracingConfig")+ assert tracing is not None, "TracingConfig must always be present"+ assert tracing.get("Mode") == "PassThrough", (+ f"default TracingConfig.Mode must be PassThrough, got: {tracing.get('Mode')}"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_get_function_configuration_environment_always_present(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ resp = lambda_client.get_function_configuration(FunctionName=fn)+ assert "Environment" in resp, (+ "Environment block must always be present in GetFunctionConfiguration response"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)+++class TestCreateFunctionWithNewFields:+ """createFunction accepts and persists new fields."""++ def test_create_function_with_arm64_architecture(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ resp = lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Architectures=["arm64"],+ Code={"ZipFile": minimal_lambda_zip},+ )+ assert resp.get("Architectures") == ["arm64"], (+ f"Architectures must be ['arm64'], got: {resp.get('Architectures')}"+ )+ # Verify it persists+ cfg = lambda_client.get_function_configuration(FunctionName=fn)+ assert cfg.get("Architectures") == ["arm64"]+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_create_function_with_ephemeral_storage(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ resp = lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ EphemeralStorage={"Size": 2048},+ Code={"ZipFile": minimal_lambda_zip},+ )+ assert resp.get("EphemeralStorage", {}).get("Size") == 2048+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_create_function_with_tracing_config(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ resp = lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ TracingConfig={"Mode": "Active"},+ Code={"ZipFile": minimal_lambda_zip},+ )+ assert resp.get("TracingConfig", {}).get("Mode") == "Active"+ finally:+ lambda_client.delete_function(FunctionName=fn)+++class TestUpdateFunctionConfiguration:+ """updateFunctionConfiguration round-trips new fields."""++ def test_update_ephemeral_storage_and_tracing(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ resp = lambda_client.update_function_configuration(+ FunctionName=fn,+ Timeout=60,+ EphemeralStorage={"Size": 1024},+ TracingConfig={"Mode": "Active"},+ )+ assert resp.get("Timeout") == 60+ assert resp.get("EphemeralStorage", {}).get("Size") == 1024+ assert resp.get("TracingConfig", {}).get("Mode") == "Active"++ # Verify persistence+ cfg = lambda_client.get_function_configuration(FunctionName=fn)+ assert cfg.get("EphemeralStorage", {}).get("Size") == 1024+ assert cfg.get("TracingConfig", {}).get("Mode") == "Active"+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_update_environment_variables_round_trip(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ resp = lambda_client.update_function_configuration(+ FunctionName=fn,+ Environment={"Variables": {"KEY_A": "value-a", "KEY_B": "value-b"}},+ )+ variables = resp.get("Environment", {}).get("Variables", {})+ assert variables.get("KEY_A") == "value-a"+ assert variables.get("KEY_B") == "value-b"++ # Clear environment — block must still be present+ cleared = lambda_client.update_function_configuration(+ FunctionName=fn,+ Environment={"Variables": {}},+ )+ assert "Environment" in cleared, (+ "Environment block must be present even after clearing variables"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)++ def test_stale_revision_id_returns_412(+ self, lambda_client, minimal_lambda_zip, unique_name+ ):+ fn = f"pytest-cfg-{unique_name}"+ try:+ lambda_client.create_function(+ FunctionName=fn,+ Runtime="nodejs20.x",+ Role=ROLE,+ Handler="index.handler",+ Code={"ZipFile": minimal_lambda_zip},+ )+ with pytest.raises(ClientError) as exc_info:+ lambda_client.update_function_configuration(+ FunctionName=fn,+ Timeout=10,+ RevisionId="00000000-0000-0000-0000-000000000000",+ )+ assert exc_info.value.response["ResponseMetadata"]["HTTPStatusCode"] == 412, (+ "Stale RevisionId must return 412 PreconditionFailedException"+ )+ finally:+ lambda_client.delete_function(FunctionName=fn)diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.javaindex 7887143830..5c46eef777 100644--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java@@ -26,6 +26,9 @@ import jakarta.ws.rs.core.MediaType;import jakarta.ws.rs.core.Response;import org.jboss.logging.Logger;+import java.time.Instant;+import java.time.ZoneOffset;+import java.time.format.DateTimeFormatter;import java.util.List;import java.util.Map;@@ -502,15 +505,46 @@ public class LambdaController {if (fn.getStateReason() != null) node.put("StateReason", fn.getStateReason());if (fn.getStateReasonCode() != null) node.put("StateReasonCode", fn.getStateReasonCode());node.put("CodeSize", fn.getCodeSizeBytes());+ node.put("CodeSha256", fn.getCodeSha256() != null ? fn.getCodeSha256() : "");node.put("PackageType", fn.getPackageType());if (fn.getImageUri() != null) node.put("ImageUri", fn.getImageUri());- node.put("LastModified", String.valueOf(fn.getLastModified()));+ node.put("LastModified", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")+ .format(Instant.ofEpochMilli(fn.getLastModified()).atOffset(ZoneOffset.UTC)));node.put("RevisionId", fn.getRevisionId());node.put("Version", fn.getVersion());node.put("LastUpdateStatus", "Successful");+ // Architectures — always present; default x86_64+ ArrayNode archNode = node.putArray("Architectures");+ List<String> archs = fn.getArchitectures();+ (archs != null && !archs.isEmpty() ? archs : List.of("x86_64")).forEach(archNode::add);++ // EphemeralStorage — always present; AWS default 512 MB+ node.putObject("EphemeralStorage").put("Size", fn.getEphemeralStorageSize());++ // TracingConfig — always present+ node.putObject("TracingConfig")+ .put("Mode", fn.getTracingMode() != null ? fn.getTracingMode() : "PassThrough");++ // DeadLetterConfig — only when set+ if (fn.getDeadLetterTargetArn() != null) {+ node.putObject("DeadLetterConfig").put("TargetArn", fn.getDeadLetterTargetArn());+ }++ // Layers — only when non-empty+ if (fn.getLayers() != null && !fn.getLayers().isEmpty()) {+ ArrayNode layersNode = node.putArray("Layers");+ fn.getLayers().forEach(arn -> layersNode.addObject().put("Arn", arn));+ }++ // KMSKeyArn — only when set+ if (fn.getKmsKeyArn() != null) {+ node.put("KMSKeyArn", fn.getKmsKeyArn());+ }++ // Environment — always present (SDK expects it even when empty)+ ObjectNode envNode = node.putObject("Environment");if (fn.getEnvironment() != null && !fn.getEnvironment().isEmpty()) {- ObjectNode envNode = node.putObject("Environment");ObjectNode vars = envNode.putObject("Variables");fn.getEnvironment().forEach(vars::put);}diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.javaindex 0d50cae754..5f5be7ba51 100644--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java@@ -232,6 +232,48 @@ public class LambdaService {Map<String, String> tags = (Map<String, String>) request.get("Tags");if (tags != null) fn.setTags(tags);+ // Architectures+ @SuppressWarnings("unchecked")+ List<String> architectures = request.get("Architectures") instanceof List+ ? (List<String>) request.get("Architectures") : null;+ if (architectures != null && !architectures.isEmpty()) {+ fn.setArchitectures(new ArrayList<>(architectures));+ }++ // EphemeralStorage+ if (request.get("EphemeralStorage") instanceof Map<?, ?> es) {+ fn.setEphemeralStorageSize(toInt(es.get("Size"), 512));+ }++ // TracingConfig+ if (request.get("TracingConfig") instanceof Map<?, ?> tc) {+ Object mode = tc.get("Mode");+ fn.setTracingMode(mode != null ? mode.toString() : "PassThrough");+ }++ // DeadLetterConfig+ if (request.get("DeadLetterConfig") instanceof Map<?, ?> dlq) {+ fn.setDeadLetterTargetArn((String) dlq.get("TargetArn"));+ }++ // Layers+ @SuppressWarnings("unchecked")+ List<String> layers = request.get("Layers") instanceof List+ ? (List<String>) request.get("Layers") : null;+ if (layers != null) {+ fn.setLayers(new ArrayList<>(layers));+ }++ if (request.containsKey("KMSKeyArn")) {+ fn.setKmsKeyArn((String) request.get("KMSKeyArn"));+ }++ if (request.get("VpcConfig") instanceof Map<?, ?>) {+ @SuppressWarnings("unchecked")+ Map<String, Object> vpc = (Map<String, Object>) request.get("VpcConfig");+ fn.setVpcConfig(vpc);+ }+// Handle code deployment@SuppressWarnings("unchecked")Map<String, Object> code = (Map<String, Object>) request.get("Code");@@ -361,6 +403,64 @@ public class LambdaService {}}+ // RevisionId optimistic locking+ if (request.containsKey("RevisionId")) {+ String incomingRevision = (String) request.get("RevisionId");+ if (incomingRevision != null && !incomingRevision.equals(fn.getRevisionId())) {+ throw new AwsException("PreconditionFailedException",+ "The Revision Id provided does not match the latest Revision Id. "+ + "Call the GetFunction or the GetFunctionConfiguration API to retrieve "+ + "the latest Revision Id for your resource.", 412);+ }+ }++ if (request.containsKey("Architectures")) {+ @SuppressWarnings("unchecked")+ List<String> archs = request.get("Architectures") instanceof List+ ? (List<String>) request.get("Architectures") : null;+ if (archs != null && !archs.isEmpty()) {+ fn.setArchitectures(new ArrayList<>(archs));+ }+ }++ if (request.containsKey("EphemeralStorage")) {+ if (request.get("EphemeralStorage") instanceof Map<?, ?> es) {+ fn.setEphemeralStorageSize(toInt(es.get("Size"), 512));+ }+ }++ if (request.containsKey("TracingConfig")) {+ if (request.get("TracingConfig") instanceof Map<?, ?> tc) {+ Object mode = tc.get("Mode");+ fn.setTracingMode(mode != null ? mode.toString() : "PassThrough");+ }+ }++ if (request.containsKey("DeadLetterConfig")) {+ if (request.get("DeadLetterConfig") instanceof Map<?, ?> dlq) {+ fn.setDeadLetterTargetArn((String) dlq.get("TargetArn"));+ }+ }++ if (request.containsKey("Layers")) {+ @SuppressWarnings("unchecked")+ List<String> layerList = request.get("Layers") instanceof List+ ? (List<String>) request.get("Layers") : null;+ fn.setLayers(layerList != null ? new ArrayList<>(layerList) : new ArrayList<>());+ }++ if (request.containsKey("KMSKeyArn")) {+ fn.setKmsKeyArn((String) request.get("KMSKeyArn"));+ }++ if (request.containsKey("VpcConfig")) {+ if (request.get("VpcConfig") instanceof Map<?, ?>) {+ @SuppressWarnings("unchecked")+ Map<String, Object> vpc = (Map<String, Object>) request.get("VpcConfig");+ fn.setVpcConfig(vpc);+ }+ }+fn.setLastModified(System.currentTimeMillis());fn.setRevisionId(UUID.randomUUID().toString());@@ -927,6 +1027,10 @@ public class LambdaService {zipExtractor.extractTo(zipBytes, codePath);fn.setCodeLocalPath(codePath.toAbsolutePath().normalize().toString());fn.setCodeSizeBytes(zipBytes.length);+ try {+ byte[] digest = java.security.MessageDigest.getInstance("SHA-256").digest(zipBytes);+ fn.setCodeSha256(Base64.getEncoder().encodeToString(digest));+ } catch (java.security.NoSuchAlgorithmException ignored) {}// For file-based runtimes, verify handler file exists (skip Java and .NET which use different handler formats)if (fn.getRuntime() != null && !fn.getRuntime().startsWith("java") && !fn.getRuntime().startsWith("dotnet")) {diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/model/LambdaFunction.java b/src/main/java/io/github/hectorvent/floci/services/lambda/model/LambdaFunction.javaindex 6733120466..9944074e66 100644--- a/src/main/java/io/github/hectorvent/floci/services/lambda/model/LambdaFunction.java+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/model/LambdaFunction.java@@ -38,6 +38,14 @@ public class LambdaFunction {private String version = "$LATEST";private LambdaUrlConfig urlConfig;private Integer reservedConcurrentExecutions;+ private List<String> architectures;+ private int ephemeralStorageSize = 512;+ private String tracingMode = "PassThrough";+ private String deadLetterTargetArn;+ private List<String> layers = new ArrayList<>();+ private String kmsKeyArn;+ private Map<String, Object> vpcConfig;+ private String codeSha256;@JsonIgnoreprivate volatile ContainerState containerState = ContainerState.COLD;@@ -120,6 +128,30 @@ public class LambdaFunction {public Integer getReservedConcurrentExecutions() { return reservedConcurrentExecutions; }public void setReservedConcurrentExecutions(Integer reservedConcurrentExecutions) { this.reservedConcurrentExecutions = reservedConcurrentExecutions; }+ public List<String> getArchitectures() { return architectures; }+ public void setArchitectures(List<String> architectures) { this.architectures = architectures; }++ public int getEphemeralStorageSize() { return ephemeralStorageSize; }+ public void setEphemeralStorageSize(int ephemeralStorageSize) { this.ephemeralStorageSize = ephemeralStorageSize; }++ public String getTracingMode() { return tracingMode; }+ public void setTracingMode(String tracingMode) { this.tracingMode = tracingMode; }++ public String getDeadLetterTargetArn() { return deadLetterTargetArn; }+ public void setDeadLetterTargetArn(String deadLetterTargetArn) { this.deadLetterTargetArn = deadLetterTargetArn; }++ public List<String> getLayers() { return layers; }+ public void setLayers(List<String> layers) { this.layers = layers; }++ public String getKmsKeyArn() { return kmsKeyArn; }+ public void setKmsKeyArn(String kmsKeyArn) { this.kmsKeyArn = kmsKeyArn; }++ public Map<String, Object> getVpcConfig() { return vpcConfig; }+ public void setVpcConfig(Map<String, Object> vpcConfig) { this.vpcConfig = vpcConfig; }++ public String getCodeSha256() { return codeSha256; }+ public void setCodeSha256(String codeSha256) { this.codeSha256 = codeSha256; }+@JsonIgnorepublic ContainerState getContainerState() { return containerState; }@JsonIgnore