| | 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 ConnectionMonitorHttpConfiguration : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Port != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("port"); |
| 0 | 22 | | writer.WriteNumberValue(Port.Value); |
| | 23 | | } |
| 0 | 24 | | if (Method != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("method"); |
| 0 | 27 | | writer.WriteStringValue(Method.Value.ToString()); |
| | 28 | | } |
| 0 | 29 | | if (Path != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("path"); |
| 0 | 32 | | writer.WriteStringValue(Path); |
| | 33 | | } |
| 0 | 34 | | if (RequestHeaders != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("requestHeaders"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in RequestHeaders) |
| | 39 | | { |
| 0 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 0 | 44 | | if (ValidStatusCodeRanges != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("validStatusCodeRanges"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in ValidStatusCodeRanges) |
| | 49 | | { |
| 0 | 50 | | writer.WriteStringValue(item); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | if (PreferHttps != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("preferHTTPS"); |
| 0 | 57 | | writer.WriteBooleanValue(PreferHttps.Value); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndObject(); |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | internal static ConnectionMonitorHttpConfiguration DeserializeConnectionMonitorHttpConfiguration(JsonElement ele |
| | 63 | | { |
| 0 | 64 | | int? port = default; |
| 0 | 65 | | HttpConfigurationMethod? method = default; |
| 0 | 66 | | string path = default; |
| 0 | 67 | | IList<HttpHeader> requestHeaders = default; |
| 0 | 68 | | IList<string> validStatusCodeRanges = default; |
| 0 | 69 | | bool? preferHTTPS = default; |
| 0 | 70 | | foreach (var property in element.EnumerateObject()) |
| | 71 | | { |
| 0 | 72 | | if (property.NameEquals("port")) |
| | 73 | | { |
| 0 | 74 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | port = property.Value.GetInt32(); |
| 0 | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | if (property.NameEquals("method")) |
| | 82 | | { |
| 0 | 83 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 84 | | { |
| | 85 | | continue; |
| | 86 | | } |
| 0 | 87 | | method = new HttpConfigurationMethod(property.Value.GetString()); |
| 0 | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | if (property.NameEquals("path")) |
| | 91 | | { |
| 0 | 92 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 93 | | { |
| | 94 | | continue; |
| | 95 | | } |
| 0 | 96 | | path = property.Value.GetString(); |
| 0 | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | if (property.NameEquals("requestHeaders")) |
| | 100 | | { |
| 0 | 101 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 102 | | { |
| | 103 | | continue; |
| | 104 | | } |
| 0 | 105 | | List<HttpHeader> array = new List<HttpHeader>(); |
| 0 | 106 | | foreach (var item in property.Value.EnumerateArray()) |
| | 107 | | { |
| 0 | 108 | | if (item.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| 0 | 110 | | array.Add(null); |
| | 111 | | } |
| | 112 | | else |
| | 113 | | { |
| 0 | 114 | | array.Add(HttpHeader.DeserializeHttpHeader(item)); |
| | 115 | | } |
| | 116 | | } |
| 0 | 117 | | requestHeaders = array; |
| 0 | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | if (property.NameEquals("validStatusCodeRanges")) |
| | 121 | | { |
| 0 | 122 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| | 124 | | continue; |
| | 125 | | } |
| 0 | 126 | | List<string> array = new List<string>(); |
| 0 | 127 | | foreach (var item in property.Value.EnumerateArray()) |
| | 128 | | { |
| 0 | 129 | | if (item.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| 0 | 131 | | array.Add(null); |
| | 132 | | } |
| | 133 | | else |
| | 134 | | { |
| 0 | 135 | | array.Add(item.GetString()); |
| | 136 | | } |
| | 137 | | } |
| 0 | 138 | | validStatusCodeRanges = array; |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("preferHTTPS")) |
| | 142 | | { |
| 0 | 143 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 144 | | { |
| | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | preferHTTPS = property.Value.GetBoolean(); |
| | 148 | | continue; |
| | 149 | | } |
| | 150 | | } |
| 0 | 151 | | return new ConnectionMonitorHttpConfiguration(port, method, path, requestHeaders, validStatusCodeRanges, pre |
| | 152 | | } |
| | 153 | | } |
| | 154 | | } |