Unverified Commit c01245fb authored by Will's avatar Will Committed by GitHub
Browse files

Add support for RDS (#455)

parent ed6f6215
Loading
Loading
Loading
Loading
+19402 −0

File added.

Preview size limit exceeded, changes collapsed.

+12 −0
Original line number Diff line number Diff line
[package]
authors = ["LMJW <heysuperming@gmail.com>"]
edition = "2018"
name = "rds-helloworld"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rds = {package = "aws-sdk-rds", path = "../../build/aws-sdk/rds"}

tokio = {version = "1", features = ["full"]}
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#[tokio::main]
async fn main() -> Result<(), rds::Error> {
    let conf = rds::Config::builder()
        .region(rds::Region::new("us-east-1"))
        .build();
    let client = rds::Client::from_conf(conf);
    let result = client.describe_db_instances().send().await?;

    for db_instance in result.db_instances.unwrap_or_default() {
        println!(
            "DB instance identifier: {:?}",
            db_instance
                .db_instance_identifier
                .expect("instance should have identifiers")
        );
        println!(
            "DB instance class: {:?}",
            db_instance
                .db_instance_class
                .expect("instance should have class")
        );
        println!(
            "DB instance engine: {:?}",
            db_instance.engine.expect("instance should have engine")
        );
        println!(
            "DB instance status: {:?}",
            db_instance
                .db_instance_status
                .expect("instance should have status")
        );
        println!(
            "DB instance endpoint: {:?}",
            db_instance.endpoint.expect("instance should have endpoint")
        );
    }

    Ok(())
}