| | 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; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Network.Models |
| | 14 | | { |
| | 15 | | public partial class ConnectionMonitorResult |
| | 16 | | { |
| | 17 | | internal static ConnectionMonitorResult DeserializeConnectionMonitorResult(JsonElement element) |
| | 18 | | { |
| 0 | 19 | | string name = default; |
| 0 | 20 | | string id = default; |
| 0 | 21 | | string etag = default; |
| 0 | 22 | | string type = default; |
| 0 | 23 | | string location = default; |
| 0 | 24 | | IReadOnlyDictionary<string, string> tags = default; |
| 0 | 25 | | ConnectionMonitorSource source = default; |
| 0 | 26 | | ConnectionMonitorDestination destination = default; |
| 0 | 27 | | bool? autoStart = default; |
| 0 | 28 | | int? monitoringIntervalInSeconds = default; |
| 0 | 29 | | IReadOnlyList<ConnectionMonitorEndpoint> endpoints = default; |
| 0 | 30 | | IReadOnlyList<ConnectionMonitorTestConfiguration> testConfigurations = default; |
| 0 | 31 | | IReadOnlyList<ConnectionMonitorTestGroup> testGroups = default; |
| 0 | 32 | | IReadOnlyList<ConnectionMonitorOutput> outputs = default; |
| 0 | 33 | | string notes = default; |
| 0 | 34 | | ProvisioningState? provisioningState = default; |
| 0 | 35 | | DateTimeOffset? startTime = default; |
| 0 | 36 | | string monitoringStatus = default; |
| 0 | 37 | | ConnectionMonitorType? connectionMonitorType = default; |
| 0 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 0 | 40 | | if (property.NameEquals("name")) |
| | 41 | | { |
| 0 | 42 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 43 | | { |
| | 44 | | continue; |
| | 45 | | } |
| 0 | 46 | | name = property.Value.GetString(); |
| 0 | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | if (property.NameEquals("id")) |
| | 50 | | { |
| 0 | 51 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 52 | | { |
| | 53 | | continue; |
| | 54 | | } |
| 0 | 55 | | id = property.Value.GetString(); |
| 0 | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | if (property.NameEquals("etag")) |
| | 59 | | { |
| 0 | 60 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 61 | | { |
| | 62 | | continue; |
| | 63 | | } |
| 0 | 64 | | etag = property.Value.GetString(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("type")) |
| | 68 | | { |
| 0 | 69 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 70 | | { |
| | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | type = property.Value.GetString(); |
| 0 | 74 | | continue; |
| | 75 | | } |
| 0 | 76 | | if (property.NameEquals("location")) |
| | 77 | | { |
| 0 | 78 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | location = property.Value.GetString(); |
| 0 | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | if (property.NameEquals("tags")) |
| | 86 | | { |
| 0 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 92 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 93 | | { |
| 0 | 94 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 95 | | { |
| 0 | 96 | | dictionary.Add(property0.Name, null); |
| | 97 | | } |
| | 98 | | else |
| | 99 | | { |
| 0 | 100 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 101 | | } |
| | 102 | | } |
| 0 | 103 | | tags = dictionary; |
| 0 | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | if (property.NameEquals("properties")) |
| | 107 | | { |
| 0 | 108 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 109 | | { |
| 0 | 110 | | if (property0.NameEquals("source")) |
| | 111 | | { |
| 0 | 112 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 113 | | { |
| | 114 | | continue; |
| | 115 | | } |
| 0 | 116 | | source = ConnectionMonitorSource.DeserializeConnectionMonitorSource(property0.Value); |
| 0 | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | if (property0.NameEquals("destination")) |
| | 120 | | { |
| 0 | 121 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | destination = ConnectionMonitorDestination.DeserializeConnectionMonitorDestination(property0 |
| 0 | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | if (property0.NameEquals("autoStart")) |
| | 129 | | { |
| 0 | 130 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | autoStart = property0.Value.GetBoolean(); |
| 0 | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | if (property0.NameEquals("monitoringIntervalInSeconds")) |
| | 138 | | { |
| 0 | 139 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | monitoringIntervalInSeconds = property0.Value.GetInt32(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property0.NameEquals("endpoints")) |
| | 147 | | { |
| 0 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | List<ConnectionMonitorEndpoint> array = new List<ConnectionMonitorEndpoint>(); |
| 0 | 153 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 154 | | { |
| 0 | 155 | | if (item.ValueKind == JsonValueKind.Null) |
| | 156 | | { |
| 0 | 157 | | array.Add(null); |
| | 158 | | } |
| | 159 | | else |
| | 160 | | { |
| 0 | 161 | | array.Add(ConnectionMonitorEndpoint.DeserializeConnectionMonitorEndpoint(item)); |
| | 162 | | } |
| | 163 | | } |
| 0 | 164 | | endpoints = array; |
| 0 | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | if (property0.NameEquals("testConfigurations")) |
| | 168 | | { |
| 0 | 169 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 170 | | { |
| | 171 | | continue; |
| | 172 | | } |
| 0 | 173 | | List<ConnectionMonitorTestConfiguration> array = new List<ConnectionMonitorTestConfiguration |
| 0 | 174 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 175 | | { |
| 0 | 176 | | if (item.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| 0 | 178 | | array.Add(null); |
| | 179 | | } |
| | 180 | | else |
| | 181 | | { |
| 0 | 182 | | array.Add(ConnectionMonitorTestConfiguration.DeserializeConnectionMonitorTestConfigu |
| | 183 | | } |
| | 184 | | } |
| 0 | 185 | | testConfigurations = array; |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property0.NameEquals("testGroups")) |
| | 189 | | { |
| 0 | 190 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 191 | | { |
| | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | List<ConnectionMonitorTestGroup> array = new List<ConnectionMonitorTestGroup>(); |
| 0 | 195 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 196 | | { |
| 0 | 197 | | if (item.ValueKind == JsonValueKind.Null) |
| | 198 | | { |
| 0 | 199 | | array.Add(null); |
| | 200 | | } |
| | 201 | | else |
| | 202 | | { |
| 0 | 203 | | array.Add(ConnectionMonitorTestGroup.DeserializeConnectionMonitorTestGroup(item)); |
| | 204 | | } |
| | 205 | | } |
| 0 | 206 | | testGroups = array; |
| 0 | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | if (property0.NameEquals("outputs")) |
| | 210 | | { |
| 0 | 211 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 0 | 215 | | List<ConnectionMonitorOutput> array = new List<ConnectionMonitorOutput>(); |
| 0 | 216 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 217 | | { |
| 0 | 218 | | if (item.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| 0 | 220 | | array.Add(null); |
| | 221 | | } |
| | 222 | | else |
| | 223 | | { |
| 0 | 224 | | array.Add(ConnectionMonitorOutput.DeserializeConnectionMonitorOutput(item)); |
| | 225 | | } |
| | 226 | | } |
| 0 | 227 | | outputs = array; |
| 0 | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | if (property0.NameEquals("notes")) |
| | 231 | | { |
| 0 | 232 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| | 234 | | continue; |
| | 235 | | } |
| 0 | 236 | | notes = property0.Value.GetString(); |
| 0 | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | if (property0.NameEquals("provisioningState")) |
| | 240 | | { |
| 0 | 241 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| | 243 | | continue; |
| | 244 | | } |
| 0 | 245 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | if (property0.NameEquals("startTime")) |
| | 249 | | { |
| 0 | 250 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 251 | | { |
| | 252 | | continue; |
| | 253 | | } |
| 0 | 254 | | startTime = property0.Value.GetDateTimeOffset("O"); |
| 0 | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | if (property0.NameEquals("monitoringStatus")) |
| | 258 | | { |
| 0 | 259 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 260 | | { |
| | 261 | | continue; |
| | 262 | | } |
| 0 | 263 | | monitoringStatus = property0.Value.GetString(); |
| 0 | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | if (property0.NameEquals("connectionMonitorType")) |
| | 267 | | { |
| 0 | 268 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 269 | | { |
| | 270 | | continue; |
| | 271 | | } |
| 0 | 272 | | connectionMonitorType = new ConnectionMonitorType(property0.Value.GetString()); |
| | 273 | | continue; |
| | 274 | | } |
| | 275 | | } |
| | 276 | | continue; |
| | 277 | | } |
| | 278 | | } |
| 0 | 279 | | return new ConnectionMonitorResult(name, id, etag, type, location, tags, source, destination, autoStart, mon |
| | 280 | | } |
| | 281 | | } |
| | 282 | | } |