Skip to content

Commit a321b7e

Browse files
aws-sdk-rust-ciDavidSoutherford-at-aws
committed
[examples] Sync SDK examples from awsdocs/aws-doc-sdk-examples
Includes commit(s): f4d62c78cc9833e0761e6c8f2d30a69801b0c021 299c9a6fdbbb541261a567d38dd527996f910d86 1d52fa7c63b2fb7bb0a3adb4d51d8b21fc8390af 5b0cb7a97ee764ef54fc93b66a658d7e2730a718 b36c1c3b333bb2c03928e066774ada74c05ea165 304651bf073daba16331cb7dcc4614953c314e62 b4935440f4f1c031330173ea5fe45ed364fd9f2c 3f0570319a5862411cb767a005363f78a187c0ab a8606e2ac77b2a2e871f06f0e13717755a22e938 26f1a3d11de9c6488e9b1db175ffc92c370c5c27 Co-authored-by: David Souther <[email protected]> Co-authored-by: ford prior <[email protected]>
1 parent d814e4f commit a321b7e

File tree

241 files changed

+4602
-1129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+4602
-1129
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
exclude = [
33
"examples/cross_service",
4+
"examples/lambda",
45
"examples/test-utils",
56
"examples/examples",
67
"examples/webassembly",

examples/cross_service/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Note: this workspace exists solely for the convenience of
22
# compiling/auto-formatting/testing all the AWS Rust SDK examples together.
33
[workspace]
4+
resolver = "2"
45
members = [
56
"detect_faces",
67
"detect_labels",

examples/cross_service/detect_faces/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ publish = false
99
aws-config= { version = "0.57.1", path = "../../../sdk/aws-config" }
1010
aws-sdk-rekognition= { version = "0.35.0", path = "../../../sdk/rekognition" }
1111
aws-sdk-s3= { version = "0.35.0", path = "../../../sdk/s3" }
12+
aws-smithy-types= { version = "0.57.1", path = "../../../sdk/aws-smithy-types", features = ["rt-tokio"] }
1213

1314
[dependencies.tokio]
1415
version = "1.20.1"
1516
features = ["full"]
1617

1718
[dependencies.clap]
18-
version = "~4.2"
19+
version = "~4.4"
1920
features = ["derive"]
2021

2122
[dependencies.tracing-subscriber]

examples/cross_service/detect_labels/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ aws-config= { version = "0.57.1", path = "../../../sdk/aws-config" }
1111
aws-sdk-dynamodb= { version = "0.35.0", path = "../../../sdk/dynamodb" }
1212
aws-sdk-rekognition= { version = "0.35.0", path = "../../../sdk/rekognition" }
1313
aws-sdk-s3= { version = "0.35.0", path = "../../../sdk/s3" }
14+
aws-smithy-types= { version = "0.57.1", path = "../../../sdk/aws-smithy-types", features = ["rt-tokio"] }
1415
aws-types= { version = "0.57.1", path = "../../../sdk/aws-types" }
1516

1617
[dependencies.tokio]
1718
version = "1.20.1"
1819
features = ["full"]
1920

2021
[dependencies.clap]
21-
version = "~4.2"
22+
version = "~4.4"
2223
features = ["derive"]
2324

2425
[dependencies.tracing-subscriber]

examples/cross_service/photo_asset_management/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ aws-sdk-dynamodb= { version = "0.35.0", path = "../../../sdk/dynamodb" }
3535
aws-sdk-rekognition= { version = "0.35.0", path = "../../../sdk/rekognition" }
3636
aws-sdk-s3= { version = "0.35.0", path = "../../../sdk/s3" }
3737
aws-sdk-sns= { version = "0.35.0", path = "../../../sdk/sns" }
38-
aws-smithy-client= { version = "0.57.1", path = "../../../sdk/aws-smithy-client", features = ["test-util"] }
3938
aws-smithy-http= { version = "0.57.1", path = "../../../sdk/aws-smithy-http" }
39+
aws-smithy-runtime= { version = "0.57.1", path = "../../../sdk/aws-smithy-runtime" }
4040
aws-smithy-types-convert= { version = "0.57.1", path = "../../../sdk/aws-smithy-types-convert", features = ["convert-chrono"] }
4141

4242
[dependencies.aws_lambda_events]
43-
version = "0.10.0"
43+
version = "0.11.1"
4444
features = ["s3", "apigw"]
4545
default-features = false
4646

47+
[dependencies.sdk-examples-test-utils]
48+
path = "../../test-utils"
49+
version = "0.1.0"
50+
4751
[dependencies.serde]
4852
version = "1.0.159"
4953
features = ["derive"]

examples/cross_service/photo_asset_management/src/chunked_uploader.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use aws_sdk_dynamodb::primitives::DateTime;
55
use aws_sdk_s3::{operation::get_object::GetObjectOutput, types::CompletedPart};
66
use aws_smithy_types_convert::date_time::DateTimeExt;
77
use chrono::NaiveDateTime;
8-
use futures::TryStreamExt;
98
use pipe::{pipe, PipeReader, PipeWriter};
109
use streaming_zip::{Archive, CompressionMode};
1110
use uuid::Uuid;

examples/cross_service/photo_asset_management/src/handlers/detect_labels.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async fn detect_record<'a>(
6464
.send()
6565
.await?
6666
.labels()
67-
.ok_or_else(|| anyhow!("missing labels"))?
6867
.iter()
6968
.map(|l| l.to_owned())
7069
.collect();
@@ -159,7 +158,5 @@ mod test {
159158
assert!(update_inner_debug.contains("\":image\": L([S(\"object\")])"));
160159
assert!(update_inner_debug.contains("\":one\": N(\"1\")"));
161160
assert!(update_inner_debug.contains("\":zero\": N(\"0\")"));
162-
163-
()
164161
}
165162
}

examples/cross_service/photo_asset_management/src/handlers/labels.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ async fn get_labels(
8484
.send()
8585
.await?;
8686

87-
let items = scan.items().ok_or_else(|| anyhow!("no scanned items"))?;
88-
8987
let mut labels = Labels::new();
90-
for item in items {
88+
for item in scan.items() {
9189
labels.insert(item.try_into()?);
9290
}
9391

@@ -106,10 +104,9 @@ pub async fn handler(
106104

107105
#[cfg(test)]
108106
mod test {
107+
use sdk_examples_test_utils::single_shot_client;
109108
use serde_json::json;
110109

111-
use crate::single_shot_client;
112-
113110
use super::{get_labels, Labels};
114111

115112
#[tokio::test]
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub mod chunked_uploader;
22
pub mod common;
33
pub mod handlers;
4-
pub mod test_utils;
54
pub mod uploader;

examples/cross_service/photo_asset_management/src/test_utils/macros.rs

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)