@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetricAlarms() == null) ? 0 : getMetricAlarms().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
/** * <p> * The information for the specified alarms. * </p> * * @param metricAlarms * The information for the specified alarms. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAlarmsResult withMetricAlarms(java.util.Collection<MetricAlarm> metricAlarms) { setMetricAlarms(metricAlarms); return this; }
/** * <p> * The token that marks the start of the next batch of returned results. * </p> * * @param nextToken * The token that marks the start of the next batch of returned results. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAlarmsResult withNextToken(String nextToken) { setNextToken(nextToken); return this; }
public DescribeAlarmsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeAlarmsResult describeAlarmsResult = new DescribeAlarmsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeAlarmsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("MetricAlarms", targetDepth)) { describeAlarmsResult.withMetricAlarms(new ArrayList<MetricAlarm>()); continue; } if (context.testExpression("MetricAlarms/member", targetDepth)) { describeAlarmsResult.withMetricAlarms(MetricAlarmStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("NextToken", targetDepth)) { describeAlarmsResult.setNextToken(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeAlarmsResult; } } } }
public DescribeAlarmsResult describeAlarms(DescribeAlarmsRequest request) { return new DescribeAlarmsResult() .withMetricAlarms( describe(request, "alarmNames", "alarms", MetricAlarm.class)); }
/** * <p> * A list of information for the specified alarms. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param metricAlarms <p> * A list of information for the specified alarms. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public DescribeAlarmsResult withMetricAlarms(MetricAlarm... metricAlarms) { if (getMetricAlarms() == null) { this.metricAlarms = new java.util.ArrayList<MetricAlarm>(metricAlarms.length); } for (MetricAlarm value : metricAlarms) { this.metricAlarms.add(value); } return this; }
public DescribeAlarmsResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeAlarmsResult describeAlarmsResult = new DescribeAlarmsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("MetricAlarms/member", targetDepth)) { describeAlarmsResult.withMetricAlarms(MetricAlarmStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } if (context.testExpression("NextToken", targetDepth)) { describeAlarmsResult.setNextToken(StringStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return describeAlarmsResult; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeAlarmsResult == false) return false; DescribeAlarmsResult other = (DescribeAlarmsResult) obj; if (other.getMetricAlarms() == null ^ this.getMetricAlarms() == null) return false; if (other.getMetricAlarms() != null && other.getMetricAlarms().equals(this.getMetricAlarms()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; return true; }
/** * <p> * The information for the specified alarms. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setMetricAlarms(java.util.Collection)} or {@link #withMetricAlarms(java.util.Collection)} if you want to * override the existing values. * </p> * * @param metricAlarms * The information for the specified alarms. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAlarmsResult withMetricAlarms(MetricAlarm... metricAlarms) { if (this.metricAlarms == null) { setMetricAlarms(new com.amazonaws.internal.SdkInternalList<MetricAlarm>(metricAlarms.length)); } for (MetricAlarm ele : metricAlarms) { this.metricAlarms.add(ele); } return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMetricAlarms() != null) sb.append("MetricAlarms: ").append(getMetricAlarms()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
/** * <p> * A list of information for the specified alarms. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param metricAlarms <p> * A list of information for the specified alarms. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public DescribeAlarmsResult withMetricAlarms(java.util.Collection<MetricAlarm> metricAlarms) { setMetricAlarms(metricAlarms); return this; }
public static void main(String[] args) { final AmazonCloudWatch cw = AmazonCloudWatchClientBuilder.defaultClient(); boolean done = false; DescribeAlarmsRequest request = new DescribeAlarmsRequest(); while(!done) { DescribeAlarmsResult response = cw.describeAlarms(request); for(MetricAlarm alarm : response.getMetricAlarms()) { System.out.printf("Retrieved alarm %s", alarm.getAlarmName()); } request.setNextToken(response.getNextToken()); if(response.getNextToken() == null) { done = true; } } } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetricAlarms() == null) ? 0 : getMetricAlarms().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeAlarmsResult == false) return false; DescribeAlarmsResult other = (DescribeAlarmsResult) obj; if (other.getMetricAlarms() == null ^ this.getMetricAlarms() == null) return false; if (other.getMetricAlarms() != null && other.getMetricAlarms().equals(this.getMetricAlarms()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMetricAlarms() != null) sb.append("MetricAlarms: " + getMetricAlarms() + ","); if (getNextToken() != null) sb.append("NextToken: " + getNextToken()); sb.append("}"); return sb.toString(); }