| | 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.KeyVault.Models |
| | 13 | | { |
| | 14 | | public partial class PrivateEndpointConnection : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("properties"); |
| 0 | 20 | | writer.WriteStartObject(); |
| 0 | 21 | | if (Optional.IsDefined(PrivateEndpoint)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("privateEndpoint"); |
| 0 | 24 | | writer.WriteObjectValue(PrivateEndpoint); |
| | 25 | | } |
| 0 | 26 | | if (Optional.IsDefined(PrivateLinkServiceConnectionState)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("privateLinkServiceConnectionState"); |
| 0 | 29 | | writer.WriteObjectValue(PrivateLinkServiceConnectionState); |
| | 30 | | } |
| 0 | 31 | | writer.WriteEndObject(); |
| 0 | 32 | | writer.WriteEndObject(); |
| 0 | 33 | | } |
| | 34 | |
|
| | 35 | | internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(JsonElement element) |
| | 36 | | { |
| 0 | 37 | | Optional<string> id = default; |
| 0 | 38 | | Optional<string> name = default; |
| 0 | 39 | | Optional<string> type = default; |
| 0 | 40 | | Optional<string> location = default; |
| 0 | 41 | | Optional<IReadOnlyDictionary<string, string>> tags = default; |
| 0 | 42 | | Optional<PrivateEndpoint> privateEndpoint = default; |
| 0 | 43 | | Optional<PrivateLinkServiceConnectionState> privateLinkServiceConnectionState = default; |
| 0 | 44 | | Optional<PrivateEndpointConnectionProvisioningState> provisioningState = default; |
| 0 | 45 | | foreach (var property in element.EnumerateObject()) |
| | 46 | | { |
| 0 | 47 | | if (property.NameEquals("id")) |
| | 48 | | { |
| 0 | 49 | | id = property.Value.GetString(); |
| 0 | 50 | | continue; |
| | 51 | | } |
| 0 | 52 | | if (property.NameEquals("name")) |
| | 53 | | { |
| 0 | 54 | | name = property.Value.GetString(); |
| 0 | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | if (property.NameEquals("type")) |
| | 58 | | { |
| 0 | 59 | | type = property.Value.GetString(); |
| 0 | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | if (property.NameEquals("location")) |
| | 63 | | { |
| 0 | 64 | | location = property.Value.GetString(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("tags")) |
| | 68 | | { |
| 0 | 69 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 70 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 71 | | { |
| 0 | 72 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 73 | | } |
| 0 | 74 | | tags = dictionary; |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("properties")) |
| | 78 | | { |
| 0 | 79 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 80 | | { |
| 0 | 81 | | if (property0.NameEquals("privateEndpoint")) |
| | 82 | | { |
| 0 | 83 | | privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property0.NameEquals("privateLinkServiceConnectionState")) |
| | 87 | | { |
| 0 | 88 | | privateLinkServiceConnectionState = PrivateLinkServiceConnectionState.DeserializePrivateLink |
| 0 | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | if (property0.NameEquals("provisioningState")) |
| | 92 | | { |
| 0 | 93 | | provisioningState = new PrivateEndpointConnectionProvisioningState(property0.Value.GetString |
| | 94 | | continue; |
| | 95 | | } |
| | 96 | | } |
| | 97 | | continue; |
| | 98 | | } |
| | 99 | | } |
| 0 | 100 | | return new PrivateEndpointConnection(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary |
| | 101 | | } |
| | 102 | | } |
| | 103 | | } |