Microsoft.Azure.Commands.Insights.Autoscale.NewAzureRmAutoscaleNotificationCommand.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() public method

Execute the cmdlet
public ExecuteCmdlet ( ) : void
return void
        public override void ExecuteCmdlet()
        {
            if (!(this.SendEmailToSubscriptionAdministrator || this.SendEmailToSubscriptionCoAdministrators) &&
                ((this.Webhooks == null || this.Webhooks.Length < 1) && (this.CustomEmails == null || this.CustomEmails.Length < 1)))
            {
                throw new ArgumentException("At least one Webhook or one CustomeEmail must be present, or the notification must be sent to the admin or co-admin");
            }

            var emailNotification = new EmailNotification
            {
                CustomEmails = this.CustomEmails,
                SendToSubscriptionAdministrator = this.SendEmailToSubscriptionAdministrator,
                SendToSubscriptionCoAdministrators = this.SendEmailToSubscriptionCoAdministrators,
            };

            var notification = new AutoscaleNotification
            {
                Email = emailNotification,
                Webhooks = this.Webhooks
            };

            WriteObject(notification);
        }
    }
NewAzureRmAutoscaleNotificationCommand