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