@rest_initialiser(cluster_init_check=True, version_check=True)
def execute(self, opts):
    if (opts.enabled == '1'):
        if (opts.email_recipients is None):
            _exit_if_errors(['--email-recipient must be set when email alerts are enabled'])
        if (opts.email_sender is None):
            _exit_if_errors(['--email-sender must be set when email alerts are enabled'])
        if (opts.email_host is None):
            _exit_if_errors(['--email-host must be set when email alerts are enabled'])
        if (opts.email_port is None):
            _exit_if_errors(['--email-port must be set when email alerts are enabled'])
    alerts = list()
    if opts.alert_af_node:
        alerts.append('auto_failover_node')
    if opts.alert_af_max_reached:
        alerts.append('auto_failover_maximum_reached')
    if opts.alert_af_node_down:
        alerts.append('auto_failover_other_nodes_down')
    if opts.alert_af_small:
        alerts.append('auto_failover_cluster_too_small')
    if opts.alert_af_disable:
        alerts.append('auto_failover_disabled')
    if opts.alert_ip_changed:
        alerts.append('ip')
    if opts.alert_disk_space:
        alerts.append('disk')
    if opts.alert_meta_overhead:
        alerts.append('overhead')
    if opts.alert_meta_oom:
        alerts.append('ep_oom_errors')
    if opts.alert_write_failed:
        alerts.append('ep_item_commit_failed')
    if opts.alert_audit_dropped:
        alerts.append('audit_dropped_events')
    if opts.alert_indexer_max_ram:
        alerts.append('indexer_ram_max_usage')
    if opts.alert_cas_drift:
        alerts.append('ep_clock_cas_drift_threshold_exceeded')
    if opts.alert_communication_issue:
        alerts.append('communication_issue')
    enabled = 'true'
    if (opts.enabled == '0'):
        enabled = 'false'
    email_encrypt = 'false'
    if (opts.email_encrypt == '1'):
        email_encrypt = 'true'
    (_, errors) = self.rest.set_alert_settings(enabled, opts.email_recipients, opts.email_sender, opts.email_username, opts.email_password, opts.email_host, opts.email_port, email_encrypt, ','.join(alerts))
    _exit_if_errors(errors)
    _success('Email alert settings modified')
@rest_initialiser(cluster_init_check=True, version_check=True)
def execute(self, opts):
    if (opts.enabled == '1'):
        if (opts.email_recipients is None):
            _exit_if_errors(['--email-recipient must be set when email alerts are enabled'])
        if (opts.email_sender is None):
            _exit_if_errors(['--email-sender must be set when email alerts are enabled'])
        if (opts.email_host is None):
            _exit_if_errors(['--email-host must be set when email alerts are enabled'])
        if (opts.email_port is None):
            _exit_if_errors(['--email-port must be set when email alerts are enabled'])
    alerts = list()
    if opts.alert_af_node:
        alerts.append('auto_failover_node')
    if opts.alert_af_max_reached:
        alerts.append('auto_failover_maximum_reached')
    if opts.alert_af_node_down:
        alerts.append('auto_failover_other_nodes_down')
    if opts.alert_af_small:
        alerts.append('auto_failover_cluster_too_small')
    if opts.alert_af_disable:
        alerts.append('auto_failover_disabled')
    if opts.alert_ip_changed:
        alerts.append('ip')
    if opts.alert_disk_space:
        alerts.append('disk')
    if opts.alert_meta_overhead:
        alerts.append('overhead')
    if opts.alert_meta_oom:
        alerts.append('ep_oom_errors')
    if opts.alert_write_failed:
        alerts.append('ep_item_commit_failed')
    if opts.alert_audit_dropped:
        alerts.append('audit_dropped_events')
    if opts.alert_indexer_max_ram:
        alerts.append('indexer_ram_max_usage')
    if opts.alert_cas_drift:
        alerts.append('ep_clock_cas_drift_threshold_exceeded')
    if opts.alert_communication_issue:
        alerts.append('communication_issue')
    enabled = 'true'
    if (opts.enabled == '0'):
        enabled = 'false'
    email_encrypt = 'false'
    if (opts.email_encrypt == '1'):
        email_encrypt = 'true'
    (_, errors) = self.rest.set_alert_settings(enabled, opts.email_recipients, opts.email_sender, opts.email_username, opts.email_password, opts.email_host, opts.email_port, email_encrypt, ','.join(alerts))
    _exit_if_errors(errors)
    _success('Email alert settings modified')