cfn-custom-resource

Crates.iocfn-custom-resource
lib.rscfn-custom-resource
version0.1.1
sourcesrc
created_at2020-07-11 02:07:02.586678
updated_at2020-07-11 21:23:39.754128
descriptionA Rust create to facilitate the creation of Rust Lambda Powered Custom Resources
homepagehttps://github.com/resilient-vitality/cfn-custom-resource
repositoryhttps://github.com/resilient-vitality/cfn-custom-resource
max_upload_size
id263909
size14,695
Zach Probst (zprobst)

documentation

README

Rust cfn-custom-resource

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();
        }
    }
}
Commit count: 0

cargo fmt