Python DSL reference
project.generate_code() -> GeneratedProjectArchiveGenerate and download project code
Send the complete topology to the authorized generation endpoint and receive a validated ZIP archive.
When to use
Call this after constructing and validating the Project when target-language source and deployment assets are required.
Behavior
- Serializes the Project to YAML, converts it to the designer-compatible API JSON model, and POSTs it to
/service_architect/generateCode. - Authenticates from
.envunlessid_token,username, andpasswordoverrides are supplied. - Decodes the API Gateway base64 body, derives the filename from
Content-Disposition, and verifies the ZIP container. - Returns archive bytes without extracting or executing generated files.
Project.generate_code parameters properties
All parameters are keyword-only.
PropertyTypeDescription
id_tokenoptional stringUse an existing Cognito ID token.
username / passwordoptional stringsOverride credentials loaded from .env.
env_filepathCredentials file; default .env.
base_urloptional URLOverride Service Architect API root.
timeoutsecondsNetwork timeout; default 120.
GeneratedProjectArchive properties
Validated successful response.
PropertyTypeDescription
filenamestringSafe basename from Content-Disposition or download.zip.
contentbytesZIP archive bytes.
save(path)PathCreate parent directories and write the archive.
Python example
from pathlib import Path
from processorder import project
diagnostics = project.validate()
if diagnostics:
raise RuntimeError(diagnostics)
archive = project.generate_code()
output = archive.save(Path("dist") / archive.filename)
print(output)