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. - app_
sync_ api_ name - Creates a validated
AppSyncApiNamewrapper for AppSync Api names at compile time. - archive_
policy - Checks whether the value that will be wrapped in the ArchivePolicy struct is between 1 and 365
- 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. - bucket_
tiering - cf_
connection_ timeout - Creates a validated
CfConnectionTimeoutwrapper for CloudFront origin connection timeouts at compile time. - channel_
namespace_ name - Creates a validated
ChannelNamespaceNamewrapper for AppSync Api 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. - key_
reuse_ period - Checks whether the value that will be wrapped in the KeyReusePeriod struct is between 60 and 86400
- 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. - max_
flexible_ time_ window - Checks whether the value that will be wrapped in the MaxFlexibleTimeWindow struct is between 1 and 1440
- 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. - policy_
name - receive_
message_ wait_ time - Checks whether the value that will be wrapped in the ReceiveMessageWaitTime struct is between 0 and 20
- record_
expiration_ days - Checks whether the value that will be wrapped in the RecordExpirationDays struct is between 7 and 2147483647
- retry_
policy_ event_ age - Checks whether the value that will be wrapped in the RetryPolicyEventAge struct is between 60 and 86400
- retry_
policy_ retries - Checks whether the value that will be wrapped in the RetryPolicyRetries struct is between 0 and 185
- s3_
origin_ read_ timeout - Checks whether the value that will be wrapped in the S3OriginReadTimeout struct is between 1 and 120
- schedule_
at_ expression - schedule_
cron_ expression - schedule_
name - schedule_
rate_ expression - 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. - success_
feedback_ sample_ rate - Checks whether the value that will be wrapped in the SuccessFeedbackSampleRate struct is between 0 and 100
- timeout
- Checks whether the value that will be wrapped in the Timeout struct is between 1 and 900
- toml_
file - Creates a validated
TomlFilewrapper. - topic_
display_ name - Creates a validated
TopicDisplayNamewrapper at compile time. - 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.