| | 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 PrivateLinkServiceConnection : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Type != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("type"); |
| 0 | 27 | | writer.WriteStringValue(Type); |
| | 28 | | } |
| 0 | 29 | | if (Etag != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("etag"); |
| 0 | 32 | | writer.WriteStringValue(Etag); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | writer.WritePropertyName("properties"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | if (ProvisioningState != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("provisioningState"); |
| 0 | 44 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 45 | | } |
| 0 | 46 | | if (PrivateLinkServiceId != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("privateLinkServiceId"); |
| 0 | 49 | | writer.WriteStringValue(PrivateLinkServiceId); |
| | 50 | | } |
| 0 | 51 | | if (GroupIds != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("groupIds"); |
| 0 | 54 | | writer.WriteStartArray(); |
| 0 | 55 | | foreach (var item in GroupIds) |
| | 56 | | { |
| 0 | 57 | | writer.WriteStringValue(item); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndArray(); |
| | 60 | | } |
| 0 | 61 | | if (RequestMessage != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("requestMessage"); |
| 0 | 64 | | writer.WriteStringValue(RequestMessage); |
| | 65 | | } |
| 0 | 66 | | if (PrivateLinkServiceConnectionState != null) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("privateLinkServiceConnectionState"); |
| 0 | 69 | | writer.WriteObjectValue(PrivateLinkServiceConnectionState); |
| | 70 | | } |
| 0 | 71 | | writer.WriteEndObject(); |
| 0 | 72 | | writer.WriteEndObject(); |
| 0 | 73 | | } |
| | 74 | |
|
| | 75 | | internal static PrivateLinkServiceConnection DeserializePrivateLinkServiceConnection(JsonElement element) |
| | 76 | | { |
| 0 | 77 | | string name = default; |
| 0 | 78 | | string type = default; |
| 0 | 79 | | string etag = default; |
| 0 | 80 | | string id = default; |
| 0 | 81 | | ProvisioningState? provisioningState = default; |
| 0 | 82 | | string privateLinkServiceId = default; |
| 0 | 83 | | IList<string> groupIds = default; |
| 0 | 84 | | string requestMessage = default; |
| 0 | 85 | | PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; |
| 0 | 86 | | foreach (var property in element.EnumerateObject()) |
| | 87 | | { |
| 0 | 88 | | if (property.NameEquals("name")) |
| | 89 | | { |
| 0 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | name = property.Value.GetString(); |
| 0 | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | if (property.NameEquals("type")) |
| | 98 | | { |
| 0 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | type = property.Value.GetString(); |
| 0 | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | if (property.NameEquals("etag")) |
| | 107 | | { |
| 0 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | etag = property.Value.GetString(); |
| 0 | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | if (property.NameEquals("id")) |
| | 116 | | { |
| 0 | 117 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 118 | | { |
| | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | id = property.Value.GetString(); |
| 0 | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | if (property.NameEquals("properties")) |
| | 125 | | { |
| 0 | 126 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 127 | | { |
| 0 | 128 | | if (property0.NameEquals("provisioningState")) |
| | 129 | | { |
| 0 | 130 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | if (property0.NameEquals("privateLinkServiceId")) |
| | 138 | | { |
| 0 | 139 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | privateLinkServiceId = property0.Value.GetString(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property0.NameEquals("groupIds")) |
| | 147 | | { |
| 0 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | List<string> array = new List<string>(); |
| 0 | 153 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 154 | | { |
| 0 | 155 | | if (item.ValueKind == JsonValueKind.Null) |
| | 156 | | { |
| 0 | 157 | | array.Add(null); |
| | 158 | | } |
| | 159 | | else |
| | 160 | | { |
| 0 | 161 | | array.Add(item.GetString()); |
| | 162 | | } |
| | 163 | | } |
| 0 | 164 | | groupIds = array; |
| 0 | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | if (property0.NameEquals("requestMessage")) |
| | 168 | | { |
| 0 | 169 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 170 | | { |
| | 171 | | continue; |
| | 172 | | } |
| 0 | 173 | | requestMessage = property0.Value.GetString(); |
| 0 | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | if (property0.NameEquals("privateLinkServiceConnectionState")) |
| | 177 | | { |
| 0 | 178 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 179 | | { |
| | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | privateLinkServiceConnectionState = PrivateLinkServiceConnectionState.DeserializePrivateLink |
| | 183 | | continue; |
| | 184 | | } |
| | 185 | | } |
| | 186 | | continue; |
| | 187 | | } |
| | 188 | | } |
| 0 | 189 | | return new PrivateLinkServiceConnection(id, name, type, etag, provisioningState, privateLinkServiceId, group |
| | 190 | | } |
| | 191 | | } |
| | 192 | | } |