| | 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 ExpressRouteLink : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Name != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 0 | 23 | | if (Etag != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("etag"); |
| 0 | 26 | | writer.WriteStringValue(Etag); |
| | 27 | | } |
| 0 | 28 | | if (Id != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("id"); |
| 0 | 31 | | writer.WriteStringValue(Id); |
| | 32 | | } |
| 0 | 33 | | writer.WritePropertyName("properties"); |
| 0 | 34 | | writer.WriteStartObject(); |
| 0 | 35 | | if (RouterName != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("routerName"); |
| 0 | 38 | | writer.WriteStringValue(RouterName); |
| | 39 | | } |
| 0 | 40 | | if (InterfaceName != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("interfaceName"); |
| 0 | 43 | | writer.WriteStringValue(InterfaceName); |
| | 44 | | } |
| 0 | 45 | | if (PatchPanelId != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("patchPanelId"); |
| 0 | 48 | | writer.WriteStringValue(PatchPanelId); |
| | 49 | | } |
| 0 | 50 | | if (RackId != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("rackId"); |
| 0 | 53 | | writer.WriteStringValue(RackId); |
| | 54 | | } |
| 0 | 55 | | if (ConnectorType != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("connectorType"); |
| 0 | 58 | | writer.WriteStringValue(ConnectorType.Value.ToString()); |
| | 59 | | } |
| 0 | 60 | | if (AdminState != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("adminState"); |
| 0 | 63 | | writer.WriteStringValue(AdminState.Value.ToString()); |
| | 64 | | } |
| 0 | 65 | | if (ProvisioningState != null) |
| | 66 | | { |
| 0 | 67 | | writer.WritePropertyName("provisioningState"); |
| 0 | 68 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 69 | | } |
| 0 | 70 | | if (MacSecConfig != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("macSecConfig"); |
| 0 | 73 | | writer.WriteObjectValue(MacSecConfig); |
| | 74 | | } |
| 0 | 75 | | writer.WriteEndObject(); |
| 0 | 76 | | writer.WriteEndObject(); |
| 0 | 77 | | } |
| | 78 | |
|
| | 79 | | internal static ExpressRouteLink DeserializeExpressRouteLink(JsonElement element) |
| | 80 | | { |
| 0 | 81 | | string name = default; |
| 0 | 82 | | string etag = default; |
| 0 | 83 | | string id = default; |
| 0 | 84 | | string routerName = default; |
| 0 | 85 | | string interfaceName = default; |
| 0 | 86 | | string patchPanelId = default; |
| 0 | 87 | | string rackId = default; |
| 0 | 88 | | ExpressRouteLinkConnectorType? connectorType = default; |
| 0 | 89 | | ExpressRouteLinkAdminState? adminState = default; |
| 0 | 90 | | ProvisioningState? provisioningState = default; |
| 0 | 91 | | ExpressRouteLinkMacSecConfig macSecConfig = default; |
| 0 | 92 | | foreach (var property in element.EnumerateObject()) |
| | 93 | | { |
| 0 | 94 | | if (property.NameEquals("name")) |
| | 95 | | { |
| 0 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 97 | | { |
| | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | name = property.Value.GetString(); |
| 0 | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | if (property.NameEquals("etag")) |
| | 104 | | { |
| 0 | 105 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | etag = property.Value.GetString(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property.NameEquals("id")) |
| | 113 | | { |
| 0 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | id = property.Value.GetString(); |
| 0 | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | if (property.NameEquals("properties")) |
| | 122 | | { |
| 0 | 123 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 124 | | { |
| 0 | 125 | | if (property0.NameEquals("routerName")) |
| | 126 | | { |
| 0 | 127 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | routerName = property0.Value.GetString(); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property0.NameEquals("interfaceName")) |
| | 135 | | { |
| 0 | 136 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | interfaceName = property0.Value.GetString(); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property0.NameEquals("patchPanelId")) |
| | 144 | | { |
| 0 | 145 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | patchPanelId = property0.Value.GetString(); |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property0.NameEquals("rackId")) |
| | 153 | | { |
| 0 | 154 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | rackId = property0.Value.GetString(); |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property0.NameEquals("connectorType")) |
| | 162 | | { |
| 0 | 163 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | connectorType = new ExpressRouteLinkConnectorType(property0.Value.GetString()); |
| 0 | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | if (property0.NameEquals("adminState")) |
| | 171 | | { |
| 0 | 172 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | adminState = new ExpressRouteLinkAdminState(property0.Value.GetString()); |
| 0 | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | if (property0.NameEquals("provisioningState")) |
| | 180 | | { |
| 0 | 181 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 182 | | { |
| | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property0.NameEquals("macSecConfig")) |
| | 189 | | { |
| 0 | 190 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 191 | | { |
| | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | macSecConfig = ExpressRouteLinkMacSecConfig.DeserializeExpressRouteLinkMacSecConfig(property |
| | 195 | | continue; |
| | 196 | | } |
| | 197 | | } |
| | 198 | | continue; |
| | 199 | | } |
| | 200 | | } |
| 0 | 201 | | return new ExpressRouteLink(id, name, etag, routerName, interfaceName, patchPanelId, rackId, connectorType, |
| | 202 | | } |
| | 203 | | } |
| | 204 | | } |