diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index bc37fcab3e3576e328a7fbe9db89cc74f873278a..d5b5e89a529383a421607bb4ccf7e461ac0429ed 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -275,3 +275,10 @@ message = "Smithy members named `send` were previously renamed to `send_value` a references = ["smithy-rs#2382"] meta = { "breaking" = true, "tada" = false, "bug" = true, "target" = "server" } author = "jdisanti" + +[[aws-sdk-rust]] +message = "The modules in the SDK crates have been reorganized. See the [SDK Crate Reorganization Upgrade Guidance](https://github.com/awslabs/aws-sdk-rust/discussions/752) to see how to fix your code after this change." +references = ["smithy-rs#2433"] +meta = { "breaking" = true, "tada" = false, "bug" = false } +author = "jdisanti" + diff --git a/aws/rust-runtime/aws-config/external-types.toml b/aws/rust-runtime/aws-config/external-types.toml index 6935fe9bc0e685c17fc59f8c2685550ce2d924e2..7e0257f46d49770082a1fd9efadf78acd5debc96 100644 --- a/aws/rust-runtime/aws-config/external-types.toml +++ b/aws/rust-runtime/aws-config/external-types.toml @@ -7,7 +7,7 @@ allowed_external_types = [ "aws_credential_types::provider::ProvideCredentials", "aws_credential_types::provider::Result", "aws_credential_types::provider::SharedCredentialsProvider", - "aws_sdk_sts::model::PolicyDescriptorType", + "aws_sdk_sts::types::_policy_descriptor_type::PolicyDescriptorType", "aws_smithy_async::rt::sleep::AsyncSleep", "aws_smithy_client::bounds::SmithyConnector", "aws_smithy_client::erase::DynConnector", diff --git a/aws/rust-runtime/aws-config/src/imds/region.rs b/aws/rust-runtime/aws-config/src/imds/region.rs index 8679e3e753bb136877ff5bea6b313e0bdb0d35f4..bc784f8d4f10c1080be7b974e106139fc615305b 100644 --- a/aws/rust-runtime/aws-config/src/imds/region.rs +++ b/aws/rust-runtime/aws-config/src/imds/region.rs @@ -117,7 +117,7 @@ mod test { use crate::imds::client::test::{imds_request, imds_response, token_request, token_response}; use crate::imds::region::ImdsRegionProvider; use crate::provider_config::ProviderConfig; - use aws_sdk_sts::Region; + use aws_sdk_sts::config::Region; use aws_smithy_async::rt::sleep::TokioSleep; use aws_smithy_client::erase::DynConnector; use aws_smithy_client::test_connection::TestConnection; diff --git a/aws/rust-runtime/aws-config/src/profile/app_name.rs b/aws/rust-runtime/aws-config/src/profile/app_name.rs index a49fefc8b45f918e0fbb12a9b860749d22b51b94..80a5f192ca5bfa2b21996e709a5642c3711c5d70 100644 --- a/aws/rust-runtime/aws-config/src/profile/app_name.rs +++ b/aws/rust-runtime/aws-config/src/profile/app_name.rs @@ -103,7 +103,7 @@ mod tests { use super::ProfileFileAppNameProvider; use crate::provider_config::ProviderConfig; use crate::test_case::no_traffic_connector; - use aws_sdk_sts::AppName; + use aws_sdk_sts::config::AppName; use aws_types::os_shim_internal::{Env, Fs}; use tracing_test::traced_test; diff --git a/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs b/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs index f930b1a8d8f26bd5f44e2f5091fd1c6ab12f313b..fda62d7708eed33c2ad9481fcd72f0ad25f5f014 100644 --- a/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs +++ b/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs @@ -11,9 +11,9 @@ use crate::sso::{SsoConfig, SsoCredentialsProvider}; use crate::sts; use crate::web_identity_token::{StaticConfiguration, WebIdentityTokenCredentialsProvider}; use aws_credential_types::provider::{self, error::CredentialsError, ProvideCredentials}; -use aws_sdk_sts::input::AssumeRoleInput; use aws_sdk_sts::middleware::DefaultMiddleware; -use aws_sdk_sts::{Config, Credentials}; +use aws_sdk_sts::operation::assume_role::AssumeRoleInput; +use aws_sdk_sts::{config::Credentials, Config}; use aws_smithy_client::erase::DynConnector; use aws_types::region::Region; use std::fmt::Debug; diff --git a/aws/rust-runtime/aws-config/src/profile/region.rs b/aws/rust-runtime/aws-config/src/profile/region.rs index c58fce403961e4598d4bd93651237dbf376e4493..3cdcf8f7e4fd022866f7a0bab7ab952154ca7995 100644 --- a/aws/rust-runtime/aws-config/src/profile/region.rs +++ b/aws/rust-runtime/aws-config/src/profile/region.rs @@ -158,7 +158,7 @@ mod test { use crate::profile::ProfileFileRegionProvider; use crate::provider_config::ProviderConfig; use crate::test_case::no_traffic_connector; - use aws_sdk_sts::Region; + use aws_sdk_sts::config::Region; use aws_types::os_shim_internal::{Env, Fs}; use futures_util::FutureExt; use tracing_test::traced_test; diff --git a/aws/rust-runtime/aws-config/src/provider_config.rs b/aws/rust-runtime/aws-config/src/provider_config.rs index 9ca283d25fd3d59c192ef203292eab2951546e29..cb4bd5aa1710e27ddeda6c256aba7baa09d26334 100644 --- a/aws/rust-runtime/aws-config/src/provider_config.rs +++ b/aws/rust-runtime/aws-config/src/provider_config.rs @@ -124,7 +124,7 @@ impl ProviderConfig { /// # #[cfg(any(feature = "rustls", feature = "native-tls"))] /// # fn example() { /// use aws_config::provider_config::ProviderConfig; - /// use aws_sdk_sts::Region; + /// use aws_sdk_sts::config::Region; /// use aws_config::web_identity_token::WebIdentityTokenCredentialsProvider; /// let conf = ProviderConfig::without_region().with_region(Some(Region::new("us-east-1"))); /// @@ -156,7 +156,7 @@ impl ProviderConfig { /// ```no_run /// # async fn test() { /// use aws_config::provider_config::ProviderConfig; - /// use aws_sdk_sts::Region; + /// use aws_sdk_sts::config::Region; /// use aws_config::web_identity_token::WebIdentityTokenCredentialsProvider; /// let conf = ProviderConfig::with_default_region().await; /// let credential_provider = WebIdentityTokenCredentialsProvider::builder().configure(&conf).build(); diff --git a/aws/rust-runtime/aws-config/src/sso.rs b/aws/rust-runtime/aws-config/src/sso.rs index 3881a217ab96e0c57b10ea2af805812fb83e718e..7c693bdf2ef79f5bfeb24980d72f1df0437356fe 100644 --- a/aws/rust-runtime/aws-config/src/sso.rs +++ b/aws/rust-runtime/aws-config/src/sso.rs @@ -17,7 +17,8 @@ use crate::provider_config::ProviderConfig; use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials}; use aws_credential_types::Credentials; use aws_sdk_sso::middleware::DefaultMiddleware as SsoMiddleware; -use aws_sdk_sso::model::RoleCredentials; +use aws_sdk_sso::operation::get_role_credentials::GetRoleCredentialsInput; +use aws_sdk_sso::types::RoleCredentials; use aws_smithy_client::erase::DynConnector; use aws_smithy_json::deserialize::Token; use aws_smithy_types::date_time::Format; @@ -211,7 +212,7 @@ async fn load_sso_credentials( let config = aws_sdk_sso::Config::builder() .region(sso_config.region.clone()) .build(); - let operation = aws_sdk_sso::input::GetRoleCredentialsInput::builder() + let operation = GetRoleCredentialsInput::builder() .role_name(&sso_config.role_name) .access_token(&*token.access_token) .account_id(&sso_config.account_id) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index ad24b11bb5680efdc13e4859ec4d61e5a6368651..35f2b3fa27b5e686dad52c85d5cb4b587bf300dc 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -8,10 +8,9 @@ use crate::provider_config::ProviderConfig; use aws_credential_types::cache::CredentialsCache; use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials}; -use aws_sdk_sts::error::AssumeRoleError; -use aws_sdk_sts::input::AssumeRoleInput; use aws_sdk_sts::middleware::DefaultMiddleware; -use aws_sdk_sts::model::PolicyDescriptorType; +use aws_sdk_sts::operation::assume_role::{AssumeRoleError, AssumeRoleInput}; +use aws_sdk_sts::types::PolicyDescriptorType; use aws_smithy_client::erase::DynConnector; use aws_smithy_http::result::SdkError; use aws_smithy_types::error::display::DisplayErrorContext; @@ -49,7 +48,7 @@ pub struct AssumeRoleProvider { struct Inner { sts: aws_smithy_client::Client, conf: aws_sdk_sts::Config, - op: aws_sdk_sts::input::AssumeRoleInput, + op: AssumeRoleInput, } impl AssumeRoleProvider { @@ -128,7 +127,7 @@ impl AssumeRoleProviderBuilder { /// /// This parameter is optional /// For more information, see - /// [policy](aws_sdk_sts::input::assume_role_input::Builder::policy_arns) + /// [policy](aws_sdk_sts::operation::assume_role::builders::AssumeRoleInputBuilder::policy_arns) pub fn policy(mut self, policy: impl Into) -> Self { self.policy = Some(policy.into()); self @@ -138,7 +137,7 @@ impl AssumeRoleProviderBuilder { /// /// This parameter is optional. /// For more information, see - /// [policy_arns](aws_sdk_sts::input::assume_role_input::Builder::policy_arns) + /// [policy_arns](aws_sdk_sts::operation::assume_role::builders::AssumeRoleInputBuilder::policy_arns) pub fn policy_arns(mut self, policy_arns: Vec) -> Self { self.policy_arns = Some(policy_arns); self @@ -155,7 +154,7 @@ impl AssumeRoleProviderBuilder { /// but your administrator set the maximum session duration to 6 hours, you cannot assume the role. /// /// For more information, see - /// [duration_seconds](aws_sdk_sts::input::assume_role_input::Builder::duration_seconds) + /// [duration_seconds](aws_sdk_sts::operation::assume_role::builders::AssumeRoleInputBuilder::duration_seconds) pub fn session_length(mut self, length: Duration) -> Self { self.session_length = Some(length); self diff --git a/aws/rust-runtime/aws-config/src/sts/util.rs b/aws/rust-runtime/aws-config/src/sts/util.rs index 9ebdbe6f160aedc92dd69671a3896a1f5be74d7e..426d3eb40aecbb8f1a4c37594a8e911d2447d452 100644 --- a/aws/rust-runtime/aws-config/src/sts/util.rs +++ b/aws/rust-runtime/aws-config/src/sts/util.rs @@ -5,7 +5,7 @@ use aws_credential_types::provider::{self, error::CredentialsError}; use aws_credential_types::Credentials as AwsCredentials; -use aws_sdk_sts::model::Credentials as StsCredentials; +use aws_sdk_sts::types::Credentials as StsCredentials; use std::convert::TryFrom; use std::time::{SystemTime, UNIX_EPOCH}; diff --git a/aws/rust-runtime/aws-config/src/web_identity_token.rs b/aws/rust-runtime/aws-config/src/web_identity_token.rs index 82c184897fbd02124d64170a78e0bc536a8c95ed..dd13524b0621a0e729968ac9b70f702a24a93795 100644 --- a/aws/rust-runtime/aws-config/src/web_identity_token.rs +++ b/aws/rust-runtime/aws-config/src/web_identity_token.rs @@ -64,8 +64,9 @@ use crate::provider_config::ProviderConfig; use crate::sts; use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials}; +use aws_sdk_sts::config::Region; use aws_sdk_sts::middleware::DefaultMiddleware; -use aws_sdk_sts::Region; +use aws_sdk_sts::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityInput; use aws_smithy_client::erase::DynConnector; use aws_smithy_types::error::display::DisplayErrorContext; use aws_types::os_shim_internal::{Env, Fs}; @@ -236,7 +237,7 @@ async fn load_credentials( .region(region.clone()) .build(); - let operation = aws_sdk_sts::input::AssumeRoleWithWebIdentityInput::builder() + let operation = AssumeRoleWithWebIdentityInput::builder() .role_arn(role_arn) .role_session_name(session_name) .web_identity_token(token) @@ -260,7 +261,7 @@ mod test { Builder, ENV_VAR_ROLE_ARN, ENV_VAR_SESSION_NAME, ENV_VAR_TOKEN_FILE, }; use aws_credential_types::provider::error::CredentialsError; - use aws_sdk_sts::Region; + use aws_sdk_sts::config::Region; use aws_smithy_async::rt::sleep::TokioSleep; use aws_smithy_types::error::display::DisplayErrorContext; use aws_types::os_shim_internal::{Env, Fs}; diff --git a/aws/sdk-adhoc-test/build.gradle.kts b/aws/sdk-adhoc-test/build.gradle.kts index 41fcbdc885aa5d42f727ac3919d195d19f0bc3c4..c127b3ff9f727c70527fcd5af905a534ea884cf0 100644 --- a/aws/sdk-adhoc-test/build.gradle.kts +++ b/aws/sdk-adhoc-test/build.gradle.kts @@ -45,7 +45,8 @@ val allCodegenTests = listOf( extraConfig = """ , "codegen": { - "includeFluentClient": false + "includeFluentClient": false, + "enableNewCrateOrganizationScheme": true }, "customizationConfig": { "awsSdk": { @@ -61,7 +62,8 @@ val allCodegenTests = listOf( extraConfig = """ , "codegen": { - "includeFluentClient": false + "includeFluentClient": false, + "enableNewCrateOrganizationScheme": true }, "customizationConfig": { "awsSdk": { diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCrateDocsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCrateDocsDecorator.kt index ee95163efa645650681b0989e22c1fd9086d3728..a810b3e8a5bc1df70b221895a36ed4e2244bda58 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCrateDocsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCrateDocsDecorator.kt @@ -72,17 +72,14 @@ class AwsCrateDocsDecorator : ClientCodegenDecorator { } } - override fun clientConstructionDocs(codegenContext: ClientCodegenContext, baseDocs: Writable): Writable { - return if (generateReadme(codegenContext)) { - writable { - val serviceName = codegenContext.serviceShape.serviceNameOrDefault("the service") - docs("Client for calling $serviceName.") + override fun clientConstructionDocs(codegenContext: ClientCodegenContext, baseDocs: Writable): Writable = + writable { + val serviceName = codegenContext.serviceShape.serviceNameOrDefault("the service") + docs("Client for calling $serviceName.") + if (generateReadme(codegenContext)) { AwsDocs.clientConstructionDocs(codegenContext)(this) } - } else { - baseDocs } - } private fun generateReadme(codegenContext: ClientCodegenContext) = SdkSettings.from(codegenContext.settings).generateReadme diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/endpoints/AwsEndpointDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/endpoints/AwsEndpointDecorator.kt index 94013f1b8f44b5d84521a40298005bf9818e7df5..41c8d29bdfbdbf200a6993b52aafc8ffb3147001 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/endpoints/AwsEndpointDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/endpoints/AwsEndpointDecorator.kt @@ -168,11 +168,9 @@ class AwsEndpointDecorator : ClientCodegenDecorator { /// ## Examples /// ```no_run /// ## fn wrapper() -> Result<(), aws_smithy_http::endpoint::error::InvalidEndpointError> { - /// use #{aws_types}::region::Region; - /// use $moduleUseName::config::{Builder, Config}; - /// use $moduleUseName::Endpoint; + /// use $moduleUseName::config::{Config, Endpoint, Region}; /// - /// let config = $moduleUseName::Config::builder() + /// let config = Config::builder() /// .endpoint_resolver(Endpoint::immutable("http://localhost:8080")?) /// .build(); /// ## Ok(()) diff --git a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt index d0a619b46798749526fbfa6f09ccb1c70308c5f2..f24dd88408ad1a10948b97eb8c41e2aa173764fa 100644 --- a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt +++ b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/TestUtil.kt @@ -49,11 +49,18 @@ fun awsSdkIntegrationTest( .withMember( "awsSdk", ObjectNode.builder() + .withMember("generateReadme", false) .withMember("integrationTestPath", "../sdk/integration-tests") .build(), ).build(), ) - .withMember("codegen", ObjectNode.builder().withMember("includeFluentClient", false).build()).build(), + .withMember( + "codegen", + ObjectNode.builder() + .withMember("includeFluentClient", false) + .withMember("enableNewCrateOrganizationScheme", true) + .build(), + ).build(), ), test = test, ) diff --git a/aws/sdk/build.gradle.kts b/aws/sdk/build.gradle.kts index 3147877704864b2a07878c9e3f6c7a42483f50ea..936740ac19c1b884cb6fea5d76bd42397ea5f576 100644 --- a/aws/sdk/build.gradle.kts +++ b/aws/sdk/build.gradle.kts @@ -100,7 +100,7 @@ fun generateSmithyBuild(services: AwsServices): String { "includeFluentClient": false, "renameErrors": false, "eventStreamAllowList": [$eventStreamAllowListMembers], - "enableNewCrateOrganizationScheme": false + "enableNewCrateOrganizationScheme": true }, "service": "${service.service}", "module": "$moduleName", diff --git a/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs b/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs index bea625d81f1b0231110105e3adc069a968f08a4b..faf7eba2eca8713fe06f21f937dedae0713cdfde 100644 --- a/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs +++ b/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_dynamodb::operation::Query; +use aws_sdk_dynamodb::operation::query::Query; use aws_smithy_http::response::ParseHttpResponse; use bytes::Bytes; use criterion::{criterion_group, criterion_main, Criterion}; diff --git a/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs b/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs index 694c7f7918e867877ebde836bee0b20de281fdb8..82e37cfe8bf38150b758b4034e85ecf5fca34c9f 100644 --- a/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs +++ b/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_dynamodb::input::PutItemInput; -use aws_sdk_dynamodb::model::AttributeValue; +use aws_sdk_dynamodb::operation::put_item::PutItemInput; +use aws_sdk_dynamodb::types::AttributeValue; use aws_sdk_dynamodb::Config; use criterion::{criterion_group, criterion_main, Criterion}; use futures_util::FutureExt; diff --git a/aws/sdk/integration-tests/dynamodb/tests/endpoints.rs b/aws/sdk/integration-tests/dynamodb/tests/endpoints.rs index 4d3dedd71e7a5a97aea089aeebb28d9e4d109379..6a01fedefd2f2e567a02d45bc1c93bcb2601c367 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/endpoints.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/endpoints.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_dynamodb::{config, Credentials, Region}; +use aws_sdk_dynamodb::config::{self, Credentials, Region}; use aws_types::SdkConfig; use http::Uri; diff --git a/aws/sdk/integration-tests/dynamodb/tests/movies.rs b/aws/sdk/integration-tests/dynamodb/tests/movies.rs index 918dc9c1ba05ee53bd70300a98eafe6925cc61e4..a3eaa244ad8ce16849565faa8dd7cf579f316965 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/movies.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/movies.rs @@ -6,12 +6,13 @@ use aws_sdk_dynamodb as dynamodb; use aws_smithy_client::test_connection::TestConnection; use aws_smithy_http::body::SdkBody; -use dynamodb::model::{ +use dynamodb::config::{Credentials, Region}; +use dynamodb::operation::query::QueryOutput; +use dynamodb::types::{ AttributeDefinition, AttributeValue, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType, TableStatus, }; -use dynamodb::output::QueryOutput; -use dynamodb::{Client, Credentials, Region}; +use dynamodb::Client; use http::header::{HeaderName, AUTHORIZATION}; use http::Uri; use serde_json::Value; diff --git a/aws/sdk/integration-tests/dynamodb/tests/paginators.rs b/aws/sdk/integration-tests/dynamodb/tests/paginators.rs index 59aa6e6101bcdc60e3c955f0811ffdb0e0a4fdf7..807a11890de055f1c040e69e7afb46facd9f9d3d 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/paginators.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/paginators.rs @@ -9,7 +9,7 @@ use std::iter::FromIterator; use tokio_stream::StreamExt; use aws_credential_types::Credentials; -use aws_sdk_dynamodb::model::AttributeValue; +use aws_sdk_dynamodb::types::AttributeValue; use aws_sdk_dynamodb::{Client, Config}; use aws_smithy_client::http_connector::HttpConnector; use aws_smithy_client::test_connection::{capture_request, TestConnection}; diff --git a/aws/sdk/integration-tests/dynamodb/tests/shared-config.rs b/aws/sdk/integration-tests/dynamodb/tests/shared-config.rs index aabccc8371d927f83c13a5f4f137c09054586314..3d5edf8cb22bc04b804e49a54dabc717b79905b3 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/shared-config.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/shared-config.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_dynamodb::{Credentials, Region}; +use aws_sdk_dynamodb::config::{Credentials, Region}; use http::Uri; /// Iterative test of loading clients from shared configuration diff --git a/aws/sdk/integration-tests/dynamodb/tests/timeouts.rs b/aws/sdk/integration-tests/dynamodb/tests/timeouts.rs index 5695b403d8fad1669ab46469893c3322bb094bbc..b566c598c70fbb4c543d5a1d6dc617e0b524052d 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/timeouts.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/timeouts.rs @@ -8,7 +8,7 @@ use std::time::Duration; use aws_credential_types::provider::SharedCredentialsProvider; use aws_credential_types::Credentials; -use aws_sdk_dynamodb::types::SdkError; +use aws_sdk_dynamodb::error::SdkError; use aws_smithy_async::rt::sleep::{AsyncSleep, Sleep}; use aws_smithy_client::never::NeverConnector; use aws_smithy_types::retry::RetryConfig; diff --git a/aws/sdk/integration-tests/ec2/tests/paginators.rs b/aws/sdk/integration-tests/ec2/tests/paginators.rs index 533e7d0dfd9b0d2d9baea49e52e33575f809182b..83528f2075e23025e5cde56ad2b7cfa1c995b648 100644 --- a/aws/sdk/integration-tests/ec2/tests/paginators.rs +++ b/aws/sdk/integration-tests/ec2/tests/paginators.rs @@ -5,7 +5,7 @@ use tokio_stream::StreamExt; -use aws_sdk_ec2::{model::InstanceType, Client, Config, Credentials, Region}; +use aws_sdk_ec2::{config::Credentials, config::Region, types::InstanceType, Client, Config}; use aws_smithy_client::http_connector::HttpConnector; use aws_smithy_client::test_connection::TestConnection; diff --git a/aws/sdk/integration-tests/glacier/tests/custom-headers.rs b/aws/sdk/integration-tests/glacier/tests/custom-headers.rs index 5ab708ef07e04bbb011ed793f40c046158487f62..00163b0a81d8b8937559304d5235d385e77dc346 100644 --- a/aws/sdk/integration-tests/glacier/tests/custom-headers.rs +++ b/aws/sdk/integration-tests/glacier/tests/custom-headers.rs @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_glacier::types::ByteStream; -use aws_sdk_glacier::{Credentials, Region}; +use aws_sdk_glacier::config::{Credentials, Region}; +use aws_sdk_glacier::primitives::ByteStream; use aws_smithy_client::test_connection::capture_request; use aws_smithy_protocol_test::{assert_ok, validate_headers}; diff --git a/aws/sdk/integration-tests/iam/tests/resolve-global-endpoint.rs b/aws/sdk/integration-tests/iam/tests/resolve-global-endpoint.rs index 252cc51822b60a3317af43df9033665be9110789..923bf568f692a74f6ea04cfe37fc87d286d603f6 100644 --- a/aws/sdk/integration-tests/iam/tests/resolve-global-endpoint.rs +++ b/aws/sdk/integration-tests/iam/tests/resolve-global-endpoint.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_iam::{Credentials, Region}; +use aws_sdk_iam::config::{Credentials, Region}; use aws_smithy_client::test_connection::capture_request; // this test is ignored because pseudoregions have been removed. This test should be re-enabled diff --git a/aws/sdk/integration-tests/kms/tests/integration.rs b/aws/sdk/integration-tests/kms/tests/integration.rs index 8c9bd1e105804031f790e33902b92599c90b89b6..8d17e13d480aab66f346c2a7dc9feaba62f0e2aa 100644 --- a/aws/sdk/integration-tests/kms/tests/integration.rs +++ b/aws/sdk/integration-tests/kms/tests/integration.rs @@ -6,15 +6,14 @@ use aws_http::user_agent::AwsUserAgent; use aws_sdk_kms as kms; use aws_sdk_kms::middleware::DefaultMiddleware; -use aws_sdk_kms::types::RequestId; +use aws_sdk_kms::operation::RequestId; use aws_smithy_client::test_connection::TestConnection; use aws_smithy_client::{Client as CoreClient, SdkError}; use aws_smithy_http::body::SdkBody; use http::header::AUTHORIZATION; use http::Uri; -use kms::operation::GenerateRandom; -use kms::Credentials; -use kms::{Config, Region}; +use kms::config::{Config, Credentials, Region}; +use kms::operation::generate_random::GenerateRandomInput; use std::time::{Duration, UNIX_EPOCH}; type Client = CoreClient; @@ -74,7 +73,7 @@ async fn generate_random() { .region(Region::new("us-east-1")) .credentials_provider(Credentials::for_tests()) .build(); - let mut op = GenerateRandom::builder() + let mut op = GenerateRandomInput::builder() .number_of_bytes(64) .build() .unwrap() @@ -112,7 +111,7 @@ async fn generate_random_malformed_response() { .region(Region::new("us-east-1")) .credentials_provider(Credentials::for_tests()) .build(); - let op = GenerateRandom::builder() + let op = GenerateRandomInput::builder() .number_of_bytes(64) .build() .unwrap() @@ -152,7 +151,7 @@ async fn generate_random_keystore_not_found() { .body(r#"{"__type":"CustomKeyStoreNotFoundException"}"#).unwrap()) ]); - let mut op = GenerateRandom::builder() + let mut op = GenerateRandomInput::builder() .number_of_bytes(64) .custom_key_store_id("does not exist") .build() diff --git a/aws/sdk/integration-tests/kms/tests/sensitive-it.rs b/aws/sdk/integration-tests/kms/tests/sensitive-it.rs index 00f3c8d95e0785e8f00ccbdf4036a496fa85b10b..2de72f3279575f76bb4c5d23da976feb497275fc 100644 --- a/aws/sdk/integration-tests/kms/tests/sensitive-it.rs +++ b/aws/sdk/integration-tests/kms/tests/sensitive-it.rs @@ -12,17 +12,16 @@ use aws_smithy_http::result::SdkError; use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, RetryKind}; use bytes::Bytes; -use kms::error::CreateAliasError; -use kms::operation::{CreateAlias, GenerateRandom}; -use kms::output::GenerateRandomOutput; -use kms::types::Blob; +use kms::operation::create_alias::{CreateAlias, CreateAliasError, CreateAliasInput}; +use kms::operation::generate_random::{GenerateRandom, GenerateRandomOutput}; +use kms::primitives::Blob; #[test] fn validate_sensitive_trait() { let builder = GenerateRandomOutput::builder().plaintext(Blob::new("some output")); assert_eq!( format!("{:?}", builder), - "Builder { plaintext: \"*** Sensitive Data Redacted ***\", _request_id: None }" + "GenerateRandomOutputBuilder { plaintext: \"*** Sensitive Data Redacted ***\", _request_id: None }" ); let output = GenerateRandomOutput::builder() .plaintext(Blob::new("some output")) @@ -40,9 +39,9 @@ fn assert_debug() {} #[tokio::test] async fn types_are_send_sync() { assert_send_sync::(); - assert_send_sync::>(); - assert_send_sync::(); - assert_send_sync::(); + assert_send_sync::>(); + assert_send_sync::(); + assert_send_sync::(); assert_send_sync::(); assert_send_sync::(); let conf = kms::Config::builder().build(); @@ -71,13 +70,13 @@ async fn client_is_clone() { #[test] fn types_are_debug() { assert_debug::(); - assert_debug::(); - assert_debug::(); + assert_debug::(); + assert_debug::(); } async fn create_alias_op() -> Parts { let conf = kms::Config::builder().build(); - let (_, parts) = CreateAlias::builder() + let (_, parts) = CreateAliasInput::builder() .build() .unwrap() .make_operation(&conf) diff --git a/aws/sdk/integration-tests/lambda/tests/request_id.rs b/aws/sdk/integration-tests/lambda/tests/request_id.rs index ab3ede5f0ac71dc515a9ee3d35d2956ec6566cad..2bc465835e7e144638bb467108781f4c5a844d09 100644 --- a/aws/sdk/integration-tests/lambda/tests/request_id.rs +++ b/aws/sdk/integration-tests/lambda/tests/request_id.rs @@ -3,9 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_lambda::error::ListFunctionsError; -use aws_sdk_lambda::operation::ListFunctions; -use aws_sdk_lambda::types::RequestId; +use aws_sdk_lambda::operation::list_functions::{ListFunctions, ListFunctionsError}; +use aws_sdk_lambda::operation::RequestId; use aws_smithy_http::response::ParseHttpResponse; use bytes::Bytes; diff --git a/aws/sdk/integration-tests/polly/tests/presigning.rs b/aws/sdk/integration-tests/polly/tests/presigning.rs index 7dc40b8e5dbb6780242da305eec3d3525c93c183..bfb87291644d8497465e907532bbfc8625d23528 100644 --- a/aws/sdk/integration-tests/polly/tests/presigning.rs +++ b/aws/sdk/integration-tests/polly/tests/presigning.rs @@ -4,19 +4,21 @@ */ use aws_sdk_polly as polly; -use aws_sdk_polly::model::{OutputFormat, VoiceId}; -use polly::presigning::config::PresigningConfig; +use polly::config::{Config, Credentials, Region}; +use polly::operation::synthesize_speech::SynthesizeSpeechInput; +use polly::presigning::PresigningConfig; +use polly::types::{OutputFormat, VoiceId}; use std::error::Error; use std::time::{Duration, SystemTime}; #[tokio::test] async fn test_presigning() -> Result<(), Box> { - let config = polly::Config::builder() - .credentials_provider(polly::Credentials::for_tests()) - .region(polly::Region::new("us-east-1")) + let config = Config::builder() + .credentials_provider(Credentials::for_tests()) + .region(Region::new("us-east-1")) .build(); - let input = polly::input::SynthesizeSpeechInput::builder() + let input = SynthesizeSpeechInput::builder() .output_format(OutputFormat::Mp3) .text("hello, world") .voice_id(VoiceId::Joanna) diff --git a/aws/sdk/integration-tests/qldbsession/tests/integration.rs b/aws/sdk/integration-tests/qldbsession/tests/integration.rs index 9e02690acbd87e666971cfd245737ec57757ece6..680e1647d5bcce59a7e6df0d7c5647f95042b9a3 100644 --- a/aws/sdk/integration-tests/qldbsession/tests/integration.rs +++ b/aws/sdk/integration-tests/qldbsession/tests/integration.rs @@ -9,11 +9,10 @@ use aws_smithy_client::test_connection::TestConnection; use aws_smithy_client::Client as CoreClient; use aws_smithy_http::body::SdkBody; use http::Uri; +use qldbsession::config::{Config, Credentials, Region}; use qldbsession::middleware::DefaultMiddleware; -use qldbsession::model::StartSessionRequest; -use qldbsession::operation::SendCommand; -use qldbsession::Credentials; -use qldbsession::{Config, Region}; +use qldbsession::operation::send_command::SendCommandInput; +use qldbsession::types::StartSessionRequest; use std::time::{Duration, UNIX_EPOCH}; pub type Client = CoreClient; @@ -46,7 +45,7 @@ async fn signv4_use_correct_service_name() { .credentials_provider(Credentials::for_tests()) .build(); - let mut op = SendCommand::builder() + let mut op = SendCommandInput::builder() .start_session( StartSessionRequest::builder() .ledger_name("not-real-ledger") diff --git a/aws/sdk/integration-tests/s3/tests/alternative-async-runtime.rs b/aws/sdk/integration-tests/s3/tests/alternative-async-runtime.rs index a1e44b2c7aaae9fc4069acf9b70a56eaaa6667e1..209403de4ad53bb7a00adec4e0941851a2b1fb64 100644 --- a/aws/sdk/integration-tests/s3/tests/alternative-async-runtime.rs +++ b/aws/sdk/integration-tests/s3/tests/alternative-async-runtime.rs @@ -5,11 +5,12 @@ use aws_config::retry::RetryConfig; use aws_credential_types::provider::SharedCredentialsProvider; -use aws_sdk_s3::model::{ +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::types::{ CompressionType, CsvInput, CsvOutput, ExpressionType, FileHeaderInfo, InputSerialization, OutputSerialization, }; -use aws_sdk_s3::{Client, Config, Credentials, Region}; +use aws_sdk_s3::{Client, Config}; use aws_smithy_async::assert_elapsed; use aws_smithy_async::rt::sleep::{AsyncSleep, Sleep}; use aws_smithy_client::never::NeverConnector; diff --git a/aws/sdk/integration-tests/s3/tests/checksums.rs b/aws/sdk/integration-tests/s3/tests/checksums.rs index 79f00a2a3a46cff3915d8c128aa7daad8b23267a..cb1e574e48b7a04f1e8aaaf0d5931d318e7a72f0 100644 --- a/aws/sdk/integration-tests/s3/tests/checksums.rs +++ b/aws/sdk/integration-tests/s3/tests/checksums.rs @@ -6,7 +6,9 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::{model::ChecksumAlgorithm, output::GetObjectOutput, Client, Credentials, Region}; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::Client; +use aws_sdk_s3::{operation::get_object::GetObjectOutput, types::ChecksumAlgorithm}; use aws_smithy_client::test_connection::{capture_request, TestConnection}; use aws_smithy_http::body::SdkBody; use http::header::AUTHORIZATION; @@ -69,7 +71,7 @@ async fn test_checksum_on_streaming_response( .get_object() .bucket("some-test-bucket") .key("test.txt") - .checksum_mode(aws_sdk_s3::model::ChecksumMode::Enabled) + .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) .customize() .await .unwrap() @@ -169,7 +171,7 @@ async fn test_checksum_on_streaming_request<'a>( use std::io::Write; file.write_all(body).unwrap(); - let body = aws_sdk_s3::types::ByteStream::read_from() + let body = aws_sdk_s3::primitives::ByteStream::read_from() .path(file.path()) .buffer_size(1024) .build() diff --git a/aws/sdk/integration-tests/s3/tests/customizable-operation.rs b/aws/sdk/integration-tests/s3/tests/customizable-operation.rs index f0b584aa12b44ab7cb6b6d8a82d2630912126f0a..24b53523a980a210431674f656613cd99eebb80d 100644 --- a/aws/sdk/integration-tests/s3/tests/customizable-operation.rs +++ b/aws/sdk/integration-tests/s3/tests/customizable-operation.rs @@ -6,7 +6,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::test_connection::capture_request; use std::convert::Infallible; diff --git a/aws/sdk/integration-tests/s3/tests/endpoints.rs b/aws/sdk/integration-tests/s3/tests/endpoints.rs index 02b1718569ef58ca335ca62832fa9f6a1807ec26..357c142900d3c5e2db566b63d804dae5d8d48237 100644 --- a/aws/sdk/integration-tests/s3/tests/endpoints.rs +++ b/aws/sdk/integration-tests/s3/tests/endpoints.rs @@ -6,7 +6,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_sdk_s3::config::Builder; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::test_connection::{capture_request, CaptureRequestReceiver}; use std::convert::Infallible; use std::time::{Duration, UNIX_EPOCH}; diff --git a/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs b/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs index e2f850cb68bb4f8672d5db7c1a2a676a2ad9371a..f4e87043604886b00cf9a12d9de17640325be350 100644 --- a/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs +++ b/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs @@ -5,7 +5,7 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::{model::ObjectAttributes, Client, Credentials, Region}; +use aws_sdk_s3::{config::Credentials, config::Region, types::ObjectAttributes, Client}; use aws_smithy_client::test_connection::TestConnection; use aws_smithy_http::body::SdkBody; use aws_types::SdkConfig; diff --git a/aws/sdk/integration-tests/s3/tests/naughty-string-metadata.rs b/aws/sdk/integration-tests/s3/tests/naughty-string-metadata.rs index fd537a539a075de93920bbf8497d36a17fa980e1..eef5b0b14b2ad832e5f61172711798f94b0ebfc1 100644 --- a/aws/sdk/integration-tests/s3/tests/naughty-string-metadata.rs +++ b/aws/sdk/integration-tests/s3/tests/naughty-string-metadata.rs @@ -5,7 +5,7 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::{types::ByteStream, Client, Credentials, Region}; +use aws_sdk_s3::{config::Credentials, config::Region, primitives::ByteStream, Client}; use aws_smithy_client::test_connection::capture_request; use aws_types::SdkConfig; use http::HeaderValue; diff --git a/aws/sdk/integration-tests/s3/tests/normalize-uri-path.rs b/aws/sdk/integration-tests/s3/tests/normalize-uri-path.rs index d039064cbc0719e4a4edeb72c976acd799bcb0ab..1f903abb7adf7befe0523d266c065d63a141f73c 100644 --- a/aws/sdk/integration-tests/s3/tests/normalize-uri-path.rs +++ b/aws/sdk/integration-tests/s3/tests/normalize-uri-path.rs @@ -6,8 +6,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::types::ByteStream; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::primitives::ByteStream; +use aws_sdk_s3::{config::Credentials, config::Region, Client}; use aws_smithy_client::test_connection::capture_request; use std::convert::Infallible; use std::time::{Duration, UNIX_EPOCH}; diff --git a/aws/sdk/integration-tests/s3/tests/presigning.rs b/aws/sdk/integration-tests/s3/tests/presigning.rs index f2f0dcacc4400cbd343aa75fe9531c5d025763e1..6f8a33d571f6c395fe5260221b4046ac37f6cf07 100644 --- a/aws/sdk/integration-tests/s3/tests/presigning.rs +++ b/aws/sdk/integration-tests/s3/tests/presigning.rs @@ -4,10 +4,14 @@ */ use aws_sdk_s3 as s3; -use aws_sdk_s3::presigning::request::PresignedRequest; use http::header::{CONTENT_LENGTH, CONTENT_TYPE}; use http::{HeaderMap, HeaderValue}; -use s3::presigning::config::PresigningConfig; +use s3::config::{Credentials, Region}; +use s3::operation::get_object::GetObjectInput; +use s3::operation::head_object::HeadObjectInput; +use s3::operation::put_object::PutObjectInput; +use s3::operation::upload_part::UploadPartInput; +use s3::presigning::{PresignedRequest, PresigningConfig}; use std::error::Error; use std::time::{Duration, SystemTime}; @@ -15,10 +19,10 @@ use std::time::{Duration, SystemTime}; /// Assumes that that input has a `presigned` method on it. macro_rules! presign_input { ($input:expr) => {{ - let creds = s3::Credentials::for_tests(); + let creds = Credentials::for_tests(); let config = s3::Config::builder() .credentials_provider(creds) - .region(s3::Region::new("us-east-1")) + .region(Region::new("us-east-1")) .build(); let req: PresignedRequest = $input @@ -37,7 +41,7 @@ macro_rules! presign_input { #[tokio::test] async fn test_presigning() -> Result<(), Box> { - let presigned = presign_input!(s3::input::GetObjectInput::builder() + let presigned = presign_input!(GetObjectInput::builder() .bucket("test-bucket") .key("test-key") .build()?); @@ -74,7 +78,7 @@ async fn test_presigning() -> Result<(), Box> { #[tokio::test] async fn test_presigning_with_payload_headers() -> Result<(), Box> { - let presigned = presign_input!(s3::input::PutObjectInput::builder() + let presigned = presign_input!(PutObjectInput::builder() .bucket("test-bucket") .key("test-key") .content_length(12345) @@ -117,7 +121,7 @@ async fn test_presigning_with_payload_headers() -> Result<(), Box> { #[tokio::test] async fn test_presigned_upload_part() -> Result<(), Box> { - let presigned = presign_input!(s3::input::UploadPartInput::builder() + let presigned = presign_input!(UploadPartInput::builder() .content_length(12345) .bucket("bucket") .key("key") @@ -133,7 +137,7 @@ async fn test_presigned_upload_part() -> Result<(), Box> { #[tokio::test] async fn test_presigning_object_lambda() -> Result<(), Box> { - let presigned = presign_input!(s3::input::GetObjectInput::builder() + let presigned = presign_input!(GetObjectInput::builder() .bucket("arn:aws:s3-object-lambda:us-west-2:123456789012:accesspoint:my-banner-ap-name") .key("test2.txt") .build() @@ -145,7 +149,7 @@ async fn test_presigning_object_lambda() -> Result<(), Box> { #[tokio::test] async fn test_presigned_head_object() -> Result<(), Box> { - let presigned = presign_input!(s3::input::HeadObjectInput::builder() + let presigned = presign_input!(HeadObjectInput::builder() .bucket("bucket") .key("key") .build()?); diff --git a/aws/sdk/integration-tests/s3/tests/query-strings-are-correctly-encoded.rs b/aws/sdk/integration-tests/s3/tests/query-strings-are-correctly-encoded.rs index 7714becfe554eac58a5fd7df3a1d1b966a426824..03393a5a74a6abba5b91c55fd6a93bfe585c6964 100644 --- a/aws/sdk/integration-tests/s3/tests/query-strings-are-correctly-encoded.rs +++ b/aws/sdk/integration-tests/s3/tests/query-strings-are-correctly-encoded.rs @@ -6,7 +6,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::test_connection::capture_request; use std::convert::Infallible; use std::time::{Duration, UNIX_EPOCH}; @@ -71,7 +72,7 @@ async fn test_s3_signer_query_string_with_all_valid_chars() { #[tokio::test] #[ignore] async fn test_query_strings_are_correctly_encoded() { - use aws_sdk_s3::error::ListObjectsV2Error; + use aws_sdk_s3::operation::list_objects_v2::ListObjectsV2Error; use aws_smithy_http::result::SdkError; tracing_subscriber::fmt::init(); diff --git a/aws/sdk/integration-tests/s3/tests/recursion-detection.rs b/aws/sdk/integration-tests/s3/tests/recursion-detection.rs index c4d739447523588380db060c6ffdf8cbb1ed9fbc..f0aa974d8e1a8a89277b0905a9a69915bd611f26 100644 --- a/aws/sdk/integration-tests/s3/tests/recursion-detection.rs +++ b/aws/sdk/integration-tests/s3/tests/recursion-detection.rs @@ -5,7 +5,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::test_connection::capture_request; use http::HeaderValue; diff --git a/aws/sdk/integration-tests/s3/tests/request_id.rs b/aws/sdk/integration-tests/s3/tests/request_id.rs index 957dd8cb28497fb6474267ea78ace62790fbcef1..67d9523fb548897273727d9335785e4e389f204f 100644 --- a/aws/sdk/integration-tests/s3/tests/request_id.rs +++ b/aws/sdk/integration-tests/s3/tests/request_id.rs @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_s3::error::GetObjectError; -use aws_sdk_s3::operation::{GetObject, ListBuckets}; -use aws_sdk_s3::types::{RequestId, RequestIdExt}; +use aws_sdk_s3::operation::get_object::{GetObject, GetObjectError}; +use aws_sdk_s3::operation::list_buckets::ListBuckets; +use aws_sdk_s3::operation::{RequestId, RequestIdExt}; use aws_smithy_http::body::SdkBody; use aws_smithy_http::operation; use aws_smithy_http::response::ParseHttpResponse; diff --git a/aws/sdk/integration-tests/s3/tests/required-query-params.rs b/aws/sdk/integration-tests/s3/tests/required-query-params.rs index 05124af0a3a0e130fdc143e7e84fb9725ea9f6fb..7cf6238da03aea2d4173966bd3294df9536f34b5 100644 --- a/aws/sdk/integration-tests/s3/tests/required-query-params.rs +++ b/aws/sdk/integration-tests/s3/tests/required-query-params.rs @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_s3::operation::AbortMultipartUpload; -use aws_sdk_s3::Region; +use aws_sdk_s3::config::Region; +use aws_sdk_s3::operation::abort_multipart_upload::AbortMultipartUploadInput; use aws_smithy_http::operation::error::BuildError; #[tokio::test] @@ -13,7 +13,7 @@ async fn test_error_when_required_query_param_is_unset() { .region(Region::new("us-east-1")) .build(); - let err = AbortMultipartUpload::builder() + let err = AbortMultipartUploadInput::builder() .bucket("test-bucket") .key("test.txt") .build() @@ -33,7 +33,7 @@ async fn test_error_when_required_query_param_is_set_but_empty() { let conf = aws_sdk_s3::Config::builder() .region(Region::new("us-east-1")) .build(); - let err = AbortMultipartUpload::builder() + let err = AbortMultipartUploadInput::builder() .bucket("test-bucket") .key("test.txt") .upload_id("") diff --git a/aws/sdk/integration-tests/s3/tests/select-object-content.rs b/aws/sdk/integration-tests/s3/tests/select-object-content.rs index d68af2f68bbe19220d64f07d6cc798f9ec0672d3..eb4d7a055ca1352eba58a9df752189a91a5b865a 100644 --- a/aws/sdk/integration-tests/s3/tests/select-object-content.rs +++ b/aws/sdk/integration-tests/s3/tests/select-object-content.rs @@ -5,11 +5,12 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; -use aws_sdk_s3::model::{ +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::types::{ CompressionType, CsvInput, CsvOutput, ExpressionType, FileHeaderInfo, InputSerialization, OutputSerialization, SelectObjectContentEventStream, }; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::dvr::{Event, ReplayingConnection}; use aws_smithy_protocol_test::{assert_ok, validate_body, MediaType}; use std::error::Error; diff --git a/aws/sdk/integration-tests/s3/tests/signing-it.rs b/aws/sdk/integration-tests/s3/tests/signing-it.rs index 0efdc9a5f658c3efd8cd0788f821cae5cc7ba8de..6e20e187e2cf47b4a6fc4594669c5b45f73fe5ba 100644 --- a/aws/sdk/integration-tests/s3/tests/signing-it.rs +++ b/aws/sdk/integration-tests/s3/tests/signing-it.rs @@ -6,7 +6,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::test_connection::TestConnection; use aws_smithy_http::body::SdkBody; use std::convert::Infallible; diff --git a/aws/sdk/integration-tests/s3/tests/size-type.rs b/aws/sdk/integration-tests/s3/tests/size-type.rs index 986daaaaf822fef02343c140b524a0354185ad85..d790b0a62298b89c14453788059b3caf0a687f1b 100644 --- a/aws/sdk/integration-tests/s3/tests/size-type.rs +++ b/aws/sdk/integration-tests/s3/tests/size-type.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_s3::model::Object; +use aws_sdk_s3::types::Object; // Tests that `com.amazonaws.s3#Size` is correctly customized to be a long instead of an int. #[test] diff --git a/aws/sdk/integration-tests/s3/tests/streaming-response.rs b/aws/sdk/integration-tests/s3/tests/streaming-response.rs index 8ff6d6eb377c8ef6b323ad8d0421e30c118bb9ad..50acb13b3325e0da0aec90198013385cb85a72c4 100644 --- a/aws/sdk/integration-tests/s3/tests/streaming-response.rs +++ b/aws/sdk/integration-tests/s3/tests/streaming-response.rs @@ -5,8 +5,9 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; -use aws_sdk_s3::{Client, Credentials, Region}; -use aws_smithy_types::error::display::DisplayErrorContext; +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::error::DisplayErrorContext; +use aws_sdk_s3::Client; use bytes::BytesMut; use std::future::Future; use std::net::SocketAddr; diff --git a/aws/sdk/integration-tests/s3/tests/timeouts.rs b/aws/sdk/integration-tests/s3/tests/timeouts.rs index 5d1cacc5aa7833a518cedfd66bc6821416f9d340..e4d28b72f46e50ffb8104d504fc0817b0a99432f 100644 --- a/aws/sdk/integration-tests/s3/tests/timeouts.rs +++ b/aws/sdk/integration-tests/s3/tests/timeouts.rs @@ -5,11 +5,12 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; -use aws_sdk_s3::model::{ +use aws_sdk_s3::config::{Credentials, Region}; +use aws_sdk_s3::types::{ CompressionType, CsvInput, CsvOutput, ExpressionType, FileHeaderInfo, InputSerialization, OutputSerialization, }; -use aws_sdk_s3::{Client, Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_async::assert_elapsed; use aws_smithy_async::rt::sleep::{default_async_sleep, TokioSleep}; use aws_smithy_client::never::NeverConnector; diff --git a/aws/sdk/integration-tests/s3/tests/user-agent-app-name.rs b/aws/sdk/integration-tests/s3/tests/user-agent-app-name.rs index 8d72c5287809b40ca2f681935c994ea2127f36a7..2dfea8d37b740ac73f954f425742ba1b5c830e16 100644 --- a/aws/sdk/integration-tests/s3/tests/user-agent-app-name.rs +++ b/aws/sdk/integration-tests/s3/tests/user-agent-app-name.rs @@ -5,7 +5,8 @@ use aws_config::SdkConfig; use aws_credential_types::provider::SharedCredentialsProvider; -use aws_sdk_s3::{AppName, Client, Credentials, Region}; +use aws_sdk_s3::config::{AppName, Credentials, Region}; +use aws_sdk_s3::Client; use aws_smithy_client::test_connection::capture_request; #[tokio::test] diff --git a/aws/sdk/integration-tests/s3control/tests/signing-it.rs b/aws/sdk/integration-tests/s3control/tests/signing-it.rs index 4a9857b17a827972831232423b082bb79142a1ec..f5c583bbcd746c4a1540bea4854da62809452a5b 100644 --- a/aws/sdk/integration-tests/s3control/tests/signing-it.rs +++ b/aws/sdk/integration-tests/s3control/tests/signing-it.rs @@ -5,7 +5,8 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_http::user_agent::AwsUserAgent; -use aws_sdk_s3control::{Client, Credentials, Region}; +use aws_sdk_s3control::config::{Credentials, Region}; +use aws_sdk_s3control::Client; use aws_smithy_client::test_connection::TestConnection; use aws_smithy_http::body::SdkBody; use aws_types::SdkConfig; diff --git a/aws/sdk/integration-tests/sts/tests/retry_idp_comms_err.rs b/aws/sdk/integration-tests/sts/tests/retry_idp_comms_err.rs index 3b546bbb0b9bed901d1381f478ebf76f580e6f65..52427857176fbf44654950767722ce565cbdbfb1 100644 --- a/aws/sdk/integration-tests/sts/tests/retry_idp_comms_err.rs +++ b/aws/sdk/integration-tests/sts/tests/retry_idp_comms_err.rs @@ -6,7 +6,8 @@ use aws_sdk_sts as sts; use aws_smithy_types::error::ErrorMetadata; use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind}; -use sts::error::{AssumeRoleWithWebIdentityError, IdpCommunicationErrorException}; +use sts::operation::assume_role_with_web_identity::AssumeRoleWithWebIdentityError; +use sts::types::error::IdpCommunicationErrorException; #[tokio::test] async fn idp_comms_err_retryable() { diff --git a/aws/sdk/integration-tests/sts/tests/signing-it.rs b/aws/sdk/integration-tests/sts/tests/signing-it.rs index 12c4d78084e19ffa3d1b4066dc16a39f867b3c0a..f2c80bd9f7fab974c29cf503ff27ea33cf9da1cc 100644 --- a/aws/sdk/integration-tests/sts/tests/signing-it.rs +++ b/aws/sdk/integration-tests/sts/tests/signing-it.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_sdk_sts::{Credentials, Region}; +use aws_sdk_sts::config::{Credentials, Region}; use aws_smithy_client::test_connection::capture_request; #[tokio::test] diff --git a/aws/sdk/integration-tests/transcribestreaming/tests/test.rs b/aws/sdk/integration-tests/transcribestreaming/tests/test.rs index fe6b028820fe2afd2ff0e57830290b0d8c15ea95..62654ebd82f2a26f62e06eefb9e459f142f2401e 100644 --- a/aws/sdk/integration-tests/transcribestreaming/tests/test.rs +++ b/aws/sdk/integration-tests/transcribestreaming/tests/test.rs @@ -4,13 +4,15 @@ */ use async_stream::stream; -use aws_sdk_transcribestreaming::error::{AudioStreamError, TranscriptResultStreamError}; -use aws_sdk_transcribestreaming::model::{ +use aws_sdk_transcribestreaming::config::{Credentials, Region}; +use aws_sdk_transcribestreaming::error::SdkError; +use aws_sdk_transcribestreaming::operation::start_stream_transcription::StartStreamTranscriptionOutput; +use aws_sdk_transcribestreaming::primitives::Blob; +use aws_sdk_transcribestreaming::types::error::{AudioStreamError, TranscriptResultStreamError}; +use aws_sdk_transcribestreaming::types::{ AudioEvent, AudioStream, LanguageCode, MediaEncoding, TranscriptResultStream, }; -use aws_sdk_transcribestreaming::output::StartStreamTranscriptionOutput; -use aws_sdk_transcribestreaming::types::{Blob, SdkError}; -use aws_sdk_transcribestreaming::{Client, Config, Credentials, Region}; +use aws_sdk_transcribestreaming::{Client, Config}; use aws_smithy_client::dvr::{Event, ReplayingConnection}; use aws_smithy_eventstream::frame::{DecodedFrame, HeaderValue, Message, MessageFrameDecoder}; use bytes::BufMut; diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientCodegenVisitor.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientCodegenVisitor.kt index 6629b480a771929fe89de4145a7e0d9abba56ccd..5a97b1ede504d80b78e077280934b5901182ca60 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientCodegenVisitor.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientCodegenVisitor.kt @@ -312,7 +312,7 @@ class ClientCodegenVisitor( UnionGenerator(model, symbolProvider, this, shape, renderUnknownVariant = true).render() } if (shape.isEventStream()) { - rustCrate.withModule(ClientRustModule.Error) { + rustCrate.withModule(symbolProvider.moduleForEventStreamError(shape)) { OperationErrorGenerator( model, symbolProvider, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustModule.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustModule.kt index 0f610a42cd98e76fd17fcb9eb6429fe2e9b460b6..a89aabb6888c60c7d871a373210ea57fbfe669af 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustModule.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustModule.kt @@ -136,12 +136,13 @@ class ClientModuleDocProvider( private fun customizeModuleDoc(): Writable = writable { val model = codegenContext.model docs("Operation customization and supporting types.\n") - if (model.operationShapes.isNotEmpty()) { + if (codegenContext.serviceShape.operations.isNotEmpty()) { val opFnName = FluentClientGenerator.clientOperationFnName( codegenContext.serviceShape.operations.minOf { it } .let { model.expectShape(it, OperationShape::class.java) }, codegenContext.symbolProvider, ) + val moduleUseName = codegenContext.moduleUseName() docsTemplate( """ The underlying HTTP requests made during an operation can be customized @@ -149,8 +150,8 @@ class ClientModuleDocProvider( operation call. For example, this can be used to add an additional HTTP header: ```no_run - ## async fn wrapper() -> Result<(), crate::Error> { - ## let client: crate::Client = unimplemented!(); + ## async fn wrapper() -> Result<(), $moduleUseName::Error> { + ## let client: $moduleUseName::Client = unimplemented!(); use #{http}::header::{HeaderName, HeaderValue}; let result = client.$opFnName() @@ -196,7 +197,7 @@ object ClientModuleProvider : ModuleProvider { override fun moduleForEventStreamError( context: ModuleProviderContext, eventStream: UnionShape, - ): RustModule.LeafModule = ClientRustModule.Error + ): RustModule.LeafModule = ClientRustModule.Types.Error override fun moduleForBuilder(context: ModuleProviderContext, shape: Shape, symbol: Symbol): RustModule.LeafModule = RustModule.public("builders", parent = symbol.module(), documentationOverride = "Builders") diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGenerator.kt index d9ef055a375c12cc84036bf5edb5ece96878309f..52894539e777bbef34738b5b3607e1d272e35377 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGenerator.kt @@ -50,7 +50,6 @@ class OperationErrorGenerator( private val customizations: List, ) { private val runtimeConfig = symbolProvider.config.runtimeConfig - private val symbol = symbolProvider.toSymbol(operationOrEventStream) private val errorMetadata = errorMetadata(symbolProvider.config.runtimeConfig) private val createUnhandledError = RuntimeType.smithyHttp(runtimeConfig).resolve("result::CreateUnhandledError") diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ClientProtocolGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ClientProtocolGenerator.kt index 31b1fb64ad62f24f6440858a18156dcf216284f0..8cd5fd93386b04e6a1349956e6c080470b044660 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ClientProtocolGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ClientProtocolGenerator.kt @@ -86,7 +86,8 @@ open class ClientProtocolGenerator( Attribute.DocHidden.render(operationWriter) operationWriter.rust("pub struct $operationName;") operationWriter.implBlock(symbolProvider.toSymbol(operationShape)) { - rustBlock("pub(crate) fn new() -> Self") { + Attribute.DocHidden.render(operationWriter) + rustBlock("pub fn new() -> Self") { rust("Self") } diff --git a/tools/ci-cdk/canary-lambda/src/canary.rs b/tools/ci-cdk/canary-lambda/src/canary.rs index 9158b4751f35b02d53ebd2414932a985c438d170..a7d497b52e35979233671ed8af565f8794025f83 100644 --- a/tools/ci-cdk/canary-lambda/src/canary.rs +++ b/tools/ci-cdk/canary-lambda/src/canary.rs @@ -11,8 +11,8 @@ use std::pin::Pin; use aws_config::SdkConfig; use tracing::{info_span, Instrument}; -use crate::paginator_canary; -use crate::{s3_canary, transcribe_canary}; +use crate::current_canary::paginator_canary; +use crate::current_canary::{s3_canary, transcribe_canary}; #[macro_export] macro_rules! mk_canary { diff --git a/tools/ci-cdk/canary-lambda/src/latest.rs b/tools/ci-cdk/canary-lambda/src/latest.rs new file mode 100644 index 0000000000000000000000000000000000000000..238c36116651594d1e70800e25934a617dab0382 --- /dev/null +++ b/tools/ci-cdk/canary-lambda/src/latest.rs @@ -0,0 +1,8 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +pub(crate) mod paginator_canary; +pub(crate) mod s3_canary; +pub(crate) mod transcribe_canary; diff --git a/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs b/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs new file mode 100644 index 0000000000000000000000000000000000000000..291f717986490571377ed10589b24d0aa999b113 --- /dev/null +++ b/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs @@ -0,0 +1,71 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +use crate::mk_canary; +use anyhow::bail; + +use aws_sdk_ec2 as ec2; +use aws_sdk_ec2::types::InstanceType; + +use crate::CanaryEnv; +use tokio_stream::StreamExt; + +mk_canary!( + "ec2_paginator", + |sdk_config: &aws_config::SdkConfig, env: &CanaryEnv| { + paginator_canary(ec2::Client::new(sdk_config), env.page_size) + } +); + +pub async fn paginator_canary(client: ec2::Client, page_size: usize) -> anyhow::Result<()> { + let mut history = client + .describe_spot_price_history() + .instance_types(InstanceType::M1Medium) + .into_paginator() + .page_size(page_size as i32) + .send(); + + let mut num_pages = 0; + while let Some(page) = history.try_next().await? { + let items_in_page = page.spot_price_history.unwrap_or_default().len(); + if items_in_page > page_size as usize { + bail!( + "failed to retrieve results of correct page size (expected {}, got {})", + page_size, + items_in_page + ) + } + num_pages += 1; + } + if dbg!(num_pages) < 2 { + bail!( + "expected 3+ pages containing ~60 results but got {} pages", + num_pages + ) + } + + // https://github.com/awslabs/aws-sdk-rust/issues/405 + let _ = client + .describe_vpcs() + .into_paginator() + .items() + .send() + .collect::, _>>() + .await?; + + Ok(()) +} + +#[cfg(test)] +mod test { + use crate::paginator_canary::paginator_canary; + + #[tokio::test] + async fn test_paginator() { + let conf = aws_config::load_from_env().await; + let client = aws_sdk_ec2::Client::new(&conf); + paginator_canary(client, 20).await.unwrap() + } +} diff --git a/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs b/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs new file mode 100644 index 0000000000000000000000000000000000000000..fbcba976d864f1fabcc53d1ba5e1e51cbc30ba7f --- /dev/null +++ b/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs @@ -0,0 +1,140 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +use crate::canary::CanaryError; +use crate::{mk_canary, CanaryEnv}; +use anyhow::Context; +use aws_config::SdkConfig; +use aws_sdk_s3 as s3; +use s3::presigning::PresigningConfig; +use s3::primitives::ByteStream; +use std::time::Duration; +use uuid::Uuid; + +const METADATA_TEST_VALUE: &str = "some value"; + +mk_canary!("s3", |sdk_config: &SdkConfig, env: &CanaryEnv| s3_canary( + s3::Client::new(sdk_config), + env.s3_bucket_name.clone() +)); + +pub async fn s3_canary(client: s3::Client, s3_bucket_name: String) -> anyhow::Result<()> { + let test_key = Uuid::new_v4().as_u128().to_string(); + + // Look for the test object and expect that it doesn't exist + match client + .get_object() + .bucket(&s3_bucket_name) + .key(&test_key) + .send() + .await + { + Ok(_) => { + return Err( + CanaryError(format!("Expected object {} to not exist in S3", test_key)).into(), + ); + } + Err(err) => { + let err = err.into_service_error(); + // If we get anything other than "No such key", we have a problem + if !err.is_no_such_key() { + return Err(err).context("unexpected s3::GetObject failure"); + } + } + } + + // Put the test object + client + .put_object() + .bucket(&s3_bucket_name) + .key(&test_key) + .body(ByteStream::from_static(b"test")) + .metadata("something", METADATA_TEST_VALUE) + .send() + .await + .context("s3::PutObject")?; + + // Get the test object and verify it looks correct + let output = client + .get_object() + .bucket(&s3_bucket_name) + .key(&test_key) + .send() + .await + .context("s3::GetObject[2]")?; + + // repeat the test with a presigned url + let uri = client + .get_object() + .bucket(&s3_bucket_name) + .key(&test_key) + .presigned(PresigningConfig::expires_in(Duration::from_secs(120)).unwrap()) + .await + .unwrap(); + let response = reqwest::get(uri.uri().to_string()) + .await + .context("s3::presigned")? + .text() + .await?; + if response != "test" { + return Err(CanaryError(format!("presigned URL returned bad data: {:?}", response)).into()); + } + + let mut result = Ok(()); + match output.metadata() { + Some(map) => { + // Option::as_deref doesn't work here since the deref of &String is String + let value = map.get("something").map(|s| s.as_str()).unwrap_or(""); + if value != METADATA_TEST_VALUE { + result = Err(CanaryError(format!( + "S3 metadata was incorrect. Expected `{}` but got `{}`.", + METADATA_TEST_VALUE, value + )) + .into()); + } + } + None => { + result = Err(CanaryError("S3 metadata was missing".into()).into()); + } + } + + let payload = output + .body + .collect() + .await + .context("download s3::GetObject[2] body")? + .into_bytes(); + if std::str::from_utf8(payload.as_ref()).context("s3 payload")? != "test" { + result = Err(CanaryError("S3 object body didn't match what was put there".into()).into()); + } + + // Delete the test object + client + .delete_object() + .bucket(&s3_bucket_name) + .key(&test_key) + .send() + .await + .context("s3::DeleteObject")?; + + result +} + +// This test runs against an actual AWS account. Comment out the `ignore` to run it. +// Be sure to set the `TEST_S3_BUCKET` environment variable to the S3 bucket to use, +// and also make sure the credential profile sets the region (or set `AWS_DEFAULT_PROFILE`). +#[ignore] +#[cfg(test)] +#[tokio::test] +async fn test_s3_canary() { + let config = aws_config::load_from_env().await; + let client = s3::Client::new(&config); + s3_canary( + client, + std::env::var("TEST_S3_BUCKET").expect("TEST_S3_BUCKET must be set"), + ) + .await + .expect("success"); +} diff --git a/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs b/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs new file mode 100644 index 0000000000000000000000000000000000000000..8f6420fc1bd94800b89e371ca10e27625ec48197 --- /dev/null +++ b/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs @@ -0,0 +1,92 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +use crate::canary::CanaryError; +use crate::mk_canary; +use async_stream::stream; +use aws_config::SdkConfig; +use aws_sdk_transcribestreaming as transcribe; +use bytes::BufMut; +use transcribe::primitives::Blob; +use transcribe::types::{ + AudioEvent, AudioStream, LanguageCode, MediaEncoding, TranscriptResultStream, +}; + +const CHUNK_SIZE: usize = 8192; +use crate::canary::CanaryEnv; + +mk_canary!( + "transcribe_canary", + |sdk_config: &SdkConfig, env: &CanaryEnv| { + transcribe_canary( + transcribe::Client::new(sdk_config), + env.expected_transcribe_result.clone(), + ) + } +); + +pub async fn transcribe_canary( + client: transcribe::Client, + expected_transcribe_result: String, +) -> anyhow::Result<()> { + let input_stream = stream! { + let pcm = pcm_data(); + for chunk in pcm.chunks(CHUNK_SIZE) { + yield Ok(AudioStream::AudioEvent(AudioEvent::builder().audio_chunk(Blob::new(chunk)).build())); + } + }; + + let mut output = client + .start_stream_transcription() + .language_code(LanguageCode::EnGb) + .media_sample_rate_hertz(8000) + .media_encoding(MediaEncoding::Pcm) + .audio_stream(input_stream.into()) + .send() + .await?; + + let mut full_message = String::new(); + while let Some(event) = output.transcript_result_stream.recv().await? { + match event { + TranscriptResultStream::TranscriptEvent(transcript_event) => { + let transcript = transcript_event.transcript.unwrap(); + for result in transcript.results.unwrap_or_default() { + if !result.is_partial { + let first_alternative = &result.alternatives.as_ref().unwrap()[0]; + full_message += first_alternative.transcript.as_ref().unwrap(); + full_message.push(' '); + } + } + } + otherwise => panic!("received unexpected event type: {:?}", otherwise), + } + } + + if expected_transcribe_result != full_message.trim() { + Err(CanaryError(format!( + "Transcription from Transcribe doesn't look right:\n\ + Expected: `{}`\n\ + Actual: `{}`\n", + expected_transcribe_result, + full_message.trim() + )) + .into()) + } else { + Ok(()) + } +} + +fn pcm_data() -> Vec { + let reader = + hound::WavReader::new(&include_bytes!("../../audio/hello-transcribe-8000.wav")[..]) + .expect("valid wav data"); + let samples_result: hound::Result> = reader.into_samples::().collect(); + + let mut pcm: Vec = Vec::new(); + for sample in samples_result.unwrap() { + pcm.put_i16_le(sample); + } + pcm +} diff --git a/tools/ci-cdk/canary-lambda/src/main.rs b/tools/ci-cdk/canary-lambda/src/main.rs index 3bb723c8024fd13abd7a799a8c0b429e362bb3b1..688462031dbbadebcd0730c656b0cfb5194e0334 100644 --- a/tools/ci-cdk/canary-lambda/src/main.rs +++ b/tools/ci-cdk/canary-lambda/src/main.rs @@ -19,35 +19,18 @@ use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::EnvFilter; use tracing_texray::TeXRayLayer; -/// Conditionally include the module based on the $version feature gate -/// -/// When the module is not included, an `mk_canary` function will be generated that returns `None`. -macro_rules! canary_module { - ($name: ident, since: $version: expr) => { - #[cfg(feature = $version)] - mod $name; - - #[cfg(not(feature = $version))] - mod $name { - pub(crate) fn mk_canary( - _clients: &aws_config::SdkConfig, - _env: &crate::canary::CanaryEnv, - ) -> Option<(&'static str, crate::canary::CanaryFuture)> { - tracing::warn!(concat!( - stringify!($name), - " is disabled because it is not supported by this version of the SDK." - )); - None - } - } - }; -} - mod canary; -mod s3_canary; -canary_module!(paginator_canary, since: "v0.4.1"); -mod transcribe_canary; +#[cfg(feature = "latest")] +mod latest; +#[cfg(feature = "latest")] +pub(crate) use latest as current_canary; + +// NOTE: This module can be deleted 3 releases after release-2023-01-26 +#[cfg(feature = "release-2023-01-26")] +mod release_2023_01_26; +#[cfg(feature = "release-2023-01-26")] +pub(crate) use release_2023_01_26 as current_canary; #[tokio::main] async fn main() -> Result<(), Error> { diff --git a/tools/ci-cdk/canary-lambda/src/release_2023_01_26.rs b/tools/ci-cdk/canary-lambda/src/release_2023_01_26.rs new file mode 100644 index 0000000000000000000000000000000000000000..238c36116651594d1e70800e25934a617dab0382 --- /dev/null +++ b/tools/ci-cdk/canary-lambda/src/release_2023_01_26.rs @@ -0,0 +1,8 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +pub(crate) mod paginator_canary; +pub(crate) mod s3_canary; +pub(crate) mod transcribe_canary; diff --git a/tools/ci-cdk/canary-lambda/src/paginator_canary.rs b/tools/ci-cdk/canary-lambda/src/release_2023_01_26/paginator_canary.rs similarity index 100% rename from tools/ci-cdk/canary-lambda/src/paginator_canary.rs rename to tools/ci-cdk/canary-lambda/src/release_2023_01_26/paginator_canary.rs diff --git a/tools/ci-cdk/canary-lambda/src/s3_canary.rs b/tools/ci-cdk/canary-lambda/src/release_2023_01_26/s3_canary.rs similarity index 100% rename from tools/ci-cdk/canary-lambda/src/s3_canary.rs rename to tools/ci-cdk/canary-lambda/src/release_2023_01_26/s3_canary.rs diff --git a/tools/ci-cdk/canary-lambda/src/transcribe_canary.rs b/tools/ci-cdk/canary-lambda/src/release_2023_01_26/transcribe_canary.rs similarity index 94% rename from tools/ci-cdk/canary-lambda/src/transcribe_canary.rs rename to tools/ci-cdk/canary-lambda/src/release_2023_01_26/transcribe_canary.rs index c0e2db2fdbfa0938e0e99ce1089473e0383929df..554f4c3ddf1cb2f4471c5d7978feef7c8f8ca394 100644 --- a/tools/ci-cdk/canary-lambda/src/transcribe_canary.rs +++ b/tools/ci-cdk/canary-lambda/src/release_2023_01_26/transcribe_canary.rs @@ -79,8 +79,9 @@ pub async fn transcribe_canary( } fn pcm_data() -> Vec { - let reader = hound::WavReader::new(&include_bytes!("../audio/hello-transcribe-8000.wav")[..]) - .expect("valid wav data"); + let reader = + hound::WavReader::new(&include_bytes!("../../audio/hello-transcribe-8000.wav")[..]) + .expect("valid wav data"); let samples_result: hound::Result> = reader.into_samples::().collect(); let mut pcm: Vec = Vec::new(); diff --git a/tools/ci-cdk/canary-runner/additional-ci b/tools/ci-cdk/canary-runner/additional-ci deleted file mode 100755 index 14e8002b88cee2dc0965f5cb72a2ca7001a6c2fb..0000000000000000000000000000000000000000 --- a/tools/ci-cdk/canary-runner/additional-ci +++ /dev/null @@ -1,5 +0,0 @@ -# run build-bundle on musl to verify that everything works -cargo run -- build-bundle \ - --sdk-release-tag release-2022-12-14 \ - --canary-path ../canary-lambda \ - --rust-version stable --musl diff --git a/tools/ci-cdk/canary-runner/src/build_bundle.rs b/tools/ci-cdk/canary-runner/src/build_bundle.rs index 1f0c4a3f9825b4d808bb685974be11ae2bec54d6..0d214f4d897f22d6649155ee5c5c811fe2c47f5f 100644 --- a/tools/ci-cdk/canary-runner/src/build_bundle.rs +++ b/tools/ci-cdk/canary-runner/src/build_bundle.rs @@ -65,7 +65,7 @@ const REQUIRED_SDK_CRATES: &[&str] = &[ lazy_static! { static ref NOTABLE_SDK_RELEASE_TAGS: Vec = vec![ - ReleaseTag::from_str("v0.4.1").unwrap(), // first version to add support for paginators + ReleaseTag::from_str("release-2023-01-26").unwrap(), // last version before the crate reorg ]; } @@ -116,11 +116,14 @@ fn enabled_features(crate_source: &CrateSource) -> Vec { let mut enabled = Vec::new(); if let CrateSource::VersionsManifest { release_tag, .. } = crate_source { for notable in NOTABLE_SDK_RELEASE_TAGS.iter() { - if notable < release_tag { + if notable <= release_tag { enabled.push(notable.as_str().into()); } } } + if enabled.is_empty() { + enabled.push("latest".into()); + } enabled } @@ -158,11 +161,12 @@ fn generate_crate_manifest(crate_source: CrateSource) -> Result { } } write!(output, "\n[features]\n").unwrap(); + writeln!(output, "latest = []").unwrap(); for release_tag in NOTABLE_SDK_RELEASE_TAGS.iter() { writeln!( output, "\"{release_tag}\" = []", - release_tag = release_tag.as_str().replace('-', "_") + release_tag = release_tag.as_str() ) .unwrap(); } @@ -436,8 +440,9 @@ aws-sdk-ec2 = { path = "some/sdk/path/ec2" } aws-sdk-transcribestreaming = { path = "some/sdk/path/transcribestreaming" } [features] -"v0.4.1" = [] -default = [] +latest = [] +"release-2023-01-26" = [] +default = ["latest"] "#, generate_crate_manifest(CrateSource::Path("some/sdk/path".into())).expect("success") ); @@ -499,8 +504,9 @@ aws-sdk-ec2 = "0.19.0" aws-sdk-transcribestreaming = "0.16.0" [features] -"v0.4.1" = [] -default = ["v0.4.1"] +latest = [] +"release-2023-01-26" = [] +default = ["release-2023-01-26"] "#, generate_crate_manifest(CrateSource::VersionsManifest { versions: VersionsManifest { @@ -517,7 +523,7 @@ default = ["v0.4.1"] .collect(), release: None, }, - release_tag: ReleaseTag::from_str("release-2022-07-26").unwrap(), + release_tag: ReleaseTag::from_str("release-2023-05-26").unwrap(), }) .expect("success") ); diff --git a/tools/ci-scripts/check-aws-sdk-canary b/tools/ci-scripts/check-aws-sdk-canary index fbeb310e03694b734e8dcb310cf7a094f636b042..73ce35f0472f94bb11effe52a47c80ccefef6a11 100755 --- a/tools/ci-scripts/check-aws-sdk-canary +++ b/tools/ci-scripts/check-aws-sdk-canary @@ -20,10 +20,11 @@ pushd tools/ci-cdk/canary-lambda # The canary-lambda doesn't have a Cargo.toml in a fresh checkout of smithy-rs, so generate one before checks pushd ../canary-runner echo "${C_YELLOW}## Generating Cargo.toml for the canary-lambda...${C_RESET}" -cargo run -- build-bundle --manifest-only --canary-path ../canary-lambda --sdk-path "${SDK_PATH}" +cargo run -- build-bundle --manifest-only --canary-path ../canary-lambda --sdk-path "${SDK_PATH}" --musl popd +# Note: This only checks the `latest` canary, and not any previous version features echo "${C_YELLOW}## Running 'cargo clippy' for the canary-lambda...${C_RESET}" -cargo clippy --all-features +cargo clippy popd