Skip to main content

controller

Attribute Macro controller 

Source
#[controller]
Expand description

Macro for simplifying resource controller implementations.

When applied to a struct, it adds internal state management fields. When applied to an impl block, it generates the ResourceController trait implementation.

§Usage on struct:

#[controller]
struct AwsFunctionController {
    pub arn: Option<String>,
    pub url: Option<String>,
}

§Usage on impl:

#[controller]
impl AwsFunctionController {
    #[flow_entry(Create)]
    #[handler(state = CreateStart, on_failure = CreateFailed, status = ResourceStatus::Provisioning)]
    async fn create_start(&mut self, ctx: &ResourceControllerContext) -> Result<HandlerAction> {
        // ...
    }
}