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