import click from curator.cli_singletons.object_class import cli_action from curator.cli_singletons.utils import get_width, json_to_dict, validate_filter_json @click.command(context_settings=get_width()) @click.option('--repository', type=str, required=True, help='Snapshot repository') @click.option('--name', type=str, help='Snapshot name', required=False, default=None) @click.option('--index', multiple=True, help='Index name to restore. (Can invoke repeatedly for multiple indices)') @click.option('--rename_pattern', type=str, help='Rename pattern', required=False, default=None) @click.option('--rename_replacement', type=str, help='Rename replacement', required=False, default=None) @click.option('--extra_settings', type=str, help='JSON version of extra_settings (see documentation)', callback=json_to_dict) @click.option('--include_aliases', is_flag=True, show_default=True, help='Include aliases with restored indices.') @click.option('--ignore_unavailable', is_flag=True, show_default=True, help='Ignore unavailable shards/indices.') @click.option('--include_global_state', is_flag=True, show_default=True, help='Restore cluster global state with snapshot.') @click.option('--partial', is_flag=True, show_default=True, help='Restore partial data (from snapshot taken with --partial).') @click.option('--wait_for_completion/--no-wait_for_completion', default=True, show_default=True, help='Wait for the snapshot to complete') @click.option('--wait_interval', default=9, type=int, help='Seconds to wait between completion checks.') @click.option('--max_wait', default=-1, type=int, help='Maximum number of seconds to wait_for_completion') @click.option('--skip_repo_fs_check', is_flag=True, show_default=True, help='Skip repository filesystem access validation.') @click.option('--ignore_empty_list', is_flag=True, help='Do not raise exception if there are no actionable indices') @click.option('--allow_ilm_indices/--no-allow_ilm_indices', help='Allow Curator to operate on Index Lifecycle Management monitored indices.', default=False, show_default=True) @click.option('--filter_list', callback=validate_filter_json, help='JSON array of filters selecting snapshots to act on.', required=True) @click.pass_context def restore(ctx, repository, name, index, rename_pattern, rename_replacement, extra_settings, include_aliases, ignore_unavailable, include_global_state, partial, wait_for_completion, wait_interval, max_wait, skip_repo_fs_check, ignore_empty_list, allow_ilm_indices, filter_list): """ Restore Indices """ indices = list(index) manual_options = {
from curator.cli_singletons.forcemerge import forcemerge from curator.cli_singletons.open_indices import open_indices from curator.cli_singletons.replicas import replicas from curator.cli_singletons.restore import restore from curator.cli_singletons.rollover import rollover from curator.cli_singletons.snapshot import snapshot from curator.cli_singletons.shrink import shrink from curator.cli_singletons.show import show_indices, show_snapshots from curator.cli_singletons.freeze import freeze from curator.cli_singletons.unfreeze import unfreeze from curator._version import __version__ import logging logger = logging.getLogger(__name__) @click.group(context_settings=get_width()) @click.option('--config', help='Path to configuration file. Default: ~/.curator/curator.yml', type=click.Path(), default=settings.config_file()) @click.option('--host', help='Elasticsearch host.') @click.option('--url_prefix', help='Elasticsearch http url prefix.') @click.option('--port', help='Elasticsearch port.') @click.option('--use_ssl', is_flag=True, callback=false_to_none, help='Connect to Elasticsearch through SSL.') @click.option('--certificate', help='Path to certificate to use for SSL validation.') @click.option('--client-cert', help='Path to file containing SSL certificate for client auth.', type=str) @click.option('--client-key', help='Path to file containing SSL key for client auth.', type=str) @click.option('--ssl-no-validate', is_flag=True, callback=false_to_none, help='Do not validate SSL certificate') @click.option('--http_auth', help='Use Basic Authentication ex: user:pass') @click.option('--timeout', help='Connection timeout in seconds.', type=int) @click.option('--master-only', is_flag=True, callback=false_to_none, help='Only operate on elected master node.') @click.option('--dry-run', is_flag=True, help='Do not perform any changes.') @click.option('--loglevel', help='Log level') @click.option('--logfile', help='log file')
import click from curator.cli_singletons.object_class import cli_action from curator.cli_singletons.utils import get_width, validate_filter_json @click.command(name='open', context_settings=get_width()) @click.option('--ignore_empty_list', is_flag=True, help='Do not raise exception if there are no actionable indices') @click.option('--allow_ilm_indices/--no-allow_ilm_indices', help='Allow Curator to operate on Index Lifecycle Management monitored indices.', default=False, show_default=True) @click.option('--filter_list', callback=validate_filter_json, help='JSON array of filters selecting indices to act on.', required=True) @click.pass_context def open_indices(ctx, ignore_empty_list, allow_ilm_indices, filter_list): """ Open Indices """ # ctx.info_name is the name of the function or name specified in @click.command decorator action = cli_action(ctx.info_name, ctx.obj['config']['client'], {'allow_ilm_indices':allow_ilm_indices}, filter_list, ignore_empty_list) action.do_singleton_action(dry_run=ctx.obj['dry_run'])
"""Shrink Index Singleton""" import click from curator.cli_singletons.object_class import cli_action from curator.cli_singletons.utils import get_width, json_to_dict, validate_filter_json @click.command(context_settings=get_width()) @click.option('--shrink_node', default='DETERMINISTIC', type=str, help='Named node, or DETERMINISTIC', show_default=True) @click.option('--node_filters', help='JSON version of node_filters (see documentation)', callback=json_to_dict) @click.option('--number_of_shards', default=1, type=int, help='Shrink to this many shards per index') @click.option('--number_of_replicas', default=1, type=int, help='Number of replicas for the target index', show_default=True) @click.option('--shrink_prefix', type=str, help='Prefix for the target index name') @click.option('--shrink_suffix', default='-shrink', type=str, help='Suffix for the target index name',
from curator.cli_singletons.close import close from curator.cli_singletons.delete import delete_indices, delete_snapshots from curator.cli_singletons.forcemerge import forcemerge from curator.cli_singletons.open_indices import open_indices from curator.cli_singletons.replicas import replicas from curator.cli_singletons.restore import restore from curator.cli_singletons.rollover import rollover from curator.cli_singletons.snapshot import snapshot from curator.cli_singletons.shrink import shrink from curator.cli_singletons.show import show_indices, show_snapshots from curator._version import __version__ import logging logger = logging.getLogger(__name__) @click.group(context_settings=get_width()) @click.option('--config', help='Path to configuration file. Default: ~/.curator/curator.yml', type=click.Path(), default=settings.config_file()) @click.option('--host', help='Elasticsearch host.') @click.option('--url_prefix', help='Elasticsearch http url prefix.') @click.option('--port', help='Elasticsearch port.') @click.option('--use_ssl', is_flag=True, callback=false_to_none, help='Connect to Elasticsearch through SSL.') @click.option('--certificate', help='Path to certificate to use for SSL validation.') @click.option('--client-cert', help='Path to file containing SSL certificate for client auth.', type=str) @click.option('--client-key', help='Path to file containing SSL key for client auth.', type=str) @click.option('--ssl-no-validate', is_flag=True, callback=false_to_none, help='Do not validate SSL certificate') @click.option('--http_auth', help='Use Basic Authentication ex: user:pass') @click.option('--timeout', help='Connection timeout in seconds.', type=int) @click.option('--master-only', is_flag=True, callback=false_to_none, help='Only operate on elected master node.') @click.option('--dry-run', is_flag=True, help='Do not perform any changes.') @click.option('--loglevel', help='Log level') @click.option('--logfile', help='log file')