| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | |
|
| | 10 | | namespace Azure.ResourceManager.Storage.Models |
| | 11 | | { |
| | 12 | | internal static class UsageUnitExtensions |
| | 13 | | { |
| 0 | 14 | | public static string ToSerialString(this UsageUnit value) => value switch |
| 0 | 15 | | { |
| 0 | 16 | | UsageUnit.Count => "Count", |
| 0 | 17 | | UsageUnit.Bytes => "Bytes", |
| 0 | 18 | | UsageUnit.Seconds => "Seconds", |
| 0 | 19 | | UsageUnit.Percent => "Percent", |
| 0 | 20 | | UsageUnit.CountsPerSecond => "CountsPerSecond", |
| 0 | 21 | | UsageUnit.BytesPerSecond => "BytesPerSecond", |
| 0 | 22 | | _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown UsageUnit value.") |
| 0 | 23 | | }; |
| | 24 | |
|
| | 25 | | public static UsageUnit ToUsageUnit(this string value) |
| | 26 | | { |
| 8 | 27 | | if (string.Equals(value, "Count", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Count; |
| 0 | 28 | | if (string.Equals(value, "Bytes", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Bytes; |
| 0 | 29 | | if (string.Equals(value, "Seconds", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Seconds; |
| 0 | 30 | | if (string.Equals(value, "Percent", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.Percent; |
| 0 | 31 | | if (string.Equals(value, "CountsPerSecond", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.C |
| 0 | 32 | | if (string.Equals(value, "BytesPerSecond", StringComparison.InvariantCultureIgnoreCase)) return UsageUnit.By |
| 0 | 33 | | throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown UsageUnit value."); |
| | 34 | | } |
| | 35 | | } |
| | 36 | | } |