< Summary

Class:Azure.ResourceManager.Resources.Models.PolicySetDefinition
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicySetDefinition.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicySetDefinition.Serialization.cs
Covered lines:127
Uncovered lines:11
Coverable lines:138
Total lines:308
Line coverage:92% (127 of 138)
Covered branches:77
Total branches:84
Branch coverage:91.6% (77 of 84)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Id()-100%100%
get_Name()-100%100%
get_Type()-100%100%
get_PolicyType()-100%100%
get_DisplayName()-100%100%
get_Description()-100%100%
get_Metadata()-100%100%
get_Parameters()-100%100%
get_PolicyDefinitions()-100%100%
get_PolicyDefinitionGroups()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-82.61%84.62%
DeserializePolicySetDefinition(...)-95.59%94.83%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicySetDefinition.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.Resources.Models
 11{
 12    /// <summary> The policy set definition. </summary>
 13    public partial class PolicySetDefinition
 14    {
 15        /// <summary> Initializes a new instance of PolicySetDefinition. </summary>
 2416        public PolicySetDefinition()
 17        {
 2418        }
 19
 20        /// <summary> Initializes a new instance of PolicySetDefinition. </summary>
 21        /// <param name="id"> The ID of the policy set definition. </param>
 22        /// <param name="name"> The name of the policy set definition. </param>
 23        /// <param name="type"> The type of the resource (Microsoft.Authorization/policySetDefinitions). </param>
 24        /// <param name="policyType"> The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, 
 25        /// <param name="displayName"> The display name of the policy set definition. </param>
 26        /// <param name="description"> The policy set definition description. </param>
 27        /// <param name="metadata"> The policy set definition metadata.  Metadata is an open ended object and is typical
 28        /// <param name="parameters"> The policy set definition parameters that can be used in policy definition referen
 29        /// <param name="policyDefinitions"> An array of policy definition references. </param>
 30        /// <param name="policyDefinitionGroups"> The metadata describing groups of policy definition references within 
 144431        internal PolicySetDefinition(string id, string name, string type, PolicyType? policyType, string displayName, st
 32        {
 144433            Id = id;
 144434            Name = name;
 144435            Type = type;
 144436            PolicyType = policyType;
 144437            DisplayName = displayName;
 144438            Description = description;
 144439            Metadata = metadata;
 144440            Parameters = parameters;
 144441            PolicyDefinitions = policyDefinitions;
 144442            PolicyDefinitionGroups = policyDefinitionGroups;
 144443        }
 44
 45        /// <summary> The ID of the policy set definition. </summary>
 148846        public string Id { get; }
 47        /// <summary> The name of the policy set definition. </summary>
 347648        public string Name { get; }
 49        /// <summary> The type of the resource (Microsoft.Authorization/policySetDefinitions). </summary>
 204050        public string Type { get; }
 51        /// <summary> The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. </su
 294052        public PolicyType? PolicyType { get; set; }
 53        /// <summary> The display name of the policy set definition. </summary>
 304454        public string DisplayName { get; set; }
 55        /// <summary> The policy set definition description. </summary>
 294856        public string Description { get; set; }
 57        /// <summary> The policy set definition metadata.  Metadata is an open ended object and is typically a collectio
 206858        public object Metadata { get; set; }
 59        /// <summary> The policy set definition parameters that can be used in policy definition references. </summary>
 190060        public IDictionary<string, ParameterDefinitionsValue> Parameters { get; set; }
 61        /// <summary> An array of policy definition references. </summary>
 1181262        public IList<PolicyDefinitionReference> PolicyDefinitions { get; set; }
 63        /// <summary> The metadata describing groups of policy definition references within the policy set definition. <
 407264        public IList<PolicyDefinitionGroup> PolicyDefinitionGroups { get; set; }
 65    }
 66}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\PolicySetDefinition.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.Resources.Models
 13{
 14    public partial class PolicySetDefinition : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 3218            writer.WriteStartObject();
 3219            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 3224            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 3229            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 3234            writer.WritePropertyName("properties");
 3235            writer.WriteStartObject();
 3236            if (PolicyType != null)
 37            {
 038                writer.WritePropertyName("policyType");
 039                writer.WriteStringValue(PolicyType.Value.ToString());
 40            }
 3241            if (DisplayName != null)
 42            {
 3243                writer.WritePropertyName("displayName");
 3244                writer.WriteStringValue(DisplayName);
 45            }
 3246            if (Description != null)
 47            {
 848                writer.WritePropertyName("description");
 849                writer.WriteStringValue(Description);
 50            }
 3251            if (Metadata != null)
 52            {
 853                writer.WritePropertyName("metadata");
 854                writer.WriteObjectValue(Metadata);
 55            }
 3256            if (Parameters != null)
 57            {
 858                writer.WritePropertyName("parameters");
 859                writer.WriteStartObject();
 3260                foreach (var item in Parameters)
 61                {
 862                    writer.WritePropertyName(item.Key);
 863                    writer.WriteObjectValue(item.Value);
 64                }
 865                writer.WriteEndObject();
 66            }
 3267            if (PolicyDefinitions != null)
 68            {
 2869                writer.WritePropertyName("policyDefinitions");
 2870                writer.WriteStartArray();
 12871                foreach (var item in PolicyDefinitions)
 72                {
 3673                    writer.WriteObjectValue(item);
 74                }
 2875                writer.WriteEndArray();
 76            }
 3277            if (PolicyDefinitionGroups != null)
 78            {
 479                writer.WritePropertyName("policyDefinitionGroups");
 480                writer.WriteStartArray();
 2481                foreach (var item in PolicyDefinitionGroups)
 82                {
 883                    writer.WriteObjectValue(item);
 84                }
 485                writer.WriteEndArray();
 86            }
 3287            writer.WriteEndObject();
 3288            writer.WriteEndObject();
 3289        }
 90
 91        internal static PolicySetDefinition DeserializePolicySetDefinition(JsonElement element)
 92        {
 144493            string id = default;
 144494            string name = default;
 144495            string type = default;
 144496            PolicyType? policyType = default;
 144497            string displayName = default;
 144498            string description = default;
 144499            object metadata = default;
 1444100            IDictionary<string, ParameterDefinitionsValue> parameters = default;
 1444101            IList<PolicyDefinitionReference> policyDefinitions = default;
 1444102            IList<PolicyDefinitionGroup> policyDefinitionGroups = default;
 14440103            foreach (var property in element.EnumerateObject())
 104            {
 5776105                if (property.NameEquals("id"))
 106                {
 1444107                    if (property.Value.ValueKind == JsonValueKind.Null)
 108                    {
 109                        continue;
 110                    }
 1444111                    id = property.Value.GetString();
 1444112                    continue;
 113                }
 4332114                if (property.NameEquals("name"))
 115                {
 1444116                    if (property.Value.ValueKind == JsonValueKind.Null)
 117                    {
 118                        continue;
 119                    }
 1444120                    name = property.Value.GetString();
 1444121                    continue;
 122                }
 2888123                if (property.NameEquals("type"))
 124                {
 1444125                    if (property.Value.ValueKind == JsonValueKind.Null)
 126                    {
 127                        continue;
 128                    }
 1444129                    type = property.Value.GetString();
 1444130                    continue;
 131                }
 1444132                if (property.NameEquals("properties"))
 133                {
 20136134                    foreach (var property0 in property.Value.EnumerateObject())
 135                    {
 8624136                        if (property0.NameEquals("policyType"))
 137                        {
 1444138                            if (property0.Value.ValueKind == JsonValueKind.Null)
 139                            {
 140                                continue;
 141                            }
 1444142                            policyType = new PolicyType(property0.Value.GetString());
 1444143                            continue;
 144                        }
 7180145                        if (property0.NameEquals("displayName"))
 146                        {
 1444147                            if (property0.Value.ValueKind == JsonValueKind.Null)
 148                            {
 149                                continue;
 150                            }
 1444151                            displayName = property0.Value.GetString();
 1444152                            continue;
 153                        }
 5736154                        if (property0.NameEquals("description"))
 155                        {
 1424156                            if (property0.Value.ValueKind == JsonValueKind.Null)
 157                            {
 158                                continue;
 159                            }
 1424160                            description = property0.Value.GetString();
 1424161                            continue;
 162                        }
 4312163                        if (property0.NameEquals("metadata"))
 164                        {
 1444165                            if (property0.Value.ValueKind == JsonValueKind.Null)
 166                            {
 167                                continue;
 168                            }
 1444169                            metadata = property0.Value.GetObject();
 1444170                            continue;
 171                        }
 2868172                        if (property0.NameEquals("parameters"))
 173                        {
 1320174                            if (property0.Value.ValueKind == JsonValueKind.Null)
 175                            {
 176                                continue;
 177                            }
 1320178                            Dictionary<string, ParameterDefinitionsValue> dictionary = new Dictionary<string, ParameterD
 38496179                            foreach (var property1 in property0.Value.EnumerateObject())
 180                            {
 17928181                                if (property1.Value.ValueKind == JsonValueKind.Null)
 182                                {
 0183                                    dictionary.Add(property1.Name, null);
 184                                }
 185                                else
 186                                {
 17928187                                    dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinit
 188                                }
 189                            }
 1320190                            parameters = dictionary;
 1320191                            continue;
 192                        }
 1548193                        if (property0.NameEquals("policyDefinitions"))
 194                        {
 1444195                            if (property0.Value.ValueKind == JsonValueKind.Null)
 196                            {
 197                                continue;
 198                            }
 1444199                            List<PolicyDefinitionReference> array = new List<PolicyDefinitionReference>();
 136432200                            foreach (var item in property0.Value.EnumerateArray())
 201                            {
 66772202                                if (item.ValueKind == JsonValueKind.Null)
 203                                {
 0204                                    array.Add(null);
 205                                }
 206                                else
 207                                {
 66772208                                    array.Add(PolicyDefinitionReference.DeserializePolicyDefinitionReference(item));
 209                                }
 210                            }
 1444211                            policyDefinitions = array;
 1444212                            continue;
 213                        }
 104214                        if (property0.NameEquals("policyDefinitionGroups"))
 215                        {
 104216                            if (property0.Value.ValueKind == JsonValueKind.Null)
 217                            {
 218                                continue;
 219                            }
 104220                            List<PolicyDefinitionGroup> array = new List<PolicyDefinitionGroup>();
 34992221                            foreach (var item in property0.Value.EnumerateArray())
 222                            {
 17392223                                if (item.ValueKind == JsonValueKind.Null)
 224                                {
 0225                                    array.Add(null);
 226                                }
 227                                else
 228                                {
 17392229                                    array.Add(PolicyDefinitionGroup.DeserializePolicyDefinitionGroup(item));
 230                                }
 231                            }
 104232                            policyDefinitionGroups = array;
 233                            continue;
 234                        }
 235                    }
 236                    continue;
 237                }
 238            }
 1444239            return new PolicySetDefinition(id, name, type, policyType, displayName, description, metadata, parameters, p
 240        }
 241    }
 242}