internal static SecurityRuleListResult DeserializeSecurityRuleListResult(JsonElement element)
        {
            Optional <IReadOnlyList <SecurityRule> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SecurityRule.DeserializeSecurityRule(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new SecurityRuleListResult(Optional.ToList(value), nextLink.Value));
        }
        internal static NetworkInterfaceAssociation DeserializeNetworkInterfaceAssociation(JsonElement element)
        {
            Optional <string> id = default;
            Optional <IReadOnlyList <SecurityRule> > securityRules = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("securityRules"))
                {
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SecurityRule.DeserializeSecurityRule(item));
                    }
                    securityRules = array;
                    continue;
                }
            }
            return(new NetworkInterfaceAssociation(id.Value, Optional.ToList(securityRules)));
        }
        internal static SecurityRuleAssociations DeserializeSecurityRuleAssociations(JsonElement element)
        {
            Optional <NetworkInterfaceAssociation>   networkInterfaceAssociation            = default;
            Optional <SubnetAssociation>             subnetAssociation                      = default;
            Optional <IReadOnlyList <SecurityRule> > defaultSecurityRules                   = default;
            Optional <IReadOnlyList <EffectiveNetworkSecurityRule> > effectiveSecurityRules = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkInterfaceAssociation"))
                {
                    networkInterfaceAssociation = NetworkInterfaceAssociation.DeserializeNetworkInterfaceAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("subnetAssociation"))
                {
                    subnetAssociation = SubnetAssociation.DeserializeSubnetAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultSecurityRules"))
                {
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SecurityRule.DeserializeSecurityRule(item));
                    }
                    defaultSecurityRules = array;
                    continue;
                }
                if (property.NameEquals("effectiveSecurityRules"))
                {
                    List <EffectiveNetworkSecurityRule> array = new List <EffectiveNetworkSecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EffectiveNetworkSecurityRule.DeserializeEffectiveNetworkSecurityRule(item));
                    }
                    effectiveSecurityRules = array;
                    continue;
                }
            }
            return(new SecurityRuleAssociations(networkInterfaceAssociation.Value, subnetAssociation.Value, Optional.ToList(defaultSecurityRules), Optional.ToList(effectiveSecurityRules)));
        }
示例#4
0
        internal static NetworkInterfaceAssociation DeserializeNetworkInterfaceAssociation(JsonElement element)
        {
            string id = default;
            IReadOnlyList <SecurityRule> securityRules = 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("securityRules"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(SecurityRule.DeserializeSecurityRule(item));
                        }
                    }
                    securityRules = array;
                    continue;
                }
            }
            return(new NetworkInterfaceAssociation(id, securityRules));
        }
示例#5
0
        internal static SecurityRuleListResult DeserializeSecurityRuleListResult(JsonElement element)
        {
            IReadOnlyList <SecurityRule> value = default;
            string nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(SecurityRule.DeserializeSecurityRule(item));
                        }
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new SecurityRuleListResult(value, nextLink));
        }
示例#6
0
        internal static NetworkSecurityGroup DeserializeNetworkSecurityGroup(JsonElement element)
        {
            Optional <string> etag     = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            Optional <string> location = default;
            Optional <IDictionary <string, string> >     tags                 = default;
            Optional <IList <SecurityRule> >             securityRules        = default;
            Optional <IReadOnlyList <SecurityRule> >     defaultSecurityRules = default;
            Optional <IReadOnlyList <NetworkInterface> > networkInterfaces    = default;
            Optional <IReadOnlyList <Subnet> >           subnets              = default;
            Optional <IReadOnlyList <FlowLog> >          flowLogs             = default;
            Optional <string>            resourceGuid      = default;
            Optional <ProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                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("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("securityRules"))
                        {
                            List <SecurityRule> array = new List <SecurityRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SecurityRule.DeserializeSecurityRule(item));
                            }
                            securityRules = array;
                            continue;
                        }
                        if (property0.NameEquals("defaultSecurityRules"))
                        {
                            List <SecurityRule> array = new List <SecurityRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SecurityRule.DeserializeSecurityRule(item));
                            }
                            defaultSecurityRules = array;
                            continue;
                        }
                        if (property0.NameEquals("networkInterfaces"))
                        {
                            List <NetworkInterface> array = new List <NetworkInterface>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NetworkInterface.DeserializeNetworkInterface(item));
                            }
                            networkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("subnets"))
                        {
                            List <Subnet> array = new List <Subnet>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Subnet.DeserializeSubnet(item));
                            }
                            subnets = array;
                            continue;
                        }
                        if (property0.NameEquals("flowLogs"))
                        {
                            List <FlowLog> array = new List <FlowLog>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FlowLog.DeserializeFlowLog(item));
                            }
                            flowLogs = array;
                            continue;
                        }
                        if (property0.NameEquals("resourceGuid"))
                        {
                            resourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new NetworkSecurityGroup(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(securityRules), Optional.ToList(defaultSecurityRules), Optional.ToList(networkInterfaces), Optional.ToList(subnets), Optional.ToList(flowLogs), resourceGuid.Value, Optional.ToNullable(provisioningState)));
        }
        internal static NetworkSecurityGroup DeserializeNetworkSecurityGroup(JsonElement element)
        {
            string etag     = default;
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string> tags                 = default;
            IList <SecurityRule>         securityRules        = default;
            IList <SecurityRule>         defaultSecurityRules = default;
            IList <NetworkInterface>     networkInterfaces    = default;
            IList <Subnet>    subnets           = default;
            IList <FlowLog>   flowLogs          = default;
            string            resourceGuid      = default;
            ProvisioningState?provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                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("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("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("securityRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <SecurityRule> array = new List <SecurityRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(SecurityRule.DeserializeSecurityRule(item));
                                }
                            }
                            securityRules = array;
                            continue;
                        }
                        if (property0.NameEquals("defaultSecurityRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <SecurityRule> array = new List <SecurityRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(SecurityRule.DeserializeSecurityRule(item));
                                }
                            }
                            defaultSecurityRules = array;
                            continue;
                        }
                        if (property0.NameEquals("networkInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <NetworkInterface> array = new List <NetworkInterface>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(NetworkInterface.DeserializeNetworkInterface(item));
                                }
                            }
                            networkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("subnets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <Subnet> array = new List <Subnet>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(Subnet.DeserializeSubnet(item));
                                }
                            }
                            subnets = array;
                            continue;
                        }
                        if (property0.NameEquals("flowLogs"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <FlowLog> array = new List <FlowLog>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(FlowLog.DeserializeFlowLog(item));
                                }
                            }
                            flowLogs = array;
                            continue;
                        }
                        if (property0.NameEquals("resourceGuid"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            resourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new NetworkSecurityGroup(id, name, type, location, tags, etag, securityRules, defaultSecurityRules, networkInterfaces, subnets, flowLogs, resourceGuid, provisioningState));
        }
        internal static SecurityRuleAssociations DeserializeSecurityRuleAssociations(JsonElement element)
        {
            NetworkInterfaceAssociation  networkInterfaceAssociation            = default;
            SubnetAssociation            subnetAssociation                      = default;
            IReadOnlyList <SecurityRule> defaultSecurityRules                   = default;
            IReadOnlyList <EffectiveNetworkSecurityRule> effectiveSecurityRules = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkInterfaceAssociation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkInterfaceAssociation = NetworkInterfaceAssociation.DeserializeNetworkInterfaceAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("subnetAssociation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    subnetAssociation = SubnetAssociation.DeserializeSubnetAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultSecurityRules"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(SecurityRule.DeserializeSecurityRule(item));
                        }
                    }
                    defaultSecurityRules = array;
                    continue;
                }
                if (property.NameEquals("effectiveSecurityRules"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EffectiveNetworkSecurityRule> array = new List <EffectiveNetworkSecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(EffectiveNetworkSecurityRule.DeserializeEffectiveNetworkSecurityRule(item));
                        }
                    }
                    effectiveSecurityRules = array;
                    continue;
                }
            }
            return(new SecurityRuleAssociations(networkInterfaceAssociation, subnetAssociation, defaultSecurityRules, effectiveSecurityRules));
        }