diff --git a/nuon/models/__init__.py b/nuon/models/__init__.py index e8dadfc0..76ae9320 100644 --- a/nuon/models/__init__.py +++ b/nuon/models/__init__.py @@ -17,6 +17,7 @@ from .app_app_branch_config import AppAppBranchConfig from .app_app_branch_install_group import AppAppBranchInstallGroup from .app_app_branch_run import AppAppBranchRun +from .app_app_branch_run_type import AppAppBranchRunType from .app_app_break_glass_config import AppAppBreakGlassConfig from .app_app_config import AppAppConfig from .app_app_config_status import AppAppConfigStatus @@ -754,6 +755,7 @@ "AppAppBranchConfig", "AppAppBranchInstallGroup", "AppAppBranchRun", + "AppAppBranchRunType", "AppAppBreakGlassConfig", "AppAppConfig", "AppAppConfigStatus", diff --git a/nuon/models/app_app_branch_run.py b/nuon/models/app_app_branch_run.py index 24d5da4f..71dd6d24 100644 --- a/nuon/models/app_app_branch_run.py +++ b/nuon/models/app_app_branch_run.py @@ -6,6 +6,7 @@ from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..models.app_app_branch_run_type import AppAppBranchRunType from ..types import UNSET, Unset if TYPE_CHECKING: @@ -37,20 +38,24 @@ class AppAppBranchRun: created_by (AppAccount | Unset): created_by_id (str | Unset): error_message (str | Unset): ErrorMessage stores any error that occurred during execution - event_type (str | Unset): EventType indicates what triggered this run (push, pull_request, manual). - force (bool | Unset): Force indicates if this run was forced (bypassing change detection) + event_type (str | Unset): EventType indicates what triggered this run. Kept for backward compat; new code uses + RunType. + force (bool | Unset): + github_comment_id (int | Unset): head_sha (str | Unset): id (str | Unset): labels (GithubComNuoncoNuonPkgLabelsLabels | Unset): log_stream (AppLogStream | Unset): log_stream_id (str | Unset): LogStreamID is the log stream created during this run for event tracking - plan_only (bool | Unset): PlanOnly indicates this is a preview run (e.g., PR preview) that should - only plan changes without applying them. - pr_number (int | Unset): PR metadata — populated when EventType is "pull_request" + no_config_changes (bool | Unset): + plan_only (bool | Unset): PlanOnly indicates this is a preview run. Kept for backward compat; new code uses + RunType. + pr_number (int | Unset): previous_run (AppAppBranchRun | Unset): previous_run_id (str | Unset): PreviousRunID links to the previous successful run on the same branch, used for build diffing to determine which components need rebuilding. queue_signal (AppQueueSignal | Unset): + run_type (AppAppBranchRunType | Unset): started_at (str | Unset): StartedAt tracks when execution actually began status (str | Unset): Status tracks the current state of the run Values: pending, running, success, failed, cancelled @@ -72,16 +77,19 @@ class AppAppBranchRun: error_message: str | Unset = UNSET event_type: str | Unset = UNSET force: bool | Unset = UNSET + github_comment_id: int | Unset = UNSET head_sha: str | Unset = UNSET id: str | Unset = UNSET labels: GithubComNuoncoNuonPkgLabelsLabels | Unset = UNSET log_stream: AppLogStream | Unset = UNSET log_stream_id: str | Unset = UNSET + no_config_changes: bool | Unset = UNSET plan_only: bool | Unset = UNSET pr_number: int | Unset = UNSET previous_run: AppAppBranchRun | Unset = UNSET previous_run_id: str | Unset = UNSET queue_signal: AppQueueSignal | Unset = UNSET + run_type: AppAppBranchRunType | Unset = UNSET started_at: str | Unset = UNSET status: str | Unset = UNSET updated_at: str | Unset = UNSET @@ -121,6 +129,8 @@ def to_dict(self) -> dict[str, Any]: force = self.force + github_comment_id = self.github_comment_id + head_sha = self.head_sha id = self.id @@ -135,6 +145,8 @@ def to_dict(self) -> dict[str, Any]: log_stream_id = self.log_stream_id + no_config_changes = self.no_config_changes + plan_only = self.plan_only pr_number = self.pr_number @@ -149,6 +161,10 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.queue_signal, Unset): queue_signal = self.queue_signal.to_dict() + run_type: str | Unset = UNSET + if not isinstance(self.run_type, Unset): + run_type = self.run_type.value + started_at = self.started_at status = self.status @@ -192,6 +208,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["event_type"] = event_type if force is not UNSET: field_dict["force"] = force + if github_comment_id is not UNSET: + field_dict["github_comment_id"] = github_comment_id if head_sha is not UNSET: field_dict["head_sha"] = head_sha if id is not UNSET: @@ -202,6 +220,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["log_stream"] = log_stream if log_stream_id is not UNSET: field_dict["log_stream_id"] = log_stream_id + if no_config_changes is not UNSET: + field_dict["no_config_changes"] = no_config_changes if plan_only is not UNSET: field_dict["plan_only"] = plan_only if pr_number is not UNSET: @@ -212,6 +232,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["previous_run_id"] = previous_run_id if queue_signal is not UNSET: field_dict["queue_signal"] = queue_signal + if run_type is not UNSET: + field_dict["run_type"] = run_type if started_at is not UNSET: field_dict["started_at"] = started_at if status is not UNSET: @@ -278,6 +300,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: force = d.pop("force", UNSET) + github_comment_id = d.pop("github_comment_id", UNSET) + head_sha = d.pop("head_sha", UNSET) id = d.pop("id", UNSET) @@ -298,6 +322,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: log_stream_id = d.pop("log_stream_id", UNSET) + no_config_changes = d.pop("no_config_changes", UNSET) + plan_only = d.pop("plan_only", UNSET) pr_number = d.pop("pr_number", UNSET) @@ -318,6 +344,13 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: else: queue_signal = AppQueueSignal.from_dict(_queue_signal) + _run_type = d.pop("run_type", UNSET) + run_type: AppAppBranchRunType | Unset + if isinstance(_run_type, Unset): + run_type = UNSET + else: + run_type = AppAppBranchRunType(_run_type) + started_at = d.pop("started_at", UNSET) status = d.pop("status", UNSET) @@ -353,16 +386,19 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: error_message=error_message, event_type=event_type, force=force, + github_comment_id=github_comment_id, head_sha=head_sha, id=id, labels=labels, log_stream=log_stream, log_stream_id=log_stream_id, + no_config_changes=no_config_changes, plan_only=plan_only, pr_number=pr_number, previous_run=previous_run, previous_run_id=previous_run_id, queue_signal=queue_signal, + run_type=run_type, started_at=started_at, status=status, updated_at=updated_at, diff --git a/nuon/models/app_app_branch_run_type.py b/nuon/models/app_app_branch_run_type.py new file mode 100644 index 00000000..715134b2 --- /dev/null +++ b/nuon/models/app_app_branch_run_type.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class AppAppBranchRunType(str, Enum): + GIT_PREVIEW_RUN = "git-preview-run" + GIT_RUN = "git-run" + MANUAL_RUN = "manual-run" + + def __str__(self) -> str: + return str(self.value) diff --git a/nuon/models/app_app_config.py b/nuon/models/app_app_config.py index a7a72cb6..da02b7a4 100644 --- a/nuon/models/app_app_config.py +++ b/nuon/models/app_app_config.py @@ -26,6 +26,7 @@ from ..models.app_composite_status import AppCompositeStatus from ..models.app_vcs_connection_commit import AppVCSConnectionCommit from ..models.blobstore_blob import BlobstoreBlob + from ..models.github_com_nuonco_nuon_pkg_labels_labels import GithubComNuoncoNuonPkgLabelsLabels T = TypeVar("T", bound="AppAppConfig") @@ -51,6 +52,7 @@ class AppAppConfig: input_ (AppAppInputConfig | Unset): intermediate_config (BlobstoreBlob | Unset): kubernetes_contexts (AppAppKubernetesContextsConfig | Unset): + labels (GithubComNuoncoNuonPkgLabelsLabels | Unset): operation_role_config (AppAppOperationRoleConfig | Unset): org_id (str | Unset): permissions (AppAppPermissionsConfig | Unset): @@ -85,6 +87,7 @@ class AppAppConfig: input_: AppAppInputConfig | Unset = UNSET intermediate_config: BlobstoreBlob | Unset = UNSET kubernetes_contexts: AppAppKubernetesContextsConfig | Unset = UNSET + labels: GithubComNuoncoNuonPkgLabelsLabels | Unset = UNSET operation_role_config: AppAppOperationRoleConfig | Unset = UNSET org_id: str | Unset = UNSET permissions: AppAppPermissionsConfig | Unset = UNSET @@ -160,6 +163,10 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.kubernetes_contexts, Unset): kubernetes_contexts = self.kubernetes_contexts.to_dict() + labels: dict[str, Any] | Unset = UNSET + if not isinstance(self.labels, Unset): + labels = self.labels.to_dict() + operation_role_config: dict[str, Any] | Unset = UNSET if not isinstance(self.operation_role_config, Unset): operation_role_config = self.operation_role_config.to_dict() @@ -247,6 +254,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["intermediate_config"] = intermediate_config if kubernetes_contexts is not UNSET: field_dict["kubernetes_contexts"] = kubernetes_contexts + if labels is not UNSET: + field_dict["labels"] = labels if operation_role_config is not UNSET: field_dict["operation_role_config"] = operation_role_config if org_id is not UNSET: @@ -300,6 +309,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.app_composite_status import AppCompositeStatus from ..models.app_vcs_connection_commit import AppVCSConnectionCommit from ..models.blobstore_blob import BlobstoreBlob + from ..models.github_com_nuonco_nuon_pkg_labels_labels import GithubComNuoncoNuonPkgLabelsLabels d = dict(src_dict) action_ids = cast(list[str], d.pop("action_ids", UNSET)) @@ -375,6 +385,13 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: else: kubernetes_contexts = AppAppKubernetesContextsConfig.from_dict(_kubernetes_contexts) + _labels = d.pop("labels", UNSET) + labels: GithubComNuoncoNuonPkgLabelsLabels | Unset + if isinstance(_labels, Unset): + labels = UNSET + else: + labels = GithubComNuoncoNuonPkgLabelsLabels.from_dict(_labels) + _operation_role_config = d.pop("operation_role_config", UNSET) operation_role_config: AppAppOperationRoleConfig | Unset if isinstance(_operation_role_config, Unset): @@ -474,6 +491,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: input_=input_, intermediate_config=intermediate_config, kubernetes_contexts=kubernetes_contexts, + labels=labels, operation_role_config=operation_role_config, org_id=org_id, permissions=permissions, diff --git a/nuon/models/service_create_app_config_request.py b/nuon/models/service_create_app_config_request.py index fa43928a..c7a45651 100644 --- a/nuon/models/service_create_app_config_request.py +++ b/nuon/models/service_create_app_config_request.py @@ -18,14 +18,18 @@ class ServiceCreateAppConfigRequest: app_branch_id (str | Unset): AppBranchID optionally links this config to an app branch. When set, triggers an app branch run after sync. cli_version (str | Unset): + intermediate_config_json (str | Unset): IntermediateConfigJSON is the serialized intermediate config (parsed + nuon.toml). + When provided, stored on the AppConfig for diffing in PR previews. plan_only (bool | Unset): PlanOnly creates a preview run (plan without apply). Only used with AppBranchID. - readme (str | Unset): not required Readme + readme (str | Unset): skip_notification (bool | Unset): SkipNotification suppresses the app-config-synced signal emission. Used when creating a config as part of app deletion cleanup. """ app_branch_id: str | Unset = UNSET cli_version: str | Unset = UNSET + intermediate_config_json: str | Unset = UNSET plan_only: bool | Unset = UNSET readme: str | Unset = UNSET skip_notification: bool | Unset = UNSET @@ -36,6 +40,8 @@ def to_dict(self) -> dict[str, Any]: cli_version = self.cli_version + intermediate_config_json = self.intermediate_config_json + plan_only = self.plan_only readme = self.readme @@ -49,6 +55,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["app_branch_id"] = app_branch_id if cli_version is not UNSET: field_dict["cli_version"] = cli_version + if intermediate_config_json is not UNSET: + field_dict["intermediate_config_json"] = intermediate_config_json if plan_only is not UNSET: field_dict["plan_only"] = plan_only if readme is not UNSET: @@ -65,6 +73,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: cli_version = d.pop("cli_version", UNSET) + intermediate_config_json = d.pop("intermediate_config_json", UNSET) + plan_only = d.pop("plan_only", UNSET) readme = d.pop("readme", UNSET) @@ -74,6 +84,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: service_create_app_config_request = cls( app_branch_id=app_branch_id, cli_version=cli_version, + intermediate_config_json=intermediate_config_json, plan_only=plan_only, readme=readme, skip_notification=skip_notification, diff --git a/pyproject.toml b/pyproject.toml index c2d6c065..ee90f36c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nuon" -version = "0.19.1043" +version = "0.19.1044" description = "A client library for accessing Nuon" authors = [] requires-python = ">=3.11" diff --git a/version.txt b/version.txt index 30335d80..a1cd7ae1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.19.1043 +0.19.1044