SAService Architect Back to designer
SAService ArchitectDocumentation
Python DSL reference project.generate_code() -> GeneratedProjectArchive

Generate 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 submits /v1/generation-jobs.
  • Authenticates with SERVICE_ARCHITECT_API_KEY, polls the owned job until completion, and requests a short-lived download URL.
  • Downloads the artifact directly from S3 without forwarding the API key, derives a safe filename, 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
api_keyoptional secret

Override SERVICE_ARCHITECT_API_KEY for the asynchronous API.

id_token / username / passwordlegacy credentials

Use the legacy synchronous generation path when no API key is available.

env_filepath

Credentials file; default .env.

base_urloptional URL

Override Service Architect API root.

timeoutseconds

Network timeout; default 120.

GeneratedProjectArchive properties

Validated successful response.

PropertyTypeDescription
filenamestring

Safe basename from Content-Disposition or download.zip.

contentbytes

ZIP archive bytes.

save(path)Path

Create 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)