diff --git a/aws/rust-runtime/Cargo.lock b/aws/rust-runtime/Cargo.lock index 3152e8e5ca4..ae3d4b704ee 100644 --- a/aws/rust-runtime/Cargo.lock +++ b/aws/rust-runtime/Cargo.lock @@ -73,28 +73,40 @@ name = "aws-credential-types" version = "1.2.11" dependencies = [ "async-trait", - "aws-smithy-async", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-async 1.2.7", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", "tokio", "zeroize", ] +[[package]] +name = "aws-credential-types" +version = "1.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd362783681b15d136480ad555a099e82ecd8e2d10a841e14dfd0078d67fee3" +dependencies = [ + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize", +] + [[package]] name = "aws-inlineable" version = "0.1.0" dependencies = [ - "aws-credential-types", - "aws-runtime", - "aws-sigv4", - "aws-smithy-async", + "aws-credential-types 1.2.11", + "aws-runtime 1.5.18", + "aws-sigv4 1.3.7", + "aws-smithy-async 1.2.7", "aws-smithy-checksums", - "aws-smithy-http", - "aws-smithy-observability", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-smithy-http 0.62.6", + "aws-smithy-observability 0.2.0", + "aws-smithy-runtime 1.9.8", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", + "aws-types 1.3.11", "bytes", "fastrand", "hex", @@ -112,21 +124,43 @@ dependencies = [ "url", ] +[[package]] +name = "aws-lc-rs" +version = "1.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e84ce723ab67259cfeb9877c6a639ee9eb7a27b28123abd71db7f0d5d0cc9d86" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a442ece363113bd4bd4c8b18977a7798dd4d3c3383f34fb61936960e8f4ad8" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + [[package]] name = "aws-runtime" version = "1.5.18" dependencies = [ "arbitrary", - "aws-credential-types", - "aws-sigv4", - "aws-smithy-async", + "aws-credential-types 1.2.11", + "aws-sigv4 1.3.7", + "aws-smithy-async 1.2.7", "aws-smithy-eventstream", - "aws-smithy-http", + "aws-smithy-http 0.62.6", "aws-smithy-protocol-test", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-smithy-runtime 1.9.8", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", + "aws-types 1.3.11", "bytes", "bytes-utils", "convert_case", @@ -149,19 +183,103 @@ dependencies = [ "uuid", ] +[[package]] +name = "aws-runtime" +version = "1.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "959dab27ce613e6c9658eb3621064d0e2027e5f2acb65bc526a43577facea557" +dependencies = [ + "aws-credential-types 1.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-sigv4 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-http 0.62.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime 1.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-types 1.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes", + "fastrand", + "http 0.2.12", + "http-body 0.4.6", + "percent-encoding", + "pin-project-lite", + "tracing", + "uuid", +] + [[package]] name = "aws-runtime-api" version = "1.1.10" +[[package]] +name = "aws-sdk-dynamodb" +version = "1.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f7e6a53cf5ee8b7041c73106d9a93480b47f8b955466262b043aab0b5bf489" +dependencies = [ + "aws-credential-types 1.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-runtime 1.5.18 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-http 0.62.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-json", + "aws-smithy-observability 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime 1.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-types 1.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes", + "fastrand", + "http 0.2.12", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-dynamodb-expressions" +version = "0.1.0" +dependencies = [ + "aws-sdk-dynamodb", + "tokio", +] + +[[package]] +name = "aws-sdk-dynamodb-mapper" +version = "0.1.0" +dependencies = [ + "aws-sdk-dynamodb", + "aws-sdk-dynamodb-expressions", + "aws-sdk-dynamodb-mapper-core", + "aws-sdk-dynamodb-mapper-macros", + "tokio", +] + +[[package]] +name = "aws-sdk-dynamodb-mapper-core" +version = "0.1.0" +dependencies = [ + "aws-sdk-dynamodb", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio", +] + +[[package]] +name = "aws-sdk-dynamodb-mapper-macros" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "aws-sigv4" version = "1.3.7" dependencies = [ - "aws-credential-types", + "aws-credential-types 1.2.11", "aws-smithy-eventstream", - "aws-smithy-http", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-http 0.62.6", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", "bytes", "criterion", "crypto-bigint 0.5.5", @@ -187,9 +305,42 @@ dependencies = [ "zeroize", ] +[[package]] +name = "aws-sigv4" +version = "1.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e523e1c4e8e7e8ff219d732988e22bfeae8a1cafdbe6d9eca1546fa080be7c" +dependencies = [ + "aws-credential-types 1.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-http 0.62.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes", + "form_urlencoded", + "hex", + "hmac", + "http 0.2.12", + "http 1.4.0", + "percent-encoding", + "sha2", + "time", + "tracing", +] + +[[package]] +name = "aws-smithy-async" +version = "1.2.7" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", +] + [[package]] name = "aws-smithy-async" version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee19095c7c4dda59f1697d028ce704c24b2d33c6718790c7f1d5a3015b4107c" dependencies = [ "futures-util", "pin-project-lite", @@ -200,8 +351,8 @@ dependencies = [ name = "aws-smithy-checksums" version = "0.63.13" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", + "aws-smithy-http 0.62.6", + "aws-smithy-types 1.3.6", "bytes", "crc-fast", "hex", @@ -218,7 +369,7 @@ dependencies = [ name = "aws-smithy-eventstream" version = "0.60.14" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 1.3.6", "bytes", "crc32fast", ] @@ -227,8 +378,29 @@ dependencies = [ name = "aws-smithy-http" version = "0.62.6" dependencies = [ - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", + "bytes", + "bytes-utils", + "futures-core", + "futures-util", + "http 0.2.12", + "http 1.4.0", + "http-body 0.4.6", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tracing", +] + +[[package]] +name = "aws-smithy-http" +version = "0.62.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826141069295752372f8203c17f28e30c464d22899a43a0c9fd9c458d469c88b" +dependencies = [ + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "bytes", "bytes-utils", "futures-core", @@ -245,28 +417,76 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59e62db736db19c488966c8d787f52e6270be565727236fd5579eaa301e7bc4a" +dependencies = [ + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.3.27", + "h2 0.4.13", + "http 0.2.12", + "http 1.4.0", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper 1.8.1", + "hyper-rustls 0.24.2", + "hyper-rustls 0.27.7", + "hyper-util", + "pin-project-lite", + "rustls 0.21.12", + "rustls 0.23.36", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.4", + "tower", + "tracing", +] + +[[package]] +name = "aws-smithy-http-client" +version = "1.1.6" dependencies = [ - "aws-smithy-async", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-async 1.2.7", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", "h2 0.3.27", "h2 0.4.13", "http 0.2.12", "http-body 0.4.6", - "hyper", - "hyper-rustls", + "hyper 0.14.32", + "hyper-rustls 0.24.2", "pin-project-lite", - "rustls", + "rustls 0.21.12", "rustls-native-certs", "tokio", "tracing", ] +[[package]] +name = "aws-smithy-json" +version = "0.61.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49fa1213db31ac95288d981476f78d05d9cbb0353d22cdf3472cc05bb02f6551" +dependencies = [ + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aws-smithy-observability" +version = "0.2.0" +dependencies = [ + "aws-smithy-runtime-api 1.10.0", +] + [[package]] name = "aws-smithy-observability" version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1fcbefc7ece1d70dcce29e490f269695dfca2d2bacdeaf9e5c3f799e4e6a42" dependencies = [ - "aws-smithy-runtime-api", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -274,7 +494,7 @@ name = "aws-smithy-protocol-test" version = "0.63.7" dependencies = [ "assert-json-diff", - "aws-smithy-runtime-api", + "aws-smithy-runtime-api 1.10.0", "base64-simd", "cbor-diag", "ciborium", @@ -288,14 +508,38 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.9.7" -dependencies = [ - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-http-client", - "aws-smithy-observability", - "aws-smithy-runtime-api", - "aws-smithy-types", +version = "1.9.8" +dependencies = [ + "aws-smithy-async 1.2.7", + "aws-smithy-http 0.62.6", + "aws-smithy-http-client 1.1.6", + "aws-smithy-observability 0.2.0", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", + "bytes", + "fastrand", + "http 0.2.12", + "http 1.4.0", + "http-body 0.4.6", + "http-body 1.0.1", + "pin-project-lite", + "pin-utils", + "tokio", + "tracing", +] + +[[package]] +name = "aws-smithy-runtime" +version = "1.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb5b6167fcdf47399024e81ac08e795180c576a20e4d4ce67949f9a88ae37dc1" +dependencies = [ + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-http 0.62.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-http-client 1.1.5", + "aws-smithy-observability 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "bytes", "fastrand", "http 0.2.12", @@ -312,8 +556,8 @@ dependencies = [ name = "aws-smithy-runtime-api" version = "1.10.0" dependencies = [ - "aws-smithy-async", - "aws-smithy-types", + "aws-smithy-async 1.2.7", + "aws-smithy-types 1.3.6", "bytes", "http 0.2.12", "http 1.4.0", @@ -323,9 +567,52 @@ dependencies = [ "zeroize", ] +[[package]] +name = "aws-smithy-runtime-api" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efce7aaaf59ad53c5412f14fc19b2d5c6ab2c3ec688d272fd31f76ec12f44fb0" +dependencies = [ + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes", + "http 0.2.12", + "http 1.4.0", + "pin-project-lite", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-smithy-types" +version = "1.3.6" +dependencies = [ + "base64-simd", + "bytes", + "bytes-utils", + "futures-core", + "http 0.2.12", + "http 1.4.0", + "http-body 0.4.6", + "http-body 1.0.1", + "http-body-util", + "itoa", + "num-integer", + "pin-project-lite", + "pin-utils", + "ryu", + "serde", + "time", + "tokio", + "tokio-util", +] + [[package]] name = "aws-smithy-types" version = "1.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65f172bcb02424eb94425db8aed1b6d583b5104d4d5ddddf22402c661a320048" dependencies = [ "base64-simd", "bytes", @@ -351,13 +638,13 @@ dependencies = [ name = "aws-types" version = "1.3.11" dependencies = [ - "aws-credential-types", - "aws-smithy-async", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-credential-types 1.2.11", + "aws-smithy-async 1.2.7", + "aws-smithy-runtime 1.9.8", + "aws-smithy-runtime-api 1.10.0", + "aws-smithy-types 1.3.6", "http 0.2.12", - "hyper-rustls", + "hyper-rustls 0.24.2", "rustc_version", "tempfile", "tokio", @@ -365,12 +652,32 @@ dependencies = [ "tracing-test", ] +[[package]] +name = "aws-types" +version = "1.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d980627d2dd7bfc32a3c025685a033eeab8d365cc840c631ef59d1b8f428164" +dependencies = [ + "aws-credential-types 1.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-async 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-runtime-api 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aws-smithy-types 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", + "tracing", +] + [[package]] name = "base16ct" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64-simd" version = "0.8.0" @@ -480,6 +787,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -550,6 +859,15 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +[[package]] +name = "cmake" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" +dependencies = [ + "cc", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -778,6 +1096,12 @@ dependencies = [ "syn", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "ecdsa" version = "0.14.8" @@ -875,6 +1199,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures-channel" version = "0.3.31" @@ -1136,6 +1466,28 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2 0.4.13", + "http 1.4.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1144,14 +1496,55 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper", + "hyper 0.14.32", "log", - "rustls", + "rustls 0.21.12", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", "webpki-roots", ] +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http 1.4.0", + "hyper 1.8.1", + "hyper-util", + "rustls 0.23.36", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.4", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http 1.4.0", + "http-body 1.0.1", + "hyper 1.8.1", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.6.1", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "icu_collections" version = "2.1.1" @@ -1264,6 +1657,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + [[package]] name = "is-terminal" version = "0.4.17" @@ -1290,6 +1689,16 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + [[package]] name = "js-sys" version = "0.3.83" @@ -1826,10 +2235,24 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.103.9", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.8.3" @@ -1861,6 +2284,18 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -2291,7 +2726,17 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls 0.23.36", "tokio", ] @@ -2308,6 +2753,22 @@ dependencies = [ "tokio", ] +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" version = "0.3.3" diff --git a/aws/rust-runtime/Cargo.toml b/aws/rust-runtime/Cargo.toml index 34ec57c49d3..1d0d96945c3 100644 --- a/aws/rust-runtime/Cargo.toml +++ b/aws/rust-runtime/Cargo.toml @@ -9,6 +9,10 @@ members = [ "aws-runtime-api", "aws-sigv4", "aws-types", + # DDB HLL + "dynamodb-mapper/aws-sdk-dynamodb-expressions", + "dynamodb-mapper/aws-sdk-dynamodb-mapper", + "dynamodb-mapper/aws-sdk-dynamodb-mapper-core", + "dynamodb-mapper/aws-sdk-dynamodb-mapper-macros", ] - exclude = ["aws-config"] diff --git a/aws/rust-runtime/aws-config/Cargo.lock b/aws/rust-runtime/aws-config/Cargo.lock index e248d6cc4d8..8d47c23f64d 100644 --- a/aws/rust-runtime/aws-config/Cargo.lock +++ b/aws/rust-runtime/aws-config/Cargo.lock @@ -357,7 +357,7 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.10.0" +version = "1.9.3" dependencies = [ "aws-smithy-async", "aws-smithy-types", diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/Cargo.toml b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/Cargo.toml new file mode 100644 index 00000000000..19b93990623 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "aws-sdk-dynamodb-expressions" +version = "0.1.0" +authors = ["AWS Rust SDK Team "] +description = "Type-safe DynamoDB expression builders for condition, update, and projection expressions." +edition = "2021" +license = "Apache-2.0" +repository = "https://github.com/smithy-lang/smithy-rs" + +[dependencies] +aws-sdk-dynamodb = "1" + +[dev-dependencies] +tokio = { version = "1", features = ["rt", "macros"] } diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/LICENSE b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/LICENSE new file mode 100644 index 00000000000..67db8588217 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/README.md b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/README.md new file mode 100644 index 00000000000..4cddab6b482 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/README.md @@ -0,0 +1,9 @@ +# aws-sdk-dynamodb-expressions + +Type-safe DynamoDB expression builders for condition, update, and projection expressions. + +This crate can be used standalone with the low-level AWS SDK or as part of the DynamoDB Mapper library. + +## License + +This project is licensed under the Apache-2.0 License. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/src/lib.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/src/lib.rs new file mode 100644 index 00000000000..8bb2e86ff8f --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-expressions/src/lib.rs @@ -0,0 +1,12 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Type-safe DynamoDB expression builders. +//! +//! This crate provides builders for DynamoDB condition, update, and projection +//! expressions. It can be used standalone with the low-level AWS SDK or as part +//! of the DynamoDB Mapper library. + +#![warn(missing_docs)] diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/Cargo.toml b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/Cargo.toml new file mode 100644 index 00000000000..0aa2e51a11c --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "aws-sdk-dynamodb-mapper-core" +version = "0.1.0" +authors = ["AWS Rust SDK Team "] +description = "Core traits and types for the AWS SDK DynamoDB Mapper." +edition = "2021" +license = "Apache-2.0" +repository = "https://github.com/smithy-lang/smithy-rs" + +[dependencies] +aws-sdk-dynamodb = "1" +aws-smithy-types = "1" + +[dev-dependencies] +tokio = { version = "1", features = ["rt", "macros"] } diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/LICENSE b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/LICENSE new file mode 100644 index 00000000000..67db8588217 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/README.md b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/README.md new file mode 100644 index 00000000000..68a242abcd8 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/README.md @@ -0,0 +1,9 @@ +# aws-sdk-dynamodb-mapper-core + +Core traits and types for the AWS SDK DynamoDB Mapper. + +This crate provides the foundational traits (`AttributeValueConvert`, `ItemConverter`, `ItemSchema`, etc.) used by the DynamoDB Mapper library. + +## License + +This project is licensed under the Apache-2.0 License. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/convert.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/convert.rs new file mode 100644 index 00000000000..911e2eb7647 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/convert.rs @@ -0,0 +1,431 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! AttributeValueConvert implementations for standard Rust types. + +use aws_sdk_dynamodb::types::AttributeValue; +use std::collections::{HashMap, HashSet}; +use std::hash::Hash; + +use crate::error::ConversionError; +use crate::traits::AttributeValueConvert; + +// Helper to get type name from AttributeValue +fn attribute_type_name(av: &AttributeValue) -> &'static str { + match av { + AttributeValue::S(_) => "S", + AttributeValue::N(_) => "N", + AttributeValue::B(_) => "B", + AttributeValue::Ss(_) => "SS", + AttributeValue::Ns(_) => "NS", + AttributeValue::Bs(_) => "BS", + AttributeValue::M(_) => "M", + AttributeValue::L(_) => "L", + AttributeValue::Null(_) => "NULL", + AttributeValue::Bool(_) => "BOOL", + _ => "Unknown", + } +} + +// ============================================================================ +// Primitive types +// ============================================================================ + +impl AttributeValueConvert for String { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::S(self.clone())) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::S(s) => Ok(s), + other => Err(ConversionError::type_mismatch( + "S", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for i64 { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::N(self.to_string())) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::N(n) => n.parse().map_err(|_| { + ConversionError::invalid_value("", format!("cannot parse '{}' as i64", n)) + }), + other => Err(ConversionError::type_mismatch( + "N", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for f64 { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::N(self.to_string())) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::N(n) => n.parse().map_err(|_| { + ConversionError::invalid_value("", format!("cannot parse '{}' as f64", n)) + }), + other => Err(ConversionError::type_mismatch( + "N", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for bool { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::Bool(*self)) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::Bool(b) => Ok(b), + other => Err(ConversionError::type_mismatch( + "BOOL", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for Vec { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::B(aws_sdk_dynamodb::primitives::Blob::new( + self.clone(), + ))) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::B(b) => Ok(b.into_inner()), + other => Err(ConversionError::type_mismatch( + "B", + attribute_type_name(&other), + )), + } + } +} + +// ============================================================================ +// Collection types +// ============================================================================ + +impl AttributeValueConvert for Option { + fn to_attribute_value(&self) -> Result { + match self { + Some(v) => v.to_attribute_value(), + None => Ok(AttributeValue::Null(true)), + } + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::Null(true) => Ok(None), + other => T::from_attribute_value(other).map(Some), + } + } +} + +impl AttributeValueConvert for Vec { + fn to_attribute_value(&self) -> Result { + let items: Result, _> = self.iter().map(|v| v.to_attribute_value()).collect(); + Ok(AttributeValue::L(items?)) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::L(list) => list.into_iter().map(T::from_attribute_value).collect(), + other => Err(ConversionError::type_mismatch( + "L", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for HashMap +where + K: AttributeValueConvert + Eq + Hash + ToString + From, + V: AttributeValueConvert, +{ + fn to_attribute_value(&self) -> Result { + let mut map = HashMap::new(); + for (k, v) in self { + map.insert(k.to_string(), v.to_attribute_value()?); + } + Ok(AttributeValue::M(map)) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::M(m) => { + let mut result = HashMap::new(); + for (k, v) in m { + result.insert(K::from(k), V::from_attribute_value(v)?); + } + Ok(result) + } + other => Err(ConversionError::type_mismatch( + "M", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for HashSet { + fn to_attribute_value(&self) -> Result { + let items: Result, _> = self.iter().map(|v| v.to_attribute_value()).collect(); + Ok(AttributeValue::L(items?)) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::L(list) => list.into_iter().map(T::from_attribute_value).collect(), + other => Err(ConversionError::type_mismatch( + "L", + attribute_type_name(&other), + )), + } + } +} + +// ============================================================================ +// Tuple types (for multi-attribute keys, up to 4 elements) +// ============================================================================ + +impl AttributeValueConvert for (T1,) { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::L(vec![self.0.to_attribute_value()?])) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::L(mut list) if list.len() == 1 => { + Ok((T1::from_attribute_value(list.remove(0))?,)) + } + AttributeValue::L(list) => Err(ConversionError::invalid_value( + "", + format!("expected list of 1 element, got {}", list.len()), + )), + other => Err(ConversionError::type_mismatch( + "L", + attribute_type_name(&other), + )), + } + } +} + +impl AttributeValueConvert for (T1, T2) { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::L(vec![ + self.0.to_attribute_value()?, + self.1.to_attribute_value()?, + ])) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::L(mut list) if list.len() == 2 => { + let v2 = list.remove(1); + let v1 = list.remove(0); + Ok((T1::from_attribute_value(v1)?, T2::from_attribute_value(v2)?)) + } + AttributeValue::L(list) => Err(ConversionError::invalid_value( + "", + format!("expected list of 2 elements, got {}", list.len()), + )), + other => Err(ConversionError::type_mismatch( + "L", + attribute_type_name(&other), + )), + } + } +} + +impl + AttributeValueConvert for (T1, T2, T3) +{ + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::L(vec![ + self.0.to_attribute_value()?, + self.1.to_attribute_value()?, + self.2.to_attribute_value()?, + ])) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::L(mut list) if list.len() == 3 => { + let v3 = list.remove(2); + let v2 = list.remove(1); + let v1 = list.remove(0); + Ok(( + T1::from_attribute_value(v1)?, + T2::from_attribute_value(v2)?, + T3::from_attribute_value(v3)?, + )) + } + AttributeValue::L(list) => Err(ConversionError::invalid_value( + "", + format!("expected list of 3 elements, got {}", list.len()), + )), + other => Err(ConversionError::type_mismatch( + "L", + attribute_type_name(&other), + )), + } + } +} + +impl< + T1: AttributeValueConvert, + T2: AttributeValueConvert, + T3: AttributeValueConvert, + T4: AttributeValueConvert, + > AttributeValueConvert for (T1, T2, T3, T4) +{ + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::L(vec![ + self.0.to_attribute_value()?, + self.1.to_attribute_value()?, + self.2.to_attribute_value()?, + self.3.to_attribute_value()?, + ])) + } + + fn from_attribute_value(value: AttributeValue) -> Result { + match value { + AttributeValue::L(mut list) if list.len() == 4 => { + let v4 = list.remove(3); + let v3 = list.remove(2); + let v2 = list.remove(1); + let v1 = list.remove(0); + Ok(( + T1::from_attribute_value(v1)?, + T2::from_attribute_value(v2)?, + T3::from_attribute_value(v3)?, + T4::from_attribute_value(v4)?, + )) + } + AttributeValue::L(list) => Err(ConversionError::invalid_value( + "", + format!("expected list of 4 elements, got {}", list.len()), + )), + other => Err(ConversionError::type_mismatch( + "L", + attribute_type_name(&other), + )), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_string_roundtrip() { + let original = "hello".to_string(); + let av = original.to_attribute_value().unwrap(); + let recovered = String::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_i64_roundtrip() { + let original: i64 = -42; + let av = original.to_attribute_value().unwrap(); + let recovered = i64::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_f64_roundtrip() { + let original: f64 = 3.14159; + let av = original.to_attribute_value().unwrap(); + let recovered = f64::from_attribute_value(av).unwrap(); + assert!((original - recovered).abs() < f64::EPSILON); + } + + #[test] + fn test_bool_roundtrip() { + let av = true.to_attribute_value().unwrap(); + assert!(bool::from_attribute_value(av).unwrap()); + } + + #[test] + fn test_bytes_roundtrip() { + let original = vec![1u8, 2, 3, 4]; + let av = original.to_attribute_value().unwrap(); + let recovered = Vec::::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_option_some_roundtrip() { + let original: Option = Some("test".to_string()); + let av = original.to_attribute_value().unwrap(); + let recovered = Option::::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_option_none_roundtrip() { + let original: Option = None; + let av = original.to_attribute_value().unwrap(); + let recovered = Option::::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_vec_roundtrip() { + let original = vec!["a".to_string(), "b".to_string()]; + let av = original.to_attribute_value().unwrap(); + let recovered = Vec::::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_tuple2_roundtrip() { + let original = ("pk".to_string(), 42i64); + let av = original.to_attribute_value().unwrap(); + let recovered = <(String, i64)>::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_tuple4_roundtrip() { + let original = ( + "a".to_string(), + "b".to_string(), + "c".to_string(), + "d".to_string(), + ); + let av = original.to_attribute_value().unwrap(); + let recovered = <(String, String, String, String)>::from_attribute_value(av).unwrap(); + assert_eq!(original, recovered); + } + + #[test] + fn test_type_mismatch_error() { + let av = AttributeValue::N("42".to_string()); + let result = String::from_attribute_value(av); + assert!(result.is_err()); + let err = result.unwrap_err(); + assert!(err.to_string().contains("expected S")); + } +} diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/error.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/error.rs new file mode 100644 index 00000000000..66f598ecf1b --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/error.rs @@ -0,0 +1,118 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Error types for type conversion operations. + +use std::fmt; + +/// Error that occurs during type conversion between Rust types and DynamoDB AttributeValues. +#[derive(Debug)] +pub struct ConversionError { + kind: ConversionErrorKind, + field: Option, +} + +// TODO(hll): revisit pub error type + +/// The kind of conversion error that occurred. +#[derive(Debug)] +#[non_exhaustive] +pub enum ConversionErrorKind { + /// A required attribute was missing from the item. + MissingAttribute, + /// The attribute value had an unexpected type. + InvalidType { + /// The expected DynamoDB type. + expected: &'static str, + /// The actual DynamoDB type found. + actual: &'static str, + }, + /// The attribute value could not be parsed or was invalid. + InvalidValue { + /// Description of why the value was invalid. + message: String, + }, +} + +impl ConversionError { + /// Creates an error for a missing attribute. + pub fn missing_attribute(field: impl Into) -> Self { + Self { + kind: ConversionErrorKind::MissingAttribute, + field: Some(field.into()), + } + } + + /// Creates an error for an invalid type. + pub fn invalid_type( + field: impl Into, + expected: &'static str, + actual: &'static str, + ) -> Self { + Self { + kind: ConversionErrorKind::InvalidType { expected, actual }, + field: Some(field.into()), + } + } + + /// Creates an error for an invalid value. + pub fn invalid_value(field: impl Into, message: impl Into) -> Self { + Self { + kind: ConversionErrorKind::InvalidValue { + message: message.into(), + }, + field: Some(field.into()), + } + } + + /// Creates a type error without a field name (for standalone conversions). + pub fn type_mismatch(expected: &'static str, actual: &'static str) -> Self { + Self { + kind: ConversionErrorKind::InvalidType { expected, actual }, + field: None, + } + } + + /// Returns the kind of error. + pub fn kind(&self) -> &ConversionErrorKind { + &self.kind + } + + /// Returns the field name if available. + pub fn field(&self) -> Option<&str> { + self.field.as_deref() + } +} + +impl fmt::Display for ConversionError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match (&self.kind, &self.field) { + (ConversionErrorKind::MissingAttribute, Some(field)) => { + write!(f, "missing required attribute '{}'", field) + } + (ConversionErrorKind::MissingAttribute, None) => { + write!(f, "missing required attribute") + } + (ConversionErrorKind::InvalidType { expected, actual }, Some(field)) => { + write!( + f, + "invalid type for '{}': expected {}, got {}", + field, expected, actual + ) + } + (ConversionErrorKind::InvalidType { expected, actual }, None) => { + write!(f, "invalid type: expected {}, got {}", expected, actual) + } + (ConversionErrorKind::InvalidValue { message }, Some(field)) => { + write!(f, "invalid value for '{}': {}", field, message) + } + (ConversionErrorKind::InvalidValue { message }, None) => { + write!(f, "invalid value: {}", message) + } + } + } +} + +impl std::error::Error for ConversionError {} diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/key.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/key.rs new file mode 100644 index 00000000000..209a7f731e6 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/key.rs @@ -0,0 +1,175 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Key specification types for DynamoDB operations. + +use aws_sdk_dynamodb::types::AttributeValue; +use std::collections::HashMap; + +use crate::error::ConversionError; +use crate::traits::AttributeValueConvert; + +/// Represents a complete DynamoDB key specification with attribute names and values. +#[derive(Debug, Clone)] +pub struct KeySpec { + partition_keys: Vec<(String, AttributeValue)>, + sort_keys: Option>, +} + +impl KeySpec { + /// Creates a new KeySpec for a partition-key-only table. + pub fn partition_only( + pk_names: &[&str], + pk_value: PK, + ) -> Result { + let av = pk_value.to_attribute_value()?; + let partition_keys = Self::expand_key(pk_names, av)?; + Ok(Self { + partition_keys, + sort_keys: None, + }) + } + + /// Creates a new KeySpec for a composite-key table. + pub fn composite( + pk_names: &[&str], + pk_value: PK, + sk_names: &[&str], + sk_value: SK, + ) -> Result { + let pk_av = pk_value.to_attribute_value()?; + let sk_av = sk_value.to_attribute_value()?; + + let partition_keys = Self::expand_key(pk_names, pk_av)?; + let sort_keys = Some(Self::expand_key(sk_names, sk_av)?); + + Ok(Self { + partition_keys, + sort_keys, + }) + } + + /// Creates a KeySpec from an object implementing ExtractKey. + pub fn from_extract_key( + item: &T, + pk_names: &[&str], + sk_names: Option<&[&str]>, + ) -> Result + where + T: crate::traits::ExtractKey, + { + let pk_av = item.extract_partition_key().to_attribute_value()?; + let partition_keys = Self::expand_key(pk_names, pk_av)?; + + let sort_keys = match (sk_names, item.extract_sort_key()) { + (Some(names), Some(sk)) => Some(Self::expand_key(names, sk.to_attribute_value()?)?), + _ => None, + }; + + Ok(Self { + partition_keys, + sort_keys, + }) + } + + /// Converts this KeySpec to a HashMap suitable for DynamoDB API calls. + pub fn to_key_map(&self) -> HashMap { + let mut map = HashMap::new(); + for (name, value) in &self.partition_keys { + map.insert(name.clone(), value.clone()); + } + if let Some(ref sk) = self.sort_keys { + for (name, value) in sk { + map.insert(name.clone(), value.clone()); + } + } + map + } + + // Expands a single AttributeValue into multiple name/value pairs for multi-attribute keys + fn expand_key( + names: &[&str], + value: AttributeValue, + ) -> Result, ConversionError> { + if names.len() == 1 { + // Single-attribute key + return Ok(vec![(names[0].to_string(), value)]); + } + + // Multi-attribute key: value should be a list + match value { + AttributeValue::L(list) if list.len() == names.len() => Ok(names + .iter() + .zip(list) + .map(|(name, av)| (name.to_string(), av)) + .collect()), + AttributeValue::L(list) => Err(ConversionError::invalid_value( + "", + format!( + "key has {} attributes but value has {} elements", + names.len(), + list.len() + ), + )), + // Single value for single-attribute key + _ if names.len() == 1 => Ok(vec![(names[0].to_string(), value)]), + _ => Err(ConversionError::invalid_value( + "", + format!( + "expected list for multi-attribute key with {} attributes", + names.len() + ), + )), + } + } +} + +/// Helper trait for creating KeySpec from partition-key-only tables. +impl KeySpec { + /// Creates a KeySpec for NoSortKey tables (partition-key-only). + pub fn partition_only_no_sort( + pk_names: &[&str], + pk_value: PK, + ) -> Result { + Self::partition_only(pk_names, pk_value) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_single_partition_key() { + let spec = KeySpec::partition_only(&["id"], "user123".to_string()).unwrap(); + let map = spec.to_key_map(); + assert_eq!(map.len(), 1); + assert!(matches!(map.get("id"), Some(AttributeValue::S(s)) if s == "user123")); + } + + #[test] + fn test_composite_key() { + let spec = KeySpec::composite(&["pk"], "user123".to_string(), &["sk"], 42i64).unwrap(); + let map = spec.to_key_map(); + assert_eq!(map.len(), 2); + assert!(matches!(map.get("pk"), Some(AttributeValue::S(s)) if s == "user123")); + assert!(matches!(map.get("sk"), Some(AttributeValue::N(n)) if n == "42")); + } + + #[test] + fn test_multi_attribute_partition_key() { + let spec = KeySpec::partition_only( + &["tournament_id", "region"], + ("WINTER2024".to_string(), "NA-EAST".to_string()), + ) + .unwrap(); + let map = spec.to_key_map(); + assert_eq!(map.len(), 2); + assert!( + matches!(map.get("tournament_id"), Some(AttributeValue::S(s)) if s == "WINTER2024") + ); + assert!(matches!(map.get("region"), Some(AttributeValue::S(s)) if s == "NA-EAST")); + } +} diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/lib.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/lib.rs new file mode 100644 index 00000000000..c05ba99882f --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/lib.rs @@ -0,0 +1,49 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Core traits and types for the AWS SDK DynamoDB Mapper. +//! +//! This crate provides the foundational traits used by the DynamoDB Mapper library: +//! +//! - [`AttributeValueConvert`] - Convert individual values to/from DynamoDB AttributeValues +//! - [`ItemConverter`] - Convert complete structs to/from DynamoDB items +//! - [`ItemSchema`] - Define key structure for tables and indexes +//! - [`ProvideItemSchema`] - Link types to their schema implementations +//! - [`ExtractKey`] - Efficiently extract keys from objects +//! +//! # Example +//! +//! ```ignore +//! use aws_sdk_dynamodb_mapper_core::{ +//! AttributeValueConvert, ItemConverter, ItemSchema, ProvideItemSchema, NoSortKey, +//! }; +//! +//! struct User { +//! id: String, +//! name: String, +//! } +//! +//! struct UserSchema; +//! +//! impl ItemSchema for UserSchema { +//! type PartitionKey = String; +//! type SortKey = NoSortKey; +//! +//! fn partition_key_names(&self) -> &'static [&'static str] { &["id"] } +//! fn sort_key_names(&self) -> Option<&'static [&'static str]> { None } +//! } +//! ``` + +#![warn(missing_docs)] + +mod convert; +pub mod error; +pub(crate) mod key; +mod traits; + +pub use error::{ConversionError, ConversionErrorKind}; +pub use traits::{ + AttributeValueConvert, ExtractKey, ItemConverter, ItemSchema, NoSortKey, ProvideItemSchema, +}; diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/traits.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/traits.rs new file mode 100644 index 00000000000..01a00c77440 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-core/src/traits.rs @@ -0,0 +1,102 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Core traits for the DynamoDB Mapper. + +use aws_sdk_dynamodb::types::AttributeValue; +use std::collections::HashMap; + +use crate::error::ConversionError; + +/// Converts individual Rust values to/from DynamoDB AttributeValues. +/// +/// This trait handles conversion of single values like `String`, `i64`, `Vec`, etc. +/// For converting complete structs to/from DynamoDB items, see [`ItemConverter`]. +pub trait AttributeValueConvert: Clone + Send + Sync + 'static { + /// Converts this value to a DynamoDB AttributeValue. + fn to_attribute_value(&self) -> Result; + + /// Constructs a value from a DynamoDB AttributeValue. + fn from_attribute_value(value: AttributeValue) -> Result; +} + +/// Converts complete Rust structs to/from DynamoDB items. +/// +/// A DynamoDB item is represented as `HashMap` where +/// keys are attribute names and values are the serialized field values. +pub trait ItemConverter { + /// Converts this object to a DynamoDB item. + fn to_item(&self) -> HashMap; + + /// Constructs an object from a DynamoDB item. + fn from_item(item: HashMap) -> Result; +} + +/// Defines the DynamoDB key structure for a table or index. +/// +/// This trait provides metadata about partition and sort keys, including +/// their Rust types and DynamoDB attribute names. +pub trait ItemSchema { + /// Partition key type - single type or tuple for multi-attribute keys. + type PartitionKey: AttributeValueConvert; + + /// Sort key type - [`NoSortKey`] for partition-only tables, single type, + /// or tuple for multi-attribute sort keys. + type SortKey: AttributeValueConvert; + + /// Returns partition key attribute names in order. + fn partition_key_names(&self) -> &'static [&'static str]; + + /// Returns sort key attribute names in order, or `None` for partition-only tables. + fn sort_key_names(&self) -> Option<&'static [&'static str]>; +} + +/// Links a Rust type to its DynamoDB schema implementation. +/// +/// This trait is the entry point for schema discovery. The mapper uses this +/// to obtain schema metadata (key structure, attribute names) for any type. +pub trait ProvideItemSchema: Sized { + /// The schema type that provides metadata for this item type. + type Schema: ItemSchema; + + /// Returns the schema instance for this type. + fn schema() -> Self::Schema; +} + +/// Extracts key values from an object without full item conversion. +/// +/// This trait enables efficient key-only operations by extracting just the +/// partition and sort key values. Unlike [`ItemConverter::to_item`], this +/// avoids serializing non-key fields. +pub trait ExtractKey { + /// The partition key type (must match the schema's partition key type). + type PartitionKey: AttributeValueConvert; + + /// The sort key type (must match the schema's sort key type). + type SortKey: AttributeValueConvert; + + /// Extracts the partition key value from this object. + fn extract_partition_key(&self) -> Self::PartitionKey; + + /// Extracts the sort key value from this object. + /// Returns `None` for partition-only tables. + fn extract_sort_key(&self) -> Option { + None + } +} + +/// Marker type for tables without a sort key. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub struct NoSortKey; + +impl AttributeValueConvert for NoSortKey { + fn to_attribute_value(&self) -> Result { + Ok(AttributeValue::Null(true)) + } + + fn from_attribute_value(_value: AttributeValue) -> Result { + Ok(NoSortKey) + } +} diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/Cargo.toml b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/Cargo.toml new file mode 100644 index 00000000000..f50264f4a4b --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "aws-sdk-dynamodb-mapper-macros" +version = "0.1.0" +authors = ["AWS Rust SDK Team "] +description = "Derive macros for the AWS SDK DynamoDB Mapper." +edition = "2021" +license = "Apache-2.0" +repository = "https://github.com/smithy-lang/smithy-rs" + +[lib] +proc-macro = true + +[dependencies] +proc-macro2 = "1" +quote = "1" +syn = { version = "2", features = ["full"] } diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/LICENSE b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/LICENSE new file mode 100644 index 00000000000..67db8588217 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/README.md b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/README.md new file mode 100644 index 00000000000..df5ba1c4706 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/README.md @@ -0,0 +1,9 @@ +# aws-sdk-dynamodb-mapper-macros + +Derive macros for the AWS SDK DynamoDB Mapper. + +Provides `DdbItem` and `AttributeValueConvert` derive macros for generating DynamoDB schema and conversion implementations. + +## License + +This project is licensed under the Apache-2.0 License. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/src/lib.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/src/lib.rs new file mode 100644 index 00000000000..5f440f8b315 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper-macros/src/lib.rs @@ -0,0 +1,11 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Derive macros for the AWS SDK DynamoDB Mapper. +//! +//! This crate provides the `DdbItem` and `AttributeValueConvert` derive macros +//! for generating DynamoDB schema and conversion implementations. + +#![warn(missing_docs)] diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/Cargo.toml b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/Cargo.toml new file mode 100644 index 00000000000..462869c218d --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "aws-sdk-dynamodb-mapper" +version = "0.1.0" +authors = ["AWS Rust SDK Team "] +description = "High-level DynamoDB mapper for the AWS SDK for Rust." +edition = "2021" +license = "Apache-2.0" +repository = "https://github.com/smithy-lang/smithy-rs" + +[dependencies] +aws-sdk-dynamodb = "1" +aws-sdk-dynamodb-mapper-core = { path = "../aws-sdk-dynamodb-mapper-core" } +aws-sdk-dynamodb-mapper-macros = { path = "../aws-sdk-dynamodb-mapper-macros" } +aws-sdk-dynamodb-expressions = { path = "../aws-sdk-dynamodb-expressions" } + +[dev-dependencies] +tokio = { version = "1", features = ["rt", "macros"] } diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/LICENSE b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/LICENSE new file mode 100644 index 00000000000..67db8588217 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/README.md b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/README.md new file mode 100644 index 00000000000..1d2f3148b84 --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/README.md @@ -0,0 +1,9 @@ +# aws-sdk-dynamodb-mapper + +High-level DynamoDB mapper for the AWS SDK for Rust. + +This crate provides a type-safe, ergonomic interface for working with DynamoDB tables. + +## License + +This project is licensed under the Apache-2.0 License. diff --git a/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/src/lib.rs b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/src/lib.rs new file mode 100644 index 00000000000..a3b673c425b --- /dev/null +++ b/aws/rust-runtime/dynamodb-mapper/aws-sdk-dynamodb-mapper/src/lib.rs @@ -0,0 +1,34 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//! High-level DynamoDB mapper for the AWS SDK for Rust. +//! +//! This crate provides a type-safe, ergonomic interface for working with +//! DynamoDB tables. It supports derive macros for automatic schema generation, +//! type-safe expressions, and efficient operations. +//! +//! # Example +//! +//! ```ignore +//! use aws_sdk_dynamodb_mapper::DdbItem; +//! +//! #[derive(DdbItem)] +//! struct User { +//! #[partition_key] +//! id: String, +//! name: String, +//! email: String, +//! } +//! ``` + +#![warn(missing_docs)] + +pub use aws_sdk_dynamodb_mapper_core::*; +pub use aws_sdk_dynamodb_mapper_macros::*; + +/// Expression builders for DynamoDB condition, update, and projection expressions. +pub mod expressions { + pub use aws_sdk_dynamodb_expressions::*; +} diff --git a/rust-runtime/Cargo.lock b/rust-runtime/Cargo.lock index 724e2f8f85d..387a70d0fa0 100644 --- a/rust-runtime/Cargo.lock +++ b/rust-runtime/Cargo.lock @@ -419,7 +419,7 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" -version = "1.1.5" +version = "1.1.6" dependencies = [ "aws-smithy-async", "aws-smithy-protocol-test",