def build_argument_parser()

in tools/stix-to-ecs/stix_to_ecs.py [0:0]


def build_argument_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(
        sys.argv[0],
        description=f"Convert STIX indicator(s) into ECS indicator(s) - Version {VERSION}",
    )

    parser.add_argument(
        "-i",
        "--input",
        type=pathlib.Path,
        help="STIX input file or directory",
        required=True,
    )

    parser.add_argument(
        "-o",
        "--output",
        type=pathlib.Path,
        help="ECS output directory",
    )

    parser.add_argument(
        "-r",
        "--recursive",
        help="Recursive processing when input is a directory",
        action="store_true",
    )

    parser.add_argument(
        "-e", "--elastic", action="store_true", help="Use Elastic cloud configuration"
    )

    parser.add_argument("-p", "--provider", help="Override ECS provider")

    parser.add_argument(
        "-c",
        "--configuration",
        type=pathlib.Path,
        help="Path to the configuration file used to connect to the Elastic cluster, used with --elastic",
    )

    parser.add_argument(
        "--cloud-id",
        help="The cloud ID of the Elastic cluster, required with --elastic unless configuration file is provided (--configuration), can't be provided along --url",
    )

    parser.add_argument(
        "--url",
        type=str,
        help="The URL of the Elastic cluster, required with --elastic unless configuration file is provided (--configuration), can't be provided along --cloud-id",
    )

    parser.add_argument(
        "--username",
        type=str,
        help="The username of the Elastic cluster, required with --elastic unless a configuration file is provided (--configuration)",
    )

    parser.add_argument(
        "--password",
        type=str,
        help="The password of the Elastic cluster, required with --elastic unless a configuration file is provided (--configuration)",
    )

    parser.add_argument(
        "--index",
        type=str,
        help="Elastic cluster's index where ECS indicators will be written, required with --elastic unless configuration file is provided (--configuration)",
    )

    parser.add_argument(
        "-x",
        "--insecure",
        action="store_false",
        dest="verify_certs",
        help="Disable TLS certificate verification when connecting to the Elastic cluster",
    )

    return parser