| | 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 NetworkProfile : 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 (ContainerNetworkInterfaces != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("containerNetworkInterfaces"); |
| 0 | 60 | | writer.WriteStartArray(); |
| 0 | 61 | | foreach (var item in ContainerNetworkInterfaces) |
| | 62 | | { |
| 0 | 63 | | writer.WriteObjectValue(item); |
| | 64 | | } |
| 0 | 65 | | writer.WriteEndArray(); |
| | 66 | | } |
| 0 | 67 | | if (ContainerNetworkInterfaceConfigurations != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("containerNetworkInterfaceConfigurations"); |
| 0 | 70 | | writer.WriteStartArray(); |
| 0 | 71 | | foreach (var item in ContainerNetworkInterfaceConfigurations) |
| | 72 | | { |
| 0 | 73 | | writer.WriteObjectValue(item); |
| | 74 | | } |
| 0 | 75 | | writer.WriteEndArray(); |
| | 76 | | } |
| 0 | 77 | | if (ResourceGuid != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("resourceGuid"); |
| 0 | 80 | | writer.WriteStringValue(ResourceGuid); |
| | 81 | | } |
| 0 | 82 | | if (ProvisioningState != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("provisioningState"); |
| 0 | 85 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 86 | | } |
| 0 | 87 | | writer.WriteEndObject(); |
| 0 | 88 | | writer.WriteEndObject(); |
| 0 | 89 | | } |
| | 90 | |
|
| | 91 | | internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) |
| | 92 | | { |
| 0 | 93 | | string etag = default; |
| 0 | 94 | | string id = default; |
| 0 | 95 | | string name = default; |
| 0 | 96 | | string type = default; |
| 0 | 97 | | string location = default; |
| 0 | 98 | | IDictionary<string, string> tags = default; |
| 0 | 99 | | IList<ContainerNetworkInterface> containerNetworkInterfaces = default; |
| 0 | 100 | | IList<ContainerNetworkInterfaceConfiguration> containerNetworkInterfaceConfigurations = default; |
| 0 | 101 | | string resourceGuid = default; |
| 0 | 102 | | ProvisioningState? provisioningState = default; |
| 0 | 103 | | foreach (var property in element.EnumerateObject()) |
| | 104 | | { |
| 0 | 105 | | if (property.NameEquals("etag")) |
| | 106 | | { |
| 0 | 107 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 108 | | { |
| | 109 | | continue; |
| | 110 | | } |
| 0 | 111 | | etag = property.Value.GetString(); |
| 0 | 112 | | continue; |
| | 113 | | } |
| 0 | 114 | | if (property.NameEquals("id")) |
| | 115 | | { |
| 0 | 116 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 117 | | { |
| | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | id = property.Value.GetString(); |
| 0 | 121 | | continue; |
| | 122 | | } |
| 0 | 123 | | if (property.NameEquals("name")) |
| | 124 | | { |
| 0 | 125 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| | 127 | | continue; |
| | 128 | | } |
| 0 | 129 | | name = property.Value.GetString(); |
| 0 | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | if (property.NameEquals("type")) |
| | 133 | | { |
| 0 | 134 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | type = property.Value.GetString(); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("location")) |
| | 142 | | { |
| 0 | 143 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 144 | | { |
| | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | location = property.Value.GetString(); |
| 0 | 148 | | continue; |
| | 149 | | } |
| 0 | 150 | | if (property.NameEquals("tags")) |
| | 151 | | { |
| 0 | 152 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 153 | | { |
| | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 157 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 158 | | { |
| 0 | 159 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 160 | | { |
| 0 | 161 | | dictionary.Add(property0.Name, null); |
| | 162 | | } |
| | 163 | | else |
| | 164 | | { |
| 0 | 165 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 166 | | } |
| | 167 | | } |
| 0 | 168 | | tags = dictionary; |
| 0 | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | if (property.NameEquals("properties")) |
| | 172 | | { |
| 0 | 173 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 174 | | { |
| 0 | 175 | | if (property0.NameEquals("containerNetworkInterfaces")) |
| | 176 | | { |
| 0 | 177 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 178 | | { |
| | 179 | | continue; |
| | 180 | | } |
| 0 | 181 | | List<ContainerNetworkInterface> array = new List<ContainerNetworkInterface>(); |
| 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(ContainerNetworkInterface.DeserializeContainerNetworkInterface(item)); |
| | 191 | | } |
| | 192 | | } |
| 0 | 193 | | containerNetworkInterfaces = array; |
| 0 | 194 | | continue; |
| | 195 | | } |
| 0 | 196 | | if (property0.NameEquals("containerNetworkInterfaceConfigurations")) |
| | 197 | | { |
| 0 | 198 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 199 | | { |
| | 200 | | continue; |
| | 201 | | } |
| 0 | 202 | | List<ContainerNetworkInterfaceConfiguration> array = new List<ContainerNetworkInterfaceConfi |
| 0 | 203 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 204 | | { |
| 0 | 205 | | if (item.ValueKind == JsonValueKind.Null) |
| | 206 | | { |
| 0 | 207 | | array.Add(null); |
| | 208 | | } |
| | 209 | | else |
| | 210 | | { |
| 0 | 211 | | array.Add(ContainerNetworkInterfaceConfiguration.DeserializeContainerNetworkInterfac |
| | 212 | | } |
| | 213 | | } |
| 0 | 214 | | containerNetworkInterfaceConfigurations = array; |
| 0 | 215 | | continue; |
| | 216 | | } |
| 0 | 217 | | if (property0.NameEquals("resourceGuid")) |
| | 218 | | { |
| 0 | 219 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 220 | | { |
| | 221 | | continue; |
| | 222 | | } |
| 0 | 223 | | resourceGuid = property0.Value.GetString(); |
| 0 | 224 | | continue; |
| | 225 | | } |
| 0 | 226 | | if (property0.NameEquals("provisioningState")) |
| | 227 | | { |
| 0 | 228 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 229 | | { |
| | 230 | | continue; |
| | 231 | | } |
| 0 | 232 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 233 | | continue; |
| | 234 | | } |
| | 235 | | } |
| | 236 | | continue; |
| | 237 | | } |
| | 238 | | } |
| 0 | 239 | | return new NetworkProfile(id, name, type, location, tags, etag, containerNetworkInterfaces, containerNetwork |
| | 240 | | } |
| | 241 | | } |
| | 242 | | } |