Пример #1
0
        internal static TlsEndpoint DeserializeTlsEndpoint(JsonElement element)
        {
            Optional <CertificateSource>    trustedCertificates = default;
            Optional <TlsValidationOptions> validationOptions   = default;
            string type = default;
            Optional <CredentialsBase> credentials = default;
            string url = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("trustedCertificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    trustedCertificates = CertificateSource.DeserializeCertificateSource(property.Value);
                    continue;
                }
                if (property.NameEquals("validationOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    validationOptions = TlsValidationOptions.DeserializeTlsValidationOptions(property.Value);
                    continue;
                }
                if (property.NameEquals("@type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    credentials = CredentialsBase.DeserializeCredentialsBase(property.Value);
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    url = property.Value.GetString();
                    continue;
                }
            }
            return(new TlsEndpoint(type, credentials.Value, url, trustedCertificates.Value, validationOptions.Value));
        }
Пример #2
0
 internal TlsEndpoint(string type, CredentialsBase credentials, string url, CertificateSource trustedCertificates, TlsValidationOptions validationOptions) : base(type, credentials, url)
 {
     TrustedCertificates = trustedCertificates;
     ValidationOptions   = validationOptions;
     Type = type ?? "#Microsoft.VideoAnalyzer.TlsEndpoint";
 }