| | | 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 PrivateEndpoint : IUtf8JsonSerializable |
| | | 15 | | { |
| | | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 17 | | { |
| | 0 | 18 | | writer.WriteStartObject(); |
| | 0 | 19 | | if (Etag != null) |
| | | 20 | | { |
| | 0 | 21 | | writer.WritePropertyName("etag"); |
| | 0 | 22 | | writer.WriteStringValue(Etag); |
| | | 23 | | } |
| | 0 | 24 | | if (Id != null) |
| | | 25 | | { |
| | 0 | 26 | | writer.WritePropertyName("id"); |
| | 0 | 27 | | writer.WriteStringValue(Id); |
| | | 28 | | } |
| | 0 | 29 | | if (Name != null) |
| | | 30 | | { |
| | 0 | 31 | | writer.WritePropertyName("name"); |
| | 0 | 32 | | writer.WriteStringValue(Name); |
| | | 33 | | } |
| | 0 | 34 | | if (Type != null) |
| | | 35 | | { |
| | 0 | 36 | | writer.WritePropertyName("type"); |
| | 0 | 37 | | writer.WriteStringValue(Type); |
| | | 38 | | } |
| | 0 | 39 | | if (Location != null) |
| | | 40 | | { |
| | 0 | 41 | | writer.WritePropertyName("location"); |
| | 0 | 42 | | writer.WriteStringValue(Location); |
| | | 43 | | } |
| | 0 | 44 | | if (Tags != null) |
| | | 45 | | { |
| | 0 | 46 | | writer.WritePropertyName("tags"); |
| | 0 | 47 | | writer.WriteStartObject(); |
| | 0 | 48 | | foreach (var item in Tags) |
| | | 49 | | { |
| | 0 | 50 | | writer.WritePropertyName(item.Key); |
| | 0 | 51 | | writer.WriteStringValue(item.Value); |
| | | 52 | | } |
| | 0 | 53 | | writer.WriteEndObject(); |
| | | 54 | | } |
| | 0 | 55 | | writer.WritePropertyName("properties"); |
| | 0 | 56 | | writer.WriteStartObject(); |
| | 0 | 57 | | if (Subnet != null) |
| | | 58 | | { |
| | 0 | 59 | | writer.WritePropertyName("subnet"); |
| | 0 | 60 | | writer.WriteObjectValue(Subnet); |
| | | 61 | | } |
| | 0 | 62 | | if (NetworkInterfaces != null) |
| | | 63 | | { |
| | 0 | 64 | | writer.WritePropertyName("networkInterfaces"); |
| | 0 | 65 | | writer.WriteStartArray(); |
| | 0 | 66 | | foreach (var item in NetworkInterfaces) |
| | | 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 | | if (PrivateLinkServiceConnections != null) |
| | | 78 | | { |
| | 0 | 79 | | writer.WritePropertyName("privateLinkServiceConnections"); |
| | 0 | 80 | | writer.WriteStartArray(); |
| | 0 | 81 | | foreach (var item in PrivateLinkServiceConnections) |
| | | 82 | | { |
| | 0 | 83 | | writer.WriteObjectValue(item); |
| | | 84 | | } |
| | 0 | 85 | | writer.WriteEndArray(); |
| | | 86 | | } |
| | 0 | 87 | | if (ManualPrivateLinkServiceConnections != null) |
| | | 88 | | { |
| | 0 | 89 | | writer.WritePropertyName("manualPrivateLinkServiceConnections"); |
| | 0 | 90 | | writer.WriteStartArray(); |
| | 0 | 91 | | foreach (var item in ManualPrivateLinkServiceConnections) |
| | | 92 | | { |
| | 0 | 93 | | writer.WriteObjectValue(item); |
| | | 94 | | } |
| | 0 | 95 | | writer.WriteEndArray(); |
| | | 96 | | } |
| | 0 | 97 | | if (CustomDnsConfigs != null) |
| | | 98 | | { |
| | 0 | 99 | | writer.WritePropertyName("customDnsConfigs"); |
| | 0 | 100 | | writer.WriteStartArray(); |
| | 0 | 101 | | foreach (var item in CustomDnsConfigs) |
| | | 102 | | { |
| | 0 | 103 | | writer.WriteObjectValue(item); |
| | | 104 | | } |
| | 0 | 105 | | writer.WriteEndArray(); |
| | | 106 | | } |
| | 0 | 107 | | writer.WriteEndObject(); |
| | 0 | 108 | | writer.WriteEndObject(); |
| | 0 | 109 | | } |
| | | 110 | | |
| | | 111 | | internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element) |
| | | 112 | | { |
| | 0 | 113 | | string etag = default; |
| | 0 | 114 | | string id = default; |
| | 0 | 115 | | string name = default; |
| | 0 | 116 | | string type = default; |
| | 0 | 117 | | string location = default; |
| | 0 | 118 | | IDictionary<string, string> tags = default; |
| | 0 | 119 | | Subnet subnet = default; |
| | 0 | 120 | | IList<NetworkInterface> networkInterfaces = default; |
| | 0 | 121 | | ProvisioningState? provisioningState = default; |
| | 0 | 122 | | IList<PrivateLinkServiceConnection> privateLinkServiceConnections = default; |
| | 0 | 123 | | IList<PrivateLinkServiceConnection> manualPrivateLinkServiceConnections = default; |
| | 0 | 124 | | IList<CustomDnsConfigPropertiesFormat> customDnsConfigs = default; |
| | 0 | 125 | | foreach (var property in element.EnumerateObject()) |
| | | 126 | | { |
| | 0 | 127 | | if (property.NameEquals("etag")) |
| | | 128 | | { |
| | 0 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 130 | | { |
| | | 131 | | continue; |
| | | 132 | | } |
| | 0 | 133 | | etag = property.Value.GetString(); |
| | 0 | 134 | | continue; |
| | | 135 | | } |
| | 0 | 136 | | if (property.NameEquals("id")) |
| | | 137 | | { |
| | 0 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 139 | | { |
| | | 140 | | continue; |
| | | 141 | | } |
| | 0 | 142 | | id = property.Value.GetString(); |
| | 0 | 143 | | continue; |
| | | 144 | | } |
| | 0 | 145 | | if (property.NameEquals("name")) |
| | | 146 | | { |
| | 0 | 147 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 148 | | { |
| | | 149 | | continue; |
| | | 150 | | } |
| | 0 | 151 | | name = property.Value.GetString(); |
| | 0 | 152 | | continue; |
| | | 153 | | } |
| | 0 | 154 | | if (property.NameEquals("type")) |
| | | 155 | | { |
| | 0 | 156 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 157 | | { |
| | | 158 | | continue; |
| | | 159 | | } |
| | 0 | 160 | | type = property.Value.GetString(); |
| | 0 | 161 | | continue; |
| | | 162 | | } |
| | 0 | 163 | | if (property.NameEquals("location")) |
| | | 164 | | { |
| | 0 | 165 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 166 | | { |
| | | 167 | | continue; |
| | | 168 | | } |
| | 0 | 169 | | location = property.Value.GetString(); |
| | 0 | 170 | | continue; |
| | | 171 | | } |
| | 0 | 172 | | if (property.NameEquals("tags")) |
| | | 173 | | { |
| | 0 | 174 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 175 | | { |
| | | 176 | | continue; |
| | | 177 | | } |
| | 0 | 178 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| | 0 | 179 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 180 | | { |
| | 0 | 181 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 182 | | { |
| | 0 | 183 | | dictionary.Add(property0.Name, null); |
| | | 184 | | } |
| | | 185 | | else |
| | | 186 | | { |
| | 0 | 187 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | | 188 | | } |
| | | 189 | | } |
| | 0 | 190 | | tags = dictionary; |
| | 0 | 191 | | continue; |
| | | 192 | | } |
| | 0 | 193 | | if (property.NameEquals("properties")) |
| | | 194 | | { |
| | 0 | 195 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 196 | | { |
| | 0 | 197 | | if (property0.NameEquals("subnet")) |
| | | 198 | | { |
| | 0 | 199 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 200 | | { |
| | | 201 | | continue; |
| | | 202 | | } |
| | 0 | 203 | | subnet = Subnet.DeserializeSubnet(property0.Value); |
| | 0 | 204 | | continue; |
| | | 205 | | } |
| | 0 | 206 | | if (property0.NameEquals("networkInterfaces")) |
| | | 207 | | { |
| | 0 | 208 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 209 | | { |
| | | 210 | | continue; |
| | | 211 | | } |
| | 0 | 212 | | List<NetworkInterface> array = new List<NetworkInterface>(); |
| | 0 | 213 | | foreach (var item in property0.Value.EnumerateArray()) |
| | | 214 | | { |
| | 0 | 215 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 216 | | { |
| | 0 | 217 | | array.Add(null); |
| | | 218 | | } |
| | | 219 | | else |
| | | 220 | | { |
| | 0 | 221 | | array.Add(NetworkInterface.DeserializeNetworkInterface(item)); |
| | | 222 | | } |
| | | 223 | | } |
| | 0 | 224 | | networkInterfaces = array; |
| | 0 | 225 | | continue; |
| | | 226 | | } |
| | 0 | 227 | | if (property0.NameEquals("provisioningState")) |
| | | 228 | | { |
| | 0 | 229 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 230 | | { |
| | | 231 | | continue; |
| | | 232 | | } |
| | 0 | 233 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 0 | 234 | | continue; |
| | | 235 | | } |
| | 0 | 236 | | if (property0.NameEquals("privateLinkServiceConnections")) |
| | | 237 | | { |
| | 0 | 238 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 239 | | { |
| | | 240 | | continue; |
| | | 241 | | } |
| | 0 | 242 | | List<PrivateLinkServiceConnection> array = new List<PrivateLinkServiceConnection>(); |
| | 0 | 243 | | foreach (var item in property0.Value.EnumerateArray()) |
| | | 244 | | { |
| | 0 | 245 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 246 | | { |
| | 0 | 247 | | array.Add(null); |
| | | 248 | | } |
| | | 249 | | else |
| | | 250 | | { |
| | 0 | 251 | | array.Add(PrivateLinkServiceConnection.DeserializePrivateLinkServiceConnection(item) |
| | | 252 | | } |
| | | 253 | | } |
| | 0 | 254 | | privateLinkServiceConnections = array; |
| | 0 | 255 | | continue; |
| | | 256 | | } |
| | 0 | 257 | | if (property0.NameEquals("manualPrivateLinkServiceConnections")) |
| | | 258 | | { |
| | 0 | 259 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 260 | | { |
| | | 261 | | continue; |
| | | 262 | | } |
| | 0 | 263 | | List<PrivateLinkServiceConnection> array = new List<PrivateLinkServiceConnection>(); |
| | 0 | 264 | | foreach (var item in property0.Value.EnumerateArray()) |
| | | 265 | | { |
| | 0 | 266 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 267 | | { |
| | 0 | 268 | | array.Add(null); |
| | | 269 | | } |
| | | 270 | | else |
| | | 271 | | { |
| | 0 | 272 | | array.Add(PrivateLinkServiceConnection.DeserializePrivateLinkServiceConnection(item) |
| | | 273 | | } |
| | | 274 | | } |
| | 0 | 275 | | manualPrivateLinkServiceConnections = array; |
| | 0 | 276 | | continue; |
| | | 277 | | } |
| | 0 | 278 | | if (property0.NameEquals("customDnsConfigs")) |
| | | 279 | | { |
| | 0 | 280 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 281 | | { |
| | | 282 | | continue; |
| | | 283 | | } |
| | 0 | 284 | | List<CustomDnsConfigPropertiesFormat> array = new List<CustomDnsConfigPropertiesFormat>(); |
| | 0 | 285 | | foreach (var item in property0.Value.EnumerateArray()) |
| | | 286 | | { |
| | 0 | 287 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 288 | | { |
| | 0 | 289 | | array.Add(null); |
| | | 290 | | } |
| | | 291 | | else |
| | | 292 | | { |
| | 0 | 293 | | array.Add(CustomDnsConfigPropertiesFormat.DeserializeCustomDnsConfigPropertiesFormat |
| | | 294 | | } |
| | | 295 | | } |
| | 0 | 296 | | customDnsConfigs = array; |
| | | 297 | | continue; |
| | | 298 | | } |
| | | 299 | | } |
| | | 300 | | continue; |
| | | 301 | | } |
| | | 302 | | } |
| | 0 | 303 | | return new PrivateEndpoint(id, name, type, location, tags, etag, subnet, networkInterfaces, provisioningStat |
| | | 304 | | } |
| | | 305 | | } |
| | | 306 | | } |