Skip to content

Commit d3785a5

Browse files
committed
Add arn
1 parent 4dc3e59 commit d3785a5

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/main.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,32 @@ async fn function_handler(event: LambdaEvent<LogsEvent>) -> Result<(), Error> {
2727

2828
println!("{:?}", v);
2929

30+
let arn = v["requestParameters"]["tagSpecificationSet"]["items"]
31+
.as_array()
32+
.unwrap()
33+
.iter()
34+
.filter(|x| x["resourceType"] == "image")
35+
.map(|x| &x["tags"])
36+
.next()
37+
.unwrap()
38+
.as_array()
39+
.unwrap()
40+
.iter()
41+
.filter(|x| x["key"] == "Ec2ImageBuilderArn")
42+
.map(|x| &x["value"])
43+
.next()
44+
.unwrap()
45+
.as_str()
46+
.unwrap();
47+
3048
let rsp = client
3149
.publish()
3250
.topic_arn(std::env::var("TOPIC_ARN").unwrap())
33-
.message(v["responseElements"]["imageId"].as_str().unwrap())
51+
.message(format!(
52+
"{} {}",
53+
arn,
54+
v["responseElements"]["imageId"].as_str().unwrap()
55+
))
3456
.send()
3557
.await?;
3658

0 commit comments

Comments
 (0)