clear-skies-aws 2.0.2__tar.gz → 2.0.4__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 (91) hide show
  1. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.pre-commit-config.yaml +1 -4
  2. clear_skies_aws-2.0.4/CHANGELOG.md +96 -0
  3. clear_skies_aws-2.0.4/LATEST_CHANGELOG.md +11 -0
  4. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/PKG-INFO +5 -3
  5. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/pyproject.toml +6 -4
  6. clear_skies_aws-2.0.4/src/clearskies_aws/__init__.py +29 -0
  7. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/backends/__init__.py +3 -3
  8. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/backends/dynamo_db_backend.py +1 -0
  9. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/backends/dynamo_db_condition_parser.py +1 -0
  10. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/backends/dynamo_db_parti_ql_backend.py +2 -0
  11. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/contexts/__init__.py +5 -5
  12. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/contexts/cli_web_socket_mock.py +3 -2
  13. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/contexts/lambda_alb.py +8 -3
  14. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/contexts/lambda_api_gateway.py +13 -9
  15. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/contexts/lambda_api_gateway_web_socket.py +24 -2
  16. clear_skies_aws-2.0.4/src/clearskies_aws/contexts/lambda_invoke.py +138 -0
  17. clear_skies_aws-2.0.4/src/clearskies_aws/contexts/lambda_sns.py +124 -0
  18. clear_skies_aws-2.0.4/src/clearskies_aws/contexts/lambda_sqs_standard.py +139 -0
  19. clear_skies_aws-2.0.4/src/clearskies_aws/cursors/__init__.py +3 -0
  20. clear_skies_aws-2.0.4/src/clearskies_aws/cursors/iam/__init__.py +7 -0
  21. clear_skies_aws-2.0.4/src/clearskies_aws/cursors/iam/rds_mysql.py +125 -0
  22. clear_skies_aws-2.0.4/src/clearskies_aws/cursors/port_forwarding/__init__.py +3 -0
  23. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/di/aws_additional_config_auto_import.py +1 -1
  24. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/di/inject/boto3.py +1 -1
  25. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/endpoints/__init__.py +0 -1
  26. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/endpoints/secrets_manager_rotation.py +1 -2
  27. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/__init__.py +2 -2
  28. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/cli_web_socket_mock.py +2 -0
  29. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py +9 -7
  30. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/lambda_input_output.py +4 -2
  31. clear_skies_aws-2.0.2/src/clearskies_aws/input_outputs/lambda_invocation.py → clear_skies_aws-2.0.4/src/clearskies_aws/input_outputs/lambda_invoke.py +10 -7
  32. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/lambda_sns.py +27 -18
  33. clear_skies_aws-2.0.4/src/clearskies_aws/input_outputs/lambda_sqs_standard.py +86 -0
  34. clear_skies_aws-2.0.4/src/clearskies_aws/models/__init__.py +1 -0
  35. clear_skies_aws-2.0.4/uv.lock +1411 -0
  36. clear_skies_aws-2.0.2/CHANGELOG.md +0 -51
  37. clear_skies_aws-2.0.2/LATEST_CHANGELOG.md +0 -9
  38. clear_skies_aws-2.0.2/src/clearskies_aws/__init__.py +0 -15
  39. clear_skies_aws-2.0.2/src/clearskies_aws/contexts/lambda_invocation.py +0 -19
  40. clear_skies_aws-2.0.2/src/clearskies_aws/contexts/lambda_sns.py +0 -18
  41. clear_skies_aws-2.0.2/src/clearskies_aws/contexts/lambda_sqs_standard_partial_batch.py +0 -29
  42. clear_skies_aws-2.0.2/src/clearskies_aws/input_outputs/lambda_sqs_standard.py +0 -84
  43. clear_skies_aws-2.0.2/src/clearskies_aws/models/__init__.py +0 -0
  44. clear_skies_aws-2.0.2/uv.lock +0 -1324
  45. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.copier-answers.yml +0 -0
  46. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.editorconfig +0 -0
  47. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.github/workflows/create-version.yaml +0 -0
  48. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.github/workflows/docs.yaml +0 -0
  49. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.github/workflows/run-tests.yml +0 -0
  50. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.github/workflows/tests-matrix.yaml +0 -0
  51. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.github/workflows/tests.yaml +0 -0
  52. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.gitignore +0 -0
  53. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/.python-version +0 -0
  54. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/LICENSE +0 -0
  55. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/README.md +0 -0
  56. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/cliff.toml +0 -0
  57. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/ruff.toml +0 -0
  58. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/__init__.py +0 -0
  59. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/action_aws.py +0 -0
  60. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/assume_role.py +0 -0
  61. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/ses.py +0 -0
  62. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/sns.py +0 -0
  63. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/sqs.py +0 -0
  64. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/actions/step_function.py +0 -0
  65. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/backends/backend.py +0 -0
  66. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/backends/sqs_backend.py +0 -0
  67. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/configs/__init__.py +0 -0
  68. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/di/__init__.py +0 -0
  69. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/di/inject/__init__.py +0 -0
  70. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/di/inject/boto3_session.py +0 -0
  71. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/di/inject/parameter_store.py +0 -0
  72. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/endpoints/simple_body_routing.py +0 -0
  73. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/lambda_alb.py +0 -0
  74. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/input_outputs/lambda_api_gateway.py +0 -0
  75. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/mocks/__init__.py +0 -0
  76. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/mocks/actions/__init__.py +0 -0
  77. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/mocks/actions/ses.py +0 -0
  78. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/mocks/actions/sns.py +0 -0
  79. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/mocks/actions/sqs.py +0 -0
  80. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/mocks/actions/step_function.py +0 -0
  81. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/models/web_socket_connection_model.py +0 -0
  82. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/__init__.py +0 -0
  83. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/additional_configs/__init__.py +0 -0
  84. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/additional_configs/iam_db_auth.py +0 -0
  85. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py +0 -0
  86. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py +0 -0
  87. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py +0 -0
  88. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/akeyless_with_ssm_cache.py +0 -0
  89. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/parameter_store.py +0 -0
  90. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/secrets.py +0 -0
  91. {clear_skies_aws-2.0.2 → clear_skies_aws-2.0.4}/src/clearskies_aws/secrets/secrets_manager.py +0 -0
@@ -8,9 +8,6 @@ ci:
8
8
  default_install_hook_types:
9
9
  - pre-commit
10
10
  - commit-msg
11
- - post-checkout
12
- - post-merge
13
- - post-rewrite
14
11
 
15
12
  default_stages: ["pre-commit"]
16
13
 
@@ -69,7 +66,7 @@ repos:
69
66
  hooks:
70
67
  - id: pytest
71
68
  name: pytest
72
- entry: uv run pytest .
69
+ entry: uv run pytest . -m "not broken"
73
70
  language: system
74
71
  types: [python]
75
72
  pass_filenames: false
@@ -0,0 +1,96 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.4] - 2026-01-09
9
+
10
+ ### Added
11
+ - Add rds mysql cursor
12
+
13
+ ### Changed
14
+ - Use the port forwarder class in [#8](https://github.com/clearskies-py/aws/pull/8)
15
+
16
+ ### Fixed
17
+ - Make age dynamic instead of fixed
18
+
19
+ ## [2.0.3] - 2026-01-05
20
+
21
+ ### Changed
22
+ - Bump version to v2.0.3 by @github-actions[bot]
23
+ - Merge pull request #7 from clearskies-py/contexts by @cmancone in [#7](https://github.com/clearskies-py/aws/pull/7)
24
+ - Require latest clearskies version per added feature by @cmancone
25
+ - Bring up-to-date by @cmancone
26
+
27
+ ### Fixed
28
+ - Inverted flag by @cmancone
29
+ - Tooling by @cmancone
30
+ - Mypy by @cmancone
31
+
32
+ ## [2.0.2] - 2025-10-30
33
+
34
+ ### Changed
35
+ - Bump version to v2.0.2 by @github-actions[bot]
36
+ - Update lock file
37
+
38
+ ### Fixed
39
+ - Build path
40
+ - Build path
41
+
42
+ ## [2.0.1] - 2025-10-21
43
+
44
+ ### Added
45
+ - Add simple body routing
46
+ - Add parameter_store tests
47
+ - Add actions
48
+ - Add AwsAdditionalConfigAutoImport
49
+ - Add __init__.py and imports for test module
50
+ - Add parameter_store tests
51
+ - Add actions
52
+ - Add AwsAdditionalConfigAutoImport
53
+
54
+ ### Changed
55
+ - Bump version to v2.0.1 by @github-actions[bot]
56
+ - Disable pytest and mypy for now in [#4](https://github.com/clearskies-py/aws/pull/4)
57
+ - More updates to get to 2.0 in [#1](https://github.com/clearskies-py/aws/pull/1)
58
+ - Moving along by @cmancone
59
+ - Try lambda sqs standard partial batch
60
+ - Combine the v1 / v2 gateway to one
61
+ - Input outputs
62
+ - Use same backend for all
63
+ - Mark failing test as broken
64
+ - More migration work
65
+ - Cleanup/tests by @cmancone
66
+ - Working through basics by @cmancone
67
+ - Moving along by @cmancone
68
+ - Moving along by @cmancone
69
+ - Try lambda sqs standard partial batch
70
+ - Combine the v1 / v2 gateway to one
71
+ - Input outputs
72
+ - Use same backend for all
73
+ - Mark failing test as broken
74
+ - More migration work
75
+ - First commit: Import from WIP by @cmancone
76
+
77
+ ### Fixed
78
+ - Rewrite sqs test
79
+ - Merge in Tom's stuff by @cmancone
80
+ - Rewrite sqs test
81
+
82
+ ### Removed
83
+ - Remove unneeded dependency
84
+ - Remove clearskies_aws.di
85
+ - Remove unneeded dependency
86
+ - Remove clearskies_aws.di
87
+
88
+ ## New Contributors
89
+ * @cmancone made their first contribution
90
+ * @ made their first contribution
91
+ * @github-actions[bot] made their first contribution
92
+ [2.0.4]: https://github.com/clearskies-py/aws/compare/v2.0.3..v2.0.4
93
+ [2.0.3]: https://github.com/clearskies-py/aws/compare/v2.0.2..v2.0.3
94
+ [2.0.2]: https://github.com/clearskies-py/aws/compare/v2.0.1..v2.0.2
95
+
96
+ <!-- generated by git-cliff -->
@@ -0,0 +1,11 @@
1
+ ## [2.0.4] - 2026-01-09
2
+
3
+ ### Added
4
+ - Add rds mysql cursor
5
+
6
+ ### Changed
7
+ - Use the port forwarder class in [#8](https://github.com/clearskies-py/aws/pull/8)
8
+
9
+ ### Fixed
10
+ - Make age dynamic instead of fixed
11
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clear-skies-aws
3
- Version: 2.0.2
3
+ Version: 2.0.4
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
@@ -16,11 +16,13 @@ Classifier: License :: OSI Approved :: MIT License
16
16
  Classifier: Programming Language :: Python :: 3
17
17
  Requires-Python: <4.0,>=3.11
18
18
  Requires-Dist: boto3<2.0.0,>=1.26.148
19
- Requires-Dist: clear-skies<3.0.0,>=2.0.2
20
- Requires-Dist: types-boto3[dynamodb,sns,sqs]<2.0.0,>=1.38.13
19
+ Requires-Dist: clear-skies<3.0.0,>=2.0.20
20
+ Requires-Dist: types-boto3[dynamodb,secretsmanager,ses,sns,sqs,ssm,stepfunctions]<2.0.0,>=1.38.13
21
21
  Provides-Extra: akeyless
22
22
  Requires-Dist: akeyless-cloud-id<0.5.0,>=0.2.3; extra == 'akeyless'
23
23
  Requires-Dist: akeyless<6.0.0,>=5.0.0; extra == 'akeyless'
24
+ Provides-Extra: mysql
25
+ Requires-Dist: pymysql<2.0.0,>=1.1.0; extra == 'mysql'
24
26
  Provides-Extra: ses
25
27
  Requires-Dist: jinja2<4.0.0,>=3.1.2; extra == 'ses'
26
28
  Description-Content-Type: text/markdown
@@ -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.2"
6
+ version = "2.0.4"
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
  'boto3 (>=1.26.148,<2.0.0)',
12
- "clear-skies (>=2.0.2,<3.0.0)",
13
- 'types-boto3[dynamodb,sns,sqs] (>=1.38.13,<2.0.0)',
12
+ "clear-skies>=2.0.20,<3.0.0",
13
+ 'types-boto3[dynamodb,sns,sqs,ses,ssm,secretsmanager,stepfunctions] (>=1.38.13,<2.0.0)',
14
14
  ]
15
15
  classifiers = [
16
16
  "Development Status :: 5 - Production/Stable",
@@ -28,6 +28,7 @@ Documentation = "https://clearskies.info/modules/clearskies-aws/"
28
28
  [project.optional-dependencies]
29
29
  akeyless = ['akeyless-cloud-id (>=0.2.3,<0.5.0)', 'akeyless (>=5.0.0,<6.0.0)']
30
30
  ses = ['jinja2 (>=3.1.2,<4.0.0)']
31
+ mysql = ['pymysql (>=1.1.0,<2.0.0)']
31
32
 
32
33
  [build-system]
33
34
  requires = ["hatchling"]
@@ -55,7 +56,8 @@ python_version = "3.11"
55
56
 
56
57
  exclude = [
57
58
  ".*_test\\.py$",
58
- "docs/.*"
59
+ "docs/.*",
60
+ "tests/.*"
59
61
  ]
60
62
 
61
63
  [tool.pytest.ini_options]
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ from clearskies_aws import (
4
+ actions,
5
+ backends,
6
+ contexts,
7
+ cursors,
8
+ di,
9
+ endpoints,
10
+ handlers,
11
+ input_outputs,
12
+ mocks,
13
+ models,
14
+ secrets,
15
+ )
16
+
17
+ __all__ = [
18
+ "actions",
19
+ "backends",
20
+ "contexts",
21
+ "cursors",
22
+ "di",
23
+ "endpoints",
24
+ "handlers",
25
+ "input_outputs",
26
+ "mocks",
27
+ "models",
28
+ "secrets",
29
+ ]
@@ -1,9 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from clearskies_aws.backends.backend import Backend
4
- from clearskies_aws.backends.dynamo_db_backend import DynamoDBBackend
5
- from clearskies_aws.backends.dynamo_db_condition_parser import DynamoDBConditionParser
6
- from clearskies_aws.backends.dynamo_db_parti_ql_backend import (
4
+ from clearskies_aws.backends.dynamo_db_backend import DynamoDBBackend # type: ignore
5
+ from clearskies_aws.backends.dynamo_db_condition_parser import DynamoDBConditionParser # type: ignore
6
+ from clearskies_aws.backends.dynamo_db_parti_ql_backend import ( # type: ignore
7
7
  DynamoDBPartiQLBackend,
8
8
  DynamoDBPartiQLCursor,
9
9
  )
@@ -1,3 +1,4 @@
1
+ # type: ignore
1
2
  from __future__ import annotations
2
3
 
3
4
  import base64
@@ -1,3 +1,4 @@
1
+ # type: ignore
1
2
  from __future__ import annotations
2
3
 
3
4
  import base64
@@ -1,3 +1,5 @@
1
+ # type: ignore
2
+
1
3
  from __future__ import annotations
2
4
 
3
5
  import base64
@@ -6,10 +6,10 @@ from clearskies_aws.contexts.lambda_api_gateway import LambdaApiGateway
6
6
  from clearskies_aws.contexts.lambda_api_gateway_web_socket import (
7
7
  LambdaApiGatewayWebSocket,
8
8
  )
9
- from clearskies_aws.contexts.lambda_invocation import LambdaInvocation
9
+ from clearskies_aws.contexts.lambda_invoke import LambdaInvoke
10
10
  from clearskies_aws.contexts.lambda_sns import LambdaSns
11
- from clearskies_aws.contexts.lambda_sqs_standard_partial_batch import (
12
- LambdaSqsStandardPartialBatch,
11
+ from clearskies_aws.contexts.lambda_sqs_standard import (
12
+ LambdaSqsStandard,
13
13
  )
14
14
 
15
15
  __all__ = [
@@ -17,7 +17,7 @@ __all__ = [
17
17
  "LambdaAlb",
18
18
  "LambdaApiGateway",
19
19
  "LambdaApiGatewayWebSocket",
20
- "LambdaInvocation",
20
+ "LambdaInvoke",
21
21
  "LambdaSns",
22
- "LambdaSqsStandardPartialBatch",
22
+ "LambdaSqsStandard",
23
23
  ]
@@ -12,8 +12,9 @@ class CliWebSocketMock(cli.Cli):
12
12
  The LambdaApiGatewayWebSocket context makes it easy to run websocket applications, but testing
13
13
  these locally is literally impossible. This context provides a close analogue to the way
14
14
  the LambdaApiGatewayWebSocket context works to give some testing capabilities when running
15
- locally.
15
+ locally. It works identically to `clearskies.contexts.Cli` but you have to provide a
16
+ `connection_id` property in the JSON body.
16
17
  """
17
18
 
18
19
  def __call__(self):
19
- return self.execute_application(CliWebSocketMockInputOutput())
20
+ return self.execute_application(CLIWebSocketMockInputOutput())
@@ -65,11 +65,16 @@ class LambdaAlb(Context):
65
65
  return application(event, context)
66
66
  ```
67
67
 
68
- ### Context for Callables
68
+ ### Context Specifics
69
69
 
70
70
  When using this context, two additional named arguments become available to any callables invoked by clearskies:
71
- `event` and `context`. These correspond to the original `event` and `context` variables provided by AWS to
72
- the lambda.
71
+
72
+ ```
73
+ | Name | Type | Description |
74
+ |:-------------:|:----------------:|----------------------------------|
75
+ | `event` | `dict[str, Any]` | The lambda `event` object |
76
+ | `context` | `dict[str, Any]` | The lambda `context` object |
77
+ ```
73
78
  """
74
79
 
75
80
  def __call__(self, event: dict[str, Any], context: dict[str, Any]) -> Any: # type: ignore[override]
@@ -59,19 +59,23 @@ class LambdaApiGateway(Context):
59
59
  return application(event, context)
60
60
  ```
61
61
 
62
- ### Context for Callables
62
+ ### Context Specifics
63
63
 
64
64
  When using this context, a number of additional named arguments become available to any callables invoked by
65
65
  clearskies:
66
66
 
67
- 1. `event`
68
- 2. `context`
69
- 3. `resource`
70
- 4. `stage`
71
- 5. `request_id`
72
- 6. `api_id`
73
- 7. `api_version` (v1 or v2)
67
+ ```
68
+ | Name | Type | Description |
69
+ |:-------------:|:----------------:|----------------------------------|
70
+ | ` event` | `dict[str, Any]` | The lambda `event` object |
71
+ | `context` | `dict[str, Any]` | The lambda `context` object |
72
+ | `resource` | `str` | The route resource |
73
+ | `stage` | `str` | The stage of the lambda function |
74
+ | `request_id` | `str` | The AWS request id for the call |
75
+ | `api_id` | `str` | The id of the API |
76
+ | `api_version` | `str` | "v1" or "v2" |
77
+ ```
74
78
  """
75
79
 
76
- def __call__(self, event: dict[str, Any], context: dict[str, Any]) -> Any: # type: ignore[override]
80
+ def __call__(self, event: dict[str, Any], context: dict[str, Any]) -> dict[str, Any]: # type: ignore[override]
77
81
  return self.execute_application(LambdaApiGatewayInputOutput(event, context))
@@ -37,7 +37,7 @@ class LambdaApiGatewayWebSocket(Context):
37
37
  having to handle such things themselves, since the typical standards of web frameworks won't match up. In
38
38
  the case of routing with an API Gateway, it has its own suggested standard of setting a routekey where the
39
39
  API gateway will check for an application-defined route parameter in the request body and use this to route
40
- to an appropriate lambda. With clearskies, you can also use the `clearskies.endpoints.JsonParamEndpointGroup`
40
+ to an appropriate lambda. With clearskies, you can also use the `clearskies.endpoints.BodyParameterRouting`
41
41
  to accomplish the same.
42
42
 
43
43
  With a websocket through API Gateway, headers are available during the `on_connect` phase, so you can always
@@ -51,7 +51,29 @@ class LambdaApiGatewayWebSocket(Context):
51
51
  there is a base model class in `clearskies_aws.models.WebSocketConnectionModel`. Check the documentation for
52
52
  this class to understand how this is managed and see a "starter" websocket application.
53
53
 
54
+ ### Context Specifics
55
+
56
+ The following parameters are made available by name to any function invoked by clearskies when using
57
+ this context:
58
+
59
+ ```
60
+ | Name | Type | Description |
61
+ |:---------------:|:----------------:|--------------------------------------------------|
62
+ | `event` | `dict[str, Any]` | The lambda `event` object |
63
+ | `context` | `dict[str, Any]` | The lambda `context` object |
64
+ | `connection_id` | `str` | The Connection ID |
65
+ | `route_key` | `str` | The value of the route key, as determined by AWS |
66
+ | `stage` | `str` | The stage of the lambda function |
67
+ | `request_id` | `str` | The AWS request id for the call |
68
+ | `api_id` | `str` | The id of the API |
69
+ | `domain_name` | `str` | The domain name |
70
+ | `event_type` | `str` | One of "MESSAGE", "CONNECT", or "DISCONNECT" |
71
+ | `connected_at` | `str` | The connection time |
72
+ ```
73
+
54
74
  """
55
75
 
56
- def __call__(self, event: dict[str, Any], context: dict[str, Any], url: str = "") -> Any: # type: ignore[override]
76
+ def __call__( # type: ignore[override]
77
+ self, event: dict[str, Any], context: dict[str, Any], url: str = "", request_method: str = ""
78
+ ) -> dict[str, Any]:
57
79
  return self.execute_application(LambdaApiGatewayWebSocketInputOutput(event, context, url))
@@ -0,0 +1,138 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from clearskies.authentication import Public
6
+ from clearskies.contexts.context import Context
7
+
8
+ from clearskies_aws.input_outputs import LambdaInvoke as LambdaInvokeInputOutput
9
+
10
+
11
+ class LambdaInvoke(Context):
12
+ """
13
+ Execute a lambda directly.
14
+
15
+ This context is used when your clearskies application is running in a lambda that is executed
16
+ directly by some variation of `aws lambda invoke`. For this context, the `event` object passed
17
+ to the lambda handler becomes the request body in the clearskies application. Note that, unlike
18
+ other lambda execution strategies (ALB, Api Gateway, etc...) the event object is exactly equal
19
+ to the body sent in with the lambda function.
20
+
21
+ ### Usage
22
+
23
+ Here's a simple example:
24
+
25
+ ```
26
+ import clearskies
27
+
28
+
29
+ def my_function(request_data):
30
+ return request_data
31
+
32
+
33
+ lambda_invoke = clearskies_aws.contexts.LambdaInvoke(
34
+ clearskies.endpoints.Callable(
35
+ my_function,
36
+ return_standard_response=False,
37
+ )
38
+ )
39
+
40
+
41
+ def lambda_handler(event, context):
42
+ return lambda_invoke(event, context)
43
+ ```
44
+
45
+ You can attach this to a lambda and might invoke it like so, with the following response:
46
+
47
+ ```
48
+ $ aws lambda invoke --function-name [function_name] --cli-binary-format raw-in-base64-out --payload '{"some":"data"}' | jq
49
+ { "Payload": {"some": "data"} }
50
+ ```
51
+
52
+ Invoking a lambda doesn't happen from an http context, so there is no URL/request method/headers/etc.
53
+ This typically means that clearskies applications in this context don't do routing and don't have
54
+ authentication configured. If you wanted to though, you could use `clearskies.endpoints.BodyParameterRouting`
55
+ to setup some basic routing and let the invoking client choose a route by providing a parameter in the
56
+ payload passed to lambda invoke.
57
+
58
+ You can pass a URL/request method into the context when you invoke it, which is often used to simplify
59
+ configuration: you can setup a standard clearskies applications with multiple endpoints, and then
60
+ use that one application in multiple lambdas, specifying which endpoint to call for each lambda.
61
+ This can also be helpful if you already have a clearskies application prepared for a standard http context
62
+ and want to execute some subset of those endpoints in a lambda invoke context. It looks something like this:
63
+
64
+ ```
65
+ import clearskies
66
+
67
+
68
+ def some_function(request_data):
69
+ return request_data
70
+
71
+
72
+ def some_other_function(request_data):
73
+ return request_data
74
+
75
+
76
+ def something_else(request_data):
77
+ return request_data
78
+
79
+
80
+ lambda_invoke = clearskies_aws.contexts.LambdaInvoke(
81
+ clearskies.endpoints.EndpointGroup(
82
+ [
83
+ clearskies.endpoints.Callable(
84
+ some_function,
85
+ url="some_function",
86
+ ),
87
+ clearskies.endpoints.Callable(
88
+ some_other_function,
89
+ url="some_other_function",
90
+ ),
91
+ clearskies.endpoints.Callable(
92
+ something_else,
93
+ url="something_else",
94
+ ),
95
+ ]
96
+ )
97
+ )
98
+
99
+
100
+ def some_function_handler(event, context):
101
+ return lambda_invoke(event, context, url="some_function")
102
+
103
+
104
+ def some_other_function_handler(event, context):
105
+ return lambda_invoke(event, context, url="some_other_function")
106
+
107
+
108
+ def something_else_handler(event, context):
109
+ return lambda_invoke(event, context, url="something_else")
110
+ ```
111
+
112
+ ### Context Specifics
113
+
114
+ When using the lambda_invoke context, it exposes a few context specific parameters which can be injected into
115
+ any function called by clearskies:
116
+
117
+ | Name | Type | Description |
118
+ |:------------------:|:----------------:|:-------------------------------:|
119
+ | `event` | `dict[str, Any]` | The lambda `event` object |
120
+ | `context` | `dict[str, Any]` | The lambda `context` object |
121
+ | `invocation_type` | `str` | Always `"direct"` |
122
+ | `function_name` | `str` | The name of the lambda function |
123
+ | `function_version` | `str` | The function version |
124
+ | `request_id` | `str` | The AWS request id for the call |
125
+
126
+ """
127
+
128
+ def __call__( # type: ignore[override]
129
+ self, event: dict[str, Any], context: dict[str, Any], request_method: str = "", url: str = ""
130
+ ) -> dict[str, Any]:
131
+ return self.execute_application(
132
+ LambdaInvokeInputOutput(
133
+ event,
134
+ context,
135
+ request_method=request_method,
136
+ url=url,
137
+ )
138
+ )
@@ -0,0 +1,124 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from clearskies.authentication import Public
6
+ from clearskies.contexts.context import Context
7
+
8
+ from clearskies_aws.input_outputs import LambdaSns as LambdaSnsInputOutput
9
+
10
+
11
+ class LambdaSns(Context):
12
+ """
13
+ Execute a clearskies application when attached to a lambda triggered by SNS.
14
+
15
+ This one is very straight-forward: just attach your clearskies application to work with an
16
+ SNS-triggered lambda. `request_data` provided to the clearskies application will be the
17
+ message sent to the SNS. Since this is no longer an http context, the various http parameters
18
+ (url, request method, headers, and even responses) do not exist. Routing won't exist unless
19
+ you use `clearskies.endpoints.BodyParameterRouting` and include the route parameter in your
20
+ SNS message body.
21
+
22
+ ### Usage
23
+
24
+ Here's a simple example:
25
+
26
+ ```
27
+ import clearskies
28
+
29
+
30
+ def my_function(request_data):
31
+ print(request_data)
32
+
33
+
34
+ lambda_invoke = clearskies_aws.contexts.LambdaInvoke(
35
+ clearskies.endpoints.Callable(
36
+ my_function,
37
+ return_standard_response=False,
38
+ )
39
+ )
40
+
41
+
42
+ def lambda_handler(event, context):
43
+ return lambda_invoke(event, context)
44
+ ```
45
+
46
+ Note the lack of a return value. You can return a value if you want, but it will be ignored
47
+ because SNS has no concept of a return response.
48
+
49
+ If you have a number of Lambda/SNS handlers, you can bundle them together for ease-of-management
50
+ and specify the URL when you invoke them:
51
+
52
+ ```
53
+ import clearskies
54
+
55
+
56
+ def some_function(request_data):
57
+ return request_data
58
+
59
+
60
+ def some_other_function(request_data):
61
+ return request_data
62
+
63
+
64
+ def something_else(request_data):
65
+ return request_data
66
+
67
+
68
+ lambda_invoke = clearskies_aws.contexts.LambdaSns(
69
+ clearskies.endpoints.EndpointGroup(
70
+ [
71
+ clearskies.endpoints.Callable(
72
+ some_function,
73
+ url="some_function",
74
+ ),
75
+ clearskies.endpoints.Callable(
76
+ some_other_function,
77
+ url="some_other_function",
78
+ ),
79
+ clearskies.endpoints.Callable(
80
+ something_else,
81
+ url="something_else",
82
+ ),
83
+ ]
84
+ )
85
+ )
86
+
87
+
88
+ def some_function_handler(event, context):
89
+ return lambda_invoke(event, context, url="some_function")
90
+
91
+
92
+ def some_other_function_handler(event, context):
93
+ return lambda_invoke(event, context, url="some_other_function")
94
+
95
+
96
+ def something_else_handler(event, context):
97
+ return lambda_invoke(event, context, url="something_else")
98
+ ```
99
+
100
+ ### Context Specifics
101
+
102
+ When you use the LambdaSns context, it makes the following named parameters available
103
+ to any callable that is invoked by clearskies:
104
+
105
+ ```
106
+ | Name | Type | Description |
107
+ |:------------:|:----------------:|------------------------------------------------|
108
+ | `event` | `dict[str, Any]` | The lambda `event` object |
109
+ | `context` | `dict[str, Any]` | The lambda `context` object |
110
+ | `message_id` | `str` | The AWS message id |
111
+ | `topic_arn` | `str` | The ARN of the SNS topic that sent the message |
112
+ | `subject` | `str` | Any subject attached to the SNS message |
113
+ | `timestamp` | `str` | The timestamp when the message was sent |
114
+ ```
115
+ """
116
+
117
+ def __call__(self, event: dict[str, Any], context: dict[str, Any], request_method: str = "", url: str = ""): # type: ignore[override]
118
+ try:
119
+ return self.execute_application(
120
+ LambdaSnsInputOutput(event, context, request_method=request_method, url=url)
121
+ )
122
+ except Exception as e:
123
+ print("Failed message " + event["Records"][0]["Sns"]["MessageId"] + ". Error error: " + str(e))
124
+ raise e