internal static MediaGraphUnsecuredEndpoint DeserializeMediaGraphUnsecuredEndpoint(JsonElement element) { string type = default; Optional <MediaGraphCredentials> credentials = default; string url = default; foreach (var property in element.EnumerateObject()) { 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 MediaGraphUnsecuredEndpoint(type, credentials.Value, url)); }
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)); }
internal static MediaGraphEndpoint DeserializeMediaGraphEndpoint(JsonElement element) { if (element.TryGetProperty("@type", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "#Microsoft.Media.MediaGraphTlsEndpoint": return(MediaGraphTlsEndpoint.DeserializeMediaGraphTlsEndpoint(element)); case "#Microsoft.Media.MediaGraphUnsecuredEndpoint": return(MediaGraphUnsecuredEndpoint.DeserializeMediaGraphUnsecuredEndpoint(element)); } } string type = default; Optional <MediaGraphCredentials> credentials = default; string url = default; foreach (var property in element.EnumerateObject()) { 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 MediaGraphEndpoint(type, credentials.Value, url)); }
internal MediaGraphEndpoint(string type, MediaGraphCredentials credentials, string url) { Type = type; Credentials = credentials; Url = url; }
internal MediaGraphUnsecuredEndpoint(string type, MediaGraphCredentials credentials, string url) : base(type, credentials, url) { Type = type ?? "#Microsoft.Media.MediaGraphUnsecuredEndpoint"; }
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"; }