Skip to content

Commit

Permalink
[HHQ-3481] Add command line functionality to fix alerts with a reason…
Browse files Browse the repository at this point in the history
…/comment
  • Loading branch information
pnguyen committed Feb 22, 2010
1 parent e67c058 commit ff3dafd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/org/hyperic/hq/hqapi1/tools/AlertCommand.java
Expand Up @@ -153,17 +153,20 @@ 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);

HQApi api = getApi(options);
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);
Expand All @@ -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")
Expand Down

0 comments on commit ff3dafd

Please sign in to comment.