@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetrics() == null) ? 0 : getMetrics().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; }
/** * <p> * The metrics. * </p> * * @param metrics * The metrics. * @return Returns a reference to this object so that method calls can be chained together. */ public ListMetricsResult withMetrics(java.util.Collection<Metric> metrics) { setMetrics(metrics); 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 ListMetricsResult withNextToken(String nextToken) { setNextToken(nextToken); return this; }
public ListMetricsResult unmarshall(StaxUnmarshallerContext context) throws Exception { ListMetricsResult listMetricsResult = new ListMetricsResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return listMetricsResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Metrics", targetDepth)) { listMetricsResult.withMetrics(new ArrayList<Metric>()); continue; } if (context.testExpression("Metrics/member", targetDepth)) { listMetricsResult.withMetrics(MetricStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("NextToken", targetDepth)) { listMetricsResult.setNextToken(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return listMetricsResult; } } } }
/** * <p> * A list of metrics used to generate statistics for an AWS account. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param metrics <p> * A list of metrics used to generate statistics for an AWS * account. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ListMetricsResult withMetrics(Metric... metrics) { if (getMetrics() == null) { this.metrics = new java.util.ArrayList<Metric>(metrics.length); } for (Metric value : metrics) { this.metrics.add(value); } return this; }
public ListMetricsResult unmarshall(StaxUnmarshallerContext context) throws Exception { ListMetricsResult listMetricsResult = new ListMetricsResult(); 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("Metrics/member", targetDepth)) { listMetricsResult.withMetrics(MetricStaxUnmarshaller.getInstance().unmarshall( context)); continue; } if (context.testExpression("NextToken", targetDepth)) { listMetricsResult.setNextToken(StringStaxUnmarshaller.getInstance().unmarshall( context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return listMetricsResult; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListMetricsResult == false) return false; ListMetricsResult other = (ListMetricsResult) obj; if (other.getMetrics() == null ^ this.getMetrics() == null) return false; if (other.getMetrics() != null && other.getMetrics().equals(this.getMetrics()) == 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 metrics. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setMetrics(java.util.Collection)} or {@link #withMetrics(java.util.Collection)} if you want to override * the existing values. * </p> * * @param metrics * The metrics. * @return Returns a reference to this object so that method calls can be chained together. */ public ListMetricsResult withMetrics(Metric... metrics) { if (this.metrics == null) { setMetrics(new com.amazonaws.internal.SdkInternalList<Metric>(metrics.length)); } for (Metric ele : metrics) { this.metrics.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 (getMetrics() != null) sb.append("Metrics: ").append(getMetrics()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); }
/** * <p> * A list of metrics used to generate statistics for an AWS account. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param metrics <p> * A list of metrics used to generate statistics for an AWS * account. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ListMetricsResult withMetrics(java.util.Collection<Metric> metrics) { setMetrics(metrics); return this; }
ListMetricsResult response = cw.listMetrics(request); for(Metric metric : response.getMetrics()) { System.out.printf( "Retrieved metric %s", metric.getMetricName()); request.setNextToken(response.getNextToken()); if(response.getNextToken() == null) { done = true;
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetrics() == null) ? 0 : getMetrics().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 ListMetricsResult == false) return false; ListMetricsResult other = (ListMetricsResult) obj; if (other.getMetrics() == null ^ this.getMetrics() == null) return false; if (other.getMetrics() != null && other.getMetrics().equals(this.getMetrics()) == 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 (getMetrics() != null) sb.append("Metrics: " + getMetrics() + ","); if (getNextToken() != null) sb.append("NextToken: " + getNextToken()); sb.append("}"); return sb.toString(); }
ListMetricsResult response = cw.listMetrics(request); if (getMetrics() == null) { metrics = response.getMetrics(); } else { metrics.addAll(response.getMetrics()); for (Metric metric : response.getMetrics()) { getLogger().debug("Retrieved metric %s", metric.getMetricName()); request.setNextToken(response.getNextToken()); if (response.getNextToken() == null) { done = true;
ListMetricsResult result = client.listMetrics(request); cloudwatchRequests.labels("listMetrics", rule.awsNamespace).inc(); for (Metric metric: result.getMetrics()) { if (metric.getDimensions().size() != dimensionFilters.size()) { nextToken = result.getNextToken(); } while (nextToken != null);