| | 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 HubVirtualNetworkConnection : 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 (Id != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("id"); |
| 0 | 31 | | writer.WriteStringValue(Id); |
| | 32 | | } |
| 0 | 33 | | writer.WritePropertyName("properties"); |
| 0 | 34 | | writer.WriteStartObject(); |
| 0 | 35 | | if (RemoteVirtualNetwork != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("remoteVirtualNetwork"); |
| 0 | 38 | | writer.WriteObjectValue(RemoteVirtualNetwork); |
| | 39 | | } |
| 0 | 40 | | if (AllowHubToRemoteVnetTransit != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("allowHubToRemoteVnetTransit"); |
| 0 | 43 | | writer.WriteBooleanValue(AllowHubToRemoteVnetTransit.Value); |
| | 44 | | } |
| 0 | 45 | | if (AllowRemoteVnetToUseHubVnetGateways != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("allowRemoteVnetToUseHubVnetGateways"); |
| 0 | 48 | | writer.WriteBooleanValue(AllowRemoteVnetToUseHubVnetGateways.Value); |
| | 49 | | } |
| 0 | 50 | | if (EnableInternetSecurity != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("enableInternetSecurity"); |
| 0 | 53 | | writer.WriteBooleanValue(EnableInternetSecurity.Value); |
| | 54 | | } |
| 0 | 55 | | if (RoutingConfiguration != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("routingConfiguration"); |
| 0 | 58 | | writer.WriteObjectValue(RoutingConfiguration); |
| | 59 | | } |
| 0 | 60 | | if (ProvisioningState != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("provisioningState"); |
| 0 | 63 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 64 | | } |
| 0 | 65 | | writer.WriteEndObject(); |
| 0 | 66 | | writer.WriteEndObject(); |
| 0 | 67 | | } |
| | 68 | |
|
| | 69 | | internal static HubVirtualNetworkConnection DeserializeHubVirtualNetworkConnection(JsonElement element) |
| | 70 | | { |
| 0 | 71 | | string name = default; |
| 0 | 72 | | string etag = default; |
| 0 | 73 | | string id = default; |
| 0 | 74 | | SubResource remoteVirtualNetwork = default; |
| 0 | 75 | | bool? allowHubToRemoteVnetTransit = default; |
| 0 | 76 | | bool? allowRemoteVnetToUseHubVnetGateways = default; |
| 0 | 77 | | bool? enableInternetSecurity = default; |
| 0 | 78 | | RoutingConfiguration routingConfiguration = default; |
| 0 | 79 | | ProvisioningState? provisioningState = default; |
| 0 | 80 | | foreach (var property in element.EnumerateObject()) |
| | 81 | | { |
| 0 | 82 | | if (property.NameEquals("name")) |
| | 83 | | { |
| 0 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 0 | 88 | | name = property.Value.GetString(); |
| 0 | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | if (property.NameEquals("etag")) |
| | 92 | | { |
| 0 | 93 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 94 | | { |
| | 95 | | continue; |
| | 96 | | } |
| 0 | 97 | | etag = property.Value.GetString(); |
| 0 | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | if (property.NameEquals("id")) |
| | 101 | | { |
| 0 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | id = property.Value.GetString(); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("properties")) |
| | 110 | | { |
| 0 | 111 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 112 | | { |
| 0 | 113 | | if (property0.NameEquals("remoteVirtualNetwork")) |
| | 114 | | { |
| 0 | 115 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | remoteVirtualNetwork = DeserializeSubResource(property0.Value); |
| 0 | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | if (property0.NameEquals("allowHubToRemoteVnetTransit")) |
| | 123 | | { |
| 0 | 124 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | allowHubToRemoteVnetTransit = property0.Value.GetBoolean(); |
| 0 | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | if (property0.NameEquals("allowRemoteVnetToUseHubVnetGateways")) |
| | 132 | | { |
| 0 | 133 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 134 | | { |
| | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | allowRemoteVnetToUseHubVnetGateways = property0.Value.GetBoolean(); |
| 0 | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | if (property0.NameEquals("enableInternetSecurity")) |
| | 141 | | { |
| 0 | 142 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 143 | | { |
| | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | enableInternetSecurity = property0.Value.GetBoolean(); |
| 0 | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | if (property0.NameEquals("routingConfiguration")) |
| | 150 | | { |
| 0 | 151 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 152 | | { |
| | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | routingConfiguration = RoutingConfiguration.DeserializeRoutingConfiguration(property0.Value) |
| 0 | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | if (property0.NameEquals("provisioningState")) |
| | 159 | | { |
| 0 | 160 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 161 | | { |
| | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 165 | | continue; |
| | 166 | | } |
| | 167 | | } |
| | 168 | | continue; |
| | 169 | | } |
| | 170 | | } |
| 0 | 171 | | return new HubVirtualNetworkConnection(id, name, etag, remoteVirtualNetwork, allowHubToRemoteVnetTransit, al |
| | 172 | | } |
| | 173 | | } |
| | 174 | | } |