예제 #1
0
 internal AzureFirewallNatRuleCollectionData(ResourceIdentifier id, string name, ResourceType?resourceType, ETag?etag, int?priority, AzureFirewallNatRCAction action, IList <AzureFirewallNatRule> rules, NetworkProvisioningState?provisioningState) : base(id, name, resourceType)
 {
     Etag              = etag;
     Priority          = priority;
     Action            = action;
     Rules             = rules;
     ProvisioningState = provisioningState;
 }
예제 #2
0
 internal AzureFirewallNatRuleCollection(string id, string name, string etag, int?priority, AzureFirewallNatRCAction action, IList <AzureFirewallNatRule> rules, ProvisioningState?provisioningState) : base(id)
 {
     Name              = name;
     Etag              = etag;
     Priority          = priority;
     Action            = action;
     Rules             = rules;
     ProvisioningState = provisioningState;
 }
예제 #3
0
        internal static AzureFirewallNatRuleCollection DeserializeAzureFirewallNatRuleCollection(JsonElement element)
        {
            Optional <string> name     = default;
            Optional <string> etag     = default;
            Optional <string> id       = default;
            Optional <int>    priority = default;
            Optional <AzureFirewallNatRCAction>      action            = default;
            Optional <IList <AzureFirewallNatRule> > rules             = default;
            Optional <ProvisioningState>             provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("priority"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            priority = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("action"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            action = AzureFirewallNatRCAction.DeserializeAzureFirewallNatRCAction(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("rules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureFirewallNatRule> array = new List <AzureFirewallNatRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallNatRule.DeserializeAzureFirewallNatRule(item));
                            }
                            rules = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AzureFirewallNatRuleCollection(id.Value, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)));
        }
예제 #4
0
        internal static AzureFirewallNatRuleCollection DeserializeAzureFirewallNatRuleCollection(JsonElement element)
        {
            string name     = default;
            string etag     = default;
            string id       = default;
            int?   priority = default;
            AzureFirewallNatRCAction     action            = default;
            IList <AzureFirewallNatRule> rules             = default;
            ProvisioningState?           provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("priority"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            priority = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("action"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            action = AzureFirewallNatRCAction.DeserializeAzureFirewallNatRCAction(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("rules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallNatRule> array = new List <AzureFirewallNatRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallNatRule.DeserializeAzureFirewallNatRule(item));
                                }
                            }
                            rules = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AzureFirewallNatRuleCollection(id, name, etag, priority, action, rules, provisioningState));
        }