clear-skies-aws 2.0.2__py3-none-any.whl → 2.0.4__py3-none-any.whl

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 (35) hide show
  1. {clear_skies_aws-2.0.2.dist-info → clear_skies_aws-2.0.4.dist-info}/METADATA +5 -3
  2. {clear_skies_aws-2.0.2.dist-info → clear_skies_aws-2.0.4.dist-info}/RECORD +33 -29
  3. {clear_skies_aws-2.0.2.dist-info → clear_skies_aws-2.0.4.dist-info}/WHEEL +1 -1
  4. clearskies_aws/__init__.py +16 -2
  5. clearskies_aws/backends/__init__.py +3 -3
  6. clearskies_aws/backends/dynamo_db_backend.py +1 -0
  7. clearskies_aws/backends/dynamo_db_condition_parser.py +1 -0
  8. clearskies_aws/backends/dynamo_db_parti_ql_backend.py +2 -0
  9. clearskies_aws/contexts/__init__.py +5 -5
  10. clearskies_aws/contexts/cli_web_socket_mock.py +3 -2
  11. clearskies_aws/contexts/lambda_alb.py +8 -3
  12. clearskies_aws/contexts/lambda_api_gateway.py +13 -9
  13. clearskies_aws/contexts/lambda_api_gateway_web_socket.py +24 -2
  14. clearskies_aws/contexts/lambda_invoke.py +138 -0
  15. clearskies_aws/contexts/lambda_sns.py +110 -4
  16. clearskies_aws/contexts/lambda_sqs_standard.py +139 -0
  17. clearskies_aws/cursors/__init__.py +3 -0
  18. clearskies_aws/cursors/iam/__init__.py +7 -0
  19. clearskies_aws/cursors/iam/rds_mysql.py +125 -0
  20. clearskies_aws/cursors/port_forwarding/__init__.py +3 -0
  21. clearskies_aws/di/aws_additional_config_auto_import.py +1 -1
  22. clearskies_aws/di/inject/boto3.py +1 -1
  23. clearskies_aws/endpoints/__init__.py +0 -1
  24. clearskies_aws/endpoints/secrets_manager_rotation.py +1 -2
  25. clearskies_aws/input_outputs/__init__.py +2 -2
  26. clearskies_aws/input_outputs/cli_web_socket_mock.py +2 -0
  27. clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py +9 -7
  28. clearskies_aws/input_outputs/lambda_input_output.py +4 -2
  29. clearskies_aws/input_outputs/{lambda_invocation.py → lambda_invoke.py} +10 -7
  30. clearskies_aws/input_outputs/lambda_sns.py +27 -18
  31. clearskies_aws/input_outputs/lambda_sqs_standard.py +32 -30
  32. clearskies_aws/models/__init__.py +1 -0
  33. clearskies_aws/contexts/lambda_invocation.py +0 -19
  34. clearskies_aws/contexts/lambda_sqs_standard_partial_batch.py +0 -29
  35. {clear_skies_aws-2.0.2.dist-info → clear_skies_aws-2.0.4.dist-info}/licenses/LICENSE +0 -0
@@ -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
@@ -1,4 +1,4 @@
1
- clearskies_aws/__init__.py,sha256=LAzXoPm5wVRdxUoQIWuBS_c71t9IT_iq-mIh338154o,297
1
+ clearskies_aws/__init__.py,sha256=o83_Jk53zPtFz-zYfJVtbwfw2NdATRziR0tvRijnxVs,396
2
2
  clearskies_aws/actions/__init__.py,sha256=YsIi3ZTdByu4R7I77uOAXDE5hzB31J_tRrIoTxe_bjo,371
3
3
  clearskies_aws/actions/action_aws.py,sha256=JMogBFIrN72h5oBQLbyMy0LmfVLrqvWCYLQDml1qO4M,4674
4
4
  clearskies_aws/actions/assume_role.py,sha256=XNxbVju460aBMS8NQhY80eoNVQgZRJ6-OydsNOx3neA,4319
@@ -6,46 +6,50 @@ clearskies_aws/actions/ses.py,sha256=Cu8USID8vy2IZC6sFOIQRzv8a0LCMvYG15yn0l-fl5g
6
6
  clearskies_aws/actions/sns.py,sha256=YS1TbEwtU-0lDbjG2HyTBs2J-ML5OL3ModAiGTMeK-c,2205
7
7
  clearskies_aws/actions/sqs.py,sha256=r0z8njU87n09UgAq3l34JuNIbaBE85D_z8IE6ciIs9Q,3359
8
8
  clearskies_aws/actions/step_function.py,sha256=Y6tGbQJIAD_IwV9ohwYfuv3vqtryTwpFTNGUFgdj_DQ,2689
9
- clearskies_aws/backends/__init__.py,sha256=LgMNrf2yD9_PZBGbfs3yQGWM0NelSwk9GO73NfGwc44,587
9
+ clearskies_aws/backends/__init__.py,sha256=lmjWPoLN7Ebmdj3Pv5X1tJDcRWN3PsR8aGG9nDcqOrs,635
10
10
  clearskies_aws/backends/backend.py,sha256=WpsoT0pZOdilvtOkbiNtk6DoOEzmjyWcCDfUCWOlToc,4316
11
- clearskies_aws/backends/dynamo_db_backend.py,sha256=cTlbSpMiJ-0YILeHRrMZ6u4blRl_76hmemZZO9BwNN4,29396
12
- clearskies_aws/backends/dynamo_db_condition_parser.py,sha256=OipIlFpcfS2GQiGpge6ZFX4NZNfNtHF87qi9g3yZgIU,12622
13
- clearskies_aws/backends/dynamo_db_parti_ql_backend.py,sha256=x1pLNTUsTjCxi1SDryr9_uhL-AQJS7ksP5bvQpnhaC8,46081
11
+ clearskies_aws/backends/dynamo_db_backend.py,sha256=0KfAow5pUXpiBg0rRWtG3j48mpHUtJP9q-C2FfpBeqA,29411
12
+ clearskies_aws/backends/dynamo_db_condition_parser.py,sha256=796BhrqqZy_lW4wVYbDKK85oVVKa0YnWbtl4Bb0RNF0,12637
13
+ clearskies_aws/backends/dynamo_db_parti_ql_backend.py,sha256=p0SdrRq467w0w5OxYscxPfqUOjrkZ41JLmJa3KQCXq8,46097
14
14
  clearskies_aws/backends/sqs_backend.py,sha256=kHTzgBwpYzV31UcGaoSUcC_7eZEwm-GsCHvXFM1OLT0,2152
15
15
  clearskies_aws/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- clearskies_aws/contexts/__init__.py,sha256=sdcIT85OXqwwo8CcBYuyNcN6kvkwv1Ph8MTwuSi4Bnk,767
17
- clearskies_aws/contexts/cli_web_socket_mock.py,sha256=ZjOhOtQHJ4Vf9V1Bkole6JiGyP1CLTzPqwTrLiiOi0A,660
18
- clearskies_aws/contexts/lambda_alb.py,sha256=9eLemimudZ4WsWGarONIhoiFnlk_fBygQ6XwJb7NrbY,3237
19
- clearskies_aws/contexts/lambda_api_gateway.py,sha256=K8sKDV2JtXbzcDy9SOd7kMveuD6t5VGxls2iDMiVhXY,2787
20
- clearskies_aws/contexts/lambda_api_gateway_web_socket.py,sha256=t3dLRT3s37xHazMa-KVOSWF-0OaUpGQ4an-olbeeJUw,3238
21
- clearskies_aws/contexts/lambda_invocation.py,sha256=j3AhSXMHRwKufOSTUjhMyeFk4sO_Y4BlX4ECCFvMudw,538
22
- clearskies_aws/contexts/lambda_sns.py,sha256=FFOIyyCQFKvYsolpf8zlVitdceRkgvEjds3GCXSJjdk,719
23
- clearskies_aws/contexts/lambda_sqs_standard_partial_batch.py,sha256=kWl3rFtsAbSkadRLZunN20oXvCQpZJFcDhv3VMMWrCg,1093
16
+ clearskies_aws/contexts/__init__.py,sha256=kBLUlkpIp88n5RgbE9gVi4rDnJou81vCE5g_aiv2v8Y,717
17
+ clearskies_aws/contexts/cli_web_socket_mock.py,sha256=XjsFcx0YlQqjb9Hh8q2NUW7T2Exu7_FHx9v_Am0Uq0g,784
18
+ clearskies_aws/contexts/lambda_alb.py,sha256=hNMWYePN_moC4waXdydAp7dJkGpSowxDZZzU39Sxc7I,3426
19
+ clearskies_aws/contexts/lambda_api_gateway.py,sha256=HWH-CAX_aYiDhQr8rBhR5TW99-wx2ODsyI_dqGJkcdw,3354
20
+ clearskies_aws/contexts/lambda_api_gateway_web_socket.py,sha256=0zrBF3ShxKcBoG9UFGENUrjYa9-F-f4iywYwa9Z6lc0,4583
21
+ clearskies_aws/contexts/lambda_invoke.py,sha256=hvW05FtyiraAvhQiP5DX77LhYoRMgFTY4Tv6HhHH9C8,4872
22
+ clearskies_aws/contexts/lambda_sns.py,sha256=_TyPqRWosfaJzreYGNabvR-XTLYYO4eVWMVINSIY-OE,4129
23
+ clearskies_aws/contexts/lambda_sqs_standard.py,sha256=sekaPlCRvuHk-E8ohfFQkC2gAfO-DnTC7uLiIKfGY0E,5293
24
+ clearskies_aws/cursors/__init__.py,sha256=vy-WYxNEy5nd9fqY0En3T6WhE3omoV1tE-A5Uz26cCk,94
25
+ clearskies_aws/cursors/iam/__init__.py,sha256=-0uOKKzWZrlnCzUNITleKyT0rl3cqoLEbPtVrAF46hI,143
26
+ clearskies_aws/cursors/iam/rds_mysql.py,sha256=PlJv8PebCFq08iv8OYPkSNd4dRTZFQbBrDFdb3brK_M,5656
27
+ clearskies_aws/cursors/port_forwarding/__init__.py,sha256=LBcFYeIIfmGhxf3Ezn1KChOUdkpF5AjJL1xE_ak-x3s,78
24
28
  clearskies_aws/di/__init__.py,sha256=pLHSIKxS1oELOgttRuwM0yXdJRxjZKXQ6tPxme2db0U,222
25
- clearskies_aws/di/aws_additional_config_auto_import.py,sha256=qc9AUlFdF9jhAzS99esyvgY1MiW7mLz45fATK7Yp0rg,1271
29
+ clearskies_aws/di/aws_additional_config_auto_import.py,sha256=94h_YsPBcdwMhqn0VAAfId1jLL5vCsk76kUrr-6ET_U,1275
26
30
  clearskies_aws/di/inject/__init__.py,sha256=5_x5_BBQwC6J4k5YLdTm1DfIDM-95zXz1L5a1nMrlrY,186
27
- clearskies_aws/di/inject/boto3.py,sha256=7qcn5N-RnUKiCd1U31JAjQHF6NDudS4KyBLT0krUD-Y,404
31
+ clearskies_aws/di/inject/boto3.py,sha256=yUDiEpR2Si6pKcLrqMOlQEUU0pi6MS1tXNdoyC2mjwk,408
28
32
  clearskies_aws/di/inject/boto3_session.py,sha256=11UYHz5kgrrx5lawoYaOFBm-QIoa45YUCMAOn4gT8Jo,383
29
33
  clearskies_aws/di/inject/parameter_store.py,sha256=g0uAVwQEywLO9bCcYLbDKuyYnYgVyrfcYsOBJWYGads,475
30
- clearskies_aws/endpoints/__init__.py,sha256=A2e3zCI8Ywg95WcTk1f92fpmlJ6eD4mTfcR43yX9sow,112
31
- clearskies_aws/endpoints/secrets_manager_rotation.py,sha256=CqtE7pJ1FiPStRjMI1WsflcYXgcr-miRUE-IU1UKmnk,7764
34
+ clearskies_aws/endpoints/__init__.py,sha256=OUL_nhtuNs62BvQeVtC9xP_e9Hs_-qjANvb81vdLdrc,61
35
+ clearskies_aws/endpoints/secrets_manager_rotation.py,sha256=c__4N-Z4qZ9XkzMMyIcxyPjOIxdO801FAJp6oX6n0a4,7761
32
36
  clearskies_aws/endpoints/simple_body_routing.py,sha256=B3fnfxUEMuNpzc26Pzly6618DFU9fpaCk8KhTGSaptE,1181
33
- clearskies_aws/input_outputs/__init__.py,sha256=83rhCp7knun2WB4Pd53H8KvVgM_4_Lt0YuD2Gvo2UPk,755
34
- clearskies_aws/input_outputs/cli_web_socket_mock.py,sha256=a96M1vnUfpe0YL04iSFpV_oXG6IkygRd710CDo72wc4,496
37
+ clearskies_aws/input_outputs/__init__.py,sha256=RTDFwhPWZ2S0tZQiIPH0Tkj2xF-9qBjZte_CA2cmGt8,743
38
+ clearskies_aws/input_outputs/cli_web_socket_mock.py,sha256=cp0MaJjVnsXE1rx5K44lpN9uHKo3MOAsNxVQ3AsJOi4,547
35
39
  clearskies_aws/input_outputs/lambda_alb.py,sha256=iYooG5AlkrQQgzSt304A5_u_UhuqYh-9PeLvFdGM_Eg,2013
36
40
  clearskies_aws/input_outputs/lambda_api_gateway.py,sha256=n5XiaxmaFKJ9wMQcNQwizpjcA-L_bdLk1aUk-QyO58w,4672
37
- clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py,sha256=P9cMrOxRlezUh7OIqGrV_34amksI6n_1ZPYujSLY_so,2702
38
- clearskies_aws/input_outputs/lambda_input_output.py,sha256=71sW2vQi-yCf0wE8DGso0Zy1G7cn5D-gnEELIvEnbiw,2743
39
- clearskies_aws/input_outputs/lambda_invocation.py,sha256=y8dPkjt9rvSJd2tkctdtM1-q_SnRPR_bXc9aySjRgdE,2800
40
- clearskies_aws/input_outputs/lambda_sns.py,sha256=n04gS8bgo3sX8EZTkBvdCykm5dlV4lloc7IoPv71_T8,2657
41
- clearskies_aws/input_outputs/lambda_sqs_standard.py,sha256=ubrSdU0RTHIURLk_kgKs3Gt7LcxaUlRBdA67169qHlA,2880
41
+ clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py,sha256=B7LIXI_9HpquTtUuPVnb7aH1agJt9qTWiISWiNlobdo,2926
42
+ clearskies_aws/input_outputs/lambda_input_output.py,sha256=nJza0TFdAYOHdLvq6eFDW-TobpeF3EzuIsW9rdhrj3U,2819
43
+ clearskies_aws/input_outputs/lambda_invoke.py,sha256=9TvtxVn2MYxUq9luZ-o0DMboFulA5ff-G8RFo3_x-nA,2861
44
+ clearskies_aws/input_outputs/lambda_sns.py,sha256=nPvLxi5EUmgSeDYxFHnosG9mEzVKjt_mOFJvjsb1gQ4,3084
45
+ clearskies_aws/input_outputs/lambda_sqs_standard.py,sha256=rtOH75SKuT4ByOn4tfgDvvLog0IZVaZUh8zQ_E4Yygw,2945
42
46
  clearskies_aws/mocks/__init__.py,sha256=mn764gINN667tYoJfnsM6HjAAhCsO_kZ6E-fUwdLY50,22
43
47
  clearskies_aws/mocks/actions/__init__.py,sha256=to1r8B365Et2PRVfUWWnJGt7Hdr8vwwQuNyZvTSTP6g,152
44
48
  clearskies_aws/mocks/actions/ses.py,sha256=KsII9ggU364BQoxgHfO2rxi6tjVsdnwJyMhtclOhWLQ,998
45
49
  clearskies_aws/mocks/actions/sns.py,sha256=yGY3V0_htOZ3y8VTLdznoMSUQZvnjulQbrR5z_-0fXQ,706
46
50
  clearskies_aws/mocks/actions/sqs.py,sha256=y0Vq7IMbjlfT5JMNHfbPsq9XVZhUF-G0kdXzQnPzyUA,710
47
51
  clearskies_aws/mocks/actions/step_function.py,sha256=ENEVy8Ai3vPymbQre5aWa5z2McBjlnopfsLxdO7oEbc,937
48
- clearskies_aws/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ clearskies_aws/models/__init__.py,sha256=tAU5cPGRSzSClNVRCBxzwlBq6eZO8fftuI3bG1jEyVQ,87
49
53
  clearskies_aws/models/web_socket_connection_model.py,sha256=5M1qfQHKuWMYPUDkwT48QPo2ROey7koizvWLfapsfow,7492
50
54
  clearskies_aws/secrets/__init__.py,sha256=0mqYja2ETBHJh4b3jgRhhJV1uGdZc9S7cUvcV5QByPs,445
51
55
  clearskies_aws/secrets/akeyless_with_ssm_cache.py,sha256=32HUS1KQ5F6Fu70HDtojqDL7VZvP_YDgbWLTTmNJvPA,2073
@@ -57,7 +61,7 @@ clearskies_aws/secrets/additional_configs/iam_db_auth.py,sha256=PwyiLaacpRfhBKzQ
57
61
  clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py,sha256=ABY29X-YvrE6vvNo6kVdf4DqyRNq5cFR5SfK7MNkltE,3463
58
62
  clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py,sha256=mLaplwvJLSbGh6oXgdOKL9Mv-6hLv5OUYCfEwHbHvLE,3700
59
63
  clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py,sha256=2VHOwto4I9gBwrpd2HGpL-Wr0T2S-jFjUhe2Ib8hNJ8,6596
60
- clear_skies_aws-2.0.2.dist-info/METADATA,sha256=BcwJmkUhC-KD2QwepuW2kAeU6IRITpMOKrKCgAO2_b4,8972
61
- clear_skies_aws-2.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
62
- clear_skies_aws-2.0.2.dist-info/licenses/LICENSE,sha256=MkEX8JF8kZxdyBpTTcB0YTd-xZpWnHvbRlw-pQh8u58,1069
63
- clear_skies_aws-2.0.2.dist-info/RECORD,,
64
+ clear_skies_aws-2.0.4.dist-info/METADATA,sha256=CMTqizz2HDuJdsyuFSsUpS1gcbfhEuFHDfA-ejsrWAE,9087
65
+ clear_skies_aws-2.0.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
66
+ clear_skies_aws-2.0.4.dist-info/licenses/LICENSE,sha256=MkEX8JF8kZxdyBpTTcB0YTd-xZpWnHvbRlw-pQh8u58,1069
67
+ clear_skies_aws-2.0.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,15 +1,29 @@
1
1
  from __future__ import annotations
2
2
 
3
- from clearskies_aws import actions, backends, contexts, di, endpoints, input_outputs, mocks, models, secrets
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
+ )
4
16
 
5
17
  __all__ = [
6
- "models",
7
18
  "actions",
8
19
  "backends",
9
20
  "contexts",
21
+ "cursors",
10
22
  "di",
11
23
  "endpoints",
24
+ "handlers",
12
25
  "input_outputs",
13
26
  "mocks",
27
+ "models",
14
28
  "secrets",
15
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
+ )
@@ -1,5 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from typing import Any
4
+
3
5
  from clearskies.authentication import Public
4
6
  from clearskies.contexts.context import Context
5
7
 
@@ -7,12 +9,116 @@ from clearskies_aws.input_outputs import LambdaSns as LambdaSnsInputOutput
7
9
 
8
10
 
9
11
  class LambdaSns(Context):
10
- def __call__(self, event, context, method=None, url=None):
11
- if self.execute_application is None:
12
- raise ValueError("Cannot execute LambdaSnsEvent context without first configuring it")
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
+ """
13
116
 
117
+ def __call__(self, event: dict[str, Any], context: dict[str, Any], request_method: str = "", url: str = ""): # type: ignore[override]
14
118
  try:
15
- return self.execute_application(LambdaSnsInputOutput(event, context, method=method, url=url))
119
+ return self.execute_application(
120
+ LambdaSnsInputOutput(event, context, request_method=request_method, url=url)
121
+ )
16
122
  except Exception as e:
17
123
  print("Failed message " + event["Records"][0]["Sns"]["MessageId"] + ". Error error: " + str(e))
18
124
  raise e