| | 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 BastionHostIPConfiguration : 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 (Subnet != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("subnet"); |
| 0 | 43 | | writer.WriteObjectValue(Subnet); |
| | 44 | | } |
| 0 | 45 | | if (PublicIPAddress != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("publicIPAddress"); |
| 0 | 48 | | writer.WriteObjectValue(PublicIPAddress); |
| | 49 | | } |
| 0 | 50 | | if (ProvisioningState != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("provisioningState"); |
| 0 | 53 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 54 | | } |
| 0 | 55 | | if (PrivateIPAllocationMethod != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("privateIPAllocationMethod"); |
| 0 | 58 | | writer.WriteStringValue(PrivateIPAllocationMethod.Value.ToString()); |
| | 59 | | } |
| 0 | 60 | | writer.WriteEndObject(); |
| 0 | 61 | | writer.WriteEndObject(); |
| 0 | 62 | | } |
| | 63 | |
|
| | 64 | | internal static BastionHostIPConfiguration DeserializeBastionHostIPConfiguration(JsonElement element) |
| | 65 | | { |
| 0 | 66 | | string name = default; |
| 0 | 67 | | string etag = default; |
| 0 | 68 | | string type = default; |
| 0 | 69 | | string id = default; |
| 0 | 70 | | SubResource subnet = default; |
| 0 | 71 | | SubResource publicIPAddress = default; |
| 0 | 72 | | ProvisioningState? provisioningState = default; |
| 0 | 73 | | IPAllocationMethod? privateIPAllocationMethod = default; |
| 0 | 74 | | foreach (var property in element.EnumerateObject()) |
| | 75 | | { |
| 0 | 76 | | if (property.NameEquals("name")) |
| | 77 | | { |
| 0 | 78 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | name = property.Value.GetString(); |
| 0 | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | if (property.NameEquals("etag")) |
| | 86 | | { |
| 0 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | etag = property.Value.GetString(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("type")) |
| | 95 | | { |
| 0 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 97 | | { |
| | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | type = property.Value.GetString(); |
| 0 | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | if (property.NameEquals("id")) |
| | 104 | | { |
| 0 | 105 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | id = property.Value.GetString(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property.NameEquals("properties")) |
| | 113 | | { |
| 0 | 114 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 115 | | { |
| 0 | 116 | | if (property0.NameEquals("subnet")) |
| | 117 | | { |
| 0 | 118 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | subnet = DeserializeSubResource(property0.Value); |
| 0 | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | if (property0.NameEquals("publicIPAddress")) |
| | 126 | | { |
| 0 | 127 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | publicIPAddress = DeserializeSubResource(property0.Value); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property0.NameEquals("provisioningState")) |
| | 135 | | { |
| 0 | 136 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property0.NameEquals("privateIPAllocationMethod")) |
| | 144 | | { |
| 0 | 145 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); |
| | 150 | | continue; |
| | 151 | | } |
| | 152 | | } |
| | 153 | | continue; |
| | 154 | | } |
| | 155 | | } |
| 0 | 156 | | return new BastionHostIPConfiguration(id, name, etag, type, subnet, publicIPAddress, provisioningState, priv |
| | 157 | | } |
| | 158 | | } |
| | 159 | | } |