< Summary

Class:Azure.ResourceManager.Network.Models.VirtualNetworkPeering
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkPeering.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkPeering.Serialization.cs
Covered lines:107
Uncovered lines:14
Coverable lines:121
Total lines:269
Line coverage:88.4% (107 of 121)
Covered branches:65
Total branches:72
Branch coverage:90.2% (65 of 72)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Etag()-100%100%
get_AllowVirtualNetworkAccess()-100%100%
get_AllowForwardedTraffic()-100%100%
get_AllowGatewayTransit()-100%100%
get_UseRemoteGateways()-100%100%
get_RemoteVirtualNetwork()-100%100%
get_RemoteAddressSpace()-100%100%
get_PeeringState()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-64.1%68.18%
DeserializeVirtualNetworkPeering(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkPeering.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
 8namespace Azure.ResourceManager.Network.Models
 9{
 10    /// <summary> Peerings in a virtual network resource. </summary>
 11    public partial class VirtualNetworkPeering : SubResource
 12    {
 13        /// <summary> Initializes a new instance of VirtualNetworkPeering. </summary>
 814        public VirtualNetworkPeering()
 15        {
 816        }
 17
 18        /// <summary> Initializes a new instance of VirtualNetworkPeering. </summary>
 19        /// <param name="id"> Resource ID. </param>
 20        /// <param name="name"> The name of the resource that is unique within a resource group. This name can be used t
 21        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 22        /// <param name="allowVirtualNetworkAccess"> Whether the VMs in the local virtual network space would be able to
 23        /// <param name="allowForwardedTraffic"> Whether the forwarded traffic from the VMs in the local virtual network
 24        /// <param name="allowGatewayTransit"> If gateway links can be used in remote virtual networking to link to this
 25        /// <param name="useRemoteGateways"> If remote gateways can be used on this virtual network. If the flag is set 
 26        /// <param name="remoteVirtualNetwork"> The reference to the remote virtual network. The remote virtual network 
 27        /// <param name="remoteAddressSpace"> The reference to the remote virtual network address space. </param>
 28        /// <param name="peeringState"> The status of the virtual network peering. </param>
 29        /// <param name="provisioningState"> The provisioning state of the virtual network peering resource. </param>
 2430        internal VirtualNetworkPeering(string id, string name, string etag, bool? allowVirtualNetworkAccess, bool? allow
 31        {
 2432            Name = name;
 2433            Etag = etag;
 2434            AllowVirtualNetworkAccess = allowVirtualNetworkAccess;
 2435            AllowForwardedTraffic = allowForwardedTraffic;
 2436            AllowGatewayTransit = allowGatewayTransit;
 2437            UseRemoteGateways = useRemoteGateways;
 2438            RemoteVirtualNetwork = remoteVirtualNetwork;
 2439            RemoteAddressSpace = remoteAddressSpace;
 2440            PeeringState = peeringState;
 2441            ProvisioningState = provisioningState;
 2442        }
 43
 44        /// <summary> The name of the resource that is unique within a resource group. This name can be used to access t
 7645        public string Name { get; set; }
 46        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 3647        public string Etag { get; }
 48        /// <summary> Whether the VMs in the local virtual network space would be able to access the VMs in remote virtu
 8849        public bool? AllowVirtualNetworkAccess { get; set; }
 50        /// <summary> Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed
 10051        public bool? AllowForwardedTraffic { get; set; }
 52        /// <summary> If gateway links can be used in remote virtual networking to link to this virtual network. </summa
 6453        public bool? AllowGatewayTransit { get; set; }
 54        /// <summary> If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatew
 5255        public bool? UseRemoteGateways { get; set; }
 56        /// <summary> The reference to the remote virtual network. The remote virtual network can be in the same or diff
 10057        public SubResource RemoteVirtualNetwork { get; set; }
 58        /// <summary> The reference to the remote virtual network address space. </summary>
 4059        public AddressSpace RemoteAddressSpace { get; set; }
 60        /// <summary> The status of the virtual network peering. </summary>
 5261        public VirtualNetworkPeeringState? PeeringState { get; set; }
 62        /// <summary> The provisioning state of the virtual network peering resource. </summary>
 1663        public ProvisioningState? ProvisioningState { get; }
 64    }
 65}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetworkPeering.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Network.Models
 12{
 13    public partial class VirtualNetworkPeering : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1617            writer.WriteStartObject();
 1618            if (Name != null)
 19            {
 820                writer.WritePropertyName("name");
 821                writer.WriteStringValue(Name);
 22            }
 1623            if (Etag != null)
 24            {
 025                writer.WritePropertyName("etag");
 026                writer.WriteStringValue(Etag);
 27            }
 1628            if (Id != null)
 29            {
 030                writer.WritePropertyName("id");
 031                writer.WriteStringValue(Id);
 32            }
 1633            writer.WritePropertyName("properties");
 1634            writer.WriteStartObject();
 1635            if (AllowVirtualNetworkAccess != null)
 36            {
 837                writer.WritePropertyName("allowVirtualNetworkAccess");
 838                writer.WriteBooleanValue(AllowVirtualNetworkAccess.Value);
 39            }
 1640            if (AllowForwardedTraffic != null)
 41            {
 1642                writer.WritePropertyName("allowForwardedTraffic");
 1643                writer.WriteBooleanValue(AllowForwardedTraffic.Value);
 44            }
 1645            if (AllowGatewayTransit != null)
 46            {
 047                writer.WritePropertyName("allowGatewayTransit");
 048                writer.WriteBooleanValue(AllowGatewayTransit.Value);
 49            }
 1650            if (UseRemoteGateways != null)
 51            {
 052                writer.WritePropertyName("useRemoteGateways");
 053                writer.WriteBooleanValue(UseRemoteGateways.Value);
 54            }
 1655            if (RemoteVirtualNetwork != null)
 56            {
 1657                writer.WritePropertyName("remoteVirtualNetwork");
 1658                writer.WriteObjectValue(RemoteVirtualNetwork);
 59            }
 1660            if (RemoteAddressSpace != null)
 61            {
 062                writer.WritePropertyName("remoteAddressSpace");
 063                writer.WriteObjectValue(RemoteAddressSpace);
 64            }
 1665            if (PeeringState != null)
 66            {
 067                writer.WritePropertyName("peeringState");
 068                writer.WriteStringValue(PeeringState.Value.ToString());
 69            }
 1670            if (ProvisioningState != null)
 71            {
 072                writer.WritePropertyName("provisioningState");
 073                writer.WriteStringValue(ProvisioningState.Value.ToString());
 74            }
 1675            writer.WriteEndObject();
 1676            writer.WriteEndObject();
 1677        }
 78
 79        internal static VirtualNetworkPeering DeserializeVirtualNetworkPeering(JsonElement element)
 80        {
 2481            string name = default;
 2482            string etag = default;
 2483            string id = default;
 2484            bool? allowVirtualNetworkAccess = default;
 2485            bool? allowForwardedTraffic = default;
 2486            bool? allowGatewayTransit = default;
 2487            bool? useRemoteGateways = default;
 2488            SubResource remoteVirtualNetwork = default;
 2489            AddressSpace remoteAddressSpace = default;
 2490            VirtualNetworkPeeringState? peeringState = default;
 2491            ProvisioningState? provisioningState = default;
 28892            foreach (var property in element.EnumerateObject())
 93            {
 12094                if (property.NameEquals("name"))
 95                {
 2496                    if (property.Value.ValueKind == JsonValueKind.Null)
 97                    {
 98                        continue;
 99                    }
 24100                    name = property.Value.GetString();
 24101                    continue;
 102                }
 96103                if (property.NameEquals("etag"))
 104                {
 24105                    if (property.Value.ValueKind == JsonValueKind.Null)
 106                    {
 107                        continue;
 108                    }
 24109                    etag = property.Value.GetString();
 24110                    continue;
 111                }
 72112                if (property.NameEquals("id"))
 113                {
 24114                    if (property.Value.ValueKind == JsonValueKind.Null)
 115                    {
 116                        continue;
 117                    }
 24118                    id = property.Value.GetString();
 24119                    continue;
 120                }
 48121                if (property.NameEquals("properties"))
 122                {
 576123                    foreach (var property0 in property.Value.EnumerateObject())
 124                    {
 264125                        if (property0.NameEquals("allowVirtualNetworkAccess"))
 126                        {
 24127                            if (property0.Value.ValueKind == JsonValueKind.Null)
 128                            {
 129                                continue;
 130                            }
 24131                            allowVirtualNetworkAccess = property0.Value.GetBoolean();
 24132                            continue;
 133                        }
 240134                        if (property0.NameEquals("allowForwardedTraffic"))
 135                        {
 24136                            if (property0.Value.ValueKind == JsonValueKind.Null)
 137                            {
 138                                continue;
 139                            }
 24140                            allowForwardedTraffic = property0.Value.GetBoolean();
 24141                            continue;
 142                        }
 216143                        if (property0.NameEquals("allowGatewayTransit"))
 144                        {
 24145                            if (property0.Value.ValueKind == JsonValueKind.Null)
 146                            {
 147                                continue;
 148                            }
 24149                            allowGatewayTransit = property0.Value.GetBoolean();
 24150                            continue;
 151                        }
 192152                        if (property0.NameEquals("useRemoteGateways"))
 153                        {
 24154                            if (property0.Value.ValueKind == JsonValueKind.Null)
 155                            {
 156                                continue;
 157                            }
 24158                            useRemoteGateways = property0.Value.GetBoolean();
 24159                            continue;
 160                        }
 168161                        if (property0.NameEquals("remoteVirtualNetwork"))
 162                        {
 24163                            if (property0.Value.ValueKind == JsonValueKind.Null)
 164                            {
 165                                continue;
 166                            }
 24167                            remoteVirtualNetwork = DeserializeSubResource(property0.Value);
 24168                            continue;
 169                        }
 144170                        if (property0.NameEquals("remoteAddressSpace"))
 171                        {
 24172                            if (property0.Value.ValueKind == JsonValueKind.Null)
 173                            {
 174                                continue;
 175                            }
 24176                            remoteAddressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
 24177                            continue;
 178                        }
 120179                        if (property0.NameEquals("peeringState"))
 180                        {
 24181                            if (property0.Value.ValueKind == JsonValueKind.Null)
 182                            {
 183                                continue;
 184                            }
 24185                            peeringState = new VirtualNetworkPeeringState(property0.Value.GetString());
 24186                            continue;
 187                        }
 96188                        if (property0.NameEquals("provisioningState"))
 189                        {
 24190                            if (property0.Value.ValueKind == JsonValueKind.Null)
 191                            {
 192                                continue;
 193                            }
 24194                            provisioningState = new ProvisioningState(property0.Value.GetString());
 195                            continue;
 196                        }
 197                    }
 198                    continue;
 199                }
 200            }
 24201            return new VirtualNetworkPeering(id, name, etag, allowVirtualNetworkAccess, allowForwardedTraffic, allowGate
 202        }
 203    }
 204}