< Summary

Class:Azure.ResourceManager.Network.Models.RouteFilterRule
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\RouteFilterRule.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\RouteFilterRule.Serialization.cs
Covered lines:90
Uncovered lines:10
Coverable lines:100
Total lines:233
Line coverage:90% (90 of 100)
Covered branches:54
Total branches:60
Branch coverage:90% (54 of 60)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Location()-100%100%
get_Etag()-100%100%
get_Access()-100%100%
get_RouteFilterRuleType()-100%100%
get_Communities()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-81.82%83.33%
DeserializeRouteFilterRule(...)-91.67%92.86%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\RouteFilterRule.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> Route Filter Rule Resource. </summary>
 13    public partial class RouteFilterRule : SubResource
 14    {
 15        /// <summary> Initializes a new instance of RouteFilterRule. </summary>
 816        public RouteFilterRule()
 17        {
 818            RouteFilterRuleType = "Community";
 819        }
 20
 21        /// <summary> Initializes a new instance of RouteFilterRule. </summary>
 22        /// <param name="id"> Resource ID. </param>
 23        /// <param name="name"> The name of the resource that is unique within a resource group. This name can be used t
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 26        /// <param name="access"> The access type of the rule. </param>
 27        /// <param name="routeFilterRuleType"> The rule type of the rule. </param>
 28        /// <param name="communities"> The collection for bgp community values to filter on. e.g. [&apos;12076:5010&apos
 29        /// <param name="provisioningState"> The provisioning state of the route filter rule resource. </param>
 1630        internal RouteFilterRule(string id, string name, string location, string etag, Access? access, string routeFilte
 31        {
 1632            Name = name;
 1633            Location = location;
 1634            Etag = etag;
 1635            Access = access;
 1636            RouteFilterRuleType = routeFilterRuleType;
 1637            Communities = communities;
 1638            ProvisioningState = provisioningState;
 1639        }
 40
 41        /// <summary> The name of the resource that is unique within a resource group. This name can be used to access t
 4442        public string Name { get; set; }
 43        /// <summary> Resource location. </summary>
 5644        public string Location { get; set; }
 45        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 1646        public string Etag { get; }
 47        /// <summary> The access type of the rule. </summary>
 5648        public Access? Access { get; set; }
 49        /// <summary> The rule type of the rule. </summary>
 5650        public string RouteFilterRuleType { get; set; }
 51        /// <summary> The collection for bgp community values to filter on. e.g. [&apos;12076:5010&apos;,&apos;12076:502
 5652        public IList<string> Communities { get; set; }
 53        /// <summary> The provisioning state of the route filter rule resource. </summary>
 2054        public ProvisioningState? ProvisioningState { get; }
 55    }
 56}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\RouteFilterRule.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 RouteFilterRule : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (Name != null)
 20            {
 821                writer.WritePropertyName("name");
 822                writer.WriteStringValue(Name);
 23            }
 1624            if (Location != null)
 25            {
 1626                writer.WritePropertyName("location");
 1627                writer.WriteStringValue(Location);
 28            }
 1629            if (Etag != null)
 30            {
 031                writer.WritePropertyName("etag");
 032                writer.WriteStringValue(Etag);
 33            }
 1634            if (Id != null)
 35            {
 036                writer.WritePropertyName("id");
 037                writer.WriteStringValue(Id);
 38            }
 1639            writer.WritePropertyName("properties");
 1640            writer.WriteStartObject();
 1641            if (Access != null)
 42            {
 1643                writer.WritePropertyName("access");
 1644                writer.WriteStringValue(Access.Value.ToString());
 45            }
 1646            if (RouteFilterRuleType != null)
 47            {
 1648                writer.WritePropertyName("routeFilterRuleType");
 1649                writer.WriteStringValue(RouteFilterRuleType);
 50            }
 1651            if (Communities != null)
 52            {
 1653                writer.WritePropertyName("communities");
 1654                writer.WriteStartArray();
 6455                foreach (var item in Communities)
 56                {
 1657                    writer.WriteStringValue(item);
 58                }
 1659                writer.WriteEndArray();
 60            }
 1661            if (ProvisioningState != null)
 62            {
 063                writer.WritePropertyName("provisioningState");
 064                writer.WriteStringValue(ProvisioningState.Value.ToString());
 65            }
 1666            writer.WriteEndObject();
 1667            writer.WriteEndObject();
 1668        }
 69
 70        internal static RouteFilterRule DeserializeRouteFilterRule(JsonElement element)
 71        {
 1672            string name = default;
 1673            string location = default;
 1674            string etag = default;
 1675            string id = default;
 1676            Access? access = default;
 1677            string routeFilterRuleType = default;
 1678            IList<string> communities = default;
 1679            ProvisioningState? provisioningState = default;
 19280            foreach (var property in element.EnumerateObject())
 81            {
 8082                if (property.NameEquals("name"))
 83                {
 1684                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 1688                    name = property.Value.GetString();
 1689                    continue;
 90                }
 6491                if (property.NameEquals("location"))
 92                {
 093                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 097                    location = property.Value.GetString();
 098                    continue;
 99                }
 64100                if (property.NameEquals("etag"))
 101                {
 16102                    if (property.Value.ValueKind == JsonValueKind.Null)
 103                    {
 104                        continue;
 105                    }
 16106                    etag = property.Value.GetString();
 16107                    continue;
 108                }
 48109                if (property.NameEquals("id"))
 110                {
 16111                    if (property.Value.ValueKind == JsonValueKind.Null)
 112                    {
 113                        continue;
 114                    }
 16115                    id = property.Value.GetString();
 16116                    continue;
 117                }
 32118                if (property.NameEquals("properties"))
 119                {
 160120                    foreach (var property0 in property.Value.EnumerateObject())
 121                    {
 64122                        if (property0.NameEquals("access"))
 123                        {
 16124                            if (property0.Value.ValueKind == JsonValueKind.Null)
 125                            {
 126                                continue;
 127                            }
 16128                            access = new Access(property0.Value.GetString());
 16129                            continue;
 130                        }
 48131                        if (property0.NameEquals("routeFilterRuleType"))
 132                        {
 16133                            if (property0.Value.ValueKind == JsonValueKind.Null)
 134                            {
 135                                continue;
 136                            }
 16137                            routeFilterRuleType = property0.Value.GetString();
 16138                            continue;
 139                        }
 32140                        if (property0.NameEquals("communities"))
 141                        {
 16142                            if (property0.Value.ValueKind == JsonValueKind.Null)
 143                            {
 144                                continue;
 145                            }
 16146                            List<string> array = new List<string>();
 64147                            foreach (var item in property0.Value.EnumerateArray())
 148                            {
 16149                                if (item.ValueKind == JsonValueKind.Null)
 150                                {
 0151                                    array.Add(null);
 152                                }
 153                                else
 154                                {
 16155                                    array.Add(item.GetString());
 156                                }
 157                            }
 16158                            communities = array;
 16159                            continue;
 160                        }
 16161                        if (property0.NameEquals("provisioningState"))
 162                        {
 16163                            if (property0.Value.ValueKind == JsonValueKind.Null)
 164                            {
 165                                continue;
 166                            }
 16167                            provisioningState = new ProvisioningState(property0.Value.GetString());
 168                            continue;
 169                        }
 170                    }
 171                    continue;
 172                }
 173            }
 16174            return new RouteFilterRule(id, name, location, etag, access, routeFilterRuleType, communities, provisioningS
 175        }
 176    }
 177}