#!/usr/bin/python3

# Copyright (c) 2020 AT&T Intellectual Property.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-only

import argparse

from vyatta import configd
from vyatta.tacplus import utils

TACPLUS_MODULE = "vyatta-system-tacplus-v1"

def reset_suppression_timers():
    c = configd.Client()
    c.call_rpc(TACPLUS_MODULE, "reset-suppression-timers", "{}")
    return 0

OPS = {
    "reset-suppression-timers" : reset_suppression_timers
}

def main():
    parser = argparse.ArgumentParser(description="TACACS+ operations")
    parser.add_argument("operation", action="store", choices=OPS.keys(),
                        help="Operation name")
    args = parser.parse_args()

    try:
        return OPS[args.operation]()
    except configd.Exception as e:
        utils.print_err(e)
    except Exception as e:
        utils.print_err(f"An unexpected error occurred during operation '{args.operation}': {e}")
    return -1

if __name__ == "__main__":
    exit(main())
