Skip to content

Commit

Permalink
Update GetMetricData.java
Browse files Browse the repository at this point in the history
  • Loading branch information
scmacdon authored Apr 8, 2020
1 parent 438bdd7 commit 030d4f4
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//snippet-sourcedescription:[PutMetricData.java demonstrates how to get metric data.]
//snippet-sourcedescription:[GetMetricData.java demonstrates how to get metric data.]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[Amazon CloudWatch]
Expand All @@ -20,7 +20,7 @@
* permissions and limitations under the License.
*/

// snippet-start:[cloudwatch.java2.put_metric_data.import]
// snippet-start:[cloudwatch.java2.get_metric_data.import]
package com.example.cloudwatch;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.cloudwatch.CloudWatchClient;
Expand All @@ -35,7 +35,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
// snippet-end:[cloudwatch.java2.put_metric_data.import]
// snippet-end:[cloudwatch.java2.get_metric_data.import]

/**
* Puts a sample metric data point
Expand All @@ -52,7 +52,7 @@ public static void main(String[] args) {
getMetData(cw) ;
}

// snippet-start:[cloudwatch.java2.put_metric_alarm.main]
// snippet-start:[cloudwatch.java2.get_metric_alarm.main]
public static void getMetData( CloudWatchClient cw) {

try {
Expand Down Expand Up @@ -96,14 +96,14 @@ public static void getMetData( CloudWatchClient cw) {
for (int i = 0; i < data.size(); i++) {

MetricDataResult item = (MetricDataResult) data.get(i);
System.out.println("The label is "+item.label());
System.out.println("The label is "+item.label());
System.out.println("The status code is "+item.statusCode().toString());
}

} catch (CloudWatchException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
// snippet-end:[cloudwatch.java2.put_metric_alarm.main]
// snippet-end:[cloudwatch.java2.get_metric_alarm.main]
}
}

0 comments on commit 030d4f4

Please sign in to comment.