[][src]Crate cfn_custom_resource

A Rust create to facilitate 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.

A simple example is below:

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();
        }
    }
}

Structs

CloudformationPayload

Defines the data that encapsualtes the payload sent by cloudformation to a lambda function. This includes all data in the payload except the inner event type. This structure is encapsulated by the CustomResourceEvent that defines that event type as well.

CustomResourceResponse

Define a response payload for the execution of a cloud formation custom resource data that is sent back to cloud formation after the process of executing the custom resource is complete.

Enums

CustomResourceEvent

Defines an event payload that is sent to a lambda function by AWS Cloud Formation. This payload is defined by AWS as the following: