Octopus.Cli.Commands.HealthStatusProvider.ValidateOptions C# (CSharp) Method

ValidateOptions() private method

private ValidateOptions ( ) : void
return void
        void ValidateOptions()
        {
            if (IsHealthStatusPendingDeprication)
            {
                if (statuses.Any())
                {
                    log.Warning("The `--status` parameter will be depricated in Octopus Deploy 4.0. You may want to execute this command with the `--health-status=` parameter instead.");
                }
            }
            else
            {
                if (healthStatuses.Any())
                {
                    throw new CommandException("The `--health-status` parameter is only available on Octopus Server instances from 3.4.0 onwards.");
                }
            }

            var missingStatuses = statuses.Where(s => !StatusNames.Contains(s, StringComparer.OrdinalIgnoreCase)).ToList();
            if (missingStatuses.Any())
                throw new CommandException(
                    $"The following status value is unknown: {string.Join(", ", missingStatuses)}. Please choose from {string.Join(", ", StatusNames)}");


            var unknownStatuses = healthStatuses.Where(s => !HealthStatusNames.Contains(s, StringComparer.OrdinalIgnoreCase)).ToList();
            if (unknownStatuses.Any())
                throw new CommandException(
                    $"The following health status value is unknown: {string.Join(", ", missingStatuses)}. Please choose from {string.Join(", ", unknownStatuses)}");
        }