[][src]Trait cfn_resource_provider::PhysicalResourceIdSuffixProvider

pub trait PhysicalResourceIdSuffixProvider {
    fn physical_resource_id_suffix(&self) -> String;
}

Every AWS CloudFormation resource, including custom resources, needs a unique physical resource ID. To aid in supplying this resource ID, your resource property type has to implement this trait with its single member, physical_resource_id_suffix.

When this library creates the response which will be sent to AWS CloudFormation, a physical resource ID will be created according to the following format (where suffix will be the suffix provided by the implementor):

arn:custom:cfn-resource-provider:::{stack_id}-{logical_resource_id}/{suffix}

The fields of a property-type used for suffix creation should be chosen as such that it changes when ever the custom resource implementation has to create an actual new physical resource. The suffix should also include the type of resource, maybe including a version number.

Example

Let's assume you have the following type and trait implementation:

struct MyResourcePropertiesType {
    my_unique_parameter: String,
    some_other_parameter: String,
}
impl PhysicalResourceIdSuffixProvider for MyResourcePropertiesType {
    fn physical_resource_id_suffix(&self) -> String {
        format!(
            "{resource_type}@{version}/{unique_reference}",
            resource_type=env!("CARGO_PKG_NAME"),
            version=env!("CARGO_PKG_VERSION"),
            unique_reference=self.my_unique_parameter,
        )
    }
}

When CfnResponse creates or updates the physical ID for the resource, it might look like the following:

arn:custom:cfn-resource-provider:::12345678-1234-1234-1234-1234567890ab-logical-id/myresource@1.0.0/uniquereference

In this case my_unique_parameter is assumed to be the parameter that requires the custom resource implementation to create a new physical resource, thus the ID changes with it.

Required methods

fn physical_resource_id_suffix(&self) -> String

Creates a suffix that uniquely identifies the physical resource represented by the type holding the AWS CloudFormation resource properties.

Loading content...

Implementations on Foreign Types

impl<T> PhysicalResourceIdSuffixProvider for Option<T> where
    T: PhysicalResourceIdSuffixProvider
[src]

impl PhysicalResourceIdSuffixProvider for ()[src]

Loading content...

Implementors

impl PhysicalResourceIdSuffixProvider for Ignored[src]

Loading content...