internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGatewayRedirectConfiguration(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> type = default; Optional <string> id = default; Optional <ApplicationGatewayRedirectType> redirectType = default; Optional <WritableSubResource> targetListener = default; Optional <string> targetUrl = default; Optional <bool> includePath = default; Optional <bool> includeQueryString = default; Optional <IList <WritableSubResource> > requestRoutingRules = default; Optional <IList <WritableSubResource> > urlPathMaps = default; Optional <IList <WritableSubResource> > pathRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("redirectType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } redirectType = new ApplicationGatewayRedirectType(property0.Value.GetString()); continue; } if (property0.NameEquals("targetListener")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } targetListener = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("targetUrl")) { targetUrl = property0.Value.GetString(); continue; } if (property0.NameEquals("includePath")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } includePath = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("includeQueryString")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } includeQueryString = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("requestRoutingRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } requestRoutingRules = array; continue; } if (property0.NameEquals("urlPathMaps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } urlPathMaps = array; continue; } if (property0.NameEquals("pathRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } pathRules = array; continue; } } continue; } } return(new ApplicationGatewayRedirectConfiguration(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(redirectType), targetListener, targetUrl.Value, Optional.ToNullable(includePath), Optional.ToNullable(includeQueryString), Optional.ToList(requestRoutingRules), Optional.ToList(urlPathMaps), Optional.ToList(pathRules))); }
internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGatewayRedirectConfiguration(JsonElement element) { string name = default; string etag = default; string type = default; string id = default; ApplicationGatewayRedirectType?redirectType = default; SubResource targetListener = default; string targetUrl = default; bool? includePath = default; bool? includeQueryString = default; IList <SubResource> requestRoutingRules = default; IList <SubResource> urlPathMaps = default; IList <SubResource> pathRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } etag = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("redirectType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } redirectType = new ApplicationGatewayRedirectType(property0.Value.GetString()); continue; } if (property0.NameEquals("targetListener")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } targetListener = DeserializeSubResource(property0.Value); continue; } if (property0.NameEquals("targetUrl")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } targetUrl = property0.Value.GetString(); continue; } if (property0.NameEquals("includePath")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } includePath = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("includeQueryString")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } includeQueryString = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("requestRoutingRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResource> array = new List <SubResource>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(DeserializeSubResource(item)); } } requestRoutingRules = array; continue; } if (property0.NameEquals("urlPathMaps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResource> array = new List <SubResource>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(DeserializeSubResource(item)); } } urlPathMaps = array; continue; } if (property0.NameEquals("pathRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <SubResource> array = new List <SubResource>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(DeserializeSubResource(item)); } } pathRules = array; continue; } } continue; } } return(new ApplicationGatewayRedirectConfiguration(id, name, etag, type, redirectType, targetListener, targetUrl, includePath, includeQueryString, requestRoutingRules, urlPathMaps, pathRules)); }