api-foundry 0.8.9__tar.gz → 0.8.10__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.8.9 → api_foundry-0.8.10}/PKG-INFO +1 -1
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/__init__.py +1 -1
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/iac/gateway_spec.py +3 -4
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/iac/pulumi/api_foundry.py +1 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/scripts/install_secret.py +16 -6
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/utils/model_factory.py +18 -32
- {api_foundry-0.8.9 → api_foundry-0.8.10}/.gitignore +0 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/LICENSE +0 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/scripts/postgres_to_openapi.py +0 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/utils/app_exception.py +0 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/utils/logger.py +0 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/api_foundry/utils/schema_validator.py +0 -0
- {api_foundry-0.8.9 → api_foundry-0.8.10}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: api-foundry
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.10
|
|
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
|
|
@@ -177,7 +177,6 @@ class APISpecEditor:
|
|
|
177
177
|
|
|
178
178
|
def generate_regex(self, property: dict[str, Any]) -> str:
|
|
179
179
|
regex_pattern = ""
|
|
180
|
-
relational_patterns = []
|
|
181
180
|
|
|
182
181
|
# UUID (either explicit type 'uuid' or string with format 'uuid')
|
|
183
182
|
if property.get("type") == "uuid" or (
|
|
@@ -215,7 +214,7 @@ class APISpecEditor:
|
|
|
215
214
|
else:
|
|
216
215
|
max_length = property.get("max_length", 200)
|
|
217
216
|
min_length = property.get("min_length", 0)
|
|
218
|
-
regex_pattern = rf"[\w\s]{min_length},{max_length}"
|
|
217
|
+
regex_pattern = rf"[\w\s]{{{min_length},{max_length}}}"
|
|
219
218
|
# Allows letters, numbers, and underscores
|
|
220
219
|
|
|
221
220
|
elif property["type"] == "integer":
|
|
@@ -235,8 +234,8 @@ class APISpecEditor:
|
|
|
235
234
|
+ rf"|^not-between::{regex_pattern},{regex_pattern},"
|
|
236
235
|
+ rf"|^in::{regex_pattern}(,{regex_pattern})*$"
|
|
237
236
|
+ rf"|^not-in::{regex_pattern}(,{regex_pattern})*$"
|
|
238
|
-
+
|
|
239
|
-
+
|
|
237
|
+
+ r"|^like::.+$"
|
|
238
|
+
+ r"|^not-like::.+$"
|
|
240
239
|
)
|
|
241
240
|
|
|
242
241
|
def generate_query_parameters(self, schema_object: dict[str, Any]):
|
|
@@ -234,6 +234,7 @@ class APIFoundry(ComponentResource):
|
|
|
234
234
|
batch_path=batch_path,
|
|
235
235
|
token_validators=token_validators,
|
|
236
236
|
)
|
|
237
|
+
self.api_spec_editor = gateway_spec
|
|
237
238
|
|
|
238
239
|
# Merge gateway_spec.integrations with user-provided integrations
|
|
239
240
|
specification = gateway_spec.rest_api_spec()
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import argparse
|
|
2
|
+
import os
|
|
2
3
|
import boto3
|
|
3
4
|
import json
|
|
4
5
|
|
|
5
6
|
from botocore.exceptions import ClientError
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
def create_secret_if_not_exists(secret_name, secret_value):
|
|
9
|
-
# Create a Secrets Manager client
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
)
|
|
9
|
+
def create_secret_if_not_exists(secret_name, secret_value, endpoint_url=None):
|
|
10
|
+
# Create a Secrets Manager client. endpoint_url is None (real AWS
|
|
11
|
+
# Secrets Manager) unless explicitly overridden, e.g. for testing
|
|
12
|
+
# against LocalStack.
|
|
13
|
+
client = boto3.client("secretsmanager", endpoint_url=endpoint_url)
|
|
13
14
|
|
|
14
15
|
try:
|
|
15
16
|
# Check if the secret already exists
|
|
@@ -55,6 +56,15 @@ def main():
|
|
|
55
56
|
parser.add_argument(
|
|
56
57
|
"--schema", default="public", help="The database schema (default: public)"
|
|
57
58
|
)
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
"--endpoint-url",
|
|
61
|
+
default=os.environ.get("AWS_ENDPOINT_URL"),
|
|
62
|
+
help=(
|
|
63
|
+
"Optional AWS endpoint URL override, e.g. for testing against "
|
|
64
|
+
"LocalStack. Defaults to the AWS_ENDPOINT_URL environment "
|
|
65
|
+
"variable, or real AWS Secrets Manager if unset."
|
|
66
|
+
),
|
|
67
|
+
)
|
|
58
68
|
|
|
59
69
|
args = parser.parse_args()
|
|
60
70
|
|
|
@@ -70,7 +80,7 @@ def main():
|
|
|
70
80
|
}
|
|
71
81
|
)
|
|
72
82
|
|
|
73
|
-
create_secret_if_not_exists(args.secret_name, secret_value)
|
|
83
|
+
create_secret_if_not_exists(args.secret_name, secret_value, args.endpoint_url)
|
|
74
84
|
|
|
75
85
|
|
|
76
86
|
if __name__ == "__main__":
|
|
@@ -263,38 +263,24 @@ class SchemaObjectProperty(OpenAPIElement):
|
|
|
263
263
|
|
|
264
264
|
return soft_delete_config
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
self.sequence_name = (
|
|
285
|
-
properties.get("x-af-sequence-name")
|
|
286
|
-
if self.key_type == "sequence"
|
|
287
|
-
else None
|
|
288
|
-
)
|
|
289
|
-
if self.key_type == "sequence" and not self.sequence_name:
|
|
290
|
-
raise ApplicationException(
|
|
291
|
-
500,
|
|
292
|
-
(
|
|
293
|
-
"Sequence-based primary keys must have a sequence name in "
|
|
294
|
-
+ f"schema object '{schema_name}', "
|
|
295
|
-
+ f"property '{self.api_name}'"
|
|
296
|
-
),
|
|
297
|
-
)
|
|
266
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
267
|
+
"""
|
|
268
|
+
Convert to a dictionary, recursively converting sub_properties and
|
|
269
|
+
items_sub_properties (dicts of SchemaObjectProperty for embedded
|
|
270
|
+
objects and arrays of embedded objects), which the base
|
|
271
|
+
OpenAPIElement.to_dict() does not recurse into since they are
|
|
272
|
+
plain dicts rather than OpenAPIElement instances themselves.
|
|
273
|
+
"""
|
|
274
|
+
data = super().to_dict()
|
|
275
|
+
if self.sub_properties is not None:
|
|
276
|
+
data["sub_properties"] = {
|
|
277
|
+
k: v.to_dict() for k, v in self.sub_properties.items()
|
|
278
|
+
}
|
|
279
|
+
if self.items_sub_properties is not None:
|
|
280
|
+
data["items_sub_properties"] = {
|
|
281
|
+
k: v.to_dict() for k, v in self.items_sub_properties.items()
|
|
282
|
+
}
|
|
283
|
+
return data
|
|
298
284
|
|
|
299
285
|
|
|
300
286
|
class SchemaObjectAssociation(OpenAPIElement):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|