diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4082f574666..296b7e402de 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,7 +14,7 @@ permissions: jobs: check: name: Check - runs-on: ubuntu-latest + runs-on: temporary-sizing-testing_ubuntu-latest_32-core steps: - name: setup run: > diff --git a/rust_dev_preview/cross_service/detect_faces/Cargo.toml b/rust_dev_preview/cross_service/detect_faces/Cargo.toml index c64afe985e7..bd20b14f57c 100644 --- a/rust_dev_preview/cross_service/detect_faces/Cargo.toml +++ b/rust_dev_preview/cross_service/detect_faces/Cargo.toml @@ -13,6 +13,7 @@ edition = "2021" aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-rekognition = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["rt-tokio"] } tokio = { version = "1.20.1", features = ["full"] } clap = { version = "~4.4", features = ["derive"] } tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } diff --git a/rust_dev_preview/cross_service/detect_labels/Cargo.toml b/rust_dev_preview/cross_service/detect_labels/Cargo.toml index 19aeb35bad8..8c85f842230 100644 --- a/rust_dev_preview/cross_service/detect_labels/Cargo.toml +++ b/rust_dev_preview/cross_service/detect_labels/Cargo.toml @@ -14,6 +14,7 @@ aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" aws-sdk-dynamodb = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-rekognition = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["rt-tokio"] } aws-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } tokio = { version = "1.20.1", features = ["full"] } clap = { version = "~4.4", features = ["derive"] } diff --git a/rust_dev_preview/cross_service/photo_asset_management/Cargo.toml b/rust_dev_preview/cross_service/photo_asset_management/Cargo.toml index 3807e112dd0..6cdbf6d8ea4 100644 --- a/rust_dev_preview/cross_service/photo_asset_management/Cargo.toml +++ b/rust_dev_preview/cross_service/photo_asset_management/Cargo.toml @@ -22,7 +22,7 @@ aws-sdk-sns = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-smithy-types-convert ={ git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["convert-chrono"] } -aws_lambda_events = { version = "0.10.0", features = ["s3", "apigw"], default-features = false } +aws_lambda_events = { version = "0.11.1", features = ["s3", "apigw"], default-features = false } bytes = "1.4.0" chrono = "0.4.24" crossbeam-channel = "0.5.8" diff --git a/rust_dev_preview/cross_service/rest_ses/Cargo.toml b/rust_dev_preview/cross_service/rest_ses/Cargo.toml index d39ae87fd61..bfa530d7695 100644 --- a/rust_dev_preview/cross_service/rest_ses/Cargo.toml +++ b/rust_dev_preview/cross_service/rest_ses/Cargo.toml @@ -18,6 +18,7 @@ aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" aws-sdk-cloudwatchlogs = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-rdsdata = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-ses = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } chrono = { version = "0.4.22", default-features = false, features = [ "clock", diff --git a/rust_dev_preview/cross_service/rest_ses/src/work_item/repository.rs b/rust_dev_preview/cross_service/rest_ses/src/work_item/repository.rs index ed2214a03fc..66d4478bf12 100644 --- a/rust_dev_preview/cross_service/rest_ses/src/work_item/repository.rs +++ b/rust_dev_preview/cross_service/rest_ses/src/work_item/repository.rs @@ -208,10 +208,11 @@ fn parse_rds_output( #[cfg(test)] mod test { + use sdk_examples_test_utils::test_event; + use crate::{client::RdsClient, work_item::WorkItem}; use super::create; - use sdk_examples_test_utils::test_event; #[tokio::test] async fn test_create_failed() { diff --git a/rust_dev_preview/cross_service/telephone/Cargo.toml b/rust_dev_preview/cross_service/telephone/Cargo.toml index f4597665bde..2ad06fec38b 100644 --- a/rust_dev_preview/cross_service/telephone/Cargo.toml +++ b/rust_dev_preview/cross_service/telephone/Cargo.toml @@ -11,6 +11,7 @@ aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" aws-sdk-polly = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-transcribe = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["rt-tokio"] } anyhow = "1" tokio = { version = "1.20.1", features = ["full"] } bytes = "1" diff --git a/rust_dev_preview/examples/aurora/Cargo.toml b/rust_dev_preview/examples/aurora/Cargo.toml index fc563f8996c..c2a8f6760fa 100644 --- a/rust_dev_preview/examples/aurora/Cargo.toml +++ b/rust_dev_preview/examples/aurora/Cargo.toml @@ -12,7 +12,7 @@ version = "0.1.0" anyhow = "1.0.75" assert_matches = "1.5.0" aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-smithy-runtime-api = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-rds = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } inquire = "0.6.2" diff --git a/rust_dev_preview/examples/aurora/README.md b/rust_dev_preview/examples/aurora/README.md index 247486ddf3b..6242b9ecfb0 100644 --- a/rust_dev_preview/examples/aurora/README.md +++ b/rust_dev_preview/examples/aurora/README.md @@ -1,4 +1,4 @@ - + # Aurora code examples for the SDK for Rust ## Overview @@ -50,7 +50,7 @@ Code excerpts that show you how to call individual service functions. * [Describe DB instances](src/aurora_scenario/mod.rs#L514) (`DescribeDBInstances`) * [Describe database engine versions](src/aurora_scenario/mod.rs#L144) (`DescribeDBEngineVersions`) * [Describe options for DB instances](src/aurora_scenario/mod.rs#L181) (`DescribeOrderableDBInstanceOptions`) -* [Describe parameters from a DB cluster parameter group](None) (`DescribeDBClusterParameters`) +* [Describe parameters from a DB cluster parameter group](src/aurora_scenario/mod.rs#L288) (`DescribeDBClusterParameters`) * [Update parameters in a DB cluster parameter group](src/aurora_scenario/mod.rs#L317) (`ModifyDBClusterParameterGroup`) ### Scenarios diff --git a/rust_dev_preview/examples/aurora/src/aurora_scenario/tests.rs b/rust_dev_preview/examples/aurora/src/aurora_scenario/tests.rs index c2a4f09e532..317e02c8a43 100644 --- a/rust_dev_preview/examples/aurora/src/aurora_scenario/tests.rs +++ b/rust_dev_preview/examples/aurora/src/aurora_scenario/tests.rs @@ -39,8 +39,8 @@ use aws_sdk_rds::{ OrderableDbInstanceOption, }, }; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::orchestrator::HttpResponse; +use aws_smithy_types::body::SdkBody; use mockall::predicate::eq; use secrecy::ExposeSecret; diff --git a/rust_dev_preview/examples/auto-scaling/README.md b/rust_dev_preview/examples/auto-scaling/README.md index 6b45db185d2..ea3e9d7ff74 100644 --- a/rust_dev_preview/examples/auto-scaling/README.md +++ b/rust_dev_preview/examples/auto-scaling/README.md @@ -1,4 +1,4 @@ - + # Auto Scaling code examples for the SDK for Rust ## Overview @@ -41,13 +41,13 @@ Code excerpts that show you how to call individual service functions. * [Create a group](src/bin/create-autoscaling-group.rs#L32) (`CreateAutoScalingGroup`) * [Delete a group](src/bin/delete-autoscaling-group.rs#L32) (`DeleteAutoScalingGroup`) -* [Disable metrics collection for a group](src/scenario.rs#L617) (`DisableMetricsCollection`) +* [Disable metrics collection for a group](src/scenario.rs#L620) (`DisableMetricsCollection`) * [Enable metrics collection for a group](src/scenario.rs#L297) (`EnableMetricsCollection`) * [Get information about groups](src/bin/list-autoscaling-groups.rs#L24) (`DescribeAutoScalingGroups`) * [Get information about instances](src/scenario.rs#L535) (`DescribeAutoScalingInstances`) * [Get information about scaling activities](src/scenario.rs#L402) (`DescribeScalingActivities`) -* [Set the desired capacity of a group](src/scenario.rs#L595) (`SetDesiredCapacity`) -* [Terminate an instance in a group](src/scenario.rs#L654) (`TerminateInstanceInAutoScalingGroup`) +* [Set the desired capacity of a group](src/scenario.rs#L598) (`SetDesiredCapacity`) +* [Terminate an instance in a group](src/scenario.rs#L657) (`TerminateInstanceInAutoScalingGroup`) * [Update a group](src/bin/update-autoscaling-group.rs#L32) (`UpdateAutoScalingGroup`) ### Scenarios diff --git a/rust_dev_preview/examples/auto-scaling/src/bin/list-autoscaling-groups.rs b/rust_dev_preview/examples/auto-scaling/src/bin/list-autoscaling-groups.rs index 8bbd673c59c..d313996e144 100644 --- a/rust_dev_preview/examples/auto-scaling/src/bin/list-autoscaling-groups.rs +++ b/rust_dev_preview/examples/auto-scaling/src/bin/list-autoscaling-groups.rs @@ -30,7 +30,10 @@ async fn list_groups(client: &Client) -> Result<(), Error> { let groups = resp.auto_scaling_groups(); for group in groups { - println!("Name: {}", group.auto_scaling_group_name(),); + println!( + "Name: {}", + group.auto_scaling_group_name().unwrap_or("Unknown") + ); println!( "Arn: {}", group.auto_scaling_group_arn().unwrap_or("unknown"), diff --git a/rust_dev_preview/examples/auto-scaling/src/scenario.rs b/rust_dev_preview/examples/auto-scaling/src/scenario.rs index 87b1135be3c..81e446f4456 100644 --- a/rust_dev_preview/examples/auto-scaling/src/scenario.rs +++ b/rust_dev_preview/examples/auto-scaling/src/scenario.rs @@ -107,8 +107,8 @@ impl Display for AutoScalingScenarioDescription { writeln!( f, "\t\t- {} Progress: {}% Status: {:?} End: {:?}", - activity.cause(), - activity.progress(), + activity.cause().unwrap_or("Unknown"), + activity.progress.unwrap_or(-1), activity.status_code(), // activity.status_message().unwrap_or_default() activity.end_time(), @@ -413,8 +413,8 @@ impl AutoScalingScenario { .map(|s| { format!( "{}: {}", - s.auto_scaling_group_name(), - s.status().unwrap_or_default() + s.auto_scaling_group_name().unwrap_or("Unknown"), + s.status().unwrap_or("Unknown") ) }) .collect::>() @@ -510,7 +510,7 @@ impl AutoScalingScenario { "Waiting for no scaling found {} activities", activities.len() ); - scaling = activities.iter().any(|a| a.progress < 100); + scaling = activities.iter().any(|a| a.progress() < Some(100)); } Ok(()) } @@ -548,8 +548,11 @@ impl AutoScalingScenario { .map(|items| { items .into_iter() - .filter(|i| i.auto_scaling_group_name == self.auto_scaling_group_name) - .map(|i| i.instance_id) + .filter(|i| { + i.auto_scaling_group_name.as_deref() + == Some(self.auto_scaling_group_name.as_str()) + }) + .map(|i| i.instance_id.unwrap_or_default()) .filter(|id| !id.is_empty()) .collect::>() }) @@ -659,10 +662,15 @@ impl AutoScalingScenario { // Or use other logic to find an instance to terminate. let instance = instances.first(); if let Some(instance) = instance { + let instance_id = if let Some(instance_id) = instance.instance_id() { + instance_id + } else { + return Err(ScenarioError::with("Missing instance id")); + }; let termination = self .ec2 .terminate_instances() - .instance_ids(instance.instance_id()) + .instance_ids(instance_id) .send() .await; if let Err(err) = termination { diff --git a/rust_dev_preview/examples/batch/README.md b/rust_dev_preview/examples/batch/README.md index a3504884535..9824159bed2 100644 --- a/rust_dev_preview/examples/batch/README.md +++ b/rust_dev_preview/examples/batch/README.md @@ -1,4 +1,4 @@ - + # AWS Batch code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/batch/src/bin/batch-helloworld.rs b/rust_dev_preview/examples/batch/src/bin/batch-helloworld.rs index 372645b3c40..e50071146c6 100644 --- a/rust_dev_preview/examples/batch/src/bin/batch-helloworld.rs +++ b/rust_dev_preview/examples/batch/src/bin/batch-helloworld.rs @@ -31,8 +31,8 @@ async fn show_envs(client: &Client) -> Result<(), Error> { let arn = env.compute_environment_arn(); let name = env.compute_environment_name(); - println!(" Name : {}", name); - println!(" ARN: {}", arn); + println!(" Name: {}", name.unwrap_or("Unknown")); + println!(" ARN: {}", arn.unwrap_or("Unknown")); println!(); } diff --git a/rust_dev_preview/examples/cloudformation/src/bin/describe-stack.rs b/rust_dev_preview/examples/cloudformation/src/bin/describe-stack.rs index 5cf26d9e0df..40ef7a442d6 100644 --- a/rust_dev_preview/examples/cloudformation/src/bin/describe-stack.rs +++ b/rust_dev_preview/examples/cloudformation/src/bin/describe-stack.rs @@ -34,7 +34,7 @@ async fn describe_stack(client: &Client, name: &str) -> Result<(), Error> { // The array should only have one item, so just access it via first(). let status = resp.stacks().first().unwrap().stack_status(); - println!("Stack status: {}", status.as_str()); + println!("Stack status: {:?}", status); println!(); diff --git a/rust_dev_preview/examples/cloudformation/src/bin/list-stacks.rs b/rust_dev_preview/examples/cloudformation/src/bin/list-stacks.rs index 6126c0b5579..f7090141b07 100644 --- a/rust_dev_preview/examples/cloudformation/src/bin/list-stacks.rs +++ b/rust_dev_preview/examples/cloudformation/src/bin/list-stacks.rs @@ -26,7 +26,7 @@ async fn list_stacks(client: &Client) -> Result<(), Error> { let stacks = client.list_stacks().send().await?; for stack in stacks.stack_summaries() { - println!("{}", stack.stack_name()); + println!("{}", stack.stack_name().unwrap_or("Unknown")); println!(" Status: {:?}", stack.stack_status()); println!(); } diff --git a/rust_dev_preview/examples/cloudwatch/README.md b/rust_dev_preview/examples/cloudwatch/README.md index 83cb1ae7f86..fca334212b5 100644 --- a/rust_dev_preview/examples/cloudwatch/README.md +++ b/rust_dev_preview/examples/cloudwatch/README.md @@ -1,4 +1,4 @@ - + # CloudWatch code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/cloudwatch/src/bin/list-metrics.rs b/rust_dev_preview/examples/cloudwatch/src/bin/list-metrics.rs index c047a97af08..fff97608259 100644 --- a/rust_dev_preview/examples/cloudwatch/src/bin/list-metrics.rs +++ b/rust_dev_preview/examples/cloudwatch/src/bin/list-metrics.rs @@ -37,8 +37,8 @@ async fn show_metrics( if let Some(dimension) = metric.dimensions.as_ref() { for d in dimension { - println!(" Name: {}", d.name()); - println!(" Value: {}", d.value()); + println!(" Name: {}", d.name().unwrap_or("Unknown")); + println!(" Value: {}", d.value().unwrap_or("Unknown")); println!(); } } diff --git a/rust_dev_preview/examples/dynamodb/Cargo.toml b/rust_dev_preview/examples/dynamodb/Cargo.toml index 63a8aff9ef2..259bbaf7ef5 100644 --- a/rust_dev_preview/examples/dynamodb/Cargo.toml +++ b/rust_dev_preview/examples/dynamodb/Cargo.toml @@ -14,7 +14,6 @@ edition = "2021" aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-sdk-dynamodb = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ "rt-tokio", ] } aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["test-util"] } aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } axum = "0.5.16" diff --git a/rust_dev_preview/examples/dynamodb/README.md b/rust_dev_preview/examples/dynamodb/README.md index 9da993e82c5..36f7e052068 100644 --- a/rust_dev_preview/examples/dynamodb/README.md +++ b/rust_dev_preview/examples/dynamodb/README.md @@ -1,4 +1,4 @@ - + # DynamoDB code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/dynamodb/src/scenario/error.rs b/rust_dev_preview/examples/dynamodb/src/scenario/error.rs index 71b1860d1d4..f156e103dc0 100644 --- a/rust_dev_preview/examples/dynamodb/src/scenario/error.rs +++ b/rust_dev_preview/examples/dynamodb/src/scenario/error.rs @@ -5,7 +5,7 @@ use std::error::Error as StdError; -use aws_smithy_http::operation::error::BuildError; +use aws_smithy_types::error::operation::BuildError; #[derive(thiserror::Error, Debug)] pub enum Error { diff --git a/rust_dev_preview/examples/dynamodb/src/scenario/movies/mod.rs b/rust_dev_preview/examples/dynamodb/src/scenario/movies/mod.rs index 2bb31ae3f8e..cb0a4a133a8 100644 --- a/rust_dev_preview/examples/dynamodb/src/scenario/movies/mod.rs +++ b/rust_dev_preview/examples/dynamodb/src/scenario/movies/mod.rs @@ -1,6 +1,6 @@ use aws_sdk_dynamodb::error::SdkError; use aws_sdk_dynamodb::types::{AttributeValue, PutRequest}; -use aws_smithy_http::operation::error::BuildError; +use aws_smithy_types::error::operation::BuildError; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; diff --git a/rust_dev_preview/examples/ebs/README.md b/rust_dev_preview/examples/ebs/README.md index d7b740f79b9..f492c81677a 100644 --- a/rust_dev_preview/examples/ebs/README.md +++ b/rust_dev_preview/examples/ebs/README.md @@ -1,4 +1,4 @@ - + # Amazon EBS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/ec2/README.md b/rust_dev_preview/examples/ec2/README.md index 3eebfd76ba7..08b0073e5fd 100644 --- a/rust_dev_preview/examples/ec2/README.md +++ b/rust_dev_preview/examples/ec2/README.md @@ -1,4 +1,4 @@ - + # Amazon EC2 code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/ecr/README.md b/rust_dev_preview/examples/ecr/README.md index 8c1a2acf2a0..5e429d7086c 100644 --- a/rust_dev_preview/examples/ecr/README.md +++ b/rust_dev_preview/examples/ecr/README.md @@ -1,4 +1,4 @@ - + # Amazon ECR code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/ecs/README.md b/rust_dev_preview/examples/ecs/README.md index 8a45b12c8ad..bfa5fdc412a 100644 --- a/rust_dev_preview/examples/ecs/README.md +++ b/rust_dev_preview/examples/ecs/README.md @@ -1,4 +1,4 @@ - + # Amazon ECS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/eks/README.md b/rust_dev_preview/examples/eks/README.md index 22f682d4787..cb5d24e7eb4 100644 --- a/rust_dev_preview/examples/eks/README.md +++ b/rust_dev_preview/examples/eks/README.md @@ -1,4 +1,4 @@ - + # Amazon EKS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/firehose/README.md b/rust_dev_preview/examples/firehose/README.md index f26556d99d0..695fce1ccd2 100644 --- a/rust_dev_preview/examples/firehose/README.md +++ b/rust_dev_preview/examples/firehose/README.md @@ -1,4 +1,4 @@ - + # Kinesis Data Firehose code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/glue/README.md b/rust_dev_preview/examples/glue/README.md index ba4d0feff74..2f089c78ec5 100644 --- a/rust_dev_preview/examples/glue/README.md +++ b/rust_dev_preview/examples/glue/README.md @@ -1,4 +1,4 @@ - + # AWS Glue code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/glue/src/lib.rs b/rust_dev_preview/examples/glue/src/lib.rs index 1b2599e39d6..79a4f1e1977 100644 --- a/rust_dev_preview/examples/glue/src/lib.rs +++ b/rust_dev_preview/examples/glue/src/lib.rs @@ -7,7 +7,7 @@ pub mod prepare; pub mod run; use aws_sdk_glue::types::Table; -use aws_smithy_http::operation::error::BuildError; +use aws_smithy_types::error::operation::BuildError; use clap::Parser; use secrecy::Secret; use std::time::Duration; diff --git a/rust_dev_preview/examples/iam/README.md b/rust_dev_preview/examples/iam/README.md index df4bc49192b..95db591c696 100644 --- a/rust_dev_preview/examples/iam/README.md +++ b/rust_dev_preview/examples/iam/README.md @@ -1,4 +1,4 @@ - + # IAM code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/iot/README.md b/rust_dev_preview/examples/iot/README.md index 10ed783f4d7..078dac63513 100644 --- a/rust_dev_preview/examples/iot/README.md +++ b/rust_dev_preview/examples/iot/README.md @@ -1,4 +1,4 @@ - + # AWS IoT code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/kinesis/README.md b/rust_dev_preview/examples/kinesis/README.md index 843587da51c..9249334a426 100644 --- a/rust_dev_preview/examples/kinesis/README.md +++ b/rust_dev_preview/examples/kinesis/README.md @@ -1,4 +1,4 @@ - + # Kinesis code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/kms/README.md b/rust_dev_preview/examples/kms/README.md index fede279eb82..b83e4702d66 100644 --- a/rust_dev_preview/examples/kms/README.md +++ b/rust_dev_preview/examples/kms/README.md @@ -1,4 +1,4 @@ - + # AWS KMS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/lambda/README.md b/rust_dev_preview/examples/lambda/README.md index e2110412dce..7a9542cdcd9 100644 --- a/rust_dev_preview/examples/lambda/README.md +++ b/rust_dev_preview/examples/lambda/README.md @@ -1,4 +1,4 @@ - + # Lambda code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/lambda/src/actions.rs b/rust_dev_preview/examples/lambda/src/actions.rs index 7867f565e5b..7b822b1e229 100644 --- a/rust_dev_preview/examples/lambda/src/actions.rs +++ b/rust_dev_preview/examples/lambda/src/actions.rs @@ -209,7 +209,7 @@ impl LambdaManager { zip_file: PathBuf, key: Option, ) -> Result { - let body = ByteStream::read_from().path(zip_file).build().await?; + let body = ByteStream::from_path(zip_file).await?; let key = key.unwrap_or_else(|| format!("{}_code", self.lambda_name)); diff --git a/rust_dev_preview/examples/medialive/README.md b/rust_dev_preview/examples/medialive/README.md index 3c7e584815e..d6bc615b290 100644 --- a/rust_dev_preview/examples/medialive/README.md +++ b/rust_dev_preview/examples/medialive/README.md @@ -1,4 +1,4 @@ - + # MediaLive code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/mediapackage/README.md b/rust_dev_preview/examples/mediapackage/README.md index ebaffe472b3..2ef3b9c955e 100644 --- a/rust_dev_preview/examples/mediapackage/README.md +++ b/rust_dev_preview/examples/mediapackage/README.md @@ -1,4 +1,4 @@ - + # MediaPackage code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/polly/README.md b/rust_dev_preview/examples/polly/README.md index 8c124d056e7..c8eb8fab26e 100644 --- a/rust_dev_preview/examples/polly/README.md +++ b/rust_dev_preview/examples/polly/README.md @@ -1,4 +1,4 @@ - + # Amazon Polly code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/qldb/README.md b/rust_dev_preview/examples/qldb/README.md index 871a49369fd..e3b0da1108f 100644 --- a/rust_dev_preview/examples/qldb/README.md +++ b/rust_dev_preview/examples/qldb/README.md @@ -1,4 +1,4 @@ - + # Amazon QLDB code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/rds/README.md b/rust_dev_preview/examples/rds/README.md index 4c08dbd97f1..cb37bfdd8ce 100644 --- a/rust_dev_preview/examples/rds/README.md +++ b/rust_dev_preview/examples/rds/README.md @@ -1,5 +1,4 @@ - - + # Amazon RDS code examples for the SDK for Rust ## Overview @@ -9,14 +8,14 @@ Shows how to use the AWS SDK for Rust to work with Amazon Relational Database Se -_Amazon RDS is a web service that makes it easier to set up, operate, and scale a relational database in the cloud._ +*Amazon RDS is a web service that makes it easier to set up, operate, and scale a relational database in the cloud.* ## ⚠ Important -- Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/?aws-products-pricing.sort-by=item.additionalFields.productNameLowercase&aws-products-pricing.sort-order=asc&awsf.Free%20Tier%20Type=*all&awsf.tech-category=*all) and [Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all). -- Running the tests might result in charges to your AWS account. -- We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). -- This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). +* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/?aws-products-pricing.sort-by=item.additionalFields.productNameLowercase&aws-products-pricing.sort-order=asc&awsf.Free%20Tier%20Type=*all&awsf.tech-category=*all) and [Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all). +* Running the tests might result in charges to your AWS account. +* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). +* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). @@ -27,6 +26,7 @@ _Amazon RDS is a web service that makes it easier to set up, operate, and scale For prerequisites, see the [README](../../README.md#Prerequisites) in the `rust_dev_preview` folder. + @@ -34,24 +34,30 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `rust_ ### Instructions + + + ### Tests ⚠ Running tests might result in charges to your AWS account. + To find instructions for running these tests, see the [README](../../README.md#Tests) in the `rust_dev_preview` folder. + + ## Additional resources -- [Amazon RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html) -- [Amazon RDS API Reference](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/Welcome.html) -- [SDK for Rust Amazon RDS reference](https://docs.rs/aws-sdk-rds/latest/aws_sdk_rds/) +* [Amazon RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html) +* [Amazon RDS API Reference](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/Welcome.html) +* [SDK for Rust Amazon RDS reference](https://docs.rs/aws-sdk-rds/latest/aws_sdk_rds/) @@ -60,4 +66,4 @@ in the `rust_dev_preview` folder. Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -SPDX-License-Identifier: Apache-2.0 +SPDX-License-Identifier: Apache-2.0 \ No newline at end of file diff --git a/rust_dev_preview/examples/s3/Cargo.toml b/rust_dev_preview/examples/s3/Cargo.toml index 462e865e7f8..7bbdfb0efd1 100644 --- a/rust_dev_preview/examples/s3/Cargo.toml +++ b/rust_dev_preview/examples/s3/Cargo.toml @@ -25,24 +25,23 @@ aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" # snippet-start:[s3.rust.s3-object-lambda-cargo.toml] aws-endpoint = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } # snippet-end:[s3.rust.s3-object-lambda-cargo.toml] -aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["rt-tokio"] } +aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["rt-tokio"]} aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-smithy-runtime-api = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["client"] } -aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["http-body-0-4-x"] } sdk-examples-test-utils = { path = "../../test-utils" } +anyhow = "1.0.70" bytes = "1.4.0" +clap = { version = "~4.4", features = ["derive"] } futures-util = { version = "0.3.21", features = ["alloc"] } http = "0.2.8" http-body = "0.4.5" md-5 = "0.10.1" +pin-project = "1.0.12" rand = "0.8.5" -clap = { version = "~4.4", features = ["derive"] } thiserror = "1.0" tokio = { version = "1.20.1", features = ["full"] } tokio-stream = "0.1.8" tracing = "0.1.37" tracing-subscriber = { version = "0.3.5", features = ["env-filter"] } uuid = { version = "1.3.1", features = ["serde", "v4"] } -anyhow = "1.0.70" -pin-project = "1.0.12" diff --git a/rust_dev_preview/examples/s3/README.md b/rust_dev_preview/examples/s3/README.md index f1fd073c886..032f1a031d8 100644 --- a/rust_dev_preview/examples/s3/README.md +++ b/rust_dev_preview/examples/s3/README.md @@ -1,4 +1,4 @@ - + # Amazon S3 code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/s3/src/bin/put-object-progress.rs b/rust_dev_preview/examples/s3/src/bin/put-object-progress.rs index 1ac986446e4..9f47c536254 100644 --- a/rust_dev_preview/examples/s3/src/bin/put-object-progress.rs +++ b/rust_dev_preview/examples/s3/src/bin/put-object-progress.rs @@ -1,6 +1,5 @@ use std::{ convert::Infallible, - mem, path::PathBuf, pin::Pin, process::exit, @@ -12,7 +11,6 @@ use aws_sdk_s3::{ primitives::{ByteStream, SdkBody}, Client, }; -use aws_smithy_http::body::BoxBody; use aws_smithy_runtime_api::client::http::request::Request; use bytes::Bytes; use clap::Parser; @@ -64,7 +62,7 @@ impl ProgressBody { let value = value.map(|body| { let len = body.content_length().expect("upload body sized"); // TODO - panics let body = ProgressBody::new(body, len); - SdkBody::from_dyn(BoxBody::new(body)) + SdkBody::from_body_0_4(body) }); Ok(value) } @@ -72,7 +70,7 @@ impl ProgressBody { impl ProgressBody where - InnerBody: Body, + InnerBody: Body, { pub fn new(body: InnerBody, content_length: u64) -> Self { Self { @@ -87,11 +85,11 @@ where impl Body for ProgressBody where - InnerBody: Body, + InnerBody: Body, { type Data = Bytes; - type Error = aws_smithy_http::body::Error; + type Error = aws_smithy_types::body::Error; // Our poll_data delegates to the inner poll_data, but needs a project() to // get there. When the poll has data, it updates the progress_tracker. diff --git a/rust_dev_preview/examples/s3/src/bin/s3-multipart-upload.rs b/rust_dev_preview/examples/s3/src/bin/s3-multipart-upload.rs index d1d3a2a934e..0b5384c3af2 100644 --- a/rust_dev_preview/examples/s3/src/bin/s3-multipart-upload.rs +++ b/rust_dev_preview/examples/s3/src/bin/s3-multipart-upload.rs @@ -18,7 +18,7 @@ use aws_sdk_s3::operation::{ }; use aws_sdk_s3::types::{CompletedMultipartUpload, CompletedPart}; use aws_sdk_s3::{config::Region, Client as S3Client}; -use aws_smithy_http::byte_stream::{ByteStream, Length}; +use aws_smithy_types::byte_stream::{ByteStream, Length}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use s3_service::error::Error; diff --git a/rust_dev_preview/examples/s3/src/error.rs b/rust_dev_preview/examples/s3/src/error.rs index 3eae3848041..228f6eb819a 100644 --- a/rust_dev_preview/examples/s3/src/error.rs +++ b/rust_dev_preview/examples/s3/src/error.rs @@ -5,7 +5,7 @@ use std::error::Error as StdError; -use aws_smithy_http::operation::error::BuildError; +use aws_smithy_types::error::operation::BuildError; #[derive(thiserror::Error, Debug)] #[error("unhandled error")] diff --git a/rust_dev_preview/examples/sagemaker/README.md b/rust_dev_preview/examples/sagemaker/README.md index 07aece07d79..c2b2cac5393 100644 --- a/rust_dev_preview/examples/sagemaker/README.md +++ b/rust_dev_preview/examples/sagemaker/README.md @@ -1,4 +1,4 @@ - + # SageMaker code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/sagemaker/src/bin/list-training-jobs.rs b/rust_dev_preview/examples/sagemaker/src/bin/list-training-jobs.rs index e5195b69520..c37e6ac6ea5 100644 --- a/rust_dev_preview/examples/sagemaker/src/bin/list-training-jobs.rs +++ b/rust_dev_preview/examples/sagemaker/src/bin/list-training-jobs.rs @@ -30,11 +30,14 @@ async fn show_jobs(client: &Client) -> Result<(), Error> { println!("Jobs:"); for j in job_details.training_job_summaries() { - let name = j.training_job_name(); - let creation_time = j.creation_time().to_chrono_utc()?; - let training_end_time = j.training_end_time().unwrap().to_chrono_utc()?; - - let status = j.training_job_status(); + let name = j.training_job_name().unwrap_or("Unknown"); + let creation_time = j.creation_time().expect("creation time").to_chrono_utc()?; + let training_end_time = j + .training_end_time() + .expect("Training end time") + .to_chrono_utc()?; + + let status = j.training_job_status().expect("training status"); let duration = training_end_time - creation_time; println!(" Name: {}", name); @@ -43,7 +46,7 @@ async fn show_jobs(client: &Client) -> Result<(), Error> { creation_time.format("%Y-%m-%d@%H:%M:%S") ); println!(" Duration (seconds): {}", duration.num_seconds()); - println!(" Status: {}", status.as_ref()); + println!(" Status: {:?}", status); println!(); } diff --git a/rust_dev_preview/examples/sagemaker/src/bin/sagemaker-helloworld.rs b/rust_dev_preview/examples/sagemaker/src/bin/sagemaker-helloworld.rs index eb18a60fcf7..2570b9bd5e6 100644 --- a/rust_dev_preview/examples/sagemaker/src/bin/sagemaker-helloworld.rs +++ b/rust_dev_preview/examples/sagemaker/src/bin/sagemaker-helloworld.rs @@ -32,7 +32,7 @@ async fn show_instances(client: &Client) -> Result<(), Error> { let n_status = n.notebook_instance_status().unwrap(); let n_name = n.notebook_instance_name(); - println!(" Name : {}", n_name); + println!(" Name : {}", n_name.unwrap_or("Unknown")); println!(" Status : {}", n_status.as_ref()); println!(" Instance Type : {}", n_instance_type.as_ref()); println!(); diff --git a/rust_dev_preview/examples/sending-presigned-requests/src/main.rs b/rust_dev_preview/examples/sending-presigned-requests/src/main.rs index cc35c520f03..27458959f3a 100644 --- a/rust_dev_preview/examples/sending-presigned-requests/src/main.rs +++ b/rust_dev_preview/examples/sending-presigned-requests/src/main.rs @@ -130,7 +130,7 @@ fn print_as_curl_request(presigned_req: &PresignedRequest, body: Option<&str>) { async fn send_presigned_request_with_hyper(req: PresignedRequest, body: hyper::Body) { let conn = hyper_tls::HttpsConnector::new(); let client = hyper::Client::builder().build(conn); - let req = req.to_http_02x_request(body).unwrap(); + let req = req.into_http_02x_request(body); let res = client.request(req).await; diff --git a/rust_dev_preview/examples/ses/README.md b/rust_dev_preview/examples/ses/README.md index 5c52384d79c..9a301a43c04 100644 --- a/rust_dev_preview/examples/ses/README.md +++ b/rust_dev_preview/examples/ses/README.md @@ -1,4 +1,4 @@ - + # Amazon SES code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/sns/README.md b/rust_dev_preview/examples/sns/README.md index 75cdb5cfb53..d87081f79ee 100644 --- a/rust_dev_preview/examples/sns/README.md +++ b/rust_dev_preview/examples/sns/README.md @@ -1,4 +1,4 @@ - + # Amazon SNS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/sqs/README.md b/rust_dev_preview/examples/sqs/README.md index 43e8f388146..27ac077e43a 100644 --- a/rust_dev_preview/examples/sqs/README.md +++ b/rust_dev_preview/examples/sqs/README.md @@ -1,4 +1,4 @@ - + # Amazon SQS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/ssm/README.md b/rust_dev_preview/examples/ssm/README.md index 0008802d8ec..38744b7c8fb 100644 --- a/rust_dev_preview/examples/ssm/README.md +++ b/rust_dev_preview/examples/ssm/README.md @@ -1,4 +1,4 @@ - + # Systems Manager code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/sts/README.md b/rust_dev_preview/examples/sts/README.md index 73d5b72542b..f622d6079dd 100644 --- a/rust_dev_preview/examples/sts/README.md +++ b/rust_dev_preview/examples/sts/README.md @@ -1,4 +1,4 @@ - + # AWS STS code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/examples/textract/README.md b/rust_dev_preview/examples/textract/README.md index f36be4545ba..c0c2770749c 100644 --- a/rust_dev_preview/examples/textract/README.md +++ b/rust_dev_preview/examples/textract/README.md @@ -1,4 +1,4 @@ - + # Amazon Textract code examples for the SDK for Rust ## Overview diff --git a/rust_dev_preview/run_all.sh b/rust_dev_preview/run_all.sh index af2eeb998ff..1e404b16b3a 100755 --- a/rust_dev_preview/run_all.sh +++ b/rust_dev_preview/run_all.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash -x cd "$(dirname "$0")" @@ -10,13 +10,15 @@ DIRS=( ) ACTIONS=( - "fmt --check" - clippy - test + "fmt --check --all" + "clippy --all" + "test --all" ) -# Clean Cargo.log -rm **/Cargo.lock +if [ "$1" == "--clean" ] ; then + rm **/Cargo.lock + ACTIONS=("clean" "${ACTIONS[@]}") +fi export RUSTFLAGS="-D warnings" ; export APP_ENVIRONMENT="test" @@ -26,10 +28,10 @@ CARGO="$HOME/.cargo/bin/cargo" FAIL=() for f in "${DIRS[@]}" ; do for a in "${ACTIONS[@]}" ; do - "$CARGO" $a --manifest-path $f/Cargo.toml --all || FAIL+=("${a}:$f") + "$CARGO" $a --manifest-path $f/Cargo.toml || FAIL+=("${a}:$f") done done -echo ${FAIL[@]} +echo "${FAIL[@]}" exit ${#FAIL[@]} diff --git a/rust_dev_preview/test-utils/Cargo.toml b/rust_dev_preview/test-utils/Cargo.toml index 8763c006f46..7b7123bbb09 100644 --- a/rust_dev_preview/test-utils/Cargo.toml +++ b/rust_dev_preview/test-utils/Cargo.toml @@ -10,11 +10,11 @@ edition = "2021" [dependencies] aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["test-util"] } aws-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next"} http = "0.2" tokio = "1.33.0" [lib] -path="src/mod.rs" +path="src/mod.rs" \ No newline at end of file diff --git a/rust_dev_preview/test-utils/src/macros.rs b/rust_dev_preview/test-utils/src/macros.rs index e5532383a99..a4fa0dfd714 100644 --- a/rust_dev_preview/test-utils/src/macros.rs +++ b/rust_dev_preview/test-utils/src/macros.rs @@ -22,11 +22,11 @@ macro_rules! test_event { ) => {{ aws_smithy_runtime::client::http::test_util::ReplayEvent::new( http::Request::builder() - .body(aws_smithy_http::body::SdkBody::from($req)) + .body(aws_smithy_types::body::SdkBody::from($req)) .unwrap(), http::Response::builder() .status($status) - .body(aws_smithy_http::body::SdkBody::from($res)) + .body(aws_smithy_types::body::SdkBody::from($res)) .unwrap(), ) }}; @@ -40,7 +40,7 @@ macro_rules! test_event { ) => {{ aws_smithy_runtime::client::http::test_util::ReplayEvent::new( http::Request::builder() - .body(aws_smithy_http::body::SdkBody::from($req)) + .body(aws_smithy_types::body::SdkBody::from($req)) .unwrap(), { let mut builder = http::Response::builder().status($status); @@ -48,7 +48,7 @@ macro_rules! test_event { builder = builder.header(k, v); } builder - .body(aws_smithy_http::body::SdkBody::from($res)) + .body(aws_smithy_types::body::SdkBody::from($res)) .unwrap() }, ) diff --git a/rust_dev_preview/test-utils/src/mod.rs b/rust_dev_preview/test-utils/src/mod.rs index f84fe202418..62334659606 100644 --- a/rust_dev_preview/test-utils/src/mod.rs +++ b/rust_dev_preview/test-utils/src/mod.rs @@ -1,4 +1,4 @@ -use aws_smithy_http::body::SdkBody; +use aws_smithy_types::body::SdkBody; pub mod macros; pub mod waiter; diff --git a/rust_dev_preview/webassembly/src/lib.rs b/rust_dev_preview/webassembly/src/lib.rs index 33d1114f960..851f3f6764a 100644 --- a/rust_dev_preview/webassembly/src/lib.rs +++ b/rust_dev_preview/webassembly/src/lib.rs @@ -9,8 +9,8 @@ use aws_sdk_lambda::config::{AsyncSleep, Region, Sleep}; use aws_sdk_lambda::primitives::SdkBody; use aws_sdk_lambda::{meta::PKG_VERSION, Client}; use aws_smithy_async::time::TimeSource; -use aws_smithy_http::result::ConnectorError; use aws_smithy_runtime_api::client::http::request::Request; +use aws_smithy_runtime_api::client::result::ConnectorError; use aws_smithy_runtime_api::{ client::{ http::{ @@ -163,7 +163,7 @@ impl MakeRequestBrowser for BrowserHttpClient { opts.body(Some(&uint_8_array)); } - let request = web_sys::Request::new_with_str_and_init(&req.uri().to_string(), &opts)?; + let request = web_sys::Request::new_with_str_and_init(req.uri(), &opts)?; for (name, value) in req.headers() { request.headers().set(name, value)?; @@ -259,7 +259,7 @@ impl HttpConnector for Adapter { }; tx.send( fut.await - .expect(format!("sending request to {uri}").as_str()), + .unwrap_or_else(|_| panic!("sending request to {uri}")), ) .expect("sent request to channel"); });