def main(config, args):
    description = "Interact with serveroverload profile objects."
    m = re.match(r'^.*\.(.*)$', __name__)
    controller_name = m.groups()[0]
    del sys.argv[1]
    parser = argparse.ArgumentParser(prog="%s %s" % (sys.argv[0], controller_name), description=description)
    subparsers = parser.add_subparsers(dest="action")

    # create
    create_parser = subparsers.add_parser("create", help="create serveroverload profile object")
    create_parser_required = create_parser.add_argument_group("required arguments")
    create_parser_required.add_argument("--name", type=str, required=True)
    create_parser_required.add_argument("--description", type=str, required=True)
    create_parser_required.add_argument("--functiontype", type=str, required=True)
    create_parser_required.add_argument("--functionexpvalue", type=str, required=True)
    create_parser_required.add_argument("--functiongrowthrate", type=str, required=True)

    # read
    read_parser = subparsers.add_parser("read", help="read serveroverload profile object(s)")
    read_parser.add_argument("--all", action="store_const", const=True, default=False, help="read all serveroverload profiles")
    read_parser.add_argument("--serveroverloadprofile", type=str, help="ID of serveroverload profile to read")

    # update
    update_parser = subparsers.add_parser("update", help="update existing serveroverload profile object")
    update_parser_required = update_parser.add_argument_group("required arguments")
    update_parser_required.add_argument("--serveroverload", type=str, required=True, help="serveroverload profile id to update")
    update_parser.add_argument("--name", type=str)
    update_parser.add_argument("--description", type=str)
    update_parser.add_argument("--functiontype", type=str)
    update_parser.add_argument("--functionexpvalue", type=int)
    update_parser.add_argument("--functiongrowthrate", type=float)

    # delete trigger
    delete_trigger_parser = subparsers.add_parser("deletetrigger", help="delete a response trigger from serveroverload profile object")
    delete_trigger_required = delete_trigger_parser.add_argument_group("required arguments")
    delete_trigger_required.add_argument("--serveroverload", type=str, required=True, help="serveroverload profile id to update")
    delete_trigger_required.add_argument("--position", type=int, required=True, help="position of trigger to delete")

    # insert trigger
    insert_trigger_parser = subparsers.add_parser("inserttrigger", help="insert a response trigger into serveroverload profile object")
    insert_trigger_required = insert_trigger_parser.add_argument_group("required arguments")
    insert_trigger_required.add_argument("--serveroverload", type=str, required=True, help="serveroverload profile id to update")
    insert_trigger_required.add_argument("--position", type=int, required=True, help="position to insert trigger at")
    insert_trigger_required.add_argument("--fromload", type=float, required=True)
    insert_trigger_required.add_argument("--toload", type=float, required=True)
    insert_trigger_required.add_argument("--actiontype", type=str, required=True)
    insert_trigger_required.add_argument("--actionvalue", type=str, required=True)
    insert_trigger_required.add_argument("--actionpercentage", type=float, required=True)

    # delete
    delete_parser = subparsers.add_parser("delete", help="delete serveroverload profile object")
    delete_parser_required = delete_parser.add_argument_group("required arguments")
    delete_parser_required.add_argument("--serveroverload", type=str, required=True, help="serveroverload profile id to delete")

    args = vars(parser.parse_args())
    action_map = {
        "create": create,
        "read": read,
        "update": update,
        "delete": delete,
        "deletetrigger": deletetrigger,
        "inserttrigger": inserttrigger,
    }
    action_map[args['action']](config, args)
dataset/ETHPy150Open emccode/heliosburn/heliosburn/hbcli/controllers/serveroverload.py/main/original