42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
namespace Nexus.Api.Services;
|
|
|
|
public sealed record AgentConfigFileInfo(string FileName, long Size, DateTime ModifiedAt);
|
|
|
|
public sealed record AgentConfigFileContent(string FileName, string Content, long Size, DateTime ModifiedAt);
|
|
|
|
public sealed record AgentConfigValidationResult(string Status, string FileKind, IReadOnlyList<string> Errors);
|
|
|
|
public sealed record AgentConfigBackupResult(string Status, bool BackupCreated);
|
|
|
|
public sealed record AgentConfigReloadCheckResult(string Status, string Message);
|
|
|
|
public sealed record AgentConfigFileSaveResult(
|
|
string FileName,
|
|
long Size,
|
|
DateTime ModifiedAt,
|
|
AgentConfigValidationResult Validation,
|
|
AgentConfigBackupResult Backup,
|
|
AgentConfigReloadCheckResult ReloadCheck
|
|
);
|
|
|
|
public sealed record AgentConfigSaveFailure(
|
|
string Code,
|
|
AgentConfigValidationResult Validation,
|
|
AgentConfigBackupResult Backup,
|
|
AgentConfigReloadCheckResult ReloadCheck
|
|
);
|
|
|
|
public sealed record AgentConfigSaveAttempt(
|
|
AgentConfigFileSaveResult? SaveResult,
|
|
AgentConfigSaveFailure? Failure
|
|
);
|
|
|
|
public interface IAgentConfigService
|
|
{
|
|
const int MaxConfigFileBytes = 500 * 1024;
|
|
|
|
IReadOnlyList<AgentConfigFileInfo> GetConfigFiles(string agentId);
|
|
Task<AgentConfigFileContent?> GetConfigFileAsync(string agentId, string fileName, CancellationToken ct = default);
|
|
Task<AgentConfigSaveAttempt> SaveConfigFileAsync(string agentId, string fileName, string content, CancellationToken ct = default);
|
|
}
|