dex-connector-amazon-lambda 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. dex_connector_amazon_lambda-0.2.0/.gitignore +28 -0
  2. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/PKG-INFO +3 -1
  3. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/README.md +2 -0
  4. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/examples/function_lookup/README.md +8 -0
  5. dex_connector_amazon_lambda-0.2.0/examples/function_lookup/delete_function.py +55 -0
  6. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/examples/function_lookup/integration_test.py +47 -1
  7. dex_connector_amazon_lambda-0.2.0/examples/function_lookup/list_functions.py +50 -0
  8. dex_connector_amazon_lambda-0.2.0/examples/function_lookup/update_function_description.py +55 -0
  9. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/examples/function_lookup/worker.py +12 -1
  10. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/pyproject.toml +1 -1
  11. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/__init__.py +54 -0
  12. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/src/dex_connectors/amazon_lambda/_generated/connection.py +54 -14
  13. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/_generated/definitions.py +91 -0
  14. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/_generated/mock.py +191 -0
  15. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/_generated/models.py +93 -0
  16. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/_generated/steps.py +234 -0
  17. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/client.py +482 -0
  18. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/dex-connector.json +221 -0
  19. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/models.py +13 -0
  20. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/src/dex_connectors/amazon_lambda/sigv4.py +6 -6
  21. dex_connector_amazon_lambda-0.2.0/src/dex_connectors/amazon_lambda/steps.py +8 -0
  22. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/uv.lock +1 -1
  23. dex_connector_amazon_lambda-0.1.0/.gitignore +0 -16
  24. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/__init__.py +0 -22
  25. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/_generated/definitions.py +0 -40
  26. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/_generated/mock.py +0 -74
  27. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/_generated/models.py +0 -23
  28. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/_generated/steps.py +0 -81
  29. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/client.py +0 -197
  30. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/dex-connector.json +0 -64
  31. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/models.py +0 -8
  32. dex_connector_amazon_lambda-0.1.0/src/dex_connectors/amazon_lambda/steps.py +0 -5
  33. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/LICENSE +0 -0
  34. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/examples/function_lookup/__init__.py +0 -0
  35. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/examples/function_lookup/flow.py +0 -0
  36. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/src/dex_connectors/amazon_lambda/_generated/__init__.py +0 -0
  37. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/src/dex_connectors/amazon_lambda/_generated/config.py +0 -0
  38. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/src/dex_connectors/amazon_lambda/connection.py +0 -0
  39. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/src/dex_connectors/amazon_lambda/lambdamock/__init__.py +0 -0
  40. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/tests/test_conformance.py +0 -0
  41. {dex_connector_amazon_lambda-0.1.0 → dex_connector_amazon_lambda-0.2.0}/tests/test_manifest_contract.py +0 -0
@@ -0,0 +1,28 @@
1
+ .DS_Store
2
+ __pycache__/
3
+ *.py[cod]
4
+ node_modules/
5
+ dist/
6
+ sdkpython/dist/dex_connectors_sdk-0.1.0-py3-none-any.whl
7
+ /.bin/dexcli
8
+ /dexcli
9
+ /dex-server-zd
10
+ /.bin/dex-server-zd
11
+ /connectorsmcp/examples/hackernews_agent/.bin/
12
+ /connectorsmcp/examples/hackernews_agent/.venv/
13
+ /sdkpython/.dexcli-data/
14
+ site/.catalog.yaml
15
+ site/.catalog-language-tags
16
+ coverage/
17
+ *.out
18
+ *.test
19
+ go.work
20
+ go.work.sum
21
+ .idea/
22
+ /sdkjava/build/
23
+ /sdkjava/.gradle/
24
+ /sdkrust/target/
25
+ /conformance/runners/rust/target/
26
+ /connectors/**/rust/target/
27
+ /connectors/**/java/build/
28
+ /connectors/**/java/.gradle/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dex-connector-amazon-lambda
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Amazon Lambda connector for Dex Flows
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -13,3 +13,5 @@ Description-Content-Type: text/markdown
13
13
  # Amazon Lambda Python connector
14
14
 
15
15
  The `get_function` Query reads a Lambda function name and ARN. Configure AWS Region and signing credentials as described in the [connector README](../README.md). The [runnable Flow](examples/function_lookup/README.md) exercises a real Dex Worker and local provider fixture. Live AWS access has not been verified.
16
+
17
+ The [function management examples](examples/function_lookup/) list a page, update an absolute description, and delete an explicitly named function in separate Flows. Custom operation bindings must now supply all four operations. The provider client and generated mock include all four.
@@ -1,3 +1,5 @@
1
1
  # Amazon Lambda Python connector
2
2
 
3
3
  The `get_function` Query reads a Lambda function name and ARN. Configure AWS Region and signing credentials as described in the [connector README](../README.md). The [runnable Flow](examples/function_lookup/README.md) exercises a real Dex Worker and local provider fixture. Live AWS access has not been verified.
4
+
5
+ The [function management examples](examples/function_lookup/) list a page, update an absolute description, and delete an explicitly named function in separate Flows. Custom operation bindings must now supply all four operations. The provider client and generated mock include all four.
@@ -1,3 +1,11 @@
1
1
  # Python function lookup example
2
2
 
3
3
  The Worker runs `AmazonLambdaFunctionLookupPython` through the static `amazon-lambda` connection and stores the function details. Configure `region`, `access_key_id`, and `secret_access_key` as described in the [connector README](../../../README.md). From `connectors/amazon/lambda/python`, run `uv run python -m examples.function_lookup.worker` with the project `DEX_PROJECT_*` environment and a running `dexcli dev` service. Start the Flow with a unique ID and input `{"functionName":"example-function"}`. Optional branches are unwired. `integration_test.py` runs the same Flow against real Dex and a local provider fixture.
4
+
5
+ The same Worker also registers three independently started Flows.
6
+
7
+ | Flow | Input | Result |
8
+ | --- | --- | --- |
9
+ | `AmazonLambdaListFunctionsPython` | Optional `marker` and `maxItems` (1–50) | Function names, ARNs, and the next marker |
10
+ | `AmazonLambdaUpdateFunctionDescriptionPython` | `functionName` and `description` | Updated function identity. An empty description clears it. |
11
+ | `AmazonLambdaDeleteFunctionPython` | `functionName` | Confirms deletion of the entire function, including versions and aliases |
@@ -0,0 +1,55 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Delete the explicitly named function and its versions and aliases."""
4
+
5
+ import dex
6
+ from dex_connectors.sdk import MutationResult
7
+
8
+ from dex_connectors.amazon_lambda import (
9
+ Connection,
10
+ DeleteFunctionInput,
11
+ FunctionWriteResult,
12
+ new_delete_function_step,
13
+ )
14
+
15
+
16
+ # dex:group group-id:lambda group-label:"Amazon Lambda"
17
+ # dex:explanation text:"Return the confirmed Lambda result."
18
+ class CompleteDeleteFunction(dex.Step[MutationResult[FunctionWriteResult]]):
19
+ """Complete the selected operation."""
20
+
21
+ def execute(self, context: dex.Context, input: MutationResult[FunctionWriteResult]) -> dex.StepDecision:
22
+ """Return the provider result to the caller."""
23
+ return dex.graceful_complete(input.value)
24
+
25
+
26
+ class DeleteFunctionFlow(dex.Flow[DeleteFunctionInput]):
27
+ """Delete the explicitly named function and its versions and aliases."""
28
+
29
+ def __init__(self, connection: Connection) -> None:
30
+ self.complete = CompleteDeleteFunction()
31
+ self.operation = new_delete_function_step(
32
+ step_type="CallDeleteFunction",
33
+ step_input_type=DeleteFunctionInput,
34
+ annotations={
35
+ "groupId": "lambda",
36
+ "groupLabel": "Amazon Lambda",
37
+ "explanation": "Delete the explicitly named function and its versions and aliases.",
38
+ },
39
+ connection=connection,
40
+ connection_name="amazon-lambda",
41
+ map_to_operation_input=lambda value: value,
42
+ deleted=self.complete,
43
+ )
44
+
45
+ def get_flow_type(self) -> str:
46
+ """Return the registered Flow identity."""
47
+ return "AmazonLambdaDeleteFunctionPython"
48
+
49
+ def get_steps(self) -> dex.StepList[DeleteFunctionInput]:
50
+ """Register the provider and completion Steps."""
51
+ return dex.StepList.start_step(self.operation).other_steps(self.complete)
52
+
53
+ def get_persistence_schema(self) -> dex.PersistenceSchema:
54
+ """Declare the Flow persistence schema."""
55
+ return dex.PersistenceSchema.of()
@@ -3,6 +3,7 @@
3
3
  """Real Dex Worker and Client verification for the Amazon Lambda Python Flow."""
4
4
 
5
5
  import asyncio
6
+ import json
6
7
  import os
7
8
  from datetime import timedelta
8
9
  from pathlib import Path
@@ -17,12 +18,20 @@ from dex_connectors.amazon_lambda import (
17
18
  Client,
18
19
  Config,
19
20
  Credentials,
21
+ DeleteFunctionInput,
20
22
  FunctionDetails,
23
+ FunctionPage,
24
+ FunctionWriteResult,
21
25
  GetFunctionInput,
26
+ ListFunctionsInput,
27
+ UpdateFunctionDescriptionInput,
22
28
  new_connection,
23
29
  )
24
30
 
31
+ from .delete_function import DeleteFunctionFlow
25
32
  from .flow import CONNECTION_NAME, FunctionLookupFlow
33
+ from .list_functions import ListFunctionsFlow
34
+ from .update_function_description import UpdateFunctionDescriptionFlow
26
35
 
27
36
 
28
37
  @pytest.mark.asyncio
@@ -33,6 +42,19 @@ async def test_function_lookup_retries_503(tmp_path: Path) -> None:
33
42
 
34
43
  def answer(request: httpx.Request) -> httpx.Response:
35
44
  requests.append(request)
45
+ identity = {"FunctionName": "example-function", "FunctionArn": "arn:example"}
46
+ if request.method == "PUT":
47
+ assert request.url.path.endswith("/functions/example-function/configuration")
48
+ assert json.loads(request.content) == {"Description": "Updated via Dex"}
49
+ if sum(r.method == "PUT" for r in requests) == 1:
50
+ return httpx.Response(409, headers={"Retry-After": "1"})
51
+ return httpx.Response(200, json=identity)
52
+ if request.method == "DELETE":
53
+ assert request.url.path.endswith("/functions/example-function")
54
+ return httpx.Response(204)
55
+ if request.url.path.endswith("/functions"):
56
+ assert request.url.params.get("Marker") == "cursor +"
57
+ return httpx.Response(200, json={"Functions": [identity], "NextMarker": "next"})
36
58
  assert request.method == "GET"
37
59
  assert request.url.path == "/2015-03-31/functions/example-function"
38
60
  assert "lambda/aws4_request" in request.headers["Authorization"]
@@ -60,7 +82,10 @@ async def test_function_lookup_retries_503(tmp_path: Path) -> None:
60
82
  )
61
83
  connection = new_connection(provider, reference)
62
84
  flow = FunctionLookupFlow(connection)
63
- registry = dex.Registry([flow], allow_async_handlers=True)
85
+ listing = ListFunctionsFlow(connection)
86
+ updating = UpdateFunctionDescriptionFlow(connection)
87
+ deleting = DeleteFunctionFlow(connection)
88
+ registry = dex.Registry([flow, listing, updating, deleting], allow_async_handlers=True)
64
89
  cache = dex.open_blob_cache(dex.BlobCacheConfig(str(tmp_path / "blobs"), 1 << 24))
65
90
  worker = dex.AsyncWorker(registry, cache, dex.WorkerOptions(server_address=address))
66
91
  worker_task = asyncio.create_task(worker.start())
@@ -73,6 +98,27 @@ async def test_function_lookup_retries_503(tmp_path: Path) -> None:
73
98
  assert result.status == dex.FlowStatus.COMPLETED, result.error_message
74
99
  assert result.single_output(FunctionDetails).name == "example-function"
75
100
  assert len(requests) == 2
101
+ list_id = f"lambda-list-{uuid4().hex}"
102
+ await client.start_flow(listing, list_id, ListFunctionsInput("cursor +", 2))
103
+ page = (await client.wait_for_flow(list_id, timedelta(seconds=30))).single_output(
104
+ FunctionPage
105
+ )
106
+ assert page.next_marker == "next" and page.functions[0].name == "example-function"
107
+ update_id = f"lambda-update-{uuid4().hex}"
108
+ await client.start_flow(
109
+ updating, update_id, UpdateFunctionDescriptionInput("example-function", "Updated via Dex")
110
+ )
111
+ updated = (await client.wait_for_flow(update_id, timedelta(seconds=30))).single_output(
112
+ FunctionDetails
113
+ )
114
+ assert updated.arn == "arn:example"
115
+ delete_id = f"lambda-delete-{uuid4().hex}"
116
+ await client.start_flow(deleting, delete_id, DeleteFunctionInput("example-function"))
117
+ deleted = (await client.wait_for_flow(delete_id, timedelta(seconds=30))).single_output(
118
+ FunctionWriteResult
119
+ )
120
+ assert deleted.applied
121
+ assert [r.method for r in requests] == ["GET", "GET", "GET", "PUT", "PUT", "DELETE"]
76
122
  finally:
77
123
  await worker.stop()
78
124
  await worker_task
@@ -0,0 +1,50 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """List one page of function names and ARNs."""
4
+
5
+ import dex
6
+ from dex_connectors.sdk import QueryResult
7
+
8
+ from dex_connectors.amazon_lambda import Connection, FunctionPage, ListFunctionsInput, new_list_functions_step
9
+
10
+
11
+ # dex:group group-id:lambda group-label:"Amazon Lambda"
12
+ # dex:explanation text:"Return the confirmed Lambda result."
13
+ class CompleteListFunctions(dex.Step[QueryResult[FunctionPage]]):
14
+ """Complete the selected operation."""
15
+
16
+ def execute(self, context: dex.Context, input: QueryResult[FunctionPage]) -> dex.StepDecision:
17
+ """Return the provider result to the caller."""
18
+ return dex.graceful_complete(input.value)
19
+
20
+
21
+ class ListFunctionsFlow(dex.Flow[ListFunctionsInput]):
22
+ """List one page of function names and ARNs."""
23
+
24
+ def __init__(self, connection: Connection) -> None:
25
+ self.complete = CompleteListFunctions()
26
+ self.operation = new_list_functions_step(
27
+ step_type="CallListFunctions",
28
+ step_input_type=ListFunctionsInput,
29
+ annotations={
30
+ "groupId": "lambda",
31
+ "groupLabel": "Amazon Lambda",
32
+ "explanation": "List one page of function names and ARNs.",
33
+ },
34
+ connection=connection,
35
+ connection_name="amazon-lambda",
36
+ map_to_operation_input=lambda value: value,
37
+ listed=self.complete,
38
+ )
39
+
40
+ def get_flow_type(self) -> str:
41
+ """Return the registered Flow identity."""
42
+ return "AmazonLambdaListFunctionsPython"
43
+
44
+ def get_steps(self) -> dex.StepList[ListFunctionsInput]:
45
+ """Register the provider and completion Steps."""
46
+ return dex.StepList.start_step(self.operation).other_steps(self.complete)
47
+
48
+ def get_persistence_schema(self) -> dex.PersistenceSchema:
49
+ """Declare the Flow persistence schema."""
50
+ return dex.PersistenceSchema.of()
@@ -0,0 +1,55 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Replace the description of the named function."""
4
+
5
+ import dex
6
+ from dex_connectors.sdk import MutationResult
7
+
8
+ from dex_connectors.amazon_lambda import (
9
+ Connection,
10
+ FunctionDetails,
11
+ UpdateFunctionDescriptionInput,
12
+ new_update_function_description_step,
13
+ )
14
+
15
+
16
+ # dex:group group-id:lambda group-label:"Amazon Lambda"
17
+ # dex:explanation text:"Return the confirmed Lambda result."
18
+ class CompleteUpdateFunctionDescription(dex.Step[MutationResult[FunctionDetails]]):
19
+ """Complete the selected operation."""
20
+
21
+ def execute(self, context: dex.Context, input: MutationResult[FunctionDetails]) -> dex.StepDecision:
22
+ """Return the provider result to the caller."""
23
+ return dex.graceful_complete(input.value)
24
+
25
+
26
+ class UpdateFunctionDescriptionFlow(dex.Flow[UpdateFunctionDescriptionInput]):
27
+ """Replace the description of the named function."""
28
+
29
+ def __init__(self, connection: Connection) -> None:
30
+ self.complete = CompleteUpdateFunctionDescription()
31
+ self.operation = new_update_function_description_step(
32
+ step_type="CallUpdateFunctionDescription",
33
+ step_input_type=UpdateFunctionDescriptionInput,
34
+ annotations={
35
+ "groupId": "lambda",
36
+ "groupLabel": "Amazon Lambda",
37
+ "explanation": "Replace the description of the named function.",
38
+ },
39
+ connection=connection,
40
+ connection_name="amazon-lambda",
41
+ map_to_operation_input=lambda value: value,
42
+ updated=self.complete,
43
+ )
44
+
45
+ def get_flow_type(self) -> str:
46
+ """Return the registered Flow identity."""
47
+ return "AmazonLambdaUpdateFunctionDescriptionPython"
48
+
49
+ def get_steps(self) -> dex.StepList[UpdateFunctionDescriptionInput]:
50
+ """Register the provider and completion Steps."""
51
+ return dex.StepList.start_step(self.operation).other_steps(self.complete)
52
+
53
+ def get_persistence_schema(self) -> dex.PersistenceSchema:
54
+ """Declare the Flow persistence schema."""
55
+ return dex.PersistenceSchema.of()
@@ -12,7 +12,10 @@ from dex_connectors.sdk.projectconfig import load_from_environment
12
12
 
13
13
  from dex_connectors.amazon_lambda import new_project_connection
14
14
 
15
+ from .delete_function import DeleteFunctionFlow
15
16
  from .flow import CONNECTION_NAME, FunctionLookupFlow
17
+ from .list_functions import ListFunctionsFlow
18
+ from .update_function_description import UpdateFunctionDescriptionFlow
16
19
 
17
20
 
18
21
  async def run_worker() -> None:
@@ -22,7 +25,15 @@ async def run_worker() -> None:
22
25
  cache = None
23
26
  try:
24
27
  connection = new_project_connection(project, CONNECTION_NAME)
25
- registry = dex.Registry([FunctionLookupFlow(connection)], allow_async_handlers=True)
28
+ registry = dex.Registry(
29
+ [
30
+ FunctionLookupFlow(connection),
31
+ ListFunctionsFlow(connection),
32
+ UpdateFunctionDescriptionFlow(connection),
33
+ DeleteFunctionFlow(connection),
34
+ ],
35
+ allow_async_handlers=True,
36
+ )
26
37
  cache_directory = os.environ.get(
27
38
  "DEX_BLOB_CACHE_DIR",
28
39
  str(Path(tempfile.gettempdir()) / "dex-lambda-function-lookup-blobs"),
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dex-connector-amazon-lambda"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Amazon Lambda connector for Dex Flows"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,54 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Amazon Lambda function queries and mutations for Dex Flows."""
4
+
5
+ from .client import (
6
+ Client,
7
+ Config,
8
+ Credentials,
9
+ DeleteFunctionOperation,
10
+ GetFunctionOperation,
11
+ ListFunctionsOperation,
12
+ UpdateFunctionDescriptionOperation,
13
+ )
14
+ from .connection import Connection, new_connection, new_connection_with_operations, new_project_connection
15
+ from .models import (
16
+ DeleteFunctionInput,
17
+ FunctionDetails,
18
+ FunctionPage,
19
+ FunctionWriteResult,
20
+ GetFunctionInput,
21
+ ListFunctionsInput,
22
+ UpdateFunctionDescriptionInput,
23
+ )
24
+ from .steps import (
25
+ new_delete_function_step,
26
+ new_get_function_step,
27
+ new_list_functions_step,
28
+ new_update_function_description_step,
29
+ )
30
+
31
+ __all__ = [
32
+ "FunctionWriteResult",
33
+ "DeleteFunctionInput",
34
+ "UpdateFunctionDescriptionInput",
35
+ "FunctionPage",
36
+ "ListFunctionsInput",
37
+ "DeleteFunctionOperation",
38
+ "new_delete_function_step",
39
+ "UpdateFunctionDescriptionOperation",
40
+ "new_update_function_description_step",
41
+ "ListFunctionsOperation",
42
+ "new_list_functions_step",
43
+ "Client",
44
+ "Config",
45
+ "Connection",
46
+ "Credentials",
47
+ "GetFunctionInput",
48
+ "FunctionDetails",
49
+ "GetFunctionOperation",
50
+ "new_connection",
51
+ "new_connection_with_operations",
52
+ "new_get_function_step",
53
+ "new_project_connection",
54
+ ]
@@ -5,34 +5,55 @@
5
5
  from typing import Any
6
6
 
7
7
  import httpx
8
- from dex_connectors.sdk import ConnectionRef, Query, Call, SecretString
8
+ from dex_connectors.sdk import ConnectionRef, Mutation, Query, Call, SecretString
9
9
  from dex_connectors.sdk.projectconfig import ConnectionKey, LoadedProject
10
10
 
11
11
  from ..client import Client, Config, Credentials
12
- from .definitions import CONNECTOR_ID, GET_FUNCTION_DEFINITION
13
- from ..models import FunctionDetails, GetFunctionInput
12
+ from .definitions import CONNECTOR_ID, DELETE_FUNCTION_DEFINITION, GET_FUNCTION_DEFINITION, LIST_FUNCTIONS_DEFINITION, UPDATE_FUNCTION_DESCRIPTION_DEFINITION
13
+ from ..models import DeleteFunctionInput, FunctionDetails, FunctionPage, FunctionWriteResult, GetFunctionInput, ListFunctionsInput, UpdateFunctionDescriptionInput
14
14
 
15
15
  class Connection:
16
16
 
17
- __slots__ = ('_get_function', '_client', 'reference')
17
+ __slots__ = ('_get_function', '_list_functions', '_update_function_description', '_delete_function', '_client', 'reference')
18
18
 
19
19
  def __init__(self,
20
20
  reference: ConnectionRef,
21
21
  get_function: Query[GetFunctionInput, FunctionDetails],
22
+ list_functions: Query[ListFunctionsInput, FunctionPage],
23
+ update_function_description: Mutation[UpdateFunctionDescriptionInput, FunctionDetails],
24
+ delete_function: Mutation[DeleteFunctionInput, FunctionWriteResult],
22
25
  client: Client | None = None,
23
26
  ) -> None:
24
27
  reference.validate()
25
- if reference.provider != CONNECTOR_ID or get_function is None:
28
+ if reference.provider != CONNECTOR_ID or get_function is None or list_functions is None or update_function_description is None or delete_function is None:
26
29
  raise ValueError("Amazon Lambda connection provider and operations are required")
27
30
  if get_function.definition().operation != GET_FUNCTION_DEFINITION.operation:
28
31
  raise ValueError("Amazon Lambda connection operation identity differs")
32
+ if list_functions.definition().operation != LIST_FUNCTIONS_DEFINITION.operation:
33
+ raise ValueError("Amazon Lambda connection operation identity differs")
34
+ if update_function_description.definition().operation != UPDATE_FUNCTION_DESCRIPTION_DEFINITION.operation:
35
+ raise ValueError("Amazon Lambda connection operation identity differs")
36
+ if delete_function.definition().operation != DELETE_FUNCTION_DEFINITION.operation:
37
+ raise ValueError("Amazon Lambda connection operation identity differs")
29
38
  self.reference = reference
30
39
  self._get_function = get_function
40
+ self._list_functions = list_functions
41
+ self._update_function_description = update_function_description
42
+ self._delete_function = delete_function
31
43
  self._client = client
32
44
 
33
45
  def get_function(self) -> Query[GetFunctionInput, FunctionDetails]:
34
46
  return self._get_function
35
47
 
48
+ def list_functions(self) -> Query[ListFunctionsInput, FunctionPage]:
49
+ return self._list_functions
50
+
51
+ def update_function_description(self) -> Mutation[UpdateFunctionDescriptionInput, FunctionDetails]:
52
+ return self._update_function_description
53
+
54
+ def delete_function(self) -> Mutation[DeleteFunctionInput, FunctionWriteResult]:
55
+ return self._delete_function
56
+
36
57
  async def aclose(self) -> None:
37
58
  if self._client is not None:
38
59
  await self._client.aclose()
@@ -49,20 +70,39 @@ setattr(Connection, '__module__', 'dex_connectors.amazon_lambda.connection')
49
70
  def new_connection(client: Client, reference: ConnectionRef) -> Connection:
50
71
  if client is None:
51
72
  raise ValueError("Amazon Lambda client is required")
52
- return Connection(reference, client.get_function(), client)
73
+ return Connection(reference, client.get_function(), client.list_functions(), client.update_function_description(), client.delete_function(), client)
53
74
 
54
75
  setattr(new_connection, '__module__', 'dex_connectors.amazon_lambda.connection')
55
76
 
56
77
 
57
78
  def new_connection_with_operations(
58
79
  get_function: Query[GetFunctionInput, FunctionDetails],
80
+ list_functions: Query[ListFunctionsInput, FunctionPage],
81
+ update_function_description: Mutation[UpdateFunctionDescriptionInput, FunctionDetails],
82
+ delete_function: Mutation[DeleteFunctionInput, FunctionWriteResult],
59
83
  reference: ConnectionRef,
60
84
  ) -> Connection:
61
- return Connection(reference, get_function)
85
+ return Connection(reference, get_function, list_functions, update_function_description, delete_function)
62
86
 
63
87
  setattr(new_connection_with_operations, '__module__', 'dex_connectors.amazon_lambda.connection')
64
88
 
65
89
 
90
+ class CredentialMaterialError(ValueError):
91
+ "Stored Amazon Lambda credential material fails the connector credential checks, so no retry can succeed."
92
+
93
+
94
+ def is_credential_material_error(error: BaseException) -> bool:
95
+ """Report malformed stored credential material, also behind the SDK provider's decoding ValueError."""
96
+ if isinstance(error, CredentialMaterialError):
97
+ return True
98
+ # Only the SDK decoding wrapper qualifies; other errors may be transient.
99
+ return (
100
+ type(error) is ValueError
101
+ and str(error) in {'project credential decoding failed', 'shared project credential decoding failed'}
102
+ and isinstance(error.__context__, CredentialMaterialError)
103
+ )
104
+
105
+
66
106
  class _ProjectCredentialSource:
67
107
 
68
108
  def __init__(self, project: LoadedProject, key: ConnectionKey) -> None:
@@ -72,22 +112,22 @@ class _ProjectCredentialSource:
72
112
  async def resolve(self, call: Call) -> Credentials:
73
113
  material = await self.project.resolve_credential(self.key, str(call.id))
74
114
  if not isinstance(material, dict):
75
- raise ValueError("Amazon Lambda stored credential does not match the connector credential fields")
115
+ raise CredentialMaterialError("Amazon Lambda stored credential does not match the connector credential fields")
76
116
  if set(material) - set(('access_key_id', 'secret_access_key', 'session_token')):
77
- raise ValueError("Amazon Lambda stored credential does not match the connector credential fields")
117
+ raise CredentialMaterialError("Amazon Lambda stored credential does not match the connector credential fields")
78
118
  access_key_id = material.get("access_key_id")
79
119
  if access_key_id is not None and not (isinstance(access_key_id, str)):
80
- raise ValueError("Amazon Lambda credential access_key_id has an invalid type")
120
+ raise CredentialMaterialError("Amazon Lambda credential access_key_id has an invalid type")
81
121
  secret_access_key = material.get("secret_access_key")
82
122
  if secret_access_key is not None and not (isinstance(secret_access_key, str)):
83
- raise ValueError("Amazon Lambda credential secret_access_key has an invalid type")
123
+ raise CredentialMaterialError("Amazon Lambda credential secret_access_key has an invalid type")
84
124
  session_token = material.get("session_token")
85
125
  if session_token is not None and not (isinstance(session_token, str)):
86
- raise ValueError("Amazon Lambda credential session_token has an invalid type")
126
+ raise CredentialMaterialError("Amazon Lambda credential session_token has an invalid type")
87
127
  if not access_key_id:
88
- raise ValueError("Amazon Lambda credential access_key_id is required")
128
+ raise CredentialMaterialError("Amazon Lambda credential access_key_id is required")
89
129
  if not secret_access_key:
90
- raise ValueError("Amazon Lambda credential secret_access_key is required")
130
+ raise CredentialMaterialError("Amazon Lambda credential secret_access_key is required")
91
131
  return Credentials(SecretString(access_key_id), SecretString(secret_access_key), SecretString(session_token or ''))
92
132
 
93
133
 
@@ -0,0 +1,91 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ # ruff: noqa
4
+
5
+ from datetime import timedelta
6
+
7
+ from dex_connectors.sdk import (
8
+ BranchDefinition,
9
+ MutationDefinition,
10
+ OperationRef,
11
+ QueryDefinition,
12
+ RetryPolicy,
13
+ StepDefaults,
14
+ default_connector_step_execute_retry_policy,
15
+ )
16
+
17
+ CONNECTOR_ID = "amazon-lambda"
18
+ PROVIDER = "amazon-lambda"
19
+ GET_FUNCTION_OPERATION_ID = "getFunction"
20
+ LIST_FUNCTIONS_OPERATION_ID = "listFunctions"
21
+ UPDATE_FUNCTION_DESCRIPTION_OPERATION_ID = "updateFunctionDescription"
22
+ DELETE_FUNCTION_OPERATION_ID = "deleteFunction"
23
+ DEFECT = "defect"
24
+ DELETED = "deleted"
25
+ FOUND = "found"
26
+ INVALID_RESPONSE = "invalidResponse"
27
+ LISTED = "listed"
28
+ MISSING = "missing"
29
+ PROVIDER_REJECTED = "providerRejected"
30
+ UPDATED = "updated"
31
+
32
+ GET_FUNCTION_DEFINITION = QueryDefinition(
33
+ OperationRef(CONNECTOR_ID, GET_FUNCTION_OPERATION_ID),
34
+ (
35
+ BranchDefinition(FOUND, "AWS returned the function configuration.", False),
36
+ BranchDefinition(MISSING, "The function does not exist in the selected Region.", True),
37
+ BranchDefinition(PROVIDER_REJECTED, "AWS conclusively rejected the request or credentials.", True),
38
+ BranchDefinition(INVALID_RESPONSE, "AWS returned malformed or oversized function metadata.", True),
39
+ BranchDefinition(DEFECT, "The function name, endpoint, Region, or credentials are invalid.", True),
40
+ ),
41
+ StepDefaults(
42
+ timedelta(seconds=30),
43
+ 2,
44
+ execute_retry=default_connector_step_execute_retry_policy(),
45
+ ),
46
+ )
47
+
48
+ LIST_FUNCTIONS_DEFINITION = QueryDefinition(
49
+ OperationRef(CONNECTOR_ID, LIST_FUNCTIONS_OPERATION_ID),
50
+ (
51
+ BranchDefinition(LISTED, "AWS returned a page of functions.", False),
52
+ BranchDefinition(PROVIDER_REJECTED, "AWS conclusively rejected the request or credentials.", True),
53
+ BranchDefinition(INVALID_RESPONSE, "AWS returned malformed or oversized function metadata.", True),
54
+ BranchDefinition(DEFECT, "The page input or connection settings are invalid.", True),
55
+ ),
56
+ StepDefaults(
57
+ timedelta(seconds=30),
58
+ 2,
59
+ execute_retry=default_connector_step_execute_retry_policy(),
60
+ ),
61
+ )
62
+
63
+ UPDATE_FUNCTION_DESCRIPTION_DEFINITION = MutationDefinition(
64
+ OperationRef(CONNECTOR_ID, UPDATE_FUNCTION_DESCRIPTION_OPERATION_ID),
65
+ (
66
+ BranchDefinition(UPDATED, "AWS accepted the description update.", False),
67
+ BranchDefinition(MISSING, "The function does not exist.", True),
68
+ BranchDefinition(PROVIDER_REJECTED, "AWS conclusively rejected the update.", True),
69
+ BranchDefinition(INVALID_RESPONSE, "AWS returned malformed or oversized metadata.", True),
70
+ BranchDefinition(DEFECT, "The update input or connection settings are invalid.", True),
71
+ ),
72
+ StepDefaults(
73
+ timedelta(seconds=30),
74
+ 2,
75
+ execute_retry=default_connector_step_execute_retry_policy(),
76
+ ),
77
+ )
78
+
79
+ DELETE_FUNCTION_DEFINITION = MutationDefinition(
80
+ OperationRef(CONNECTOR_ID, DELETE_FUNCTION_OPERATION_ID),
81
+ (
82
+ BranchDefinition(DELETED, "The function is absent after deletion.", False),
83
+ BranchDefinition(PROVIDER_REJECTED, "AWS conclusively rejected the deletion.", True),
84
+ BranchDefinition(DEFECT, "The function name or connection settings are invalid.", True),
85
+ ),
86
+ StepDefaults(
87
+ timedelta(seconds=30),
88
+ 2,
89
+ execute_retry=default_connector_step_execute_retry_policy(),
90
+ ),
91
+ )