clear-skies-aws 2.0.11__tar.gz → 2.0.12__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 (87) hide show
  1. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.copier-answers.yml +1 -1
  2. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.github/workflows/run-tests.yml +2 -1
  3. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.github/workflows/tests-matrix.yaml +12 -16
  4. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.pre-commit-config.yaml +5 -2
  5. clear_skies_aws-2.0.12/.vscode/settings.json +21 -0
  6. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/CHANGELOG.md +20 -0
  7. clear_skies_aws-2.0.12/LATEST_CHANGELOG.md +16 -0
  8. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/PKG-INFO +2 -2
  9. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/pyproject.toml +2 -2
  10. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/backends/backend.py +17 -21
  11. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/backends/sqs_backend.py +7 -10
  12. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/__init__.py +2 -0
  13. clear_skies_aws-2.0.12/src/clearskies_aws/contexts/lambda_step_function.py +129 -0
  14. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/__init__.py +2 -0
  15. clear_skies_aws-2.0.12/src/clearskies_aws/input_outputs/lambda_step_function.py +208 -0
  16. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/uv.lock +137 -137
  17. clear_skies_aws-2.0.11/LATEST_CHANGELOG.md +0 -8
  18. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.editorconfig +0 -0
  19. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.github/workflows/create-version.yaml +0 -0
  20. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.github/workflows/docs.yaml +0 -0
  21. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.github/workflows/tests.yaml +0 -0
  22. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.gitignore +0 -0
  23. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/.python-version +0 -0
  24. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/LICENSE +0 -0
  25. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/README.md +0 -0
  26. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/cliff.toml +0 -0
  27. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/ruff.toml +0 -0
  28. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/__init__.py +0 -0
  29. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/__init__.py +0 -0
  30. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/action_aws.py +0 -0
  31. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/assume_role.py +0 -0
  32. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/ses.py +0 -0
  33. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/sns.py +0 -0
  34. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/sqs.py +0 -0
  35. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/actions/step_function.py +0 -0
  36. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/backends/__init__.py +0 -0
  37. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/backends/dynamo_db_backend.py +0 -0
  38. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/backends/dynamo_db_condition_parser.py +0 -0
  39. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/backends/dynamo_db_parti_ql_backend.py +0 -0
  40. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/configs/__init__.py +0 -0
  41. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/cli_web_socket_mock.py +0 -0
  42. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/lambda_alb.py +0 -0
  43. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/lambda_api_gateway.py +0 -0
  44. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/lambda_api_gateway_web_socket.py +0 -0
  45. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/lambda_invoke.py +0 -0
  46. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/lambda_sns.py +0 -0
  47. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/contexts/lambda_sqs_standard.py +0 -0
  48. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/cursors/__init__.py +0 -0
  49. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/cursors/iam/__init__.py +0 -0
  50. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/cursors/iam/rds_mysql.py +0 -0
  51. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/cursors/port_forwarding/__init__.py +0 -0
  52. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/cursors/port_forwarding/ssm.py +0 -0
  53. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/di/__init__.py +0 -0
  54. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/di/aws_additional_config_auto_import.py +0 -0
  55. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/di/inject/__init__.py +0 -0
  56. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/di/inject/boto3.py +0 -0
  57. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/di/inject/boto3_session.py +0 -0
  58. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/di/inject/parameter_store.py +0 -0
  59. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/endpoints/__init__.py +0 -0
  60. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/endpoints/secrets_manager_rotation.py +0 -0
  61. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/endpoints/simple_body_routing.py +0 -0
  62. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/cli_web_socket_mock.py +0 -0
  63. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_alb.py +0 -0
  64. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_api_gateway.py +0 -0
  65. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py +0 -0
  66. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_input_output.py +0 -0
  67. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_invoke.py +0 -0
  68. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_sns.py +0 -0
  69. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/input_outputs/lambda_sqs_standard.py +0 -0
  70. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/mocks/__init__.py +0 -0
  71. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/mocks/actions/__init__.py +0 -0
  72. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/mocks/actions/ses.py +0 -0
  73. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/mocks/actions/sns.py +0 -0
  74. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/mocks/actions/sqs.py +0 -0
  75. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/mocks/actions/step_function.py +0 -0
  76. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/models/__init__.py +0 -0
  77. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/models/web_socket_connection_model.py +0 -0
  78. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/__init__.py +0 -0
  79. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/additional_configs/__init__.py +0 -0
  80. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/additional_configs/iam_db_auth.py +0 -0
  81. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py +0 -0
  82. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py +0 -0
  83. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py +0 -0
  84. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/akeyless_with_ssm_cache.py +0 -0
  85. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/parameter_store.py +0 -0
  86. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/secrets.py +0 -0
  87. {clear_skies_aws-2.0.11 → clear_skies_aws-2.0.12}/src/clearskies_aws/secrets/secrets_manager.py +0 -0
@@ -1,5 +1,5 @@
1
1
  # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
- _commit: v0.0.34
2
+ _commit: v0.0.45
3
3
  _src_path: https://github.com/clearskies-py/clearskies-module-template
4
4
  author_email: tom.nijboer@cimpress.com
5
5
  author_name: Tom Nijboer
@@ -67,8 +67,8 @@ jobs:
67
67
  python-version: ${{ matrix.python-version }}
68
68
  run-mypy: ${{ needs.changes.outputs.tests == 'true' }}
69
69
  run-pytest: ${{ needs.changes.outputs.tests == 'true' }}
70
- run-ruff-check: ${{ needs.changes.outputs.tests == 'true' }}
71
70
  run-ruff-format: ${{ needs.changes.outputs.tests == 'true' }}
71
+ run-ruff-check: ${{ needs.changes.outputs.tests == 'true' }}
72
72
  secrets: inherit
73
73
  strategy:
74
74
  matrix:
@@ -76,6 +76,7 @@ jobs:
76
76
  - '3.11'
77
77
  - '3.12'
78
78
  - '3.13'
79
+ - '3.14'
79
80
  fail-fast: false
80
81
 
81
82
  status:
@@ -14,10 +14,10 @@ on:
14
14
  run-pytest:
15
15
  required: true
16
16
  type: boolean
17
- run-ruff-check:
17
+ run-ruff-format:
18
18
  required: true
19
19
  type: boolean
20
- run-ruff-format:
20
+ run-ruff-check:
21
21
  required: true
22
22
  type: boolean
23
23
 
@@ -46,7 +46,6 @@ jobs:
46
46
  - name: Install dependencies
47
47
  run: uv sync --locked --all-extras --dev
48
48
  - run: uv run mypy src --check || true
49
- continue-on-error: true
50
49
 
51
50
  pytest:
52
51
  name: pytest
@@ -64,26 +63,23 @@ jobs:
64
63
  enable-cache: true
65
64
  - name: Install dependencies
66
65
  run: uv sync --locked --all-extras --dev
67
- - run: uv run pytest -v
68
- continue-on-error: true
69
- - run: git diff --exit-code --stat
70
- continue-on-error: true
71
-
66
+ - run: uv run pytest -v . -m "not broken"
67
+ - run: git diff --exit-code --stat HEAD
72
68
 
73
- ruff-check:
74
- name: ruff-check
69
+ ruff-format:
70
+ name: ruff-format
75
71
  runs-on: ${{ inputs.runner }}
76
- if: inputs.run-ruff-check
72
+ if: inputs.run-ruff-format
77
73
  steps:
78
74
  - uses: astral-sh/ruff-action@v3
79
75
  with:
80
- args: "check --diff"
76
+ args: "format --diff"
81
77
 
82
- ruff-format:
83
- name: ruff-format
78
+ ruff-check:
79
+ name: ruff-check
84
80
  runs-on: ${{ inputs.runner }}
85
- if: inputs.run-ruff-format
81
+ if: inputs.run-ruff-check
86
82
  steps:
87
83
  - uses: astral-sh/ruff-action@v3
88
84
  with:
89
- args: "format --diff"
85
+ args: "check --diff"
@@ -1,5 +1,5 @@
1
- # Pre-commit configuration for Akeyless Custom Producer
2
- fail_fast: true
1
+ # Pre-commit configuration for Clearkskies AWS project
2
+ fail_fast: false
3
3
 
4
4
  ci:
5
5
  autofix_commit_msg: "chore(pre-commit): autofix run"
@@ -8,6 +8,9 @@ ci:
8
8
  default_install_hook_types:
9
9
  - pre-commit
10
10
  - commit-msg
11
+ - post-checkout
12
+ - post-merge
13
+ - post-rewrite
11
14
 
12
15
  default_stages: ["pre-commit"]
13
16
 
@@ -0,0 +1,21 @@
1
+ {
2
+ "python.testing.pytestArgs": ["tests"],
3
+ "python.testing.unittestEnabled": false,
4
+ "python.testing.pytestEnabled": true,
5
+ "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
6
+ "ruff.interpreter": ["${workspaceFolder}/.venv/bin/python"],
7
+ "ruff.path": ["${workspaceFolder}/.venv/bin/ruff"],
8
+ "ruff.configuration": "${workspaceFolder}/ruff.toml",
9
+ "ruff.nativeServer": "on",
10
+ "[python]": {
11
+ "editor.formatOnSave": true,
12
+ "editor.codeActionsOnSave": {
13
+ "source.fixAll": "explicit",
14
+ "source.organizeImports": "explicit"
15
+ },
16
+ "editor.defaultFormatter": "charliermarsh.ruff"
17
+ },
18
+ "mypy-type-checker.args": [
19
+ "--config-file=${workspaceFolder}/pyproject.toml"
20
+ ]
21
+ }
@@ -5,8 +5,27 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.12] - 2026-01-27
9
+
10
+ ### Added
11
+ - Add docs
12
+ - Add stepfucntions context with variables to ENV vars
13
+
14
+ ### Changed
15
+ - Merge pull request #11 from clearskies-py/stepfunctions-variables by @cmancone in [#11](https://github.com/clearskies-py/aws/pull/11)
16
+ - Update docstrings of stepfunctions
17
+ - Move Environment to the input output of step functions
18
+ - Udpate to QueryResult
19
+ - Update to latest copier template
20
+
21
+ ### Fixed
22
+ - Ignore dynamodb mypy issues
23
+
8
24
  ## [2.0.11] - 2026-01-21
9
25
 
26
+ ### Changed
27
+ - Bump version to v2.0.11 by @github-actions[bot]
28
+
10
29
  ### Fixed
11
30
  - Set correct type for context
12
31
 
@@ -147,6 +166,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
147
166
  * @cmancone made their first contribution
148
167
  * @ made their first contribution
149
168
  * @github-actions[bot] made their first contribution
169
+ [2.0.12]: https://github.com/clearskies-py/aws/compare/v2.0.11..v2.0.12
150
170
  [2.0.11]: https://github.com/clearskies-py/aws/compare/v2.0.10..v2.0.11
151
171
  [2.0.10]: https://github.com/clearskies-py/aws/compare/v2.0.9..v2.0.10
152
172
  [2.0.9]: https://github.com/clearskies-py/aws/compare/v2.0.8..v2.0.9
@@ -0,0 +1,16 @@
1
+ ## [2.0.12] - 2026-01-27
2
+
3
+ ### Added
4
+ - Add docs
5
+ - Add stepfucntions context with variables to ENV vars
6
+
7
+ ### Changed
8
+ - Merge pull request #11 from clearskies-py/stepfunctions-variables by @cmancone in [#11](https://github.com/clearskies-py/aws/pull/11)
9
+ - Update docstrings of stepfunctions
10
+ - Move Environment to the input output of step functions
11
+ - Udpate to QueryResult
12
+ - Update to latest copier template
13
+
14
+ ### Fixed
15
+ - Ignore dynamodb mypy issues
16
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clear-skies-aws
3
- Version: 2.0.11
3
+ Version: 2.0.12
4
4
  Summary: clearskies bindings for working in AWS
5
5
  Project-URL: Repository, https://github.com/clearskies-py/clearskies-aws
6
6
  Project-URL: Issues, https://github.com/clearskies-py/clearskies-aws/issues
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3
17
17
  Requires-Python: <4.0,>=3.11
18
18
  Requires-Dist: awslambdaric>=3.1.1
19
19
  Requires-Dist: boto3<2.0.0,>=1.26.148
20
- Requires-Dist: clear-skies<3.0.0,>=2.0.20
20
+ Requires-Dist: clear-skies<3.0.0,>=2.0.37
21
21
  Requires-Dist: jinja2>=3.1.6
22
22
  Requires-Dist: types-boto3[dynamodb,secretsmanager,ses,sns,sqs,ssm,stepfunctions]<2.0.0,>=1.38.13
23
23
  Provides-Extra: akeyless
@@ -3,14 +3,14 @@
3
3
  name = "clear-skies-aws"
4
4
  description = "clearskies bindings for working in AWS"
5
5
  license = "MIT"
6
- version = "2.0.11"
6
+ version = "2.0.12"
7
7
  readme = "./README.md"
8
8
  authors = [{name = "tnijboer"}, {name = "Conor Mancone", email = "cmancone@gmail.com"}]
9
9
  requires-python = '>=3.11,<4.0'
10
10
  dependencies = [
11
11
  "awslambdaric>=3.1.1",
12
12
  'boto3 (>=1.26.148,<2.0.0)',
13
- "clear-skies>=2.0.20,<3.0.0",
13
+ "clear-skies>=2.0.37,<3.0.0",
14
14
  "jinja2>=3.1.6",
15
15
  'types-boto3[dynamodb,sns,sqs,ses,ssm,secretsmanager,stepfunctions] (>=1.38.13,<2.0.0)',
16
16
  ]
@@ -7,6 +7,12 @@ import clearskies.model
7
7
  import clearskies.query
8
8
  from clearskies.autodoc.schema import Schema as AutoDocSchema
9
9
  from clearskies.di import inject
10
+ from clearskies.query.result import (
11
+ CountQueryResult,
12
+ RecordQueryResult,
13
+ RecordsQueryResult,
14
+ SuccessQueryResult,
15
+ )
10
16
 
11
17
  from clearskies_aws.di.inject import boto3
12
18
 
@@ -31,35 +37,25 @@ class Backend(clearskies.Configurable, clearskies.backends.Backend, clearskies.d
31
37
  boto3 = boto3.Boto3()
32
38
  environment = inject.Environment()
33
39
 
34
- def update(self, id: int | str, data: dict[str, Any], model: clearskies.model.Model) -> dict[str, Any]:
40
+ def update(self, id: int | str, data: dict[str, Any], model: clearskies.model.Model) -> RecordQueryResult:
35
41
  """Update the record with the given id with the information from the data dictionary."""
36
- return {}
42
+ return RecordQueryResult(record={})
37
43
 
38
- def create(self, data: dict[str, Any], model: clearskies.model.Model) -> dict[str, Any]:
44
+ def create(self, data: dict[str, Any], model: clearskies.model.Model) -> RecordQueryResult:
39
45
  """Create a record with the information from the data dictionary."""
40
- return {}
46
+ return RecordQueryResult(record={})
41
47
 
42
- def delete(self, id: int | str, model: clearskies.model.Model) -> bool:
48
+ def delete(self, id: int | str, model: clearskies.model.Model) -> SuccessQueryResult:
43
49
  """Delete the record with the given id."""
44
- return True
50
+ return SuccessQueryResult()
45
51
 
46
- def count(self, query: clearskies.query.Query) -> int:
52
+ def count(self, query: clearskies.query.Query) -> CountQueryResult:
47
53
  """Return the number of records which match the given query configuration."""
48
- return 1
49
-
50
- def records(
51
- self,
52
- query: clearskies.query.Query,
53
- next_page_data: dict[str, str | int] | None = None,
54
- ) -> list[dict[str, Any]]:
55
- """
56
- Return a list of records that match the given query configuration.
54
+ return CountQueryResult(count=1)
57
55
 
58
- next_page_data is used to return data to the caller. Pass in an empty dictionary, and it will be populated
59
- with the data needed to return the next page of results. If it is still an empty dictionary when returned,
60
- then there is no additional data.
61
- """
62
- return []
56
+ def records(self, query: clearskies.query.Query) -> RecordsQueryResult:
57
+ """Return a list of records that match the given query configuration."""
58
+ return RecordsQueryResult(records=[])
63
59
 
64
60
  def validate_pagination_data(self, data: dict[str, Any], case_mapping: Callable[[str], str]) -> str:
65
61
  """
@@ -5,6 +5,7 @@ from typing import Any
5
5
 
6
6
  from clearskies import Model
7
7
  from clearskies.query import Query
8
+ from clearskies.query.result import CountQueryResult, RecordQueryResult, RecordsQueryResult, SuccessQueryResult
8
9
  from types_boto3_sqs import SQSClient
9
10
 
10
11
  from clearskies_aws.backends import backend
@@ -37,25 +38,21 @@ class SqsBackend(backend.Backend):
37
38
 
38
39
  return self._sqs
39
40
 
40
- def create(self, data: dict[str, Any], model: Model) -> dict[str, Any]:
41
+ def create(self, data: dict[str, Any], model: Model) -> RecordQueryResult:
41
42
  self.sqs.send_message(
42
43
  QueueUrl=model.destination_name(),
43
44
  MessageBody=json.dumps(data),
44
45
  )
45
- return {**data}
46
+ return RecordQueryResult(record={**data})
46
47
 
47
- def update(self, id: int | str, data: dict[str, Any], model: Model) -> dict[str, Any]:
48
+ def update(self, id: int | str, data: dict[str, Any], model: Model) -> RecordQueryResult:
48
49
  raise ValueError("The SQS backend only supports the create operation")
49
50
 
50
- def delete(self, id: int | str, model: Model) -> bool:
51
+ def delete(self, id: int | str, model: Model) -> SuccessQueryResult:
51
52
  raise ValueError("The SQS backend only supports the create operation")
52
53
 
53
- def count(self, query: Query) -> int:
54
+ def count(self, query: Query) -> CountQueryResult:
54
55
  raise ValueError("The SQS backend only supports the create operation")
55
56
 
56
- def records(
57
- self,
58
- query: Query,
59
- next_page_data: dict[str, str | int] | None = None,
60
- ) -> list[dict[str, Any]]:
57
+ def records(self, query: Query) -> RecordsQueryResult:
61
58
  raise ValueError("The SQS backend only supports the create operation")
@@ -11,6 +11,7 @@ from clearskies_aws.contexts.lambda_sns import LambdaSns
11
11
  from clearskies_aws.contexts.lambda_sqs_standard import (
12
12
  LambdaSqsStandard,
13
13
  )
14
+ from clearskies_aws.contexts.lambda_step_function import LambdaStepFunction
14
15
 
15
16
  __all__ = [
16
17
  "CliWebSocketMock",
@@ -20,4 +21,5 @@ __all__ = [
20
21
  "LambdaInvoke",
21
22
  "LambdaSns",
22
23
  "LambdaSqsStandard",
24
+ "LambdaStepFunction",
23
25
  ]
@@ -0,0 +1,129 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Callable
4
+
5
+ from clearskies.contexts.context import Context
6
+
7
+ from clearskies_aws.input_outputs.lambda_step_function import LambdaStepFunction as LambdaStepFunctionInputOutput
8
+
9
+
10
+ class LambdaStepFunction(Context):
11
+ """
12
+ Execute a Lambda invoked from AWS Step Functions.
13
+
14
+ This context is used when your clearskies application is running in a Lambda that is
15
+ invoked from an AWS Step Functions state machine. It supports extracting variables
16
+ assigned in the Step Functions state and exposing them through the clearskies
17
+ Environment class.
18
+
19
+ ### Usage
20
+
21
+ Basic usage:
22
+
23
+ ```python
24
+ import clearskies
25
+ import clearskies_aws
26
+
27
+
28
+ def my_function(request_data, environment):
29
+ # Access extracted environment variables
30
+ business_name = environment.get("BUSINESS_NAME")
31
+ return {"business": business_name, "data": request_data}
32
+
33
+
34
+ lambda_step_function = clearskies_aws.contexts.LambdaStepFunction(
35
+ clearskies.endpoints.Callable(
36
+ my_function,
37
+ return_standard_response=False,
38
+ ),
39
+ environment_keys=["BUSINESS_NAME", "GITLAB_AUTH_KEY"],
40
+ )
41
+
42
+
43
+ def lambda_handler(event, context):
44
+ return lambda_step_function(event, context)
45
+ ```
46
+
47
+ ### Configuration Options
48
+
49
+ The `environment_keys` parameter accepts three types:
50
+
51
+ **1. List of keys** - Extract specific keys from the event:
52
+ ```python
53
+ clearskies_aws.contexts.LambdaStepFunction(
54
+ endpoint, environment_keys=["BUSINESS_NAME", "GITLAB_AUTH_KEY"]
55
+ )
56
+ ```
57
+
58
+ **2. Mapping dict** - Map event keys to environment variable names:
59
+ ```python
60
+ clearskies_aws.contexts.LambdaStepFunction(
61
+ endpoint,
62
+ environment_keys={
63
+ "BUSINESS_NAME": "BUSINESS_NAME", # same name
64
+ "GITLAB_AUTH_KEY": "GITLAB_TOKEN_PATH", # rename
65
+ },
66
+ )
67
+ ```
68
+
69
+ **3. Callable** - Full control via a function (supports dependency injection):
70
+ ```python
71
+ def extract_env_vars(event, secrets):
72
+ # Can inject clearskies dependencies like secrets
73
+ return {
74
+ "BUSINESS_NAME": event.get("BUSINESS_NAME"),
75
+ "GITLAB_KEY": secrets.get(event.get("GITLAB_AUTH_KEY")),
76
+ }
77
+
78
+
79
+ clearskies_aws.contexts.LambdaStepFunction(endpoint, environment_keys=extract_env_vars)
80
+ ```
81
+
82
+ ### Context Specifics
83
+
84
+ When using this context, the following named parameters become available to inject
85
+ into any callable invoked by clearskies:
86
+
87
+ | Name | Type | Description |
88
+ |:----------------------:|:------------------:|:------------------------------------:|
89
+ | `event` | `dict[str, Any]` | The lambda `event` object |
90
+ | `context` | `dict[str, Any]` | The lambda `context` object |
91
+ | `invocation_type` | `str` | Always `"step-functions"` |
92
+ | `function_name` | `str` | The name of the lambda function |
93
+ | `function_version` | `str` | The function version |
94
+ | `request_id` | `str` | The AWS request id for the call |
95
+ | `states_context` | `dict[str, Any]` | The Step Functions $states context |
96
+
97
+ """
98
+
99
+ def __init__(
100
+ self,
101
+ endpoint,
102
+ environment_keys: list[str] | dict[str, str] | Callable[..., dict[str, Any]] | None = None,
103
+ **kwargs,
104
+ ):
105
+ super().__init__(endpoint, **kwargs)
106
+ self._environment_keys = environment_keys
107
+
108
+ def __call__( # type: ignore[override]
109
+ self,
110
+ event: dict[str, Any],
111
+ context: dict[str, Any],
112
+ request_method: str = "",
113
+ url: str = "",
114
+ ) -> dict[str, Any]:
115
+ input_output = LambdaStepFunctionInputOutput(
116
+ event,
117
+ context,
118
+ request_method=request_method,
119
+ url=url,
120
+ environment_keys=self._environment_keys,
121
+ )
122
+
123
+ # Inject extra environment variables from the step function event
124
+ input_output.inject_extra_environment_variables(
125
+ self.di.build("environment", cache=True),
126
+ self.di,
127
+ )
128
+
129
+ return self.execute_application(input_output)
@@ -9,6 +9,7 @@ from clearskies_aws.input_outputs.lambda_api_gateway_web_socket import (
9
9
  from clearskies_aws.input_outputs.lambda_invoke import LambdaInvoke
10
10
  from clearskies_aws.input_outputs.lambda_sns import LambdaSns
11
11
  from clearskies_aws.input_outputs.lambda_sqs_standard import LambdaSqsStandard
12
+ from clearskies_aws.input_outputs.lambda_step_function import LambdaStepFunction
12
13
 
13
14
  __all__ = [
14
15
  "CliWebSocketMock",
@@ -18,4 +19,5 @@ __all__ = [
18
19
  "LambdaInvoke",
19
20
  "LambdaSns",
20
21
  "LambdaSqsStandard",
22
+ "LambdaStepFunction",
21
23
  ]