| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Network.Models |
| | 12 | | { |
| | 13 | | public partial class VpnSiteLink : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Etag != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("etag"); |
| 0 | 21 | | writer.WriteStringValue(Etag); |
| | 22 | | } |
| 0 | 23 | | if (Name != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("name"); |
| 0 | 26 | | writer.WriteStringValue(Name); |
| | 27 | | } |
| 0 | 28 | | if (Type != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("type"); |
| 0 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 0 | 33 | | if (Id != null) |
| | 34 | | { |
| 0 | 35 | | writer.WritePropertyName("id"); |
| 0 | 36 | | writer.WriteStringValue(Id); |
| | 37 | | } |
| 0 | 38 | | writer.WritePropertyName("properties"); |
| 0 | 39 | | writer.WriteStartObject(); |
| 0 | 40 | | if (LinkProperties != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("linkProperties"); |
| 0 | 43 | | writer.WriteObjectValue(LinkProperties); |
| | 44 | | } |
| 0 | 45 | | if (IpAddress != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("ipAddress"); |
| 0 | 48 | | writer.WriteStringValue(IpAddress); |
| | 49 | | } |
| 0 | 50 | | if (Fqdn != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("fqdn"); |
| 0 | 53 | | writer.WriteStringValue(Fqdn); |
| | 54 | | } |
| 0 | 55 | | if (BgpProperties != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("bgpProperties"); |
| 0 | 58 | | writer.WriteObjectValue(BgpProperties); |
| | 59 | | } |
| 0 | 60 | | if (ProvisioningState != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("provisioningState"); |
| 0 | 63 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 64 | | } |
| 0 | 65 | | writer.WriteEndObject(); |
| 0 | 66 | | writer.WriteEndObject(); |
| 0 | 67 | | } |
| | 68 | |
|
| | 69 | | internal static VpnSiteLink DeserializeVpnSiteLink(JsonElement element) |
| | 70 | | { |
| 0 | 71 | | string etag = default; |
| 0 | 72 | | string name = default; |
| 0 | 73 | | string type = default; |
| 0 | 74 | | string id = default; |
| 0 | 75 | | VpnLinkProviderProperties linkProperties = default; |
| 0 | 76 | | string ipAddress = default; |
| 0 | 77 | | string fqdn = default; |
| 0 | 78 | | VpnLinkBgpSettings bgpProperties = default; |
| 0 | 79 | | ProvisioningState? provisioningState = default; |
| 0 | 80 | | foreach (var property in element.EnumerateObject()) |
| | 81 | | { |
| 0 | 82 | | if (property.NameEquals("etag")) |
| | 83 | | { |
| 0 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 0 | 88 | | etag = property.Value.GetString(); |
| 0 | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | if (property.NameEquals("name")) |
| | 92 | | { |
| 0 | 93 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | name = property.Value.GetString(); |
| 0 | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | if (property.NameEquals("type")) |
| | 101 | | { |
| 0 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | type = property.Value.GetString(); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("id")) |
| | 110 | | { |
| 0 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | id = property.Value.GetString(); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property.NameEquals("properties")) |
| | 119 | | { |
| 0 | 120 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 121 | | { |
| 0 | 122 | | if (property0.NameEquals("linkProperties")) |
| | 123 | | { |
| 0 | 124 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | linkProperties = VpnLinkProviderProperties.DeserializeVpnLinkProviderProperties(property0.Va |
| 0 | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | if (property0.NameEquals("ipAddress")) |
| | 132 | | { |
| 0 | 133 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 134 | | { |
| | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | ipAddress = property0.Value.GetString(); |
| 0 | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | if (property0.NameEquals("fqdn")) |
| | 141 | | { |
| 0 | 142 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 143 | | { |
| | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | fqdn = property0.Value.GetString(); |
| 0 | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | if (property0.NameEquals("bgpProperties")) |
| | 150 | | { |
| 0 | 151 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 152 | | { |
| | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | bgpProperties = VpnLinkBgpSettings.DeserializeVpnLinkBgpSettings(property0.Value); |
| 0 | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | if (property0.NameEquals("provisioningState")) |
| | 159 | | { |
| 0 | 160 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 161 | | { |
| | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 165 | | continue; |
| | 166 | | } |
| | 167 | | } |
| | 168 | | continue; |
| | 169 | | } |
| | 170 | | } |
| 0 | 171 | | return new VpnSiteLink(id, etag, name, type, linkProperties, ipAddress, fqdn, bgpProperties, provisioningSta |
| | 172 | | } |
| | 173 | | } |
| | 174 | | } |