use aws_config::{BehaviorVersion, SdkConfig}; use aws_sdk_autoscaling as asg; use aws_sdk_ec2 as ec2; use aws_sdk_route53 as route53; use crate::autoscaling::AutoScaling; use crate::ec2::Ec2; use crate::route53::Route53; pub struct AwsContext { asg: asg::Client, ec2: ec2::Client, route53: route53::Client, } impl AwsContext { pub async fn from_env() -> Self { let config = aws_config::defaults(BehaviorVersion::v2024_03_28()) .load() .await; Self::new(&config) } fn new(config: &SdkConfig) -> Self { Self { asg: asg::Client::new(config), ec2: ec2::Client::new(config), route53: route53::Client::new(config), } } } impl AutoScaling for AwsContext { fn autoscaling(&self) -> &asg::Client { &self.asg } } impl Ec2 for AwsContext { fn ec2(&self) -> &ec2::Client { &self.ec2 } } impl Route53 for AwsContext { fn route53(&self) -> &route53::Client { &self.route53 } }