internal static CustomScaleRule DeserializeCustomScaleRule(JsonElement element) { Optional <string> type = default; Optional <IDictionary <string, string> > metadata = default; Optional <IList <ContainerAppScaleRuleAuth> > auth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("metadata")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } metadata = dictionary; continue; } if (property.NameEquals("auth")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ContainerAppScaleRuleAuth> array = new List <ContainerAppScaleRuleAuth>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ContainerAppScaleRuleAuth.DeserializeContainerAppScaleRuleAuth(item)); } auth = array; continue; } } return(new CustomScaleRule(type.Value, Optional.ToDictionary(metadata), Optional.ToList(auth))); }
internal static QueueScaleRule DeserializeQueueScaleRule(JsonElement element) { Optional <string> queueName = default; Optional <int> queueLength = default; Optional <IList <ContainerAppScaleRuleAuth> > auth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queueName")) { queueName = property.Value.GetString(); continue; } if (property.NameEquals("queueLength")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } queueLength = property.Value.GetInt32(); continue; } if (property.NameEquals("auth")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ContainerAppScaleRuleAuth> array = new List <ContainerAppScaleRuleAuth>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ContainerAppScaleRuleAuth.DeserializeContainerAppScaleRuleAuth(item)); } auth = array; continue; } } return(new QueueScaleRule(queueName.Value, Optional.ToNullable(queueLength), Optional.ToList(auth))); }