// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using EpicGames.Horde.Agents.Leases; using EpicGames.Horde.Agents.Sessions; using EpicGames.Horde.Logs; namespace EpicGames.Horde.Agents { /// /// Status of an agent. Must match RpcAgentStatus. /// public enum AgentStatus { /// /// Unspecified state. /// Unspecified = 0, /// /// Agent is running normally. /// Ok = 1, /// /// Agent is currently shutting down, and should not be assigned new leases. /// Stopping = 2, /// /// Agent is in an unhealthy state and should not be assigned new leases. /// Unhealthy = 3, /// /// Agent is currently stopped. /// Stopped = 4, /// /// Agent is busy performing other work (eg. serving an interactive user) /// Busy = 5, } /// /// Parameters to update an agent /// /// Whether the agent is currently enabled /// Whether the agent is ephemeral /// Request a conform be performed using the current agent set /// Request that a full conform be performed, removing all intermediate files /// Request the machine be restarted /// Request the machine be shut down /// Request the machine be restarted without waiting for leases to complete /// Pools for this agent /// New comment public record UpdateAgentRequest(bool? Enabled = null, bool? Ephemeral = null, bool? RequestConform = null, bool? RequestFullConform = null, bool? RequestRestart = null, bool? RequestShutdown = null, bool? RequestForceRestart = null, List? Pools = null, string? Comment = null); /// /// Response for queries to find a particular lease within an agent /// /// Identifier for the lease /// Identifier for the parent lease. Used to terminate hierarchies of leases. /// The agent id /// Cost of this agent, per hour /// Name of the lease /// Log id for this lease /// Time at which the lease started (UTC) /// Time at which the lease started (UTC) /// Whether this lease has started executing on the agent yet /// Details of the payload being executed /// Outcome of the lease /// State of the lease (for AgentLeases) public record GetAgentLeaseResponse(LeaseId Id, LeaseId? ParentId, AgentId? AgentId, double? AgentRate, string Name, LogId? LogId, DateTime StartTime, DateTime? FinishTime, bool Executing, Dictionary? Details, LeaseOutcome? Outcome, LeaseState? State); /// /// Information about a workspace synced on an agent /// /// The Perforce server and port to connect to /// User to log into Perforce with (eg. buildmachine) /// Identifier to distinguish this workspace from other workspaces /// The stream to sync /// Custom view for the workspace /// Whether to use an incremental workspace /// Method to use when syncing/materializing data from Perforce /// Minimum disk space that must be available *after* syncing this workspace (in megabytes) /// Threshold for when to trigger an automatic conform of agent. Measured in megabytes free on disk public record GetAgentWorkspaceResponse(string? Cluster, string? UserName, string Identifier, string Stream, List? View, bool BIncremental, string? Method, long? MinScratchSpace, long? ConformDiskFreeSpace); /// /// Information about an agent /// /// The agent's unique ID /// Friendly name of the agent /// Whether the agent is currently enabled /// Status of the agent /// Cost estimate per-hour for this agent /// The current session id /// Whether the agent is ephemeral /// Whether the agent is currently online /// Whether this agent has expired /// Whether a conform job is pending /// Whether a full conform job is pending /// Whether a restart is pending /// Whether a shutdown is pending /// The reason for the last shutdown /// Last time a conform was attempted /// Number of times a conform has been attempted /// Last time a conform was attempted /// The current client version /// Properties for the agent /// Resources for the agent /// Last update time of this agent /// Last time that the agent was online /// Pools for this agent /// Capabilities of this agent /// Array of active leases. /// Current workspaces synced on the agent /// Comment for this agent public record GetAgentResponse(AgentId Id, string Name, bool Enabled, AgentStatus Status, double? Rate, SessionId? SessionId, bool Ephemeral, bool Online, bool Deleted, bool PendingConform, bool PendingFullConform, bool PendingRestart, bool PendingShutdown, string LastShutdownReason, DateTime LastConformTime, int? ConformAttemptCount, DateTime? NextConformTime, string? Version, List Properties, Dictionary Resources, DateTime? UpdateTime, DateTime? LastOnlineTime, List? Pools, object? Capabilities, List Leases, List Workspaces, string? Comment); /// /// Telemetry data for an agent /// public record GetAgentTelemetryResponse(List Samples); /// /// Telemetry data sample /// public record GetAgentTelemetrySampleResponse(DateTime Time, float UserCpu, float IdleCpu, float SystemCpu, int FreeRam, int UsedRam, int TotalRam, long FreeDisk, long TotalDisk); }