| | | 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.AppConfiguration.Models |
| | | 14 | | { |
| | | 15 | | public partial class ConfigurationStore : IUtf8JsonSerializable |
| | | 16 | | { |
| | | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 18 | | { |
| | 16 | 19 | | writer.WriteStartObject(); |
| | 16 | 20 | | if (Identity != null) |
| | | 21 | | { |
| | 0 | 22 | | writer.WritePropertyName("identity"); |
| | 0 | 23 | | writer.WriteObjectValue(Identity); |
| | | 24 | | } |
| | 16 | 25 | | writer.WritePropertyName("sku"); |
| | 16 | 26 | | writer.WriteObjectValue(Sku); |
| | 16 | 27 | | if (Id != null) |
| | | 28 | | { |
| | 0 | 29 | | writer.WritePropertyName("id"); |
| | 0 | 30 | | writer.WriteStringValue(Id); |
| | | 31 | | } |
| | 16 | 32 | | if (Name != null) |
| | | 33 | | { |
| | 0 | 34 | | writer.WritePropertyName("name"); |
| | 0 | 35 | | writer.WriteStringValue(Name); |
| | | 36 | | } |
| | 16 | 37 | | if (Type != null) |
| | | 38 | | { |
| | 0 | 39 | | writer.WritePropertyName("type"); |
| | 0 | 40 | | writer.WriteStringValue(Type); |
| | | 41 | | } |
| | 16 | 42 | | writer.WritePropertyName("location"); |
| | 16 | 43 | | writer.WriteStringValue(Location); |
| | 16 | 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 | | } |
| | 16 | 55 | | writer.WritePropertyName("properties"); |
| | 16 | 56 | | writer.WriteStartObject(); |
| | 16 | 57 | | if (ProvisioningState != null) |
| | | 58 | | { |
| | 0 | 59 | | writer.WritePropertyName("provisioningState"); |
| | 0 | 60 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | | 61 | | } |
| | 16 | 62 | | if (CreationDate != null) |
| | | 63 | | { |
| | 0 | 64 | | writer.WritePropertyName("creationDate"); |
| | 0 | 65 | | writer.WriteStringValue(CreationDate.Value, "O"); |
| | | 66 | | } |
| | 16 | 67 | | if (Endpoint != null) |
| | | 68 | | { |
| | 0 | 69 | | writer.WritePropertyName("endpoint"); |
| | 0 | 70 | | writer.WriteStringValue(Endpoint); |
| | | 71 | | } |
| | 16 | 72 | | if (Encryption != null) |
| | | 73 | | { |
| | 0 | 74 | | writer.WritePropertyName("encryption"); |
| | 0 | 75 | | writer.WriteObjectValue(Encryption); |
| | | 76 | | } |
| | 16 | 77 | | if (PrivateEndpointConnections != null) |
| | | 78 | | { |
| | 0 | 79 | | writer.WritePropertyName("privateEndpointConnections"); |
| | 0 | 80 | | writer.WriteStartArray(); |
| | 0 | 81 | | foreach (var item in PrivateEndpointConnections) |
| | | 82 | | { |
| | 0 | 83 | | writer.WriteObjectValue(item); |
| | | 84 | | } |
| | 0 | 85 | | writer.WriteEndArray(); |
| | | 86 | | } |
| | 16 | 87 | | if (PublicNetworkAccess != null) |
| | | 88 | | { |
| | 0 | 89 | | writer.WritePropertyName("publicNetworkAccess"); |
| | 0 | 90 | | writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); |
| | | 91 | | } |
| | 16 | 92 | | writer.WriteEndObject(); |
| | 16 | 93 | | writer.WriteEndObject(); |
| | 16 | 94 | | } |
| | | 95 | | |
| | | 96 | | internal static ConfigurationStore DeserializeConfigurationStore(JsonElement element) |
| | | 97 | | { |
| | 24 | 98 | | ResourceIdentity identity = default; |
| | 24 | 99 | | Sku sku = default; |
| | 24 | 100 | | string id = default; |
| | 24 | 101 | | string name = default; |
| | 24 | 102 | | string type = default; |
| | 24 | 103 | | string location = default; |
| | 24 | 104 | | IDictionary<string, string> tags = default; |
| | 24 | 105 | | ProvisioningState? provisioningState = default; |
| | 24 | 106 | | DateTimeOffset? creationDate = default; |
| | 24 | 107 | | string endpoint = default; |
| | 24 | 108 | | EncryptionProperties encryption = default; |
| | 24 | 109 | | IList<PrivateEndpointConnectionReference> privateEndpointConnections = default; |
| | 24 | 110 | | PublicNetworkAccess? publicNetworkAccess = default; |
| | 384 | 111 | | foreach (var property in element.EnumerateObject()) |
| | | 112 | | { |
| | 168 | 113 | | if (property.NameEquals("identity")) |
| | | 114 | | { |
| | 0 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 116 | | { |
| | | 117 | | continue; |
| | | 118 | | } |
| | 0 | 119 | | identity = ResourceIdentity.DeserializeResourceIdentity(property.Value); |
| | 0 | 120 | | continue; |
| | | 121 | | } |
| | 168 | 122 | | if (property.NameEquals("sku")) |
| | | 123 | | { |
| | 24 | 124 | | sku = Sku.DeserializeSku(property.Value); |
| | 24 | 125 | | continue; |
| | | 126 | | } |
| | 144 | 127 | | if (property.NameEquals("id")) |
| | | 128 | | { |
| | 24 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 130 | | { |
| | | 131 | | continue; |
| | | 132 | | } |
| | 24 | 133 | | id = property.Value.GetString(); |
| | 24 | 134 | | continue; |
| | | 135 | | } |
| | 120 | 136 | | if (property.NameEquals("name")) |
| | | 137 | | { |
| | 24 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 139 | | { |
| | | 140 | | continue; |
| | | 141 | | } |
| | 24 | 142 | | name = property.Value.GetString(); |
| | 24 | 143 | | continue; |
| | | 144 | | } |
| | 96 | 145 | | if (property.NameEquals("type")) |
| | | 146 | | { |
| | 24 | 147 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 148 | | { |
| | | 149 | | continue; |
| | | 150 | | } |
| | 24 | 151 | | type = property.Value.GetString(); |
| | 24 | 152 | | continue; |
| | | 153 | | } |
| | 72 | 154 | | if (property.NameEquals("location")) |
| | | 155 | | { |
| | 24 | 156 | | location = property.Value.GetString(); |
| | 24 | 157 | | continue; |
| | | 158 | | } |
| | 48 | 159 | | if (property.NameEquals("tags")) |
| | | 160 | | { |
| | 24 | 161 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 162 | | { |
| | | 163 | | continue; |
| | | 164 | | } |
| | 24 | 165 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| | 56 | 166 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 167 | | { |
| | 4 | 168 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 169 | | { |
| | 0 | 170 | | dictionary.Add(property0.Name, null); |
| | | 171 | | } |
| | | 172 | | else |
| | | 173 | | { |
| | 4 | 174 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | | 175 | | } |
| | | 176 | | } |
| | 24 | 177 | | tags = dictionary; |
| | 24 | 178 | | continue; |
| | | 179 | | } |
| | 24 | 180 | | if (property.NameEquals("properties")) |
| | | 181 | | { |
| | 288 | 182 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 183 | | { |
| | 120 | 184 | | if (property0.NameEquals("provisioningState")) |
| | | 185 | | { |
| | 24 | 186 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 187 | | { |
| | | 188 | | continue; |
| | | 189 | | } |
| | 24 | 190 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 24 | 191 | | continue; |
| | | 192 | | } |
| | 96 | 193 | | if (property0.NameEquals("creationDate")) |
| | | 194 | | { |
| | 24 | 195 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 196 | | { |
| | | 197 | | continue; |
| | | 198 | | } |
| | 24 | 199 | | creationDate = property0.Value.GetDateTimeOffset("O"); |
| | 24 | 200 | | continue; |
| | | 201 | | } |
| | 72 | 202 | | if (property0.NameEquals("endpoint")) |
| | | 203 | | { |
| | 24 | 204 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 205 | | { |
| | | 206 | | continue; |
| | | 207 | | } |
| | 24 | 208 | | endpoint = property0.Value.GetString(); |
| | 24 | 209 | | continue; |
| | | 210 | | } |
| | 48 | 211 | | if (property0.NameEquals("encryption")) |
| | | 212 | | { |
| | 24 | 213 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 214 | | { |
| | | 215 | | continue; |
| | | 216 | | } |
| | 24 | 217 | | encryption = EncryptionProperties.DeserializeEncryptionProperties(property0.Value); |
| | 24 | 218 | | continue; |
| | | 219 | | } |
| | 24 | 220 | | if (property0.NameEquals("privateEndpointConnections")) |
| | | 221 | | { |
| | 24 | 222 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 223 | | { |
| | | 224 | | continue; |
| | | 225 | | } |
| | 16 | 226 | | List<PrivateEndpointConnectionReference> array = new List<PrivateEndpointConnectionReference |
| | 64 | 227 | | foreach (var item in property0.Value.EnumerateArray()) |
| | | 228 | | { |
| | 16 | 229 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 230 | | { |
| | 0 | 231 | | array.Add(null); |
| | | 232 | | } |
| | | 233 | | else |
| | | 234 | | { |
| | 16 | 235 | | array.Add(PrivateEndpointConnectionReference.DeserializePrivateEndpointConnectionRef |
| | | 236 | | } |
| | | 237 | | } |
| | 16 | 238 | | privateEndpointConnections = array; |
| | 16 | 239 | | continue; |
| | | 240 | | } |
| | 0 | 241 | | if (property0.NameEquals("publicNetworkAccess")) |
| | | 242 | | { |
| | 0 | 243 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 244 | | { |
| | | 245 | | continue; |
| | | 246 | | } |
| | 0 | 247 | | publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); |
| | | 248 | | continue; |
| | | 249 | | } |
| | | 250 | | } |
| | | 251 | | continue; |
| | | 252 | | } |
| | | 253 | | } |
| | 24 | 254 | | return new ConfigurationStore(id, name, type, location, tags, identity, sku, provisioningState, creationDate |
| | | 255 | | } |
| | | 256 | | } |
| | | 257 | | } |