changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/lib/tenex/models/aws/lib.rs

changeset 189: 3d78bed56188
parent: 0ccbbd142694
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 02 Feb 2024 19:47:03 -0500
permissions: -rw-r--r--
description: apply clippy fixes
1 //! aws/lib.rs --- AWS client model
2 pub use aws_config::{meta::region::RegionProviderChain, Region};
3 pub fn new_region(region: Option<String>) -> RegionProviderChain {
4  RegionProviderChain::first_try(region.map(Region::new))
5  .or_default_provider()
6  .or_else(Region::new("us-east-2"))
7 }
8 
9 /// Route53
10 pub async fn show_host_info(
11  client: &aws_sdk_route53::Client,
12 ) -> Result<(), aws_sdk_route53::Error> {
13  let hosted_zone_count = client.get_hosted_zone_count().send().await?;
14 
15  println!(
16  "Number of hosted zones in region : {}",
17  hosted_zone_count.hosted_zone_count(),
18  );
19 
20  let hosted_zones = client.list_hosted_zones().send().await?;
21 
22  println!("Zones:");
23 
24  for hz in hosted_zones.hosted_zones() {
25  let zone_name = hz.name();
26  let zone_id = hz.id();
27 
28  println!(" ID : {}", zone_id);
29  println!(" Name : {}", zone_name);
30  println!();
31  }
32 
33  Ok(())
34 }
35 
36 //// EC2
37 // pub async fn start_instance(client: &aws_sdk_ec2::Client, id: &str) ->
38 // Result<(), aws_sdk_ec2::Error> { client.start_instances().
39 // instance_ids(id).send().await?;
40 
41 // println!("Started instance.");
42 
43 // Ok(())
44 // }
45 
46 // pub async fn delete_snapshot(client: &aws_sdk_ec2::Client, id: &str) ->
47 // Result<(), aws_sdk_ec2::Error> { client.delete_snapshot().
48 // snapshot_id(id).send().await?; Ok(())
49 // }