Expand description
This crate provides compile-time validation macros for AWS cloud infrastructure configuration. These macros ensure type safety and enforce AWS service limits at build time, preventing runtime errors from invalid configurations.
§Overview
All macros perform validation at compile time and generate wrapper types that encapsulate validated values.
The macros always return a newtype ‘wrapper’. You should import those from the rusty_cdk::wrappers directory, as seen in the below example.
§Usage Example
ⓘ
use rusty_cdk::wrappers::Memory; // import the wrapper
use rusty_cdk::memory;
// Lambda memory configuration with validated limit
let mem = memory!(512); // 512 MB (128-10240 range)Macros§
- app_
config_ name - Creates a validated
AppConfigNamewrapper for AWS AppConfig resource names at compile time. - bucket
- Creates a validated
Bucketwrapper for existing AWS S3 bucket references at compile time. - bucket_
name - Creates a validated
BucketNamewrapper for new AWS S3 bucket names at compile time. - cf_
connection_ timeout - Creates a validated
CfConnectionTimeoutwrapper for CloudFront origin connection timeouts at compile time. - connection_
attempts - Checks whether the value that will be wrapped in the ConnectionAttempts struct is between 1 and 3
- default_
root_ object - Creates a validated
DefaultRootObjectwrapper for CloudFront default root objects at compile time. - delay_
seconds - Checks whether the value that will be wrapped in the DelaySeconds struct is between 0 and 900
- deployment_
duration_ in_ minutes - Checks whether the value that will be wrapped in the DeploymentDurationInMinutes struct is between 0 and 1440
- env_
var_ key - Creates a validated
EnvVarKeywrapper for AWS Lambda environment variable keys at compile time. - growth_
factor - Checks whether the value that will be wrapped in the GrowthFactor struct is between 0 and 100
- iam_
action - Creates a validated
IamActionwrapper for AWS IAM permissions at compile time. - lambda_
permission_ action - Creates a validated
LambdaPermissionActionwrapper for Lambda resource-based policy actions at compile time. - lifecycle_
object_ sizes - Creates a validated
S3LifecycleObjectSizeswrapper for S3 lifecycle rule object size constraints at compile time. - lifecycle_
transition_ in_ days - Creates a validated
LifecycleTransitionInDayswrapper for S3 lifecycle transition rules at compile time. - location_
uri - Creates a validated
LocationUriwrapper for AppConfig - log_
group_ name - Creates a validated
LogGroupNamewrapper for AWS CloudWatch Logs log group names at compile time. - log_
retention - Creates a validated
RetentionInDayswrapper for AWS CloudWatch Logs retention periods at compile time. - maximum_
message_ size - Checks whether the value that will be wrapped in the MaximumMessageSize struct is between 1024 and 1048576
- memory
- Checks whether the value that will be wrapped in the Memory struct is between 128 and 10240
- message_
retention_ period - Checks whether the value that will be wrapped in the MessageRetentionPeriod struct is between 60 and 1209600
- non_
zero_ number - Creates a validated
NonZeroNumberwrapper for positive integers at compile time. - origin_
path - Creates a validated
OriginPathwrapper for CloudFront origin path prefixes at compile time. - receive_
message_ wait_ time - Checks whether the value that will be wrapped in the ReceiveMessageWaitTime struct is between 0 and 20
- s3_
origin_ read_ timeout - Checks whether the value that will be wrapped in the S3OriginReadTimeout struct is between 1 and 120
- sqs_
event_ source_ max_ concurrency - Checks whether the value that will be wrapped in the SqsEventSourceMaxConcurrency struct is between 2 and 1000
- string_
for_ secret - Creates a validated
StringForSecretwrapper for AWS Secrets Manager secret names at compile time. - string_
with_ only_ alphanumerics_ and_ hyphens - Creates a validated
StringWithOnlyAlphaNumericsUnderscoresAndHyphenswrapper at compile time. - string_
with_ only_ alphanumerics_ and_ underscores - Creates a validated
StringWithOnlyAlphaNumericsAndUnderscoreswrapper at compile time. - string_
with_ only_ alphanumerics_ underscores_ and_ hyphens - Creates a validated
StringWithOnlyAlphaNumericsUnderscoresAndHyphenswrapper at compile time. - timeout
- Checks whether the value that will be wrapped in the Timeout struct is between 1 and 900
- toml_
file - Creates a validated
TomlFilewrapper. - visibility_
timeout - Checks whether the value that will be wrapped in the VisibilityTimeout struct is between 0 and 43200
- zip_
file - Creates a validated
ZipFilewrapper for AWS Lambda deployment packages at compile time.