Files
DECNET/decnet/web/db/models/deploy.py
anti f2b3393669 chore: relicense to AGPL-3.0-or-later and add SPDX headers
Replaces LICENSE (GPLv3 -> AGPLv3) and prepends
`SPDX-License-Identifier: AGPL-3.0-or-later` to every source file
across decnet/, decnet_web/, tests/, scripts/, and tools/.

Rationale: closes the GPLv3 ASP loophole so any party operating a
modified DECNET as a network service must offer their modified
source. Personal copyright (Samuel Paschuan) + inbound=outbound
contributions make a future unilateral relicense infeasible.

- LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt)
- COPYRIGHT: project copyright notice
- tools/add_spdx_headers.py: idempotent header injector
  (shebang- and PEP 263-aware)

Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh).
No behavior change; comments only.
2026-05-22 21:04:16 -04:00

44 lines
1.6 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""Fleet deploy + mutate-interval request DTOs."""
from typing import Optional
from pydantic import BaseModel, ConfigDict, Field as PydanticField
from decnet.models import IniContent
class MutateIntervalRequest(BaseModel):
# Human-readable duration: <number><unit> where unit is m(inutes), d(ays), M(onths), y/Y(ears).
# Minimum granularity is 1 minute. Seconds are not accepted.
mutate_interval: Optional[str] = PydanticField(None, pattern=r"^[1-9]\d*[mdMyY]$")
class DeployIniRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
# This field now enforces strict INI structure during Pydantic initialization.
# The OpenAPI schema correctly shows it as a required string.
ini_content: IniContent = PydanticField(..., description="A valid INI formatted string")
replace_fleet: bool = PydanticField(
default=False,
description=(
"If true, the INI is treated as the complete desired fleet — any "
"existing decky absent from the INI is torn down. Default false: "
"the INI is appended to the existing fleet; name or IP collisions "
"with already-deployed deckies yield 409."
),
)
class DeployResponse(BaseModel):
"""202-Accepted response: deploy spawned in background, client polls
GET /deckies/lifecycle?ids=... until each row reaches a terminal
status."""
message: str
mode: str
lifecycle_ids: list[str] = PydanticField(default_factory=list)
class PurgeResponse(BaseModel):
message: str
deleted: dict[str, int]