| | | 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 PrivateLinkServiceIpConfiguration : 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 (Type != null) |
| | | 29 | | { |
| | 0 | 30 | | writer.WritePropertyName("type"); |
| | 0 | 31 | | writer.WriteStringValue(Type); |
| | | 32 | | } |
| | 0 | 33 | | if (Id != null) |
| | | 34 | | { |
| | 0 | 35 | | writer.WritePropertyName("id"); |
| | 0 | 36 | | writer.WriteStringValue(Id); |
| | | 37 | | } |
| | 0 | 38 | | writer.WritePropertyName("properties"); |
| | 0 | 39 | | writer.WriteStartObject(); |
| | 0 | 40 | | if (PrivateIPAddress != null) |
| | | 41 | | { |
| | 0 | 42 | | writer.WritePropertyName("privateIPAddress"); |
| | 0 | 43 | | writer.WriteStringValue(PrivateIPAddress); |
| | | 44 | | } |
| | 0 | 45 | | if (PrivateIPAllocationMethod != null) |
| | | 46 | | { |
| | 0 | 47 | | writer.WritePropertyName("privateIPAllocationMethod"); |
| | 0 | 48 | | writer.WriteStringValue(PrivateIPAllocationMethod.Value.ToString()); |
| | | 49 | | } |
| | 0 | 50 | | if (Subnet != null) |
| | | 51 | | { |
| | 0 | 52 | | writer.WritePropertyName("subnet"); |
| | 0 | 53 | | writer.WriteObjectValue(Subnet); |
| | | 54 | | } |
| | 0 | 55 | | if (Primary != null) |
| | | 56 | | { |
| | 0 | 57 | | writer.WritePropertyName("primary"); |
| | 0 | 58 | | writer.WriteBooleanValue(Primary.Value); |
| | | 59 | | } |
| | 0 | 60 | | if (ProvisioningState != null) |
| | | 61 | | { |
| | 0 | 62 | | writer.WritePropertyName("provisioningState"); |
| | 0 | 63 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | | 64 | | } |
| | 0 | 65 | | if (PrivateIPAddressVersion != null) |
| | | 66 | | { |
| | 0 | 67 | | writer.WritePropertyName("privateIPAddressVersion"); |
| | 0 | 68 | | writer.WriteStringValue(PrivateIPAddressVersion.Value.ToString()); |
| | | 69 | | } |
| | 0 | 70 | | writer.WriteEndObject(); |
| | 0 | 71 | | writer.WriteEndObject(); |
| | 0 | 72 | | } |
| | | 73 | | |
| | | 74 | | internal static PrivateLinkServiceIpConfiguration DeserializePrivateLinkServiceIpConfiguration(JsonElement eleme |
| | | 75 | | { |
| | 0 | 76 | | string name = default; |
| | 0 | 77 | | string etag = default; |
| | 0 | 78 | | string type = default; |
| | 0 | 79 | | string id = default; |
| | 0 | 80 | | string privateIPAddress = default; |
| | 0 | 81 | | IPAllocationMethod? privateIPAllocationMethod = default; |
| | 0 | 82 | | Subnet subnet = default; |
| | 0 | 83 | | bool? primary = default; |
| | 0 | 84 | | ProvisioningState? provisioningState = default; |
| | 0 | 85 | | IPVersion? privateIPAddressVersion = 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("etag")) |
| | | 98 | | { |
| | 0 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 100 | | { |
| | | 101 | | continue; |
| | | 102 | | } |
| | 0 | 103 | | etag = property.Value.GetString(); |
| | 0 | 104 | | continue; |
| | | 105 | | } |
| | 0 | 106 | | if (property.NameEquals("type")) |
| | | 107 | | { |
| | 0 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 109 | | { |
| | | 110 | | continue; |
| | | 111 | | } |
| | 0 | 112 | | type = 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("privateIPAddress")) |
| | | 129 | | { |
| | 0 | 130 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 131 | | { |
| | | 132 | | continue; |
| | | 133 | | } |
| | 0 | 134 | | privateIPAddress = property0.Value.GetString(); |
| | 0 | 135 | | continue; |
| | | 136 | | } |
| | 0 | 137 | | if (property0.NameEquals("privateIPAllocationMethod")) |
| | | 138 | | { |
| | 0 | 139 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 140 | | { |
| | | 141 | | continue; |
| | | 142 | | } |
| | 0 | 143 | | privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); |
| | 0 | 144 | | continue; |
| | | 145 | | } |
| | 0 | 146 | | if (property0.NameEquals("subnet")) |
| | | 147 | | { |
| | 0 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 149 | | { |
| | | 150 | | continue; |
| | | 151 | | } |
| | 0 | 152 | | subnet = Subnet.DeserializeSubnet(property0.Value); |
| | 0 | 153 | | continue; |
| | | 154 | | } |
| | 0 | 155 | | if (property0.NameEquals("primary")) |
| | | 156 | | { |
| | 0 | 157 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 158 | | { |
| | | 159 | | continue; |
| | | 160 | | } |
| | 0 | 161 | | primary = property0.Value.GetBoolean(); |
| | 0 | 162 | | continue; |
| | | 163 | | } |
| | 0 | 164 | | if (property0.NameEquals("provisioningState")) |
| | | 165 | | { |
| | 0 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 167 | | { |
| | | 168 | | continue; |
| | | 169 | | } |
| | 0 | 170 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 0 | 171 | | continue; |
| | | 172 | | } |
| | 0 | 173 | | if (property0.NameEquals("privateIPAddressVersion")) |
| | | 174 | | { |
| | 0 | 175 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 176 | | { |
| | | 177 | | continue; |
| | | 178 | | } |
| | 0 | 179 | | privateIPAddressVersion = new IPVersion(property0.Value.GetString()); |
| | | 180 | | continue; |
| | | 181 | | } |
| | | 182 | | } |
| | | 183 | | continue; |
| | | 184 | | } |
| | | 185 | | } |
| | 0 | 186 | | return new PrivateLinkServiceIpConfiguration(id, name, etag, type, privateIPAddress, privateIPAllocationMeth |
| | | 187 | | } |
| | | 188 | | } |
| | | 189 | | } |