Loading aws/sdk/examples/polly-describe-voices/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "polly-describe-voices" version = "0.1.0" authors = ["Doug Schwartz <dougsch@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] polly = { package = "aws-sdk-polly", path = "../../build/aws-sdk/polly" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws-types = { path = "../../build/aws-sdk/aws-types" } aws/sdk/examples/polly-describe-voices/src/main.rs 0 → 100644 +72 −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. */ use std::process; use polly::{Client, Config, Region}; use aws_types::region::{EnvironmentProvider, ProvideRegion}; use structopt::StructOpt; use tracing_subscriber::fmt::format::FmtSpan; use tracing_subscriber::fmt::SubscriberBuilder; #[derive(Debug, StructOpt)] struct Opt { /// The region #[structopt(short, long)] region: Option<String>, /// Display additional information #[structopt(short, long)] verbose: bool, } #[tokio::main] async fn main() { let Opt { region, verbose } = Opt::from_args(); let region = EnvironmentProvider::new() .region() .or_else(|| region.as_ref().map(|region| Region::new(region.clone()))) .unwrap_or_else(|| Region::new("us-west-2")); if verbose { println!("polly client version: {}\n", polly::PKG_VERSION); println!("Region: {:?}", ®ion); SubscriberBuilder::default() .with_env_filter("info") .with_span_events(FmtSpan::CLOSE) .init(); } let config = Config::builder().region(region).build(); let client = Client::from_conf(config); match client.describe_voices().send().await { Ok(resp) => { println!("Voices:"); let voices = resp.voices.unwrap_or_default(); for voice in &voices { println!( " Name: {}", voice.name.as_deref().unwrap_or("No name!") ); println!( " Language: {}", voice.language_name.as_deref().unwrap_or("No language!") ); } println!("\nFound {} voices\n", voices.len()); } Err(e) => { println!("Got an error describing voices:"); println!("{}", e); process::exit(1); } }; } aws/sdk/examples/polly-list-lexicons/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "polly-list-lexicons" version = "0.1.0" authors = ["Doug Schwartz <dougsch@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] polly = { package = "aws-sdk-polly", path = "../../build/aws-sdk/polly" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws-types = { path = "../../build/aws-sdk/aws-types" } aws/sdk/examples/polly-list-lexicons/src/main.rs 0 → 100644 +80 −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. */ use std::process; use polly::{Client, Config, Region}; use aws_types::region::{EnvironmentProvider, ProvideRegion}; use structopt::StructOpt; use tracing_subscriber::fmt::format::FmtSpan; use tracing_subscriber::fmt::SubscriberBuilder; #[derive(Debug, StructOpt)] struct Opt { /// The region #[structopt(short, long)] region: Option<String>, /// Activate verbose mode #[structopt(short, long)] verbose: bool, } #[tokio::main] async fn main() { let Opt { region, verbose } = Opt::from_args(); let region = EnvironmentProvider::new() .region() .or_else(|| region.as_ref().map(|region| Region::new(region.clone()))) .unwrap_or_else(|| Region::new("us-west-2")); if verbose { println!("polly client version: {}\n", polly::PKG_VERSION); println!("Region: {:?}", ®ion); SubscriberBuilder::default() .with_env_filter("info") .with_span_events(FmtSpan::CLOSE) .init(); } let config = Config::builder().region(region).build(); let client = Client::from_conf(config); match client.list_lexicons().send().await { Ok(resp) => { println!("Lexicons:"); let lexicons = resp.lexicons.unwrap_or_default(); for lexicon in &lexicons { println!( " Name: {}", lexicon.name.as_deref().unwrap_or_default() ); println!( " Language: {:?}\n", lexicon .attributes .as_ref() .map(|attrib| attrib .language_code .as_ref() .expect("languages must have language codes")) .expect("languages must have attributes") ); } println!("\nFound {} lexicons.\n", lexicons.len()); } Err(e) => { println!("Got an error listing lexicons:"); println!("{}", e); process::exit(1); } }; } aws/sdk/examples/polly-put-lexicon/Cargo.toml 0 → 100644 +15 −0 Original line number Diff line number Diff line [package] name = "polly-put-lexicon" version = "0.1.0" authors = ["Doug Schwartz <dougsch@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] polly = { package = "aws-sdk-polly", path = "../../build/aws-sdk/polly" } aws-hyper = { path = "../../build/aws-sdk/aws-hyper"} tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws-types = { path = "../../build/aws-sdk/aws-types" } Loading
aws/sdk/examples/polly-describe-voices/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "polly-describe-voices" version = "0.1.0" authors = ["Doug Schwartz <dougsch@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] polly = { package = "aws-sdk-polly", path = "../../build/aws-sdk/polly" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws-types = { path = "../../build/aws-sdk/aws-types" }
aws/sdk/examples/polly-describe-voices/src/main.rs 0 → 100644 +72 −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. */ use std::process; use polly::{Client, Config, Region}; use aws_types::region::{EnvironmentProvider, ProvideRegion}; use structopt::StructOpt; use tracing_subscriber::fmt::format::FmtSpan; use tracing_subscriber::fmt::SubscriberBuilder; #[derive(Debug, StructOpt)] struct Opt { /// The region #[structopt(short, long)] region: Option<String>, /// Display additional information #[structopt(short, long)] verbose: bool, } #[tokio::main] async fn main() { let Opt { region, verbose } = Opt::from_args(); let region = EnvironmentProvider::new() .region() .or_else(|| region.as_ref().map(|region| Region::new(region.clone()))) .unwrap_or_else(|| Region::new("us-west-2")); if verbose { println!("polly client version: {}\n", polly::PKG_VERSION); println!("Region: {:?}", ®ion); SubscriberBuilder::default() .with_env_filter("info") .with_span_events(FmtSpan::CLOSE) .init(); } let config = Config::builder().region(region).build(); let client = Client::from_conf(config); match client.describe_voices().send().await { Ok(resp) => { println!("Voices:"); let voices = resp.voices.unwrap_or_default(); for voice in &voices { println!( " Name: {}", voice.name.as_deref().unwrap_or("No name!") ); println!( " Language: {}", voice.language_name.as_deref().unwrap_or("No language!") ); } println!("\nFound {} voices\n", voices.len()); } Err(e) => { println!("Got an error describing voices:"); println!("{}", e); process::exit(1); } }; }
aws/sdk/examples/polly-list-lexicons/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "polly-list-lexicons" version = "0.1.0" authors = ["Doug Schwartz <dougsch@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] polly = { package = "aws-sdk-polly", path = "../../build/aws-sdk/polly" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws-types = { path = "../../build/aws-sdk/aws-types" }
aws/sdk/examples/polly-list-lexicons/src/main.rs 0 → 100644 +80 −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. */ use std::process; use polly::{Client, Config, Region}; use aws_types::region::{EnvironmentProvider, ProvideRegion}; use structopt::StructOpt; use tracing_subscriber::fmt::format::FmtSpan; use tracing_subscriber::fmt::SubscriberBuilder; #[derive(Debug, StructOpt)] struct Opt { /// The region #[structopt(short, long)] region: Option<String>, /// Activate verbose mode #[structopt(short, long)] verbose: bool, } #[tokio::main] async fn main() { let Opt { region, verbose } = Opt::from_args(); let region = EnvironmentProvider::new() .region() .or_else(|| region.as_ref().map(|region| Region::new(region.clone()))) .unwrap_or_else(|| Region::new("us-west-2")); if verbose { println!("polly client version: {}\n", polly::PKG_VERSION); println!("Region: {:?}", ®ion); SubscriberBuilder::default() .with_env_filter("info") .with_span_events(FmtSpan::CLOSE) .init(); } let config = Config::builder().region(region).build(); let client = Client::from_conf(config); match client.list_lexicons().send().await { Ok(resp) => { println!("Lexicons:"); let lexicons = resp.lexicons.unwrap_or_default(); for lexicon in &lexicons { println!( " Name: {}", lexicon.name.as_deref().unwrap_or_default() ); println!( " Language: {:?}\n", lexicon .attributes .as_ref() .map(|attrib| attrib .language_code .as_ref() .expect("languages must have language codes")) .expect("languages must have attributes") ); } println!("\nFound {} lexicons.\n", lexicons.len()); } Err(e) => { println!("Got an error listing lexicons:"); println!("{}", e); process::exit(1); } }; }
aws/sdk/examples/polly-put-lexicon/Cargo.toml 0 → 100644 +15 −0 Original line number Diff line number Diff line [package] name = "polly-put-lexicon" version = "0.1.0" authors = ["Doug Schwartz <dougsch@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] polly = { package = "aws-sdk-polly", path = "../../build/aws-sdk/polly" } aws-hyper = { path = "../../build/aws-sdk/aws-hyper"} tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws-types = { path = "../../build/aws-sdk/aws-types" }