| | 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.EventHubs.Models |
| | 13 | | { |
| | 14 | | public partial class Cluster : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Sku != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("sku"); |
| 0 | 22 | | writer.WriteObjectValue(Sku); |
| | 23 | | } |
| 0 | 24 | | if (Location != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("location"); |
| 0 | 27 | | writer.WriteStringValue(Location); |
| | 28 | | } |
| 0 | 29 | | if (Tags != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("tags"); |
| 0 | 32 | | writer.WriteStartObject(); |
| 0 | 33 | | foreach (var item in Tags) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName(item.Key); |
| 0 | 36 | | writer.WriteStringValue(item.Value); |
| | 37 | | } |
| 0 | 38 | | writer.WriteEndObject(); |
| | 39 | | } |
| 0 | 40 | | if (Id != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("id"); |
| 0 | 43 | | writer.WriteStringValue(Id); |
| | 44 | | } |
| 0 | 45 | | if (Name != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("name"); |
| 0 | 48 | | writer.WriteStringValue(Name); |
| | 49 | | } |
| 0 | 50 | | if (Type != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("type"); |
| 0 | 53 | | writer.WriteStringValue(Type); |
| | 54 | | } |
| 0 | 55 | | writer.WritePropertyName("properties"); |
| 0 | 56 | | writer.WriteStartObject(); |
| 0 | 57 | | if (Created != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("created"); |
| 0 | 60 | | writer.WriteStringValue(Created); |
| | 61 | | } |
| 0 | 62 | | if (Updated != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("updated"); |
| 0 | 65 | | writer.WriteStringValue(Updated); |
| | 66 | | } |
| 0 | 67 | | if (MetricId != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("metricId"); |
| 0 | 70 | | writer.WriteStringValue(MetricId); |
| | 71 | | } |
| 0 | 72 | | if (Status != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("status"); |
| 0 | 75 | | writer.WriteStringValue(Status); |
| | 76 | | } |
| 0 | 77 | | writer.WriteEndObject(); |
| 0 | 78 | | writer.WriteEndObject(); |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | internal static Cluster DeserializeCluster(JsonElement element) |
| | 82 | | { |
| 0 | 83 | | ClusterSku sku = default; |
| 0 | 84 | | string location = default; |
| 0 | 85 | | IDictionary<string, string> tags = default; |
| 0 | 86 | | string id = default; |
| 0 | 87 | | string name = default; |
| 0 | 88 | | string type = default; |
| 0 | 89 | | string created = default; |
| 0 | 90 | | string updated = default; |
| 0 | 91 | | string metricId = default; |
| 0 | 92 | | string status = default; |
| 0 | 93 | | foreach (var property in element.EnumerateObject()) |
| | 94 | | { |
| 0 | 95 | | if (property.NameEquals("sku")) |
| | 96 | | { |
| 0 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 0 | 101 | | sku = ClusterSku.DeserializeClusterSku(property.Value); |
| 0 | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | if (property.NameEquals("location")) |
| | 105 | | { |
| 0 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | location = property.Value.GetString(); |
| 0 | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | if (property.NameEquals("tags")) |
| | 114 | | { |
| 0 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 120 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 121 | | { |
| 0 | 122 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| 0 | 124 | | dictionary.Add(property0.Name, null); |
| | 125 | | } |
| | 126 | | else |
| | 127 | | { |
| 0 | 128 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 129 | | } |
| | 130 | | } |
| 0 | 131 | | tags = dictionary; |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property.NameEquals("id")) |
| | 135 | | { |
| 0 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | id = property.Value.GetString(); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property.NameEquals("name")) |
| | 144 | | { |
| 0 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | name = property.Value.GetString(); |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property.NameEquals("type")) |
| | 153 | | { |
| 0 | 154 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | type = property.Value.GetString(); |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property.NameEquals("properties")) |
| | 162 | | { |
| 0 | 163 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 164 | | { |
| 0 | 165 | | if (property0.NameEquals("created")) |
| | 166 | | { |
| 0 | 167 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | created = property0.Value.GetString(); |
| 0 | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | if (property0.NameEquals("updated")) |
| | 175 | | { |
| 0 | 176 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | updated = property0.Value.GetString(); |
| 0 | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | if (property0.NameEquals("metricId")) |
| | 184 | | { |
| 0 | 185 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 186 | | { |
| | 187 | | continue; |
| | 188 | | } |
| 0 | 189 | | metricId = property0.Value.GetString(); |
| 0 | 190 | | continue; |
| | 191 | | } |
| 0 | 192 | | if (property0.NameEquals("status")) |
| | 193 | | { |
| 0 | 194 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | status = property0.Value.GetString(); |
| | 199 | | continue; |
| | 200 | | } |
| | 201 | | } |
| | 202 | | continue; |
| | 203 | | } |
| | 204 | | } |
| 0 | 205 | | return new Cluster(id, name, type, location, tags, sku, created, updated, metricId, status); |
| | 206 | | } |
| | 207 | | } |
| | 208 | | } |