internal static PolicySetDefinition DeserializePolicySetDefinition(JsonElement element)
 {
     string id = default;
     string name = default;
     string type = default;
     PolicyType? policyType = default;
     string displayName = default;
     string description = default;
     object metadata = default;
     IDictionary<string, ParameterDefinitionsValue> parameters = default;
     IList<PolicyDefinitionReference> policyDefinitions = default;
     IList<PolicyDefinitionGroup> policyDefinitionGroups = default;
     foreach (var property in element.EnumerateObject())
     {
         if (property.NameEquals("id"))
         {
             if (property.Value.ValueKind == JsonValueKind.Null)
             {
                 continue;
             }
             id = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("name"))
         {
             if (property.Value.ValueKind == JsonValueKind.Null)
             {
                 continue;
             }
             name = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("type"))
         {
             if (property.Value.ValueKind == JsonValueKind.Null)
             {
                 continue;
             }
             type = property.Value.GetString();
             continue;
         }
         if (property.NameEquals("properties"))
         {
             foreach (var property0 in property.Value.EnumerateObject())
             {
                 if (property0.NameEquals("policyType"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     policyType = new PolicyType(property0.Value.GetString());
                     continue;
                 }
                 if (property0.NameEquals("displayName"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     displayName = property0.Value.GetString();
                     continue;
                 }
                 if (property0.NameEquals("description"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     description = property0.Value.GetString();
                     continue;
                 }
                 if (property0.NameEquals("metadata"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     metadata = property0.Value.GetObject();
                     continue;
                 }
                 if (property0.NameEquals("parameters"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     Dictionary<string, ParameterDefinitionsValue> dictionary = new Dictionary<string, ParameterDefinitionsValue>();
                     foreach (var property1 in property0.Value.EnumerateObject())
                     {
                         if (property1.Value.ValueKind == JsonValueKind.Null)
                         {
                             dictionary.Add(property1.Name, null);
                         }
                         else
                         {
                             dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinitionsValue(property1.Value));
                         }
                     }
                     parameters = dictionary;
                     continue;
                 }
                 if (property0.NameEquals("policyDefinitions"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     List<PolicyDefinitionReference> array = new List<PolicyDefinitionReference>();
                     foreach (var item in property0.Value.EnumerateArray())
                     {
                         if (item.ValueKind == JsonValueKind.Null)
                         {
                             array.Add(null);
                         }
                         else
                         {
                             array.Add(PolicyDefinitionReference.DeserializePolicyDefinitionReference(item));
                         }
                     }
                     policyDefinitions = array;
                     continue;
                 }
                 if (property0.NameEquals("policyDefinitionGroups"))
                 {
                     if (property0.Value.ValueKind == JsonValueKind.Null)
                     {
                         continue;
                     }
                     List<PolicyDefinitionGroup> array = new List<PolicyDefinitionGroup>();
                     foreach (var item in property0.Value.EnumerateArray())
                     {
                         if (item.ValueKind == JsonValueKind.Null)
                         {
                             array.Add(null);
                         }
                         else
                         {
                             array.Add(PolicyDefinitionGroup.DeserializePolicyDefinitionGroup(item));
                         }
                     }
                     policyDefinitionGroups = array;
                     continue;
                 }
             }
             continue;
         }
     }
     return new PolicySetDefinition(id, name, type, policyType, displayName, description, metadata, parameters, policyDefinitions, policyDefinitionGroups);
 }
예제 #2
0
        internal static PolicySetDefinition DeserializePolicySetDefinition(JsonElement element)
        {
            Optional <string>     id          = default;
            Optional <string>     name        = default;
            Optional <string>     type        = default;
            Optional <PolicyType> policyType  = default;
            Optional <string>     displayName = default;
            Optional <string>     description = default;
            Optional <object>     metadata    = default;
            Optional <IDictionary <string, ParameterDefinitionsValue> > parameters = default;
            Optional <IList <PolicyDefinitionReference> > policyDefinitions        = default;
            Optional <IList <PolicyDefinitionGroup> >     policyDefinitionGroups   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("policyType"))
                        {
                            policyType = new PolicyType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("displayName"))
                        {
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("metadata"))
                        {
                            metadata = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("parameters"))
                        {
                            Dictionary <string, ParameterDefinitionsValue> dictionary = new Dictionary <string, ParameterDefinitionsValue>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinitionsValue(property1.Value));
                            }
                            parameters = dictionary;
                            continue;
                        }
                        if (property0.NameEquals("policyDefinitions"))
                        {
                            List <PolicyDefinitionReference> array = new List <PolicyDefinitionReference>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PolicyDefinitionReference.DeserializePolicyDefinitionReference(item));
                            }
                            policyDefinitions = array;
                            continue;
                        }
                        if (property0.NameEquals("policyDefinitionGroups"))
                        {
                            List <PolicyDefinitionGroup> array = new List <PolicyDefinitionGroup>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PolicyDefinitionGroup.DeserializePolicyDefinitionGroup(item));
                            }
                            policyDefinitionGroups = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PolicySetDefinition(id.Value, name.Value, type.Value, Optional.ToNullable(policyType), displayName.Value, description.Value, metadata.Value, Optional.ToDictionary(parameters), Optional.ToList(policyDefinitions), Optional.ToList(policyDefinitionGroups)));
        }
예제 #3
0
        internal static PolicyDefinition DeserializePolicyDefinition(JsonElement element)
        {
            Optional <string>     id          = default;
            Optional <string>     name        = default;
            Optional <string>     type        = default;
            Optional <PolicyType> policyType  = default;
            Optional <string>     mode        = default;
            Optional <string>     displayName = default;
            Optional <string>     description = default;
            Optional <object>     policyRule  = default;
            Optional <object>     metadata    = default;
            Optional <IDictionary <string, ParameterDefinitionsValue> > parameters = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("policyType"))
                        {
                            policyType = new PolicyType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("mode"))
                        {
                            mode = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("displayName"))
                        {
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("policyRule"))
                        {
                            policyRule = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("metadata"))
                        {
                            metadata = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("parameters"))
                        {
                            Dictionary <string, ParameterDefinitionsValue> dictionary = new Dictionary <string, ParameterDefinitionsValue>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinitionsValue(property1.Value));
                            }
                            parameters = dictionary;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PolicyDefinition(id.Value, name.Value, type.Value, Optional.ToNullable(policyType), mode.Value, displayName.Value, description.Value, policyRule.Value, metadata.Value, Optional.ToDictionary(parameters)));
        }
        internal static PolicyDefinition DeserializePolicyDefinition(JsonElement element)
        {
            string     id          = default;
            string     name        = default;
            string     type        = default;
            PolicyType?policyType  = default;
            string     mode        = default;
            string     displayName = default;
            string     description = default;
            object     policyRule  = default;
            object     metadata    = default;
            IDictionary <string, ParameterDefinitionsValue> parameters = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("policyType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            policyType = new PolicyType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("mode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            mode = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("displayName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("policyRule"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            policyRule = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("metadata"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            metadata = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("parameters"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            Dictionary <string, ParameterDefinitionsValue> dictionary = new Dictionary <string, ParameterDefinitionsValue>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                if (property1.Value.ValueKind == JsonValueKind.Null)
                                {
                                    dictionary.Add(property1.Name, null);
                                }
                                else
                                {
                                    dictionary.Add(property1.Name, ParameterDefinitionsValue.DeserializeParameterDefinitionsValue(property1.Value));
                                }
                            }
                            parameters = dictionary;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PolicyDefinition(id, name, type, policyType, mode, displayName, description, policyRule, metadata, parameters));
        }