-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cloudwatch metrics (cloudwatch) & example (#554)
* Add cloudwatch metrics (cloudwatch) * remove unused dependencies
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ val tier1Services = setOf( | |
"sqs", | ||
"ssm", | ||
"sts", | ||
"cloudwatch", | ||
"ecr", | ||
"eks" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "cloudwatch-code-examples" | ||
version = "0.1.0" | ||
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
cloudwatch = { package = "aws-sdk-cloudwatch", path = "../../build/aws-sdk/cloudwatch" } | ||
tokio = { version = "1", features = ["full"] } | ||
tracing-subscriber = { version = "0.2", features = ["fmt"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
use cloudwatch::Client; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), cloudwatch::Error> { | ||
tracing_subscriber::fmt::init(); | ||
|
||
let client = Client::from_env(); | ||
let rsp = client.list_metrics().send().await?; | ||
let metrics = rsp.metrics.unwrap_or_default(); | ||
println!("found {} metric(s)", metrics.len()); | ||
for metric in metrics { | ||
println!("metric: {:?}", metric); | ||
} | ||
Ok(()) | ||
} |