| | | 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.Text.Json; |
| | | 9 | | using Azure.Core; |
| | | 10 | | |
| | | 11 | | namespace Azure.ResourceManager.Network.Models |
| | | 12 | | { |
| | | 13 | | public partial class VpnClientRootCertificate : IUtf8JsonSerializable |
| | | 14 | | { |
| | | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 16 | | { |
| | 0 | 17 | | writer.WriteStartObject(); |
| | 0 | 18 | | if (Name != null) |
| | | 19 | | { |
| | 0 | 20 | | writer.WritePropertyName("name"); |
| | 0 | 21 | | writer.WriteStringValue(Name); |
| | | 22 | | } |
| | 0 | 23 | | if (Etag != null) |
| | | 24 | | { |
| | 0 | 25 | | writer.WritePropertyName("etag"); |
| | 0 | 26 | | writer.WriteStringValue(Etag); |
| | | 27 | | } |
| | 0 | 28 | | if (Id != null) |
| | | 29 | | { |
| | 0 | 30 | | writer.WritePropertyName("id"); |
| | 0 | 31 | | writer.WriteStringValue(Id); |
| | | 32 | | } |
| | 0 | 33 | | writer.WritePropertyName("properties"); |
| | 0 | 34 | | writer.WriteStartObject(); |
| | 0 | 35 | | writer.WritePropertyName("publicCertData"); |
| | 0 | 36 | | writer.WriteStringValue(PublicCertData); |
| | 0 | 37 | | if (ProvisioningState != null) |
| | | 38 | | { |
| | 0 | 39 | | writer.WritePropertyName("provisioningState"); |
| | 0 | 40 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | | 41 | | } |
| | 0 | 42 | | writer.WriteEndObject(); |
| | 0 | 43 | | writer.WriteEndObject(); |
| | 0 | 44 | | } |
| | | 45 | | |
| | | 46 | | internal static VpnClientRootCertificate DeserializeVpnClientRootCertificate(JsonElement element) |
| | | 47 | | { |
| | 0 | 48 | | string name = default; |
| | 0 | 49 | | string etag = default; |
| | 0 | 50 | | string id = default; |
| | 0 | 51 | | string publicCertData = default; |
| | 0 | 52 | | ProvisioningState? provisioningState = default; |
| | 0 | 53 | | foreach (var property in element.EnumerateObject()) |
| | | 54 | | { |
| | 0 | 55 | | if (property.NameEquals("name")) |
| | | 56 | | { |
| | 0 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 58 | | { |
| | | 59 | | continue; |
| | | 60 | | } |
| | 0 | 61 | | name = property.Value.GetString(); |
| | 0 | 62 | | continue; |
| | | 63 | | } |
| | 0 | 64 | | if (property.NameEquals("etag")) |
| | | 65 | | { |
| | 0 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 67 | | { |
| | | 68 | | continue; |
| | | 69 | | } |
| | 0 | 70 | | etag = property.Value.GetString(); |
| | 0 | 71 | | continue; |
| | | 72 | | } |
| | 0 | 73 | | if (property.NameEquals("id")) |
| | | 74 | | { |
| | 0 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 76 | | { |
| | | 77 | | continue; |
| | | 78 | | } |
| | 0 | 79 | | id = property.Value.GetString(); |
| | 0 | 80 | | continue; |
| | | 81 | | } |
| | 0 | 82 | | if (property.NameEquals("properties")) |
| | | 83 | | { |
| | 0 | 84 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 85 | | { |
| | 0 | 86 | | if (property0.NameEquals("publicCertData")) |
| | | 87 | | { |
| | 0 | 88 | | publicCertData = property0.Value.GetString(); |
| | 0 | 89 | | continue; |
| | | 90 | | } |
| | 0 | 91 | | if (property0.NameEquals("provisioningState")) |
| | | 92 | | { |
| | 0 | 93 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 94 | | { |
| | | 95 | | continue; |
| | | 96 | | } |
| | 0 | 97 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | | 98 | | continue; |
| | | 99 | | } |
| | | 100 | | } |
| | | 101 | | continue; |
| | | 102 | | } |
| | | 103 | | } |
| | 0 | 104 | | return new VpnClientRootCertificate(id, name, etag, publicCertData, provisioningState); |
| | | 105 | | } |
| | | 106 | | } |
| | | 107 | | } |