< Summary

Class:Azure.ResourceManager.Network.Models.VirtualNetworkGateway
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkGateway.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkGateway.Serialization.cs
Covered lines:219
Uncovered lines:21
Coverable lines:240
Total lines:504
Line coverage:91.2% (219 of 240)
Covered branches:136
Total branches:150
Branch coverage:90.6% (136 of 150)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Etag()-100%100%
get_IpConfigurations()-100%100%
get_GatewayType()-100%100%
get_VpnType()-100%100%
get_VpnGatewayGeneration()-100%100%
get_EnableBgp()-100%100%
get_EnablePrivateIpAddress()-100%100%
get_Active()-100%100%
get_GatewayDefaultSite()-100%100%
get_Sku()-100%100%
get_VpnClientConfiguration()-100%100%
get_BgpSettings()-100%100%
get_CustomRoutes()-100%100%
get_ResourceGuid()-100%100%
get_ProvisioningState()-100%100%
get_EnableDnsForwarding()-100%100%
get_InboundDnsForwardingEndpoint()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-89.87%91.67%
DeserializeVirtualNetworkGateway(...)-89.43%90.2%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkGateway.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Network.Models
 11{
 12    /// <summary> A common class for general resource information. </summary>
 13    public partial class VirtualNetworkGateway : Resource
 14    {
 15        /// <summary> Initializes a new instance of VirtualNetworkGateway. </summary>
 1216        public VirtualNetworkGateway()
 17        {
 1218        }
 19
 20        /// <summary> Initializes a new instance of VirtualNetworkGateway. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="tags"> Resource tags. </param>
 26        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 27        /// <param name="ipConfigurations"> IP configurations for virtual network gateway. </param>
 28        /// <param name="gatewayType"> The type of this virtual network gateway. </param>
 29        /// <param name="vpnType"> The type of this virtual network gateway. </param>
 30        /// <param name="vpnGatewayGeneration"> The generation for this VirtualNetworkGateway. Must be None if gatewayTy
 31        /// <param name="enableBgp"> Whether BGP is enabled for this virtual network gateway or not. </param>
 32        /// <param name="enablePrivateIpAddress"> Whether private IP needs to be enabled on this gateway for connections
 33        /// <param name="active"> ActiveActive flag. </param>
 34        /// <param name="gatewayDefaultSite"> The reference to the LocalNetworkGateway resource which represents local n
 35        /// <param name="sku"> The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected 
 36        /// <param name="vpnClientConfiguration"> The reference to the VpnClientConfiguration resource which represents 
 37        /// <param name="bgpSettings"> Virtual network gateway&apos;s BGP speaker settings. </param>
 38        /// <param name="customRoutes"> The reference to the address space resource which represents the custom routes a
 39        /// <param name="resourceGuid"> The resource GUID property of the virtual network gateway resource. </param>
 40        /// <param name="provisioningState"> The provisioning state of the virtual network gateway resource. </param>
 41        /// <param name="enableDnsForwarding"> Whether dns forwarding is enabled or not. </param>
 42        /// <param name="inboundDnsForwardingEndpoint"> The IP address allocated by the gateway to which dns requests ca
 9243        internal VirtualNetworkGateway(string id, string name, string type, string location, IDictionary<string, string>
 44        {
 9245            Etag = etag;
 9246            IpConfigurations = ipConfigurations;
 9247            GatewayType = gatewayType;
 9248            VpnType = vpnType;
 9249            VpnGatewayGeneration = vpnGatewayGeneration;
 9250            EnableBgp = enableBgp;
 9251            EnablePrivateIpAddress = enablePrivateIpAddress;
 9252            Active = active;
 9253            GatewayDefaultSite = gatewayDefaultSite;
 9254            Sku = sku;
 9255            VpnClientConfiguration = vpnClientConfiguration;
 9256            BgpSettings = bgpSettings;
 9257            CustomRoutes = customRoutes;
 9258            ResourceGuid = resourceGuid;
 9259            ProvisioningState = provisioningState;
 9260            EnableDnsForwarding = enableDnsForwarding;
 9261            InboundDnsForwardingEndpoint = inboundDnsForwardingEndpoint;
 9262        }
 63
 64        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 13665        public string Etag { get; }
 66        /// <summary> IP configurations for virtual network gateway. </summary>
 26467        public IList<VirtualNetworkGatewayIPConfiguration> IpConfigurations { get; set; }
 68        /// <summary> The type of this virtual network gateway. </summary>
 26469        public VirtualNetworkGatewayType? GatewayType { get; set; }
 70        /// <summary> The type of this virtual network gateway. </summary>
 26471        public VpnType? VpnType { get; set; }
 72        /// <summary> The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. </summary>
 22873        public VpnGatewayGeneration? VpnGatewayGeneration { get; set; }
 74        /// <summary> Whether BGP is enabled for this virtual network gateway or not. </summary>
 26475        public bool? EnableBgp { get; set; }
 76        /// <summary> Whether private IP needs to be enabled on this gateway for connections or not. </summary>
 22877        public bool? EnablePrivateIpAddress { get; set; }
 78        /// <summary> ActiveActive flag. </summary>
 22879        public bool? Active { get; set; }
 80        /// <summary> The reference to the LocalNetworkGateway resource which represents local network site having defau
 21681        public SubResource GatewayDefaultSite { get; set; }
 82        /// <summary> The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtu
 25283        public VirtualNetworkGatewaySku Sku { get; set; }
 84        /// <summary> The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurat
 17285        public VpnClientConfiguration VpnClientConfiguration { get; set; }
 86        /// <summary> Virtual network gateway&apos;s BGP speaker settings. </summary>
 24887        public BgpSettings BgpSettings { get; set; }
 88        /// <summary> The reference to the address space resource which represents the custom routes address space speci
 17289        public AddressSpace CustomRoutes { get; set; }
 90        /// <summary> The resource GUID property of the virtual network gateway resource. </summary>
 13691        public string ResourceGuid { get; }
 92        /// <summary> The provisioning state of the virtual network gateway resource. </summary>
 15293        public ProvisioningState? ProvisioningState { get; }
 94        /// <summary> Whether dns forwarding is enabled or not. </summary>
 17295        public bool? EnableDnsForwarding { get; set; }
 96        /// <summary> The IP address allocated by the gateway to which dns requests can be sent. </summary>
 8097        public string InboundDnsForwardingEndpoint { get; }
 98    }
 99}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkGateway.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Network.Models
 13{
 14    public partial class VirtualNetworkGateway : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 8018            writer.WriteStartObject();
 8019            if (Etag != null)
 20            {
 5621                writer.WritePropertyName("etag");
 5622                writer.WriteStringValue(Etag);
 23            }
 8024            if (Id != null)
 25            {
 5626                writer.WritePropertyName("id");
 5627                writer.WriteStringValue(Id);
 28            }
 8029            if (Name != null)
 30            {
 5631                writer.WritePropertyName("name");
 5632                writer.WriteStringValue(Name);
 33            }
 8034            if (Type != null)
 35            {
 5636                writer.WritePropertyName("type");
 5637                writer.WriteStringValue(Type);
 38            }
 8039            if (Location != null)
 40            {
 8041                writer.WritePropertyName("location");
 8042                writer.WriteStringValue(Location);
 43            }
 8044            if (Tags != null)
 45            {
 8046                writer.WritePropertyName("tags");
 8047                writer.WriteStartObject();
 32048                foreach (var item in Tags)
 49                {
 8050                    writer.WritePropertyName(item.Key);
 8051                    writer.WriteStringValue(item.Value);
 52                }
 8053                writer.WriteEndObject();
 54            }
 8055            writer.WritePropertyName("properties");
 8056            writer.WriteStartObject();
 8057            if (IpConfigurations != null)
 58            {
 8059                writer.WritePropertyName("ipConfigurations");
 8060                writer.WriteStartArray();
 32061                foreach (var item in IpConfigurations)
 62                {
 8063                    writer.WriteObjectValue(item);
 64                }
 8065                writer.WriteEndArray();
 66            }
 8067            if (GatewayType != null)
 68            {
 8069                writer.WritePropertyName("gatewayType");
 8070                writer.WriteStringValue(GatewayType.Value.ToString());
 71            }
 8072            if (VpnType != null)
 73            {
 8074                writer.WritePropertyName("vpnType");
 8075                writer.WriteStringValue(VpnType.Value.ToString());
 76            }
 8077            if (VpnGatewayGeneration != null)
 78            {
 5679                writer.WritePropertyName("vpnGatewayGeneration");
 5680                writer.WriteStringValue(VpnGatewayGeneration.Value.ToString());
 81            }
 8082            if (EnableBgp != null)
 83            {
 8084                writer.WritePropertyName("enableBgp");
 8085                writer.WriteBooleanValue(EnableBgp.Value);
 86            }
 8087            if (EnablePrivateIpAddress != null)
 88            {
 5689                writer.WritePropertyName("enablePrivateIpAddress");
 5690                writer.WriteBooleanValue(EnablePrivateIpAddress.Value);
 91            }
 8092            if (Active != null)
 93            {
 5694                writer.WritePropertyName("activeActive");
 5695                writer.WriteBooleanValue(Active.Value);
 96            }
 8097            if (GatewayDefaultSite != null)
 98            {
 1699                writer.WritePropertyName("gatewayDefaultSite");
 16100                writer.WriteObjectValue(GatewayDefaultSite);
 101            }
 80102            if (Sku != null)
 103            {
 72104                writer.WritePropertyName("sku");
 72105                writer.WriteObjectValue(Sku);
 106            }
 80107            if (VpnClientConfiguration != null)
 108            {
 0109                writer.WritePropertyName("vpnClientConfiguration");
 0110                writer.WriteObjectValue(VpnClientConfiguration);
 111            }
 80112            if (BgpSettings != null)
 113            {
 64114                writer.WritePropertyName("bgpSettings");
 64115                writer.WriteObjectValue(BgpSettings);
 116            }
 80117            if (CustomRoutes != null)
 118            {
 0119                writer.WritePropertyName("customRoutes");
 0120                writer.WriteObjectValue(CustomRoutes);
 121            }
 80122            if (ResourceGuid != null)
 123            {
 56124                writer.WritePropertyName("resourceGuid");
 56125                writer.WriteStringValue(ResourceGuid);
 126            }
 80127            if (ProvisioningState != null)
 128            {
 56129                writer.WritePropertyName("provisioningState");
 56130                writer.WriteStringValue(ProvisioningState.Value.ToString());
 131            }
 80132            if (EnableDnsForwarding != null)
 133            {
 0134                writer.WritePropertyName("enableDnsForwarding");
 0135                writer.WriteBooleanValue(EnableDnsForwarding.Value);
 136            }
 80137            if (InboundDnsForwardingEndpoint != null)
 138            {
 0139                writer.WritePropertyName("inboundDnsForwardingEndpoint");
 0140                writer.WriteStringValue(InboundDnsForwardingEndpoint);
 141            }
 80142            writer.WriteEndObject();
 80143            writer.WriteEndObject();
 80144        }
 145
 146        internal static VirtualNetworkGateway DeserializeVirtualNetworkGateway(JsonElement element)
 147        {
 92148            string etag = default;
 92149            string id = default;
 92150            string name = default;
 92151            string type = default;
 92152            string location = default;
 92153            IDictionary<string, string> tags = default;
 92154            IList<VirtualNetworkGatewayIPConfiguration> ipConfigurations = default;
 92155            VirtualNetworkGatewayType? gatewayType = default;
 92156            VpnType? vpnType = default;
 92157            VpnGatewayGeneration? vpnGatewayGeneration = default;
 92158            bool? enableBgp = default;
 92159            bool? enablePrivateIpAddress = default;
 92160            bool? activeActive = default;
 92161            SubResource gatewayDefaultSite = default;
 92162            VirtualNetworkGatewaySku sku = default;
 92163            VpnClientConfiguration vpnClientConfiguration = default;
 92164            BgpSettings bgpSettings = default;
 92165            AddressSpace customRoutes = default;
 92166            string resourceGuid = default;
 92167            ProvisioningState? provisioningState = default;
 92168            bool? enableDnsForwarding = default;
 92169            string inboundDnsForwardingEndpoint = default;
 752170            foreach (var property in element.EnumerateObject())
 171            {
 284172                if (property.NameEquals("etag"))
 173                {
 32174                    if (property.Value.ValueKind == JsonValueKind.Null)
 175                    {
 176                        continue;
 177                    }
 32178                    etag = property.Value.GetString();
 32179                    continue;
 180                }
 252181                if (property.NameEquals("id"))
 182                {
 92183                    if (property.Value.ValueKind == JsonValueKind.Null)
 184                    {
 185                        continue;
 186                    }
 92187                    id = property.Value.GetString();
 92188                    continue;
 189                }
 160190                if (property.NameEquals("name"))
 191                {
 32192                    if (property.Value.ValueKind == JsonValueKind.Null)
 193                    {
 194                        continue;
 195                    }
 32196                    name = property.Value.GetString();
 32197                    continue;
 198                }
 128199                if (property.NameEquals("type"))
 200                {
 32201                    if (property.Value.ValueKind == JsonValueKind.Null)
 202                    {
 203                        continue;
 204                    }
 32205                    type = property.Value.GetString();
 32206                    continue;
 207                }
 96208                if (property.NameEquals("location"))
 209                {
 32210                    if (property.Value.ValueKind == JsonValueKind.Null)
 211                    {
 212                        continue;
 213                    }
 32214                    location = property.Value.GetString();
 32215                    continue;
 216                }
 64217                if (property.NameEquals("tags"))
 218                {
 32219                    if (property.Value.ValueKind == JsonValueKind.Null)
 220                    {
 221                        continue;
 222                    }
 32223                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 128224                    foreach (var property0 in property.Value.EnumerateObject())
 225                    {
 32226                        if (property0.Value.ValueKind == JsonValueKind.Null)
 227                        {
 0228                            dictionary.Add(property0.Name, null);
 229                        }
 230                        else
 231                        {
 32232                            dictionary.Add(property0.Name, property0.Value.GetString());
 233                        }
 234                    }
 32235                    tags = dictionary;
 32236                    continue;
 237                }
 32238                if (property.NameEquals("properties"))
 239                {
 848240                    foreach (var property0 in property.Value.EnumerateObject())
 241                    {
 392242                        if (property0.NameEquals("ipConfigurations"))
 243                        {
 32244                            if (property0.Value.ValueKind == JsonValueKind.Null)
 245                            {
 246                                continue;
 247                            }
 32248                            List<VirtualNetworkGatewayIPConfiguration> array = new List<VirtualNetworkGatewayIPConfigura
 128249                            foreach (var item in property0.Value.EnumerateArray())
 250                            {
 32251                                if (item.ValueKind == JsonValueKind.Null)
 252                                {
 0253                                    array.Add(null);
 254                                }
 255                                else
 256                                {
 32257                                    array.Add(VirtualNetworkGatewayIPConfiguration.DeserializeVirtualNetworkGatewayIPCon
 258                                }
 259                            }
 32260                            ipConfigurations = array;
 32261                            continue;
 262                        }
 360263                        if (property0.NameEquals("gatewayType"))
 264                        {
 32265                            if (property0.Value.ValueKind == JsonValueKind.Null)
 266                            {
 267                                continue;
 268                            }
 32269                            gatewayType = new VirtualNetworkGatewayType(property0.Value.GetString());
 32270                            continue;
 271                        }
 328272                        if (property0.NameEquals("vpnType"))
 273                        {
 32274                            if (property0.Value.ValueKind == JsonValueKind.Null)
 275                            {
 276                                continue;
 277                            }
 32278                            vpnType = new VpnType(property0.Value.GetString());
 32279                            continue;
 280                        }
 296281                        if (property0.NameEquals("vpnGatewayGeneration"))
 282                        {
 32283                            if (property0.Value.ValueKind == JsonValueKind.Null)
 284                            {
 285                                continue;
 286                            }
 32287                            vpnGatewayGeneration = new VpnGatewayGeneration(property0.Value.GetString());
 32288                            continue;
 289                        }
 264290                        if (property0.NameEquals("enableBgp"))
 291                        {
 32292                            if (property0.Value.ValueKind == JsonValueKind.Null)
 293                            {
 294                                continue;
 295                            }
 32296                            enableBgp = property0.Value.GetBoolean();
 32297                            continue;
 298                        }
 232299                        if (property0.NameEquals("enablePrivateIpAddress"))
 300                        {
 32301                            if (property0.Value.ValueKind == JsonValueKind.Null)
 302                            {
 303                                continue;
 304                            }
 32305                            enablePrivateIpAddress = property0.Value.GetBoolean();
 32306                            continue;
 307                        }
 200308                        if (property0.NameEquals("activeActive"))
 309                        {
 32310                            if (property0.Value.ValueKind == JsonValueKind.Null)
 311                            {
 312                                continue;
 313                            }
 32314                            activeActive = property0.Value.GetBoolean();
 32315                            continue;
 316                        }
 168317                        if (property0.NameEquals("gatewayDefaultSite"))
 318                        {
 8319                            if (property0.Value.ValueKind == JsonValueKind.Null)
 320                            {
 321                                continue;
 322                            }
 8323                            gatewayDefaultSite = SubResource.DeserializeSubResource(property0.Value);
 8324                            continue;
 325                        }
 160326                        if (property0.NameEquals("sku"))
 327                        {
 32328                            if (property0.Value.ValueKind == JsonValueKind.Null)
 329                            {
 330                                continue;
 331                            }
 32332                            sku = VirtualNetworkGatewaySku.DeserializeVirtualNetworkGatewaySku(property0.Value);
 32333                            continue;
 334                        }
 128335                        if (property0.NameEquals("vpnClientConfiguration"))
 336                        {
 0337                            if (property0.Value.ValueKind == JsonValueKind.Null)
 338                            {
 339                                continue;
 340                            }
 0341                            vpnClientConfiguration = VpnClientConfiguration.DeserializeVpnClientConfiguration(property0.
 0342                            continue;
 343                        }
 128344                        if (property0.NameEquals("bgpSettings"))
 345                        {
 32346                            if (property0.Value.ValueKind == JsonValueKind.Null)
 347                            {
 348                                continue;
 349                            }
 32350                            bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value);
 32351                            continue;
 352                        }
 96353                        if (property0.NameEquals("customRoutes"))
 354                        {
 0355                            if (property0.Value.ValueKind == JsonValueKind.Null)
 356                            {
 357                                continue;
 358                            }
 0359                            customRoutes = AddressSpace.DeserializeAddressSpace(property0.Value);
 0360                            continue;
 361                        }
 96362                        if (property0.NameEquals("resourceGuid"))
 363                        {
 32364                            if (property0.Value.ValueKind == JsonValueKind.Null)
 365                            {
 366                                continue;
 367                            }
 32368                            resourceGuid = property0.Value.GetString();
 32369                            continue;
 370                        }
 64371                        if (property0.NameEquals("provisioningState"))
 372                        {
 32373                            if (property0.Value.ValueKind == JsonValueKind.Null)
 374                            {
 375                                continue;
 376                            }
 32377                            provisioningState = new ProvisioningState(property0.Value.GetString());
 32378                            continue;
 379                        }
 32380                        if (property0.NameEquals("enableDnsForwarding"))
 381                        {
 0382                            if (property0.Value.ValueKind == JsonValueKind.Null)
 383                            {
 384                                continue;
 385                            }
 0386                            enableDnsForwarding = property0.Value.GetBoolean();
 0387                            continue;
 388                        }
 32389                        if (property0.NameEquals("inboundDnsForwardingEndpoint"))
 390                        {
 0391                            if (property0.Value.ValueKind == JsonValueKind.Null)
 392                            {
 393                                continue;
 394                            }
 0395                            inboundDnsForwardingEndpoint = property0.Value.GetString();
 396                            continue;
 397                        }
 398                    }
 399                    continue;
 400                }
 401            }
 92402            return new VirtualNetworkGateway(id, name, type, location, tags, etag, ipConfigurations, gatewayType, vpnTyp
 403        }
 404    }
 405}