33 lines
987 B
C#
33 lines
987 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO.Abstractions;
|
|
using StellaOps.Vexer.Connectors.Abstractions;
|
|
|
|
namespace StellaOps.Vexer.Connectors.SUSE.RancherVEXHub.Configuration;
|
|
|
|
public sealed class RancherHubConnectorOptionsValidator : IVexConnectorOptionsValidator<RancherHubConnectorOptions>
|
|
{
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
public RancherHubConnectorOptionsValidator(IFileSystem fileSystem)
|
|
{
|
|
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
|
|
}
|
|
|
|
public void Validate(VexConnectorDescriptor descriptor, RancherHubConnectorOptions options, IList<string> errors)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(descriptor);
|
|
ArgumentNullException.ThrowIfNull(options);
|
|
ArgumentNullException.ThrowIfNull(errors);
|
|
|
|
try
|
|
{
|
|
options.Validate(_fileSystem);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message);
|
|
}
|
|
}
|
|
}
|