Datasets:
id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::types::ParameterType;
use aws_sdk_ssm::{config::Region, meta::PKG_VERSION, Client, Error};
use cl... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/ssm/src/bin/create-parameter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:2 | value: &str,
description: &str,
) -> Result<(), Error> {
let resp = client
.put_parameter()
.overwrite(true)
.r#type(ParameterType::String)
.name(name)
.value(value)
.description(description)
.send()
.await?;
println!("Success! Parameter now h... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/ssm/src/bin/create-parameter.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:3 | let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider()
.or_else(Region::new("us-west-2"));
println!();
if verbose {
println!("SQS client version: {}", PKG_VERSION);
println!(
"Region: {}",
reg... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/ssm/src/bin/create-parameter.rs | 81 | 103 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::types::ParameterType;
use aws_sdk_ssm::{config::Region, meta::PKG_VERSION, Client, Error};
use st... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/ssm/src/bin/create-parameter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:2 | value: &str,
description: &str,
) -> Result<(), Error> {
let resp = client
.put_parameter()
.overwrite(true)
.r#type(ParameterType::String)
.name(name)
.value(value)
.description(description)
.send()
.await?;
println!("Success! Parameter now h... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/ssm/src/bin/create-parameter.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::model::ParameterType;
use aws_sdk_ssm::{Client, Error, Region, PKG_VERSION};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
st... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/ssm/src/bin/create-parameter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:2 | ) -> Result<(), Error> {
let resp = client
.put_parameter()
.overwrite(true)
.r#type(ParameterType::String)
.name(name)
.value(value)
.description(description)
.send()
.await?;
println!("Success! Parameter now has version: {}", resp.version());
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/ssm/src/bin/create-parameter.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:3 | .or_else(Region::new("us-west-2"));
println!();
if verbose {
println!("SQS client version: {}", PKG_VERSION);
println!(
"Region: {}",
region_provider.region().await.unwrap().as_ref()
);
println!("Parameter name: {}", &name);
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/ssm/src/bin/create-parameter.rs | 81 | 101 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::model::ParameterType;
use aws_sdk_ssm::{Client, Region};
use std::process;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
stru... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/create-parameter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:2 | /// * `[-d DEFAULT-REGION]` - The region in which the client is created.
/// 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**.
/// * `[-v]` - Whether to display additional information.
#[tokio::main]
async fn ... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/create-parameter.rs | 41 | 93 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/create-parameter.rs:3 | .description(description)
.send()
.await
{
Ok(response) => {
println!("Success! Parameter now has version: {}", response.version)
}
Err(error) => {
println!("Got an error putting the parameter: {}", error);
process::exit(1);
}
}... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/create-parameter.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/create-parameter.rs | 81 | 93 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::{config::Region, meta::PKG_VERSION, Client, Error};
use clap::Parser;
#[derive(Debug, Parser)]
s... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/ssm/src/bin/describe-parameters.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:2 | /// If the environment variable is not set, defaults to **us-west-2**.
/// * `[-v]` - Whether to display additional information.
#[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
let Opt { region, verbose } = Opt::parse();
let region_provider = RegionProviderChain::... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/ssm/src/bin/describe-parameters.rs | 41 | 70 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::{config::Region, meta::PKG_VERSION, Client, Error};
use structopt::StructOpt;
#[derive(Debug, St... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/ssm/src/bin/describe-parameters.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:2 | /// If the environment variable is not set, defaults to **us-west-2**.
/// * `[-v]` - Whether to display additional information.
#[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
let Opt { region, verbose } = Opt::from_args();
let region_provider = RegionProviderCha... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/ssm/src/bin/describe-parameters.rs | 41 | 70 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::{Client, Error, Region, PKG_VERSION};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The AWS Region.
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/ssm/src/bin/describe-parameters.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:2 | #[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
let Opt { region, verbose } = Opt::from_args();
let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider()
.or_else(Region::new("us-west-2"));
println!();
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/ssm/src/bin/describe-parameters.rs | 41 | 68 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::{Client, Region};
use std::process;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The region
#[struc... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/describe-parameters.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/describe-parameters.rs:2 | "Region: {:?}",
shared_config.region().unwrap()
);
tracing_subscriber::fmt::init();
}
let client = Client::new(&shared_config);
println!("Parameter names:");
match client.describe_parameters().send().await {
Ok(response) => {
for param in... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/describe-parameters.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/describe-parameters.rs | 41 | 70 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/ssm-helloworld.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_ssm::model::ParameterType;
use aws_sdk_ssm::{Client, Region};
use std::process;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
stru... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/ssm-helloworld.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/ssm-helloworld.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/ssm-helloworld.rs:2 | /// * `[-d DEFAULT-REGION]` - The region in which the client is created.
/// 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**.
/// * `[-v]` - Whether to display additional information.
#[tokio::main]
async fn ... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/ssm-helloworld.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/ssm-helloworld.rs | 41 | 92 |
awslabs/aws-sdk-rust:examples/ssm/src/bin/ssm-helloworld.rs:3 | .send()
.await
{
Ok(response) => {
println!("Success! Parameter now has version: {}", response.version)
}
Err(error) => {
println!("Got an error putting the parameter: {}", error);
process::exit(1);
}
}
} | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/ssm/src/bin/ssm-helloworld.rs | Apache-2.0 | fe1cfc31a925306b740e22a005fbf0ab6ec4fca7 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/fe1cfc31a925306b740e22a005fbf0ab6ec4fca7/examples/ssm/src/bin/ssm-helloworld.rs | 81 | 92 |
awslabs/aws-sdk-rust:examples/stepfunction/src/bin/start-execution.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_sdk_sfn::{Client, Error};
use clap::Parser;
#[derive(Debug, Parser)]
struct Opt {
/// The Amazon Resource Name (ARN) of the state machine to execute.
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/stepfunction/src/bin/start-execution.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/stepfunction/src/bin/start-execution.rs | 1 | 58 |
awslabs/aws-sdk-rust:examples/stepfunction/src/bin/start-execution.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_sdk_sfn::{Client, Error};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The Amazon Resource Name (ARN) of the state machine to ... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/stepfunction/src/bin/start-execution.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/stepfunction/src/bin/start-execution.rs | 1 | 58 |
awslabs/aws-sdk-rust:examples/stepfunction/src/bin/start-execution.rs:1 | use aws_sdk_sfn::{Client, Error};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The Amazon Resource Name (ARN) of the state machine to execute.
#[structopt(short, long)]
arn: String,
/// The string that contains the JSON input data for the execution, for example "{\"first_name... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/stepfunction/src/bin/start-execution.rs | Apache-2.0 | d364b5a1168812b83466ff568c8961fe31714c3d | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/d364b5a1168812b83466ff568c8961fe31714c3d/examples/stepfunction/src/bin/start-execution.rs | 1 | 51 |
awslabs/aws-sdk-rust:examples/stepfunction/src/bin/stop-execution.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_sdk_sfn::{Client, Error};
use clap::Parser;
#[derive(Debug, Parser)]
struct Opt {
/// The Amazon Resource Name (ARN) of the state machine to execute.
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/stepfunction/src/bin/stop-execution.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/stepfunction/src/bin/stop-execution.rs | 1 | 44 |
awslabs/aws-sdk-rust:examples/stepfunction/src/bin/stop-execution.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_sdk_sfn::{Client, Error};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The Amazon Resource Name (ARN) of the state machine to ... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/stepfunction/src/bin/stop-execution.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/stepfunction/src/bin/stop-execution.rs | 1 | 44 |
awslabs/aws-sdk-rust:examples/stepfunction/src/bin/stop-execution.rs:1 | use aws_sdk_sfn::{Client, Error};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The Amazon Resource Name (ARN) of the state machine to execute.
#[structopt(short, long)]
arn: String,
/// Whether to display additional information.
#[structopt(short, long)]
verbose: bool... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/stepfunction/src/bin/stop-execution.rs | Apache-2.0 | d364b5a1168812b83466ff568c8961fe31714c3d | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/d364b5a1168812b83466ff568c8961fe31714c3d/examples/stepfunction/src/bin/stop-execution.rs | 1 | 37 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_sts::{meta::PKG_VERSION, Client, Error};
use aws_types::region::Region;
use aws_types::sdk_config::Sdk... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 5274f20931d6dd4a41496acb1f0366f9ac062443 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5274f20931d6dd4a41496acb1f0366f9ac062443/examples/sts/src/bin/assume-role.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:2 | match config.credentials_provider() {
Some(credential) => {
let provider = aws_config::sts::AssumeRoleProvider::builder(role_name)
.region(region)
.session_name(session_name.unwrap_or_else(|| String::from("rust-assume-role")))
.build(credential.clone()... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 5274f20931d6dd4a41496acb1f0366f9ac062443 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5274f20931d6dd4a41496acb1f0366f9ac062443/examples/sts/src/bin/assume-role.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:3 | #[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
let Opt {
region,
verbose,
role_arn,
role_session_name,
} = Opt::parse();
let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider()
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 5274f20931d6dd4a41496acb1f0366f9ac062443 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5274f20931d6dd4a41496acb1f0366f9ac062443/examples/sts/src/bin/assume-role.rs | 81 | 114 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_sts::{meta::PKG_VERSION, Client, Error};
use aws_types::region::Region;
use aws_types::sdk_config::Sdk... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/sts/src/bin/assume-role.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_sts::{meta::PKG_VERSION, Client, Error};
use aws_types::region::Region;
use aws_types::sdk_config::Sdk... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/sts/src/bin/assume-role.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:2 | match config.credentials_provider() {
Some(credential) => {
let provider = aws_config::sts::AssumeRoleProvider::builder(role_name)
.region(region)
.session_name(session_name.unwrap_or_else(|| String::from("rust-assume-role")))
.build(credential.clone()... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/sts/src/bin/assume-role.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/sts/src/bin/assume-role.rs:3 | #[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
let Opt {
region,
verbose,
role_arn,
role_session_name,
} = Opt::from_args();
let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/assume-role.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/sts/src/bin/assume-role.rs | 81 | 114 |
awslabs/aws-sdk-rust:examples/sts/src/bin/get-caller-identity.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_sts::{config::Region, meta::PKG_VERSION, Client, Error};
use clap::Parser;
use std::fmt::Debug;
#[der... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/get-caller-identity.rs | Apache-2.0 | 5274f20931d6dd4a41496acb1f0366f9ac062443 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5274f20931d6dd4a41496acb1f0366f9ac062443/examples/sts/src/bin/get-caller-identity.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/sts/src/bin/get-caller-identity.rs:2 | Ok(())
}
// snippet-end:[sts.rust.get_caller_identity]
/// Displays information about the Amazon API Gateway REST APIs in the Region.
///
/// # Arguments
///
/// * `[-r REGION]` - The Region in which the client is created.
/// If not supplied, uses the value of the **AWS_REGION** environment variable.
/// If the e... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/get-caller-identity.rs | Apache-2.0 | 5274f20931d6dd4a41496acb1f0366f9ac062443 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/5274f20931d6dd4a41496acb1f0366f9ac062443/examples/sts/src/bin/get-caller-identity.rs | 41 | 77 |
awslabs/aws-sdk-rust:examples/sts/src/bin/get-caller-identity.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_sts::{config::Region, meta::PKG_VERSION, Client, Error};
use clap::Parser;
use std::fmt::Debug;
#[der... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/get-caller-identity.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/sts/src/bin/get-caller-identity.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/sts/src/bin/get-caller-identity.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_sts::{config::Region, meta::PKG_VERSION, Client, Error};
use std::fmt::Debug;
use structopt::StructOpt... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/get-caller-identity.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/sts/src/bin/get-caller-identity.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/sts/src/bin/get-caller-identity.rs:2 | Ok(())
}
// snippet-end:[sts.rust.get_caller_identity]
/// Displays information about the Amazon API Gateway REST APIs in the Region.
///
/// # Arguments
///
/// * `[-r REGION]` - The Region in which the client is created.
/// If not supplied, uses the value of the **AWS_REGION** environment variable.
/// If the e... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/sts/src/bin/get-caller-identity.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/sts/src/bin/get-caller-identity.rs | 41 | 77 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//! Macros and functions that simplify making AWS SDK clients with a mocked request/response pair.
/// Generate a single http::{Request, Response} pair. The first argument
/// is the expression to use as the v... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 35a58f4fe9e6e159f2e74885e6d86bd36ac918b2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/35a58f4fe9e6e159f2e74885e6d86bd36ac918b2/examples/test-utils/src/macros.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:2 | .body(aws_smithy_types::body::SdkBody::from($req))
.unwrap(),
{
let mut builder = http::Response::builder().status($status);
for (k, v) in $headers {
builder = builder.header(k, v);
}
builder
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 35a58f4fe9e6e159f2e74885e6d86bd36ac918b2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/35a58f4fe9e6e159f2e74885e6d86bd36ac918b2/examples/test-utils/src/macros.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:3 | }
/// Create a hard-coded testing config for an AWS SDK.
#[macro_export]
macro_rules! client_config {
(
$sdk_crate:ident
) => {
/// TODO: remove after https://github.com/awslabs/smithy-rs/pull/2145
$sdk_crate::Config::builder()
.behavior_version($sdk_crate::config::BehaviorV... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 35a58f4fe9e6e159f2e74885e6d86bd36ac918b2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/35a58f4fe9e6e159f2e74885e6d86bd36ac918b2/examples/test-utils/src/macros.rs | 81 | 101 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
//! Macros and functions that simplify making AWS SDK clients with a mocked request/response pair.
/// Generate a single http::{Request, Response} pair. The first argument
/// is the expression to use ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 6f2a0fa89ee36dc80e3efa2f4e8820ea87631186 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/6f2a0fa89ee36dc80e3efa2f4e8820ea87631186/examples/test-utils/src/macros.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:2 | aws_smithy_runtime::client::http::test_util::ReplayEvent::new(
http::Request::builder()
.body(aws_smithy_types::body::SdkBody::from($req))
.unwrap(),
{
let mut builder = http::Response::builder().status($status);
for (k, v) in $head... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 6f2a0fa89ee36dc80e3efa2f4e8820ea87631186 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/6f2a0fa89ee36dc80e3efa2f4e8820ea87631186/examples/test-utils/src/macros.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:3 | )
}};
}
/// Create a hard-coded testing config for an AWS SDK.
#[macro_export]
macro_rules! client_config {
(
$sdk_crate:ident
) => {
/// TODO: remove after https://github.com/awslabs/smithy-rs/pull/2145
$sdk_crate::Config::builder()
.behavior_version($sdk_crate::config:... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 6f2a0fa89ee36dc80e3efa2f4e8820ea87631186 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/6f2a0fa89ee36dc80e3efa2f4e8820ea87631186/examples/test-utils/src/macros.rs | 81 | 103 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:2 | aws_smithy_runtime::client::http::test_util::ReplayEvent::new(
http::Request::builder()
.body(aws_smithy_types::body::SdkBody::from($req))
.unwrap(),
{
let mut builder = http::Response::builder().status($status);
for (k, v) in $head... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | a321b7eda7402345fccc44b5f64bc2587ece2f45 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a321b7eda7402345fccc44b5f64bc2587ece2f45/examples/test-utils/src/macros.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:3 | )
}};
}
/// Create a hard-coded testing config for an AWS SDK.
#[macro_export]
macro_rules! client_config {
(
$sdk_crate:ident
) => {
/// TODO: remove after https://github.com/awslabs/smithy-rs/pull/2145
$sdk_crate::Config::builder()
.credentials_provider($sdk_crate::con... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | a321b7eda7402345fccc44b5f64bc2587ece2f45 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a321b7eda7402345fccc44b5f64bc2587ece2f45/examples/test-utils/src/macros.rs | 81 | 102 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
//! Macros and functions that simplify making AWS SDK clients with a mocked request/response pair.
/// Generate a single http::{Request, Response} pair. The first argument
/// is the expression to use ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/test-utils/src/macros.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:2 | (
http::Request::builder()
.body(aws_smithy_http::body::SdkBody::from($req))
.unwrap(),
{
let mut builder = http::Response::builder().status($status);
for (k, v) in $headers {
builder = builder.header(k, v);
... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/test-utils/src/macros.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
//! Macros and functions that simplify making AWS SDK clients with a mocked request/response pair.
/// Generate a single http::{Request, Response} pair. The first argument
/// is the expression to use ... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 8bcacf75913b4529bd0f80a281551e4c9f1ab324 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8bcacf75913b4529bd0f80a281551e4c9f1ab324/examples/test-utils/src/macros.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/macros.rs:2 | sdk_examples_test_utils::single_shot_client!($sdk_crate, "", $status, $res)
}};
(sdk: $sdk_crate:ident, request: $req:expr, status: $status:expr, response: $res:expr) => {{
sdk_examples_test_utils::single_shot_client!($sdk_crate, $res, $status, $res)
}};
// "Private" internal root macro.
($s... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/macros.rs | Apache-2.0 | 8bcacf75913b4529bd0f80a281551e4c9f1ab324 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8bcacf75913b4529bd0f80a281551e4c9f1ab324/examples/test-utils/src/macros.rs | 41 | 76 |
awslabs/aws-sdk-rust:examples/test-utils/src/mod.rs:1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use aws_smithy_types::body::SdkBody;
pub mod macros;
pub mod waiter;
/// Create a single-shot test connection. The arguments are the same as test_event,
/// but the expanded macro creates a TestConnection. The... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/mod.rs | Apache-2.0 | 35a58f4fe9e6e159f2e74885e6d86bd36ac918b2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/35a58f4fe9e6e159f2e74885e6d86bd36ac918b2/examples/test-utils/src/mod.rs | 1 | 18 |
awslabs/aws-sdk-rust:examples/test-utils/src/mod.rs:1 | use aws_smithy_types::body::SdkBody;
pub mod macros;
pub mod waiter;
/// Create a single-shot test connection. The arguments are the same as test_event,
/// but the expanded macro creates a TestConnection. The `TestConnection` can be
/// provided directly to a `Client::from_conf_conn`.
pub fn single_shot(
req: Sd... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/mod.rs | Apache-2.0 | a321b7eda7402345fccc44b5f64bc2587ece2f45 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a321b7eda7402345fccc44b5f64bc2587ece2f45/examples/test-utils/src/mod.rs | 1 | 16 |
awslabs/aws-sdk-rust:examples/test-utils/src/mod.rs:1 | use aws_smithy_http::body::SdkBody;
pub mod macros;
/// Create a single-shot test connection. The arguments are the same as test_event,
/// but the expanded macro creates a TestConnection. The `TestConnection` can be
/// provided directly to a `Client::from_conf_conn`.
pub fn single_shot(
req: SdkBody,
res: (... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/mod.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/test-utils/src/mod.rs | 1 | 15 |
awslabs/aws-sdk-rust:examples/test-utils/src/mod.rs:1 | use aws_smithy_client::test_connection::TestConnection;
use aws_smithy_http::body::SdkBody;
use http::StatusCode;
pub mod macros;
/// Create a single-shot test connection. The arguments are the same as test_event,
/// but the expanded macro creates a TestConnection. The `TestConnection` can be
/// provided directly t... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/mod.rs | Apache-2.0 | 8bcacf75913b4529bd0f80a281551e4c9f1ab324 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8bcacf75913b4529bd0f80a281551e4c9f1ab324/examples/test-utils/src/mod.rs | 1 | 14 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::{
error::Error,
fmt::Display,
time::{Duration, SystemTime},
};
use tokio;
// Wait at most 25 seconds.
const MAX_WAIT: Duration = Duration::from_secs(5 * 60);
// Wait half a second at a tim... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | 2c81d4d19aa8a02154fb7c245a0f273d44371d7f | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2c81d4d19aa8a02154fb7c245a0f273d44371d7f/examples/test-utils/src/waiter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:2 | * *
*/
fn new(max: Duration, interval: Duration) -> Self {
Waiter {
start: SystemTime::now(),
max,
interval,
}
}
pub async fn sleep(&self) -> Result<(), WaitError> {
if SystemTime::now()
.duration_since(self.start)
.un... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | 2c81d4d19aa8a02154fb7c245a0f273d44371d7f | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2c81d4d19aa8a02154fb7c245a0f273d44371d7f/examples/test-utils/src/waiter.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:3 | }
pub fn max(mut self, max: Duration) -> Self {
self.max = Some(max);
self
}
pub fn build(self) -> Waiter {
Waiter::new(
self.max.unwrap_or(MAX_WAIT),
self.poll.unwrap_or(DEFAULT_INTERVAL),
)
}
}
/// Create an async block to repeat a request unt... | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | 2c81d4d19aa8a02154fb7c245a0f273d44371d7f | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2c81d4d19aa8a02154fb7c245a0f273d44371d7f/examples/test-utils/src/waiter.rs | 81 | 130 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:4 | if response.as_ref().map($test).unwrap_or(false) {
break;
}
response = $req.clone().send().await;
sleep = $waiter.sleep().await;
}
response
}
};
} | rust | rust | macro-heavy | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | 2c81d4d19aa8a02154fb7c245a0f273d44371d7f | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/2c81d4d19aa8a02154fb7c245a0f273d44371d7f/examples/test-utils/src/waiter.rs | 121 | 130 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::{
error::Error,
fmt::Display,
time::{Duration, SystemTime},
};
use tokio;
// Wait at most 25 seconds.
const MAX_WAIT: Duration = Duration::from_secs(5 * 60);
// Wait half a second at a tim... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | 35a58f4fe9e6e159f2e74885e6d86bd36ac918b2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/35a58f4fe9e6e159f2e74885e6d86bd36ac918b2/examples/test-utils/src/waiter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:2 | Waiter {
start: SystemTime::now(),
max,
poll,
}
}
pub async fn sleep(&self) -> Result<(), WaitError> {
if SystemTime::now()
.duration_since(self.start)
.unwrap_or(Duration::MAX)
> self.max
{
Err(WaitErro... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | 35a58f4fe9e6e159f2e74885e6d86bd36ac918b2 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/35a58f4fe9e6e159f2e74885e6d86bd36ac918b2/examples/test-utils/src/waiter.rs | 41 | 88 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use std::{
error::Error,
fmt::Display,
time::{Duration, SystemTime},
};
use tokio;
// Wait at most 25 seconds.
const MAX_WAIT: Duration = Duration::from_secs(5 * 60);
// Wait half a second ... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | a321b7eda7402345fccc44b5f64bc2587ece2f45 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a321b7eda7402345fccc44b5f64bc2587ece2f45/examples/test-utils/src/waiter.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:2 | fn new(max: Duration, poll: Duration) -> Self {
Waiter {
start: SystemTime::now(),
max,
poll,
}
}
pub async fn sleep(&self) -> Result<(), WaitError> {
if SystemTime::now()
.duration_since(self.start)
.unwrap_or(Duration::MAX)
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | a321b7eda7402345fccc44b5f64bc2587ece2f45 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a321b7eda7402345fccc44b5f64bc2587ece2f45/examples/test-utils/src/waiter.rs | 41 | 90 |
awslabs/aws-sdk-rust:examples/test-utils/src/waiter.rs:3 | pub fn max(mut self, max: Duration) -> Self {
self.max = Some(max);
self
}
pub fn build(self) -> Waiter {
Waiter::new(self.max.unwrap_or(MAX_WAIT), self.poll.unwrap_or(POLL_TIME))
}
} | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/test-utils/src/waiter.rs | Apache-2.0 | a321b7eda7402345fccc44b5f64bc2587ece2f45 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/a321b7eda7402345fccc44b5f64bc2587ece2f45/examples/test-utils/src/waiter.rs | 81 | 90 |
awslabs/aws-sdk-rust:examples/testing/src/enums.rs:2 | Self::real_list_objects(s3.clone(), bucket, prefix, continuation_token).await
}
#[cfg(test)]
Self::Test {
expected_bucket,
expected_prefix,
pages,
} => {
assert_eq!(expected_bucket, bucket);
a... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/enums.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/testing/src/enums.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/enums.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(dead_code)]
use aws_sdk_s3 as s3;
use std::error::Error;
// snippet-start:[testing.rust.enums-struct]
pub struct ListObjectsResult {
pub objects: Vec<s3::model::Object>,
pub continuat... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/enums.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/enums.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/testing/src/enums.rs:2 | Self::real_list_objects(s3.clone(), bucket, prefix, continuation_token).await
}
#[cfg(test)]
Self::Test {
expected_bucket,
expected_prefix,
pages,
} => {
assert_eq!(expected_bucket, bucket);
a... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/enums.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/enums.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/enums.rs:3 | fn test_list_objects(
pages: &[Vec<s3::model::Object>],
continuation_token: Option<String>,
) -> Result<ListObjectsResult, Box<dyn Error + Send + Sync + 'static>> {
use std::str::FromStr;
let index = continuation_token
.map(|t| usize::from_str(&t).expect("valid token"))
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/enums.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/enums.rs | 81 | 140 |
awslabs/aws-sdk-rust:examples/testing/src/enums.rs:4 | for object in result.objects {
total_size_bytes += object.size() as usize;
}
// Handle pagination, and break the loop if there are no more pages
next_token = result.continuation_token;
if !result.has_more {
break;
}
}
Ok(total_size_bytes)
}
// sni... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/enums.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/enums.rs | 121 | 180 |
awslabs/aws-sdk-rust:examples/testing/src/enums.rs:5 | use s3::model::Object;
// This time, we add a helper function for making pages
fn make_page(sizes: &[i64]) -> Vec<Object> {
sizes
.iter()
.map(|size| Object::builder().size(*size).build())
.collect()
}
// Create the TestListObjects instance with two pages of... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/enums.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/enums.rs | 161 | 184 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
// snippet-start:[testing.rust.intro-import]
// So we can refer to the S3 package as s3 for the rest of the example.
use aws_sdk_s3 as s3;
// snippet-e... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/testing/src/intro.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:2 | bucket: &str,
prefix: &str,
) -> Result<usize, Box<dyn Error + Send + Sync + 'static>> {
let mut next_token: Option<String> = None;
let mut total_size_bytes = 0;
loop {
let response = s3
.list_objects_v2()
.bucket(bucket)
.prefix(prefix)
.set_conti... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/testing/src/intro.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:3 | } = Opt::parse();
let region_provider = RegionProviderChain::first_try(region.map(s3::config::Region::new))
.or_default_provider()
.or_else(s3::config::Region::new("us-west-2"));
println!();
if verbose {
println!("S3 client version: {}", s3::meta::PKG_VERSION);
println!(
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/testing/src/intro.rs | 81 | 107 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
// snippet-start:[testing.rust.intro-import]
// So we can refer to the S3 package as s3 for the rest of the example.
use aws_sdk_s3 as s3;
// snippet-e... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/testing/src/intro.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:2 | bucket: &str,
prefix: &str,
) -> Result<usize, Box<dyn Error + Send + Sync + 'static>> {
let mut next_token: Option<String> = None;
let mut total_size_bytes = 0;
loop {
let response = s3
.list_objects_v2()
.bucket(bucket)
.prefix(prefix)
.set_conti... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/testing/src/intro.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:3 | } = Opt::from_args();
let region_provider = RegionProviderChain::first_try(region.map(s3::config::Region::new))
.or_default_provider()
.or_else(s3::config::Region::new("us-west-2"));
println!();
if verbose {
println!("S3 client version: {}", s3::meta::PKG_VERSION);
println... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/testing/src/intro.rs | 81 | 107 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:2 | bucket: &str,
prefix: &str,
) -> Result<usize, Box<dyn Error + Send + Sync + 'static>> {
let mut next_token: Option<String> = None;
let mut total_size_bytes = 0;
loop {
let response = s3
.list_objects_v2()
.bucket(bucket)
.prefix(prefix)
.set_conti... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/intro.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/intro.rs:3 | } = Opt::from_args();
let region_provider = RegionProviderChain::first_try(region.map(s3::Region::new))
.or_default_provider()
.or_else(s3::Region::new("us-west-2"));
println!();
if verbose {
println!("S3 client version: {}", s3::PKG_VERSION);
println!(
"Region... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/intro.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/intro.rs | 81 | 107 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(dead_code)]
use async_trait::async_trait;
use aws_sdk_s3 as s3;
use std::error::Error;
use std::str::FromStr;
// snippet-start:[testing.rust.traits-trait]
pub struct ListObjectsResult {
p... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/testing/src/traits.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:2 | }
#[async_trait]
impl ListObjects for S3ListObjects {
async fn list_objects(
&self,
bucket: &str,
prefix: &str,
continuation_token: Option<String>,
) -> Result<ListObjectsResult, Box<dyn Error + Send + Sync + 'static>> {
let response = self
.s3
.l... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/testing/src/traits.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(dead_code)]
use async_trait::async_trait;
use aws_sdk_s3 as s3;
use std::error::Error;
use std::str::FromStr;
// snippet-start:[testing.rust.traits-trait]
pub struct ListObjectsResult {
p... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/traits.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:2 | }
#[async_trait]
impl ListObjects for S3ListObjects {
async fn list_objects(
&self,
bucket: &str,
prefix: &str,
continuation_token: Option<String>,
) -> Result<ListObjectsResult, Box<dyn Error + Send + Sync + 'static>> {
let response = self
.s3
.l... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/traits.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:3 | prefix: &str,
continuation_token: Option<String>,
) -> Result<ListObjectsResult, Box<dyn Error + Send + Sync + 'static>> {
assert_eq!(self.expected_bucket, bucket);
assert_eq!(self.expected_prefix, prefix);
let index = continuation_token
.map(|t| usize::from_str(&t).expe... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/traits.rs | 81 | 140 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:4 | // Add up the file sizes we got back
for object in result.objects {
total_size_bytes += object.size() as usize;
}
// Handle pagination, and break the loop if there are no more pages
next_token = result.continuation_token;
if !result.has_more {
break;
... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/traits.rs | 121 | 180 |
awslabs/aws-sdk-rust:examples/testing/src/traits.rs:5 | async fn test_multiple_pages() {
use s3::model::Object;
// This time, we add a helper function for making pages
fn make_page(sizes: &[i64]) -> Vec<Object> {
sizes
.iter()
.map(|size| Object::builder().size(*size).build())
.collect()
}
// Create the TestL... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/testing/src/traits.rs | Apache-2.0 | 8611aa3f0fa7c75a7f93dbf860d099c24a272d06 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8611aa3f0fa7c75a7f93dbf860d099c24a272d06/examples/testing/src/traits.rs | 161 | 185 |
awslabs/aws-sdk-rust:examples/textract/src/bin/analyze-document.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_textract::config::Region;
use aws_sdk_textract::error::DisplayErrorContext;
use aws_sdk_textract::prim... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/textract/src/bin/analyze-document.rs | Apache-2.0 | e632a1e3255a37d6a07a37d502eef9c351ec4300 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e632a1e3255a37d6a07a37d502eef9c351ec4300/examples/textract/src/bin/analyze-document.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/textract/src/bin/analyze-document.rs:2 | } = Opt::from_args();
let document_bytes = std::fs::read(document_path).expect("file exists and is readable");
let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider()
.or_else(Region::new("us-west-2"));
let shared_config = aws_config::from_env().... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/textract/src/bin/analyze-document.rs | Apache-2.0 | e632a1e3255a37d6a07a37d502eef9c351ec4300 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/e632a1e3255a37d6a07a37d502eef9c351ec4300/examples/textract/src/bin/analyze-document.rs | 41 | 88 |
awslabs/aws-sdk-rust:examples/tls/src/lib.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/*
Purpose
Shows how to use rustls, hyper-rustls, and webpki-roots to set the minimum TLS version to 1.3 for
outgoing connections.
Then, uses TLS 1.3 to make a sample call to AWS Key Management Service... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/tls/src/lib.rs | Apache-2.0 | 317b86da4f62ff4815551e7eaf54ae9f194d1268 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/317b86da4f62ff4815551e7eaf54ae9f194d1268/examples/tls/src/lib.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/tls/src/lib.rs:2 | .expect("It looks like your system doesn't support TLS1.3")
.with_root_certificates(root_store)
.with_no_client_auth();
// Finish setup of the rustls connector.
let rustls_connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_tls_config(config)
.https_only()
.enab... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/tls/src/lib.rs | Apache-2.0 | 317b86da4f62ff4815551e7eaf54ae9f194d1268 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/317b86da4f62ff4815551e7eaf54ae9f194d1268/examples/tls/src/lib.rs | 41 | 67 |
awslabs/aws-sdk-rust:examples/tls/src/lib.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/*
Purpose
Shows how to use rustls, hyper-rustls, and webpki-roots to set the minimum TLS version to 1.3 for
outgoing connections.
Then, uses TLS 1.3 to make a sample call to AWS Key Management Service... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/tls/src/lib.rs | Apache-2.0 | b9deeed6ee0cf186959a9b237e8dae0d4c34ee59 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b9deeed6ee0cf186959a9b237e8dae0d4c34ee59/examples/tls/src/lib.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/tls/src/lib.rs:2 | .expect("It looks like your system doesn't support TLS1.3")
.with_root_certificates(root_store)
.with_no_client_auth();
// Finish setup of the rustls connector.
let rustls_connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_tls_config(config)
.https_only()
.enab... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/tls/src/lib.rs | Apache-2.0 | b9deeed6ee0cf186959a9b237e8dae0d4c34ee59 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b9deeed6ee0cf186959a9b237e8dae0d4c34ee59/examples/tls/src/lib.rs | 41 | 70 |
awslabs/aws-sdk-rust:examples/tls/src/main.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/*
Purpose
Shows how to use rustls, hyper-rustls, and webpki-roots to set the minimum TLS version to 1.3 for
outgoing connections.
Then, uses TLS 1.3 to make a sample call to AWS Key Management Service... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/tls/src/main.rs | Apache-2.0 | b9deeed6ee0cf186959a9b237e8dae0d4c34ee59 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b9deeed6ee0cf186959a9b237e8dae0d4c34ee59/examples/tls/src/main.rs | 1 | 22 |
awslabs/aws-sdk-rust:examples/tls/tests/test-tls.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#[ignore]
#[tokio::test]
async fn test_it_runs() {
match tls::connect_via_tls_13().await {
Err(_e) => assert!(false),
_ => assert!(true),
}
} | rust | rust | testsuite | awslabs/aws-sdk-rust | examples/tls/tests/test-tls.rs | Apache-2.0 | 8bcacf75913b4529bd0f80a281551e4c9f1ab324 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/8bcacf75913b4529bd0f80a281551e4c9f1ab324/examples/tls/tests/test-tls.rs | 1 | 13 |
awslabs/aws-sdk-rust:examples/tls/tests/test-tls.rs:1 | #[ignore]
#[tokio::test]
async fn test_it_runs() {
match tls::connect_via_tls_13().await {
Err(_e) => assert!(false),
_ => assert!(true),
}
} | rust | rust | testsuite | awslabs/aws-sdk-rust | examples/tls/tests/test-tls.rs | Apache-2.0 | 317b86da4f62ff4815551e7eaf54ae9f194d1268 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/317b86da4f62ff4815551e7eaf54ae9f194d1268/examples/tls/tests/test-tls.rs | 1 | 8 |
awslabs/aws-sdk-rust:examples/tls/tests/test-tls.rs:1 | use tls;
#[ignore]
#[tokio::test]
async fn test_it_runs() {
match tls::connect_via_tls_13().await {
Err(_e) => assert!(false),
_ => assert!(true),
}
} | rust | rust | testsuite | awslabs/aws-sdk-rust | examples/tls/tests/test-tls.rs | Apache-2.0 | b9deeed6ee0cf186959a9b237e8dae0d4c34ee59 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/b9deeed6ee0cf186959a9b237e8dae0d4c34ee59/examples/tls/tests/test-tls.rs | 1 | 10 |
awslabs/aws-sdk-rust:examples/transcribestreaming/src/main.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use async_stream::stream;
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_transcribestreaming::primitives::Blob;
use aws_sdk_transcribestreaming::type... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/transcribestreaming/src/main.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/transcribestreaming/src/main.rs | 1 | 60 |
awslabs/aws-sdk-rust:examples/transcribestreaming/src/main.rs:2 | /// Amazon transcribe also supports __ogg-opus__ and __flac__ formats.
/// * `[-r REGION]` - The Region in which the client is created.
/// If not supplied, uses the value of the **AWS_REGION** environment variable.
/// If the environment variable is not set, defaults to **us-west-2**.
/// * `[-v]` - Whether to d... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/transcribestreaming/src/main.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/transcribestreaming/src/main.rs | 41 | 100 |
awslabs/aws-sdk-rust:examples/transcribestreaming/src/main.rs:3 | }
};
let mut output = client
.start_stream_transcription()
.language_code(LanguageCode::EnGb)
.media_sample_rate_hertz(8000)
.media_encoding(MediaEncoding::Pcm)
.audio_stream(input_stream.into())
.send()
.await?;
let mut full_message = String::new();... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/transcribestreaming/src/main.rs | Apache-2.0 | 44cc3f3c28295590938931857eb2d5652aa57225 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/44cc3f3c28295590938931857eb2d5652aa57225/examples/transcribestreaming/src/main.rs | 81 | 127 |
awslabs/aws-sdk-rust:examples/transcribestreaming/src/main.rs:1 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#![allow(clippy::result_large_err)]
use async_stream::stream;
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_transcribestreaming::primitives::Blob;
use aws_sdk_transcribestreaming::type... | rust | rust | rust-source | awslabs/aws-sdk-rust | examples/transcribestreaming/src/main.rs | Apache-2.0 | 90d063f52e4e6d4a1399fa565064bc2d7aa7e848 | github | sdk | https://github.com/awslabs/aws-sdk-rust/blob/90d063f52e4e6d4a1399fa565064bc2d7aa7e848/examples/transcribestreaming/src/main.rs | 1 | 60 |
End of preview. Expand in Data Studio
NickIBrody/rust-code-suite
Rust Code Suite is a public raw Rust source corpus built from open-source repositories and selected historical git revisions.
Splits
train.jsonlvalidation.jsonltest.jsonl
Schema
{
"id": "owner/repo:path:chunk",
"text": "...",
"arch": "rust",
"syntax": "rust",
"kind": "rust-source",
"repo": "owner/repo",
"path": "src/lib.rs",
"license": "GPL-2.0",
"commit": "abcdef123456",
"source_url": "https://github.com/owner/repo/blob/abcdef123456/src/lib.rs"
}
Build Summary
{
"total_examples": 1079332,
"arch_counts": {
"rust": 1079332
},
"syntax_counts": {
"rust": 1079332
},
"kind_counts": {
"rust-source": 738167,
"macro-heavy": 251258,
"testsuite": 87434,
"inline": 2473
},
"top_repos": [
[
"RustPython/RustPython",
80000
],
[
"rhaiscript/rhai",
80000
],
[
"rust-lang/cargo",
80000
],
[
"rust-lang/rust-analyzer",
80000
],
[
"rust-lang/rust",
80000
],
[
"rustdesk/rustdesk",
80000
],
[
"clap-rs/clap",
77890
],
[
"rust-lang/rustfmt",
77682
],
[
"rust-lang/rust-clippy",
75049
],
[
"serde-rs/serde",
59024
],
[
"tokio-rs/tokio",
57979
],
[
"rust-lang/rustup",
54353
],
[
"hyperium/hyper",
44769
],
[
"awslabs/aws-sdk-rust",
29884
],
[
"mozilla/uniffi-rs",
23585
],
[
"BurntSushi/ripgrep",
21317
],
[
"serde-rs/json",
20506
],
[
"rust-bitcoin/rust-secp256k1",
16189
],
[
"tokio-rs/prost",
11952
],
[
"rust-lang/rustlings",
6059
]
],
"avg_chars": 1887.91,
"size_estimate_bytes": 2037683839,
"train": 971127,
"validation": 54238,
"test": 53967
}
- Downloads last month
- 32