From e6177b3dc2625fb88c3433677339735b62154a86 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Wed, 14 Sep 2022 13:36:17 -0700 Subject: [PATCH 1/3] Fix native Smithy client retry and retry response errors (#1717) * Fix retry for native Smithy clients * Treat `SdkError::ResponseError` as a retryable transient failure * Rename `ClassifyResponse` to `ClassifyRetry` * Rename 'policy' to 'classifier' in AWS SDK public API * Rename `AwsResponseClassifier` to `AwsResponseRetryClassifier` Co-authored-by: Zelda Hessler --- CHANGELOG.next.toml | 44 ++++ .../src/http_credential_provider.rs | 26 ++- .../aws-config/src/imds/client.rs | 28 +-- .../aws-config/src/imds/client/token.rs | 4 +- aws/rust-runtime/aws-http/src/retry.rs | 125 ++++++----- .../tests/middleware_e2e_test.rs | 7 +- .../smithy/rustsdk/AwsCodegenDecorator.kt | 2 +- .../rustsdk/AwsFluentClientDecorator.kt | 8 +- ...corator.kt => RetryClassifierDecorator.kt} | 10 +- .../dynamodb/tests/movies.rs | 165 ++++---------- .../kms/tests/sensitive-it.rs | 10 +- .../smithy/generators/PaginatorGenerator.kt | 8 +- .../client/FluentClientGenerator.kt | 12 +- .../generators/client/FluentClientGenerics.kt | 8 +- .../protocol/MakeOperationGenerator.kt | 5 +- design/src/rfcs/rfc0010_waiters.md | 5 +- rust-runtime/aws-smithy-client/src/bounds.rs | 4 +- rust-runtime/aws-smithy-client/src/lib.rs | 2 +- rust-runtime/aws-smithy-client/src/retry.rs | 8 +- .../aws-smithy-client/src/static_tests.rs | 3 +- .../aws-smithy-client/tests/e2e_test.rs | 15 +- rust-runtime/aws-smithy-http-tower/src/lib.rs | 6 +- rust-runtime/aws-smithy-http/src/operation.rs | 21 +- rust-runtime/aws-smithy-http/src/retry.rs | 208 +++++++++++++++++- 24 files changed, 462 insertions(+), 272 deletions(-) rename aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/{RetryPolicyDecorator.kt => RetryClassifierDecorator.kt} (83%) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 4e13f28cd65..7d36001ddfd 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -192,3 +192,47 @@ message = "The AWS STS SDK now automatically retries `IDPCommunicationError` whe references = ["smithy-rs#966", "smithy-rs#1718"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "jdisanti" + +[[smithy-rs]] +message = "Generated clients now retry transient errors without replacing the retry policy." +references = ["smithy-rs#1715", "smithy-rs#1717"] +meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "client" } +author = "jdisanti" + +[[smithy-rs]] +message = "`ClassifyResponse` was renamed to `ClassifyRetry` and is no longer implemented for the unit type." +references = ["smithy-rs#1715", "smithy-rs#1717"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } +author = "jdisanti" + +[[smithy-rs]] +message = """ +The `with_retry_policy` and `retry_policy` functions on `aws_smithy_http::operation::Operation` have been +renamed to `with_retry_classifier` and `retry_classifier` respectively. Public member `retry_policy` on +`aws_smithy_http::operation::Parts` has been renamed to `retry_classifier`. +""" +references = ["smithy-rs#1715", "smithy-rs#1717"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } +author = "jdisanti" + +[[aws-sdk-rust]] +message = "The `SdkError::ResponseError`, typically caused by a connection terminating before the full response is received, is now treated as a transient failure and retried." +references = ["aws-sdk-rust#303", "smithy-rs#1717"] +meta = { "breaking" = false, "tada" = false, "bug" = true } +author = "jdisanti" + +[[aws-sdk-rust]] +message = "`ClassifyResponse` was renamed to `ClassifyRetry` and is no longer implemented for the unit type." +references = ["smithy-rs#1715", "smithy-rs#1717"] +meta = { "breaking" = true, "tada" = false, "bug" = false } +author = "jdisanti" + +[[aws-sdk-rust]] +message = """ +The `with_retry_policy` and `retry_policy` functions on `aws_smithy_http::operation::Operation` have been +renamed to `with_retry_classifier` and `retry_classifier` respectively. Public member `retry_policy` on +`aws_smithy_http::operation::Parts` has been renamed to `retry_classifier`. +""" +references = ["smithy-rs#1715", "smithy-rs#1717"] +meta = { "breaking" = true, "tada" = false, "bug" = false } +author = "jdisanti" diff --git a/aws/rust-runtime/aws-config/src/http_credential_provider.rs b/aws/rust-runtime/aws-config/src/http_credential_provider.rs index d77aa81ca62..2e6d6e137fa 100644 --- a/aws/rust-runtime/aws-config/src/http_credential_provider.rs +++ b/aws/rust-runtime/aws-config/src/http_credential_provider.rs @@ -14,7 +14,7 @@ use aws_smithy_http::body::SdkBody; use aws_smithy_http::operation::{Operation, Request}; use aws_smithy_http::response::ParseStrictResponse; use aws_smithy_http::result::{SdkError, SdkSuccess}; -use aws_smithy_http::retry::ClassifyResponse; +use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, RetryKind}; use aws_smithy_types::timeout; use aws_smithy_types::tristate::TriState; @@ -58,7 +58,7 @@ impl HttpCredentialProvider { fn operation( &self, auth: Option, - ) -> Operation { + ) -> Operation { let mut http_req = http::Request::builder() .uri(&self.uri) .header(ACCEPT, "application/json"); @@ -73,7 +73,7 @@ impl HttpCredentialProvider { provider_name: self.provider_name, }, ) - .with_retry_policy(HttpCredentialRetryPolicy) + .with_retry_classifier(HttpCredentialRetryClassifier) } } @@ -165,12 +165,12 @@ impl ParseStrictResponse for CredentialsResponseParser { } #[derive(Clone, Debug)] -struct HttpCredentialRetryPolicy; +struct HttpCredentialRetryClassifier; -impl ClassifyResponse, SdkError> - for HttpCredentialRetryPolicy +impl ClassifyRetry, SdkError> + for HttpCredentialRetryClassifier { - fn classify( + fn classify_retry( &self, response: Result<&SdkSuccess, &SdkError>, ) -> RetryKind { @@ -206,12 +206,14 @@ impl ClassifyResponse, SdkError> #[cfg(test)] mod test { - use crate::http_credential_provider::{CredentialsResponseParser, HttpCredentialRetryPolicy}; + use crate::http_credential_provider::{ + CredentialsResponseParser, HttpCredentialRetryClassifier, + }; use aws_smithy_http::body::SdkBody; use aws_smithy_http::operation; use aws_smithy_http::response::ParseStrictResponse; use aws_smithy_http::result::{SdkError, SdkSuccess}; - use aws_smithy_http::retry::ClassifyResponse; + use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, RetryKind}; use aws_types::credentials::CredentialsError; use aws_types::Credentials; @@ -245,7 +247,7 @@ mod test { .unwrap(); assert_eq!( - HttpCredentialRetryPolicy.classify(sdk_resp(bad_response).as_ref()), + HttpCredentialRetryClassifier.classify_retry(sdk_resp(bad_response).as_ref()), RetryKind::Error(ErrorKind::ServerError) ); } @@ -266,7 +268,7 @@ mod test { let sdk_result = sdk_resp(ok_response); assert_eq!( - HttpCredentialRetryPolicy.classify(sdk_result.as_ref()), + HttpCredentialRetryClassifier.classify_retry(sdk_result.as_ref()), RetryKind::Unnecessary ); @@ -281,7 +283,7 @@ mod test { .unwrap(); let sdk_result = sdk_resp(error_response); assert_eq!( - HttpCredentialRetryPolicy.classify(sdk_result.as_ref()), + HttpCredentialRetryClassifier.classify_retry(sdk_result.as_ref()), RetryKind::UnretryableFailure ); let sdk_error = sdk_result.expect_err("should be error"); diff --git a/aws/rust-runtime/aws-config/src/imds/client.rs b/aws/rust-runtime/aws-config/src/imds/client.rs index 8f30468bcdd..9e1fd43c7de 100644 --- a/aws/rust-runtime/aws-config/src/imds/client.rs +++ b/aws/rust-runtime/aws-config/src/imds/client.rs @@ -23,7 +23,7 @@ use aws_smithy_http::endpoint::Endpoint; use aws_smithy_http::operation; use aws_smithy_http::operation::{Metadata, Operation}; use aws_smithy_http::response::ParseStrictResponse; -use aws_smithy_http::retry::ClassifyResponse; +use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_http_tower::map_request::{ AsyncMapRequestLayer, AsyncMapRequestService, MapRequestLayer, MapRequestService, }; @@ -232,7 +232,7 @@ impl Client { fn make_operation( &self, path: &str, - ) -> Result, ImdsError> { + ) -> Result, ImdsError> { let mut base_uri: Uri = path.parse().map_err(|_| ImdsError::InvalidPath)?; self.inner.endpoint.set_endpoint(&mut base_uri, None); let request = http::Request::builder() @@ -243,7 +243,7 @@ impl Client { request.properties_mut().insert(user_agent()); Ok(Operation::new(request, ImdsGetResponseHandler) .with_metadata(Metadata::new("get", "imds")) - .with_retry_policy(ImdsErrorPolicy)) + .with_retry_classifier(ImdsResponseRetryClassifier)) } } @@ -706,9 +706,9 @@ impl Display for TokenError { impl Error for TokenError {} #[derive(Clone)] -struct ImdsErrorPolicy; +struct ImdsResponseRetryClassifier; -impl ImdsErrorPolicy { +impl ImdsResponseRetryClassifier { fn classify(response: &operation::Response) -> RetryKind { let status = response.http().status(); match status { @@ -721,7 +721,7 @@ impl ImdsErrorPolicy { } } -/// IMDS Retry Policy +/// IMDS Response Retry Classifier /// /// Possible status codes: /// - 200 (OK) @@ -730,12 +730,12 @@ impl ImdsErrorPolicy { /// - 403 (IMDS disabled): **Not Retryable** /// - 404 (Not found): **Not Retryable** /// - >=500 (server error): **Retryable** -impl ClassifyResponse, SdkError> for ImdsErrorPolicy { - fn classify(&self, response: Result<&SdkSuccess, &SdkError>) -> RetryKind { +impl ClassifyRetry, SdkError> for ImdsResponseRetryClassifier { + fn classify_retry(&self, response: Result<&SdkSuccess, &SdkError>) -> RetryKind { match response { Ok(_) => RetryKind::Unnecessary, Err(SdkError::ResponseError { raw, .. }) | Err(SdkError::ServiceError { raw, .. }) => { - ImdsErrorPolicy::classify(raw) + Self::classify(raw) } _ => RetryKind::UnretryableFailure, } @@ -744,7 +744,7 @@ impl ClassifyResponse, SdkError> for ImdsErrorPolicy { #[cfg(test)] pub(crate) mod test { - use crate::imds::client::{Client, EndpointMode, ImdsErrorPolicy}; + use crate::imds::client::{Client, EndpointMode, ImdsResponseRetryClassifier}; use crate::provider_config::ProviderConfig; use aws_smithy_async::rt::sleep::TokioSleep; use aws_smithy_client::erase::DynConnector; @@ -1033,9 +1033,9 @@ pub(crate) mod test { /// Successful responses should classify as `RetryKind::Unnecessary` #[test] fn successful_response_properly_classified() { - use aws_smithy_http::retry::ClassifyResponse; + use aws_smithy_http::retry::ClassifyRetry; - let policy = ImdsErrorPolicy; + let classifier = ImdsResponseRetryClassifier; fn response_200() -> operation::Response { operation::Response::new(imds_response("").map(|_| SdkBody::empty())) } @@ -1045,7 +1045,7 @@ pub(crate) mod test { }; assert_eq!( RetryKind::Unnecessary, - policy.classify(Ok::<_, &SdkError<()>>(&success)) + classifier.classify_retry(Ok::<_, &SdkError<()>>(&success)) ); // Emulate a failure to parse the response body (using an io error since it's easy to construct in a test) @@ -1055,7 +1055,7 @@ pub(crate) mod test { }; assert_eq!( RetryKind::UnretryableFailure, - policy.classify(Err::<&SdkSuccess<()>, _>(&failure)) + classifier.classify_retry(Err::<&SdkSuccess<()>, _>(&failure)) ); } diff --git a/aws/rust-runtime/aws-config/src/imds/client/token.rs b/aws/rust-runtime/aws-config/src/imds/client/token.rs index 52db23d259d..ba14c092b8b 100644 --- a/aws/rust-runtime/aws-config/src/imds/client/token.rs +++ b/aws/rust-runtime/aws-config/src/imds/client/token.rs @@ -38,7 +38,7 @@ use aws_types::os_shim_internal::TimeSource; use http::{HeaderValue, Uri}; use crate::cache::ExpiringCache; -use crate::imds::client::{ImdsError, ImdsErrorPolicy, TokenError}; +use crate::imds::client::{ImdsError, ImdsResponseRetryClassifier, TokenError}; /// Token Refresh Buffer /// @@ -143,7 +143,7 @@ impl TokenMiddleware { request.properties_mut().insert(super::user_agent()); let operation = Operation::new(request, self.token_parser.clone()) - .with_retry_policy(ImdsErrorPolicy) + .with_retry_classifier(ImdsResponseRetryClassifier) .with_metadata(Metadata::new("get-token", "imds")); let response = self .client diff --git a/aws/rust-runtime/aws-http/src/retry.rs b/aws/rust-runtime/aws-http/src/retry.rs index 748d9584159..4ee9a3c792a 100644 --- a/aws/rust-runtime/aws-http/src/retry.rs +++ b/aws/rust-runtime/aws-http/src/retry.rs @@ -5,21 +5,10 @@ //! AWS-specific retry logic use aws_smithy_http::result::SdkError; -use aws_smithy_http::retry::ClassifyResponse; +use aws_smithy_http::retry::{ClassifyRetry, DefaultResponseRetryClassifier}; use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind}; use std::time::Duration; -/// A retry policy that models AWS error codes as outlined in the SEP -/// -/// In order of priority: -/// 1. The `x-amz-retry-after` header is checked -/// 2. The modeled error retry mode is checked -/// 3. The code is checked against a predetermined list of throttling errors & transient error codes -/// 4. The status code is checked against a predetermined list of status codes -#[non_exhaustive] -#[derive(Clone, Debug)] -pub struct AwsErrorRetryPolicy; - const TRANSIENT_ERROR_STATUS_CODES: &[u16] = &[500, 502, 503, 504]; const THROTTLING_ERRORS: &[&str] = &[ "Throttling", @@ -39,41 +28,42 @@ const THROTTLING_ERRORS: &[&str] = &[ ]; const TRANSIENT_ERRORS: &[&str] = &["RequestTimeout", "RequestTimeoutException"]; -impl AwsErrorRetryPolicy { - /// Create an `AwsErrorRetryPolicy` with the default set of known error & status codes +/// Implementation of [`ClassifyRetry`] that classifies AWS error codes. +/// +/// In order of priority: +/// 1. The `x-amz-retry-after` header is checked +/// 2. The modeled error retry mode is checked +/// 3. The code is checked against a predetermined list of throttling errors & transient error codes +/// 4. The status code is checked against a predetermined list of status codes +#[non_exhaustive] +#[derive(Clone, Debug)] +pub struct AwsResponseRetryClassifier; + +impl AwsResponseRetryClassifier { + /// Create an `AwsResponseRetryClassifier` with the default set of known error & status codes pub fn new() -> Self { - AwsErrorRetryPolicy + Self } } -impl Default for AwsErrorRetryPolicy { +impl Default for AwsResponseRetryClassifier { fn default() -> Self { Self::new() } } -impl ClassifyResponse> for AwsErrorRetryPolicy +impl ClassifyRetry> for AwsResponseRetryClassifier where E: ProvideErrorKind, { - fn classify(&self, err: Result<&T, &SdkError>) -> RetryKind { - let (err, response) = match err { - Ok(_) => return RetryKind::Unnecessary, - Err(SdkError::ServiceError { err, raw }) => (err, raw), - Err(SdkError::TimeoutError(_err)) => { - return RetryKind::Error(ErrorKind::TransientError) - } - - Err(SdkError::DispatchFailure(err)) => { - return if err.is_timeout() || err.is_io() { - RetryKind::Error(ErrorKind::TransientError) - } else if let Some(ek) = err.is_other() { - RetryKind::Error(ek) - } else { - RetryKind::UnretryableFailure - }; - } - Err(_) => return RetryKind::UnretryableFailure, + fn classify_retry(&self, result: Result<&T, &SdkError>) -> RetryKind { + // Run common retry classification logic from aws-smithy-http, and if it yields + // a `RetryKind`, then return that immediately. Otherwise, continue on to run some + // AWS SDK specific classification logic. + let (err, response) = match DefaultResponseRetryClassifier::try_extract_err_response(result) + { + Ok(extracted) => extracted, + Err(retry_kind) => return retry_kind, }; if let Some(retry_after_delay) = response .http() @@ -105,15 +95,23 @@ where #[cfg(test)] mod test { - use crate::retry::AwsErrorRetryPolicy; + use crate::retry::AwsResponseRetryClassifier; use aws_smithy_http::body::SdkBody; use aws_smithy_http::operation; use aws_smithy_http::result::{SdkError, SdkSuccess}; - use aws_smithy_http::retry::ClassifyResponse; + use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind}; + use std::fmt; use std::time::Duration; + #[derive(Debug)] struct UnmodeledError; + impl fmt::Display for UnmodeledError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "UnmodeledError") + } + } + impl std::error::Error for UnmodeledError {} struct CodedError { code: &'static str, @@ -151,36 +149,36 @@ mod test { #[test] fn not_an_error() { - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); let test_response = http::Response::new("OK"); assert_eq!( - policy.classify(make_err(UnmodeledError, test_response).as_ref()), + policy.classify_retry(make_err(UnmodeledError, test_response).as_ref()), RetryKind::UnretryableFailure ); } #[test] fn classify_by_response_status() { - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); let test_resp = http::Response::builder() .status(500) .body("error!") .unwrap(); assert_eq!( - policy.classify(make_err(UnmodeledError, test_resp).as_ref()), + policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()), RetryKind::Error(ErrorKind::TransientError) ); } #[test] fn classify_by_response_status_not_retryable() { - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); let test_resp = http::Response::builder() .status(408) .body("error!") .unwrap(); assert_eq!( - policy.classify(make_err(UnmodeledError, test_resp).as_ref()), + policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()), RetryKind::UnretryableFailure ); } @@ -188,16 +186,18 @@ mod test { #[test] fn classify_by_error_code() { let test_response = http::Response::new("OK"); - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); assert_eq!( - policy.classify(make_err(CodedError { code: "Throttling" }, test_response).as_ref()), + policy.classify_retry( + make_err(CodedError { code: "Throttling" }, test_response).as_ref() + ), RetryKind::Error(ErrorKind::ThrottlingError) ); let test_response = http::Response::new("OK"); assert_eq!( - policy.classify( + policy.classify_retry( make_err( CodedError { code: "RequestTimeout" @@ -214,9 +214,9 @@ mod test { fn classify_generic() { let err = aws_smithy_types::Error::builder().code("SlowDown").build(); let test_response = http::Response::new("OK"); - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); assert_eq!( - policy.classify(make_err(err, test_response).as_ref()), + policy.classify_retry(make_err(err, test_response).as_ref()), RetryKind::Error(ErrorKind::ThrottlingError) ); } @@ -236,34 +236,51 @@ mod test { } } - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); assert_eq!( - policy.classify(make_err(ModeledRetries, test_response).as_ref()), + policy.classify_retry(make_err(ModeledRetries, test_response).as_ref()), RetryKind::Error(ErrorKind::ClientError) ); } #[test] fn test_retry_after_header() { - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); let test_response = http::Response::builder() .header("x-amz-retry-after", "5000") .body("retry later") .unwrap(); assert_eq!( - policy.classify(make_err(UnmodeledError, test_response).as_ref()), + policy.classify_retry(make_err(UnmodeledError, test_response).as_ref()), RetryKind::Explicit(Duration::from_millis(5000)) ); } + #[test] + fn classify_response_error() { + let policy = AwsResponseRetryClassifier::new(); + assert_eq!( + policy.classify_retry( + Result::, SdkError>::Err(SdkError::ResponseError { + err: Box::new(UnmodeledError), + raw: operation::Response::new( + http::Response::new("OK").map(|b| SdkBody::from(b)) + ), + }) + .as_ref() + ), + RetryKind::Error(ErrorKind::TransientError) + ); + } + #[test] fn test_timeout_error() { - let policy = AwsErrorRetryPolicy::new(); + let policy = AwsResponseRetryClassifier::new(); let err: Result<(), SdkError> = Err(SdkError::TimeoutError("blah".into())); assert_eq!( - policy.classify(err.as_ref()), + policy.classify_retry(err.as_ref()), RetryKind::Error(ErrorKind::TransientError) ); } diff --git a/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs b/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs index bfec2313d40..23932395dbf 100644 --- a/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs +++ b/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs @@ -15,7 +15,7 @@ use http::{self, Uri}; use aws_endpoint::partition::endpoint::{Protocol, SignatureVersion}; use aws_endpoint::{EndpointShim, Params}; -use aws_http::retry::AwsErrorRetryPolicy; +use aws_http::retry::AwsResponseRetryClassifier; use aws_http::user_agent::AwsUserAgent; use aws_inlineable::middleware::DefaultMiddleware; use aws_sig_auth::signer::OperationSigningConfig; @@ -75,7 +75,7 @@ impl ParseHttpResponse for TestOperationParser { } } -fn test_operation() -> Operation { +fn test_operation() -> Operation { let req = operation::Request::new( http::Request::builder() .uri("https://test-service.test-region.amazonaws.com/") @@ -110,7 +110,8 @@ fn test_operation() -> Operation { Result::<_, Infallible>::Ok(req) }) .unwrap(); - Operation::new(req, TestOperationParser).with_retry_policy(AwsErrorRetryPolicy::new()) + Operation::new(req, TestOperationParser) + .with_retry_classifier(AwsResponseRetryClassifier::new()) } #[cfg(any(feature = "native-tls", feature = "rustls"))] diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt index d228a609497..f63e7078d88 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt @@ -26,7 +26,7 @@ val DECORATORS = listOf( SigV4SigningDecorator(), HttpRequestChecksumDecorator(), HttpResponseChecksumDecorator(), - RetryPolicyDecorator(), + RetryClassifierDecorator(), IntegrationTestDecorator(), AwsFluentClientDecorator(), CrateLicenseDecorator(), diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt index aa49746e155..746443223bf 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt @@ -74,7 +74,7 @@ private class AwsClientGenerics(private val types: Types) : FluentClientGenerics override val bounds = writable { } /** Bounds for generated `send()` functions */ - override fun sendBounds(operation: Symbol, operationOutput: Symbol, operationError: RuntimeType, retryPolicy: Writable): Writable = writable { } + override fun sendBounds(operation: Symbol, operationOutput: Symbol, operationError: RuntimeType, retryClassifier: RuntimeType): Writable = writable { } override fun toGenericsGenerator(): GenericsGenerator { return GenericsGenerator() @@ -98,7 +98,7 @@ class AwsFluentClientDecorator : RustCodegenDecorator { AwsPresignedFluentBuilderMethod(runtimeConfig), AwsFluentClientDocs(codegenContext), ), - retryPolicy = runtimeConfig.awsHttp().asType().member("retry::AwsErrorRetryPolicy").writable, + retryClassifier = runtimeConfig.awsHttp().asType().member("retry::AwsResponseRetryClassifier"), ).render(rustCrate) rustCrate.withModule(FluentClientGenerator.customizableOperationModule) { writer -> renderCustomizableOperationSendMethod(runtimeConfig, generics, writer) @@ -282,7 +282,7 @@ private fun renderCustomizableOperationSendMethod( "combined_generics_decl" to combinedGenerics.declaration(), "handle_generics_bounds" to handleGenerics.bounds(), "SdkSuccess" to smithyHttp.member("result::SdkSuccess"), - "ClassifyResponse" to smithyHttp.member("retry::ClassifyResponse"), + "ClassifyRetry" to smithyHttp.member("retry::ClassifyRetry"), "ParseHttpResponse" to smithyHttp.member("response::ParseHttpResponse"), ) @@ -297,7 +297,7 @@ private fun renderCustomizableOperationSendMethod( where E: std::error::Error, O: #{ParseHttpResponse}> + Send + Sync + Clone + 'static, - Retry: #{ClassifyResponse}<#{SdkSuccess}, SdkError> + Send + Sync + Clone, + Retry: #{ClassifyRetry}<#{SdkSuccess}, SdkError> + Send + Sync + Clone, { self.handle.client.call(self.operation).await } diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryPolicyDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryClassifierDecorator.kt similarity index 83% rename from aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryPolicyDecorator.kt rename to aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryClassifierDecorator.kt index dfb0bbdf599..30d3126f406 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryPolicyDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RetryClassifierDecorator.kt @@ -17,7 +17,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCust import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator -class RetryPolicyDecorator : RustCodegenDecorator { +class RetryClassifierDecorator : RustCodegenDecorator { override val name: String = "RetryPolicy" override val order: Byte = 0 @@ -26,19 +26,19 @@ class RetryPolicyDecorator : RustCodegenDecorator { operation: OperationShape, baseCustomizations: List, ): List { - return baseCustomizations + RetryPolicyFeature(codegenContext.runtimeConfig) + return baseCustomizations + RetryClassifierFeature(codegenContext.runtimeConfig) } override fun supportsCodegenContext(clazz: Class): Boolean = clazz.isAssignableFrom(ClientCodegenContext::class.java) } -class RetryPolicyFeature(private val runtimeConfig: RuntimeConfig) : OperationCustomization() { - override fun retryType(): RuntimeType = runtimeConfig.awsHttp().asType().member("retry::AwsErrorRetryPolicy") +class RetryClassifierFeature(private val runtimeConfig: RuntimeConfig) : OperationCustomization() { + override fun retryType(): RuntimeType = runtimeConfig.awsHttp().asType().member("retry::AwsResponseRetryClassifier") override fun section(section: OperationSection) = when (section) { is OperationSection.FinalizeOperation -> writable { rust( - "let ${section.operation} = ${section.operation}.with_retry_policy(#T::new());", + "let ${section.operation} = ${section.operation}.with_retry_classifier(#T::new());", retryType(), ) } diff --git a/aws/sdk/integration-tests/dynamodb/tests/movies.rs b/aws/sdk/integration-tests/dynamodb/tests/movies.rs index c3a0f079ade..c6cded6c0f9 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/movies.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/movies.rs @@ -4,24 +4,14 @@ */ use aws_sdk_dynamodb as dynamodb; - -use aws_http::retry::AwsErrorRetryPolicy; -use aws_sdk_dynamodb::input::CreateTableInput; use aws_smithy_client::test_connection::TestConnection; use aws_smithy_http::body::SdkBody; -use aws_smithy_http::operation::Operation; -use aws_smithy_http::result::{SdkError, SdkSuccess}; -use aws_smithy_http::retry::ClassifyResponse; -use aws_smithy_types::retry::RetryKind; -use dynamodb::error::DescribeTableError; -use dynamodb::input::{DescribeTableInput, PutItemInput, QueryInput}; use dynamodb::model::{ AttributeDefinition, AttributeValue, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType, TableStatus, }; -use dynamodb::operation::{CreateTable, DescribeTable}; -use dynamodb::output::DescribeTableOutput; -use dynamodb::{Config, Credentials, Region}; +use dynamodb::output::QueryOutput; +use dynamodb::{Client, Credentials, Region}; use http::header::{HeaderName, AUTHORIZATION}; use http::Uri; use serde_json::Value; @@ -29,12 +19,9 @@ use std::collections::HashMap; use std::time::Duration; use tokio::time::Instant; -use aws_sdk_dynamodb::middleware::DefaultMiddleware; -use aws_smithy_client::Client as CoreClient; -pub type Client = CoreClient; - -fn create_table(table_name: &str) -> CreateTableInput { - CreateTable::builder() +async fn create_table(client: &Client, table_name: &str) { + client + .create_table() .table_name(table_name) .key_schema( KeySchemaElement::builder() @@ -66,8 +53,9 @@ fn create_table(table_name: &str) -> CreateTableInput { .write_capacity_units(10) .build(), ) - .build() - .expect("valid operation") + .send() + .await + .expect("failed to create table"); } fn value_to_item(value: Value) -> AttributeValue { @@ -83,92 +71,57 @@ fn value_to_item(value: Value) -> AttributeValue { } } -fn add_item(table_name: impl Into, item: Value) -> PutItemInput { +async fn add_item(client: &Client, table_name: impl Into, item: Value) { let attribute_value = match value_to_item(item) { AttributeValue::M(map) => map, other => panic!("can only insert top level values, got {:?}", other), }; - PutItemInput::builder() + client + .put_item() .table_name(table_name) .set_item(Some(attribute_value)) - .build() - .expect("valid operation") + .send() + .await + .expect("valid operation"); } -fn movies_in_year(table_name: &str, year: u16) -> QueryInput { +async fn movies_in_year(client: &Client, table_name: &str, year: u16) -> QueryOutput { let mut expr_attrib_names = HashMap::new(); expr_attrib_names.insert("#yr".to_string(), "year".to_string()); let mut expr_attrib_values = HashMap::new(); expr_attrib_values.insert(":yyyy".to_string(), AttributeValue::N(year.to_string())); - QueryInput::builder() + + client + .query() .table_name(table_name) .key_condition_expression("#yr = :yyyy") .set_expression_attribute_names(Some(expr_attrib_names)) .set_expression_attribute_values(Some(expr_attrib_values)) - .build() + .send() + .await .expect("valid operation") } -/// Hand-written waiter to retry every second until the table is out of `Creating` state -#[derive(Clone)] -struct WaitForReadyTable { - inner: R, -} - -impl ClassifyResponse, SdkError> - for WaitForReadyTable -where - R: ClassifyResponse, SdkError>, -{ - fn classify( - &self, - response: Result<&SdkSuccess, &SdkError>, - ) -> RetryKind { - match self.inner.classify(response) { - RetryKind::UnretryableFailure | RetryKind::Unnecessary => (), - other => return other, - }; - match response { - Ok(SdkSuccess { parsed, .. }) => { - if parsed - .table - .as_ref() - .unwrap() - .table_status - .as_ref() - .unwrap() - == &TableStatus::Creating - { - RetryKind::Explicit(Duration::from_secs(1)) - } else { - RetryKind::Unnecessary - } +/// Poll the DescribeTable operation once per second until the table exists. +async fn wait_for_ready_table(client: &Client, table_name: &str) { + loop { + if let Some(table) = client + .describe_table() + .table_name(table_name) + .send() + .await + .expect("success") + .table() + { + if !matches!(table.table_status, Some(TableStatus::Creating)) { + break; } - _ => RetryKind::UnretryableFailure, } + tokio::time::sleep(Duration::from_secs(1)).await; } } -/// Construct a `DescribeTable` request with a policy to retry every second until the table -/// is ready -async fn wait_for_ready_table( - table_name: &str, - conf: &Config, -) -> Operation> { - let operation = DescribeTableInput::builder() - .table_name(table_name) - .build() - .unwrap() - .make_operation(&conf) - .await - .expect("valid operation"); - let waiting_policy = WaitForReadyTable { - inner: operation.retry_policy().clone(), - }; - operation.with_retry_policy(waiting_policy) -} - /// Validate that time has passed with a 5ms tolerance /// /// This is to account for some non-determinism in the Tokio timer @@ -193,7 +146,6 @@ async fn movies_it() { // The waiter will retry 5 times tokio::time::pause(); let conn = movies_it_test_connection(); // RecordingConnection::https(); - let client = Client::new(conn.clone()); let conf = dynamodb::Config::builder() .region(Region::new("us-east-1")) .credentials_provider(Credentials::new( @@ -204,21 +156,12 @@ async fn movies_it() { "test", )) .build(); - client - .call( - create_table(table_name) - .make_operation(&conf) - .await - .expect("valid request"), - ) - .await - .expect("failed to create table"); + let client = Client::from_conf_conn(conf, conn.clone()); + + create_table(&client, table_name).await; let waiter_start = tokio::time::Instant::now(); - client - .call(wait_for_ready_table(table_name, &conf).await) - .await - .expect("table should become ready"); + wait_for_ready_table(&client, table_name).await; assert_time_passed(waiter_start, Duration::from_secs(4)); // data.json contains 2 movies from 2013 @@ -228,37 +171,13 @@ async fn movies_it() { data => panic!("data must be an array, got: {:?}", data), }; for item in data { - client - .call( - add_item(table_name, item.clone()) - .make_operation(&conf) - .await - .expect("valid request"), - ) - .await - .expect("failed to insert item"); + add_item(&client, table_name, item.clone()).await; } - let films_2222 = client - .call( - movies_in_year(table_name, 2222) - .make_operation(&conf) - .await - .expect("valid request"), - ) - .await - .expect("query should succeed"); - // this isn't back to the future, there are no movies from 2022 + let films_2222 = movies_in_year(&client, table_name, 2222).await; + // this isn't "Back To The Future", there are no movies from 2222 assert_eq!(films_2222.count, 0); - let films_2013 = client - .call( - movies_in_year(table_name, 2013) - .make_operation(&conf) - .await - .expect("valid request"), - ) - .await - .expect("query should succeed"); + let films_2013 = movies_in_year(&client, table_name, 2013).await; assert_eq!(films_2013.count, 2); let titles: Vec = films_2013 .items diff --git a/aws/sdk/integration-tests/kms/tests/sensitive-it.rs b/aws/sdk/integration-tests/kms/tests/sensitive-it.rs index ec49cdd08b2..610d40dfe21 100644 --- a/aws/sdk/integration-tests/kms/tests/sensitive-it.rs +++ b/aws/sdk/integration-tests/kms/tests/sensitive-it.rs @@ -3,13 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_http::retry::AwsErrorRetryPolicy; +use aws_http::retry::AwsResponseRetryClassifier; use aws_sdk_kms as kms; use aws_smithy_http::body::SdkBody; use aws_smithy_http::operation::{self, Parts}; use aws_smithy_http::response::ParseStrictResponse; use aws_smithy_http::result::SdkError; -use aws_smithy_http::retry::ClassifyResponse; +use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, RetryKind}; use bytes::Bytes; use kms::error::CreateAliasError; @@ -65,7 +65,7 @@ fn types_are_debug() { assert_debug::(); } -async fn create_alias_op() -> Parts { +async fn create_alias_op() -> Parts { let conf = kms::Config::builder().build(); let (_, parts) = CreateAlias::builder() .build() @@ -94,7 +94,7 @@ async fn errors_are_retryable() { err: e, raw: operation::Response::new(http_response.map(SdkBody::from)), }); - let retry_kind = op.retry_policy.classify(err.as_ref()); + let retry_kind = op.retry_classifier.classify_retry(err.as_ref()); assert_eq!(retry_kind, RetryKind::Error(ErrorKind::ThrottlingError)); } @@ -112,6 +112,6 @@ async fn unmodeled_errors_are_retryable() { err: e, raw: operation::Response::new(http_response.map(SdkBody::from)), }); - let retry_kind = op.retry_policy.classify(err.as_ref()); + let retry_kind = op.retry_classifier.classify_retry(err.as_ref()); assert_eq!(retry_kind, RetryKind::Error(ErrorKind::ThrottlingError)); } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt index 052e196f0b1..9c1873627a3 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt @@ -48,14 +48,14 @@ class PaginatorGenerator private constructor( service: ServiceShape, operation: OperationShape, private val generics: FluentClientGenerics, - retryPolicy: Writable = RustType.Unit.writable, + retryClassifier: RuntimeType, ) { companion object { fun paginatorType( coreCodegenContext: CoreCodegenContext, generics: FluentClientGenerics, operationShape: OperationShape, - retryPolicy: Writable = RustType.Unit.writable, + retryClassifier: RuntimeType, ): RuntimeType? { return if (operationShape.isPaginated(coreCodegenContext.model)) { PaginatorGenerator( @@ -64,7 +64,7 @@ class PaginatorGenerator private constructor( coreCodegenContext.serviceShape, operationShape, generics, - retryPolicy, + retryClassifier, ).paginatorType() } else { null @@ -98,7 +98,7 @@ class PaginatorGenerator private constructor( "generics" to generics.decl, "bounds" to generics.bounds, "page_size_setter" to pageSizeSetter(), - "send_bounds" to generics.sendBounds(symbolProvider.toSymbol(operation), outputType, errorType, retryPolicy), + "send_bounds" to generics.sendBounds(symbolProvider.toSymbol(operation), outputType, errorType, retryClassifier), // Operation Types "operation" to symbolProvider.toSymbol(operation), diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt index 8699c19c2ca..c0e53cf052e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt @@ -17,7 +17,6 @@ import software.amazon.smithy.rust.codegen.client.rustlang.RustModule import software.amazon.smithy.rust.codegen.client.rustlang.RustReservedWords import software.amazon.smithy.rust.codegen.client.rustlang.RustType import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter -import software.amazon.smithy.rust.codegen.client.rustlang.Writable import software.amazon.smithy.rust.codegen.client.rustlang.asArgumentType import software.amazon.smithy.rust.codegen.client.rustlang.asOptional import software.amazon.smithy.rust.codegen.client.rustlang.asType @@ -67,7 +66,8 @@ class FluentClientGenerator( client = CargoDependency.SmithyClient(codegenContext.runtimeConfig).asType(), ), private val customizations: List = emptyList(), - private val retryPolicy: Writable = RustType.Unit.writable, + private val retryClassifier: RuntimeType = CargoDependency.SmithyHttp(codegenContext.runtimeConfig).asType() + .member("retry::DefaultResponseRetryClassifier"), ) { companion object { fun clientOperationFnName(operationShape: OperationShape, symbolProvider: RustSymbolProvider): String = @@ -317,19 +317,19 @@ class FluentClientGenerator( self.handle.client.call(op).await } """, - "ClassifyResponse" to runtimeConfig.smithyHttp().member("retry::ClassifyResponse"), + "ClassifyRetry" to runtimeConfig.smithyHttp().member("retry::ClassifyRetry"), "OperationError" to errorType, "OperationOutput" to outputType, "SdkError" to runtimeConfig.smithyHttp().member("result::SdkError"), "SdkSuccess" to runtimeConfig.smithyHttp().member("result::SdkSuccess"), - "send_bounds" to generics.sendBounds(operationSymbol, outputType, errorType, retryPolicy), + "send_bounds" to generics.sendBounds(operationSymbol, outputType, errorType, retryClassifier), "customizable_op_type_params" to rustTypeParameters( symbolProvider.toSymbol(operation), - retryPolicy, + retryClassifier, generics.toGenericsGenerator(), ), ) - PaginatorGenerator.paginatorType(codegenContext, generics, operation, retryPolicy)?.also { paginatorType -> + PaginatorGenerator.paginatorType(codegenContext, generics, operation, retryClassifier)?.also { paginatorType -> rustTemplate( """ /// Create a paginator for this request diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerics.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerics.kt index 7ae3c0033f2..e5300d1a053 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerics.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerics.kt @@ -28,7 +28,7 @@ interface FluentClientGenerics { val bounds: Writable /** Bounds for generated `send()` functions */ - fun sendBounds(input: Symbol, output: Symbol, error: RuntimeType, retryPolicy: Writable): Writable + fun sendBounds(operation: Symbol, output: Symbol, error: RuntimeType, retryClassifier: RuntimeType): Writable /** Convert this `FluentClientGenerics` into the more general `GenericsGenerator` */ fun toGenericsGenerator(): GenericsGenerator @@ -70,7 +70,7 @@ data class FlexibleClientGenerics( } /** Bounds for generated `send()` functions */ - override fun sendBounds(operation: Symbol, operationOutput: Symbol, operationError: RuntimeType, retryPolicy: Writable): Writable = writable { + override fun sendBounds(operation: Symbol, operationOutput: Symbol, operationError: RuntimeType, retryClassifier: RuntimeType): Writable = writable { rustTemplate( """ where @@ -78,14 +78,14 @@ data class FlexibleClientGenerics( #{Operation}, #{OperationOutput}, #{OperationError}, - #{RetryPolicy:W} + #{RetryClassifier} > """, "client" to client, "Operation" to operation, "OperationOutput" to operationOutput, "OperationError" to operationError, - "RetryPolicy" to retryPolicy, + "RetryClassifier" to retryClassifier, ) } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt index 2d781e24f2b..2771e7b3457 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt @@ -10,7 +10,6 @@ import software.amazon.smithy.model.shapes.BlobShape import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.rust.codegen.client.rustlang.Attribute import software.amazon.smithy.rust.codegen.client.rustlang.CargoDependency -import software.amazon.smithy.rust.codegen.client.rustlang.RustType import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.docs @@ -48,6 +47,8 @@ open class MakeOperationGenerator( protected val runtimeConfig = coreCodegenContext.runtimeConfig protected val symbolProvider = coreCodegenContext.symbolProvider protected val httpBindingResolver = protocol.httpBindingResolver + private val defaultClassifier = CargoDependency.SmithyHttp(runtimeConfig) + .asType().member("retry::DefaultResponseRetryClassifier") private val sdkId = coreCodegenContext.serviceShape.getTrait()?.sdkId?.lowercase()?.replace(" ", "") @@ -152,7 +153,7 @@ open class MakeOperationGenerator( writer.format(symbolProvider.toSymbol(shape)) private fun buildOperationTypeRetry(writer: RustWriter, customizations: List): String = - (customizations.firstNotNullOfOrNull { it.retryType() } ?: RustType.Unit).let { writer.format(it) } + (customizations.firstNotNullOfOrNull { it.retryType() } ?: defaultClassifier).let { writer.format(it) } private fun needsContentLength(operationShape: OperationShape): Boolean { return protocol.httpBindingResolver.requestBindings(operationShape) diff --git a/design/src/rfcs/rfc0010_waiters.md b/design/src/rfcs/rfc0010_waiters.md index ba6293b98f4..f738f0f3579 100644 --- a/design/src/rfcs/rfc0010_waiters.md +++ b/design/src/rfcs/rfc0010_waiters.md @@ -146,9 +146,8 @@ pub async fn wait( .map_err(|err| { aws_smithy_http::result::SdkError::ConstructionFailure(err.into()) })?; - // The `ClassifyResponse` trait is implemented for `()` as never retry, - // so this disables the default retry for the operation - let operation = operation.with_retry_policy(()); + // Assume `ClassifyRetry` trait is implemented for `NeverRetry` to always return `RetryKind::Unnecessary` + let operation = operation.with_retry_classifier(NeverRetry::new()); let result = handle.client.call(operation).await; match classify_result(&input, result) { diff --git a/rust-runtime/aws-smithy-client/src/bounds.rs b/rust-runtime/aws-smithy-client/src/bounds.rs index 13c64434977..32478e1d12c 100644 --- a/rust-runtime/aws-smithy-client/src/bounds.rs +++ b/rust-runtime/aws-smithy-client/src/bounds.rs @@ -135,7 +135,7 @@ pub trait SmithyRetryPolicy: /// Forwarding type to `Retry` for bound inference. /// /// See module-level docs for details. - type Retry: ClassifyResponse, SdkError>; + type Retry: ClassifyRetry, SdkError>; } impl SmithyRetryPolicy for R @@ -143,7 +143,7 @@ where R: tower::retry::Policy, SdkSuccess, SdkError> + Clone, O: ParseHttpResponse> + Send + Sync + Clone + 'static, E: Error, - Retry: ClassifyResponse, SdkError>, + Retry: ClassifyRetry, SdkError>, { type O = O; type E = E; diff --git a/rust-runtime/aws-smithy-client/src/lib.rs b/rust-runtime/aws-smithy-client/src/lib.rs index b5d44612e77..1ab3fb4f864 100644 --- a/rust-runtime/aws-smithy-client/src/lib.rs +++ b/rust-runtime/aws-smithy-client/src/lib.rs @@ -94,7 +94,7 @@ use aws_smithy_http::body::SdkBody; use aws_smithy_http::operation::Operation; use aws_smithy_http::response::ParseHttpResponse; pub use aws_smithy_http::result::{SdkError, SdkSuccess}; -use aws_smithy_http::retry::ClassifyResponse; +use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_http_tower::dispatch::DispatchLayer; use aws_smithy_http_tower::parse_response::ParseResponseLayer; use aws_smithy_types::retry::ProvideErrorKind; diff --git a/rust-runtime/aws-smithy-client/src/retry.rs b/rust-runtime/aws-smithy-client/src/retry.rs index 3c9bdc27c5b..d58194e70eb 100644 --- a/rust-runtime/aws-smithy-client/src/retry.rs +++ b/rust-runtime/aws-smithy-client/src/retry.rs @@ -21,7 +21,7 @@ use crate::{SdkError, SdkSuccess}; use aws_smithy_async::rt::sleep::AsyncSleep; use aws_smithy_http::operation::Operation; -use aws_smithy_http::retry::ClassifyResponse; +use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, RetryKind}; use tracing::Instrument; @@ -364,7 +364,7 @@ impl tower::retry::Policy, SdkSuccess for RetryHandler where Handler: Clone, - R: ClassifyResponse, SdkError>, + R: ClassifyRetry, SdkError>, { type Future = BoxFuture; @@ -373,8 +373,8 @@ where req: &Operation, result: Result<&SdkSuccess, &SdkError>, ) -> Option { - let policy = req.retry_policy(); - let retry_kind = policy.classify(result); + let classifier = req.retry_classifier(); + let retry_kind = classifier.classify_retry(result); self.retry_for(retry_kind) } diff --git a/rust-runtime/aws-smithy-client/src/static_tests.rs b/rust-runtime/aws-smithy-client/src/static_tests.rs index f9835135a3b..4c9ef91bad8 100644 --- a/rust-runtime/aws-smithy-client/src/static_tests.rs +++ b/rust-runtime/aws-smithy-client/src/static_tests.rs @@ -7,6 +7,7 @@ use crate::{Builder, Error, Operation, ParseHttpResponse, ProvideErrorKind}; use aws_smithy_http::operation; +use aws_smithy_http::retry::DefaultResponseRetryClassifier; #[derive(Debug)] #[non_exhaustive] @@ -40,7 +41,7 @@ impl ParseHttpResponse for TestOperation { unreachable!("only used for static tests") } } -pub type ValidTestOperation = Operation; +pub type ValidTestOperation = Operation; // Statically check that a standard retry can actually be used to build a Client. #[allow(dead_code)] diff --git a/rust-runtime/aws-smithy-client/tests/e2e_test.rs b/rust-runtime/aws-smithy-client/tests/e2e_test.rs index c5c4d171793..d2e393f8a80 100644 --- a/rust-runtime/aws-smithy-client/tests/e2e_test.rs +++ b/rust-runtime/aws-smithy-client/tests/e2e_test.rs @@ -3,9 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -use crate::test_operation::{TestOperationParser, TestPolicy}; +use crate::test_operation::{TestOperationParser, TestRetryClassifier}; use aws_smithy_async::rt::sleep::TokioSleep; - use aws_smithy_client::test_connection::TestConnection; use aws_smithy_client::Client; use aws_smithy_http::body::SdkBody; @@ -20,7 +19,7 @@ mod test_operation { use aws_smithy_http::operation; use aws_smithy_http::response::ParseHttpResponse; use aws_smithy_http::result::SdkError; - use aws_smithy_http::retry::ClassifyResponse; + use aws_smithy_http::retry::ClassifyRetry; use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind}; use bytes::Bytes; use std::error::Error; @@ -67,14 +66,14 @@ mod test_operation { } #[derive(Clone)] - pub(super) struct TestPolicy; + pub(super) struct TestRetryClassifier; - impl ClassifyResponse> for TestPolicy + impl ClassifyRetry> for TestRetryClassifier where E: ProvideErrorKind + Debug, T: Debug, { - fn classify(&self, err: Result<&T, &SdkError>) -> RetryKind { + fn classify_retry(&self, err: Result<&T, &SdkError>) -> RetryKind { let kind = match err { Err(SdkError::ServiceError { err, .. }) => err.retryable_error_kind(), Ok(_) => return RetryKind::Unnecessary, @@ -88,14 +87,14 @@ mod test_operation { } } -fn test_operation() -> Operation { +fn test_operation() -> Operation { let req = operation::Request::new( http::Request::builder() .uri("https://test-service.test-region.amazonaws.com/") .body(SdkBody::from("request body")) .unwrap(), ); - Operation::new(req, TestOperationParser).with_retry_policy(TestPolicy) + Operation::new(req, TestOperationParser).with_retry_classifier(TestRetryClassifier) } #[tokio::test] diff --git a/rust-runtime/aws-smithy-http-tower/src/lib.rs b/rust-runtime/aws-smithy-http-tower/src/lib.rs index eefe1bb6139..e79e48d7286 100644 --- a/rust-runtime/aws-smithy-http-tower/src/lib.rs +++ b/rust-runtime/aws-smithy-http-tower/src/lib.rs @@ -62,6 +62,7 @@ mod tests { use aws_smithy_http::operation::{Operation, Request}; use aws_smithy_http::response::ParseStrictResponse; use aws_smithy_http::result::ConnectorError; + use aws_smithy_http::retry::DefaultResponseRetryClassifier; use bytes::Bytes; use http::Response; use std::convert::{Infallible, TryInto}; @@ -102,7 +103,10 @@ mod tests { }); let mut svc = ServiceBuilder::new() - .layer(ParseResponseLayer::::new()) + .layer(ParseResponseLayer::< + TestParseResponse, + DefaultResponseRetryClassifier, + >::new()) .layer(MapRequestLayer::for_mapper(AddHeader)) .layer(DispatchLayer) .service(http_layer); diff --git a/rust-runtime/aws-smithy-http/src/operation.rs b/rust-runtime/aws-smithy-http/src/operation.rs index 4d2bb1a3eb1..7fc7ce51747 100644 --- a/rust-runtime/aws-smithy-http/src/operation.rs +++ b/rust-runtime/aws-smithy-http/src/operation.rs @@ -5,6 +5,7 @@ use crate::body::SdkBody; use crate::property_bag::{PropertyBag, SharedPropertyBag}; +use crate::retry::DefaultResponseRetryClassifier; use aws_smithy_types::date_time::DateTimeFormatError; use http::uri::InvalidUri; use std::borrow::Cow; @@ -42,7 +43,7 @@ impl Metadata { #[derive(Clone, Debug)] pub struct Parts { pub response_handler: H, - pub retry_policy: R, + pub retry_classifier: R, pub metadata: Option, } @@ -166,6 +167,9 @@ impl From for SerializationError { } } +// Generics: +// - H: Response handler +// - R: Implementation of `ClassifyRetry` #[derive(Debug)] pub struct Operation { request: Request, @@ -203,19 +207,19 @@ impl Operation { self } - pub fn with_retry_policy(self, retry_policy: R2) -> Operation { + pub fn with_retry_classifier(self, retry_classifier: R2) -> Operation { Operation { request: self.request, parts: Parts { response_handler: self.parts.response_handler, - retry_policy, + retry_classifier, metadata: self.parts.metadata, }, } } - pub fn retry_policy(&self) -> &R { - &self.parts.retry_policy + pub fn retry_classifier(&self) -> &R { + &self.parts.retry_classifier } pub fn try_clone(&self) -> Option @@ -232,12 +236,15 @@ impl Operation { } impl Operation { - pub fn new(request: Request, response_handler: H) -> Self { + pub fn new( + request: Request, + response_handler: H, + ) -> Operation { Operation { request, parts: Parts { response_handler, - retry_policy: (), + retry_classifier: DefaultResponseRetryClassifier::new(), metadata: None, }, } diff --git a/rust-runtime/aws-smithy-http/src/retry.rs b/rust-runtime/aws-smithy-http/src/retry.rs index 2b133dc13fc..b562b66290b 100644 --- a/rust-runtime/aws-smithy-http/src/retry.rs +++ b/rust-runtime/aws-smithy-http/src/retry.rs @@ -7,14 +7,210 @@ //! //! For protocol agnostic retries, see `aws_smithy_types::Retry`. -use aws_smithy_types::retry::RetryKind; +use crate::operation::Response; +use crate::result::SdkError; +use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind}; -pub trait ClassifyResponse: Clone { - fn classify(&self, response: Result<&T, &E>) -> RetryKind; +/// Classifies what kind of retry is needed for a given `response`. +pub trait ClassifyRetry: Clone { + fn classify_retry(&self, response: Result<&T, &E>) -> RetryKind; } -impl ClassifyResponse for () { - fn classify(&self, _: Result<&T, &E>) -> RetryKind { - RetryKind::Unnecessary +const TRANSIENT_ERROR_STATUS_CODES: &[u16] = &[500, 502, 503, 504]; + +/// The default implementation of [`ClassifyRetry`] for generated clients. +#[derive(Clone, Debug, Default)] +pub struct DefaultResponseRetryClassifier; + +impl DefaultResponseRetryClassifier { + /// Creates a new `DefaultResponseRetryClassifier` + pub fn new() -> Self { + Default::default() + } + + /// Matches on the given `result` and, if possible, returns the underlying cause and the operation response + /// that can be used for further classification logic. Otherwise, it returns a `RetryKind` that should be used + /// for the result. + // + // IMPORTANT: This function is used by the AWS SDK in `aws-http` for the SDK's own response classification logic + #[doc(hidden)] + pub fn try_extract_err_response<'a, T, E>( + result: Result<&T, &'a SdkError>, + ) -> Result<(&'a E, &'a Response), RetryKind> { + match result { + Ok(_) => Err(RetryKind::Unnecessary), + Err(SdkError::ServiceError { err, raw }) => Ok((err, raw)), + Err(SdkError::TimeoutError(_err)) => Err(RetryKind::Error(ErrorKind::TransientError)), + Err(SdkError::DispatchFailure(err)) => { + if err.is_timeout() || err.is_io() { + Err(RetryKind::Error(ErrorKind::TransientError)) + } else if let Some(ek) = err.is_other() { + Err(RetryKind::Error(ek)) + } else { + Err(RetryKind::UnretryableFailure) + } + } + Err(SdkError::ResponseError { .. }) => Err(RetryKind::Error(ErrorKind::TransientError)), + Err(SdkError::ConstructionFailure(_)) => Err(RetryKind::UnretryableFailure), + } + } +} + +impl ClassifyRetry> for DefaultResponseRetryClassifier +where + E: ProvideErrorKind, +{ + fn classify_retry(&self, result: Result<&T, &SdkError>) -> RetryKind { + let (err, response) = match Self::try_extract_err_response(result) { + Ok(extracted) => extracted, + Err(retry_kind) => return retry_kind, + }; + if let Some(kind) = err.retryable_error_kind() { + return RetryKind::Error(kind); + }; + if TRANSIENT_ERROR_STATUS_CODES.contains(&response.http().status().as_u16()) { + return RetryKind::Error(ErrorKind::TransientError); + }; + RetryKind::UnretryableFailure + } +} + +#[cfg(test)] +mod test { + use super::*; + use crate::body::SdkBody; + use crate::operation; + use crate::result::{SdkError, SdkSuccess}; + use crate::retry::ClassifyRetry; + use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, RetryKind}; + use std::fmt; + + #[derive(Debug)] + struct UnmodeledError; + impl fmt::Display for UnmodeledError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "UnmodeledError") + } + } + impl std::error::Error for UnmodeledError {} + + struct CodedError { + code: &'static str, + } + + impl ProvideErrorKind for UnmodeledError { + fn retryable_error_kind(&self) -> Option { + None + } + + fn code(&self) -> Option<&str> { + None + } + } + + impl ProvideErrorKind for CodedError { + fn retryable_error_kind(&self) -> Option { + None + } + + fn code(&self) -> Option<&str> { + Some(self.code) + } + } + + fn make_err( + err: E, + raw: http::Response<&'static str>, + ) -> Result, SdkError> { + Err(SdkError::ServiceError { + err, + raw: operation::Response::new(raw.map(|b| SdkBody::from(b))), + }) + } + + #[test] + fn not_an_error() { + let policy = DefaultResponseRetryClassifier::new(); + let test_response = http::Response::new("OK"); + assert_eq!( + policy.classify_retry(make_err(UnmodeledError, test_response).as_ref()), + RetryKind::UnretryableFailure + ); + } + + #[test] + fn classify_by_response_status() { + let policy = DefaultResponseRetryClassifier::new(); + let test_resp = http::Response::builder() + .status(500) + .body("error!") + .unwrap(); + assert_eq!( + policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()), + RetryKind::Error(ErrorKind::TransientError) + ); + } + + #[test] + fn classify_by_response_status_not_retryable() { + let policy = DefaultResponseRetryClassifier::new(); + let test_resp = http::Response::builder() + .status(408) + .body("error!") + .unwrap(); + assert_eq!( + policy.classify_retry(make_err(UnmodeledError, test_resp).as_ref()), + RetryKind::UnretryableFailure + ); + } + + #[test] + fn classify_by_error_kind() { + struct ModeledRetries; + let test_response = http::Response::new("OK"); + impl ProvideErrorKind for ModeledRetries { + fn retryable_error_kind(&self) -> Option { + Some(ErrorKind::ClientError) + } + + fn code(&self) -> Option<&str> { + // code should not be called when `error_kind` is provided + unimplemented!() + } + } + + let policy = DefaultResponseRetryClassifier::new(); + + assert_eq!( + policy.classify_retry(make_err(ModeledRetries, test_response).as_ref()), + RetryKind::Error(ErrorKind::ClientError) + ); + } + + #[test] + fn classify_response_error() { + let policy = DefaultResponseRetryClassifier::new(); + assert_eq!( + policy.classify_retry( + Result::, SdkError>::Err(SdkError::ResponseError { + err: Box::new(UnmodeledError), + raw: operation::Response::new( + http::Response::new("OK").map(|b| SdkBody::from(b)) + ), + }) + .as_ref() + ), + RetryKind::Error(ErrorKind::TransientError) + ); + } + + #[test] + fn test_timeout_error() { + let policy = DefaultResponseRetryClassifier::new(); + let err: Result<(), SdkError> = Err(SdkError::TimeoutError("blah".into())); + assert_eq!( + policy.classify_retry(err.as_ref()), + RetryKind::Error(ErrorKind::TransientError) + ); } } From e171ce0274dabae71781e014aa84f0efdd1fab21 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Wed, 14 Sep 2022 15:03:12 -0700 Subject: [PATCH 2/3] Move most utils and synthetic traits into core (#1730) - Moves most of the `util` package from `codegen-client` into `codegen-core` - Moves the synthetic traits into `codegen-core` - Consolidates duplicated `RustTypesTest` files - Corrects `lang` -> `rustlang` package name in `codegen-client` tests - Moves `letIf` from `SymbolVisitor` into its own file in `codegen-core` --- .../smithy/rustsdk/AwsEndpointDecorator.kt | 6 ++--- .../rustsdk/AwsFluentClientDecorator.kt | 2 +- .../smithy/rustsdk/AwsPresigningDecorator.kt | 4 ++-- .../smithy/rustsdk/AwsReadmeDecorator.kt | 2 +- .../rustsdk/HttpRequestChecksumDecorator.kt | 8 +++---- .../rustsdk/HttpResponseChecksumDecorator.kt | 8 +++---- .../amazon/smithy/rustsdk/SdkSettings.kt | 2 +- .../smithy/rustsdk/SigV4SigningDecorator.kt | 12 +++++----- .../smithy/rustsdk/UserAgentDecorator.kt | 4 ++-- .../apigateway/ApiGatewayDecorator.kt | 2 +- .../customize/ec2/BoxPrimitiveShapes.kt | 2 +- .../rustsdk/customize/ec2/Ec2Decorator.kt | 2 +- .../customize/glacier/AccountIdAutofill.kt | 2 +- .../customize/glacier/ApiVersionHeader.kt | 2 +- .../customize/route53/Route53Decorator.kt | 6 ++--- .../rustsdk/customize/s3/S3Decorator.kt | 2 +- .../rustsdk/customize/sts/STSDecorator.kt | 4 ++-- .../rustsdk/AwsPresigningDecoratorTest.kt | 4 ++-- .../EndpointConfigCustomizationTest.kt | 2 +- .../customize/ec2/BoxPrimitiveShapesTest.kt | 4 ++-- .../client/rustlang/CargoDependency.kt | 2 +- .../client/rustlang/RustReservedWords.kt | 6 ++--- .../rust/codegen/client/rustlang/RustTypes.kt | 2 +- .../codegen/client/rustlang/RustWriter.kt | 6 ++--- .../codegen/client/smithy/CodegenVisitor.kt | 11 +++++---- .../codegen/client/smithy/CoreRustSettings.kt | 2 +- .../smithy/EventStreamSymbolProvider.kt | 12 +++++----- .../codegen/client/smithy/RuntimeTypes.kt | 2 +- .../smithy/StreamingTraitSymbolProvider.kt | 10 ++++---- .../client/smithy/SymbolMetadataProvider.kt | 2 +- .../codegen/client/smithy/SymbolVisitor.kt | 24 +++++++------------ .../HttpChecksumRequiredGenerator.kt | 6 ++--- .../HttpVersionListCustomization.kt | 4 ++-- .../IdempotencyTokenGenerator.kt | 4 ++-- .../SmithyTypesPubUseGenerator.kt | 4 ++-- .../NoOpEventStreamSigningDecorator.kt | 2 +- .../smithy/customize/RustCodegenDecorator.kt | 2 +- .../smithy/generators/BuilderGenerator.kt | 4 ++-- .../smithy/generators/CargoTomlGenerator.kt | 2 +- .../EndpointTraitBindingGenerator.kt | 2 +- .../client/smithy/generators/EnumGenerator.kt | 8 +++---- .../client/smithy/generators/Instantiator.kt | 10 ++++---- .../smithy/generators/LibRsGenerator.kt | 2 +- .../smithy/generators/PaginatorGenerator.kt | 14 +++++------ .../smithy/generators/ServiceGenerator.kt | 2 +- .../smithy/generators/StructureGenerator.kt | 8 +++---- .../smithy/generators/UnionGenerator.kt | 2 +- .../client/FluentClientGenerator.kt | 8 +++---- .../config/ServiceConfigGenerator.kt | 2 +- .../error/CombinedErrorGenerator.kt | 4 ++-- .../smithy/generators/error/ErrorGenerator.kt | 6 ++--- .../error/ServerCombinedErrorGenerator.kt | 2 +- .../generators/http/HttpBindingGenerator.kt | 16 ++++++------- .../http/RequestBindingGenerator.kt | 6 ++--- .../protocol/MakeOperationGenerator.kt | 10 ++++---- .../generators/protocol/ProtocolGenerator.kt | 2 +- .../protocol/ProtocolTestGenerator.kt | 18 +++++++------- .../client/smithy/protocols/AwsJson.kt | 2 +- .../client/smithy/protocols/AwsQuery.kt | 2 +- .../smithy/protocols/HttpBindingResolver.kt | 6 ++--- .../protocols/HttpBoundProtocolGenerator.kt | 14 +++++------ .../HttpBoundProtocolPayloadGenerator.kt | 22 ++++++++--------- .../smithy/protocols/InlineFunctionNamer.kt | 4 ++-- .../client/smithy/protocols/RestJson.kt | 6 ++--- .../client/smithy/protocols/RestXml.kt | 2 +- .../client/smithy/protocols/XmlNameIndex.kt | 14 +++++------ .../parse/EventStreamUnmarshallerGenerator.kt | 10 ++++---- .../protocols/parse/JsonParserGenerator.kt | 10 ++++---- .../protocols/parse/RestXmlParserGenerator.kt | 8 +++---- .../parse/XmlBindingTraitParserGenerator.kt | 12 +++++----- .../serialize/AwsQuerySerializerGenerator.kt | 2 +- .../serialize/Ec2QuerySerializerGenerator.kt | 2 +- .../EventStreamErrorMarshallerGenerator.kt | 10 ++++---- .../EventStreamMarshallerGenerator.kt | 6 ++--- .../serialize/JsonSerializerGenerator.kt | 12 +++++----- .../serialize/QuerySerializerGenerator.kt | 10 ++++---- .../XmlBindingTraitSerializerGenerator.kt | 12 +++++----- .../smithy/transformers/AddErrorMessage.kt | 4 ++-- .../transformers/EventStreamNormalizer.kt | 12 +++++----- .../transformers/OperationNormalizer.kt | 6 ++--- .../transformers/RecursiveShapeBoxer.kt | 2 +- .../RemoveEventStreamOperations.kt | 4 ++-- .../rust/codegen/client/testutil/Rust.kt | 10 ++++---- .../codegen/client/testutil/TestHelpers.kt | 4 ++-- .../rust/codegen/client/util/Synthetics.kt | 1 + .../HttpVersionListGeneratorTest.kt | 2 +- .../client/generators/EnumGeneratorTest.kt | 6 ++--- .../generators/StructureGeneratorTest.kt | 2 +- .../client/generators/UnionGeneratorTest.kt | 2 +- .../http/RequestBindingGeneratorTest.kt | 4 ++-- .../http/ResponseBindingGeneratorTest.kt | 2 +- .../rust/codegen/client/lang/RustTypesTest.kt | 20 ---------------- .../RustReservedWordSymbolProviderTest.kt | 6 ++--- .../codegen/client/rustlang/RustTypesTest.kt | 8 +++++++ .../{lang => rustlang}/RustWriterTest.kt | 15 ++---------- .../{lang => rustlang}/UseDeclarationsTest.kt | 3 +-- .../StreamingShapeSymbolProviderTest.kt | 2 +- .../generators/CombinedErrorGeneratorTest.kt | 2 +- .../generators/EndpointTraitBindingsTest.kt | 4 ++-- .../smithy/generators/InstantiatorTest.kt | 4 ++-- .../generators/PaginatorGeneratorTest.kt | 2 +- .../config/ServiceConfigGeneratorTest.kt | 2 +- .../error/TopLevelErrorGeneratorTest.kt | 2 +- .../protocol/ProtocolTestGeneratorTest.kt | 8 +++---- .../client/smithy/protocols/AwsQueryTest.kt | 2 +- .../client/smithy/protocols/Ec2QueryTest.kt | 2 +- .../protocols/InlineFunctionNamerTest.kt | 2 +- .../client/smithy/protocols/RestJsonTest.kt | 2 +- .../client/smithy/protocols/RestXmlTest.kt | 2 +- .../parse/AwsQueryParserGeneratorTest.kt | 4 ++-- .../parse/Ec2QueryParserGeneratorTest.kt | 4 ++-- .../parse/JsonParserGeneratorTest.kt | 6 ++--- .../XmlBindingTraitParserGeneratorTest.kt | 6 ++--- .../AwsQuerySerializerGeneratorTest.kt | 6 ++--- .../Ec2QuerySerializerGeneratorTest.kt | 6 ++--- .../serialize/JsonSerializerGeneratorTest.kt | 6 ++--- .../XmlBindingTraitSerializerGeneratorTest.kt | 6 ++--- .../transformers/EventStreamNormalizerTest.kt | 6 ++--- .../transformers/OperationNormalizerTest.kt | 6 ++--- .../transformers/RecursiveShapeBoxerTest.kt | 6 ++--- .../RecursiveShapesIntegrationTest.kt | 4 ++-- .../codegen/client/util/SyntheticsTest.kt | 1 + .../traits/SyntheticEventStreamUnionTrait.kt | 2 +- .../smithy/traits/SyntheticInputTrait.kt | 2 +- .../smithy/traits/SyntheticOutputTrait.kt | 2 +- .../smithy/rust/codegen/core}/util/Exec.kt | 3 +-- .../smithy/rust/codegen/core/util/LetIf.kt | 14 +++++++++++ .../smithy/rust/codegen/core}/util/Map.kt | 2 +- .../smithy/rust/codegen/core}/util/Option.kt | 2 +- .../smithy/rust/codegen/core}/util/Panic.kt | 2 +- .../smithy/rust/codegen/core}/util/Smithy.kt | 6 ++--- .../smithy/rust/codegen/core}/util/Strings.kt | 2 +- .../rust/codegen/core}/util/ExecKtTest.kt | 2 +- .../smithy/rust/codegen/core}/util/MapTest.kt | 2 +- .../rust/codegen/core}/util/StringsTest.kt | 2 +- .../smithy/PythonServerCodegenVisitor.kt | 2 +- .../smithy/PythonServerSymbolProvider.kt | 11 ++++----- .../PythonServerCodegenDecorator.kt | 2 +- .../generators/PythonApplicationGenerator.kt | 8 +++---- .../generators/PythonServerEnumGenerator.kt | 2 +- .../generators/PythonServerModuleGenerator.kt | 2 +- .../PythonServerOperationHandlerGenerator.kt | 2 +- .../PythonServerStructureGenerator.kt | 2 +- .../server/smithy/ServerCodegenVisitor.kt | 6 ++--- .../smithy/generators/ServerEnumGenerator.kt | 2 +- .../ServerHttpSensitivityGenerator.kt | 6 ++--- .../generators/ServerOperationGenerator.kt | 2 +- .../ServerOperationHandlerGenerator.kt | 8 +++---- .../ServerOperationRegistryGenerator.kt | 8 +++---- .../generators/ServerServiceGeneratorV2.kt | 4 ++-- .../protocol/ServerProtocolTestGenerator.kt | 20 ++++++++-------- .../server/smithy/protocols/ServerAwsJson.kt | 2 +- .../ServerHttpBoundProtocolGenerator.kt | 24 +++++++++---------- .../AdditionalErrorsDecoratorTest.kt | 2 +- .../ServerCombinedErrorGeneratorTest.kt | 2 +- .../generators/ServerEnumGeneratorTest.kt | 4 ++-- .../ServerHttpSensitivityGeneratorTest.kt | 4 ++-- .../ServerOperationRegistryGeneratorTest.kt | 2 +- .../smithy/protocols/EventStreamTestTools.kt | 6 ++--- .../EventStreamMarshallerGeneratorTest.kt | 2 +- 160 files changed, 426 insertions(+), 443 deletions(-) delete mode 100644 codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustTypesTest.kt rename codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/{lang => rustlang}/RustWriterTest.kt (87%) rename codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/{lang => rustlang}/UseDeclarationsTest.kt (91%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/smithy/traits/SyntheticEventStreamUnionTrait.kt (89%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/smithy/traits/SyntheticInputTrait.kt (92%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/smithy/traits/SyntheticOutputTrait.kt (92%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/util/Exec.kt (92%) create mode 100644 codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/LetIf.kt rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/util/Map.kt (95%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/util/Option.kt (77%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/util/Panic.kt (88%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/util/Smithy.kt (95%) rename {codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core}/util/Strings.kt (91%) rename {codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core}/util/ExecKtTest.kt (87%) rename {codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core}/util/MapTest.kt (97%) rename {codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client => codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core}/util/StringsTest.kt (90%) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt index bcd99053a32..7fd4d56a834 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt @@ -34,9 +34,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsSection import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ConfigCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ServiceConfig import software.amazon.smithy.rust.codegen.client.smithy.generators.operationBuildError -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.orNull import kotlin.io.path.readText class AwsEndpointDecorator : RustCodegenDecorator { diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt index 746443223bf..8fca9073086 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt @@ -33,7 +33,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.client.Fluen import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerics import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientSection -import software.amazon.smithy.rust.codegen.client.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.expectTrait import software.amazon.smithy.rustsdk.AwsRuntimeType.defaultMiddleware private class Types(runtimeConfig: RuntimeConfig) { diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt index 5fc2483208c..e077de8bd69 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt @@ -39,8 +39,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.error.errorS import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.MakeOperationGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpBoundProtocolPayloadGenerator import software.amazon.smithy.rust.codegen.client.util.cloneOperation -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait import software.amazon.smithy.rustsdk.AwsRuntimeType.defaultMiddleware import software.amazon.smithy.rustsdk.traits.PresignableTrait import kotlin.streams.toList diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt index 872cec7c11a..fe1f1db4e58 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsReadmeDecorator.kt @@ -15,7 +15,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RustCrate import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator import software.amazon.smithy.rust.codegen.client.smithy.generators.ManifestCustomizations -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait import java.util.logging.Logger // Use a sigil that should always be unique in the text to fix line breaks and spaces diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt index 88791adbfce..ba21e3bec37 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpRequestChecksumDecorator.kt @@ -21,10 +21,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCust import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator import software.amazon.smithy.rust.codegen.client.smithy.generators.operationBuildError -import software.amazon.smithy.rust.codegen.client.util.expectMember -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.expectMember +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.orNull fun RuntimeConfig.awsInlineableBodyWithChecksum() = RuntimeType.forInlineDependency( InlineAwsDependency.forRustFile( diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt index 9d85714501b..ecc83f04291 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/HttpResponseChecksumDecorator.kt @@ -15,10 +15,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator -import software.amazon.smithy.rust.codegen.client.util.expectMember -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.expectMember +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.orNull private fun HttpChecksumTrait.requestValidationModeMember( codegenContext: ClientCodegenContext, diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt index 5cb8ccebc57..bf62ecb8639 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SdkSettings.kt @@ -6,7 +6,7 @@ package software.amazon.smithy.rustsdk import software.amazon.smithy.model.node.ObjectNode import software.amazon.smithy.rust.codegen.client.smithy.CoreRustSettings -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.orNull import java.nio.file.Path import java.nio.file.Paths diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt index 0ce13c8d5bf..9f61d1f0683 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt @@ -27,12 +27,12 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSect import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ConfigCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.config.EventStreamSigningConfig -import software.amazon.smithy.rust.codegen.client.smithy.letIf -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasEventStreamOperations -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.isInputEventStream +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasEventStreamOperations +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.isInputEventStream +import software.amazon.smithy.rust.codegen.core.util.letIf /** * The SigV4SigningDecorator: diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt index 31fa610a944..c3a1d5feed8 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt @@ -23,8 +23,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsCustomi import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsSection import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ConfigCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ServiceConfig -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait /** * Inserts a UserAgent configuration into the operation diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/apigateway/ApiGatewayDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/apigateway/ApiGatewayDecorator.kt index d2971c0ff88..449b74b4a08 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/apigateway/ApiGatewayDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/apigateway/ApiGatewayDecorator.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator -import software.amazon.smithy.rust.codegen.client.smithy.letIf +import software.amazon.smithy.rust.codegen.core.util.letIf class ApiGatewayDecorator : RustCodegenDecorator { override val name: String = "ApiGateway" diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapes.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapes.kt index bd830d463e0..77805ee91f2 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapes.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapes.kt @@ -20,7 +20,7 @@ import software.amazon.smithy.model.shapes.Shape import software.amazon.smithy.model.shapes.ShortShape import software.amazon.smithy.model.traits.BoxTrait import software.amazon.smithy.model.transform.ModelTransformer -import software.amazon.smithy.rust.codegen.client.util.UNREACHABLE +import software.amazon.smithy.rust.codegen.core.util.UNREACHABLE import software.amazon.smithy.utils.ToSmithyBuilder object BoxPrimitiveShapes { diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/Ec2Decorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/Ec2Decorator.kt index fb8e67faf94..b1b5f91bb58 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/Ec2Decorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/ec2/Ec2Decorator.kt @@ -11,7 +11,7 @@ import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator -import software.amazon.smithy.rust.codegen.client.smithy.letIf +import software.amazon.smithy.rust.codegen.core.util.letIf class Ec2Decorator : RustCodegenDecorator { override val name: String = "Ec2" diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt index 023aea603d1..af0460cadd9 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/AccountIdAutofill.kt @@ -12,7 +12,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.inputShape class AccountIdAutofill() : OperationCustomization() { override fun mutSelf(): Boolean = true diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/ApiVersionHeader.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/ApiVersionHeader.kt index a3ff2e76ae5..9d29cd826c0 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/ApiVersionHeader.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/glacier/ApiVersionHeader.kt @@ -11,7 +11,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq class ApiVersionHeader( /** diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/route53/Route53Decorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/route53/Route53Decorator.kt index 4e6c988a4d9..4db45856d64 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/route53/Route53Decorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/route53/Route53Decorator.kt @@ -21,9 +21,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator -import software.amazon.smithy.rust.codegen.client.smithy.letIf -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.letIf import software.amazon.smithy.rustsdk.InlineAwsDependency import java.util.logging.Logger diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt index 39bd902d1c7..d64672d96df 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/s3/S3Decorator.kt @@ -27,11 +27,11 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsSection -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.protocols.AllowInvalidXmlRoot import software.amazon.smithy.rust.codegen.client.smithy.protocols.ProtocolMap import software.amazon.smithy.rust.codegen.client.smithy.protocols.RestXml import software.amazon.smithy.rust.codegen.client.smithy.protocols.RestXmlFactory +import software.amazon.smithy.rust.codegen.core.util.letIf import software.amazon.smithy.rustsdk.AwsRuntimeType import java.util.logging.Logger diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/sts/STSDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/sts/STSDecorator.kt index 6dc1ccb36dd..d3ef7f8f702 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/sts/STSDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/customize/sts/STSDecorator.kt @@ -15,8 +15,8 @@ import software.amazon.smithy.model.transform.ModelTransformer import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDecorator -import software.amazon.smithy.rust.codegen.client.smithy.letIf -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.letIf import java.util.logging.Logger class STSDecorator : RustCodegenDecorator { diff --git a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecoratorTest.kt b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecoratorTest.kt index ce9747258dd..7a1460bc1ec 100644 --- a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecoratorTest.kt +++ b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecoratorTest.kt @@ -15,8 +15,8 @@ import software.amazon.smithy.model.shapes.ServiceShape import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.traits.HttpTrait import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.orNull import software.amazon.smithy.rustsdk.traits.PresignableTrait class AwsPresigningDecoratorTest { diff --git a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/EndpointConfigCustomizationTest.kt b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/EndpointConfigCustomizationTest.kt index 47301e19d62..3489bc7c940 100644 --- a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/EndpointConfigCustomizationTest.kt +++ b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/EndpointConfigCustomizationTest.kt @@ -24,7 +24,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext import software.amazon.smithy.rust.codegen.client.testutil.stubConfigCustomization import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand internal class EndpointConfigCustomizationTest { private val placeholderEndpointParams = AwsTestRuntimeConfig.awsEndpoint().asType().member("Params") diff --git a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapesTest.kt b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapesTest.kt index b9674c2b931..1677ea28d0e 100644 --- a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapesTest.kt +++ b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/customize/ec2/BoxPrimitiveShapesTest.kt @@ -10,8 +10,8 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.traits.BoxTrait import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.lookup internal class BoxPrimitiveShapesTest { @Test diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/CargoDependency.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/CargoDependency.kt index 192393792da..18aa5a31941 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/CargoDependency.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/CargoDependency.kt @@ -9,7 +9,7 @@ import software.amazon.smithy.codegen.core.SymbolDependency import software.amazon.smithy.codegen.core.SymbolDependencyContainer import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq import java.nio.file.Path sealed class DependencyScope { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWords.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWords.kt index 9789fa1bf43..becc7c0c1e6 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWords.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWords.kt @@ -18,10 +18,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.MaybeRenamed import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.WrappingSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.generators.UnionGenerator -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.renamedFrom -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.toPascalCase class RustReservedWordSymbolProvider(private val base: RustSymbolProvider, private val model: Model) : WrappingSymbolProvider(base) { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypes.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypes.kt index 6d20af877fa..60819a4c50e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypes.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypes.kt @@ -6,7 +6,7 @@ package software.amazon.smithy.rust.codegen.client.rustlang import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq /** * Dereference [input] diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriter.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriter.kt index 1874c77eb4d..24d59c01ab7 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriter.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriter.kt @@ -22,10 +22,10 @@ import software.amazon.smithy.model.traits.DeprecatedTrait import software.amazon.smithy.model.traits.DocumentationTrait import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.isOptional -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.orNull import software.amazon.smithy.utils.AbstractCodeWriter import java.io.File import java.util.function.BiFunction diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt index 389e332ec30..f160b3d4e1a 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenVisitor.kt @@ -26,16 +26,17 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.implBlock import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.ProtocolGeneratorFactory import software.amazon.smithy.rust.codegen.client.smithy.protocols.ProtocolLoader -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait import software.amazon.smithy.rust.codegen.client.smithy.transformers.AddErrorMessage import software.amazon.smithy.rust.codegen.client.smithy.transformers.EventStreamNormalizer import software.amazon.smithy.rust.codegen.client.smithy.transformers.OperationNormalizer import software.amazon.smithy.rust.codegen.client.smithy.transformers.RecursiveShapeBoxer import software.amazon.smithy.rust.codegen.client.smithy.transformers.RemoveEventStreamOperations -import software.amazon.smithy.rust.codegen.client.util.CommandFailed -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.util.CommandFailed +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.runCommand import java.util.logging.Logger /** diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CoreRustSettings.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CoreRustSettings.kt index d3e6046e491..beac002e1b2 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CoreRustSettings.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CoreRustSettings.kt @@ -12,7 +12,7 @@ import software.amazon.smithy.model.node.StringNode import software.amazon.smithy.model.shapes.ServiceShape import software.amazon.smithy.model.shapes.Shape import software.amazon.smithy.model.shapes.ShapeId -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.orNull import java.util.Optional import java.util.logging.Logger import kotlin.streams.toList diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/EventStreamSymbolProvider.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/EventStreamSymbolProvider.kt index 92799b2f994..2f9d42819d3 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/EventStreamSymbolProvider.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/EventStreamSymbolProvider.kt @@ -16,13 +16,13 @@ import software.amazon.smithy.rust.codegen.client.rustlang.render import software.amazon.smithy.rust.codegen.client.rustlang.stripOuter import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.error.eventStreamErrorSymbol -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait import software.amazon.smithy.rust.codegen.client.smithy.transformers.eventStreamErrors -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.isEventStream -import software.amazon.smithy.rust.codegen.client.util.isInputEventStream -import software.amazon.smithy.rust.codegen.client.util.isOutputEventStream +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.isEventStream +import software.amazon.smithy.rust.codegen.core.util.isInputEventStream +import software.amazon.smithy.rust.codegen.core.util.isOutputEventStream /** * Wrapping symbol provider to wrap modeled types with the aws-smithy-http Event Stream send/receive types. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/RuntimeTypes.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/RuntimeTypes.kt index 63c01fcb25b..66de796b83b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/RuntimeTypes.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/RuntimeTypes.kt @@ -23,8 +23,8 @@ import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rustInlineTemplate import software.amazon.smithy.rust.codegen.client.rustlang.writable -import software.amazon.smithy.rust.codegen.client.util.orNull import software.amazon.smithy.rust.codegen.core.Version +import software.amazon.smithy.rust.codegen.core.util.orNull import java.util.Optional private const val DEFAULT_KEY = "DEFAULT" diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingTraitSymbolProvider.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingTraitSymbolProvider.kt index a92078f6424..88e1ba9511d 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingTraitSymbolProvider.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingTraitSymbolProvider.kt @@ -14,11 +14,11 @@ import software.amazon.smithy.model.shapes.StringShape import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.shapes.UnionShape import software.amazon.smithy.rust.codegen.client.rustlang.RustMetadata -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.isStreaming +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.isStreaming /** * Wrapping symbol provider to change `Blob` to `ByteStream` when it targets a streaming member diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolMetadataProvider.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolMetadataProvider.kt index 1f65db2f90c..8c7d7e70c46 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolMetadataProvider.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolMetadataProvider.kt @@ -19,7 +19,7 @@ import software.amazon.smithy.model.traits.StreamingTrait import software.amazon.smithy.rust.codegen.client.rustlang.Attribute import software.amazon.smithy.rust.codegen.client.rustlang.RustMetadata import software.amazon.smithy.rust.codegen.client.rustlang.Visibility -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait /** * Default delegator to enable easily decorating another symbol provider. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolVisitor.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolVisitor.kt index f6ee87b5de1..e3087f1e21e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolVisitor.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/SymbolVisitor.kt @@ -39,13 +39,14 @@ import software.amazon.smithy.model.traits.EnumTrait import software.amazon.smithy.model.traits.ErrorTrait import software.amazon.smithy.rust.codegen.client.rustlang.RustType import software.amazon.smithy.rust.codegen.client.rustlang.stripOuter -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.toPascalCase -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import kotlin.reflect.KClass /** Map from Smithy Shapes to Rust Types */ @@ -409,12 +410,3 @@ fun Symbol.isRustBoxed(): Boolean = rustType().stripOuter() is // Symbols should _always_ be created with a Rust type & shape attached fun Symbol.rustType(): RustType = this.expectProperty(RUST_TYPE_KEY, RustType::class.java) fun Symbol.shape(): Shape = this.expectProperty(SHAPE_KEY, Shape::class.java) - -/** - * Utility function similar to `let` that conditionally applies [f] only if [cond] is true. - */ -fun T.letIf(cond: Boolean, f: (T) -> T): T { - return if (cond) { - f(this) - } else this -} diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpChecksumRequiredGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpChecksumRequiredGenerator.kt index d134f429c48..5a3ee39e58c 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpChecksumRequiredGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpChecksumRequiredGenerator.kt @@ -18,9 +18,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.generators.operationBuildError -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape class HttpChecksumRequiredGenerator( private val coreCodegenContext: CoreCodegenContext, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpVersionListCustomization.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpVersionListCustomization.kt index 953b98e8adb..ff2c1079f9b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpVersionListCustomization.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpVersionListCustomization.kt @@ -15,8 +15,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.isEventStream +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.isEventStream private fun RuntimeConfig.httpVersionModule(): RuntimeType = RuntimeType("http_versions", this.runtimeCrate("http"), "aws_smithy_http") diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/IdempotencyTokenGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/IdempotencyTokenGenerator.kt index 090f76a6c80..d0bc823a748 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/IdempotencyTokenGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/IdempotencyTokenGenerator.kt @@ -13,8 +13,8 @@ import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationCustomization import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSection -import software.amazon.smithy.rust.codegen.client.util.findMemberWithTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.findMemberWithTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape class IdempotencyTokenGenerator(coreCodegenContext: CoreCodegenContext, private val operationShape: OperationShape) : OperationCustomization() { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/SmithyTypesPubUseGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/SmithyTypesPubUseGenerator.kt index bb294d8453c..94aa834566d 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/SmithyTypesPubUseGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/SmithyTypesPubUseGenerator.kt @@ -17,8 +17,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsSection -import software.amazon.smithy.rust.codegen.client.util.hasEventStreamMember -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasEventStreamMember +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember private data class PubUseType( val type: RuntimeType, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/NoOpEventStreamSigningDecorator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/NoOpEventStreamSigningDecorator.kt index c6c0f805fcb..b6280b75034 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/NoOpEventStreamSigningDecorator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/NoOpEventStreamSigningDecorator.kt @@ -13,7 +13,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ConfigCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.config.EventStreamSigningConfig -import software.amazon.smithy.rust.codegen.client.util.hasEventStreamOperations +import software.amazon.smithy.rust.codegen.core.util.hasEventStreamOperations /** * The NoOpEventStreamSigningDecorator: diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/RustCodegenDecorator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/RustCodegenDecorator.kt index ed8975a7024..edb96225cff 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/RustCodegenDecorator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customize/RustCodegenDecorator.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsCustomi import software.amazon.smithy.rust.codegen.client.smithy.generators.ManifestCustomizations import software.amazon.smithy.rust.codegen.client.smithy.generators.config.ConfigCustomization import software.amazon.smithy.rust.codegen.client.smithy.protocols.ProtocolMap -import software.amazon.smithy.rust.codegen.client.util.deepMergeWith +import software.amazon.smithy.rust.codegen.core.util.deepMergeWith import java.util.ServiceLoader import java.util.logging.Logger diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/BuilderGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/BuilderGenerator.kt index 11df4b09ac4..d9a6d8edaad 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/BuilderGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/BuilderGenerator.kt @@ -32,8 +32,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.expectRustMetadata import software.amazon.smithy.rust.codegen.client.smithy.isOptional import software.amazon.smithy.rust.codegen.client.smithy.makeOptional import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase fun StructureShape.builderSymbol(symbolProvider: RustSymbolProvider): Symbol { val structureSymbol = symbolProvider.toSymbol(this) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CargoTomlGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CargoTomlGenerator.kt index b05a0bafc9e..a6000ad0dc6 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CargoTomlGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CargoTomlGenerator.kt @@ -11,8 +11,8 @@ import software.amazon.smithy.rust.codegen.client.rustlang.DependencyScope import software.amazon.smithy.rust.codegen.client.rustlang.Feature import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter import software.amazon.smithy.rust.codegen.client.smithy.CoreRustSettings -import software.amazon.smithy.rust.codegen.client.util.deepMergeWith import software.amazon.smithy.rust.codegen.core.Version +import software.amazon.smithy.rust.codegen.core.util.deepMergeWith /** * Customizations to apply to the generated Cargo.toml file. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt index d3c8b9034e0..0742725435e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt @@ -18,7 +18,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.generators.http.rustFormatString import software.amazon.smithy.rust.codegen.client.smithy.isOptional -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.inputShape fun EndpointTrait.prefixFormatString(): String { return this.hostPrefix.rustFormatString("", "") diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EnumGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EnumGenerator.kt index 9130e15fbed..1d5447caf3d 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EnumGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EnumGenerator.kt @@ -22,10 +22,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.MaybeRenamed import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.expectRustMetadata -import software.amazon.smithy.rust.codegen.client.util.doubleQuote -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.doubleQuote +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.orNull /** Model that wraps [EnumDefinition] to calculate and cache values required to generate the Rust enum source. */ class EnumMemberModel(private val definition: EnumDefinition, private val symbolProvider: RustSymbolProvider) { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/Instantiator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/Instantiator.kt index a54ab771d82..3cf94d8b71b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/Instantiator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/Instantiator.kt @@ -44,12 +44,12 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.isOptional -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.letIf /** * Instantiator generates code to instantiate a given Shape given a `Node` representing the value diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/LibRsGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/LibRsGenerator.kt index 2df4d03f856..7da60fe44fc 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/LibRsGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/LibRsGenerator.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.smithy.CoreRustSettings import software.amazon.smithy.rust.codegen.client.smithy.customize.NamedSectionGenerator import software.amazon.smithy.rust.codegen.client.smithy.customize.Section -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait sealed class LibRsSection(name: String) : Section(name) { object Attributes : LibRsSection("Attributes") diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt index 9c1873627a3..b0ae7339930 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGenerator.kt @@ -29,13 +29,13 @@ import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerics import software.amazon.smithy.rust.codegen.client.smithy.generators.error.errorSymbol import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.findMemberWithTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.findMemberWithTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toPascalCase // TODO(https://github.com/awslabs/smithy-rs/issues/1013) Support pagination when the idempotency trait is present fun OperationShape.isPaginated(model: Model) = diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ServiceGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ServiceGenerator.kt index 637862e26c3..219d8d08f0e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ServiceGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ServiceGenerator.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.error.TopLev import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolSupport import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolTestGenerator -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.inputShape /** * ServiceGenerator diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/StructureGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/StructureGenerator.kt index 50e5e43b54f..c1b93c72431 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/StructureGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/StructureGenerator.kt @@ -32,10 +32,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.error.ErrorG import software.amazon.smithy.rust.codegen.client.smithy.isOptional import software.amazon.smithy.rust.codegen.client.smithy.renamedFrom import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait fun RustWriter.implBlock(structureShape: Shape, symbolProvider: SymbolProvider, block: RustWriter.() -> Unit) { rustBlock("impl ${symbolProvider.toSymbol(structureShape).name}") { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/UnionGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/UnionGenerator.kt index 5f4c1872d9c..388dc2e14dd 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/UnionGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/UnionGenerator.kt @@ -18,7 +18,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustBlock import software.amazon.smithy.rust.codegen.client.smithy.expectRustMetadata import software.amazon.smithy.rust.codegen.client.smithy.renamedFrom -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase fun CodegenTarget.renderUnknownVariant() = when (this) { CodegenTarget.SERVER -> false diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt index c0e53cf052e..1555af2c175 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt @@ -51,10 +51,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.isPaginated import software.amazon.smithy.rust.codegen.client.smithy.generators.setterName import software.amazon.smithy.rust.codegen.client.smithy.generators.smithyHttp import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase class FluentClientGenerator( private val codegenContext: ClientCodegenContext, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGenerator.kt index ce63b086d7f..68eb2c0001b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGenerator.kt @@ -18,7 +18,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.customize.NamedSectionGenerator import software.amazon.smithy.rust.codegen.client.smithy.customize.Section -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait /** * [ServiceConfig] is the parent type of sections that can be overridden when generating a config for a service. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/CombinedErrorGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/CombinedErrorGenerator.kt index d69981d55d9..86f1c37fd2f 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/CombinedErrorGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/CombinedErrorGenerator.kt @@ -30,8 +30,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.Section import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.transformers.eventStreamErrors import software.amazon.smithy.rust.codegen.client.smithy.transformers.operationErrors -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase /** * For a given Operation ([this]), return the symbol referring to the unified error. This can be used diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ErrorGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ErrorGenerator.kt index e5972af9a72..748e0bff8ae 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ErrorGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ErrorGenerator.kt @@ -19,10 +19,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType.Companion.S import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.isOptional -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.transformers.errorMessageMember -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.letIf sealed class ErrorKind { abstract fun writable(runtimeConfig: RuntimeConfig): Writable diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ServerCombinedErrorGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ServerCombinedErrorGenerator.kt index e78dcddc486..77196149a35 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ServerCombinedErrorGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ServerCombinedErrorGenerator.kt @@ -19,7 +19,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustBlock import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase /** * Generates a unified error enum for [operation]. [ErrorGenerator] handles generating the individual variants, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/HttpBindingGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/HttpBindingGenerator.kt index b9f05a2041b..2de37bbf815 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/HttpBindingGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/HttpBindingGenerator.kt @@ -47,14 +47,14 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.EventStreamUnmarshallerGenerator import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.UNREACHABLE -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.isPrimitive -import software.amazon.smithy.rust.codegen.client.util.isStreaming -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.UNREACHABLE +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.isPrimitive +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase /** * The type of HTTP message from which we are (de)serializing the HTTP-bound data. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt index 2a4e7a603c3..84e3f772133 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt @@ -27,9 +27,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationBui import software.amazon.smithy.rust.codegen.client.smithy.generators.operationBuildError import software.amazon.smithy.rust.codegen.client.smithy.isOptional import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectMember -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectMember +import software.amazon.smithy.rust.codegen.core.util.inputShape fun HttpTrait.uriFormatString(): String { return uri.rustFormatString("/", "/") diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt index 2771e7b3457..a18be2d44ac 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/MakeOperationGenerator.kt @@ -25,13 +25,13 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.OperationSect import software.amazon.smithy.rust.codegen.client.smithy.customize.writeCustomizations import software.amazon.smithy.rust.codegen.client.smithy.generators.http.RequestBindingGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.operationBuildError -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.findStreamingMember -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.findStreamingMember +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.letIf /** Generates the `make_operation` function on input structs */ open class MakeOperationGenerator( diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolGenerator.kt index 82d1432a70d..8a788196f77 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolGenerator.kt @@ -20,7 +20,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.BuilderGener import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.implBlock import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.inputShape /** * Payload Body Generator. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt index 9d61bc81bbc..efc452973e6 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt @@ -36,15 +36,15 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarge import software.amazon.smithy.rust.codegen.client.smithy.generators.Instantiator import software.amazon.smithy.rust.codegen.client.smithy.generators.error.errorSymbol import software.amazon.smithy.rust.codegen.client.testutil.TokioTest -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.findMemberWithTrait -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.isStreaming -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.findMemberWithTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import java.util.logging.Logger data class ProtocolSupport( diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt index c43100c469a..a50da4220ec 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsJson.kt @@ -27,7 +27,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.JsonPar import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.JsonSerializerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.StructuredDataSerializerGenerator -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.inputShape sealed class AwsJsonVersion { abstract val value: String diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt index d749526484a..d0f4ca0c14a 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQuery.kt @@ -25,7 +25,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.AwsQuer import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.AwsQuerySerializerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.StructuredDataSerializerGenerator -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait class AwsQueryFactory : ProtocolGeneratorFactory { override fun protocol(codegenContext: ClientCodegenContext): Protocol = AwsQueryProtocol(codegenContext) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBindingResolver.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBindingResolver.kt index a2795ad1d15..46150481266 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBindingResolver.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBindingResolver.kt @@ -13,9 +13,9 @@ import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ToShapeId import software.amazon.smithy.model.traits.HttpTrait import software.amazon.smithy.model.traits.TimestampFormatTrait -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.orNull typealias HttpLocation = HttpBinding.Location diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt index 607531ffebe..1d63ce1f031 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt @@ -36,13 +36,13 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.setterName import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.transformers.errorMessageMember import software.amazon.smithy.rust.codegen.client.smithy.transformers.operationErrors -import software.amazon.smithy.rust.codegen.client.util.UNREACHABLE -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.isStreaming -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.UNREACHABLE +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase class HttpBoundProtocolGenerator( coreCodegenContext: CoreCodegenContext, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt index 57af610867e..c8f7e855baa 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolPayloadGenerator.kt @@ -33,17 +33,17 @@ import software.amazon.smithy.rust.codegen.client.smithy.isOptional import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.EventStreamErrorMarshallerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.EventStreamMarshallerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.StructuredDataSerializerGenerator -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.UNREACHABLE -import software.amazon.smithy.rust.codegen.client.util.expectMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.isEventStream -import software.amazon.smithy.rust.codegen.client.util.isInputEventStream -import software.amazon.smithy.rust.codegen.client.util.isOutputEventStream -import software.amazon.smithy.rust.codegen.client.util.isStreaming -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.UNREACHABLE +import software.amazon.smithy.rust.codegen.core.util.expectMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.isEventStream +import software.amazon.smithy.rust.codegen.core.util.isInputEventStream +import software.amazon.smithy.rust.codegen.core.util.isOutputEventStream +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase class HttpBoundProtocolPayloadGenerator( coreCodegenContext: CoreCodegenContext, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamer.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamer.kt index ae3a33b3df8..16d1c28668a 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamer.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamer.kt @@ -16,8 +16,8 @@ import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.shapes.UnionShape import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase fun RustSymbolProvider.lensName(prefix: String, root: Shape, path: List): String { val base = shapeFunctionName("${prefix}lens", root) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt index a71c2277ffd..123acd4f5e6 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJson.kt @@ -26,9 +26,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.JsonPar import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.JsonSerializerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.StructuredDataSerializerGenerator -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.outputShape class RestJsonFactory : ProtocolGeneratorFactory { override fun protocol(codegenContext: ClientCodegenContext): Protocol = RestJson(codegenContext) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt index f2cc52023e4..09de074078b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXml.kt @@ -24,7 +24,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.RestXml import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.StructuredDataSerializerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.XmlBindingTraitSerializerGenerator -import software.amazon.smithy.rust.codegen.client.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.expectTrait class RestXmlFactory( private val generator: (ClientCodegenContext) -> Protocol = { RestXml(it) }, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/XmlNameIndex.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/XmlNameIndex.kt index 233a93c0771..a153ba7c65f 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/XmlNameIndex.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/XmlNameIndex.kt @@ -11,13 +11,13 @@ import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.traits.XmlAttributeTrait import software.amazon.smithy.model.traits.XmlNameTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape /** * KnowledgeIndex to determine the name for a given shape based on the XmlName trait and the shape's id. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt index 038f3629dec..2036ca246d9 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt @@ -39,12 +39,12 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.UnionGenerat import software.amazon.smithy.rust.codegen.client.smithy.generators.error.eventStreamErrorSymbol import software.amazon.smithy.rust.codegen.client.smithy.generators.renderUnknownVariant import software.amazon.smithy.rust.codegen.client.smithy.protocols.Protocol -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticEventStreamUnionTrait import software.amazon.smithy.rust.codegen.client.smithy.transformers.eventStreamErrors -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticEventStreamUnionTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.toPascalCase class EventStreamUnmarshallerGenerator( private val protocol: Protocol, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGenerator.kt index b9a7619a88a..2fbf75ba8dd 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGenerator.kt @@ -47,11 +47,11 @@ import software.amazon.smithy.rust.codegen.client.smithy.isRustBoxed import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpBindingResolver import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.client.smithy.protocols.deserializeFunctionName -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape import software.amazon.smithy.utils.StringUtils class JsonParserGenerator( diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/RestXmlParserGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/RestXmlParserGenerator.kt index d632533a98b..b718071c52b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/RestXmlParserGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/RestXmlParserGenerator.kt @@ -9,10 +9,10 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.protocols.AllowInvalidXmlRoot -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.orNull class RestXmlParserGenerator( coreCodegenContext: CoreCodegenContext, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt index 43929fb2cc3..051631d672c 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt @@ -51,12 +51,12 @@ import software.amazon.smithy.rust.codegen.client.smithy.isRustBoxed import software.amazon.smithy.rust.codegen.client.smithy.protocols.XmlMemberIndex import software.amazon.smithy.rust.codegen.client.smithy.protocols.XmlNameIndex import software.amazon.smithy.rust.codegen.client.smithy.protocols.deserializeFunctionName -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape // The string argument is the name of the XML ScopedDecoder to continue parsing from typealias OperationInnerWriteable = RustWriter.(String) -> Unit diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGenerator.kt index da6a1fe8386..25961611e43 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGenerator.kt @@ -12,7 +12,7 @@ import software.amazon.smithy.model.traits.XmlFlattenedTrait import software.amazon.smithy.model.traits.XmlNameTrait import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait class AwsQuerySerializerGenerator(coreCodegenContext: CoreCodegenContext) : QuerySerializerGenerator(coreCodegenContext) { override val protocolName: String get() = "AWS Query" diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGenerator.kt index 24ff2f50350..f340ee05c91 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGenerator.kt @@ -12,7 +12,7 @@ import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.traits.XmlNameTrait import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait import software.amazon.smithy.utils.StringUtils class Ec2QuerySerializerGenerator(coreCodegenContext: CoreCodegenContext) : QuerySerializerGenerator(coreCodegenContext) { diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamErrorMarshallerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamErrorMarshallerGenerator.kt index e96bda36ff6..de02c7561bf 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamErrorMarshallerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamErrorMarshallerGenerator.kt @@ -29,12 +29,12 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.error.eventS import software.amazon.smithy.rust.codegen.client.smithy.generators.renderUnknownVariant import software.amazon.smithy.rust.codegen.client.smithy.generators.unknownVariantError import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticEventStreamUnionTrait import software.amazon.smithy.rust.codegen.client.smithy.transformers.eventStreamErrors -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticEventStreamUnionTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.toPascalCase class EventStreamErrorMarshallerGenerator( private val model: Model, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt index 21f1367fa92..2b3e4616461 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt @@ -39,9 +39,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.renderUnknow import software.amazon.smithy.rust.codegen.client.smithy.generators.unknownVariantError import software.amazon.smithy.rust.codegen.client.smithy.isOptional import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.toPascalCase open class EventStreamMarshallerGenerator( private val model: Model, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGenerator.kt index 7ee33645211..650b079ef11 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGenerator.kt @@ -45,12 +45,12 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpBindingRe import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.client.smithy.protocols.serializeFunctionName import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape /** * Class describing a JSON section that can be used in a customization. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/QuerySerializerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/QuerySerializerGenerator.kt index 9fc5739fe46..4d59e387732 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/QuerySerializerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/QuerySerializerGenerator.kt @@ -40,11 +40,11 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.serializatio import software.amazon.smithy.rust.codegen.client.smithy.isOptional import software.amazon.smithy.rust.codegen.client.smithy.protocols.serializeFunctionName import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.orNull abstract class QuerySerializerGenerator(coreCodegenContext: CoreCodegenContext) : StructuredDataSerializerGenerator { protected data class Context( diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGenerator.kt index ec63267d506..e4270443eb0 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGenerator.kt @@ -43,18 +43,18 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.UnionGenerat import software.amazon.smithy.rust.codegen.client.smithy.generators.renderUnknownVariant import software.amazon.smithy.rust.codegen.client.smithy.generators.serializationError import software.amazon.smithy.rust.codegen.client.smithy.isOptional -import software.amazon.smithy.rust.codegen.client.smithy.letIf import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpBindingResolver import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.client.smithy.protocols.XmlMemberIndex import software.amazon.smithy.rust.codegen.client.smithy.protocols.XmlNameIndex import software.amazon.smithy.rust.codegen.client.smithy.protocols.serializeFunctionName import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.outputShape class XmlBindingTraitSerializerGenerator( coreCodegenContext: CoreCodegenContext, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/AddErrorMessage.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/AddErrorMessage.kt index 7757a5450d6..bfb4163afd7 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/AddErrorMessage.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/AddErrorMessage.kt @@ -11,8 +11,8 @@ import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.traits.ErrorTrait import software.amazon.smithy.model.transform.ModelTransformer -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.orNull import java.util.logging.Logger fun StructureShape.errorMessageMember(): MemberShape? = this.getMember("message").or { this.getMember("Message") }.orNull() diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizer.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizer.kt index c3a3453e5e3..4195891a349 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizer.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizer.kt @@ -15,12 +15,12 @@ import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.shapes.UnionShape import software.amazon.smithy.model.traits.ErrorTrait import software.amazon.smithy.model.transform.ModelTransformer -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticEventStreamUnionTrait -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.isEventStream -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticEventStreamUnionTrait +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.isEventStream +import software.amazon.smithy.rust.codegen.core.util.outputShape /** * Generates synthetic unions to replace the modeled unions for Event Stream types. diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizer.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizer.kt index fbf1f13d0f0..1fae090fd92 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizer.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizer.kt @@ -11,10 +11,10 @@ import software.amazon.smithy.model.shapes.Shape import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.transform.ModelTransformer -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.orNull import software.amazon.smithy.rust.codegen.client.util.rename +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.orNull import java.util.Optional import kotlin.streams.toList diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxer.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxer.kt index 9d7d53d30f8..f14c0e99082 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxer.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxer.kt @@ -14,7 +14,7 @@ import software.amazon.smithy.model.shapes.SetShape import software.amazon.smithy.model.shapes.Shape import software.amazon.smithy.model.transform.ModelTransformer import software.amazon.smithy.rust.codegen.client.smithy.RustBoxTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait object RecursiveShapeBoxer { /** diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RemoveEventStreamOperations.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RemoveEventStreamOperations.kt index b22c5c0de21..aa48d9f0a0c 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RemoveEventStreamOperations.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RemoveEventStreamOperations.kt @@ -10,8 +10,8 @@ import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.transform.ModelTransformer import software.amazon.smithy.rust.codegen.client.smithy.CoreRustSettings -import software.amazon.smithy.rust.codegen.client.util.findStreamingMember -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.findStreamingMember +import software.amazon.smithy.rust.codegen.core.util.orNull import java.util.logging.Logger // TODO(EventStream): [CLEANUP] Remove this class once the Event Stream implementation is stable diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/Rust.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/Rust.kt index 563131c5e46..a3e21dba78e 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/Rust.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/Rust.kt @@ -28,11 +28,11 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RustCrate import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.SymbolVisitorConfig -import software.amazon.smithy.rust.codegen.client.smithy.letIf -import software.amazon.smithy.rust.codegen.client.util.CommandFailed -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.CommandFailed +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.runCommand import java.io.File import java.nio.file.Files.createTempDirectory import java.nio.file.Path diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/TestHelpers.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/TestHelpers.kt index 54c2cf6b387..e5762296b27 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/TestHelpers.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/testutil/TestHelpers.kt @@ -27,8 +27,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.BuilderGener import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.StructureGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.implBlock -import software.amazon.smithy.rust.codegen.client.smithy.letIf -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.letIf import java.io.File val TestRuntimeConfig = diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Synthetics.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Synthetics.kt index 33557a376b2..1f2c99cac57 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Synthetics.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Synthetics.kt @@ -10,6 +10,7 @@ import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.shapes.ToShapeId +import software.amazon.smithy.rust.codegen.core.util.orNull /** * Clones an entire operation and its input/output shapes under a new name. diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/customizations/HttpVersionListGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/customizations/HttpVersionListGeneratorTest.kt index 92b5171830b..ef5188e9bfa 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/customizations/HttpVersionListGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/customizations/HttpVersionListGeneratorTest.kt @@ -23,7 +23,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.AddRustTestsDecorator import software.amazon.smithy.rust.codegen.client.testutil.TokioTest import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand // If any of these tests fail, and you want to understand why, run them with logging: // ``` diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/EnumGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/EnumGeneratorTest.kt index 20d4c3cbc4b..24855a63166 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/EnumGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/EnumGeneratorTest.kt @@ -18,9 +18,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.EnumMemberMo import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.orNull class EnumGeneratorTest { @Nested diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/StructureGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/StructureGeneratorTest.kt index 64456a83d26..00fac0b016c 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/StructureGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/StructureGeneratorTest.kt @@ -25,7 +25,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup class StructureGeneratorTest { companion object { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/UnionGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/UnionGeneratorTest.kt index b9c2b73b152..a05f219b2d1 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/UnionGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/UnionGeneratorTest.kt @@ -14,7 +14,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.UnionGenerat import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup class UnionGeneratorTest { @Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/RequestBindingGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/RequestBindingGeneratorTest.kt index cf79878f81e..e17e79dde9e 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/RequestBindingGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/RequestBindingGeneratorTest.kt @@ -29,8 +29,8 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait class RequestBindingGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/ResponseBindingGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/ResponseBindingGeneratorTest.kt index 551d81e1b54..03486aab4a0 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/ResponseBindingGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/generators/http/ResponseBindingGeneratorTest.kt @@ -26,7 +26,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape class ResponseBindingGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustTypesTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustTypesTest.kt deleted file mode 100644 index d627e275f57..00000000000 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustTypesTest.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -package software.amazon.smithy.rust.codegen.client.lang - -import io.kotest.matchers.shouldBe -import org.junit.jupiter.api.Test -import software.amazon.smithy.rust.codegen.client.rustlang.RustType -import software.amazon.smithy.rust.codegen.client.rustlang.render - -class RustTypesTest { - @Test - fun `types render properly`() { - val type = RustType.Box(RustType.Option(RustType.Reference("a", RustType.Vec(RustType.String)))) - type.render(false) shouldBe "Box>>" - type.render(true) shouldBe "std::boxed::Box>>" - } -} diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWordSymbolProviderTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWordSymbolProviderTest.kt index 8b9cd070598..ba0849d1c17 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWordSymbolProviderTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustReservedWordSymbolProviderTest.kt @@ -15,9 +15,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.MaybeRenamed import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.SymbolVisitorConfig import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.PANIC -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.PANIC +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.toPascalCase internal class RustReservedWordSymbolProviderTest { class Stub : RustSymbolProvider { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypesTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypesTest.kt index cfec6003fc5..9f9dafc0c31 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypesTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustTypesTest.kt @@ -5,6 +5,7 @@ package software.amazon.smithy.rust.codegen.client.rustlang +import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain import org.junit.jupiter.api.Test @@ -132,4 +133,11 @@ internal class RustTypesTest { "'dyn foo::Foo'", ) } + + @Test + fun `types render properly`() { + val type = RustType.Box(RustType.Option(RustType.Reference("a", RustType.Vec(RustType.String)))) + type.render(false) shouldBe "Box>>" + type.render(true) shouldBe "std::boxed::Box>>" + } } diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustWriterTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriterTest.kt similarity index 87% rename from codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustWriterTest.kt rename to codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriterTest.kt index 1a7f7ccca7a..aa88fca2f31 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/RustWriterTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustWriterTest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.lang +package software.amazon.smithy.rust.codegen.client.rustlang import io.kotest.matchers.collections.shouldContain import io.kotest.matchers.shouldBe @@ -15,24 +15,13 @@ import software.amazon.smithy.model.Model import software.amazon.smithy.model.shapes.SetShape import software.amazon.smithy.model.shapes.StringShape import software.amazon.smithy.model.shapes.StructureShape -import software.amazon.smithy.rust.codegen.client.rustlang.Attribute -import software.amazon.smithy.rust.codegen.client.rustlang.CargoDependency -import software.amazon.smithy.rust.codegen.client.rustlang.RustType -import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter -import software.amazon.smithy.rust.codegen.client.rustlang.asType -import software.amazon.smithy.rust.codegen.client.rustlang.docs -import software.amazon.smithy.rust.codegen.client.rustlang.isEmpty -import software.amazon.smithy.rust.codegen.client.rustlang.rust -import software.amazon.smithy.rust.codegen.client.rustlang.rustBlock -import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate -import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndRun import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.shouldCompile import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup class RustWriterTest { @Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/UseDeclarationsTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/UseDeclarationsTest.kt similarity index 91% rename from codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/UseDeclarationsTest.kt rename to codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/UseDeclarationsTest.kt index 3b46f1f03c9..da53e8a05f3 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/lang/UseDeclarationsTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/UseDeclarationsTest.kt @@ -3,11 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.lang +package software.amazon.smithy.rust.codegen.client.rustlang import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test -import software.amazon.smithy.rust.codegen.client.rustlang.UseDeclarations import software.amazon.smithy.rust.codegen.client.testutil.shouldCompile class UseDeclarationsTest { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt index 54e0af3fcb8..2af307a9432 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt @@ -11,7 +11,7 @@ import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.rust.codegen.client.smithy.transformers.OperationNormalizer import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup internal class StreamingShapeSymbolProviderTest { val model = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CombinedErrorGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CombinedErrorGeneratorTest.kt index 311ae8de22b..099b8a452c9 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CombinedErrorGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/CombinedErrorGeneratorTest.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilder import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup class CombinedErrorGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt index 633c4d3fb95..6a9e859e5d7 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt @@ -28,8 +28,8 @@ import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.runCommand import kotlin.io.path.ExperimentalPathApi internal class EndpointTraitBindingsTest { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/InstantiatorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/InstantiatorTest.kt index 5c1c009c4db..b164a32a6a2 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/InstantiatorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/InstantiatorTest.kt @@ -23,8 +23,8 @@ import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilder import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.lookup class InstantiatorTest { private val model = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGeneratorTest.kt index 0a55737fcd7..6b4366b4989 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/PaginatorGeneratorTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.smithy.RustCodegenPlugin import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand internal class PaginatorGeneratorTest { private val model = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGeneratorTest.kt index c5d336a6a34..2f7fbf656d0 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/config/ServiceConfigGeneratorTest.kt @@ -18,7 +18,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup internal class ServiceConfigGeneratorTest { @Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/TopLevelErrorGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/TopLevelErrorGeneratorTest.kt index 27aede14dc4..1cf32633b37 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/TopLevelErrorGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/TopLevelErrorGeneratorTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.smithy.RustCodegenPlugin import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand import kotlin.io.path.ExperimentalPathApi import kotlin.io.path.createDirectory import kotlin.io.path.writeText diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGeneratorTest.kt index e18326726fe..03d27153075 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGeneratorTest.kt @@ -28,10 +28,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.ProtocolMap import software.amazon.smithy.rust.codegen.client.smithy.protocols.RestJson import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.CommandFailed -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.CommandFailed +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.runCommand import java.nio.file.Path private class TestProtocolPayloadGenerator(private val body: String) : ProtocolPayloadGenerator { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryTest.kt index 59889d1bc37..09b103df239 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.smithy.RustCodegenPlugin import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand class AwsQueryTest { private val model = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2QueryTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2QueryTest.kt index 7ffbf7448c4..d7efcefa14e 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2QueryTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/Ec2QueryTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.smithy.RustCodegenPlugin import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand class Ec2QueryTest { private val model = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamerTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamerTest.kt index 31526946320..996d4453402 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamerTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/InlineFunctionNamerTest.kt @@ -10,7 +10,7 @@ import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup class InlineFunctionNamerTest { private val testModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJsonTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJsonTest.kt index 0042720103b..9790ecb71fa 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJsonTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestJsonTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.smithy.RustCodegenPlugin import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand internal class RestJsonTest { val model = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXmlTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXmlTest.kt index 58b640c95d5..4bf4f747aad 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXmlTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/RestXmlTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.rust.codegen.client.smithy.RustCodegenPlugin import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.generatePluginContext -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.runCommand internal class RestXmlTest { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/AwsQueryParserGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/AwsQueryParserGeneratorTest.kt index e3fe0df8e6a..9e3258e8e2d 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/AwsQueryParserGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/AwsQueryParserGeneratorTest.kt @@ -20,8 +20,8 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.outputShape class AwsQueryParserGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/Ec2QueryParserGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/Ec2QueryParserGeneratorTest.kt index 37852525dbd..8ad6273857e 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/Ec2QueryParserGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/Ec2QueryParserGeneratorTest.kt @@ -20,8 +20,8 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.outputShape class Ec2QueryParserGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGeneratorTest.kt index 1b50162dd9b..dd757fefaa2 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/JsonParserGeneratorTest.kt @@ -24,9 +24,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.outputShape class JsonParserGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGeneratorTest.kt index 4b584ba933d..6cb3b5aba9a 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/parse/XmlBindingTraitParserGeneratorTest.kt @@ -23,9 +23,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.outputShape internal class XmlBindingTraitParserGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGeneratorTest.kt index cce30780872..e31e0ea2729 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/AwsQuerySerializerGeneratorTest.kt @@ -23,9 +23,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.lookup class AwsQuerySerializerGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGeneratorTest.kt index c12f1ecef26..ca9bb6fd6a4 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/Ec2QuerySerializerGeneratorTest.kt @@ -21,9 +21,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.lookup class Ec2QuerySerializerGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGeneratorTest.kt index 9fb394e813b..56bc924f7aa 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/JsonSerializerGeneratorTest.kt @@ -24,9 +24,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.lookup class JsonSerializerGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGeneratorTest.kt index dbab25d7dbd..d4ad16fb3bb 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/serialize/XmlBindingTraitSerializerGeneratorTest.kt @@ -23,9 +23,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilde import software.amazon.smithy.rust.codegen.client.testutil.testCodegenContext import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.lookup internal class XmlBindingTraitSerializerGeneratorTest { private val baseModel = """ diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizerTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizerTest.kt index 0337266eedc..a24c579453a 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizerTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/EventStreamNormalizerTest.kt @@ -9,10 +9,10 @@ import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.UnionShape -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticEventStreamUnionTrait import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticEventStreamUnionTrait +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait class EventStreamNormalizerTest { @Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizerTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizerTest.kt index c774b68c6ab..e2110779269 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizerTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/OperationNormalizerTest.kt @@ -11,11 +11,11 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.orNull +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.orNull internal class OperationNormalizerTest { @Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxerTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxerTest.kt index 9729f6c0d71..4ec569e8a23 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxerTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapeBoxerTest.kt @@ -10,9 +10,9 @@ import org.junit.jupiter.api.Test import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.rust.codegen.client.smithy.RustBoxTrait import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.lookup import kotlin.streams.toList internal class RecursiveShapeBoxerTest { diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapesIntegrationTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapesIntegrationTest.kt index 25f0b7e18f6..00574e930f0 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapesIntegrationTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/transformers/RecursiveShapesIntegrationTest.kt @@ -16,8 +16,8 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.UnionGenerat import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.CommandFailed -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.CommandFailed +import software.amazon.smithy.rust.codegen.core.util.lookup class RecursiveShapesIntegrationTest { @Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/SyntheticsTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/SyntheticsTest.kt index f2751374b15..a2058bc83c5 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/SyntheticsTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/SyntheticsTest.kt @@ -11,6 +11,7 @@ import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel +import software.amazon.smithy.rust.codegen.core.util.orNull class SyntheticsTest { @Test diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticEventStreamUnionTrait.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticEventStreamUnionTrait.kt similarity index 89% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticEventStreamUnionTrait.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticEventStreamUnionTrait.kt index 53b89b0d41e..a609a59fdfe 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticEventStreamUnionTrait.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticEventStreamUnionTrait.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.smithy.traits +package software.amazon.smithy.rust.codegen.core.smithy.traits import software.amazon.smithy.model.node.Node import software.amazon.smithy.model.shapes.MemberShape diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticInputTrait.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticInputTrait.kt similarity index 92% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticInputTrait.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticInputTrait.kt index 18ef0ec6e9c..e4b95f5cde2 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticInputTrait.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticInputTrait.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.smithy.traits +package software.amazon.smithy.rust.codegen.core.smithy.traits import software.amazon.smithy.model.node.Node import software.amazon.smithy.model.shapes.ShapeId diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticOutputTrait.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticOutputTrait.kt similarity index 92% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticOutputTrait.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticOutputTrait.kt index 955e3bb9416..ba086f9cb6a 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/traits/SyntheticOutputTrait.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/traits/SyntheticOutputTrait.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.smithy.traits +package software.amazon.smithy.rust.codegen.core.smithy.traits import software.amazon.smithy.model.node.Node import software.amazon.smithy.model.shapes.ShapeId diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Exec.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Exec.kt similarity index 92% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Exec.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Exec.kt index 3090407fc28..7609e950a2c 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Exec.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Exec.kt @@ -3,9 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util -import software.amazon.smithy.rust.codegen.client.smithy.letIf import java.io.IOException import java.nio.file.Path import java.util.concurrent.TimeUnit diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/LetIf.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/LetIf.kt new file mode 100644 index 00000000000..d02f925c68d --- /dev/null +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/LetIf.kt @@ -0,0 +1,14 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package software.amazon.smithy.rust.codegen.core.util + +/** + * Utility function similar to `let` that conditionally applies [f] only if [cond] is true. + */ +fun T.letIf(cond: Boolean, f: (T) -> T): T { + return if (cond) { + f(this) + } else this +} diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Map.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Map.kt similarity index 95% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Map.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Map.kt index 7016551d91d..a326ee67ff4 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Map.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Map.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import kotlin.collections.Map diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Option.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Option.kt similarity index 77% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Option.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Option.kt index 517518b0c9a..311fe119813 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Option.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Option.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import java.util.Optional diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Panic.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Panic.kt similarity index 88% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Panic.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Panic.kt index 96c00f706ef..b7dc3e681c1 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Panic.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Panic.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util /** Something has gone horribly wrong due to a coding error */ fun PANIC(reason: String): Nothing = throw RuntimeException(reason) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Smithy.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Smithy.kt similarity index 95% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Smithy.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Smithy.kt index 822c5b2cd58..e7b78944784 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Smithy.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Smithy.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import software.amazon.smithy.codegen.core.CodegenException import software.amazon.smithy.model.Model @@ -18,8 +18,8 @@ import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.model.shapes.UnionShape import software.amazon.smithy.model.traits.StreamingTrait import software.amazon.smithy.model.traits.Trait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait inline fun Model.lookup(shapeId: String): T { return this.expectShape(ShapeId.from(shapeId), T::class.java) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Strings.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Strings.kt similarity index 91% rename from codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Strings.kt rename to codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Strings.kt index e5788f5499e..1fcf080884b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/util/Strings.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/util/Strings.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import software.amazon.smithy.utils.CaseUtils import software.amazon.smithy.utils.StringUtils diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/ExecKtTest.kt b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/ExecKtTest.kt similarity index 87% rename from codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/ExecKtTest.kt rename to codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/ExecKtTest.kt index 0629351f2a6..aab2b706130 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/ExecKtTest.kt +++ b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/ExecKtTest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import io.kotest.assertions.throwables.shouldThrow import org.junit.jupiter.api.Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/MapTest.kt b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/MapTest.kt similarity index 97% rename from codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/MapTest.kt rename to codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/MapTest.kt index 715f46ae105..a38499de36b 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/MapTest.kt +++ b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/MapTest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/StringsTest.kt b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/StringsTest.kt similarity index 90% rename from codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/StringsTest.kt rename to codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/StringsTest.kt index cd98ca82140..ff029c0e182 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/util/StringsTest.kt +++ b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/util/StringsTest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package software.amazon.smithy.rust.codegen.client.util +package software.amazon.smithy.rust.codegen.core.util import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt index 1f894ea4ada..3c37204bd88 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerCodegenVisitor.kt @@ -21,7 +21,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDe import software.amazon.smithy.rust.codegen.client.smithy.generators.BuilderGenerator import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.implBlock -import software.amazon.smithy.rust.codegen.client.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.getTrait import software.amazon.smithy.rust.codegen.server.python.smithy.generators.PythonServerEnumGenerator import software.amazon.smithy.rust.codegen.server.python.smithy.generators.PythonServerServiceGenerator import software.amazon.smithy.rust.codegen.server.python.smithy.generators.PythonServerStructureGenerator diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerSymbolProvider.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerSymbolProvider.kt index d7f400312f7..ba298b536e8 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerSymbolProvider.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/PythonServerSymbolProvider.kt @@ -22,12 +22,11 @@ import software.amazon.smithy.rust.codegen.client.smithy.SymbolMetadataProvider import software.amazon.smithy.rust.codegen.client.smithy.SymbolVisitor import software.amazon.smithy.rust.codegen.client.smithy.SymbolVisitorConfig import software.amazon.smithy.rust.codegen.client.smithy.expectRustMetadata -import software.amazon.smithy.rust.codegen.client.smithy.shape -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticOutputTrait -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.isStreaming +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticOutputTrait +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.isStreaming import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerRuntimeType /** diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt index f6f8e0bb58b..9ab914f01b9 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt @@ -18,7 +18,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.customize.RustCodegenDe import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsCustomization import software.amazon.smithy.rust.codegen.client.smithy.generators.LibRsSection import software.amazon.smithy.rust.codegen.client.smithy.generators.ManifestCustomizations -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerRuntimeType import software.amazon.smithy.rust.codegen.server.python.smithy.generators.PythonServerModuleGenerator import software.amazon.smithy.rust.codegen.server.smithy.customizations.AddInternalServerErrorToAllOperationsDecorator diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonApplicationGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonApplicationGenerator.kt index 515bfe764d5..a55cb4f23dd 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonApplicationGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonApplicationGenerator.kt @@ -17,10 +17,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.Errors import software.amazon.smithy.rust.codegen.client.smithy.Inputs import software.amazon.smithy.rust.codegen.client.smithy.Outputs -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEnumGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEnumGenerator.kt index 970e40745b5..68aa3153904 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEnumGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEnumGenerator.kt @@ -18,7 +18,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerEnumGenerator diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt index 5e9eca83ff5..cf9631047d6 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerModuleGenerator.kt @@ -17,7 +17,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rustBlockTemplate import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.smithy.RustCrate import software.amazon.smithy.rust.codegen.client.smithy.ServerCodegenContext -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerCargoDependency class PythonServerModuleGenerator( diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerOperationHandlerGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerOperationHandlerGenerator.kt index 16a3eed716f..c624cb13851 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerOperationHandlerGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerOperationHandlerGenerator.kt @@ -12,7 +12,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.asType import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerOperationHandlerGenerator diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerStructureGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerStructureGenerator.kt index a336e4efa4b..03e512d12a1 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerStructureGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerStructureGenerator.kt @@ -21,7 +21,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.generators.StructureGenerator import software.amazon.smithy.rust.codegen.client.smithy.rustType -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait import software.amazon.smithy.rust.codegen.server.python.smithy.PythonServerCargoDependency /** diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt index 921ce79aaeb..d4cc3162442 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt @@ -35,9 +35,9 @@ import software.amazon.smithy.rust.codegen.client.smithy.transformers.EventStrea import software.amazon.smithy.rust.codegen.client.smithy.transformers.OperationNormalizer import software.amazon.smithy.rust.codegen.client.smithy.transformers.RecursiveShapeBoxer import software.amazon.smithy.rust.codegen.client.smithy.transformers.RemoveEventStreamOperations -import software.amazon.smithy.rust.codegen.client.util.CommandFailed -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.runCommand +import software.amazon.smithy.rust.codegen.core.util.CommandFailed +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.runCommand import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerEnumGenerator import software.amazon.smithy.rust.codegen.server.smithy.generators.ServerServiceGenerator import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGenerator.kt index e4fd95a3e62..6ace15f028c 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGenerator.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.RustSymbolProvider import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.EnumGenerator -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType open class ServerEnumGenerator( diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGenerator.kt index 625988fd0e2..4135ce384ad 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGenerator.kt @@ -31,9 +31,9 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rustBlockTemplate import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.rustlang.withBlock import software.amazon.smithy.rust.codegen.client.smithy.RuntimeConfig -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import java.util.* diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationGenerator.kt index 786f6117985..d638a3976f5 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationGenerator.kt @@ -14,7 +14,7 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.toPascalCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency class ServerOperationGenerator( diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationHandlerGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationHandlerGenerator.kt index 69c7dd1eb2c..9e07d4bc489 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationHandlerGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationHandlerGenerator.kt @@ -16,10 +16,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.error.errorSymbol import software.amazon.smithy.rust.codegen.client.smithy.transformers.operationErrors -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toPascalCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType import software.amazon.smithy.rust.codegen.server.smithy.protocols.ServerHttpBoundProtocolGenerator diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt index aa5f25e3c93..e7556953778 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGenerator.kt @@ -28,10 +28,10 @@ import software.amazon.smithy.rust.codegen.client.smithy.Outputs import software.amazon.smithy.rust.codegen.client.smithy.RuntimeType import software.amazon.smithy.rust.codegen.client.smithy.generators.CodegenTarget import software.amazon.smithy.rust.codegen.client.smithy.generators.error.errorSymbol -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt index 7e93e79caad..05bcc1937e8 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt @@ -17,8 +17,8 @@ import software.amazon.smithy.rust.codegen.client.rustlang.rust import software.amazon.smithy.rust.codegen.client.rustlang.rustTemplate import software.amazon.smithy.rust.codegen.client.rustlang.writable import software.amazon.smithy.rust.codegen.client.smithy.CoreCodegenContext -import software.amazon.smithy.rust.codegen.client.util.toPascalCase -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt index 830f0e07716..237b38aa44f 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt @@ -44,16 +44,16 @@ import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.Pro import software.amazon.smithy.rust.codegen.client.smithy.generators.protocol.ProtocolSupport import software.amazon.smithy.rust.codegen.client.smithy.transformers.allErrors import software.amazon.smithy.rust.codegen.client.testutil.TokioTest -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.isStreaming -import software.amazon.smithy.rust.codegen.client.util.orNull -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toPascalCase -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType import software.amazon.smithy.rust.codegen.server.smithy.protocols.ServerHttpBoundProtocolGenerator diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerAwsJson.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerAwsJson.kt index b1b4d86f0d7..c93caca67ff 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerAwsJson.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerAwsJson.kt @@ -21,7 +21,7 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.Jso import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.JsonSection import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.JsonSerializerGenerator import software.amazon.smithy.rust.codegen.client.smithy.protocols.serialize.StructuredDataSerializerGenerator -import software.amazon.smithy.rust.codegen.client.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.hasTrait import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerAwsJsonProtocol import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt index 391441d7911..ce26142120b 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt @@ -60,20 +60,20 @@ import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpBoundProt import software.amazon.smithy.rust.codegen.client.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.client.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.client.smithy.toOptional -import software.amazon.smithy.rust.codegen.client.smithy.traits.SyntheticInputTrait import software.amazon.smithy.rust.codegen.client.smithy.transformers.operationErrors import software.amazon.smithy.rust.codegen.client.smithy.wrapOptional -import software.amazon.smithy.rust.codegen.client.util.dq -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.findStreamingMember -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.hasStreamingMember -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape -import software.amazon.smithy.rust.codegen.client.util.isStreaming -import software.amazon.smithy.rust.codegen.client.util.outputShape -import software.amazon.smithy.rust.codegen.client.util.toPascalCase -import software.amazon.smithy.rust.codegen.client.util.toSnakeCase +import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.findStreamingMember +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.hasStreamingMember +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.isStreaming +import software.amazon.smithy.rust.codegen.core.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.toPascalCase +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.ServerRuntimeType import software.amazon.smithy.rust.codegen.server.smithy.generators.http.ServerRequestBindingGenerator diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/AdditionalErrorsDecoratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/AdditionalErrorsDecoratorTest.kt index d419c2b318d..a1d1a7d7a8c 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/AdditionalErrorsDecoratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/AdditionalErrorsDecoratorTest.kt @@ -11,7 +11,7 @@ import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ServiceShape import software.amazon.smithy.rust.codegen.client.smithy.transformers.OperationNormalizer import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup class AdditionalErrorsDecoratorTest { private val baseModel = """ diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerCombinedErrorGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerCombinedErrorGeneratorTest.kt index e67fa2e1ee7..bbd64783cb3 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerCombinedErrorGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerCombinedErrorGeneratorTest.kt @@ -16,7 +16,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilder import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverTestSymbolProvider class ServerCombinedErrorGeneratorTest { diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGeneratorTest.kt index 7e46930827b..1f972cb3165 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerEnumGeneratorTest.kt @@ -12,8 +12,8 @@ import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter import software.amazon.smithy.rust.codegen.client.testutil.TestRuntimeConfig import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest -import software.amazon.smithy.rust.codegen.client.util.expectTrait -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.lookup import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverTestSymbolProvider class ServerEnumGeneratorTest { diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGeneratorTest.kt index 319b302439e..7d3db149da3 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerHttpSensitivityGeneratorTest.kt @@ -21,8 +21,8 @@ import software.amazon.smithy.rust.codegen.client.testutil.TestWorkspace import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.getTrait -import software.amazon.smithy.rust.codegen.client.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.getTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape import software.amazon.smithy.rust.codegen.server.smithy.ServerCargoDependency import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverTestSymbolProvider diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt index d0b08053aa9..ebf9b67ab60 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerOperationRegistryGeneratorTest.kt @@ -11,7 +11,7 @@ import software.amazon.smithy.model.knowledge.TopDownIndex import software.amazon.smithy.model.shapes.ServiceShape import software.amazon.smithy.rust.codegen.client.rustlang.RustWriter import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel -import software.amazon.smithy.rust.codegen.client.util.lookup +import software.amazon.smithy.rust.codegen.core.util.lookup import software.amazon.smithy.rust.codegen.server.smithy.generators.protocol.ServerProtocol import software.amazon.smithy.rust.codegen.server.smithy.protocols.ServerProtocolLoader import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverTestCodegenContext diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/EventStreamTestTools.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/EventStreamTestTools.kt index a441a0886e5..868a2898e4c 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/EventStreamTestTools.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/EventStreamTestTools.kt @@ -42,9 +42,9 @@ import software.amazon.smithy.rust.codegen.client.testutil.TestWriterDelegator import software.amazon.smithy.rust.codegen.client.testutil.asSmithyModel import software.amazon.smithy.rust.codegen.client.testutil.renderWithModelBuilder import software.amazon.smithy.rust.codegen.client.testutil.testSymbolProvider -import software.amazon.smithy.rust.codegen.client.util.hasTrait -import software.amazon.smithy.rust.codegen.client.util.lookup -import software.amazon.smithy.rust.codegen.client.util.outputShape +import software.amazon.smithy.rust.codegen.core.util.hasTrait +import software.amazon.smithy.rust.codegen.core.util.lookup +import software.amazon.smithy.rust.codegen.core.util.outputShape import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverTestSymbolProvider import java.util.stream.Stream import kotlin.streams.toList diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/serialize/EventStreamMarshallerGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/serialize/EventStreamMarshallerGeneratorTest.kt index cd0c5cbae1b..97c57d46159 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/serialize/EventStreamMarshallerGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/serialize/EventStreamMarshallerGeneratorTest.kt @@ -17,7 +17,7 @@ import software.amazon.smithy.rust.codegen.client.testutil.TestRuntimeConfig import software.amazon.smithy.rust.codegen.client.testutil.compileAndTest import software.amazon.smithy.rust.codegen.client.testutil.testRustSettings import software.amazon.smithy.rust.codegen.client.testutil.unitTest -import software.amazon.smithy.rust.codegen.client.util.dq +import software.amazon.smithy.rust.codegen.core.util.dq import software.amazon.smithy.rust.codegen.smithy.protocols.EventStreamTestModels import software.amazon.smithy.rust.codegen.smithy.protocols.EventStreamTestTools From c52bb03e415df1e78335474a88b3051d06f64ad0 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Thu, 15 Sep 2022 09:13:37 -0700 Subject: [PATCH 3/3] Update CODEOWNERS (#1737) --- CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 926764c9f31..e64917ef570 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,5 +1,6 @@ * @awslabs/rust-sdk-owners -/codegen/ @awslabs/rust-sdk-owners @crisidev @david-perez +/buildSrc/ @awslabs/rust-sdk-owners @crisidev @david-perez +/codegen-core/ @awslabs/rust-sdk-owners @crisidev @david-perez /codegen-server/ @awslabs/smithy-rs-server /codegen-server-test/ @awslabs/smithy-rs-server /rust-runtime/aws-smithy-http-server/ @awslabs/smithy-rs-server