Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/deno_sandbox/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,23 @@ async def create(
self,
*,
slug: Optional[str] = None,
layers: Optional[List[str]] = None,
env_vars: Optional[List[EnvVarInput]] = None,
config: Optional[Config] = None,
) -> App:
"""Create a new app.

Args:
slug: Human readable identifier for the app.
layers: Layer IDs or slugs to reference.
env_vars: App-specific environment variables.
config: Default build and runtime configuration.
"""
options: dict[str, Any] = {}
if slug is not None:
options["slug"] = slug
if layers is not None:
options["layers"] = layers
if env_vars is not None:
options["env_vars"] = env_vars
if config is not None:
Expand All @@ -250,6 +254,7 @@ async def update(
app: str,
*,
slug: Optional[str] = None,
layers: Optional[List[str]] = None,
env_vars: Optional[List[EnvVarUpdate]] = None,
config: Optional[Config] = None,
) -> App:
Expand All @@ -258,12 +263,15 @@ async def update(
Args:
app: The app ID or slug to update.
slug: Human readable identifier for the app.
layers: Replace all layer references.
env_vars: Deep merge with existing environment variables.
config: Replace the entire deploy config.
"""
update: dict[str, Any] = {}
if slug is not None:
update["slug"] = slug
if layers is not None:
update["layers"] = layers
if env_vars is not None:
update["env_vars"] = env_vars
if config is not None:
Expand Down Expand Up @@ -346,25 +354,30 @@ def create(
self,
*,
slug: Optional[str] = None,
layers: Optional[List[str]] = None,
env_vars: Optional[List[EnvVarInput]] = None,
config: Optional[Config] = None,
) -> App:
"""Create a new app.

Args:
slug: Human readable identifier for the app.
layers: Layer IDs or slugs to reference.
env_vars: App-specific environment variables.
config: Default build and runtime configuration.
"""
return self._bridge.run(
self._async.create(slug=slug, env_vars=env_vars, config=config)
self._async.create(
slug=slug, layers=layers, env_vars=env_vars, config=config
)
)

def update(
self,
app: str,
*,
slug: Optional[str] = None,
layers: Optional[List[str]] = None,
env_vars: Optional[List[EnvVarUpdate]] = None,
config: Optional[Config] = None,
) -> App:
Expand All @@ -373,11 +386,14 @@ def update(
Args:
app: The app ID or slug to update.
slug: Human readable identifier for the app.
layers: Replace all layer references.
env_vars: Deep merge with existing environment variables.
config: Replace the entire deploy config.
"""
return self._bridge.run(
self._async.update(app, slug=slug, env_vars=env_vars, config=config)
self._async.update(
app, slug=slug, layers=layers, env_vars=env_vars, config=config
)
)

def delete(self, app: str) -> None:
Expand Down
13 changes: 12 additions & 1 deletion src/deno_sandbox/revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ async def deploy(
assets: Dict[str, Asset],
*,
config: Optional[Config] = None,
layers: Optional[List[str]] = None,
env_vars: Optional[List[EnvVarInputForDeploy]] = None,
labels: Optional[Dict[str, str]] = None,
) -> Revision:
Expand All @@ -188,6 +189,7 @@ async def deploy(
app: The app ID or slug.
assets: Dict mapping file paths to Asset objects.
config: Optional build/runtime configuration.
layers: Layer IDs or slugs to reference for this revision.
env_vars: Optional environment variables for this revision.
labels: Optional labels (e.g., git metadata).

Expand All @@ -197,6 +199,8 @@ async def deploy(
body: Dict[str, Any] = {"assets": assets}
if config is not None:
body["config"] = config
if layers is not None:
body["layers"] = layers
if env_vars is not None:
body["env_vars"] = env_vars
if labels is not None:
Expand Down Expand Up @@ -260,6 +264,7 @@ def deploy(
assets: Dict[str, Asset],
*,
config: Optional[Config] = None,
layers: Optional[List[str]] = None,
env_vars: Optional[List[EnvVarInputForDeploy]] = None,
labels: Optional[Dict[str, str]] = None,
) -> Revision:
Expand All @@ -269,6 +274,7 @@ def deploy(
app: The app ID or slug.
assets: Dict mapping file paths to Asset objects.
config: Optional build/runtime configuration.
layers: Layer IDs or slugs to reference for this revision.
env_vars: Optional environment variables for this revision.
labels: Optional labels (e.g., git metadata).

Expand All @@ -277,6 +283,11 @@ def deploy(
"""
return self._bridge.run(
self._async.deploy(
app, assets, config=config, env_vars=env_vars, labels=labels
app,
assets,
config=config,
layers=layers,
env_vars=env_vars,
labels=labels,
)
)