Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the PSLogicAppReceiver class.
 /// </summary>
 /// <param name="receiver">The receiver to wrap.</param>
 public PSLogicAppReceiver(LogicAppReceiver receiver)
 {
     this.Name                 = receiver.Name;
     this.ResourceId           = receiver.ResourceId;
     this.CallbackUrl          = receiver.CallbackUrl;
     this.UseCommonAlertSchema = receiver.UseCommonAlertSchema.HasValue ? receiver.UseCommonAlertSchema.Value : false;
 }
        ///GENMHASH:8725DC52ABD03FF631A8419911616ECF:0B992D320C1057B364C3C054EFD0BA8F
        public ActionGroupImpl WithLogicApp(string logicAppResourceId, string callbackUrl)
        {
            this.WithoutLogicApp();

            var compositeKey = this.actionReceiverPrefix + logicSuffix;
            var lr           = new LogicAppReceiver
            {
                Name        = compositeKey,
                ResourceId  = logicAppResourceId,
                CallbackUrl = callbackUrl
            };

            this.logicReceivers[compositeKey] = lr;
            return(this);
        }
Exemple #3
0
        internal static ActionGroupData DeserializeActionGroupData(JsonElement element)
        {
            Optional <string>            kind     = default;
            Optional <string>            identity = default;
            IDictionary <string, string> tags     = default;
            AzureLocation      location           = default;
            ResourceIdentifier id             = default;
            string             name           = default;
            ResourceType       type           = default;
            SystemData         systemData     = default;
            Optional <string>  groupShortName = default;
            Optional <bool>    enabled        = default;
            Optional <IList <EmailReceiver> >             emailReceivers             = default;
            Optional <IList <SmsReceiver> >               smsReceivers               = default;
            Optional <IList <WebhookReceiver> >           webhookReceivers           = default;
            Optional <IList <ItsmReceiver> >              itsmReceivers              = default;
            Optional <IList <AzureAppPushReceiver> >      azureAppPushReceivers      = default;
            Optional <IList <AutomationRunbookReceiver> > automationRunbookReceivers = default;
            Optional <IList <VoiceReceiver> >             voiceReceivers             = default;
            Optional <IList <LogicAppReceiver> >          logicAppReceivers          = default;
            Optional <IList <AzureFunctionReceiver> >     azureFunctionReceivers     = default;
            Optional <IList <ArmRoleReceiver> >           armRoleReceivers           = default;
            Optional <IList <EventHubReceiver> >          eventHubReceivers          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    identity = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("groupShortName"))
                        {
                            groupShortName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("emailReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <EmailReceiver> array = new List <EmailReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(EmailReceiver.DeserializeEmailReceiver(item));
                            }
                            emailReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("smsReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SmsReceiver> array = new List <SmsReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SmsReceiver.DeserializeSmsReceiver(item));
                            }
                            smsReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("webhookReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <WebhookReceiver> array = new List <WebhookReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(WebhookReceiver.DeserializeWebhookReceiver(item));
                            }
                            webhookReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("itsmReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ItsmReceiver> array = new List <ItsmReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ItsmReceiver.DeserializeItsmReceiver(item));
                            }
                            itsmReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("azureAppPushReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureAppPushReceiver> array = new List <AzureAppPushReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureAppPushReceiver.DeserializeAzureAppPushReceiver(item));
                            }
                            azureAppPushReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("automationRunbookReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AutomationRunbookReceiver> array = new List <AutomationRunbookReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AutomationRunbookReceiver.DeserializeAutomationRunbookReceiver(item));
                            }
                            automationRunbookReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("voiceReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VoiceReceiver> array = new List <VoiceReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VoiceReceiver.DeserializeVoiceReceiver(item));
                            }
                            voiceReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("logicAppReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <LogicAppReceiver> array = new List <LogicAppReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(LogicAppReceiver.DeserializeLogicAppReceiver(item));
                            }
                            logicAppReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("azureFunctionReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureFunctionReceiver> array = new List <AzureFunctionReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFunctionReceiver.DeserializeAzureFunctionReceiver(item));
                            }
                            azureFunctionReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("armRoleReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ArmRoleReceiver> array = new List <ArmRoleReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ArmRoleReceiver.DeserializeArmRoleReceiver(item));
                            }
                            armRoleReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("eventHubReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <EventHubReceiver> array = new List <EventHubReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(EventHubReceiver.DeserializeEventHubReceiver(item));
                            }
                            eventHubReceivers = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ActionGroupData(id, name, type, systemData, tags, location, kind.Value, identity.Value, groupShortName.Value, Optional.ToNullable(enabled), Optional.ToList(emailReceivers), Optional.ToList(smsReceivers), Optional.ToList(webhookReceivers), Optional.ToList(itsmReceivers), Optional.ToList(azureAppPushReceivers), Optional.ToList(automationRunbookReceivers), Optional.ToList(voiceReceivers), Optional.ToList(logicAppReceivers), Optional.ToList(azureFunctionReceivers), Optional.ToList(armRoleReceivers), Optional.ToList(eventHubReceivers)));
        }