// Copyright Epic Games, Inc. All Rights Reserved. using HordeServer.Models; using HordeServer.Services; using HordeServer.Utilities; using MongoDB.Bson; using MongoDB.Bson.Serialization; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; using PoolId = HordeServer.Utilities.StringId; namespace HordeServer.Collections { /// /// Collection of pool documents /// public interface IPoolCollection { /// /// Creates a new pool /// /// Unique id for the new pool /// Name of the new pool /// Requirements for agents to include in this pool /// Whether to enable autoscaling for this pool /// Minimum number of agents in the pool /// Minimum number of idle agents to maintain /// Properties for the pool /// The new pool document Task AddAsync(PoolId Id, string Name, AgentRequirements? Requirements = null, bool? EnableAutoscaling = null, int? MinAgents = null, int? NumReserveAgents = null, IEnumerable>? Properties = null); /// /// Enumerates all the pools /// /// The pool documents Task> GetAsync(); /// /// Gets a pool by ID /// /// Unique id of the pool /// The pool document Task GetAsync(PoolId Id); /// /// Gets a list of all valid pool ids /// /// List of pool ids Task> GetPoolIdsAsync(); /// /// Gets a pool by ID /// /// Unique id of the pool /// The pool document Task DeleteAsync(PoolId Id); /// /// Updates a pool /// /// The pool to update /// New name for the pool /// New requirements for the pool /// New setting for whether to enable autoscaling /// Minimum number of agents in the pool /// Minimum number of idle agents to maintain /// New workspaces for the pool /// New properties for the pool /// New time for last (auto) scale up /// New time for last (auto) scale down /// Async task Task TryUpdateAsync(IPool Pool, string? NewName = null, AgentRequirements? NewRequirements = null, bool? NewEnableAutoscaling = null, int? NewMinAgents = null, int? NewNumReserveAgents = null, List? NewWorkspaces = null, Dictionary? NewProperties = null, DateTime? LastScaleUpTime = null, DateTime? LastScaleDownTime = null); } }