| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class MetricSpecification |
| | 15 | | { |
| | 16 | | internal static MetricSpecification DeserializeMetricSpecification(JsonElement element) |
| | 17 | | { |
| 0 | 18 | | string name = default; |
| 0 | 19 | | string displayName = default; |
| 0 | 20 | | string displayDescription = default; |
| 0 | 21 | | string unit = default; |
| 0 | 22 | | IReadOnlyList<Dimension> dimensions = default; |
| 0 | 23 | | string aggregationType = default; |
| 0 | 24 | | bool? fillGapWithZero = default; |
| 0 | 25 | | string category = default; |
| 0 | 26 | | string resourceIdDimensionNameOverride = default; |
| 0 | 27 | | foreach (var property in element.EnumerateObject()) |
| | 28 | | { |
| 0 | 29 | | if (property.NameEquals("name")) |
| | 30 | | { |
| 0 | 31 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 32 | | { |
| | 33 | | continue; |
| | 34 | | } |
| 0 | 35 | | name = property.Value.GetString(); |
| 0 | 36 | | continue; |
| | 37 | | } |
| 0 | 38 | | if (property.NameEquals("displayName")) |
| | 39 | | { |
| 0 | 40 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 41 | | { |
| | 42 | | continue; |
| | 43 | | } |
| 0 | 44 | | displayName = property.Value.GetString(); |
| 0 | 45 | | continue; |
| | 46 | | } |
| 0 | 47 | | if (property.NameEquals("displayDescription")) |
| | 48 | | { |
| 0 | 49 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 50 | | { |
| | 51 | | continue; |
| | 52 | | } |
| 0 | 53 | | displayDescription = property.Value.GetString(); |
| 0 | 54 | | continue; |
| | 55 | | } |
| 0 | 56 | | if (property.NameEquals("unit")) |
| | 57 | | { |
| 0 | 58 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 59 | | { |
| | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | unit = property.Value.GetString(); |
| 0 | 63 | | continue; |
| | 64 | | } |
| 0 | 65 | | if (property.NameEquals("dimensions")) |
| | 66 | | { |
| 0 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 0 | 71 | | List<Dimension> array = new List<Dimension>(); |
| 0 | 72 | | foreach (var item in property.Value.EnumerateArray()) |
| | 73 | | { |
| 0 | 74 | | if (item.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| 0 | 76 | | array.Add(null); |
| | 77 | | } |
| | 78 | | else |
| | 79 | | { |
| 0 | 80 | | array.Add(Dimension.DeserializeDimension(item)); |
| | 81 | | } |
| | 82 | | } |
| 0 | 83 | | dimensions = array; |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property.NameEquals("aggregationType")) |
| | 87 | | { |
| 0 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 0 | 92 | | aggregationType = property.Value.GetString(); |
| 0 | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | if (property.NameEquals("fillGapWithZero")) |
| | 96 | | { |
| 0 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 0 | 101 | | fillGapWithZero = property.Value.GetBoolean(); |
| 0 | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | if (property.NameEquals("category")) |
| | 105 | | { |
| 0 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | category = property.Value.GetString(); |
| 0 | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | if (property.NameEquals("resourceIdDimensionNameOverride")) |
| | 114 | | { |
| 0 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | resourceIdDimensionNameOverride = property.Value.GetString(); |
| | 120 | | continue; |
| | 121 | | } |
| | 122 | | } |
| 0 | 123 | | return new MetricSpecification(name, displayName, displayDescription, unit, dimensions, aggregationType, fil |
| | 124 | | } |
| | 125 | | } |
| | 126 | | } |