From 1754b64db14a1ea409779738a84d020fbb1ac79b Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 25 Jul 2024 20:01:46 -0400 Subject: Unify dns_name and dns_ttl into a "target" type, pass that around. --- src/cli.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index 340d537..7a8d2c7 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -7,7 +7,7 @@ use trust_dns_proto::rr::Name; use crate::apply::ApplyMode; use crate::aws_context::AwsContext; use crate::converge::named_asg_changes; -use crate::dns::absolute; +use crate::route53::Target; /// Synchronize a DNS entry with an autoscaling group's running instances. /// @@ -45,14 +45,9 @@ impl Args { let args = Args::parse(); let aws_context = AwsContext::from_env().await; + let target = self.target()?; - let changes = named_asg_changes( - &aws_context, - &args.autoscaling_group, - &absolute(args.dns_name)?, - args.dns_ttl, - ) - .await?; + let changes = named_asg_changes(&aws_context, &target, &args.autoscaling_group).await?; self.apply_mode() .apply( @@ -75,4 +70,9 @@ impl Args { (true, true) => unreachable!("Cannot set --apply and --dry-run together"), } } + + fn target(&self) -> Result { + let target = Target::new(&self.dns_name, self.dns_ttl)?; + Ok(target) + } } -- cgit v1.2.3