/// <summary> /// Execute the cmdlet /// </summary> public override void ExecuteCmdlet() { PSActionGroupReceiverBase receiverBase = null; if (this.ParameterSetName == NewEmailReceiver) { receiverBase = new PSEmailReceiver { Name = Name, EmailAddress = EmailAddress }; } else if (this.ParameterSetName == NewSmsReceiver) { receiverBase = new PSSmsReceiver { Name = Name, CountryCode = CountryCode, PhoneNumber = PhoneNumber }; } else if (this.ParameterSetName == NewWebhookReceiver) { receiverBase = new PSWebhookReceiver { Name = Name, ServiceUri = ServiceUri }; } WriteObject(receiverBase); }
/// <summary> /// Execute the cmdlet /// </summary> public override void ExecuteCmdlet() { PSActionGroupReceiverBase receiverBase = null; if (this.ParameterSetName == NewEmailReceiver) { receiverBase = new PSEmailReceiver { Name = Name, EmailAddress = EmailAddress, UseCommonAlertSchema = UseCommonAlertSchema }; } else if (this.ParameterSetName == NewSmsReceiver) { receiverBase = new PSSmsReceiver { Name = Name, CountryCode = CountryCode, PhoneNumber = PhoneNumber }; } else if (this.ParameterSetName == NewWebhookReceiver) { receiverBase = new PSWebhookReceiver { Name = Name, ServiceUri = ServiceUri, UseCommonAlertSchema = UseCommonAlertSchema, UseAadAuth = UseAadAuth, ObjectId = ObjectId, IdentifierUri = IdentifierUri, TenantId = TenantId }; } else if (this.ParameterSetName == NewEventHubReceiver) { receiverBase = new PSEventHubReceiver { Name = Name, SubscriptionId = SubscriptionId, EventHubNameSpace = EventHubNameSpace, EventHubName = EventHubName, UseCommonAlertSchema = UseCommonAlertSchema }; } else if (this.ParameterSetName == NewItsmReceiver) { receiverBase = new PSItsmReceiver { Name = Name, WorkspaceId = WorkspaceId, ConnectionId = ConnectionId, TicketConfiguration = TicketConfiguration, Region = Region }; } else if (this.ParameterSetName == NewVoiceReceiver) { receiverBase = new PSVoiceReceiver { Name = Name, CountryCode = VoiceCountryCode, PhoneNumber = VoicePhoneNumber }; } else if (this.ParameterSetName == NewArmRoleReceiver) { receiverBase = new PSArmRoleReceiver { Name = Name, RoleId = RoleId, UseCommonAlertSchema = UseCommonAlertSchema }; } else if (this.ParameterSetName == NewAzureFunctionReceiver) { receiverBase = new PSAzureFunctionReceiver { Name = Name, FunctionAppResourceId = FunctionAppResourceId, FunctionName = FunctionName, HttpTriggerUrl = HttpTriggerUrl, UseCommonAlertSchema = UseCommonAlertSchema }; } else if (this.ParameterSetName == NewLogicAppReceiver) { receiverBase = new PSLogicAppReceiver { Name = Name, ResourceId = ResourceId, CallbackUrl = CallbackUrl, UseCommonAlertSchema = UseCommonAlertSchema }; } else if (this.ParameterSetName == NewAutomationRunbookReceiver) { receiverBase = new PSAutomationRunbookReceiver { Name = Name, AutomationAccountId = AutomationAccountId, RunbookName = RunbookName, WebhookResourceId = WebhookResourceId, IsGlobalRunbook = IsGlobalRunbook, UseCommonAlertSchema = UseCommonAlertSchema, ServiceUri = AutomationRunbookServiceUri }; } else if (this.ParameterSetName == NewAzureAppPushReceiver) { receiverBase = new PSAzureAppPushReceiver { Name = Name, EmailAddress = AzureAppPushEmailAddress }; } WriteObject(receiverBase); }