| | 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.AppConfiguration.Models |
| | 12 | | { |
| | 13 | | public partial class PrivateEndpointConnection : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 8 | 17 | | writer.WriteStartObject(); |
| 8 | 18 | | if (Id != null) |
| | 19 | | { |
| 8 | 20 | | writer.WritePropertyName("id"); |
| 8 | 21 | | writer.WriteStringValue(Id); |
| | 22 | | } |
| 8 | 23 | | if (Name != null) |
| | 24 | | { |
| 8 | 25 | | writer.WritePropertyName("name"); |
| 8 | 26 | | writer.WriteStringValue(Name); |
| | 27 | | } |
| 8 | 28 | | if (Type != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("type"); |
| 0 | 31 | | writer.WriteStringValue(Type); |
| | 32 | | } |
| 8 | 33 | | writer.WritePropertyName("properties"); |
| 8 | 34 | | writer.WriteStartObject(); |
| 8 | 35 | | if (ProvisioningState != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("provisioningState"); |
| 0 | 38 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 39 | | } |
| 8 | 40 | | if (PrivateEndpoint != null) |
| | 41 | | { |
| 8 | 42 | | writer.WritePropertyName("privateEndpoint"); |
| 8 | 43 | | writer.WriteObjectValue(PrivateEndpoint); |
| | 44 | | } |
| 8 | 45 | | if (PrivateLinkServiceConnectionState != null) |
| | 46 | | { |
| 8 | 47 | | writer.WritePropertyName("privateLinkServiceConnectionState"); |
| 8 | 48 | | writer.WriteObjectValue(PrivateLinkServiceConnectionState); |
| | 49 | | } |
| 8 | 50 | | writer.WriteEndObject(); |
| 8 | 51 | | writer.WriteEndObject(); |
| 8 | 52 | | } |
| | 53 | |
|
| | 54 | | internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(JsonElement element) |
| | 55 | | { |
| 12 | 56 | | string id = default; |
| 12 | 57 | | string name = default; |
| 12 | 58 | | string type = default; |
| 12 | 59 | | ProvisioningState? provisioningState = default; |
| 12 | 60 | | PrivateEndpoint privateEndpoint = default; |
| 12 | 61 | | PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; |
| 168 | 62 | | foreach (var property in element.EnumerateObject()) |
| | 63 | | { |
| 72 | 64 | | if (property.NameEquals("id")) |
| | 65 | | { |
| 12 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 12 | 70 | | id = property.Value.GetString(); |
| 12 | 71 | | continue; |
| | 72 | | } |
| 60 | 73 | | if (property.NameEquals("name")) |
| | 74 | | { |
| 12 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 76 | | { |
| | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | name = property.Value.GetString(); |
| 0 | 80 | | continue; |
| | 81 | | } |
| 48 | 82 | | if (property.NameEquals("type")) |
| | 83 | | { |
| 12 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 12 | 88 | | type = property.Value.GetString(); |
| 12 | 89 | | continue; |
| | 90 | | } |
| 36 | 91 | | if (property.NameEquals("properties")) |
| | 92 | | { |
| 96 | 93 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 94 | | { |
| 36 | 95 | | if (property0.NameEquals("provisioningState")) |
| | 96 | | { |
| 12 | 97 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 12 | 101 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 12 | 102 | | continue; |
| | 103 | | } |
| 24 | 104 | | if (property0.NameEquals("privateEndpoint")) |
| | 105 | | { |
| 12 | 106 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 12 | 110 | | privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); |
| 12 | 111 | | continue; |
| | 112 | | } |
| 12 | 113 | | if (property0.NameEquals("privateLinkServiceConnectionState")) |
| | 114 | | { |
| 12 | 115 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 12 | 119 | | privateLinkServiceConnectionState = PrivateLinkServiceConnectionState.DeserializePrivateLink |
| | 120 | | continue; |
| | 121 | | } |
| | 122 | | } |
| | 123 | | continue; |
| | 124 | | } |
| | 125 | | } |
| 12 | 126 | | return new PrivateEndpointConnection(id, name, type, provisioningState, privateEndpoint, privateLinkServiceC |
| | 127 | | } |
| | 128 | | } |
| | 129 | | } |