Skip to main content

Crate rusty_cdk_macros

Crate rusty_cdk_macros 

Source
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 AppConfigName wrapper for AWS AppConfig resource names at compile time.
app_sync_api_name
Creates a validated AppSyncApiName wrapper 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 Bucket wrapper for existing AWS S3 bucket references at compile time.
bucket_name
Creates a validated BucketName wrapper for new AWS S3 bucket names at compile time.
bucket_tiering
cf_connection_timeout
Creates a validated CfConnectionTimeout wrapper for CloudFront origin connection timeouts at compile time.
channel_namespace_name
Creates a validated ChannelNamespaceName wrapper 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 DefaultRootObject wrapper 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 EnvVarKey wrapper 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 IamAction wrapper 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 LambdaPermissionAction wrapper for Lambda resource-based policy actions at compile time.
lifecycle_object_sizes
Creates a validated S3LifecycleObjectSizes wrapper for S3 lifecycle rule object size constraints at compile time.
lifecycle_transition_in_days
Creates a validated LifecycleTransitionInDays wrapper for S3 lifecycle transition rules at compile time.
location_uri
Creates a validated LocationUri wrapper for AppConfig
log_group_name
Creates a validated LogGroupName wrapper for AWS CloudWatch Logs log group names at compile time.
log_retention
Creates a validated RetentionInDays wrapper 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 NonZeroNumber wrapper for positive integers at compile time.
origin_path
Creates a validated OriginPath wrapper 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 StringForSecret wrapper for AWS Secrets Manager secret names at compile time.
string_with_only_alphanumerics_and_hyphens
Creates a validated StringWithOnlyAlphaNumericsUnderscoresAndHyphens wrapper at compile time.
string_with_only_alphanumerics_and_underscores
Creates a validated StringWithOnlyAlphaNumericsAndUnderscores wrapper at compile time.
string_with_only_alphanumerics_underscores_and_hyphens
Creates a validated StringWithOnlyAlphaNumericsUnderscoresAndHyphens wrapper 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 TomlFile wrapper.
topic_display_name
Creates a validated TopicDisplayName wrapper 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 ZipFile wrapper for AWS Lambda deployment packages at compile time.