api-foundry-query-engine 0.8.83__tar.gz → 0.8.84__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.
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/PKG-INFO +1 -1
- api_foundry_query_engine-0.8.84/api_foundry_query_engine/__init__.py +1 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/logger.py +29 -12
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/token_decoder.py +23 -1
- api_foundry_query_engine-0.8.83/api_foundry_query_engine/__init__.py +0 -1
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/.gitignore +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/LICENSE +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/.pre-commit-config.yaml +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/adapters/adapter.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/adapters/gateway_adapter.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/connectors/connection.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/connectors/connection_factory.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/connectors/data_api_connection.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/connectors/postgres_connection.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/batch_operation_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/dao.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/operation_dao.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_custom_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_delete_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_insert_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_restore_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_select_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_subselect_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/dao/sql_update_query_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/lambda_handler.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/operation.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/services/service.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/services/transactional_service.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/api_model.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/app_exception.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/claims_check.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/dependency_resolver.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/api_foundry_query_engine/utils/reference_resolver.py +0 -0
- {api_foundry_query_engine-0.8.83 → api_foundry_query_engine-0.8.84}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: api-foundry-query-engine
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.84
|
|
4
4
|
Summary: The AWS lambda service handler use by the `api_foundry` project is a powerful tool designed to automate the deployment of REST APIs on AWS using Lambda services to access and interact with relational databases (RDBMS). This project leverages the OpenAPI specification to define and manage the APIs
|
|
5
5
|
Project-URL: Documentation, https://github.com/DanRepik/api-foundry
|
|
6
6
|
Project-URL: Source, https://github.com/DanRepik/api-foundry
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.8.84"
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
4
|
+
# The root log level comes from LOGGING_LEVEL, defaulting to INFO. force=True
|
|
5
|
+
# so the configuration applies even when the Lambda runtime has already
|
|
6
|
+
# installed a handler.
|
|
7
|
+
DEFAULT_LOGGING_LEVEL = "INFO"
|
|
8
|
+
|
|
9
|
+
# At DEBUG, botocore logs every request it signs: the headers, including the
|
|
10
|
+
# caller's x-amz-security-token, and the body -- which for the RDS Data API
|
|
11
|
+
# carries every SQL parameter. These loggers are therefore held at WARNING
|
|
12
|
+
# whatever LOGGING_LEVEL is, unless AWS_SDK_LOGGING_LEVEL explicitly says
|
|
13
|
+
# otherwise.
|
|
14
|
+
AWS_SDK_LOGGERS = ("boto3", "botocore", "s3transfer", "urllib3")
|
|
15
|
+
DEFAULT_AWS_SDK_LOGGING_LEVEL = "WARNING"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _logging_level() -> str:
|
|
19
|
+
return os.getenv("LOGGING_LEVEL", DEFAULT_LOGGING_LEVEL).upper()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _quiet_aws_sdk_loggers() -> None:
|
|
23
|
+
level = os.getenv("AWS_SDK_LOGGING_LEVEL", DEFAULT_AWS_SDK_LOGGING_LEVEL).upper()
|
|
24
|
+
for name in AWS_SDK_LOGGERS:
|
|
25
|
+
logging.getLogger(name).setLevel(level)
|
|
26
|
+
|
|
27
|
+
|
|
7
28
|
logging.basicConfig(
|
|
8
29
|
format="%(name)s:%(lineno)s - %(levelname)s - %(message)s",
|
|
9
|
-
level=
|
|
30
|
+
level=_logging_level(),
|
|
10
31
|
force=True,
|
|
11
32
|
)
|
|
33
|
+
_quiet_aws_sdk_loggers()
|
|
12
34
|
|
|
13
35
|
WARN = logging.WARN
|
|
14
36
|
INFO = logging.INFO
|
|
@@ -26,14 +48,9 @@ def logger(name=None):
|
|
|
26
48
|
logging.Logger: Logger object with the specified name or the root logger.
|
|
27
49
|
|
|
28
50
|
"""
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Setting the logging level for the root logger to the obtained logging level
|
|
34
|
-
logging.getLogger().setLevel(loggingLevel)
|
|
35
|
-
|
|
36
|
-
# Returning a logger object with the specified name or the root logger
|
|
51
|
+
# Re-applied on every call: LOGGING_LEVEL may have changed since import.
|
|
52
|
+
logging.getLogger().setLevel(_logging_level())
|
|
53
|
+
_quiet_aws_sdk_loggers()
|
|
37
54
|
return logging.getLogger(name)
|
|
38
55
|
|
|
39
56
|
|
|
@@ -43,6 +43,27 @@ def _log_jwt_configuration():
|
|
|
43
43
|
log.debug("===============================")
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
# Headers never written to the log, even at DEBUG: bearer tokens, session
|
|
47
|
+
# cookies and API keys are credentials, not diagnostics.
|
|
48
|
+
_REDACTED_HEADERS = frozenset({"authorization", "cookie", "x-api-key"})
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _redacted_event(event: Dict[str, Any]) -> Dict[str, Any]:
|
|
52
|
+
"""A copy of `event` safe to log: credential headers masked in both
|
|
53
|
+
`headers` and `multiValueHeaders`, matched case-insensitively."""
|
|
54
|
+
if not isinstance(event, dict):
|
|
55
|
+
return event
|
|
56
|
+
redacted = dict(event)
|
|
57
|
+
for key in ("headers", "multiValueHeaders"):
|
|
58
|
+
headers = event.get(key)
|
|
59
|
+
if isinstance(headers, dict):
|
|
60
|
+
redacted[key] = {
|
|
61
|
+
name: ("[REDACTED]" if str(name).lower() in _REDACTED_HEADERS else value)
|
|
62
|
+
for name, value in headers.items()
|
|
63
|
+
}
|
|
64
|
+
return redacted
|
|
65
|
+
|
|
66
|
+
|
|
46
67
|
class LambdaTokenValidator:
|
|
47
68
|
"""Validates tokens by invoking an AWS Lambda TOKEN authorizer."""
|
|
48
69
|
|
|
@@ -265,7 +286,8 @@ def token_decoder(
|
|
|
265
286
|
if log.isEnabledFor(logging.DEBUG):
|
|
266
287
|
_log_jwt_configuration()
|
|
267
288
|
|
|
268
|
-
log.
|
|
289
|
+
if log.isEnabledFor(logging.DEBUG):
|
|
290
|
+
log.debug("Event structure: %s", json.dumps(_redacted_event(event), default=str))
|
|
269
291
|
|
|
270
292
|
# Check if authorizer already exists (gateway validated)
|
|
271
293
|
if event.get("requestContext", {}).get("authorizer"):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.83"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|