in utils/rules_update.py [0:0]
def main():
'''
Main Function Used to control the code flow
'''
args=parsers()
try:
data = read_json(PATH_TEMPLATE)
except FileNotFoundError:
Logger.info(f"Template File Does not exist or the file path is incorrect")
return
if args.view:
try:
data = read_json(PATH)
#Iterating on the rules to print one by one
for i in data[args.doc_type]:
Logger.info(f"{i} : {data[args.doc_type][i]}")
except FileNotFoundError:
Logger.info(f"File Does not exist or the file path is incorrect")
except KeyError:
Logger.info(f"Document Name is incorrect")
return
if args.delete:
try:
data = read_json(PATH)
data[args.doc_type].pop(args.ruleid)
json.dump(data, open(file_name,"w"))
upload_bucket()
os.remove(file_name)
except FileNotFoundError:
Logger.info(f"File Does not exist or the file path is incorrect")
return
params = get_params(args)
template = load_template(data,args)
try:
jinn = prep_sql(template,params)
except TypeError as e:
Logger.info(f"Incorrect Input Format")
return
data = update_json(jinn,args)
dump_updated_json(data)
upload_bucket()
os.remove(file_name)