Unverified Commit 82cb50ea authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Use ChainProvider for region in Snowball examples (#580)

* Use ChainProvider for region in Snowball examples

* Change default_region to region in Cognito and Snowball examples
parent 3e4cec37
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.aws.traits.ServiceTrait
import kotlin.streams.toList
import org.jetbrains.kotlin.utils.ifEmpty

extra["displayName"] = "Smithy :: Rust :: AWS-SDK"
extra["moduleName"] = "software.amazon.smithy.rust.awssdk"
+5 −8
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ use structopt::StructOpt;

#[derive(Debug, StructOpt)]
struct Opt {
    /// The default region
    /// The region
    #[structopt(short, long)]
    default_region: Option<String>,
    region: Option<String>,

    /// Whether to display additional information
    #[structopt(short, long)]
@@ -21,7 +21,7 @@ struct Opt {
/// Lists your Amazon Cognito identities
/// # Arguments
///
/// * `[-d DEFAULT-REGION]` - The region containing the buckets.
/// * `[-r REGION]` - The region containing the buckets.
///   If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable.
///   If the environment variable is not set, defaults to **us-west-2**.
/// * `[-g]` - Whether to display buckets in all regions.
@@ -30,12 +30,9 @@ struct Opt {
async fn main() -> Result<(), Error> {
    tracing_subscriber::fmt::init();

    let Opt {
        default_region,
        verbose,
    } = Opt::from_args();
    let Opt { region, verbose } = Opt::from_args();

    let region_provider = region::ChainProvider::first_try(default_region.map(Region::new))
    let region_provider = region::ChainProvider::first_try(region.map(Region::new))
        .or_default_provider()
        .or_else(Region::new("us-west-2"));

+5 −8
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ use structopt::StructOpt;

#[derive(Debug, StructOpt)]
struct Opt {
    /// The default region
    /// The region
    #[structopt(short, long)]
    default_region: Option<String>,
    region: Option<String>,

    /// Whether to display additional information
    #[structopt(short, long)]
@@ -21,7 +21,7 @@ struct Opt {
/// Lists your Amazon Cognito user pools
/// # Arguments
///
/// * `[-d DEFAULT-REGION]` - The region containing the buckets.
/// * `[-r REGION]` - The region containing the buckets.
///   If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable.
///   If the environment variable is not set, defaults to **us-west-2**.
/// * `[-g]` - Whether to display buckets in all regions.
@@ -30,12 +30,9 @@ struct Opt {
async fn main() -> Result<(), Error> {
    tracing_subscriber::fmt::init();

    let Opt {
        default_region,
        verbose,
    } = Opt::from_args();
    let Opt { region, verbose } = Opt::from_args();

    let region_provider = region::ChainProvider::first_try(default_region.map(Region::new))
    let region_provider = region::ChainProvider::first_try(region.map(Region::new))
        .or_default_provider()
        .or_else(Region::new("us-west-2"));

+5 −8
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ use structopt::StructOpt;

#[derive(Debug, StructOpt)]
struct Opt {
    /// The default region
    /// The region
    #[structopt(short, long)]
    default_region: Option<String>,
    region: Option<String>,

    /// Whether to display additional information
    #[structopt(short, long)]
@@ -21,7 +21,7 @@ struct Opt {
/// Lists identity pools registered with  Amazon Cognito
/// # Arguments
///
/// * `[-d DEFAULT-REGION]` - The region containing the buckets.
/// * `[-r REGION]` - The region containing the buckets.
///   If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable.
///   If the environment variable is not set, defaults to **us-west-2**.
/// * `[-g]` - Whether to display buckets in all regions.
@@ -30,12 +30,9 @@ struct Opt {
async fn main() -> Result<(), Error> {
    tracing_subscriber::fmt::init();

    let Opt {
        default_region,
        verbose,
    } = Opt::from_args();
    let Opt { region, verbose } = Opt::from_args();

    let region_provider = region::ChainProvider::first_try(default_region.map(Region::new))
    let region_provider = region::ChainProvider::first_try(region.map(Region::new))
        .or_default_provider()
        .or_else(Region::new("us-west-2"));

+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ edition = "2018"
[dependencies]
tokio = { version = "1", features = ["full"]}
aws-sdk-snowball = { path = "../../build/aws-sdk/snowball" }
aws-hyper = { path = "../../build/aws-sdk/aws-hyper" }
aws-types = { path = "../../build/aws-sdk/aws-types" }
structopt = { version = "0.3", default-features = false }
tracing-subscriber = { version = "0.2.16", features = ["fmt"] }
Loading