internal static MediaGraphTlsEndpoint DeserializeMediaGraphTlsEndpoint(JsonElement element)
        {
            Optional <MediaGraphCertificateSource>    trustedCertificates = default;
            Optional <MediaGraphTlsValidationOptions> validationOptions   = default;
            string type = default;
            Optional <MediaGraphCredentials> 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 = MediaGraphCertificateSource.DeserializeMediaGraphCertificateSource(property.Value);
                    continue;
                }
                if (property.NameEquals("validationOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    validationOptions = MediaGraphTlsValidationOptions.DeserializeMediaGraphTlsValidationOptions(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 = MediaGraphCredentials.DeserializeMediaGraphCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    url = property.Value.GetString();
                    continue;
                }
            }
            return(new MediaGraphTlsEndpoint(type, credentials.Value, url, trustedCertificates.Value, validationOptions.Value));
        }
Exemplo n.º 2
0
 internal MediaGraphTlsEndpoint(string type, MediaGraphCredentials credentials, string url, MediaGraphCertificateSource trustedCertificates, MediaGraphTlsValidationOptions validationOptions) : base(type, credentials, url)
 {
     TrustedCertificates = trustedCertificates;
     ValidationOptions   = validationOptions;
     Type = type ?? "#Microsoft.Media.MediaGraphTlsEndpoint";
 }