| | | 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 | | using System.Collections.Generic; |
| | | 10 | | using System.Text.Json; |
| | | 11 | | using Azure.Core; |
| | | 12 | | |
| | | 13 | | namespace Azure.ResourceManager.EventHubs.Models |
| | | 14 | | { |
| | | 15 | | public partial class EHNamespace : IUtf8JsonSerializable |
| | | 16 | | { |
| | | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 18 | | { |
| | 120 | 19 | | writer.WriteStartObject(); |
| | 120 | 20 | | if (Sku != null) |
| | | 21 | | { |
| | 56 | 22 | | writer.WritePropertyName("sku"); |
| | 56 | 23 | | writer.WriteObjectValue(Sku); |
| | | 24 | | } |
| | 120 | 25 | | if (Identity != null) |
| | | 26 | | { |
| | 0 | 27 | | writer.WritePropertyName("identity"); |
| | 0 | 28 | | writer.WriteObjectValue(Identity); |
| | | 29 | | } |
| | 120 | 30 | | if (Location != null) |
| | | 31 | | { |
| | 112 | 32 | | writer.WritePropertyName("location"); |
| | 112 | 33 | | writer.WriteStringValue(Location); |
| | | 34 | | } |
| | 120 | 35 | | if (Tags != null) |
| | | 36 | | { |
| | 104 | 37 | | writer.WritePropertyName("tags"); |
| | 104 | 38 | | writer.WriteStartObject(); |
| | 624 | 39 | | foreach (var item in Tags) |
| | | 40 | | { |
| | 208 | 41 | | writer.WritePropertyName(item.Key); |
| | 208 | 42 | | writer.WriteStringValue(item.Value); |
| | | 43 | | } |
| | 104 | 44 | | writer.WriteEndObject(); |
| | | 45 | | } |
| | 120 | 46 | | if (Id != null) |
| | | 47 | | { |
| | 0 | 48 | | writer.WritePropertyName("id"); |
| | 0 | 49 | | writer.WriteStringValue(Id); |
| | | 50 | | } |
| | 120 | 51 | | if (Name != null) |
| | | 52 | | { |
| | 0 | 53 | | writer.WritePropertyName("name"); |
| | 0 | 54 | | writer.WriteStringValue(Name); |
| | | 55 | | } |
| | 120 | 56 | | if (Type != null) |
| | | 57 | | { |
| | 0 | 58 | | writer.WritePropertyName("type"); |
| | 0 | 59 | | writer.WriteStringValue(Type); |
| | | 60 | | } |
| | 120 | 61 | | writer.WritePropertyName("properties"); |
| | 120 | 62 | | writer.WriteStartObject(); |
| | 120 | 63 | | if (ProvisioningState != null) |
| | | 64 | | { |
| | 0 | 65 | | writer.WritePropertyName("provisioningState"); |
| | 0 | 66 | | writer.WriteStringValue(ProvisioningState); |
| | | 67 | | } |
| | 120 | 68 | | if (CreatedAt != null) |
| | | 69 | | { |
| | 0 | 70 | | writer.WritePropertyName("createdAt"); |
| | 0 | 71 | | writer.WriteStringValue(CreatedAt.Value, "O"); |
| | | 72 | | } |
| | 120 | 73 | | if (UpdatedAt != null) |
| | | 74 | | { |
| | 0 | 75 | | writer.WritePropertyName("updatedAt"); |
| | 0 | 76 | | writer.WriteStringValue(UpdatedAt.Value, "O"); |
| | | 77 | | } |
| | 120 | 78 | | if (ServiceBusEndpoint != null) |
| | | 79 | | { |
| | 0 | 80 | | writer.WritePropertyName("serviceBusEndpoint"); |
| | 0 | 81 | | writer.WriteStringValue(ServiceBusEndpoint); |
| | | 82 | | } |
| | 120 | 83 | | if (ClusterArmId != null) |
| | | 84 | | { |
| | 0 | 85 | | writer.WritePropertyName("clusterArmId"); |
| | 0 | 86 | | writer.WriteStringValue(ClusterArmId); |
| | | 87 | | } |
| | 120 | 88 | | if (MetricId != null) |
| | | 89 | | { |
| | 0 | 90 | | writer.WritePropertyName("metricId"); |
| | 0 | 91 | | writer.WriteStringValue(MetricId); |
| | | 92 | | } |
| | 120 | 93 | | if (IsAutoInflateEnabled != null) |
| | | 94 | | { |
| | 8 | 95 | | writer.WritePropertyName("isAutoInflateEnabled"); |
| | 8 | 96 | | writer.WriteBooleanValue(IsAutoInflateEnabled.Value); |
| | | 97 | | } |
| | 120 | 98 | | if (MaximumThroughputUnits != null) |
| | | 99 | | { |
| | 8 | 100 | | writer.WritePropertyName("maximumThroughputUnits"); |
| | 8 | 101 | | writer.WriteNumberValue(MaximumThroughputUnits.Value); |
| | | 102 | | } |
| | 120 | 103 | | if (KafkaEnabled != null) |
| | | 104 | | { |
| | 8 | 105 | | writer.WritePropertyName("kafkaEnabled"); |
| | 8 | 106 | | writer.WriteBooleanValue(KafkaEnabled.Value); |
| | | 107 | | } |
| | 120 | 108 | | if (ZoneRedundant != null) |
| | | 109 | | { |
| | 0 | 110 | | writer.WritePropertyName("zoneRedundant"); |
| | 0 | 111 | | writer.WriteBooleanValue(ZoneRedundant.Value); |
| | | 112 | | } |
| | 120 | 113 | | if (Encryption != null) |
| | | 114 | | { |
| | 0 | 115 | | writer.WritePropertyName("encryption"); |
| | 0 | 116 | | writer.WriteObjectValue(Encryption); |
| | | 117 | | } |
| | 120 | 118 | | writer.WriteEndObject(); |
| | 120 | 119 | | writer.WriteEndObject(); |
| | 120 | 120 | | } |
| | | 121 | | |
| | | 122 | | internal static EHNamespace DeserializeEHNamespace(JsonElement element) |
| | | 123 | | { |
| | 144 | 124 | | Sku sku = default; |
| | 144 | 125 | | Identity identity = default; |
| | 144 | 126 | | string location = default; |
| | 144 | 127 | | IDictionary<string, string> tags = default; |
| | 144 | 128 | | string id = default; |
| | 144 | 129 | | string name = default; |
| | 144 | 130 | | string type = default; |
| | 144 | 131 | | string provisioningState = default; |
| | 144 | 132 | | DateTimeOffset? createdAt = default; |
| | 144 | 133 | | DateTimeOffset? updatedAt = default; |
| | 144 | 134 | | string serviceBusEndpoint = default; |
| | 144 | 135 | | string clusterArmId = default; |
| | 144 | 136 | | string metricId = default; |
| | 144 | 137 | | bool? isAutoInflateEnabled = default; |
| | 144 | 138 | | int? maximumThroughputUnits = default; |
| | 144 | 139 | | bool? kafkaEnabled = default; |
| | 144 | 140 | | bool? zoneRedundant = default; |
| | 144 | 141 | | Encryption encryption = default; |
| | 2304 | 142 | | foreach (var property in element.EnumerateObject()) |
| | | 143 | | { |
| | 1008 | 144 | | if (property.NameEquals("sku")) |
| | | 145 | | { |
| | 144 | 146 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 147 | | { |
| | | 148 | | continue; |
| | | 149 | | } |
| | 144 | 150 | | sku = Sku.DeserializeSku(property.Value); |
| | 144 | 151 | | continue; |
| | | 152 | | } |
| | 864 | 153 | | if (property.NameEquals("identity")) |
| | | 154 | | { |
| | 0 | 155 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 156 | | { |
| | | 157 | | continue; |
| | | 158 | | } |
| | 0 | 159 | | identity = Identity.DeserializeIdentity(property.Value); |
| | 0 | 160 | | continue; |
| | | 161 | | } |
| | 864 | 162 | | if (property.NameEquals("location")) |
| | | 163 | | { |
| | 144 | 164 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 165 | | { |
| | | 166 | | continue; |
| | | 167 | | } |
| | 144 | 168 | | location = property.Value.GetString(); |
| | 144 | 169 | | continue; |
| | | 170 | | } |
| | 720 | 171 | | if (property.NameEquals("tags")) |
| | | 172 | | { |
| | 144 | 173 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 174 | | { |
| | | 175 | | continue; |
| | | 176 | | } |
| | 144 | 177 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| | 784 | 178 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 179 | | { |
| | 248 | 180 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 181 | | { |
| | 0 | 182 | | dictionary.Add(property0.Name, null); |
| | | 183 | | } |
| | | 184 | | else |
| | | 185 | | { |
| | 248 | 186 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | | 187 | | } |
| | | 188 | | } |
| | 144 | 189 | | tags = dictionary; |
| | 144 | 190 | | continue; |
| | | 191 | | } |
| | 576 | 192 | | if (property.NameEquals("id")) |
| | | 193 | | { |
| | 144 | 194 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 195 | | { |
| | | 196 | | continue; |
| | | 197 | | } |
| | 144 | 198 | | id = property.Value.GetString(); |
| | 144 | 199 | | continue; |
| | | 200 | | } |
| | 432 | 201 | | if (property.NameEquals("name")) |
| | | 202 | | { |
| | 144 | 203 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 204 | | { |
| | | 205 | | continue; |
| | | 206 | | } |
| | 144 | 207 | | name = property.Value.GetString(); |
| | 144 | 208 | | continue; |
| | | 209 | | } |
| | 288 | 210 | | if (property.NameEquals("type")) |
| | | 211 | | { |
| | 144 | 212 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 213 | | { |
| | | 214 | | continue; |
| | | 215 | | } |
| | 144 | 216 | | type = property.Value.GetString(); |
| | 144 | 217 | | continue; |
| | | 218 | | } |
| | 144 | 219 | | if (property.NameEquals("properties")) |
| | | 220 | | { |
| | 3168 | 221 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 222 | | { |
| | 1440 | 223 | | if (property0.NameEquals("provisioningState")) |
| | | 224 | | { |
| | 144 | 225 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 226 | | { |
| | | 227 | | continue; |
| | | 228 | | } |
| | 144 | 229 | | provisioningState = property0.Value.GetString(); |
| | 144 | 230 | | continue; |
| | | 231 | | } |
| | 1296 | 232 | | if (property0.NameEquals("createdAt")) |
| | | 233 | | { |
| | 144 | 234 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 235 | | { |
| | | 236 | | continue; |
| | | 237 | | } |
| | 144 | 238 | | createdAt = property0.Value.GetDateTimeOffset("O"); |
| | 144 | 239 | | continue; |
| | | 240 | | } |
| | 1152 | 241 | | if (property0.NameEquals("updatedAt")) |
| | | 242 | | { |
| | 144 | 243 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 244 | | { |
| | | 245 | | continue; |
| | | 246 | | } |
| | 144 | 247 | | updatedAt = property0.Value.GetDateTimeOffset("O"); |
| | 144 | 248 | | continue; |
| | | 249 | | } |
| | 1008 | 250 | | if (property0.NameEquals("serviceBusEndpoint")) |
| | | 251 | | { |
| | 144 | 252 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 253 | | { |
| | | 254 | | continue; |
| | | 255 | | } |
| | 144 | 256 | | serviceBusEndpoint = property0.Value.GetString(); |
| | 144 | 257 | | continue; |
| | | 258 | | } |
| | 864 | 259 | | if (property0.NameEquals("clusterArmId")) |
| | | 260 | | { |
| | 0 | 261 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 262 | | { |
| | | 263 | | continue; |
| | | 264 | | } |
| | 0 | 265 | | clusterArmId = property0.Value.GetString(); |
| | 0 | 266 | | continue; |
| | | 267 | | } |
| | 864 | 268 | | if (property0.NameEquals("metricId")) |
| | | 269 | | { |
| | 144 | 270 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 271 | | { |
| | | 272 | | continue; |
| | | 273 | | } |
| | 144 | 274 | | metricId = property0.Value.GetString(); |
| | 144 | 275 | | continue; |
| | | 276 | | } |
| | 720 | 277 | | if (property0.NameEquals("isAutoInflateEnabled")) |
| | | 278 | | { |
| | 144 | 279 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 280 | | { |
| | | 281 | | continue; |
| | | 282 | | } |
| | 144 | 283 | | isAutoInflateEnabled = property0.Value.GetBoolean(); |
| | 144 | 284 | | continue; |
| | | 285 | | } |
| | 576 | 286 | | if (property0.NameEquals("maximumThroughputUnits")) |
| | | 287 | | { |
| | 144 | 288 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 289 | | { |
| | | 290 | | continue; |
| | | 291 | | } |
| | 144 | 292 | | maximumThroughputUnits = property0.Value.GetInt32(); |
| | 144 | 293 | | continue; |
| | | 294 | | } |
| | 432 | 295 | | if (property0.NameEquals("kafkaEnabled")) |
| | | 296 | | { |
| | 144 | 297 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 298 | | { |
| | | 299 | | continue; |
| | | 300 | | } |
| | 144 | 301 | | kafkaEnabled = property0.Value.GetBoolean(); |
| | 144 | 302 | | continue; |
| | | 303 | | } |
| | 288 | 304 | | if (property0.NameEquals("zoneRedundant")) |
| | | 305 | | { |
| | 144 | 306 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 307 | | { |
| | | 308 | | continue; |
| | | 309 | | } |
| | 144 | 310 | | zoneRedundant = property0.Value.GetBoolean(); |
| | 144 | 311 | | continue; |
| | | 312 | | } |
| | 144 | 313 | | if (property0.NameEquals("encryption")) |
| | | 314 | | { |
| | 0 | 315 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 316 | | { |
| | | 317 | | continue; |
| | | 318 | | } |
| | 0 | 319 | | encryption = Encryption.DeserializeEncryption(property0.Value); |
| | | 320 | | continue; |
| | | 321 | | } |
| | | 322 | | } |
| | | 323 | | continue; |
| | | 324 | | } |
| | | 325 | | } |
| | 144 | 326 | | return new EHNamespace(id, name, type, location, tags, sku, identity, provisioningState, createdAt, updatedA |
| | | 327 | | } |
| | | 328 | | } |
| | | 329 | | } |