示例#1
0
        internal static FirewallPolicyTransportSecurity DeserializeFirewallPolicyTransportSecurity(JsonElement element)
        {
            Optional <FirewallPolicyCertificateAuthority> certificateAuthority = default;
            Optional <IList <string> > excludedDomains = default;
            Optional <IList <FirewallPolicyTrustedRootCertificate> > trustedRootCertificates = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("certificateAuthority"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    certificateAuthority = FirewallPolicyCertificateAuthority.DeserializeFirewallPolicyCertificateAuthority(property.Value);
                    continue;
                }
                if (property.NameEquals("excludedDomains"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    excludedDomains = array;
                    continue;
                }
                if (property.NameEquals("trustedRootCertificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <FirewallPolicyTrustedRootCertificate> array = new List <FirewallPolicyTrustedRootCertificate>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(FirewallPolicyTrustedRootCertificate.DeserializeFirewallPolicyTrustedRootCertificate(item));
                    }
                    trustedRootCertificates = array;
                    continue;
                }
            }
            return(new FirewallPolicyTransportSecurity(certificateAuthority.Value, Optional.ToList(excludedDomains), Optional.ToList(trustedRootCertificates)));
        }
        internal static FirewallPolicyTransportSecurity DeserializeFirewallPolicyTransportSecurity(JsonElement element)
        {
            FirewallPolicyCertificateAuthority certificateAuthority = default;
            IList <string> excludedDomains = default;
            IList <FirewallPolicyTrustedRootCertificate> trustedRootCertificates = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("certificateAuthority"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    certificateAuthority = FirewallPolicyCertificateAuthority.DeserializeFirewallPolicyCertificateAuthority(property.Value);
                    continue;
                }
                if (property.NameEquals("excludedDomains"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetString());
                        }
                    }
                    excludedDomains = array;
                    continue;
                }
                if (property.NameEquals("trustedRootCertificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <FirewallPolicyTrustedRootCertificate> array = new List <FirewallPolicyTrustedRootCertificate>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(FirewallPolicyTrustedRootCertificate.DeserializeFirewallPolicyTrustedRootCertificate(item));
                        }
                    }
                    trustedRootCertificates = array;
                    continue;
                }
            }
            return(new FirewallPolicyTransportSecurity(certificateAuthority, excludedDomains, trustedRootCertificates));
        }