This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Scott Bommarito
authored
Oct 12, 2018
1 parent
c75c1c5
commit c3aeb02
Showing
69 changed files
with
5,740 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/StatusAggregator/Parse/EnvironmentPrefixIncidentParser.cs
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
src/StatusAggregator/Parse/EnvironmentPrefixIncidentRegexParsingHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NuGet.Services.Incidents; | ||
|
||
namespace StatusAggregator.Parse | ||
{ | ||
/// <summary> | ||
/// Subclass of <see cref="IncidentRegexParsingHandler"/> that expects <see cref="Incident"/>s are prefixed with "[ENVIRONMENT]". | ||
/// </summary> | ||
public abstract class EnvironmentPrefixIncidentRegexParsingHandler : IncidentRegexParsingHandler | ||
{ | ||
public EnvironmentPrefixIncidentRegexParsingHandler( | ||
string subtitleRegEx, | ||
IEnumerable<IIncidentRegexParsingFilter> filters) | ||
: base( | ||
PrependEnvironmentRegexGroup(subtitleRegEx), | ||
filters) | ||
{ | ||
if (!filters.Any(f => f is EnvironmentRegexParsingFilter)) | ||
{ | ||
throw new ArgumentException( | ||
$"A {nameof(EnvironmentPrefixIncidentRegexParsingHandler)} must be run with an {nameof(EnvironmentRegexParsingFilter)}!", | ||
nameof(filters)); | ||
} | ||
} | ||
|
||
private static string PrependEnvironmentRegexGroup(string subtitleRegEx) | ||
{ | ||
return $@"\[(?<{EnvironmentRegexParsingFilter.EnvironmentGroupName}>.*)\] {subtitleRegEx}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/StatusAggregator/Parse/IIncidentRegexParsingHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
using NuGet.Services.Incidents; | ||
using NuGet.Services.Status; | ||
|
||
namespace StatusAggregator.Parse | ||
{ | ||
public interface IIncidentRegexParsingHandler | ||
{ | ||
string RegexPattern { get; } | ||
IReadOnlyCollection<IIncidentRegexParsingFilter> Filters { get; } | ||
|
||
/// <summary> | ||
/// Attempts to parse a <see cref="ParsedIncident.AffectedComponentPath"/> from <paramref name="incident"/>. | ||
/// </summary> | ||
/// <param name="affectedComponentPath"> | ||
/// The <see cref="ParsedIncident.AffectedComponentPath"/> parsed from <paramref name="incident"/> or <c>null</c> if <paramref name="incident"/> could not be parsed. | ||
/// </param> | ||
/// <returns> | ||
/// <c>true</c> if a <see cref="ParsedIncident.AffectedComponentPath"/> can be parsed from <paramref name="incident"/> and <c>false</c> otherwise. | ||
/// </returns> | ||
bool TryParseAffectedComponentPath(Incident incident, GroupCollection groups, out string affectedComponentPath); | ||
|
||
/// <summary> | ||
/// Attempts to parse a <see cref="ParsedIncident.AffectedComponentStatus"/> from <paramref name="incident"/>. | ||
/// </summary> | ||
/// <param name="affectedComponentStatus"></param> | ||
/// The <see cref="ParsedIncident.AffectedComponentStatus"/> parsed from <paramref name="incident"/> or <see cref="default(ComponentStatus)"/> if <paramref name="incident"/> could not be parsed. | ||
/// <returns> | ||
/// <c>true</c> if a <see cref="ParsedIncident.AffectedComponentStatus"/> can be parsed from <paramref name="incident"/> and <c>false</c> otherwise. | ||
/// </returns> | ||
bool TryParseAffectedComponentStatus(Incident incident, GroupCollection groups, out ComponentStatus affectedComponentStatus); | ||
} | ||
} |
Oops, something went wrong.