Crates.io | cfn-custom-resource |
lib.rs | cfn-custom-resource |
version | 0.1.1 |
source | src |
created_at | 2020-07-11 02:07:02.586678 |
updated_at | 2020-07-11 21:23:39.754128 |
description | A Rust create to facilitate the creation of Rust Lambda Powered Custom Resources |
homepage | https://github.com/resilient-vitality/cfn-custom-resource |
repository | https://github.com/resilient-vitality/cfn-custom-resource |
max_upload_size | |
id | 263909 |
size | 14,695 |
A Rust create to facilate the creation of Rust Lambda Powered Custom Resources for AWS Cloudformation. It does not cast an opinion on which aws lambda custom runtime that the function is executing in.
use cfn_custom_resource::CustomResourceEvent;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
struct MyParameters {
value_one: i64,
value_two: i64,
}
async fn my_handler_func(event: CustomResourceEvent<MyParameters>) {
match event {
CustomResourceEvent::Create(data) => {
println!(
"{}",
data.resource_properties.value_one + data.resource_properties.value_two
);
data.respond_with_success("all done")
.finish()
.await
.unwrap();
}
CustomResourceEvent::Update(data) => {
println!("got an update");
data.respond_with_success("all done")
.finish()
.await
.unwrap();
}
CustomResourceEvent::Delete(data) => {
println!("got a delete");
data.respond_with_success("all done")
.finish()
.await
.unwrap();
}
}
}