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