From ff3dafd0067a4979b36d295119bc1c1cf0d1f689 Mon Sep 17 00:00:00 2001 From: pnguyen Date: Mon, 22 Feb 2010 12:48:49 -0800 Subject: [PATCH] [HHQ-3481] Add command line functionality to fix alerts with a reason/comment --- src/org/hyperic/hq/hqapi1/tools/AlertCommand.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/org/hyperic/hq/hqapi1/tools/AlertCommand.java b/src/org/hyperic/hq/hqapi1/tools/AlertCommand.java index baa0e625..5d2ff5d2 100644 --- a/src/org/hyperic/hq/hqapi1/tools/AlertCommand.java +++ b/src/org/hyperic/hq/hqapi1/tools/AlertCommand.java @@ -153,8 +153,10 @@ private void fix(String[] args) throws Exception { OptionParser p = getOptionParser(); - p.accepts(OPT_ID, "The id of the Alert to fix"). - withRequiredArg().ofType(Integer.class); + p.accepts(OPT_ID, "The id of the alert to fix") + .withRequiredArg().ofType(Integer.class); + p.accepts(OPT_REASON, "The reason for fixing the alert") + .withRequiredArg().ofType(String.class); OptionSet options = getOptions(p, args); @@ -162,8 +164,9 @@ private void fix(String[] args) throws Exception { AlertApi alertApi = api.getAlertApi(); Integer id = (Integer)getRequired(options, OPT_ID); + String reason = (String)options.valueOf(OPT_REASON); - AlertResponse response = alertApi.fixAlert(id); + AlertResponse response = alertApi.fixAlert(id, reason); checkSuccess(response); System.out.println("Successfully fixed alert id " + id); @@ -175,7 +178,7 @@ private void ack(String[] args) throws Exception { p.accepts(OPT_ID, "The id of the Alert to acknowledge"). withRequiredArg().ofType(Integer.class); - p.accepts(OPT_REASON, "The reason for acknoledging the alert") + p.accepts(OPT_REASON, "The reason for acknowledging the alert") .withRequiredArg().ofType(String.class); p.accepts(OPT_PAUSE, "If specified, pause the Escalation for the " + "given number of milliseconds")