Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/DeploymentCommands.cs
T

83 lines
4.1 KiB
C#

namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
public record MgmtDeployArtifactsCommand(int? SiteId = null);
/// <summary>
/// Deploys every deployable instance at one site in a single operation.
///
/// <para>
/// Distinct from <see cref="MgmtDeployArtifactsCommand"/>, which ships the
/// SYSTEM-WIDE artifact sets (shared scripts, external systems, DB/data
/// connections) to a site. This command deploys the site's INSTANCE
/// configurations — the same per-instance pipeline
/// <c>MgmtDeployInstanceCommand</c> runs, batched.
/// </para>
///
/// <para>
/// Not all-or-nothing: each instance keeps its own deployment id, revision hash,
/// operation lock and status record, and a failure on one is reported as a failed
/// row while the rest proceed. Individually retryable via the single-instance
/// deploy. Additive contract; new fields go on the end with a default.
/// </para>
/// </summary>
/// <param name="SiteId">Database id of the target site. Required — this command is never fleet-wide.</param>
/// <param name="Force">
/// Deploy every deployable instance even when its flattened config already matches
/// the revision the site is running. Default <see langword="false"/>: an unchanged
/// instance is skipped and reported in the summary's <c>SkippedInstances</c>,
/// because a redeploy resets static attribute overrides and native alarm state at
/// the site. Set it when central's recorded state cannot be trusted — a site whose
/// data volume was restored or whose node was rebuilt looks up-to-date from central
/// and needs the push anyway. Never overrides the Disabled skip.
/// </param>
public record MgmtDeploySiteCommand(int SiteId, bool Force = false);
/// <summary>
/// Bulk-deploys every instance in one area SUBTREE — the area plus every area
/// nested beneath it at any depth — with exactly the rules of
/// <see cref="MgmtDeploySiteCommand"/>: Disabled instances are always skipped,
/// up-to-date ones are skipped unless <see cref="Force"/> is set, and the batch is
/// not all-or-nothing. Answers with the same site deployment summary. Deployer-only,
/// site-scoped by the area's owning site (Gitea #40).
/// </summary>
/// <param name="AreaId">Database id of the subtree's root area.</param>
/// <param name="Force">
/// Redeploy instances whose config already matches the deployed revision. Never
/// overrides the Disabled skip. Same meaning as <see cref="MgmtDeploySiteCommand.Force"/>.
/// </param>
public record MgmtDeployAreaCommand(int AreaId, bool Force = false);
public record QueryDeploymentsCommand(int? InstanceId = null, string? Status = null, int Page = 1, int PageSize = 50);
/// <summary>
/// Result wrapper for <see cref="QueryDeploymentsCommand"/>.
///
/// <para>
/// The handler used to return a bare row array. It cannot any more: the page size
/// is now BOUNDED (a non-positive <c>PageSize</c> no longer means "unlimited" —
/// deferred-work register row 87), and a bounded page without a total is a silent
/// truncation. <see cref="TotalCount"/> is what lets a caller tell "that is all of
/// them" from "there is more, ask for page 2". Mirrors
/// <c>AuditLogQueryResult</c> / <c>SecuredWriteListResult</c>, the other paged
/// management query results.
/// </para>
///
/// <para>
/// <see cref="Page"/> and <see cref="PageSize"/> echo the values the server
/// actually applied, which are not necessarily the ones requested: both are
/// floored/clamped/defaulted server-side, so the echo is the only way a caller
/// learns the effective slice. Additive contract; new fields go on the end with a
/// default.
/// </para>
/// </summary>
/// <param name="Deployments">The requested page of deployment rows, newest first.</param>
/// <param name="TotalCount">Total rows matching the filter across all pages.</param>
/// <param name="Page">The 1-based page number actually served.</param>
/// <param name="PageSize">The page size actually applied.</param>
public record DeploymentQueryResult(
IReadOnlyList<Types.Deployment.DeploymentListRow> Deployments,
int TotalCount,
int Page,
int PageSize);
public record GetDeploymentDiffCommand(int InstanceId);