| | | 1 | | namespace AsiBackbone.Core.Classification; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Provides stable provider-neutral reason codes for DLP and classification failure policy decisions. |
| | | 5 | | /// </summary> |
| | | 6 | | public static class DlpFailureReasonCodes |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Reason code used when the screening service or API is unavailable. |
| | | 10 | | /// </summary> |
| | | 11 | | public const string ServiceUnavailable = "dlp.service_unavailable"; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Reason code used when screening times out. |
| | | 15 | | /// </summary> |
| | | 16 | | public const string Timeout = "dlp.timeout"; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Reason code used when screening returns an indeterminate result. |
| | | 20 | | /// </summary> |
| | | 21 | | public const string IndeterminateResult = "dlp.indeterminate_result"; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Reason code used when screening returns a blocked result. |
| | | 25 | | /// </summary> |
| | | 26 | | public const string BlockedResult = "dlp.blocked_result"; |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Reason code used when screening returns a classified result that requires policy handling. |
| | | 30 | | /// </summary> |
| | | 31 | | public const string ClassifiedResult = "dlp.classified_result"; |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets the reason code associated with a provider-neutral DLP or classification failure kind. |
| | | 35 | | /// </summary> |
| | | 36 | | /// <param name="failureKind">The failure kind.</param> |
| | | 37 | | /// <returns>The stable reason code.</returns> |
| | | 38 | | public static string GetFor(DlpClassificationFailureKind failureKind) |
| | | 39 | | { |
| | 31 | 40 | | return failureKind switch |
| | 31 | 41 | | { |
| | 17 | 42 | | DlpClassificationFailureKind.ServiceUnavailable => ServiceUnavailable, |
| | 4 | 43 | | DlpClassificationFailureKind.Timeout => Timeout, |
| | 3 | 44 | | DlpClassificationFailureKind.IndeterminateResult => IndeterminateResult, |
| | 3 | 45 | | DlpClassificationFailureKind.BlockedResult => BlockedResult, |
| | 3 | 46 | | DlpClassificationFailureKind.ClassifiedResult => ClassifiedResult, |
| | 1 | 47 | | _ => throw new ArgumentOutOfRangeException(nameof(failureKind), failureKind, "DLP failure kind must be defin |
| | 31 | 48 | | }; |
| | | 49 | | } |
| | | 50 | | } |