clear-skies-aws 1.10.2__py3-none-any.whl → 2.0.2__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.
- {clear_skies_aws-1.10.2.dist-info → clear_skies_aws-2.0.2.dist-info}/METADATA +36 -35
- clear_skies_aws-2.0.2.dist-info/RECORD +63 -0
- {clear_skies_aws-1.10.2.dist-info → clear_skies_aws-2.0.2.dist-info}/WHEEL +1 -1
- clear_skies_aws-2.0.2.dist-info/licenses/LICENSE +21 -0
- clearskies_aws/__init__.py +15 -2
- clearskies_aws/actions/__init__.py +13 -106
- clearskies_aws/actions/action_aws.py +74 -57
- clearskies_aws/actions/assume_role.py +43 -30
- clearskies_aws/actions/ses.py +82 -73
- clearskies_aws/actions/sns.py +27 -30
- clearskies_aws/actions/sqs.py +32 -33
- clearskies_aws/actions/step_function.py +38 -31
- clearskies_aws/backends/__init__.py +11 -4
- clearskies_aws/backends/backend.py +106 -0
- clearskies_aws/backends/dynamo_db_backend.py +150 -155
- clearskies_aws/backends/dynamo_db_condition_parser.py +40 -80
- clearskies_aws/backends/dynamo_db_parti_ql_backend.py +179 -337
- clearskies_aws/backends/sqs_backend.py +32 -51
- clearskies_aws/configs/__init__.py +0 -0
- clearskies_aws/contexts/__init__.py +23 -10
- clearskies_aws/contexts/cli_web_socket_mock.py +19 -0
- clearskies_aws/contexts/lambda_alb.py +76 -0
- clearskies_aws/contexts/lambda_api_gateway.py +75 -28
- clearskies_aws/contexts/lambda_api_gateway_web_socket.py +56 -29
- clearskies_aws/contexts/lambda_invocation.py +15 -44
- clearskies_aws/contexts/lambda_sns.py +8 -33
- clearskies_aws/contexts/lambda_sqs_standard_partial_batch.py +14 -36
- clearskies_aws/di/__init__.py +6 -1
- clearskies_aws/di/aws_additional_config_auto_import.py +37 -0
- clearskies_aws/di/inject/__init__.py +6 -0
- clearskies_aws/di/inject/boto3.py +15 -0
- clearskies_aws/di/inject/boto3_session.py +13 -0
- clearskies_aws/di/inject/parameter_store.py +15 -0
- clearskies_aws/{handlers → endpoints}/secrets_manager_rotation.py +76 -55
- clearskies_aws/endpoints/simple_body_routing.py +41 -0
- clearskies_aws/input_outputs/__init__.py +21 -8
- clearskies_aws/input_outputs/{cli_websocket_mock.py → cli_web_socket_mock.py} +9 -3
- clearskies_aws/input_outputs/lambda_alb.py +53 -0
- clearskies_aws/input_outputs/lambda_api_gateway.py +106 -88
- clearskies_aws/input_outputs/lambda_api_gateway_web_socket.py +69 -6
- clearskies_aws/input_outputs/lambda_input_output.py +87 -0
- clearskies_aws/input_outputs/lambda_invocation.py +77 -26
- clearskies_aws/input_outputs/lambda_sns.py +66 -39
- clearskies_aws/input_outputs/lambda_sqs_standard.py +70 -40
- clearskies_aws/mocks/actions/ses.py +25 -19
- clearskies_aws/mocks/actions/sns.py +18 -12
- clearskies_aws/mocks/actions/sqs.py +18 -12
- clearskies_aws/mocks/actions/step_function.py +19 -13
- clearskies_aws/models/__init__.py +0 -0
- clearskies_aws/models/web_socket_connection_model.py +182 -0
- clearskies_aws/secrets/__init__.py +13 -7
- clearskies_aws/secrets/additional_configs/__init__.py +10 -2
- clearskies_aws/secrets/additional_configs/iam_db_auth.py +26 -16
- clearskies_aws/secrets/additional_configs/iam_db_auth_with_ssm.py +43 -39
- clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py +30 -31
- clearskies_aws/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssm_bastion.py +70 -49
- clearskies_aws/secrets/akeyless_with_ssm_cache.py +32 -18
- clearskies_aws/secrets/parameter_store.py +34 -32
- clearskies_aws/secrets/secrets.py +16 -0
- clearskies_aws/secrets/secrets_manager.py +78 -57
- clear_skies_aws-1.10.2.dist-info/LICENSE +0 -7
- clear_skies_aws-1.10.2.dist-info/RECORD +0 -71
- clearskies_aws/actions/assume_role_test.py +0 -72
- clearskies_aws/actions/ses_test.py +0 -89
- clearskies_aws/actions/sns_test.py +0 -77
- clearskies_aws/actions/sqs_test.py +0 -127
- clearskies_aws/actions/step_function_test.py +0 -103
- clearskies_aws/backends/dynamo_db_backend_test.py +0 -300
- clearskies_aws/backends/dynamo_db_condition_parser_test.py +0 -266
- clearskies_aws/backends/dynamo_db_parti_ql_backend_test.py +0 -544
- clearskies_aws/backends/sqs_backend_test.py +0 -31
- clearskies_aws/contexts/cli.py +0 -19
- clearskies_aws/contexts/cli_websocket_mock.py +0 -33
- clearskies_aws/contexts/lambda_elb.py +0 -30
- clearskies_aws/contexts/lambda_http_gateway.py +0 -30
- clearskies_aws/contexts/lambda_sqs_standard_partial_batch_test.py +0 -66
- clearskies_aws/contexts/wsgi.py +0 -19
- clearskies_aws/di/standard_dependencies.py +0 -60
- clearskies_aws/handlers/simple_body_routing.py +0 -39
- clearskies_aws/input_outputs/lambda_api_gateway_test.py +0 -87
- clearskies_aws/input_outputs/lambda_elb.py +0 -21
- clearskies_aws/input_outputs/lambda_http_gateway.py +0 -12
- clearskies_aws/secrets/parameter_store_test.py +0 -18
- clearskies_aws/secrets/secrets_manager_test.py +0 -18
- clearskies_aws/web_socket_connection_model.py +0 -43
- clearskies_aws/{handlers → endpoints}/__init__.py +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Callable
|
|
4
|
+
|
|
5
|
+
import clearskies
|
|
6
|
+
import clearskies.model
|
|
7
|
+
import clearskies.query
|
|
8
|
+
from clearskies.autodoc.schema import Schema as AutoDocSchema
|
|
9
|
+
from clearskies.di import inject
|
|
10
|
+
|
|
11
|
+
from clearskies_aws.di.inject import boto3
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Backend(clearskies.Configurable, clearskies.backends.Backend, clearskies.di.InjectableProperties):
|
|
15
|
+
"""
|
|
16
|
+
Connect models to their data since 2020.
|
|
17
|
+
|
|
18
|
+
The backend system acts as a flexible layer between models and their data sources. By changing the backend attached to a model,
|
|
19
|
+
you change where the model fetches and saves data. This might be a database, an in-memory data store, a dynamodb table,
|
|
20
|
+
an API, and more. This allows you to interact with a variety of data sources with the models acting as a standardized API.
|
|
21
|
+
Since endpoints also rely on the models for their functionality, this means that you can easily build API endpoints and
|
|
22
|
+
more for a variety of data sources with a minimal amount of code.
|
|
23
|
+
|
|
24
|
+
Of course, not all data sources support all functionality present in the model. Therefore, you do still need to have
|
|
25
|
+
a fair understanding of how your data sources work.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
supports_n_plus_one = False
|
|
29
|
+
can_count = True
|
|
30
|
+
|
|
31
|
+
boto3 = boto3.Boto3()
|
|
32
|
+
environment = inject.Environment()
|
|
33
|
+
|
|
34
|
+
def update(self, id: int | str, data: dict[str, Any], model: clearskies.model.Model) -> dict[str, Any]:
|
|
35
|
+
"""Update the record with the given id with the information from the data dictionary."""
|
|
36
|
+
return {}
|
|
37
|
+
|
|
38
|
+
def create(self, data: dict[str, Any], model: clearskies.model.Model) -> dict[str, Any]:
|
|
39
|
+
"""Create a record with the information from the data dictionary."""
|
|
40
|
+
return {}
|
|
41
|
+
|
|
42
|
+
def delete(self, id: int | str, model: clearskies.model.Model) -> bool:
|
|
43
|
+
"""Delete the record with the given id."""
|
|
44
|
+
return True
|
|
45
|
+
|
|
46
|
+
def count(self, query: clearskies.query.Query) -> int:
|
|
47
|
+
"""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.
|
|
57
|
+
|
|
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 []
|
|
63
|
+
|
|
64
|
+
def validate_pagination_data(self, data: dict[str, Any], case_mapping: Callable[[str], str]) -> str:
|
|
65
|
+
"""
|
|
66
|
+
Check if the given dictionary is valid pagination data for the background.
|
|
67
|
+
|
|
68
|
+
Return a string with an error message, or an empty string if the data is valid
|
|
69
|
+
"""
|
|
70
|
+
return ""
|
|
71
|
+
|
|
72
|
+
def allowed_pagination_keys(self) -> list[str]:
|
|
73
|
+
"""
|
|
74
|
+
Return the list of allowed keys in the pagination kwargs for the backend.
|
|
75
|
+
|
|
76
|
+
It must always return keys in snake_case so that the auto casing system can
|
|
77
|
+
adjust on the front-end for consistency.
|
|
78
|
+
"""
|
|
79
|
+
return []
|
|
80
|
+
|
|
81
|
+
def documentation_pagination_next_page_response(self, case_mapping: Callable) -> list[Any]:
|
|
82
|
+
"""
|
|
83
|
+
Return a list of autodoc schema objects.
|
|
84
|
+
|
|
85
|
+
It will describe the contents of the `next_page` dictionary
|
|
86
|
+
in the pagination section of the response
|
|
87
|
+
"""
|
|
88
|
+
return []
|
|
89
|
+
|
|
90
|
+
def documentation_pagination_parameters(self, case_mapping: Callable) -> list[tuple[AutoDocSchema, str]]:
|
|
91
|
+
"""
|
|
92
|
+
Return a list of autodoc schema objects describing the allowed input keys to set pagination.
|
|
93
|
+
|
|
94
|
+
It should return a list of tuples, with each tuple corresponding to an input key.
|
|
95
|
+
The first element in the tuple should be the schema, and the second should be the description.
|
|
96
|
+
"""
|
|
97
|
+
return []
|
|
98
|
+
|
|
99
|
+
def documentation_pagination_next_page_example(self, case_mapping: Callable) -> dict[str, Any]:
|
|
100
|
+
"""
|
|
101
|
+
Return an example for next page documentation.
|
|
102
|
+
|
|
103
|
+
Returns an example (as a simple dictionary) of what the next_page data in the pagination response
|
|
104
|
+
should look like
|
|
105
|
+
"""
|
|
106
|
+
return {}
|