Skip to content

Commit

Permalink
Merge branch 'hqapi-2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed May 4, 2010
2 parents 0ef5efc + 6465ba2 commit 0d2a510
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -79,6 +79,8 @@ Changes in HQApi 3.0

Changes in HQApi 2.4

*) [HHQ-3960] Allow filtering of alert definitions by priority.

*) [HHQ-3925] Add agent transferPlugin() AgentAPI and associated CLI command

*) [HHQ-3924] Add agent ping CLI command.
Expand Down
16 changes: 16 additions & 0 deletions src/org/hyperic/hq/hqapi1/tools/AlertDefinitionCommand.java
Expand Up @@ -67,6 +67,7 @@ public class AlertDefinitionCommand extends AbstractCommand {
private static String OPT_RESOURCE_NAME = "resourceName";
private static String OPT_RESOURCE_DESC = "resourceDescription";
private static String OPT_ALERT_NAME = "alertName";
private static String OPT_ALERT_PRIORITY = "alertPriority";
private static String OPT_ID = "id";
private static String OPT_BATCH_SIZE = "batchSize";
private static String OPT_ESCLATION = "escalation";
Expand Down Expand Up @@ -152,6 +153,10 @@ private void list(String[] args) throws Exception {
"which have at least one condition of the " +
"given type")
.withRequiredArg().ofType(Integer.class);
p.accepts(OPT_ALERT_PRIORITY, "If specified, only include alerts with " +
"the given priority. 3 = high, 2 = medium, " +
"1 = low")
.withRequiredArg().ofType(Integer.class);

OptionSet options = getOptions(p, args);

Expand Down Expand Up @@ -254,6 +259,17 @@ private void list(String[] args) throws Exception {
}
}

if (options.has(OPT_ALERT_PRIORITY)) {
Integer priority = (Integer)getRequired(options, OPT_ALERT_PRIORITY);
for (Iterator<AlertDefinition> i =
alertDefs.getAlertDefinition().iterator(); i.hasNext(); ) {
AlertDefinition d = i.next();
if (d.getPriority() != priority) {
i.remove();
}
}
}

checkSuccess(alertDefs);
XmlUtil.serialize(alertDefs, System.out, Boolean.TRUE);
}
Expand Down

0 comments on commit 0d2a510

Please sign in to comment.