diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatch.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatch.java index 88275db690..91de69af63 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatch.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatch.java @@ -36,18 +36,19 @@ public class CloudWatch { * List metrics based on the criteria in the {@link ListMetricsOptions} passed in. * * @param cloudWatchClient the CloudWatch client + * @param region the region to list metrics in * @param options the options describing the ListMetrics request * * @return iterable of metrics fitting the criteria */ public static Iterable listMetrics(final CloudWatchClient cloudWatchClient, - final ListMetricsOptions options) { + final String region, final ListMetricsOptions options) { return new Iterable() { public Iterator iterator() { return new AbstractIterator() { private ListMetricsOptions lastOptions = options; - private ListMetricsResponse response = cloudWatchClient.listMetrics(lastOptions); + private ListMetricsResponse response = cloudWatchClient.listMetrics(region, lastOptions); private Iterator iterator = response.getMetrics().iterator(); /** @@ -63,7 +64,7 @@ public class CloudWatch { .namespace(lastOptions.getNamespace()) .nextToken(response.getNextToken()) .build(); - response = cloudWatchClient.listMetrics(lastOptions); + response = cloudWatchClient.listMetrics(region, lastOptions); iterator = response.getMetrics().iterator(); } if (iterator.hasNext()) { diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java index 83c93c7ce4..c98e12873e 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java @@ -79,21 +79,25 @@ public interface CloudWatchAsyncClient { GetMetricStatisticsOptions... options); /** - * @see CloudWatchClient#listMetrics(org.jclouds.cloudwatch.options.ListMetricsOptions) + * @see CloudWatchClient#listMetrics(String, org.jclouds.cloudwatch.options.ListMetricsOptions) */ @POST @Path("/") @XMLResponseParser(ListMetricsResponseHandler.class) @FormParams(keys = "Action", values = "ListMetrics") - ListenableFuture listMetrics(ListMetricsOptions options); + ListenableFuture listMetrics( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, + ListMetricsOptions options); /** - * @see CloudWatchClient#getMetricStatistics(org.jclouds.cloudwatch.options.GetMetricStatisticsOptionsV2) + * @see CloudWatchClient#getMetricStatistics(String, org.jclouds.cloudwatch.options.GetMetricStatisticsOptionsV2) */ @POST @Path("/") @XMLResponseParser(GetMetricStatisticsResponseHandlerV2.class) @FormParams(keys = "Action", values = "GetMetricStatistics") - ListenableFuture getMetricStatistics(GetMetricStatisticsOptionsV2 options); + ListenableFuture getMetricStatistics( + @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, + GetMetricStatisticsOptionsV2 options); } diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java index b73b34c907..cb3da3bb92 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java @@ -92,21 +92,23 @@ public interface CloudWatchClient { *

Note

Up to 500 results are returned for any one call. To retrieve further results, use returned * NextToken ({@link org.jclouds.cloudwatch.domain.ListMetricsResponse#getNextToken()}) * value with subsequent calls .To retrieve all available metrics with one call, use - * {@link CloudWatch#listMetrics(CloudWatchClient, org.jclouds.cloudwatch.options.ListMetricsOptions)}. + * {@link CloudWatch#listMetrics(CloudWatchClient, String, org.jclouds.cloudwatch.options.ListMetricsOptions)}. * + * @param region the region to query metrics in * @param options the options describing the metrics query * * @return the response object */ - ListMetricsResponse listMetrics(ListMetricsOptions options); + ListMetricsResponse listMetrics(@Nullable String region, ListMetricsOptions options); /** * Gets statistics for the specified metric. * + * @param region the region to gather metrics in * @param options the options describing the metric statistics query * * @return the response object */ - GetMetricStatisticsResponse getMetricStatistics(GetMetricStatisticsOptionsV2 options); + GetMetricStatisticsResponse getMetricStatistics(@Nullable String region, GetMetricStatisticsOptionsV2 options); } diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Datapoint.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Datapoint.java index 2238915b39..c9f0459d66 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Datapoint.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Datapoint.java @@ -119,7 +119,7 @@ public class Datapoint { @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), average, customUnit, maximum, minimum, samples, sum, timestamp, unit); + return Objects.hashCode(average, customUnit, maximum, minimum, samples, sum, timestamp, unit); } @Override @@ -132,7 +132,7 @@ public class Datapoint { return false; Datapoint other = (Datapoint) obj; return Objects.equal(this.average, other.average) && - Objects.equal(this.customUnit, other.maximum) && + Objects.equal(this.customUnit, other.customUnit) && Objects.equal(this.maximum, other.maximum) && Objects.equal(this.minimum, other.minimum) && Objects.equal(this.samples, other.samples) && diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Dimension.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Dimension.java index 8c99618bf3..6fe8228c84 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Dimension.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Dimension.java @@ -54,7 +54,7 @@ public class Dimension { */ @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), name, value); + return Objects.hashCode(name, value); } /** diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/GetMetricStatisticsResponse.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/GetMetricStatisticsResponse.java index e26781ee6a..35c195f0f8 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/GetMetricStatisticsResponse.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/GetMetricStatisticsResponse.java @@ -62,7 +62,7 @@ public class GetMetricStatisticsResponse { */ @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), datapoints, label); + return Objects.hashCode(datapoints, label); } /** diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/ListMetricsResponse.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/ListMetricsResponse.java index 7ce0bc0794..7411f46a7e 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/ListMetricsResponse.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/ListMetricsResponse.java @@ -64,7 +64,7 @@ public class ListMetricsResponse { */ @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), metrics, nextToken); + return Objects.hashCode(metrics, nextToken); } /** diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Metric.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Metric.java index 8f1d8b373e..1a4f79d282 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Metric.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/domain/Metric.java @@ -74,7 +74,7 @@ public class Metric { */ @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), dimensions, metricName, namespace); + return Objects.hashCode(dimensions, metricName, namespace); } /** diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java index 9f8519b3e7..a79ce1a9bd 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java @@ -69,7 +69,7 @@ import static org.testng.Assert.assertEquals; public class CloudWatchAsyncClientTest extends BaseAsyncClientTest { /** - * Tests that {@link CloudWatchAsyncClient#getMetricStatistics(org.jclouds.cloudwatch.options.GetMetricStatisticsOptionsV2)} + * Tests that {@link CloudWatchAsyncClient#getMetricStatistics(String, org.jclouds.cloudwatch.options.GetMetricStatisticsOptionsV2)} * works as expected. * * @throws Exception if anything goes wrong @@ -97,8 +97,9 @@ public class CloudWatchAsyncClientTest extends BaseAsyncClientTest 0) { @@ -91,7 +91,7 @@ public class CloudWatchClientLiveTest extends BaseContextLiveTest 0) { checkNotNull(response.getLabel()); @@ -123,7 +123,7 @@ public class CloudWatchClientLiveTest extends BaseContextLiveTest