< Summary

Class:Azure.ResourceManager.Network.Models.ApplicationRuleCondition
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ApplicationRuleCondition.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ApplicationRuleCondition.Serialization.cs
Covered lines:0
Uncovered lines:158
Coverable lines:158
Total lines:351
Line coverage:0% (0 of 158)
Covered branches:0
Total branches:100
Branch coverage:0% (0 of 100)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_SourceAddresses()-0%100%
get_DestinationAddresses()-0%100%
get_Protocols()-0%100%
get_TargetUrls()-0%100%
get_TargetFqdns()-0%100%
get_FqdnTags()-0%100%
get_SourceIpGroups()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeApplicationRuleCondition(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ApplicationRuleCondition.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> Rule condition of type application. </summary>
 13    public partial class ApplicationRuleCondition : FirewallPolicyRuleCondition
 14    {
 15        /// <summary> Initializes a new instance of ApplicationRuleCondition. </summary>
 016        public ApplicationRuleCondition()
 17        {
 018            RuleConditionType = FirewallPolicyRuleConditionType.ApplicationRuleCondition;
 019        }
 20
 21        /// <summary> Initializes a new instance of ApplicationRuleCondition. </summary>
 22        /// <param name="name"> Name of the rule condition. </param>
 23        /// <param name="description"> Description of the rule condition. </param>
 24        /// <param name="ruleConditionType"> Rule Condition Type. </param>
 25        /// <param name="sourceAddresses"> List of source IP addresses for this rule. </param>
 26        /// <param name="destinationAddresses"> List of destination IP addresses or Service Tags. </param>
 27        /// <param name="protocols"> Array of Application Protocols. </param>
 28        /// <param name="targetUrls"> List of Urls for this rule condition. </param>
 29        /// <param name="targetFqdns"> List of FQDNs for this rule condition. </param>
 30        /// <param name="fqdnTags"> List of FQDN Tags for this rule condition. </param>
 31        /// <param name="sourceIpGroups"> List of source IpGroups for this rule. </param>
 032        internal ApplicationRuleCondition(string name, string description, FirewallPolicyRuleConditionType ruleCondition
 33        {
 034            SourceAddresses = sourceAddresses;
 035            DestinationAddresses = destinationAddresses;
 036            Protocols = protocols;
 037            TargetUrls = targetUrls;
 038            TargetFqdns = targetFqdns;
 039            FqdnTags = fqdnTags;
 040            SourceIpGroups = sourceIpGroups;
 041            RuleConditionType = ruleConditionType;
 042        }
 43
 44        /// <summary> List of source IP addresses for this rule. </summary>
 045        public IList<string> SourceAddresses { get; set; }
 46        /// <summary> List of destination IP addresses or Service Tags. </summary>
 047        public IList<string> DestinationAddresses { get; set; }
 48        /// <summary> Array of Application Protocols. </summary>
 049        public IList<FirewallPolicyRuleConditionApplicationProtocol> Protocols { get; set; }
 50        /// <summary> List of Urls for this rule condition. </summary>
 051        public IList<string> TargetUrls { get; set; }
 52        /// <summary> List of FQDNs for this rule condition. </summary>
 053        public IList<string> TargetFqdns { get; set; }
 54        /// <summary> List of FQDN Tags for this rule condition. </summary>
 055        public IList<string> FqdnTags { get; set; }
 56        /// <summary> List of source IpGroups for this rule. </summary>
 057        public IList<string> SourceIpGroups { get; set; }
 58    }
 59}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ApplicationRuleCondition.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 ApplicationRuleCondition : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (SourceAddresses != null)
 20            {
 021                writer.WritePropertyName("sourceAddresses");
 022                writer.WriteStartArray();
 023                foreach (var item in SourceAddresses)
 24                {
 025                    writer.WriteStringValue(item);
 26                }
 027                writer.WriteEndArray();
 28            }
 029            if (DestinationAddresses != null)
 30            {
 031                writer.WritePropertyName("destinationAddresses");
 032                writer.WriteStartArray();
 033                foreach (var item in DestinationAddresses)
 34                {
 035                    writer.WriteStringValue(item);
 36                }
 037                writer.WriteEndArray();
 38            }
 039            if (Protocols != null)
 40            {
 041                writer.WritePropertyName("protocols");
 042                writer.WriteStartArray();
 043                foreach (var item in Protocols)
 44                {
 045                    writer.WriteObjectValue(item);
 46                }
 047                writer.WriteEndArray();
 48            }
 049            if (TargetUrls != null)
 50            {
 051                writer.WritePropertyName("targetUrls");
 052                writer.WriteStartArray();
 053                foreach (var item in TargetUrls)
 54                {
 055                    writer.WriteStringValue(item);
 56                }
 057                writer.WriteEndArray();
 58            }
 059            if (TargetFqdns != null)
 60            {
 061                writer.WritePropertyName("targetFqdns");
 062                writer.WriteStartArray();
 063                foreach (var item in TargetFqdns)
 64                {
 065                    writer.WriteStringValue(item);
 66                }
 067                writer.WriteEndArray();
 68            }
 069            if (FqdnTags != null)
 70            {
 071                writer.WritePropertyName("fqdnTags");
 072                writer.WriteStartArray();
 073                foreach (var item in FqdnTags)
 74                {
 075                    writer.WriteStringValue(item);
 76                }
 077                writer.WriteEndArray();
 78            }
 079            if (SourceIpGroups != null)
 80            {
 081                writer.WritePropertyName("sourceIpGroups");
 082                writer.WriteStartArray();
 083                foreach (var item in SourceIpGroups)
 84                {
 085                    writer.WriteStringValue(item);
 86                }
 087                writer.WriteEndArray();
 88            }
 089            if (Name != null)
 90            {
 091                writer.WritePropertyName("name");
 092                writer.WriteStringValue(Name);
 93            }
 094            if (Description != null)
 95            {
 096                writer.WritePropertyName("description");
 097                writer.WriteStringValue(Description);
 98            }
 099            writer.WritePropertyName("ruleConditionType");
 0100            writer.WriteStringValue(RuleConditionType.ToString());
 0101            writer.WriteEndObject();
 0102        }
 103
 104        internal static ApplicationRuleCondition DeserializeApplicationRuleCondition(JsonElement element)
 105        {
 0106            IList<string> sourceAddresses = default;
 0107            IList<string> destinationAddresses = default;
 0108            IList<FirewallPolicyRuleConditionApplicationProtocol> protocols = default;
 0109            IList<string> targetUrls = default;
 0110            IList<string> targetFqdns = default;
 0111            IList<string> fqdnTags = default;
 0112            IList<string> sourceIpGroups = default;
 0113            string name = default;
 0114            string description = default;
 0115            FirewallPolicyRuleConditionType ruleConditionType = default;
 0116            foreach (var property in element.EnumerateObject())
 117            {
 0118                if (property.NameEquals("sourceAddresses"))
 119                {
 0120                    if (property.Value.ValueKind == JsonValueKind.Null)
 121                    {
 122                        continue;
 123                    }
 0124                    List<string> array = new List<string>();
 0125                    foreach (var item in property.Value.EnumerateArray())
 126                    {
 0127                        if (item.ValueKind == JsonValueKind.Null)
 128                        {
 0129                            array.Add(null);
 130                        }
 131                        else
 132                        {
 0133                            array.Add(item.GetString());
 134                        }
 135                    }
 0136                    sourceAddresses = array;
 0137                    continue;
 138                }
 0139                if (property.NameEquals("destinationAddresses"))
 140                {
 0141                    if (property.Value.ValueKind == JsonValueKind.Null)
 142                    {
 143                        continue;
 144                    }
 0145                    List<string> array = new List<string>();
 0146                    foreach (var item in property.Value.EnumerateArray())
 147                    {
 0148                        if (item.ValueKind == JsonValueKind.Null)
 149                        {
 0150                            array.Add(null);
 151                        }
 152                        else
 153                        {
 0154                            array.Add(item.GetString());
 155                        }
 156                    }
 0157                    destinationAddresses = array;
 0158                    continue;
 159                }
 0160                if (property.NameEquals("protocols"))
 161                {
 0162                    if (property.Value.ValueKind == JsonValueKind.Null)
 163                    {
 164                        continue;
 165                    }
 0166                    List<FirewallPolicyRuleConditionApplicationProtocol> array = new List<FirewallPolicyRuleConditionApp
 0167                    foreach (var item in property.Value.EnumerateArray())
 168                    {
 0169                        if (item.ValueKind == JsonValueKind.Null)
 170                        {
 0171                            array.Add(null);
 172                        }
 173                        else
 174                        {
 0175                            array.Add(FirewallPolicyRuleConditionApplicationProtocol.DeserializeFirewallPolicyRuleCondit
 176                        }
 177                    }
 0178                    protocols = array;
 0179                    continue;
 180                }
 0181                if (property.NameEquals("targetUrls"))
 182                {
 0183                    if (property.Value.ValueKind == JsonValueKind.Null)
 184                    {
 185                        continue;
 186                    }
 0187                    List<string> array = new List<string>();
 0188                    foreach (var item in property.Value.EnumerateArray())
 189                    {
 0190                        if (item.ValueKind == JsonValueKind.Null)
 191                        {
 0192                            array.Add(null);
 193                        }
 194                        else
 195                        {
 0196                            array.Add(item.GetString());
 197                        }
 198                    }
 0199                    targetUrls = array;
 0200                    continue;
 201                }
 0202                if (property.NameEquals("targetFqdns"))
 203                {
 0204                    if (property.Value.ValueKind == JsonValueKind.Null)
 205                    {
 206                        continue;
 207                    }
 0208                    List<string> array = new List<string>();
 0209                    foreach (var item in property.Value.EnumerateArray())
 210                    {
 0211                        if (item.ValueKind == JsonValueKind.Null)
 212                        {
 0213                            array.Add(null);
 214                        }
 215                        else
 216                        {
 0217                            array.Add(item.GetString());
 218                        }
 219                    }
 0220                    targetFqdns = array;
 0221                    continue;
 222                }
 0223                if (property.NameEquals("fqdnTags"))
 224                {
 0225                    if (property.Value.ValueKind == JsonValueKind.Null)
 226                    {
 227                        continue;
 228                    }
 0229                    List<string> array = new List<string>();
 0230                    foreach (var item in property.Value.EnumerateArray())
 231                    {
 0232                        if (item.ValueKind == JsonValueKind.Null)
 233                        {
 0234                            array.Add(null);
 235                        }
 236                        else
 237                        {
 0238                            array.Add(item.GetString());
 239                        }
 240                    }
 0241                    fqdnTags = array;
 0242                    continue;
 243                }
 0244                if (property.NameEquals("sourceIpGroups"))
 245                {
 0246                    if (property.Value.ValueKind == JsonValueKind.Null)
 247                    {
 248                        continue;
 249                    }
 0250                    List<string> array = new List<string>();
 0251                    foreach (var item in property.Value.EnumerateArray())
 252                    {
 0253                        if (item.ValueKind == JsonValueKind.Null)
 254                        {
 0255                            array.Add(null);
 256                        }
 257                        else
 258                        {
 0259                            array.Add(item.GetString());
 260                        }
 261                    }
 0262                    sourceIpGroups = array;
 0263                    continue;
 264                }
 0265                if (property.NameEquals("name"))
 266                {
 0267                    if (property.Value.ValueKind == JsonValueKind.Null)
 268                    {
 269                        continue;
 270                    }
 0271                    name = property.Value.GetString();
 0272                    continue;
 273                }
 0274                if (property.NameEquals("description"))
 275                {
 0276                    if (property.Value.ValueKind == JsonValueKind.Null)
 277                    {
 278                        continue;
 279                    }
 0280                    description = property.Value.GetString();
 0281                    continue;
 282                }
 0283                if (property.NameEquals("ruleConditionType"))
 284                {
 0285                    ruleConditionType = new FirewallPolicyRuleConditionType(property.Value.GetString());
 286                    continue;
 287                }
 288            }
 0289            return new ApplicationRuleCondition(name, description, ruleConditionType, sourceAddresses, destinationAddres
 290        }
 291    }
 292}