2022-08-29 12:38:21 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
2022-09-09 11:35:24 -04:00
|
|
|
using System;
|
2022-08-29 12:38:21 -04:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2023-01-06 12:42:07 -05:00
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Text.Json.Serialization;
|
2022-08-29 12:38:21 -04:00
|
|
|
using EpicGames.Core;
|
2023-03-17 09:50:40 -04:00
|
|
|
using Horde.Server.Acls;
|
|
|
|
|
using Horde.Server.Agents.Pools;
|
|
|
|
|
using Horde.Server.Configuration;
|
|
|
|
|
using Horde.Server.Server;
|
|
|
|
|
using Horde.Server.Streams;
|
2023-01-30 17:34:49 -05:00
|
|
|
using HordeCommon.Rpc.Tasks;
|
2023-06-14 22:18:34 -04:00
|
|
|
using EpicGames.Horde.Api;
|
2022-08-29 12:38:21 -04:00
|
|
|
|
2023-03-17 09:50:40 -04:00
|
|
|
namespace Horde.Server.Projects
|
2022-08-29 12:38:21 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stores configuration for a project
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonSchema("https://unrealengine.com/horde/project")]
|
|
|
|
|
[JsonSchemaCatalog("Horde Project", "Horde project configuration file", new[] { "*.project.json", "Projects/*.json" })]
|
2023-01-13 16:01:14 -05:00
|
|
|
[ConfigIncludeRoot]
|
|
|
|
|
[DebuggerDisplay("{Id}")]
|
2023-02-01 15:11:15 -05:00
|
|
|
public class ProjectConfig : IAclScope
|
2022-08-29 12:38:21 -04:00
|
|
|
{
|
2023-01-13 16:01:14 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Accessor for the global config owning this project
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public GlobalConfig GlobalConfig { get; private set; } = null!;
|
|
|
|
|
|
2023-02-01 15:11:15 -05:00
|
|
|
/// <inheritdoc/>
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public IAclScope? ParentScope => GlobalConfig;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public AclScopeName ScopeName { get; private set; }
|
|
|
|
|
|
2023-01-13 16:01:14 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// The project id
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ProjectId Id { get; set; }
|
|
|
|
|
|
2022-08-29 12:38:21 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Name for the new project
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name { get; set; } = null!;
|
|
|
|
|
|
2023-01-13 16:01:14 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Direct include path for the project config. For backwards compatibility with old config files when including from a GlobalConfig object.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ConfigInclude, ConfigRelativePath]
|
|
|
|
|
public string? Path { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Includes for other configuration files
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<ConfigInclude> Include { get; set; } = new List<ConfigInclude>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Order of this project on the dashboard
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Order { get; set; } = 128;
|
|
|
|
|
|
2022-08-29 12:38:21 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the project logo
|
|
|
|
|
/// </summary>
|
2023-01-17 13:50:26 -05:00
|
|
|
public ConfigResource? Logo { get; set; }
|
2022-08-29 12:38:21 -04:00
|
|
|
|
2022-11-15 13:22:09 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// List of pools for this project
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<PoolConfig> Pools { get; set; } = new List<PoolConfig>();
|
|
|
|
|
|
2022-08-29 12:38:21 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Categories to include in this project
|
|
|
|
|
/// </summary>
|
2022-09-09 11:35:24 -04:00
|
|
|
public List<ProjectCategoryConfig> Categories { get; set; } = new List<ProjectCategoryConfig>();
|
2022-08-29 12:38:21 -04:00
|
|
|
|
2023-01-30 17:34:49 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Default settings for executing jobs
|
|
|
|
|
/// </summary>
|
|
|
|
|
public JobOptions JobOptions { get; set; } = new JobOptions();
|
|
|
|
|
|
2022-08-29 12:38:21 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// List of streams
|
|
|
|
|
/// </summary>
|
2023-01-13 16:01:14 -05:00
|
|
|
public List<StreamConfig> Streams { get; set; } = new List<StreamConfig>();
|
2022-08-29 12:38:21 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Acl entries
|
|
|
|
|
/// </summary>
|
2022-09-05 10:33:46 -04:00
|
|
|
public AclConfig? Acl { get; set; }
|
2022-08-29 12:38:21 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-01-13 16:01:14 -05:00
|
|
|
/// Callback after this configuration has been read
|
2022-08-29 12:38:21 -04:00
|
|
|
/// </summary>
|
2023-01-13 16:01:14 -05:00
|
|
|
/// <param name="id">Id of this project</param>
|
|
|
|
|
/// <param name="globalConfig">The owning global config object</param>
|
|
|
|
|
public void PostLoad(ProjectId id, GlobalConfig globalConfig)
|
|
|
|
|
{
|
|
|
|
|
Id = id;
|
|
|
|
|
GlobalConfig = globalConfig;
|
2023-02-01 15:17:02 -05:00
|
|
|
ScopeName = globalConfig.ScopeName.Append("p", Id.ToString());
|
2023-01-13 16:01:14 -05:00
|
|
|
|
|
|
|
|
foreach (StreamConfig stream in Streams)
|
|
|
|
|
{
|
|
|
|
|
stream.PostLoad(stream.Id, this);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-29 12:38:21 -04:00
|
|
|
}
|
2022-09-09 11:35:24 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Information about a category to display for a stream
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ProjectCategoryConfig
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Name of this category
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
public string Name { get; set; } = String.Empty;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Index of the row to display this category on
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Row { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether to show this category on the nav menu
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowOnNavMenu { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Patterns for stream names to include
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> IncludePatterns { get; set; } = new List<string>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Patterns for stream names to exclude
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> ExcludePatterns { get; set; } = new List<string>();
|
|
|
|
|
}
|
2022-08-29 12:38:21 -04:00
|
|
|
}
|