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