@rest_initialiser(cluster_init_check=True, version_check=True)
def execute(self, opts):
    if ((opts.db_perc is not None) and ((opts.db_perc < 2) or (opts.db_perc > 100))):
        _exit_if_errors(['--compaction-db-percentage must be between 2 and 100'])
    if ((opts.view_perc is not None) and ((opts.view_perc < 2) or (opts.view_perc > 100))):
        _exit_if_errors(['--compaction-view-percentage must be between 2 and 100'])
    if (opts.db_size is not None):
        if (int(opts.db_size) < 1):
            _exit_if_errors(['--compaction-db-size must be between greater than 1 or infinity'])
        opts.db_size = (int(opts.db_size) * (1024 ** 2))
    if (opts.view_size is not None):
        if (int(opts.view_size) < 1):
            _exit_if_errors(['--compaction-view-size must be between greater than 1 or infinity'])
        opts.view_size = (int(opts.view_size) * (1024 ** 2))
    if (opts.from_period and (not (opts.to_period and opts.enable_abort))):
        errors = []
        if (opts.to_period is None):
            errors.append('--compaction-period-to is required when using --compaction-period-from')
        if (opts.enable_abort is None):
            errors.append('--enable-compaction-abort is required when using --compaction-period-from')
        _exit_if_errors(errors)
    if (opts.to_period and (not (opts.from_period and opts.enable_abort))):
        errors = []
        if (opts.from_period is None):
            errors.append('--compaction-period-from is required when using --compaction-period-to')
        if (opts.enable_abort is None):
            errors.append('--enable-compaction-abort is required when using --compaction-period-to')
        _exit_if_errors(errors)
    if (opts.enable_abort and (not (opts.from_period and opts.to_period))):
        errors = []
        if (opts.from_period is None):
            errors.append('--compaction-period-from is required when using --enable-compaction-abort')
        if (opts.to_period is None):
            errors.append('--compaction-period-to is required when using --enable-compaction-abort')
        _exit_if_errors(errors)
    (from_hour, from_min) = self._handle_timevalue(opts.from_period, '--compaction-period-from')
    (to_hour, to_min) = self._handle_timevalue(opts.to_period, '--compaction-period-to')
    if (opts.enable_abort == '1'):
        opts.enable_abort = 'true'
    elif (opts.enable_abort == '0'):
        opts.enable_abort = 'false'
    if (opts.enable_parallel == '1'):
        opts.enable_parallel = 'true'
    else:
        opts.enable_parallel = 'false'
    if ((opts.purge_interval is not None) and ((opts.purge_interval < 0.04) or (opts.purge_interval > 60.0))):
        _exit_if_errors(['--metadata-purge-interval must be between 0.04 and 60.0'])
    g_from_hour = None
    g_from_min = None
    g_to_hour = None
    g_to_min = None
    if (opts.gsi_mode == 'append'):
        opts.gsi_mode = 'full'
        if (opts.gsi_perc is None):
            _exit_if_errors(['--compaction-gsi-percentage must be specified when --gsi-compaction-mode is set to append'])
    elif (opts.gsi_mode == 'circular'):
        if ((opts.gsi_from_period is not None) and (opts.gsi_to_period is None)):
            _exit_if_errors(['--compaction-gsi-period-to is required with --compaction-gsi-period-from'])
        if ((opts.gsi_to_period is not None) and (opts.gsi_from_period is None)):
            _exit_if_errors(['--compaction-gsi-period-from is required with --compaction-gsi-period-to'])
        (g_from_hour, g_from_min) = self._handle_timevalue(opts.gsi_from_period, '--compaction-gsi-period-from')
        (g_to_hour, g_to_min) = self._handle_timevalue(opts.gsi_to_period, '--compaction-gsi-period-to')
        if (opts.enable_gsi_abort == '1'):
            opts.enable_gsi_abort = 'true'
        else:
            opts.enable_gsi_abort = 'false'
    (_, errors) = self.rest.set_compaction_settings(opts.db_perc, opts.db_size, opts.view_perc, opts.view_size, from_hour, from_min, to_hour, to_min, opts.enable_abort, opts.enable_parallel, opts.purge_interval, opts.gsi_mode, opts.gsi_perc, opts.gsi_interval, g_from_hour, g_from_min, g_to_hour, g_to_min, opts.enable_gsi_abort)
    _exit_if_errors(errors)
    _success('Compaction settings modified')
@rest_initialiser(cluster_init_check=True, version_check=True)
def execute(self, opts):
    if ((opts.db_perc is not None) and ((opts.db_perc < 2) or (opts.db_perc > 100))):
        _exit_if_errors(['--compaction-db-percentage must be between 2 and 100'])
    if ((opts.view_perc is not None) and ((opts.view_perc < 2) or (opts.view_perc > 100))):
        _exit_if_errors(['--compaction-view-percentage must be between 2 and 100'])
    if (opts.db_size is not None):
        if (int(opts.db_size) < 1):
            _exit_if_errors(['--compaction-db-size must be between greater than 1 or infinity'])
        opts.db_size = (int(opts.db_size) * (1024 ** 2))
    if (opts.view_size is not None):
        if (int(opts.view_size) < 1):
            _exit_if_errors(['--compaction-view-size must be between greater than 1 or infinity'])
        opts.view_size = (int(opts.view_size) * (1024 ** 2))
    if (opts.from_period and (not (opts.to_period and opts.enable_abort))):
        errors = []
        if (opts.to_period is None):
            errors.append('--compaction-period-to is required when using --compaction-period-from')
        if (opts.enable_abort is None):
            errors.append('--enable-compaction-abort is required when using --compaction-period-from')
        _exit_if_errors(errors)
    if (opts.to_period and (not (opts.from_period and opts.enable_abort))):
        errors = []
        if (opts.from_period is None):
            errors.append('--compaction-period-from is required when using --compaction-period-to')
        if (opts.enable_abort is None):
            errors.append('--enable-compaction-abort is required when using --compaction-period-to')
        _exit_if_errors(errors)
    if (opts.enable_abort and (not (opts.from_period and opts.to_period))):
        errors = []
        if (opts.from_period is None):
            errors.append('--compaction-period-from is required when using --enable-compaction-abort')
        if (opts.to_period is None):
            errors.append('--compaction-period-to is required when using --enable-compaction-abort')
        _exit_if_errors(errors)
    (from_hour, from_min) = self._handle_timevalue(opts.from_period, '--compaction-period-from')
    (to_hour, to_min) = self._handle_timevalue(opts.to_period, '--compaction-period-to')
    if (opts.enable_abort == '1'):
        opts.enable_abort = 'true'
    elif (opts.enable_abort == '0'):
        opts.enable_abort = 'false'
    if (opts.enable_parallel == '1'):
        opts.enable_parallel = 'true'
    else:
        opts.enable_parallel = 'false'
    if ((opts.purge_interval is not None) and ((opts.purge_interval < 0.04) or (opts.purge_interval > 60.0))):
        _exit_if_errors(['--metadata-purge-interval must be between 0.04 and 60.0'])
    g_from_hour = None
    g_from_min = None
    g_to_hour = None
    g_to_min = None
    if (opts.gsi_mode == 'append'):
        opts.gsi_mode = 'full'
        if (opts.gsi_perc is None):
            _exit_if_errors(['--compaction-gsi-percentage must be specified when --gsi-compaction-mode is set to append'])
    elif (opts.gsi_mode == 'circular'):
        if ((opts.gsi_from_period is not None) and (opts.gsi_to_period is None)):
            _exit_if_errors(['--compaction-gsi-period-to is required with --compaction-gsi-period-from'])
        if ((opts.gsi_to_period is not None) and (opts.gsi_from_period is None)):
            _exit_if_errors(['--compaction-gsi-period-from is required with --compaction-gsi-period-to'])
        (g_from_hour, g_from_min) = self._handle_timevalue(opts.gsi_from_period, '--compaction-gsi-period-from')
        (g_to_hour, g_to_min) = self._handle_timevalue(opts.gsi_to_period, '--compaction-gsi-period-to')
        if (opts.enable_gsi_abort == '1'):
            opts.enable_gsi_abort = 'true'
        else:
            opts.enable_gsi_abort = 'false'
    (_, errors) = self.rest.set_compaction_settings(opts.db_perc, opts.db_size, opts.view_perc, opts.view_size, from_hour, from_min, to_hour, to_min, opts.enable_abort, opts.enable_parallel, opts.purge_interval, opts.gsi_mode, opts.gsi_perc, opts.gsi_interval, g_from_hour, g_from_min, g_to_hour, g_to_min, opts.enable_gsi_abort)
    _exit_if_errors(errors)
    _success('Compaction settings modified')