@rest_initialiser(cluster_init_check=True, version_check=True, enterprise_check=False)
def execute(self, opts):
    if (opts.enabled == '1'):
        opts.enabled = 'true'
    elif (opts.enabled == '0'):
        opts.enabled = 'false'
    if (opts.enable_failover_on_data_disk_issues == '1'):
        opts.enable_failover_on_data_disk_issues = 'true'
    elif (opts.enable_failover_on_data_disk_issues == '0'):
        opts.enable_failover_on_data_disk_issues = 'false'
    if (opts.enable_failover_of_server_groups == '1'):
        opts.enable_failover_of_server_groups = 'true'
    elif (opts.enable_failover_of_server_groups == '0'):
        opts.enable_failover_of_server_groups = 'false'
    if (not self.enterprise):
        if opts.enable_failover_of_server_groups:
            _exit_if_errors(['--enable-failover-of-server-groups can only be configured on enterprise edition'])
        if (opts.enable_failover_on_data_disk_issues or opts.failover_on_data_disk_period):
            _exit_if_errors([('Auto failover on Data Service disk issues can only be configured on enterprise' + ' edition')])
        if opts.max_failovers:
            _exit_if_errors(['--max-count can only be configured on enterprise edition'])
        if opts.can_abort_rebalance:
            _exit_if_errors(['--can-abort-rebalance can only be configured on enterprise edition'])
    if (not any([opts.enabled, opts.timeout, opts.enable_failover_on_data_disk_issues, opts.failover_on_data_disk_period, opts.enable_failover_of_server_groups, opts.max_failovers])):
        _exit_if_errors(['No settings specified to be changed'])
    if (((opts.enable_failover_on_data_disk_issues is None) or (opts.enable_failover_on_data_disk_issues == 'false')) and opts.failover_on_data_disk_period):
        _exit_if_errors(['--enable-failover-on-data-disk-issues must be set to 1 when auto-failover Data Service disk period has been set'])
    if (opts.enable_failover_on_data_disk_issues and (opts.failover_on_data_disk_period is None)):
        _exit_if_errors(['--failover-data-disk-period must be set when auto-failover on Data Service disk is enabled'])
    if ((opts.enabled == 'false') or (opts.enabled is None)):
        if (opts.enable_failover_on_data_disk_issues or opts.failover_on_data_disk_period):
            _exit_if_errors(['--enable-auto-failover must be set to 1 when auto-failover on Data Service disk issues settings are being configured'])
        if opts.enable_failover_of_server_groups:
            _exit_if_errors(['--enable-auto-failover must be set to 1 when enabling auto-failover of Server Groups'])
        if opts.timeout:
            _warning('Timeout specified will not take affect because auto-failover is being disabled')
    if (opts.can_abort_rebalance == '1'):
        opts.can_abort_rebalance = 'true'
    elif (opts.can_abort_rebalance == '0'):
        opts.can_abort_rebalance = 'false'
    (_, errors) = self.rest.set_autofailover_settings(opts.enabled, opts.timeout, opts.enable_failover_of_server_groups, opts.max_failovers, opts.enable_failover_on_data_disk_issues, opts.failover_on_data_disk_period, opts.can_abort_rebalance)
    _exit_if_errors(errors)
    _success('Auto-failover settings modified')
@rest_initialiser(cluster_init_check=True, version_check=True, enterprise_check=False)
def execute(self, opts):
    if (opts.enabled == '1'):
        opts.enabled = 'true'
    elif (opts.enabled == '0'):
        opts.enabled = 'false'
    if (opts.enable_failover_on_data_disk_issues == '1'):
        opts.enable_failover_on_data_disk_issues = 'true'
    elif (opts.enable_failover_on_data_disk_issues == '0'):
        opts.enable_failover_on_data_disk_issues = 'false'
    if (opts.enable_failover_of_server_groups == '1'):
        opts.enable_failover_of_server_groups = 'true'
    elif (opts.enable_failover_of_server_groups == '0'):
        opts.enable_failover_of_server_groups = 'false'
    if (not self.enterprise):
        if opts.enable_failover_of_server_groups:
            _exit_if_errors(['--enable-failover-of-server-groups can only be configured on enterprise edition'])
        if (opts.enable_failover_on_data_disk_issues or opts.failover_on_data_disk_period):
            _exit_if_errors([('Auto failover on Data Service disk issues can only be configured on enterprise' + ' edition')])
        if opts.max_failovers:
            _exit_if_errors(['--max-count can only be configured on enterprise edition'])
        if opts.can_abort_rebalance:
            _exit_if_errors(['--can-abort-rebalance can only be configured on enterprise edition'])
    if (not any([opts.enabled, opts.timeout, opts.enable_failover_on_data_disk_issues, opts.failover_on_data_disk_period, opts.enable_failover_of_server_groups, opts.max_failovers])):
        _exit_if_errors(['No settings specified to be changed'])
    if (((opts.enable_failover_on_data_disk_issues is None) or (opts.enable_failover_on_data_disk_issues == 'false')) and opts.failover_on_data_disk_period):
        _exit_if_errors(['--enable-failover-on-data-disk-issues must be set to 1 when auto-failover Data Service disk period has been set'])
    if (opts.enable_failover_on_data_disk_issues and (opts.failover_on_data_disk_period is None)):
        _exit_if_errors(['--failover-data-disk-period must be set when auto-failover on Data Service disk is enabled'])
    if ((opts.enabled == 'false') or (opts.enabled is None)):
        if (opts.enable_failover_on_data_disk_issues or opts.failover_on_data_disk_period):
            _exit_if_errors(['--enable-auto-failover must be set to 1 when auto-failover on Data Service disk issues settings are being configured'])
        if opts.enable_failover_of_server_groups:
            _exit_if_errors(['--enable-auto-failover must be set to 1 when enabling auto-failover of Server Groups'])
        if opts.timeout:
            _warning('Timeout specified will not take affect because auto-failover is being disabled')
    if (opts.can_abort_rebalance == '1'):
        opts.can_abort_rebalance = 'true'
    elif (opts.can_abort_rebalance == '0'):
        opts.can_abort_rebalance = 'false'
    (_, errors) = self.rest.set_autofailover_settings(opts.enabled, opts.timeout, opts.enable_failover_of_server_groups, opts.max_failovers, opts.enable_failover_on_data_disk_issues, opts.failover_on_data_disk_period, opts.can_abort_rebalance)
    _exit_if_errors(errors)
    _success('Auto-failover settings modified')