api-foundry 0.1.15__tar.gz → 0.1.16__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-0.1.15 → api_foundry-0.1.16}/PKG-INFO +1 -1
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/iac/pulumi/api_foundry.py +37 -8
- {api_foundry-0.1.15 → api_foundry-0.1.16}/pyproject.toml +1 -1
- {api_foundry-0.1.15 → api_foundry-0.1.16}/.gitignore +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/LICENSE +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/__init__.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/adapters/adapter.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/adapters/case_change_adapter.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/adapters/gateway_adapter.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/cloudprints/archive_builder.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/cloudprints/hash_comparator.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/cloudprints/pulumi/lambda_.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/cloudprints/pulumi/log_group.pv +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/cloudprints/pulumi/rest_api.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/cloudprints/python_archive_builder.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/connectors/connection.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/connectors/connection_factory.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/connectors/oracle_connector.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/connectors/postgres_connection.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/dao.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/operation_dao.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_custom_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_delete_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_insert_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_select_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_subselect_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/dao/sql_update_query_handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/iac/gateway_spec.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/iac/handler.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/operation.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/scripts/install_secret.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/scripts/postgres_to_openapi.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/services/service.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/services/transactional_service.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/utils/app_exception.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/utils/logger.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/utils/model_factory.py +0 -0
- {api_foundry-0.1.15 → api_foundry-0.1.16}/api_foundry/utils/spec_handler.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: api-foundry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.16
|
|
4
4
|
Summary: 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
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import pkgutil
|
|
2
|
+
import json
|
|
2
3
|
import importlib.resources as pkg_resources
|
|
3
4
|
from pathlib import Path
|
|
4
|
-
from pulumi import ComponentResource, Output, ResourceOptions, export
|
|
5
|
+
from pulumi import ComponentResource, Output, ResourceOptions, export, Config
|
|
5
6
|
import pulumi_aws as aws
|
|
6
|
-
from typing import Any, Awaitable, Mapping
|
|
7
|
+
from typing import Any, Awaitable, Mapping, Dict
|
|
7
8
|
|
|
8
9
|
from api_foundry.iac.gateway_spec import GatewaySpec
|
|
9
10
|
from api_foundry.cloudprints.python_archive_builder import PythonArchiveBuilder
|
|
@@ -46,17 +47,25 @@ class APIFoundry(ComponentResource):
|
|
|
46
47
|
working_dir="temp",
|
|
47
48
|
)
|
|
48
49
|
|
|
50
|
+
environment = props.get("environment") if isinstance(props.get("environment"), dict) else {} # type: ignore
|
|
51
|
+
# Check if we are deploying to LocalStack
|
|
52
|
+
if self.is_deploying_to_localstack():
|
|
53
|
+
# Add LocalStack-specific environment variables
|
|
54
|
+
localstack_env = {
|
|
55
|
+
"AWS_ACCESS_KEY_ID": "test",
|
|
56
|
+
"AWS_SECRET_ACCESS_KEY": "test",
|
|
57
|
+
"AWS_ENDPOINT_URL": "http://localstack:4566",
|
|
58
|
+
}
|
|
59
|
+
environment = {**localstack_env, **environment}
|
|
60
|
+
|
|
61
|
+
environment['secrets'] = props["secrets"]
|
|
62
|
+
|
|
49
63
|
lambda_function = PythonFunctionCloudprint(
|
|
50
64
|
name=f"{name}-api-maker",
|
|
51
65
|
hash=self.archive_builder.hash(),
|
|
52
66
|
handler="app.lambda_handler",
|
|
53
67
|
archive_location=self.archive_builder.location(),
|
|
54
|
-
environment=
|
|
55
|
-
"AWS_ACCESS_KEY_ID": "test",
|
|
56
|
-
"AWS_SECRET_ACCESS_KEY": "test",
|
|
57
|
-
"AWS_ENDPOINT_URL": "http://localstack:4566",
|
|
58
|
-
"SECRETS": props["secrets"],
|
|
59
|
-
},
|
|
68
|
+
environment=environment
|
|
60
69
|
)
|
|
61
70
|
|
|
62
71
|
ModelFactory.load_yaml(api_spec)
|
|
@@ -96,3 +105,23 @@ class APIFoundry(ComponentResource):
|
|
|
96
105
|
)
|
|
97
106
|
|
|
98
107
|
export("gateway-api", gateway.id)
|
|
108
|
+
|
|
109
|
+
def is_deploying_to_localstack(self) -> bool:
|
|
110
|
+
# Create a Pulumi Config instance
|
|
111
|
+
config = Config("aws")
|
|
112
|
+
|
|
113
|
+
# Check if the 'endpoints' configuration is set, which usually indicates LocalStack
|
|
114
|
+
endpoints = config.get("endpoints")
|
|
115
|
+
|
|
116
|
+
if endpoints:
|
|
117
|
+
try:
|
|
118
|
+
# Parse the endpoints configuration and check for LocalStack URL
|
|
119
|
+
endpoints_list = json.loads(endpoints)
|
|
120
|
+
for endpoint in endpoints_list:
|
|
121
|
+
if "localhost" in endpoint.get("url", ""):
|
|
122
|
+
return True
|
|
123
|
+
except json.JSONDecodeError:
|
|
124
|
+
pass
|
|
125
|
+
|
|
126
|
+
return False
|
|
127
|
+
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|