< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Etag()-0%100%
get_ResourceGuid()-0%100%
get_ProvisioningState()-0%100%
get_PublicIPAddresses()-0%100%
get_ProtocolCustomSettings()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeDdosCustomPolicy(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\DdosCustomPolicy.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 DDoS custom policy in a resource group. </summary>
 13    public partial class DdosCustomPolicy : Resource
 14    {
 15        /// <summary> Initializes a new instance of DdosCustomPolicy. </summary>
 016        public DdosCustomPolicy()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of DdosCustomPolicy. </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="resourceGuid"> The resource GUID property of the DDoS custom policy resource. It uniquely ident
 28        /// <param name="provisioningState"> The provisioning state of the DDoS custom policy resource. </param>
 29        /// <param name="publicIPAddresses"> The list of public IPs associated with the DDoS custom policy resource. Thi
 30        /// <param name="protocolCustomSettings"> The protocol-specific DDoS policy customization parameters. </param>
 031        internal DdosCustomPolicy(string id, string name, string type, string location, IDictionary<string, string> tags
 32        {
 033            Etag = etag;
 034            ResourceGuid = resourceGuid;
 035            ProvisioningState = provisioningState;
 036            PublicIPAddresses = publicIPAddresses;
 037            ProtocolCustomSettings = protocolCustomSettings;
 038        }
 39
 40        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 041        public string Etag { get; }
 42        /// <summary> The resource GUID property of the DDoS custom policy resource. It uniquely identifies the resource
 043        public string ResourceGuid { get; }
 44        /// <summary> The provisioning state of the DDoS custom policy resource. </summary>
 045        public ProvisioningState? ProvisioningState { get; }
 46        /// <summary> The list of public IPs associated with the DDoS custom policy resource. This list is read-only. </
 047        public IList<SubResource> PublicIPAddresses { get; }
 48        /// <summary> The protocol-specific DDoS policy customization parameters. </summary>
 049        public IList<ProtocolCustomSettingsFormat> ProtocolCustomSettings { get; set; }
 50    }
 51}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\DdosCustomPolicy.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 DdosCustomPolicy : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Etag != null)
 20            {
 021                writer.WritePropertyName("etag");
 022                writer.WriteStringValue(Etag);
 23            }
 024            if (Id != null)
 25            {
 026                writer.WritePropertyName("id");
 027                writer.WriteStringValue(Id);
 28            }
 029            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 034            if (Type != null)
 35            {
 036                writer.WritePropertyName("type");
 037                writer.WriteStringValue(Type);
 38            }
 039            if (Location != null)
 40            {
 041                writer.WritePropertyName("location");
 042                writer.WriteStringValue(Location);
 43            }
 044            if (Tags != null)
 45            {
 046                writer.WritePropertyName("tags");
 047                writer.WriteStartObject();
 048                foreach (var item in Tags)
 49                {
 050                    writer.WritePropertyName(item.Key);
 051                    writer.WriteStringValue(item.Value);
 52                }
 053                writer.WriteEndObject();
 54            }
 055            writer.WritePropertyName("properties");
 056            writer.WriteStartObject();
 057            if (ResourceGuid != null)
 58            {
 059                writer.WritePropertyName("resourceGuid");
 060                writer.WriteStringValue(ResourceGuid);
 61            }
 062            if (ProvisioningState != null)
 63            {
 064                writer.WritePropertyName("provisioningState");
 065                writer.WriteStringValue(ProvisioningState.Value.ToString());
 66            }
 067            if (PublicIPAddresses != null)
 68            {
 069                writer.WritePropertyName("publicIPAddresses");
 070                writer.WriteStartArray();
 071                foreach (var item in PublicIPAddresses)
 72                {
 073                    writer.WriteObjectValue(item);
 74                }
 075                writer.WriteEndArray();
 76            }
 077            if (ProtocolCustomSettings != null)
 78            {
 079                writer.WritePropertyName("protocolCustomSettings");
 080                writer.WriteStartArray();
 081                foreach (var item in ProtocolCustomSettings)
 82                {
 083                    writer.WriteObjectValue(item);
 84                }
 085                writer.WriteEndArray();
 86            }
 087            writer.WriteEndObject();
 088            writer.WriteEndObject();
 089        }
 90
 91        internal static DdosCustomPolicy DeserializeDdosCustomPolicy(JsonElement element)
 92        {
 093            string etag = default;
 094            string id = default;
 095            string name = default;
 096            string type = default;
 097            string location = default;
 098            IDictionary<string, string> tags = default;
 099            string resourceGuid = default;
 0100            ProvisioningState? provisioningState = default;
 0101            IList<SubResource> publicIPAddresses = default;
 0102            IList<ProtocolCustomSettingsFormat> protocolCustomSettings = default;
 0103            foreach (var property in element.EnumerateObject())
 104            {
 0105                if (property.NameEquals("etag"))
 106                {
 0107                    if (property.Value.ValueKind == JsonValueKind.Null)
 108                    {
 109                        continue;
 110                    }
 0111                    etag = property.Value.GetString();
 0112                    continue;
 113                }
 0114                if (property.NameEquals("id"))
 115                {
 0116                    if (property.Value.ValueKind == JsonValueKind.Null)
 117                    {
 118                        continue;
 119                    }
 0120                    id = property.Value.GetString();
 0121                    continue;
 122                }
 0123                if (property.NameEquals("name"))
 124                {
 0125                    if (property.Value.ValueKind == JsonValueKind.Null)
 126                    {
 127                        continue;
 128                    }
 0129                    name = property.Value.GetString();
 0130                    continue;
 131                }
 0132                if (property.NameEquals("type"))
 133                {
 0134                    if (property.Value.ValueKind == JsonValueKind.Null)
 135                    {
 136                        continue;
 137                    }
 0138                    type = property.Value.GetString();
 0139                    continue;
 140                }
 0141                if (property.NameEquals("location"))
 142                {
 0143                    if (property.Value.ValueKind == JsonValueKind.Null)
 144                    {
 145                        continue;
 146                    }
 0147                    location = property.Value.GetString();
 0148                    continue;
 149                }
 0150                if (property.NameEquals("tags"))
 151                {
 0152                    if (property.Value.ValueKind == JsonValueKind.Null)
 153                    {
 154                        continue;
 155                    }
 0156                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0157                    foreach (var property0 in property.Value.EnumerateObject())
 158                    {
 0159                        if (property0.Value.ValueKind == JsonValueKind.Null)
 160                        {
 0161                            dictionary.Add(property0.Name, null);
 162                        }
 163                        else
 164                        {
 0165                            dictionary.Add(property0.Name, property0.Value.GetString());
 166                        }
 167                    }
 0168                    tags = dictionary;
 0169                    continue;
 170                }
 0171                if (property.NameEquals("properties"))
 172                {
 0173                    foreach (var property0 in property.Value.EnumerateObject())
 174                    {
 0175                        if (property0.NameEquals("resourceGuid"))
 176                        {
 0177                            if (property0.Value.ValueKind == JsonValueKind.Null)
 178                            {
 179                                continue;
 180                            }
 0181                            resourceGuid = property0.Value.GetString();
 0182                            continue;
 183                        }
 0184                        if (property0.NameEquals("provisioningState"))
 185                        {
 0186                            if (property0.Value.ValueKind == JsonValueKind.Null)
 187                            {
 188                                continue;
 189                            }
 0190                            provisioningState = new ProvisioningState(property0.Value.GetString());
 0191                            continue;
 192                        }
 0193                        if (property0.NameEquals("publicIPAddresses"))
 194                        {
 0195                            if (property0.Value.ValueKind == JsonValueKind.Null)
 196                            {
 197                                continue;
 198                            }
 0199                            List<SubResource> array = new List<SubResource>();
 0200                            foreach (var item in property0.Value.EnumerateArray())
 201                            {
 0202                                if (item.ValueKind == JsonValueKind.Null)
 203                                {
 0204                                    array.Add(null);
 205                                }
 206                                else
 207                                {
 0208                                    array.Add(SubResource.DeserializeSubResource(item));
 209                                }
 210                            }
 0211                            publicIPAddresses = array;
 0212                            continue;
 213                        }
 0214                        if (property0.NameEquals("protocolCustomSettings"))
 215                        {
 0216                            if (property0.Value.ValueKind == JsonValueKind.Null)
 217                            {
 218                                continue;
 219                            }
 0220                            List<ProtocolCustomSettingsFormat> array = new List<ProtocolCustomSettingsFormat>();
 0221                            foreach (var item in property0.Value.EnumerateArray())
 222                            {
 0223                                if (item.ValueKind == JsonValueKind.Null)
 224                                {
 0225                                    array.Add(null);
 226                                }
 227                                else
 228                                {
 0229                                    array.Add(ProtocolCustomSettingsFormat.DeserializeProtocolCustomSettingsFormat(item)
 230                                }
 231                            }
 0232                            protocolCustomSettings = array;
 233                            continue;
 234                        }
 235                    }
 236                    continue;
 237                }
 238            }
 0239            return new DdosCustomPolicy(id, name, type, location, tags, etag, resourceGuid, provisioningState, publicIPA
 240        }
 241    }
 242}