internal static DeliveryRuleActionAutoGenerated DeserializeDeliveryRuleActionAutoGenerated(JsonElement element) { if (element.TryGetProperty("name", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "CacheExpiration": return(DeliveryRuleCacheExpirationAction.DeserializeDeliveryRuleCacheExpirationAction(element)); case "CacheKeyQueryString": return(DeliveryRuleCacheKeyQueryStringAction.DeserializeDeliveryRuleCacheKeyQueryStringAction(element)); case "ModifyRequestHeader": return(DeliveryRuleRequestHeaderAction.DeserializeDeliveryRuleRequestHeaderAction(element)); case "ModifyResponseHeader": return(DeliveryRuleResponseHeaderAction.DeserializeDeliveryRuleResponseHeaderAction(element)); case "OriginGroupOverride": return(OriginGroupOverrideAction.DeserializeOriginGroupOverrideAction(element)); case "UrlRedirect": return(UrlRedirectAction.DeserializeUrlRedirectAction(element)); case "UrlRewrite": return(UrlRewriteAction.DeserializeUrlRewriteAction(element)); case "UrlSigning": return(UrlSigningAction.DeserializeUrlSigningAction(element)); } } DeliveryRuleAction name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = new DeliveryRuleAction(property.Value.GetString()); continue; } } return(new DeliveryRuleActionAutoGenerated(name)); }
internal static DeliveryRule DeserializeDeliveryRule(JsonElement element) { Optional <string> name = default; int order = default; Optional <IList <DeliveryRuleCondition> > conditions = default; IList <DeliveryRuleAction> actions = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("order")) { order = property.Value.GetInt32(); continue; } if (property.NameEquals("conditions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <DeliveryRuleCondition> array = new List <DeliveryRuleCondition>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DeliveryRuleCondition.DeserializeDeliveryRuleCondition(item)); } conditions = array; continue; } if (property.NameEquals("actions")) { List <DeliveryRuleAction> array = new List <DeliveryRuleAction>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DeliveryRuleAction.DeserializeDeliveryRuleAction(item)); } actions = array; continue; } } return(new DeliveryRule(name.Value, order, Optional.ToList(conditions), actions)); }
internal static DeliveryRuleResponseHeaderAction DeserializeDeliveryRuleResponseHeaderAction(JsonElement element) { HeaderActionParameters parameters = default; DeliveryRuleAction name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters")) { parameters = HeaderActionParameters.DeserializeHeaderActionParameters(property.Value); continue; } if (property.NameEquals("name")) { name = new DeliveryRuleAction(property.Value.GetString()); continue; } } return(new DeliveryRuleResponseHeaderAction(name, parameters)); }
internal DeliveryRuleCacheExpirationAction(DeliveryRuleAction name, CacheExpirationActionParameters parameters) : base(name) { Parameters = parameters; Name = name; }
internal OriginGroupOverrideAction(DeliveryRuleAction name, OriginGroupOverrideActionParameters parameters) : base(name) { Parameters = parameters; Name = name; }
internal UrlSigningAction(DeliveryRuleAction name, UrlSigningActionParameters parameters) : base(name) { Parameters = parameters; Name = name; }
internal DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleAction name, CacheKeyQueryStringActionParameters parameters) : base(name) { Parameters = parameters; Name = name; }
internal DeliveryRuleResponseHeaderAction(DeliveryRuleAction name, HeaderActionParameters parameters) : base(name) { Parameters = parameters; Name = name; }
internal UrlRedirectAction(DeliveryRuleAction name, UrlRedirectActionParameters parameters) : base(name) { Parameters = parameters; Name = name; }