public TenantResource WithTag(TagResource tag) { if (!TenantTags.Any(t => string.Equals(t, tag.CanonicalTagName, StringComparison.OrdinalIgnoreCase))) { TenantTags.Add(tag.CanonicalTagName); } return(this); }
void ValidateTenantTags(IOctopusSpaceRepository repository) { if (TenantTags == null || !TenantTags.Any()) { return; } var tagSets = repository.TagSets.FindAll(); var missingTags = TenantTags.Where(tt => !tagSets.Any(ts => ts.Tags.Any(t => t.CanonicalTagName.Equals(tt, StringComparison.OrdinalIgnoreCase)))).ToList(); if (missingTags.Any()) { throw new ArgumentException(CouldNotFindMessage("tag", missingTags.ToArray())); } }
void ValidateTenantTags(OctopusRepository repository) { if (TenantTags == null || !TenantTags.Any()) { return; } var tagSets = repository.TagSets.FindAll(); var missingTags = TenantTags.Where(tt => !tagSets.Any(ts => ts.Tags.Any(t => t.CanonicalTagName.Equals(tt, StringComparison.OrdinalIgnoreCase)))).ToList(); if (missingTags.Any()) { throw new ArgumentException($"Could not find the {"tag" + (missingTags.Count == 1 ? "" : "s")} {string.Join(", ", missingTags)} on the Octopus server."); } }
async Task ValidateTenantTags(IOctopusSpaceAsyncRepository repository) { if (TenantTags == null || !TenantTags.Any()) { return; } var tagSets = await repository.TagSets.FindAll().ConfigureAwait(false); var missingTags = TenantTags.Where(tt => !tagSets.Any(ts => ts.Tags.Any(t => t.CanonicalTagName.Equals(tt, StringComparison.OrdinalIgnoreCase)))).ToList(); if (missingTags.Any()) { throw new InvalidRegistrationArgumentsException(CouldNotFindMessage("tag", missingTags.ToArray())); } }