in helper-scripts/export_kibana_config.py [0:0]
def check_args():
"""
Checks arguments passed to the script
"""
parser = argparse.ArgumentParser(description="")
parser.add_argument(
"--exportpath",
metavar="<exportpath>",
dest="exportpath",
help="Path to export the objects",
)
parser.add_argument(
"--indexpattern", action="store_true", help="Export Kibana index patterns"
)
parser.add_argument("--search", action="store_true", help="Export Kibana searches")
parser.add_argument(
"--visualization", action="store_true", help="Export Kibana visualizations"
)
parser.add_argument(
"--dashboard", action="store_true", help="Export Kibana dashboards"
)
parser.add_argument("--map", action="store_true", help="Export Kibana maps")
parser.add_argument(
"--estemplate", action="store_true", help="Export Elasticsearch templates"
)
parser.add_argument(
"--all",
action="store_true",
help="Export all Kibana objects (similar to --indexpattern --search --visualizations --dashboards --estemplate --maps)",
)
parser.add_argument(
"--export",
action="store_true",
help="Export data (either --export of --process required)",
)
parser.add_argument(
"--process",
action="store_true",
help="Process locally saved NDJSON files for easy diff (either --export of --process required)",
)
parser.add_argument(
"--username",
metavar="<username>",
dest="username",
help="Elastic username, if not provided default 'redelk' is used",
)
parser.add_argument(
"--password",
metavar="<password>",
dest="password",
help="Elastic password, if not provided config file ../elkserver/.env will be parsed",
)
script_args = parser.parse_args()
# pylint: disable=too-many-boolean-expressions
if (
not script_args.indexpattern
and not script_args.search
and not script_args.visualization
and not script_args.dashboard
and not script_args.all
and not script_args.estemplate
and not script_args.map
and not (script_args.export or script_args.process)
):
print("[X] Missing argument")
sys.exit(-1)
if not script_args.export and not script_args.process:
print("[X] Either --export of --process argument required")
sys.exit(-1)
return script_args