protected override Task ValidateParameters() { if (ProjectNameOrId == null) { throw new CommandException("A project name or id must be supplied."); } if (RunbookNameOrId == null) { throw new CommandException("Runbook name or id must be supplied."); } if (!EnvironmentNamesOrIds.Any()) { throw new CommandException("One or more environment must be supplied."); } if ((RunAt ?? DateTimeOffset.Now) > NoRunAfter) { throw new CommandException( "The Run will expire before it has a chance to execute. Please select an expiry time that occurs after the deployment is scheduled to begin"); } CheckForIntersection(IncludedMachineIds.ToList(), ExcludedMachineIds.ToList()); if (TenantNamesOrIds.Contains("*") && (TenantNamesOrIds.Count > 1 || TenantTagNames.Count > 0)) { throw new CommandException( "When running on all tenants using the --tenant=* wildcard, no other tenant filters can be provided"); } return(Task.FromResult(0)); }
private async Task <string[]> RetrieveTenants() { return((!TenantNamesOrIds.Contains("*") && TenantNamesOrIds.Any()) ? (await Repository.Tenants.FindByNamesOrIdsOrFail(TenantNamesOrIds).ConfigureAwait(false)).Select(ten => ten.Id).ToArray() : TenantNamesOrIds.ToArray()); }