internal static AutoscaleNotification DeserializeAutoscaleNotification(JsonElement element)
        {
            string operation = default;
            Optional <EmailNotification>            email    = default;
            Optional <IList <WebhookNotification> > webhooks = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("operation"))
                {
                    operation = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("email"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    email = EmailNotification.DeserializeEmailNotification(property.Value);
                    continue;
                }
                if (property.NameEquals("webhooks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <WebhookNotification> array = new List <WebhookNotification>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(WebhookNotification.DeserializeWebhookNotification(item));
                    }
                    webhooks = array;
                    continue;
                }
            }
            return(new AutoscaleNotification(operation, email.Value, Optional.ToList(webhooks)));
        }
コード例 #2
0
 internal AutoscaleNotification(string operation, EmailNotification email, IList <WebhookNotification> webhooks)
 {
     Operation = operation;
     Email     = email;
     Webhooks  = webhooks;
 }